ruby-gnome2-all-2.2.5/0000755000175000017500000000000012516441037012615 5ustar koukouruby-gnome2-all-2.2.5/AUTHORS0000644000175000017500000000703411701304107013660 0ustar koukouThe Ruby-GNOME2 Project Team (in alphabetical order, M:Maintainer) ------------------------------------------------------------------------ Chikara Takamatsu Japanese Website, Website Guillaume Cottenceau Ruby/GLib, Ruby/GTK, Website. Dario Linsky German Website(M). Franz Burgmann German Website, Website, Provides some binary packages. Hiroshi IGARASHI rbbr, Technical advisor. Geoff Youngs Ruby/GTK, Ruby/GdkPixbuf, Ruby/GtkSourceView, Ruby/Pango, Ruby/GLib. Ruby-GNOME2 Icon, Website. Joachim Glauche Releases(M), since 0.17.0 Joao Pedrosa Portuguese-BR Website(M), Website, Ruby/GTK. Joshua Keith Tutorial, Website, Ruby-GNOME2 Icon. Junichiro Kita Ruby/GTK Tutorial(Japanese) (M) KATO Kazuyoshi Ruby/GTK(mainly gtk-demo), Ruby/GdkPixbuf, Ruby/GLib, Ruby/Libart. Kouhei Sutou Ruby/GnomePrint(M), Ruby/GnomePrintUI(M), Ruby/RSVG(M), Ruby/GdkPixbuf, Ruby/GnomeCanvas, Ruby/GTK, Ruby/Libart, Ruby/Pango, Ruby/GtkGLExt, Ruby/GLib. KUBO Takehiro Ruby/GNOME, Ruby/GnomeCanvas, Ruby/Libart, Ruby/GTK, Ruby/GLib. Laurent Sansonetti Ruby/GStreamer(M), Ruby/Libgda(M), Ruby/GtkSourceView(M), Ruby/GLib, Ruby/GTK, French Website, Website, Tutorials. Malte Milatz German Website. Martin Povolný Ruby/GtkHtml2(M). Ruby/GTK, Masahiro Sakai Ruby/GLib and almost of the important design of Ruby-GNOME2. Porting to Win32 platform. Masao Mutoh Chief maintainer. Ruby/ATK(M), Ruby/GTK(M), Ruby/GdkPixbuf(M), Ruby/Libglade(M), Ruby/Pango(M), Ruby/PanelApplet(M), Ruby/rbbr(M), Website(M), Others. Project management. Matthew Berg Ruby/GTK TreeView Tutorial(M), Website, Ruby/GTK. Mirko Maischberger Ruby/GtkMozEmbed(M), Ruby/GTK, Ruby/Pango, Ruby/GdkPixbuf, Ruby/GNOME, Website. Nikolai :: lone-star :: Weibull Ruby/GConf, Ruby/GnomeVFS(M), Ruby/GTK. Nobuyoshi Nakada Technical advisor. OGASAWARA, Takeshi Ruby/GTK. Pascal Terjan Ruby/GLib, Ruby/GTK, Ruby/GtkSourceView, Ruby/Pango, Ruby/GnomeVFS, Ruby/GConf. Sam Stephenson Website. Sjoerd Simons Ruby/GLib, Ruby/GTK. TAMURA.Kenichi Ruby/GLib. Vincent Isambart Ruby/GtkGLExt(M), Ruby/GnomeCanvas, Ruby/ATK, Ruby/Pango, Ruby/GLib, Ruby/GTK, Ruby/GtkHtml2, Ruby/Libart, Ruby/Libglade, French Website, Website. All members of Ruby-GNOME2 Mailing lists. And many others who have contributed patches, reported bugs. Thanks! ---------------------------------------- Ruby-GNOME Maintainers. (current) Kouhei Sutou (up to Ruby-GNOME2 ver. 0.16) Masao Mutoh (up to Ruby-GNOME ver. 0.27) Neil Conway (up to Ruby-GNOME ver. 0.25) Hiroshi IGARASHI (up to Ruby-GNOME ver. 0.18) by Dai.K. charset = UTF-8. ruby-gnome2-all-2.2.5/NEWS0000644000175000017500000033114612516434470013327 0ustar koukou# -*- RD -*- = NEWS == Ruby-GNOME2 2.2.5: 2015-04-24 It is a GLib 2.44 support release. === Changes ==== Ruby/GLib2 * Improvements * Supported GLib 2.44. [GitHub#361][Reported by Benjamin Maisano] === Thanks * Benjamin Maisano == Ruby-GNOME2 2.2.4: 2014-12-23 It is a x64 Windows support release. === Changes ==== Ruby/GLib2 * Improvements * Stopped to call g_thread_init() for GLib 2.32.0 or later because g_thread_init() is called automatically. * Added GLib.format_size. * Added GLib::Source#name. * Added GLib::Source#name=. * Added GLib::Source#ready_time. * Added GLib::Source#ready_time=. * Added GLib::Source#destroy. * Fixes * Fixed a bug that wrong converter is used on bigendian environment. [GitHub#270][Reported by mtasaka] ==== Ruby/GIO2 * Improvements * Added Gio::DBus. * Fixes * Fixed a bug that Gio::ContentType#executable? isn't defined by correct name. ==== Ruby/GTK2 * Improvements * Gtk::AboutDialog#show: Supported license_type option. [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito] * Fixes * Gtk::AboutDialog#show: Fixed a bug that wrap_license option doesn't work. [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito] ==== Ruby/GObjectIntrospection * Improvements * Supported prefix removing from method name. * Supported GList of UTF-8. [ruby-gnome2-devel-en][Reported by Detlef Reichl] * Added documentation. [GitHub#267][Patch by Detlef Reichl] * Fixes * Fixed a bug that out only argument is required. [GitHub#268][Reported by mtasaka] ==== Ruby/GDK3 * Improvements * Gdk::Window: Added deprecated constants for backward compatibility. * Supported Gdk::Keyval module functions. [GitHub#265][Reported by Detlef Reichl] * Cairo::Context#set_source_rgba: Re-supported (({set_source_rgba(r, g, b, a)})) style. [GitHub#272][Patch by Detlef Reichl] * [windows] Bundled the new default GNOME icon theme. [GitHub#276][Reported by glurp] * Fixes * Gdk::Color.parse: Fixed unexpected API change. [GitHub#276][Reported by glurp] * Fixed a bug that Gdk::Event::Mask fallback doesn't work. [GitHub#276][Reported by glurp] ==== Ruby/GTK3 * Improvements * Gtk::AboutDialog#show: Supported license_type option. [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito] * Gtk::ActionBar: Added. [GitHub#282][Suggested by Christopher L. Ramsey] * Fixes * Gtk::AboutDialog#show: Fixed a bug that wrap_license option doesn't work. [ruby-gnome2-devel-ja][Patch by Hiroyuki Ito] ==== Ruby/RSVG2 * Improvements * RSVG::Handle.new_from_file: Supported flags. You can open a large file with (({:flags => :unlimited})). [GitHub#263][Patch by Taro Matsuzawa] ==== Ruby/Clutter * Improvements * Added Clutter::Feature. * Fixes * Added missing require for Ruby/Pango. * Fixed initializing order. [GitHub#274][Reported by mtasaka] === Thanks * Detlef Reichl * Hiroyuki Ito * mtasaka * glurp * Taro Matsuzawa * Christopher L. Ramsey == Ruby-GNOME2 2.2.3: 2014-10-26 It is a bug fix release. It's recommended that you upgrade if your application uses thread and runs on Ruby 2.0 or later. === Changes ==== All * Improvements * Supported auto native package install on SuSE. ==== Ruby/GLib2 * Fixes * Fixed infinite loop bug on Ruby 2.0 or later. [ruby-gnome2-devel-ja] [Reported by Toshi Hatsune] ==== Ruby/GDK3 * Fixes * Added missing dependencies. [GitHub#258] [Reported by Luis Daniel Gonzalez Orozco] ==== Ruby/CairoGObject * Improvements * Supported auto required native package install by Homebrew. * Fixes * Fixed wrong package name on Debian. ==== Ruby/VTE3 * Improvements * Supported auto required native package install by Homebrew. ==== Ruby/Clutter * Improvements * Added Clutter.check_version?. === Thanks * Luis Daniel Gonzalez Orozco * Toshi Hatsune == Ruby-GNOME2 2.2.2: 2014-10-12 It is a Windows package fix release. == Ruby-GNOME2 2.2.1: 2014-10-12 It is a release that Ruby/GDK3 is migrated to Ruby/GObjectIntrospection based bindings. Some API changes in Ruby/GDK3 are expected but unexpected API changes may exist. If you find API change, please report it. If the API change provides non Rubyish API, it will be a bug. Ruby/GooCanvas is removed because we can't maintain it. === Changes ==== Ruby/GLib2 * Improvements * Added GObject#unref to free large object immediately. * Fixes * [windows] Added a missing exported symbol. ((({rbg_inspect}))) * Fixed a bug that signal handler doesn't work on Ruby 2.1. [ruby-gnome2-devel-en] [Reported by Carlo E. Prelz] * Fixed free function (free -> xfree). ==== Ruby/GObjectIntrospection * Improvements * Supported instantiating union. * Accepted 5 or more the number of signals. It may be increased for later GIO version. [GitHub#229] [Reported by cosmo0920] * Added "?" to boolean field value reader. * Supported mapping function info to method. * Don't handle MethodInfo as FunctionInfo. * Accepted not GType struct as an input argument. * Accepted getting a field value from not GType but GType descendant sruct. * Added Loader.register_constant_rename_map. * Supported in GType array. * Don't require needless array length argument. * Supported finding suitable method that has optional argument. * Fixes * Fixed wrong argument index for Ruby objects. * Fixed a bug that ArgInfo isn't passed. ==== Ruby/CairoGObject * Improvements * Suppressed a warning that instance variable gboxed not initialized. ==== Ruby/GIO2 * Improvements * Supported GLib 2.42.0. Annotation for GObject Introspection is added to g_pollable_input_stream_read_nonblocking() since GLib 2.42.0. See also: https://bugzilla.gnome.org/show_bug.cgi?id=730493 * Supported GLib <= 2.36.0. * Fixes * Fixed a bug that .pc isn't installed. [Reported by OBATA Akio] ==== Ruby/GDK3 * Improvements * Migrated to Ruby/GObjectIntrospection based bindings. * Gdk::Keyval::GDK_KEY_x style is deprecated. Use Gdk::Keyval::KEY_x style instead. * Accepted Gdk::RGBA for Cairo::Context#set_source_rgba. ==== Ruby/GTK3 * Improvements * Added Gtk::StackSwitcher. * Supported interrupt in Gtk.main. * Supported interrupt in Gtk::Dialog#run. [Reported by Carlo E. Prelz] * Added initialization with Gdk::RGBA value. [GitHub#231] [Patch by Detlef Reichl] * Added Gtk::Window#set_titlebar (enable the use of Gtk::HeaderBar). [GitHub#236] [Patch by tescorg] * Updated sample scripts. [Patch by kitachro] * Fixes * Fixed memory leak of Gtk::Image. [GitHub#252] [Reported by Michel Boaventura] ==== Ruby/GTK2 * Improvements * Fixed wrong property value on ppc64 and s390x. [GitHub#256] [Reported by mtasaka] ==== Ruby/GStreamer * Improvements * Added gstreamer.rb for Bundler's autoload. [GitHub#232] [Reported by saepia] * Added Caps.any and Caps.empty. * Supported property for Gst::ChildProxy. [GitHub#233] [Reported by saepia] * Fixes * Fixed a bug that Gst.init is failed. [GitHub#232] [Reported by saepia] ==== Ruby/Poppler * Improvements * Install Poppler with --with-glib option for Homebrew. [GitHub#237] [Reported by Colin Dean] * Removed needless `--with-glib` option. Now, it is the default. [rabbit-shocker/rabbit#24] [Reported by Kazuhiro NISHIYAMA] ==== Ruby/ClutterGStreamer * Improvements * Added clutter-gstreamer.rb to support Bundler's autoload. ==== Ruby/GooCanvas * Removed. === Thanks * OBATA Akio * Carlo E. Prelz * cosmo0920 * Detlef Reichl * saepia * tescorg * Colin Dean * Kazuhiro NISHIYAMA * kitachro * Michel Boaventura * mtasaka == Ruby-GNOME2 2.2.0: 2014-03-09 It is a release that Ruby/GIO2 is migrated to Ruby/GObjectIntrospection based bindings. Some API changes in Ruby/GIO2 are expected but unexpected API changes may exist. If you find API change, please report it. If the API change provides non Rubyish API, it will be a bug. === Changes ==== Ruby/GLib2 * Improvements * Stopped to use deprecated API internally in G_REPLACE_SET_PROPERTY. * Added RG_REPLACE_SET_PROPERTY. * Reduced locking on object creation. * Exported rbg_inspect(). * Created code level error. * Raised code level error instead of domain level error. * Fixes * Fixed a bug that wrong error code may be used. ==== Ruby/GTK2 * Improvements * Suppressed warnings on startup. * Fixes * [windows] Suppressed IME related warnings. [Reported by OBATA Akio] * [GitHub#222] Fixed a bug that Gdk::EventAny related methods aren't used by other Gdk::Event classes. [Reported by mtasaka] ==== Ruby/GDK3 * Improvements * Added Gdk::Display#device_manager. * Added Gdk::Window#display. * Suppressed warnings on startup. * Added Gdk::Event::PROPAGATE. * Added Gdk::Event::STOP. * Fixes * [windows] Suppressed IME related warnings. * Fixed a bug that Gdk::DeviceManager is wrong object. * [GitHub#222] Fixed a bug that Gdk::EventAny related methods aren't used by other Gdk::Event classes. [Reported by mtasaka] ==== Ruby/GTK3 * Improvements * Added Gtk::MenuButton. * [GitHub#219] Added Gtk::LevelBar. [Patch by cosmo0920] * Added Gtk::IconView. * [GitHub#206] Added Gtk::HeaderBar. [Reported by dark-yux] * [GitHub#223] Added Gtk::Stack. [Patch by cosmo0920] * Suppressed warnings on startup. * Added Gtk::Revealer. * Updated sample scripts. * [GitHub#227] Added Gtk::SearchBar. [patch by cosmo0920] ==== Ruby/GIO2 * Improvements * Migrated to Ruby/GObjectIntrospection based bindings. * [SF.net#187] Supported Gio::ContentType.guess. [Reported by neversleep1911] * Added Gio::Resources.lookup_data. * Added Gio::Resources.open_stream. * Added Gio::Resources.enumerate_children. * Added Gio::Resources.get_info. * Added Gio::Resources.register. * Added Gio::Resources.unregister. * Changes * Removed Gio::Socket#create_source. Use Gio::InputStream#create_source or Gio::OutputStream#create_source instead. * Removed Gio::InetAddress.new_from_string. Use Gio::InetAddress.new instead. * Removed Gio::InetAddress.new_any. Use Gio::InetAddress.any instead. * Removed Gio::InetAddress.new_l. Use Gio::InetAddress.any instead. * Fixes * [SF.net#186] Fixed a bug that Gio::ContentType module functions raises "no implicit conversion" error. [Reported by neversleep1911] ==== Ruby/Pango * Improvements * [ruby-gnome2-devel-en] Re-supported build on CentOS 5. [Reported by Grant Schoep] ==== Ruby/Poppler * Improvements * Suppressed a warning on startup. ==== Ruby/GtkSourceView2 * Improvements * [GitHub#226] Suppressed warnings. [Patch by cosmo0920] * Fixes * [GitHub#215] Fixed a return value for GtkSource#get_mark_category_background. [Reported by mtasaka] ==== Ruby/GObjectIntrospection * Improvements * [GitHub#216] Suppressed warnings on armv7hl. [Reported by mtasaka] * Supported freeing interface. * Supported freeing struct. * Supported String as void * value for value. * Supported freeing array of int8. * Supported freeing array of uint8. * Supported defining errors. * Improved guessing target method for overloaded method. * Supported array length. * Supported inout array. * Converted GBytes to String instead of wrapped GBytes. * Supported all exception types rather than GLib::Error. * Changes * Changed returned value of inout array to an array from an array and array length. * Fixes * [GitHub#216] Fixed test failures on i686 environment. [Reported by mtasaka] ==== Ruby/ClutterGTK * Improvements * Added duplicated Clutter.init check. === Thanks * OBATA Akio * mtasaka * cosmo0920 * Grant Schoep * dark-yux * neversleep1911 == Ruby-GNOME2 2.1.0: 2013-12-29 Ruby 2.1.0 support release! === Changes ==== All * Improvements * Set license information to gem. * Fixes * [windows] Added missing binaries for Ruby 2.1.0. [GitHub#123] [Patch by Masafumi Yokoyama] ==== Ruby/GDK3 * Improvements * [windows] Bundled hicolor-icon-theme. It may fix a problem that Windows theme is not applied. [ruby-gnome2-devel-en] [Reported by Regis d'Aubarede] === Thanks * Masafumi Yokoyama * Regis d'Aubarede == Ruby-GNOME2 2.0.3: 2013-12-29 It is RC release for 2.1.0. === Changes ==== All * Improvements * Removed Ruby 1.8 from supported Ruby in READMEs. [GitHub#166] [Reported by Markus Heiler] [Patch by Masafumi Yokoyama] * Supported Ruby 2.1.0. [GitHub#181] [cosmo0920][Masafumi Yokoyama] * Made rcairo optional to required because we dropped old GTK+ that doesn't use cairo. (Cairo isn't used library such as GLib doesn't require rcairo. But Ruby/GLib2 requires rcairo on Windows because it uses zlib bundled in rcairo.) [GitHub#193] [cosmo0920] * Updated LGPL 2.1 files. [GitHub#196] [Reported by ktdreyer] * Supported tests on Travis CI. [Masafumi Yokoyama][cosmo0920] * Supported rake-compiler 0.9.1. ==== Ruby/GLib2 * Improvements * Set UTF-8 encoding to exception message. * Added GLib::GetText.bindtextdomain. * Dropped GLib < 2.12 because CentOS 5 has GLib 2.12.3. [GitHub#190] [cosmo0920] * Added GValue#to_s. * [windows] Updated bundled GLib to 2.38.2 from 2.36.2. ==== Ruby/GObjectIntrospection * Improvements * Supported GList return type. * Supported freeing UTF-8 return type. * Supported freeing array return type. * Supported NULL as array return value. * Supported freeing GObject return value. * Supported freeing structure return value. * Supported NULL character for gint8 array. * Fixes * Fixed type conversion from VALUE to GType. [GitHub#186] [Patch by Hiroyuki Tanaka] ==== Ruby/ATK * Improvements * Dropped ATK < 1.12 support because CentOS 5 has GTK+ 1.12.2. [GitHub#191] [cosmo0920] * [windows] Updated bundled ATK to 2.10.0 from 2.8.0. ==== Ruby/Pango * Improvements * Supported cairo 1.6. [GitHub#172] [Patch by Grant Schoep] * Dropped Pango < 1.14 support because CentOS 5 has GTK+ 1.14.9. [GitHub#192] [cosmo0920] * Added Pango::Layout#height=. [GitHub#210] [Patch by Vasily Fedoseyev] * Added Pango::Layout#ellipsized?. [GitHub#210] [Patch by Vasily Fedoseyev] * [windows] Updated bundled Pango to 1.36.1 from 1.34.1. ==== Ruby/GdkPixbuf2 * Improvements * [windows] Added rcairo dependency on Windows for using libpng and zlib bundled in rcairo. * [windows] Updated bundled gdk-pixbuf to 2.30.2 from 2.28.1. ==== Ruby/GTK2 * Improvements * Dropped GTK+ < 2.10 support because CentOS 5 has GTK+ 2.10.4. [GitHub#182] [Patch by cosmo0920] * [windows] Updated bundled GTK+ to 2.24.22 from 2.24.18. ==== Ruby/GDK3 * Improvements * [test] Made more stable. [GitHub#178] [Reported by mtasaka] * Added Gdk::Device#ungrab. [cosmo0920] * Added Gdk::DeviceManager. [cosmo0920] * Added Gdk::Device#get_position. [cosmo0920] * Added Gdk::Device#warp. [cosmo0920] * Added Gdk::Device#grab. [cosmo0920] * Added Gdk::Window#get_device_position. [cosmo0920] * [windows] Updated bundled GTK+ to 3.10.6 from 3.8.2. ==== Ruby/GTK3 * Improvements * [sample] Updated for GTK+ 3. [Masafumi Yokoyama] * Removed Gtk::BindingSet#add_path. * Added Gtk.show_uri. * Fixes * Fixed a bug that Gtk::ActionGroup#add_radio_actions always fails. [ruby-gnome2-devel-ja] [Reported by S. Kitagawa] ==== Ruby/GStreamer * Improvements * Supported calling module functions of Gst module such as Gst.version before calling Gst.init. * Added Gst::Registry#plugins. * Added Gst::Registry#get_features. * Added Gst::ElementFactory#long_name. * Added Gst::ElementFactory#klass. * Added Gst::ElementFactory#author. * Added Gst::ElementFactory#static_pad_templates. * Added Gst::Caps#structures. * Added Gst::Structure#fields. * Gst::Element#flags returns flag object instead of raw integer value. Use Gst::Element#flags_raw for raw integer value. * Gst::PluginFeature#rank returns Gst::Rank instead of raw integer value. Use Gst::PluginFeature#rank for raw integer value. * Supported GstValueList. * [windows] Updated bundled GStreamer to 1.2.1 from 1.0.7. ==== Ruby/Clutter * Improvements * [sample] Updated for Clutter 1.12 or later. [Patch by Kentaro Fukuchi] * [windows] Updated bundled Clutter to 1.16.2 from 1.14.4. ==== Ruby/ClutterGStreamer * Improvements * [sample] Added. [Masafumi Yokoyama] * Fixed a typo in sample. [Reported by Toyo Abe] * [windows] Updated bundled Clutter-GStreamer to 2.0.8 from 2.0.2. ==== Ruby/Poppler * Improvements * Dropped Popper < 0.12 because CentOS has Poppler 0.12.4. [GitHub#212] [cosmo0920] * [windows] Bundled Poppler 0.24.4. ==== Ruby/RSVG * Improvements * [windows] Bundled librsvg 2.40.1. ==== Ruby/GtkSourceView3 * Improvements * Supported auto GtkSourceView install on OS X. [GitHub#177] [Masafumi Yokoyama] * [windows] Updated bundled GtkSourceView to 3.10.1 from 3.8.1. ==== Ruby/GooCanvas * Improvements * [sample] Followed changes caused by migrating to Ruby/GObjectIntrospection. [Masafumi Yokoyama] * Updated FSF address. [GitHub#201] [Reported by ktdreyer] * Fixes * Fixed wrong dependency. [ruby-gnomde2-devel-ja] [Reported by Masafumi Yokoyama] === Thanks * Kentaro Fukuchi * S. Kitagawa * Markus Heiler * Masafumi Yokoyama * Grant Schoep * Toyo Abe * mtasaka * cosmo0920 * Hiroyuki Tanaka * ktdreyer == Ruby-GNOME2 2.0.2: 2013-05-26 Windows XP re-supportted release! === Changes ==== Ruby/GLib2 * Improvements * Added rbgutil_key_equal() convenient function. It is used for comparing key that may be String or Symbol. ==== Ruby/Pango * Improvements * [windows] Forced to disable uniscribe backend of HarfBuzz. [ruby-list:49412] [Reported by Masafumi Yokoyama] * Don't define Pango::CairoFcFontMap and Pango::CairoWin32FontMap because they may cause crash on OS X. [shocker-ja:1119] [Reported by znz] * Updated samples. [GitHub#164] [Patch by Kentaro Fukuchi] * Fixes * Fixed wrong index access in Pango::GlyphString#glyphs. [ruby-gnome2-devel-ja] [Reported by Kentaro Fukuchi] === Thanks * Kentaro Fukuchi * Masafumi Yokoyama * znz == Ruby-GNOME2 2.0.1: 2013-05-25 Ruby 1.8 support is dropped release! === Changes ==== All * Improvements * Dropped Ruby 1.8 support. * Updated bundled binaries versions for Windows. ==== Ruby/Pango * Improvements * Added Pango::CairoFontMap.set_default. * Enabled fontconfig font on Windows. * Defined Pango::CairoFcFontMap on init if it is available. * Defined Pango::CairoWin32FontMap on init if it is available. ==== Ruby/GTK3 * Improvements * Added Gtk::Image#set_from_icon_set. [GitHub#150] [Patch by Detlef Reichl] * Added Gtk::Image#set_from_stock. [GitHub#150] [Patch by Detlef Reichl] * Added Gtk::Image#set_from_gicon. [GitHub#150] [Patch by Detlef Reichl] * Updated samples. [GitHUb#151] [Patch by Detlef Reichl] * Fixes * Fixed a GC related crash bug. [ruby-gnome2-devel-en] [Reported by Detlef Reichl] ==== Ruby/GObjectIntrospection * Improvements * Supported ownership transfer for some input argument types. (Struct and Object) * Supported "(out caller-allocates)" for boxed object. [ruby-gnome2-devel-ja] [Reported by Kentaro Fukuchi] * Supported gpointer in/out. [ruby-gnome2-devel-ja] [Reported by NAKAJIMA Takashi] * Fixes * Fixed missing argument. [GitHub#154] [Reported by Masafumi Yokoyama] ==== RubyGStreamer * Improvements * Supported methods that call callback [ruby-gnome2-devel-ja] [Reported by NAKAJIMA Takashi] * Updated samples. [GitHub#156][GitHub#159][GitHub#160][GitHub#161] [Patch by NAKAJIMA Takashi] * Supported Gst::Bus#set_handler. [ruby-gnome2-devel-ja] [Reported by NAKAJIMA Takashi] * Supported Gst::Controller [ruby-gnome2-devel-ja] [Suggested by NAKAJIMA Takashi] * Stopped to require Gst.init. * Fixes * Fixed out of index access bug. ==== Ruby/GooCanvas * Improvements * Migrated to Ruby/GObjectIntrospection based bindings. * Stopped to require Goo.init. * Fixes * Updated samples. [GitHub#152][GitHub#153][GitHub#155][GitHub#157] [Patch by Masafumi Yokoyama] ==== Ruby/Clutter * Improvements * Stopped to require Clutter.init. * Fixes * Fixed broken samples. [ruby-gnome2-devel-ja] [Patch by Kentaro Fukuchi] ==== Ruby/ClutterGtk * Improvements * Stopped to require ClutterGtk.init. ==== Ruby/ClutterGStreamer * Added. ==== Ruby/WebKitGtk * Improvements * Stopped to require WebKitGtk.init. ==== Ruby/WebKitGtk2 * Improvements * Stopped to require WebKitGtk2.init. === Thanks * Detlef Reichl * NAKAJIMA Takashi * Masafumi Yokoyama * Kentaro Fukuchi == Ruby-GNOME2 2.0.0: 2013-04-29 GObject Introspection based bindings on Windows support release! === Changes ==== NEWS * Fixes * Fixed a typo. [Reported by Masafumi Yokoyama] * FIxed a typo. [Reported by Toyo Abe] ==== Ruby/GLib2 * Improvements * Moved lib/gnome2-*.rb files to lib/gnome2/ directory. * Supported GLib 2.34. [Reported by OBATA Akio] ==== Ruby/GdkPixbuf2 * Fixes * [windows] Fixed PNG can't be handled problem. [ruby-gnoem2-devel-ja] [Reported by Masafumi Yokoyama] ==== Ruby/GDK3 * Improvements * [windows] Removed needless Greybird theme. [ruby-gnome2-devel-en] [Reported by Regis d'Aubarede] * Added Gdk::Window#create_cairo_context [ruby-gnome2-devel-en] [Reported by Detlef Reichl] ==== Ruby/GTK3 * Improvements * Updated samples. [GitHub #140][GitHub #141][GitHub #144] [Patch by Simon Arnaud] [GitHub #142][GitHub #143][GitHub #145][GitHub #146][GitHub #148] [Patch by Detlef Reichl] ==== Ruby/GObjectIntrospection * Improvements * [windows] Supported! ==== Ruby/GStreamer * Improvements * Supported GStreamer 1.0! * Migrated to GObject Introspection bindings! * Dropped GStreamer 0.10 support. ==== Ruby/Clutter * Improvements * [windows] Supported! ==== Ruby/ClutterGTK * Improvements * [windows] Supported! === Thanks * Masafumi Yokoyama * Toyo Abe * OBATA Akio * Regis d'Aubarede * Detlef Reichl * Simon Arnaud == Ruby-GNOME2 1.2.6: 2013-04-02 Broken Ruby/Poppler fix release! === Changes ==== Ruby/GLib2 * Improvements * Removed deprecated GLib::Completion. * Removed deprecated g_source_get_current_time() use. * [windows] Updated bundled GLib to 3.8.0. * [windows] Updated bundled glib-networking to 3.8.0. * [windows] Updated bundled GnuTLS to 3.1.10. ==== Ruby/ATK * Improvements * [windows] Updated bundled ATK to 2.8.0. ==== Ruby/GdkPixbuf2 * Improvements * [windows] Updated bundled gdk-pixbuf to 2.28.0. ==== Ruby/Pango * Improvements * [windows] Updated bundled Pango to 1.34.0. ==== Ruby/GDK3 * Improvements * [windows] Updated bundled GTK+ to 3.8.0. ==== Ruby/Poppler * Fixes * Fixed a bug that Poppler::Page#render is broken. [SF.net#184] [Reported by HARUYAMA Seigo] ==== Ruby/GooCanvas * Improvements * Added a Ruby/GObjectIntrospection based sample. [GitHub #139] [Patch by Masafumi Yokoyama] === Thanks * Masafumi Yokoyama * HARUYAMA Seigo == Ruby-GNOME2 1.2.5: 2013-03-28 Crash bug fix release! === Changes ==== All * Fixes * Fixed crash bugs. [GitHub #138] [Reported by Takuma Nakajima] === Thanks * Takuma Nakajima == Ruby-GNOME2 1.2.4: 2013-03-24 Ruby/WebKitGtk2 addition release! === Changes ==== All * Improvements * Start mswin64 support. (But it is not completed yet.) [GitHub #135] [Patch by usa] ==== Ruby/GLib2 * Improvements * Reduce needless GBoxed object copy. ==== Ruby/GdkPixbuf2 * Fixes * Fix build error by a typo. ==== Ruby/GtkSourceView2 * Improvements * Support auto RPM install on CentOS 6. ==== Ruby/GObjectIntrospection * Improvements * Add method name to arguments validation failure message. * Support specific version loading. ==== Ruby/GTK3 * Improvements * [windows] Add gschemas.compiled. [ruby-talk:406026] [Reported by Regis d'Aubarede] ==== Ruby/WebKitGtk2 * New! [GitHub #136] [Patch by eumario] === Thanks * usa * Regis d'Aubarede * eumario == Ruby-GNOME2 1.2.3: 2013-03-17 Clean up release! === Changes ==== Ruby/GTK2 * Remove needless signale handlers restore. ==== Ruby/GTK3 * Remove needless signale handlers restore. == Ruby-GNOME2 1.2.2: 2013-03-11 Ruby 2.0.0 support release! === Changes ==== Ruby/GLib2 * Improvements * Supported test on Ruby 2.0.0. [GitHub #134] [Reported by mtasaka] ==== Ruby/Poppler * Improvements * Removed deprecated GDK support. ==== Ruby/GDK3 * Improvements * Supported Ruby 2.0.0. [GitHub#129] [Reported by TOMITA Masahiro] ==== Ruby/GObjectIntrospection * Improvements * Supported not GType based flags. * Supported not GType based enum. * Supported custom callback function. * Supported .h install. * Supported .pc install. * More Rubyish method names are used. * Stopped to raise exception when there are two or more out parameters. * Added Loader.start_callback_dispatch_thread(). * Supported arguments validation. * Stopped to use array for just one return value. * Supported Enumerator. * Hide constructor methods. ==== Ruby/GtkSourceView3 * Fixes * Fixed wrong deb package name. ==== Ruby/Clutter * Fixes * Fixed wrong initialized check. * Stopped to override Clutter.init unexpectedly. ==== Ruby/ClutterGTK * Fixes * Fixed wrong initialized check. ==== Ruby/WebKitGTK * Fixes * Fixed wrong initialized check. === Thanks * Vincent Carmona (for unreleased GObjectIntrospection based GStreamer bindings) * TOMITA Masahiro * NAKAJIMA Takashi (for unreleased GObjectIntrospection based GStreamer bindings) * mtasaka == Ruby-GNOME2 1.2.1: 2013-01-30 GTK+ 3 support on Mac OS X release! === Changes ==== Ruby/GLib2 * Improvements * Supported custom sudo prompt on auto native package install. [GitHub:126] [Suggested by Yorick Peterse] * Started to support JRuby. (It is not completed yet.) [GitHub:125] [Reported by vpereira] * Accepted unsigned long int size GType. * Removed DL support. * Don't call deprecated g_type_init() for GLib >= 2.35.1. ==== Ruby/GTK2 * Fixes * Fixed a memory leak related Gtk::TreeIter. [GitHub:128] [Patch by Toshiaki Asai] ==== Ruby/GTK3 * Fixes * Fixed a memory leak related Gtk::TreeIter. [GitHub:128] [Patch by Toshiaki Asai] * Fixed a crash bug caused by symbol conflict with Ruby/GDK3 on Mac OS X. [GitHub:127] [Reported by Sergio Campama] [Helped by Watson] ==== Ruby/GDK3 * Improvements * [windows] Bundled Greybird theme. [Suggested by Regis d'Aubarede] ==== Ruby/GooCanvas * Improvements * Added Goo::Canvas#get_items_at [GitHub:124] [Patch by David Maciejak] ==== Ruby/WebKitGTK * Added ==== Ruby/GtkSourceView3 * Improvements * Supported Windows. === Thanks * David Maciejak * Yorick Peterse * vpereira * Toshiaki Asai * Sergio Campama * Watson * Regis d'Aubarede == Ruby-GNOME2 1.2.0: 2013-01-24 GTK+ 3 support release! === Changes ==== All * Added ruby-gtk3 package. Here is a list: * Ruby/GLib2 * Ruby/ATK * Ruby/Pango * Ruby/GdkPixbuf2 * Ruby/GDK3 * Ruby/GTK3 ==== Ruby/GLib2 * Improvements * Supported custom VALUE <-> GBoxed conversion * Supported VALUE <-> GBoxed conversion by RVAL2GOBJ * Added GLib::Source::REMOVE * Added GLib::Source::CONTINUE * Added rbgobj_make_boxed_raw() * Added GLib::Value for internal use * [windows] Updated to the latest GLib: 2.28.8-1 -> 2.34.3 * Changes * Removed deprecated GLib::Win32.get_package_installation_directory * Removed deprecated GLib::Win32.get_package_installation_subdirectory * Added user_data to RGConvertTable callbacks * rbgobj_convert_define() copies passed RGConvertTable * Removed deprecated G_DEF_FUNDAMENTAL. Use RG_DEF_CONVERSION instead ==== Ruby/GIO2 * Improvements * Installed headers ==== Ruby/ATK * Improvements * [windows] Updated to the latest ATK: 1.32.0 -> 2.6.0 ==== Ruby/Pango * Improvements * [windows] Updated to the latest Pango: 1.28.3 -> 1.32.6 ==== Ruby/GdkPixbuf2 * Improvements * [windows] Updated to the latest gdk-pixbuf: 2.24.0 -> 2.26.5 ==== Ruby/GTK2 * Improvements * Removed needless not copy flag from Allocation * [windows] Updated to the latest GTK+ 2: 2.24.8 -> 2.24.14 ==== Ruby/GDK3 * Improvements * [windows] Supported: 3.6.4 ==== Ruby/GTK3 * Improvements * Removed needless not copy flag from Allocation * [windows] Supported: 3.6.4 ==== Ruby/GObjectIntrospection * Improvements * Supported over loaded method * Supported over loaded constructor * Supported GBoxed object * Supported char * * Supported GInterface * Supported CallableInfo * Supported may be null * Supported union object * Supported not GBoxed struct * Supported out parameter * Supported C array * Added "?" suffix to predicate method name * Supported SourceFunc callback * Supported GValue * Added GObjectIntrospection::Loader.register_boxed_class_converter * Supported inout parameter * Supported binary data array * Changes * ArgInfo#[] -> ArgInfo#get_arg ==== Ruby/CairoGObject * Added ==== Ruby/Clutter * Added ==== Ruby/ClutterGtk * Added == Ruby-GNOME2 1.1.9: 2012-12-29 This is a experimental GObjectIntrospection support release. === Changes ==== Ruby/GLib2 * Improvements * Renamed G_DEF_CLASS4 to G_DEF_CLASS_WITH_PARENT. G_DEF_CLASS4 is still usable but it is deprecated. ==== Ruby/GObjectIntrospection * Added. It is still experimental. == Ruby-GNOME2 1.1.8: 2012-12-19 This is a bug fix release for Ruby 2.0.0. === Changes ==== All * Fixes * Fixed a bug that *.so isn't installed with Ruby 2.0.0. == Ruby-GNOME2 1.1.7: 2012-12-10 This is a package for Windows fix release. === Changes ==== Ruby/GTK2 * Fixes * Bundled GTK+ 2.24.8-1 instead of GTK+ 2.24.10-1. [Reported by Mahoro Shimura] === Thanks * Mahoro Shimura == Ruby-GNOME2 1.1.6: 2012-12-02 This is Ruby 2.0.0 support release! === Changes ==== All * Fixes * Fixed install error on Ruby 2.0.0. [ruby-gnome2-devel-en] Recent Ruby: 'depend' files must be changed [Reported by Carlo E. Prelz] ==== Ruby/GLib2 * Improvements * Improved portability a bit. '$,' is used instead of rb_output_fs. [GktHub:#117] [Reported by Marvin Gülker] ==== Ruby/GIO2 * Fixes * Fixed a crash bug on i386. [Reported by TAKATSU Tomonari] ==== Ruby/GTK2 * Improvements * Added Gtk::TreeModel#iter_root. [GitHub:121] [Patch by dmaciejak] * Added Gtk::TreeModel#iter_next. [GitHub:121] [Patch by dmaciejak] ==== Ruby/GdkPixbuf2 * Fixes * Fixed build errors with old gdk-pixbuf. ==== Ruby/Poppler * Improvements * Added missing required Poppler version. [Suggested by Grant Schoep] [ruby-gnome2-devel-en] poppler, build fails, incorrect required_pkg_config_package? * Fixes * Fixed a wrong package name on Red Hat and Fedora. [Reported by Grant Schoep] [ruby-gnome2-devel-en] poppler, build fails, incorrect required_pkg_config_package? * Changes * Disabled auto Poppler install for Homebrew. It requires --with-glib option but auto install with --with-glib option isn't supported yet. ==== Ruby/GooCanvas * Improvements * Added Goo::Canvas#update. [GitHub:119] [Patch by dmaciejak] * Added Goo::Canvas#request_update. [GitHub:119] [Patch by dmaciejak] * Added Goo::Canvas#convert_from_pixels. [GitHub:123] [Patch by dmaciejak] * Added Goo::Canvas#convert_to_pixels. [GitHub:123] [Patch by dmaciejak] * Added Goo::Canvas#get_item_at. [GitHub:123] [Patch by dmaciejak] * Added Goo::Canvas#bounds. [GitHub:123] [Patch by dmaciejak] ==== Ruby/GStreamer * Improvements * Don't pass -h and --help to GStreamer. [GitHub:#118] [Reported by dmaciejak] === Thanks * TAKATSU Tomonari * dmaciejak * Grant Schoep * Carlo E. Prelz * Marvin Gülker == Ruby-GNOME2 1.1.5: 2012-08-29 This is a network support improvement release! === Changes ==== Ruby/GLib2 * Improvements * windows: Bundled glib-networking. ==== Ruby/GIO2 * Improvements * Added Gio::TlsCertificate. * Added Gio::TlsCertificateFlags. ==== Ruby/GTK2 * Improvements * Added Gtk.show_uri. * Fixes * Gtk::TreeStore#reorder: Fixed wrong the number of reorder values check. [SF.net#3561748] [Reported by Nounou] === Thanks * Nounou == Ruby-GNOME2 1.1.4: 2012-07-21 This is a easy to install release! === Changes ==== All * Improvements * Supported automatic required native packages install. ==== Ruby/GLib2 * Improvements * mkenums: Supported "/* < flags > */" tag. * mkenums: Supported two or more upper case characters such as "IO". * Before: GIOStatus -> g_iostatus * After: GIOStatus -> g_io_status * GIOCondition: Changed to GLib::Boxed object from integer. * GLib::Source#attach doesn't require context. * Fixes * Fixed wrong type conversion for GIOCondition. ==== Ruby/GIO2 * Improvements * Gio::Socket#create_source: Supported callback. * Fixes * Fixed return values. * Fixed wrong type conversions. ==== Ruby/GTK2 * Improvements * Re-supported GTK+ 2.10.0. [GitHub:115] [Patch by Grant Schoep] * Fixes * Fixed a typo in test script. [GitHub:109] [Reported by kimura wataru] ==== Ruby/GStreamer * Fixes * Fixed a test failure with GStreamer 0.10.36. [GitHub:111] [Reported by mtasaka] === Thanks * kimura wataru * mtasaka * Grant Schoep == Ruby-GNOME2 1.1.3: 2012-04-08 This is a bug fix release of 1.1.2. === Changes ==== Ruby/GLib2 * Improvements * Added required Ruby version into gemspec. * [GitHub#106] glib-mkenums.rb supported macro lines in header. This change is required for building with GLib 2.31.20. [Reported by mtasaka] * [GitHub#107] Supported tests on PPC. [Reported by mtasaka] * Fixes * Fixed handler_id type. ==== Ruby/GTK2 * Improvements * Added Gtk::TreeViewColumn#set_sort_column_id and Gtk::TreeViewColumn#sort_column_id= for GTK+ < 2.18. [ruby-gnome2-devel-en] Gtk::TreeViewColumn [Reported by grant schoep] * Added Gtk::InfoBar. * Added Gtk::MessageType. * Added Gtk::ResponseType. * Fixes * Fixed build failure with GTK+ < 2.12. [ruby-gnome2-devel-en] compile problems gtk2, ruby-gnome2-all-1.1.2 [Reported by grant schoep] * Fixed require failure with GTK+ < 2.14. [ruby-gnome2-devel-en] NameError: undefined method `color_selection' for class `Gtk::ColorSelectionDialog' [Reported by grant schoep] ==== Ruby/Poppler * Improvements * [GitHub#97] Added Poppler::Page#text_layout. [Patch by Andrey Kutejko] * [SF.net#3495948] Removed needless poppler-cairo check. [Reported by Pino Toscano] * Fixes * [GitHub#96] Fixed valid state of child index iterator. [Patch by Andrey Kutejko] * [GitHub#97] Fixed parameter check of Poppler::Page#get_text. [Patch by Andrey Kutejko] ==== Ruby/VTE * Fixes * Fixed build failure with VTE < 0.24. ==== Ruby/GStreamer * Improvements * Added Gst::Element#seek_simple. * Fixes * [GitHub#95] Fixed async test. [Reported by mtasaka] === Thanks * mtasaka * grant schoep * Andrey Kutejko * Pino Toscano == Ruby-GNOME2 1.1.2: 2012-01-15 This is a bug fix release of 1.1.1. === Changes ==== Ruby/GLib2 * Fixes * [GitHub#94] install missing header files. [Reported by mtasaka] ==== Ruby/Pango * Fixes * [GitHub#94] install a missing header file. [Reported by mtasaka] ==== Ruby/GdkPixbuf2 * Fixes * [GitHub#94] install missing header files. [Reported by mtasaka] === Thanks * mtasaka == Ruby-GNOME2 1.1.1: 2012-01-14 This is a bug fix release of 1.1.0. === Changes ==== Ruby/GLib2 * Fixes * [ruby-list:48587] Re: [ANN] Ruby-GNOME2 1.1.0 fix wrong parent class for GLib::IOChannelWin32Socket. [Reported by ashbb] ==== Ruby/GTK2 * Fixes * Fixed a bug that Gtk::ActionGroup#add_radio_actions always fail. ==== Ruby/GStreamer * Improvements * [win32] Supported FLAC. === Thanks * ashbb == Ruby-GNOME2 1.1.0: 2012-01-05 This is a source cleanup release. === Changes ==== Ruby/GLib2 * Improvements * [GitHub#65] Supported GLib 2.31. [Reported by mtasaka] * Supported comparing between GLib::Enum/GLib::Flags and Symbol. * Fixes * [GitHub#1] Fix GLib::Spawn regression. [Patch by Geoff Youngs] * Plugged memory leaks. * Fixed a crash by GC on Ruby 1.9. * Changes * Remove optional Ruby-GetText-Package dependency. ==== Ruby/GTK2 * Improvements * [ruby-gnome2-devel-en] FileChooserDialog raising warnings on Windows: Added hicolor-icon-theme into gem on Windows. [Suggested by Nikolai Weibull] * Fixes * Fixed a crash by GC. * Plugged memory leaks. * Fixed Gdk::GC#colormap= uses wrong value. * Fixed Gtk::TextBuffer#serialize uses wrong value. ==== Ruby/Pango * Fixes * Plugged memory leaks. ==== Ruby/GdkPixbuf * Improvements * Gdk::Pixbuf.new supports hash argument. * Fixes * Plugged memory leaks. ==== Ruby/GStreamer * Improvements * Supported Windows gem. * Improved memory management. * Fixes * [GitHub#86] Gstreamer: test_caps test fails. [Reported by mtasaka] * [GitHub#87] GStreamer: test_span test fails. [Reported by mtasaka] * [GitHub#87] GStreamer: test_create_clock test fails. [Reported by mtasaka] * [GitHub#89] GStreamer: test_fraction_range_new test fails. [Reported by mtasaka] * [GitHub#91] GStreamer: test_state "sometimes" fails. [Reported by mtasaka] ==== Ruby/Poppler * Fixes * Fixed a wrong conversion in Poppler::Document#find_dest. [Reported by Chloé Desoutter] === Thanks * Geoff Youngs * mtasaka * Chloé Desoutter * Nikolai Weibull == Ruby-GNOME2 1.0.3: 2011-09-19 This is a bug fix release of 1.0.2. === Changes ==== Ruby/GLib2 * Fixes * [#3411234] Supported RubyGems 1.8.6. [Tobias Pfeiffer, Kouhei Sutou] === Thanks * Tobias Pfeiffer == Ruby-GNOME2 1.0.2: 2011-09-18 This is a bug fix release of 1.0.1. === Changes ==== Ruby/GLib2 * Fixes * [#3411204] Supported RubyGems 1.8.6. [Tobias Pfeiffer, Kouhei Sutou] ==== Ruby/GTK2 * Fixes * Fixed the default theme on Windows. [ashbb, Kouhei Sutou] === Thanks * Tobias Pfeiffer * ashbb == Ruby-GNOME2 1.0.1: 2011-09-18 This is a bug fix release of 1.0.0. === Changes ==== Ruby/GLib2 * Improvements * GLib::IOChannel.open supports Windows. [OBATA Akio, Kouhei Sutou] * Added RVAL2STRV_FREE(), CSTRFILENAME2RVAL(), RVAL2STRV, STRV2RVAL(), G_REPLACE_SET_PROPERTY(), G_REPLACE_GET_PROPERTY() and G_REPLACE_ACTION(). [Nikolai Weibull] * Fixes * GLib::IOChannelWin32Socket.new uses raw socket handle not file descriptor. [NAKAMURA Usaku, Kouhei Sutou] ==== Ruby/GTK2 * Fixes * [#3383158] removed non LANG=C characters to be buildable on LANG=C environment. [Antonio Terceiro, Kouhei Sutou] * Fixed Gtk::FileFilter#add_custom crash. [Jeff Moore, Kouhei Sutou] * Fixed initialization order. [ashbb, Kouhei Sutou] ==== Ruby/GooCanvas * Improvements * Supported binary bundled gem. [HAYASHI Kentaro] ==== Ruby/GtkSourceView2 * Fixes * Fixed bundled binary directory path on Windows. [HAYASHI Kentaro] ==== Ruby/GtkMozEmbed * Deprecated. === Thanks * Antonio Terceiro * OBATA Akio * NAKAMURA Usaku * HAYASHI Kentaro * Jeff Moore * ashbb * Nikolai Weibull == Ruby-GNOME2 1.0.0: 2011-07-13 This is the first major release!!! === Changes ==== Document * Fixes * updated deprecated list in README. [Michal Suchanek, Kouhei Sutou] ==== Ruby/GLib2 * Improvements * bind g_io_channel_win32_new_socket() as GLib::IOChannelWin32Socket. [Kouhei Sutou] * Fixes * [#3312572] added missing parentheses. [Evan Phoenix] === Thanks * Evan Phoenix * Michal Suchanek == Ruby-GNOME2 0.90.9: 2011-06-11 NOTE: 0.90.x releases are for 1.0.0 major release. This is the last release of 0.90.x series. The next release will be 1.0.0! === Changes ==== All * Fixes * Fix a bug in version numbers. [Grant Schoep, Vincent Carmona] * Support 'bundle install' . ==== Ruby/GLib2 * Improvements * Support GLib::IOChannel.new(fd) and GLib::IOChannel#fd on Windows. * GLib::IOChannel#write returns written byte not self. [backward incompatible] ==== Ruby/GTK2 * Fixes * fix misc/bindings.rb sample (ruby 1.9). [Vincent Carmona] * [#3305589] fix Gtk::Window#add_accel_group misses a reference to accel group. [Piotr Korzuszek, Kouhei Sutou] * Support cairo related samples in Ruby 1.9. [Jon, Kouhei Sutou] ==== Ruby/GStreamer * Improvements * add Gst::Registry.update method. [Vincent Carmona] ==== Ruby/VTE * Fixes * [#3199587] fix pc install. [OBATA Akio, Kouhei Sutou] ==== Ruby/Poppler * Fixes * [#3292118] don't run needless tests. [Mamoru Tasaka, Kouhei Sutou] ==== Ruby/GtkSourceView2 * Improvements * support Windows. [S.Kitagawa] === Thanks * OBATA Akio * Grant Schoep * Mamoru Tasaka * Piotr Korzuszek * S.Kitagawa * Jon == Ruby-GNOME2 0.90.8: 2011-03-04 NOTE: 0.90.x releases are for 1.0.0 major release. A bug fix release of 0.90.7. === Changes ==== All * Fixes * 'make distclean' does not removed pkg-config files. ==== Ruby/GLib2 * Fixes * fix non-gem rcairo detection. [#3178228] [OBATA Akio, Kouhei Sutou] ==== Ruby/Atk * Fixes * fix 'make distclean' cleans needed a file. [Vincent Carmona] ==== Ruby/Pango * Fixes * fix 'make distclean' cleans needed a file. [Vincent Carmona] ==== Ruby/GTK2 * Fixes * fix require order. [id:kenhys] * [#3046538] fix crash by GC at exit. [Vincent Carmona, Kouhei Sutou] * gtk-demo samples with ruby 1.9 (excepted cairo ones). [Vincent Carmona] ==== Ruby/GooCanvas * Fixes * fix pc install. [#3178294] [OBATA Akio, Kouhei Sutou] ==== Ruby/GStreamer * Improvements * improve missing message. [Vincent Carmona] * add Gst::InstallPlugins. [Vincent Carmona, Kouhei Sutou] * Fixes * fix pc install. [#3178294] [OBATA Akio, Kouhei Sutou] * don't use rbgprivate.h. [#3188442] [Mamoru Tasaka, Kouhei Sutou] ==== Ruby/GtkMozEmbed * Fixes * fix pc install. [#3178294] [OBATA Akio, Kouhei Sutou] ==== Ruby/GtkSourceView2 * Fixes * fix pc install. [#3178294] [OBATA Akio, Kouhei Sutou] === Thanks * OBATA Akio * Vincent Carmona * id:kenhys * Mamoru Tasaka == Ruby-GNOME2 0.90.7: 2011-02-02 NOTE: 0.90.x releases are for 1.0.0 major release. A package fix release of 0.90.6. === Changes ==== Ruby/GLib2 * Improvements * force remove "-Wl,--no-undefined" linker option because Ruby-GNOME2 packages doesn't support the option. [Dobai-Pataky Bálint, Kouhei Sutou] ==== Ruby/GTK2 * Improvements * use "MS-Windows" GTK+ theme by default on Windows. [ashbb, Kouhei Sutou] === Thanks * ashbb * Dobai-Pataky Bálint == Ruby-GNOME2 0.90.6: 2011-01-29 NOTE: 0.90.x releases are for 1.0.0 major release. Removed deprecated packages. All supported packages support RubyGems. All supported packages except Ruby/VTE, Ruby/GStreamer and Ruby/GtkMozEmbed support also Windows binary bundled gem. === Changes ==== All * remove all deprecated packages. [Masaaki Aoyagi] * all supported packages support RubyGems. [Masaaki Aoyagi] ==== Ruby/GLib2 * Imrpovements * add gnome2-raketask.rb that is a utility library to define Rake tasks for Ruby-GNOME2 packages. [Masaaki Aoyagi, Kouhei Sutou] * Fixes * fix GType conversion. [Kouhei Sutou] * fix rcairo installed by RubyGems detection. [Masaaki Aoyagi] ==== Ruby/GIO2 * Improvements * support GIO 2.26. [Nikolai Weibull] ==== Ruby/GStreamer * Improvements * add Gst::MissingURISourceMessage. [Vincent Carmona, Kouhei Sutou] * support RubyGems. [Masaaki Aoyagi] ==== Ruby/Pango * Fixes * rename Pango::LayoutIter#at_last_line! to at_last_line? because at_last_line is a predicate method. (at_last_line! still exists for backward compatibility.) [mrkn, Kouhei Sutou] ==== Ruby/GtkMozEmbed * Improvements * support RubyGems. [Masaaki Aoyagi] * Fixes * support "2.0b7" style module version. #3141244 [reandr, Kouhei Sutou] ==== Ruby/GooCanvas * Improvements * support RubyGems. [Masaaki Aoyagi] ==== Ruby/GtkSourceView2 * Improvements * support RubyGems. [Masaaki Aoyagi] ==== Ruby/VTE * Improvements * support RubyGems. [Masaaki Aoyagi] === Thanks * Vincent Carmona * mrkn * reandr * Nikolai Weibull * Masaaki Aoyagi == Ruby-GNOME2 0.90.5: 2010-10-28 NOTE: 0.90.x releases are for 1.0.0 major release. A build system improvements release. === Changes ==== All * Improvements * add --with-pkg-config-dir option to extconf.rb for *.pc. ==== Ruby/GLib2 * Improvements * glib-mkenums.rb can work with Ruby 1.9 on LANG=C. [Kouhei Sutou] * Bug fixes * fix pkg-config gem dependency. [Kouhei Sutou] == Ruby-GNOME2 0.90.4: 2010-10-24 NOTE: 0.90.x releases are for 1.0.0 major release. A bug fix release of 0.90.3. === Changes ==== Ruby/GLib2 * Bug fixes * add missing '*' for String type conversion. [#3093789] [tmtms, Kouhei Sutou] ==== Ruby/GIO2 * Bug fixes * Remove needless cairo dependency. [OBATA Akio, Kouhei Sutou] ==== Ruby/Libglade2 * Improvements * Don't install *.pc by default. [OBATA Akio, Kouhei Sutou] === Thanks * OBATA Akio * tmtms == Ruby-GNOME2 0.90.3: 2010-10-23 NOTE: 0.90.x releases are for 1.0.0 major release. * Support String encoding in Ruby 1.9. * RVAL2CSTR2 and CSTR2RVAL2 are deprecated. * Ruby/GIO2 is imported as an experimental library. === Changes ==== All * Support String encoding. [Guillaume Cottenceau, Neil Roberts, Kouhei Sutou] * Don't install *.pc by default. Set pkgconfigdir make varialbe like 'make pkgconfigdir=/usr/lib/pkgconfig'. ==== Ruby/GLib2 * Improvements: * declare argument types. [Nobuyoshi Nakada, Kouhei Sutou] ==== Ruby/GIO2 * Imported as an experimental library. [Nikolai Weibull] ==== Ruby/GTK2 * Improvements: * keep backward compatibility around GDK key symbols introduced at GTK+ 2.20. "[ruby-gnome2-devel-en] Constants names change in Gdk::KeyVal" [Vincent Carmona] * move gdk-pixbuf and cairo related methods from Ruby/GdkPixbuf2. "[ruby-gnome2-devel-en] gtk2 dependency to gdkpixbuf2" [Andrea Dallera, Kouhei Sutou] * Bug fixes: * fix GType conversion in Gtk::ItemFactory.new on 64bit platform. [Grant McLean, Steve Wills, Kouhei Sutou] ==== Ruby/GdkPixbuf2 * Improvements: * move gdk-pixbuf and cairo related methods to Ruby/GTK2. "[ruby-gnome2-devel-en] gtk2 dependency to gdkpixbuf2" [Andrea Dallera, Kouhei Sutou] * change .pc filename from ruby-gdkpixbuf2 to ruby-gdk-pixbuf2. ==== Ruby/RSVG2 * Bug fixes: * add missing libcroco dependency on Windows. [U.Nakamura, Kouhei Sutou] ==== Ruby/Poppler * Improvements: * support Popper 0.15.0. [#3079667] [Mamoru Tasaka, Kouhei Sutou] * Bug fixes: * add missing libjpeg dependency on Windows. [U.Nakamura, Kouhei Sutou] * fix installed Ruby/GLib2 gem can't be detected. [kdmsnr, Kouhei Sutou] === Thanks * U.Nakamura * kdmsnr * Mamoru Tasaka * Guillaume Cottenceau * Vincent Carmona * Grant McLean * Steve Wills * Andrea Dallera * Nobuyoshi Nakada * Neil Roberts == Ruby-GNOME2 0.90.2: 2010-09-26 NOTE: 0.90.x releases are for 1.0.0 major release. A RubyGems package fix release. === Changes ==== All * fix path. [kimura wataru, Kouhei Sutou] ==== Ruby/GTK2 * Bug fixes: * fix gtk2/base.rb is missing in gem. [S.Kitagawa, Kouhei Sutou] ==== Ruby/GIO2 * Bug fixes: * fix a typo in .pc name. [#3075619] [O01eg, Kouhei Sutou] ==== Ruby/RSVG2 * Bug fixes: * also check rb_cairo.h availability. [#3075617] [O01eg, Kouhei Sutou] === Thanks * S.Kitagawa * O01eg * kimura wataru == Ruby-GNOME2 0.90.1: 2010-09-23 NOTE: 0.90.x releases are for 1.0.0 major release. A install bug fix release of 0.90.0. === Changes ==== Ruby/ATK * Bug fixes: * fix .pc install path. [OBATA Akio, Kouhei Sutou] ==== Ruby/GTK2 * Bug fixes: * fix .pc install path. [OBATA Akio, Kouhei Sutou] ==== Ruby/Pango * Bug fixes: * fix .pc install path. [OBATA Akio, Kouhei Sutou] ==== Ruby/Poppler * Bug fixes: * fix .pc install path. [OBATA Akio, Kouhei Sutou] ==== Ruby/RSVG * Bug fixes: * fix .pc install path. [OBATA Akio, Kouhei Sutou] === Thanks * OBATA Akio == Ruby-GNOME2 0.90.0: 2010-09-23 NOTE: 0.90.x releases are for 1.0.0 major release. RubyGems support! === Changes ==== Ruby/GTK2 * Bug fixes: * [ruby-gnome2-devel-en] Gtk 2.20, Gtk::Builder and 'name' add Gtk::Buildable#builder_name/set_builder_name. [Simon Arnaud, Kouhei Sutou] === Thanks * Simon Arnaud == Ruby-GNOME2 0.19.4: 2011-04-17 NOTE: 0.19.x releases are development series. This release has many bug fixes and some improvements. The fixed bugs include a memory leak bug on GC. If your application live long time, you should upgrade. === Changes ==== Ruby/GLib2 * Bug fixes: * fixed type_register on Ruby 1.9. [Simon Arnaud, Kouhei Sutou] * fixed memory leak in GC. [Kouhei Sutou] ==== Ruby/GTK2 * Bug fixes: * [#2865895] support GdkWindow's cursor property. NOTE: GTK+ 2.18.0 is unsupported version. [Guillaume Cottenceau, Mamoru Tasaka] * Gtk::MenuItem.new accepts nil as a label. [Kazuhiro NISHIYAMA, Kouhei Sutou] * fixed wrong conversion in Gtk::TreePath#<=>. [Takeuchi Yusuke, Kouhei Sutou] * fix Gtk::RecentInfo#application_info's double free bug. [Kouhei Sutou] * Improvements: * Gdk::Window#invalidate accepts nil as 'area' argument. It means 'invalidates whole window'. [Hiroyuki Ito] * Gtk::Clipbord#request_text sets UTF-8 encoding in Ruby 1.9. [Rg Rg, Kouhei Sutou] * add Gtk::TreePath#==. [Takeuchi Yusuke, Kouhei Sutou] ==== Ruby/Pango * Improvements: * add Pango::Gravity. [Hiroyuki Ito, Kouhei Sutou] ==== Ruby/GdkPixbuf * add Gdk::Pixbuf#pixels=. [Michal Suchanek] ==== Ruby/GStreamer * Bug fixes: * [#2920997] fix argument type. [Johan Kiviniemi] * [#2924886] implement Gst::MessageTag#parse. [Vincent Carmona] ==== Ruby/GtkMozEmbed * Bug Fixes: * [#2924766] fix -Wl,-rpath syntax. [OBATA Akio] * [#2925285] Gtk::MozEmbed#chrome_mask fails. [tobi, Kouhei Sutou] * support XULRunner 1.9.2. [OBATA Akio] === Thanks * Guillaume Cottenceau * Mamoru Tasaka * Michal Suchanek * Simon Arnaud * Kazuhiro NISHIYAMA * Johan Kiviniemi * OBATA Akio * Hiroyuki Ito * Rg Rg * Vincent Carmona * tobi * Takeuchi Yusuke == Ruby-GNOME2 0.19.3: 2009-09-24 NOTE: 0.19.x releases are development series. This release is a bug fix release of 0.19.2. === Changes ==== Ruby/GLib2 * Bug fix: * really fix 'empty $(vendorarchdir) related build problem on CentOS 5.3 x86_64.' [Simon Arnaud, Kouhei Sutou] === Thanks * Simon Arnaud == Ruby-GNOME2 0.19.2: 2009-09-23 NOTE: 0.19.x releases are development series. This release is a bug fix release of 0.19.1. === Changes ==== Ruby/GLib2 * Bug fixes: * empty $(vendorarchdir) related build problem on CentOS 5.3 x86_64. [Toshiyuki Suzumura, Kouhei Sutou] * [#2862022] fix multi thread blocking with Ruby 1.8.6-p368 or later and 1.8.7-p173 or later. [Roy Wright, Andrea Dallera, Kouhei Sutou] * [Debian #502262] work Ruby thread with GTK+. [Johan Walles, Kouhei Sutou] ==== Ruby/GTK2 * Bug fixes: * [#2679744] fix a typo: Gtk::Widget#set_scroll_adjustment -> Gtk::Widget#set_scroll_adjustments. [Kentaro Fukuchi, Kouhei Sutou] ==== Ruby/GtkMozEmbed * Bug fixes: * fix .pc detection. [OBATA Akio, Kouhei Sutou] === Thanks * OBATA Akio * Toshiyuki Suzumura * Roy Wright * Andrea Dallera * Johan Walles * Kentaro Fukuchi == Ruby-GNOME2 0.19.1: 2009-07-26 NOTE: 0.19.x releases are development series. This release is a bug fix release of 0.19.0. === Changes ==== Ruby/GTK2 * use RUBYARCHDIR [OBATA Akio] * #2814953: install missing headers [Mamoru Tasaka] ==== Ruby/GLib2 * Bug fixes: * avoid object allocation while GC [OBATA Akio, Kouhei Sutou] * use RUBYARCHDIR [OBATA Akio] * mkmf-gnome2.rb add "-I$(vendorarchdir)" to $CPPFLAGS. [OBATA Akio, Kouhei Sutou] ==== Ruby/ATK * use RUBYARCHDIR [OBATA Akio] ==== Ruby/Pango * use RUBYARCHDIR [OBATA Akio] * use gem version rcairo as fallback [OBATA Akio] ==== Ruby/Libart * use RUBYARCHDIR [OBATA Akio] ==== Ruby/GdkPixbuf * use gem version rcairo as fallback [OBATA Akio] ==== Ruby/GnomePrint * install rblibgnomeprintversion.h [OBATA Akio, Kouhei Sutou] ==== Ruby/GtkMozEmbeded * fix header generation error caused by missing file [OBATA Akio] ==== Ruby/VTE * support VTE 0.20 [Kouhei Sutou] ==== Ruby/PanelApplet * #2815036: re-support Ruby 1.8.6. [Mamoru Tasaka, Kouhei Sutou] ==== Ruby/Libglade2 * Debian#519786: fix GC related SEGV when a widget in glade is removed by hand. [Arnaud Cornet, Kouhei Sutou] === Thanks * OBATA Akio * Mamoru Tasaka * Arnaud Cornet == Ruby-GNOME2 0.19.0: 2009-05-29 NOTE: 0.19.x releases are development series. This release supports new versions of panel-applet and xulrunner and fixes various bugs including some GC issues === Changes Ruby/GLib2: * add 'const' to name argument of rbgerr_define_gerror() [Nikolai Weibull, Kouhei Sutou] * Bug fixes: * #2420281: Failed to build [troels knak-nielsen, Kouhei Sutou] * #2493874: glib/rbglib_maincontext.c error in "RUBY_UBF_IO" [boo, Kouhei Sutou] * wrong priority conversion in GLib::Timeout.add and GLib::Timeout.add_seconds. [Nikolai Weibull] * fixed limits of basic types [Pascal Terjan] Ruby/GTK2: * Bug fixes: * fixed initialize function is deleted. [kimura wataru, Kouhei Sutou] * checked GTK_FILE_SYSTEM_ERROR availability. GTK+ 2.15.x doesn't have it. [Kouhei Sutou] * fixed GC problems. [Kouhei Sutou] * #2195432: Gtk::RCStyle.set_color_flags wrong conversion [Jesse van den Kieboom, Kouhei Sutou] * #2318481: gtkselectiondata_set Drag and Drop API problem [dave foster, Kouhei Sutou] * #2420281: Failed to build [troels knak-nielsen, Kouhei Sutou] Ruby/Pango: * added Pango::Attribute#start_index= and Pango::Attribute#end_index=. [Geoff Youngs, Kouhei Sutou] Ruby/Poppler: * removed 0.6.x support. 0.8.0 or later is required. [Kouhei Sutou] Ruby/RSVG2: * fixed broken cairo integration. [James Healy, Kouhei Sutou] Ruby/PanelApplet: * #2466921: fixed build failure with libpanel-applet >= 2.25 [Mamoru Tasaka, Kouhei Sutou] * fixed incomplete install. [Pascal Terjan, Kouhei Sutou] Ruby/GtkMozEmbed: * supported XULRunner 1.9.0. [Arnaud Cornet, Kouhei Sutou] Ruby/GNOME2: * supported MinGW. [id:luna_8bit, Kouhei Sutou] Ruby/Bonobo2: * moved Bonobo.setup_x_error_handler to Ruby/BonoboUI2. [id:luna_8bit, Kouhei Sutou] Ruby/BonoboUI2: * moved Bonobo.setup_x_error_handler from Ruby/Bonobo2. [id:luna_8bit, Kouhei Sutou] Ruby/GnomeVFS: * format security error. [Pascal Terjan] === Thanks * kimura wataru * Philipp Götzinger * Andrew S. Townley * Jesse van den Kieboom * James Healy * dave foster * troels knak-nielsen * boo * Geoff Youngs * Arnaud Cornet * id:luna_8bit == Ruby-GNOME2 0.18.0: 2008-09-30 This release fixes some memory leak bugs and has new experimental packages. === Changes Ruby/GLib2: * mkmf-gnome2.rb: add check_cairo. [Kouhei Sutou] * fixed memory leaks. [Kouhei Sutou] * [#2110165] Gdk::Pixbuf memory leak * install glib-enum-types.h. [Andy Spencer] * [#2106938] Install glib-enum-types.h Ruby/GTK2: * add GTK+ 2.12 related bindings. [Guillaume Cottenceau] * fixed initialize order. [Kouhei Sutou] * [#2113491] Incorrect initialize order (compiling with mingw) Ruby/GooCanvas [NEW][EXPERIMENTAL]: * added. [Kouhei Sutou] Ruby/Pango: * fixed memory leaks. [Kouhei Sutou] Ruby/GtkSourceView2 [NEW][EXPERIMENTAL]: * add. [yselkowitz] === Thanks * OBATA Akio * James Healy * Ricky Zheng * Guillaume Cottenceau * Ricky Zheng == Ruby-GNOME2 0.17.0: 2008-09-07 === Release notes * This Release supports Ruby 1.8.7 and has many bug fixes and new bound functions. === Main changes Ruby/GLib: * [#2060606] Crash when removing ruby applet from gnome panel with 0.7rc1 [Kouhei Sutou] Ruby/GTK: * [#2025651] FTBFS with gtk+ 2.13.5 [Cesare Tirabassi, Kouhei Sutou] * [#2043970] Segfaults on 64-bit Linux [Neil Roberts, Kouhei Sutou] Ruby/Pango: * [#2043970] Pango::FontDescription#weight= seg fault [Kouhei Sutou] Many other changes, GC bugs, Segfault fixes. See corresponding ChangeLog for detailed information on changes and contributors. === Thanks Special thanks for your contributions to: (list in no particular order) * Neil Roberts * Cesare Tirabassi * Arnaud Cornet == Ruby-GNOME2 0.17.0-rc1: 2008-06-06 === Release notes * This Release Candidate seems to be pretty stable. Please give us feedback if you encounter any problems. * The win32 bindings will be released later and will be considered as EXPERIMENTAL The changes marked with 2 stars (**) may currently not work on win32 platforms. === Main changes Ruby/GLib: * Bound functions defined since 2.14 and 2.16. * Improved main loop polling. ** * Improved callback handling from non Ruby thread. ** This changes breaks API. Sjoerd, you need to call rbgutil_start_callback_dispatch_thread() in your GStreamer bindings. Sorry. * Supported convenience GEnum and GFlags notation. e.g.: GLib::UTF8.normalize(utf8, GLib::NormalizeMode::NFD) -> GLib::UTF8.normalize(utf8, :nfd) key_file.load_from_data(data, GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS) -> key_file.load_from_data(data, [:keep_contents, :keep_translations]) * Fixed locale dependent constant name computation. [#1901843] [Kouhei Sutou] Ruby/GTK: * partially support new symbols in 2.12 (Gtk::RecentAction, Gtk::TextBuffer, Gdk::Display, Gtk::TreeViewColumn, Gtk::Stock, Gtk::Widget, Gtk::ScaleButton, Gtk::TreeView, Gtk::VolumneButton, Gtk::Tooptip and Gtk::TextMark only). * [#2025651] FTBFS with gtk+ 2.13.5 [Cesare Tirabassi, Kouhei Sutou] * [#2043970] Segfaults on 64-bit Linux [Neil Roberts, Kouhei Sutou] Ruby/GStreamer: * Worked with GStreamer >= 0.10.x but isn't completed yet. Ruby/Poppler: * Supported poppler-glib 0.6.x and 0.8.0. [Kouhei Sutou] Ruby-GNOME2: * Ruby-GNOME2 can be built with ruby 1.9.0 but doesn't work well without [ruby-dev:34104] patch. * Some extconf.rb improvements Many other changes, GC bugs, Segfault fixes. See corresponding ChangeLog for detailed information on changes and contributors. === Thanks Special thanks for your contributions to: (list in no particular order) * Kazuhiro NISHIYAMA * Kouhei Sutou * Kero van Gelder * Masahiro Sakai * Detlef Reichl * Guillaume Cottenceau * Masahiro Sakai * Mikael Hallendal * Carlo E. Prelz * Sjoerd Simons * Juergen Mangler * Dirk von Schmieden * Mathieu Blondel * Joseph Method * Masayuki Yamaguchi And also special thanks to all other contributors not listed above! == Ruby-GNOME2 0.16.0: 2006-12-30 Ruby-GNOME2: * Fixed serious bugs (depends on GC) * Support GTK+-2.10 and the latest version of each libraries. * Don't include Ruby/GStreamer and Ruby/Libgda. We cancel to support Ruby/GStreamer and Ruby/Libgda. * Cancel to support ruby-1.6.x and GTK+-2.4 or earlier. Ruby/GLib: * Support GLib+-2.10 APIs. [Kouhei Sutou, Masao Mutoh] * Fix segfaults related GC with signal handlers. [Guillaume Cottenceau, Kouhei Sutou] * Add functions for Unicode Manipulation [Kouhei Sutou] GLib::Unicode, GLib::UTF8, GLib::UTF16, GLib::UCS4, GLib::UniChar * Add Key-value file parser [Masao Mutoh] GLib::KeyFile * Add Bookmark file parser [Masao Mutoh] GLib::BookmarkFile * Add Win32 compatibility functions [Masao Mutoh] GLib::Win32 * Add glib-mkenums.rb [Kouhei Sutou, Masao Mutoh] * Other improvement and fix bugs.[Kouhei Sutou, Masao Mutoh] Ruby/ATK: * Support ATK-1.12 APIs. [Masao Mutoh] Ruby/Pango: * Support Pango-1.2, 1.4 APIs [Masao Mutoh] * Fix some bugs. [Masao Mutoh] Ruby/GdkPixbuf: * Move Cairo::Context#set_source_pixbuf from Ruby/GTK.[Kouhei Sutou] You can use the methods unless X server. Ruby/GTK: * Support GTK+-2.10. [Pascal Terjan, Kouhei Sutou, Masao Mutoh] Gtk::PrintUnixDialog, Gtk::PageSetupUnixDialog, Gtk::Print*, Gtk::PageSet Gtk::LinkButton, Gtk::Recent*, Gtk::Assistant, Gtk::StatusIcon * Other improvement and fix bugs [Sjoerd Simons, Kouhei Sutou, Masao Mutoh] Ruby/GNOME: * None. Ruby/GnomeCanvas: * Fixed a bug and trivial improvement. [Masao Mutoh] Ruby/Libglade: * Fixed some bugs and trivial improvement. [Kouhei Sutou, Masao Mutoh] Ruby/Libart: * a trivial improvement. [Kouhei Sutou] Ruby/GConf: * Sample code cleanup. [Masao Mutoh] Ruby/GnomeVFS: * None. Ruby/GtkHtml2: * None. Ruby/GtkGLExt: * None. Ruby/PanelApplet: * None. Deprecated (Use Gtk::StatusIcon in Ruby/GTK+) Ruby/GtkSourceView: * Support gtksourceview-1.8. Some improvements. [Kouhei Sutou, Masao Mutoh] Ruby/GnomePrint: * None. Ruby/GnomePrintUI: * a trivial improvement. [Kouhei Sutou] Ruby/RSVG: * Added a sample [Kouhei Sutou] * Improved, fixed bugs [Kouhei Sutou] Ruby/GtkMozEmbed: * a trivial improvement. [Masao Mutoh] Ruby/Poppler: * Improved, fixed bugs [Kouhei Sutou] Ruby/VTE: * None. Ruby/GStreamer: * Canceled. Ruby/Libgda: * Canceled. == Ruby-GNOME2-0.15.0: 2006-07-01 Ruby/GLib: * Improve signal handlers with pthread ruby(--enable-pthread). [Sjoerd Simons] * Added new fundamental object for other bindings. [Sjoerd Simons] * GLib::Source#remove -> GLib::Soruce.remove [Kouhei Sutou] * Added new macros (GLIST2ARYF, GLIST2ARY2F, GSLIST2ARYF, GLIST2ARY2F, G_PROTECT_CALLBACK) [Masao Mutoh] * Added GLib.win32_locale, GLib, win32_locale_filename_from_utf8 [Kouhei Sutou] * Improve memory management [Kouhei Sutou, Sjoerd Simons, Masahiro Sakai, Masao Mutoh] * Other improvement and fix bugs. [Sjoerd Simons, Joao Pedrosa, Kouhei Sutou, Masahiro Sakai, Masao Mutoh] Ruby/ATK: * Improved cygwin support. [Masao Mutoh] * Fix a bug. [Masahiro Sakai] Ruby/Pango: * Fix some bugs. [Laurent Sansonetti, Masao Mutoh] * Added Pango::Layout#markup=, Pango::AttrAbsoluteSize [Masao Mutoh] Ruby/GdkPixbuf: * Fix a bug. [NISHI Takao] * Code cleanup [Masao Mutoh] Ruby/GTK: * Improve signal handlers. [Masahiro Sakai] * Added Gtk::Widget#set_widget, #set_requisition. [Daniel Chokola] * Added Gtk::Dialog#get_response. [Masao Mutoh] * Other improvement and fix bugs [Mario Steele, Tilman Sauerbeck, Geoff Youngs, Masahiro Sakai, Kouhei Sutou, Masao Mutoh] Ruby/GNOME: * Follow Ruby/GLib2 change(GRClosure). [Kouhei Sutou] Ruby/GnomeCanvas: * Code cleanup [Kouhei Sutou, Masao Mutoh] Ruby/Libglade: * Fixed some bugs and trivial improvement. [Masao Mutoh] Ruby/Libart: * None. Ruby/GConf: * Sample code cleanup. [Masao Mutoh] Ruby/GStreamer: * Sample code cleanup. [Masao Mutoh] Ruby/GnomeVFS: * Improved and fixed bugs. [Masahiro Sakai, Masao Mutoh] Ruby/GtkHtml2: * Sample code cleanup. [Masao Mutoh] Ruby/GtkGLExt: * Improved and fixed bugs. [Kouhei Sutou, Masao Mutoh] Ruby/Libgda: * Fix build against 1.3.x branch (libgda-2.x). [Laurent Sansonetti] Ruby/PanelApplet: * Fixed a bug [Patch #1431855] Ruby/GtkSourceView: * Sample code cleanup. [Masao Mutoh] Ruby/GnomePrint: * Added Gnome::Print::BINDING_VERSION. Code cleanup [Kouhei Sutou] Ruby/GnomePrintUI: * Added Gnome::PrintUI::BINDING_VERSION. [Kouhei Sutou] * Sample code cleanup. [Masao Mutoh] Ruby/RSVG: * Added RSVG::BINDING_VERSION, RBRSVG_MAJOR_VERSION, RBRSVG_MINOR_VERSION, RBRSVG_MICRO_VERSION. [Kouhei Sutou] * Supported 2.14. * Improved, fixed bugs [Kouhei Sutou, Masao Mutoh] Ruby/GtkMozEmbed: * Improved, fixed bugs [Mirko Maischberger, Masao Mutoh] Ruby/Poppler [NEW] [EXPERIMENTAL]: * Added [Kouhei Sutou] Ruby/VTE [NEW]: * Added [Kouhei Sutou] == Ruby-GNOME2 0.14.1: 2005-11-06 Ruby/GLib: * Fix memory leaks. [Masao Mutoh] Ruby/ATK: * None. Ruby/Pango: * Fix some bugs. [Masao Mutoh] Ruby/GdkPixbuf: * None. Ruby/GTK: * Improve memory management. [Masao Mutoh] Ruby/GNOME: * None. Ruby/GnomeCanvas: * None. Ruby/Libglade: * None. Ruby/Libart: * None. Ruby/GConf: * None. Ruby/GStreamer: * None. Ruby/GnomeVFS: * None. Ruby/GtkHtml2: * None. Ruby/GtkGLExt: * None. Ruby/Libgda: * None. Ruby/PanelApplet: * None. Ruby/GtkSourceView: * None. Ruby/GnomePrint: * None. Ruby/GnomePrintUI: * None. Ruby/RSVG: * None. Ruby/GtkMozEmbed: * None. == Ruby-GNOME2 0.14.0: 2005-10-16 Ruby/GLib: * Fix segfault related on GC. [Masao Mutoh] * Support Ruby-GetText-Pacakge(Include pseudo GetText module). [Masao Mutoh] * Add and completed: [Masao Mutoh] * Glib::Shell, GLib::Completion, GLib::Timer, sample/shell.rb, completion.rb, timer.rb. * Add some methods, improved, fixed bugs: [Pascal Terjan, Sven Herzberg, Masao Mutoh] * GLib, GLib::Object, GLib::MetaInterface, GLib::Enum, GLib::Flags, PKGConfig, extconf.rb, mkmf-gnome2.rb Ruby/ATK: * Support ATK-1.10. [Masao Mutoh] * Add Atk::BUILD_VERSION. [Masao Mutoh] * Add some methods, improved, fixed bugs: [Masao Mutoh] * Atk, Atk::Relation, Atk::RelationSet, Atk::StreamableContent, Atk::Text::Attribute, Atk::Util * Add and completed: [Masao Mutoh] * Atk::Util::KeyEventType Ruby/Pango: * Support Pango-1.10 and cairo [Kouhei Sutou, Masao Mutoh] * Add Pango::BUILD_VERSION. [Masao Mutoh] * Add some methods, improved, fixed bugs: [Kouhei Sutou, Masao Mutoh] * Pango, Pango::Layout, Pango::LayoutLine, Pango::LayoutIter, Pango::Language, Pango::Font, Pango::GlyphItem, Pango::GlyphString, Pango::Context, Pango::Analysis, Pango::Item * Add and completed: [Masao Mutoh] * Pango::ScriptIter, Pango::Script, Pango::(.*)FontMap, Pango::(.*)Face, Pango::(.*)Family, Pango::XFont, Pango::FT2Font, sample/script.rb, break.rb, item.rb, layout.rb * Add classes: [Kouhei Sutou, Masao Mutoh] * Pango::Engine, Pango::EngineShape, Pango::EngineLang Cairo::Context, Pango::CairoFcFont, Pango::CairoFont, Pango::CairoWin32Font, Pango::CairoFontMap * Rename class name: [Masao Mutoh] * Pango::FontSet -> Pango::Fontset, Pango::FontSetSimple -> Pango::FontsetSimple. Ruby/GdkPixbuf: * Support GTK+-2.8. [Guillaume Cottenceau] * Add some methods, improved, fixed bugs: [Kouhei Sutou, Guillaume Cottenceau] * Gdk::Pixbuf * Add and completed: [Guillaume Cottenceau] * Gdk::PixbufSimpleAnim, sample/simpleanim.rb Ruby/GTK: * Support GTK+-2.8. [Guillaume Cottenceau, Masao Mutoh] * Support cairo. [Kouhei Sutou, Masao Mutoh] * Add Gtk::BUILD_VERSION. [Masao Mutoh] * Add some methods, improve, fix bugs: [Guillaume Cottenceau, Masao Mutoh] * Gdk, Gdk::Drawable, Gdk::Display, Gdk::Drawable, Gdk::Cursor, Gdk::Window, Gdk::Screen, Gtk::Action, Gtk::Dialog, Gtk::Drag, Gtk::EntryCompletion, Gtk::FileChooser, Gtk::IconView, Gtk::Image, Gtk::Menubar, Gtk::MenuShell, Gtk::ScrolledWindow, Gtk::SizeGroup, Gtk::Stock, Gtk::TextBuffer, Gtk::TextIter, Gtk::ToolButton, Gtk::TreeRowReference, Gtk::TreeView, Gtk::TreeViewColumn, Gtk::Window, sample/gtk-demo/*.rb * Add: [Guillaume Cottenceau, Kouhei Sutou] * Cairo::Context, Gdk::EventGrabBroken, sample/gtk-demo/cairo_*.rb, sample/misc/rgtk+cairo.rb Ruby/GNOME [Masao Mutoh]: * Support libgnome/libgnomeui-2.12. * Add Gnome::BUILD_VERSION. * Add some methods, improve, fix bugs: * Gnome, Gnome::Util, Gnome::URL, Gnome::Help, Gnome::App, Gnome::Client * Add: Gnome::GConf, Gnome::Sound, Gnome::Trigger * sample/gnome-trigger.rb, sample/gnome-sound.rb Ruby/GnomeCanvas: * Support libgnomecanvas-2.12. [Pascal Terjan, Masao Mutoh] * Add Gnome::Canvas::BUILD_VERSION. [Masao Mutoh] * Add some methods, improve, fix bugs: [Kouhei Sutoh, Pascal Terjan, Masao Mutoh] * Gnome::CanvasItem, Gnome::CanvasPathDef, Gnome::Canvas. * Add: Gnome::CanvasBuf. [Masao Mutoh] Ruby/Libglade [Masao Mutoh]: * Support libglade-2.12. * Add GladeXML::BUILD_VERSION. * Add some methods, improve, fix bugs: bin/ruby-glade-create-template, sample/l10n_*.rb, GladeXML Ruby/Libart [Masao Mutoh]: * Add Art::BUILD_VERSION. * Add: Art::Uta. Ruby/GConf: * Support Cygwin. [Yaakov Selkowitz] * Add GConf::BUILD_VERSION. [Masao Mutoh] Ruby/GStreamer: * Support on Ruby-1.9. [Laurent Sansonetti] * Add Gst::BUILD_VERSION. [Masao Mutoh] * Fix bugs, improve, add some methods: [Masao Mutoh] * Gst::Element Ruby/GnomeVFS: * Support Cygwin. [Yaakov Selkowitz] * Add GnomeVFS::BUILD_VERSION. [Masao Mutoh] * Fix bugs, improve, add some methods: [Masao Mutoh] * GnomeVFS Ruby/GtkHtml2 [Masao Mutoh]: * Add Gtk::HtmlContext::BUILD_VERSION. Ruby/GtkGLExt: * Added Gtk::GL::BUILD_VERSION. [Masao Mutoh] * Fix bugs, improve, add some methods: [Kouhei Sutou] * Gdk::Pixmap Ruby/Libgda: * Support Cygwin. [Yaakov Selkowitz] * Add Gda::BUILD_VERSION. [Masao Mutoh] Ruby/PanelApplet [Masao Mutoh]: * Add PanelApplet::BUILD_VERSION. Ruby/GtkSourceView [Masao Mutoh]: * Support GtkSourcView-1.4. * Add Gtk::SourceView::BUILD_VERSION. * Fix bugs, Improve, Add some methods: * Gtk::SourceView, Gtk::SourceBuffer, Gtk::SourceTag, Gtk::SourceTagStyleMask * Add and completed: * Gtk::SourceStyleScheme, Gtk::SourcePrintJob Ruby/GnomePrint [Kouhei Sutou]: * Support libgnomeprint-2.12. * Add Gnome::Print::BUILD_VERSION * Fix bugs, Improve, Add some methods: * Gnome::PrintContext * Add: sample/gp-pac.rb Ruby/GnomePrintUI [Kouhei Sutou]: * Support libgnomeprintui-2.12. * Add: * Gnome::PrintUI::BUILD_VERSION, Gnome::FontSelection, Gnome::FontPreview, Gnome::FontDialog, Gnome::PrintContentSelector Ruby/RSVG [Kouhei Sutou]: * Support rsvg-2.12. * Add RSVG::BUILD_VERSION Ruby/GtkMozEmbed [NEW]: * Merged. [Mirko Maischberber] * Add Gtk::MozEmbed::BUILD_VERSION [Masao Mutoh] == Ruby-GNOME2 0.13.0: 2005-07-31 Ruby/GLib: * Fixed GCC 4.0 warnings [Masao Mutoh] * Added and completed: [Masao Mutoh] * GLib:PollFD, GLib::Source, GLib::MainLoop, GLib::IOChannel, GLib::Idle, GLib::ChildWatch * Added some methods, improved, fixed bugs: [Vincent Isambart, Masao Mutoh] * PKGConfig, extconf.rb, * Added: [Masao Mutoh] * GLib::MainContext, sample/iochannel.rb, idle.rb, timeout.rb, timeout2.rb, tests/test-iochannel.*, runner.rb, Ruby/ATK: * None. Ruby/Pango: * Fixed GCC 4.0 warnings [Masao Mutoh] * Support x86_64 [Masao Mutoh] * Pango::Layout * Added some methods, improved, fixed bugs: [Mirko Maischberger, Pascal Terjan, Masao Mutoh] * sample/parse.rb, Pango::LayoutLine, Pango::Coverage, Pango::LayoutIter, Pango::FontFamily, Pango::Attriterator Ruby/GdkPixbuf: * Fixed GCC 4.0 warnings [Masao Mutoh] * Fixed bugs, Improved: [Mirko Maischberger, Masao Mutoh] * sample/*.rb Ruby/GTK: * Support x86_64 [Kouhei Sutou, Masao Mutoh] * Gdk::Atom, Gtk::ItemFactory, Gtk::Widget, Gtk::Drag, Gtk::SizeGroup * Fixed GCC 4.0 warnings [Masao Mutoh] * Fixed bugs, Improved, Added some methods: [Hiroyuki Ikezoe, KATO Kazuyoshi, Pascal Terjan, Kouhei Sutou, Mirko Maischberger, Masao Mutoh] * Gtk::ActionGroup, Gtk::IconTheme, Gtk::RC, Gtk::TreeModel, Gdk::TimeCoord, Gdk::Window, Gtk::CellView, Gtk::ToolButton, Gtk::MenuToolButton, Gdk, Gdk::Display, Gdk::GC, Gdk::PangoAttrEmbossed, Gdk::Drawable, Gtk::Window, sample/gtk-demo/main.rb, sample/misc/*.rb, sample/testgtk/*.rb. * Added: [KATO Kazuyoshi, Masao Mutoh] * sample/gtk-demo/hypertext.rb, sample/misc/colorselection.rb Ruby/GNOME [Mirko Maischberger]: * sh-bang (!#) normalization * sample/test-gnome/*.rb Ruby/GnomeCanvas [Kouhei Sutou]: * Support x86_64, Improved. [Kouhei Sutou] * Gnome::CanvasPathDef Ruby/Libglade: * None. Ruby/Libart: * Added [Kouhei Sutou] * Art::DRect, Art::IRect * Fixed bugs, Improved, Added some methods: [Kouhei Sutou, Masao Mutoh] * Art::Affine, Art::BPath. Art::Canvas Ruby/GConf: * None. Ruby/GStreamer: * Fixed GCC 4.0 warnings [Masao Mutoh] * Added: [Laurent Sansonetti] * Gst::XOverLay, sample/video-player.rb, * Fixed bugs, Improved, Added some methods: [Laurent Sansonetti] * Gst::Caps, Gst::Pad, Gst::Element, Gst::TagSetter Ruby/GnomeVFS [Masao Mutoh]: * Fixed bugs, Improved, Added some methods: GnomeVFS::File Ruby/GtkHtml2: * None. Ruby/GtkGLExt: * None. Ruby/Libgda: * None. Ruby/PanelApplet [Masao Mutoh]: * Check libpanel-applet version(2.6 or later): extconf.rb Ruby/GtkSourceView [Masao Mutoh]: * None. Ruby/GnomePrint: * Fixed GCC 4.0 warnings [Masao Mutoh] * Fixed bugs, Improved, Added some methods. [Kouhei Sutou] * Gnome::PrintContext, Gnome::PrintJob, Gnome::PrintConfig, Gnome::PrintUnit, Gnome::PrintPaper, src/lib/gnomeprint2.rb, sample/to_file.rb Ruby/GnomePrintUI: * Fixed GCC 4.0 warnings [Masao Mutoh] * Fixed bugs, Improved, Added some methods. [Kouhei Sutou] * Gnome::PaperSelector, Gnome::PrintUnitSelector, Gnome::PrintPreview, Gnome::PrintDialog, Gnome::PrintConfigDialog, sample/dialog.rb, Ruby/RSVG: * Fixed GCC 4.0 warnings [Masao Mutoh] * Fixed bugs, Improved, Added some methods. [Kouhei Sutou] == Ruby-GNOME2 0.12.0: 2005-03-06 Ruby/GLib: * Support GLib-2.6.x. [Masao, Mutoh] * Support MS VC++. [Masao, Mutoh] * Fix bugs, Improved, Added some methods. [KATO Kazuyoshi, Masao Mutoh] * PKGConfig, rbgobj_lookup_class(). * Added: [Masao, Mutoh] * GLib::Threads, src/lib/pkg-config.rb, sample/spawn.rb. Ruby/ATK [Dafydd Harries, Vincent Isambart, Masao Mutoh]: * Support MS VC++. * Fix bugs, Improved, Added some methods. * Follow Ruby/GLib changes. Ruby/Pango [Masao Mutoh]: * Support Pango-1.8.x. * Support MS VC++. * Follow Ruby/GLib changes. * Added and completed: * Pango::Renderer, Pango::Matrix, Pango::AttrStrikethroughColor, Pango::AttrUnderlineColor, Pango::GlyphItem * Added some methods, improved, fixed bugs: [Matthew Berg] * Pango::Context, Pango::AttList, Pango::Attribute, Pango::Layout, Pango, Pango::AttrSize, Pango::LogAttr, Pango::Item, Pango::Analysis, Pango::Font, Pango::FontDescription, Pango::FontFace, Pango::FontSet, Pango::AttrList, Pango::AttrIterator, Pango::Rectangle, Pango::Layout, Pango::LayoutLine, Pango::LayoutIter, Pango::GlyphInfo * Added * Pango::FcFont, Pango::XftFont, Pango::FontFcFontMap, Pango::XftFontMap. * Renamed, Moved * Pango::FontFamily#list_faces -> #faces. Ruby/GdkPixbuf [leon breedt, Masao Mutoh]: * Support GTK+-2.6.x. * Follow Ruby/GLib changes. * Fixed bugs, Improved, Added some methods for GTK+-2.6.x: * Gdk::PixbufAnimationIter, Gdk::Pixbuf, Gdk::PixbufLoader, Gdk::PixbufFormat Ruby/GTK: * Support Ruby-1.9.x. * Support Pango-1.8.x. * Support GTK+-2.6.x. * Support MS VC++. * Follow Ruby/GLib changes. * Improve to support gthread. * Added and completed for GTK+-2.6.x: [Darren Willis, * Gtk::CellRendererProgress, Gtk::ScrollStep, Gtk::IconView, Gtk::CellRendererCombo, Gtk::AboutDialog, Gdk::PangoRenderer, Gtk::CellView, Gtk::MenuToolButton, Gtk::FileChooserButton, Gdk::EventChange, Gdk::X11 * Fixed bugs, Improved, Added some methods for GTK+-2.6.x: [Mirko Maischberger, Joao Pedrosa, KATO Kazuyoshi, Masao Mutoh] * Gtk, Gtk::CellLayout, Gtk::RadioToolButton, Gtk::ToggleToolButton, Gtk::Stock, Gtk::Image, Gtk::Label, Gtk::Progressbar, Gtk::EntryCompletion, Gtk::TextBuffer, Gtk::FileFilter, Gtk::FileChooser, Gtk::Menu, Gtk::CellRenderer, Gtk::TreeView, Gtk::TextView, Gtk::TextBuffer, Gtk::Drag, Gtk::ToolItem, Gtk::ActionGroup, Gtk::Action, Gtk::ComboBox, Gtk::Combo, Gtk::IconTheme, Gtk::SelectionData, Gtk::TargetList, Gtk::ListStore, Gtk::Window, Gtk::ToggleAction, Gtk::MessageDialog, Gdk::Region, Gdk::Window, Gtk::Clipboard, Gtk::Settings, Gtk::TreeModel, Gtk::ModelFilter, Gtk::TreeViewColumn, Gtk::Widget, Gdk::Pango, Gdk::Display, Gdk::Drawable, Gtk::RadioAction, Gdk::Screen, Gtk::TextBuffer, Gdk::Threads, sample/gtk-demo/*.rb, sample/misc/threads.rb, pangorenderer.rb * Added: [KATO Kazuyoshi, Darren Willis, Masao, Mutoh] * sample/misc/tree_progress.rb, misc_button.rb, aboutdialog.rb, aboutdialog2.rb, sample/gtk-demo/clipboard.rb, entry_completion.rb, expander.rb, iconview.rb Ruby/GNOME [Masao Mutoh]: * Follow Ruby/GLib changes. Ruby/GnomeCanvas [Masao Mutoh]: * Follow Ruby/GLib changes. Ruby/Libglade [Masao Mutoh]: * Follow Ruby/GLib changes. * Support MS VC++. * Improved. Ruby/Libart [KATO Kazuyoshi, Masao Mutoh]: * Follow Ruby/GLib changes. Ruby/GConf [Masao Mutoh]: * Follow Ruby/GLib changes. * Fixed bugs, Improved. * Deprecated: * GConf::Client.new Ruby/GStreamer: * Follow Ruby/GLib changes. [Masao Mutoh] * Added and completed: [Jack Paul, Masao Mutoh, Laurent Sansonetti] * Gst::TypeFindFactory, Gst::MediaInfoError, Gst::Tag, Gst::RegistryPool, Gst::TagSetter * Fixed bugs, Improved, Added some methods: [Jack Paul, Max Nickel, Masao Mutoh, Laurent Sansonetti] * Gst::Plugin, Gst::PluginFeature, Gst::Caps, Gst::Structure, Gst::Xml, Gst::Thread, Gst::Scheduler, Gst::SchedulerFactory, Gst::MediaInfo, sample/gst-inspect.rb Ruby/GnomeVFS [Masao Mutoh]: * Follow Ruby/GLib changes. * Fixed bugs, Improved. Ruby/GtkHtml2 [Masao Mutoh]: * Follow Ruby/GLib changes. Ruby/GtkGLExt [Masao Mutoh]: * Follow Ruby/GLib changes. Ruby/Libgda: * Support 1.1.99 * Follow Ruby/GLib changes. [Masao Mutoh] * Fixed bugs, Improved, Added some methods: [Laurent Sansonetti] Gda::DataModel, Gda::Provider, Gda::Quarklist, Gda::Connection * Renamed, Moved [Laurent Sansonetti] * Gda::DataModel#editable? => #updatable? * #editing? => changed? * #begin_edit => #begin_update * #cancel_edit => #cancel_update * #end_edit => #end_update Ruby/PanelApplet [Neil Stevens, Masao Mutoh]: * Follow Ruby/GLib changes. * Added some methods Ruby/GtkSourceView [Masao Mutoh]: * Follow Ruby/GLib changes. * Added some methods Ruby/GnomePrint: * Follow Ruby/GLib changes. [Masao Mutoh, Kouhei Sutou] * Fixed bugs, Improved, Added some methods. [Kouhei Sutou] Ruby/GnomePrintUI: * Follow Ruby/GLib changes. [Masao Mutoh, Kouhei Sutou] * Fixed bugs, Improved, Added some methods. [Kouhei Sutou] Ruby/RSVG: * Follow Ruby/GLib changes. [Masao Mutoh, Kouhei Sutou] * Fixed bugs, Improved, Added some methods. [Kouhei Sutou] == Ruby-GNOME2 0.11.0: 2004-11-14 Ruby/GLib [Kouhei Sutou, Vincent Isambart, Masao Mutoh]: * Fix bugs, Improved, Added some methods. Ruby/ATK [Vincent Isambart, Masao Mutoh]: * Support ATK+-1.7.x. * Fixed bugs, Improved, Added some methods. Ruby/Pango [Geoff Youngs, Vincent Isambart, Masao Mutoh]: * Improved, Fix bugs. Ruby/GdkPixbuf [Geoff Youngs, Masao Mutoh]: * Support GTK+-2.4.x. * Fixed bugs, Improved, Added some methods. Ruby/GTK [Geoff Youngs, Vincent Isambart, Masao Mutoh]: * Fixed bugs, Improved, Added some methods. Ruby/GNOME [Masao Mutoh]: * Improved. Ruby/GnomeCanvas [Masao Mutoh]: * Fixed bugs, Improved, Added some methods. Ruby/Libglade [Masao Mutoh]: * Improved. Ruby/Libart [Vincent Isambart, Masao Mutoh]: * Improved to support ruby-1.7.x or later. * Changed: [Masao Mutoh] * Art::Canvas::Color.new -> Art::Canvas.color. * Art::Vpath::Dash -> Art::VpathDash. Ruby/GConf [Masao Mutoh]: * Improved. Ruby/GStreamer [Masao Mutoh]: * Improved. Ruby/GnomeVFS [Masao Mutoh]: * Improved. Ruby/GtkHtml2 [Masao Mutoh]: * Improved. Ruby/GtkGLExt [Vincent Isambart]: * Improved. Ruby/Libgda: * None. Ruby/PanelApplet: * None. Ruby/GtkSourceView [Vincent Isambart, Masao Mutoh]: * Fixed bugs. Ruby/GnomePrint [NEW]: * Added. [Kouhei Sutou] Ruby/GnomePrintUI [NEW: Alpha release]: * Added. [Kouhei Sutou] Ruby/RSVG [NEW: Alpha release]: * Added. [Kouhei Sutou] == Ruby-GNOME2 0.10.1: 2004-08-16 Ruby/GdkPixbuf [Masao Mutoh]: - Fix bugs. Ruby/GTK [Masao Mutoh]: - Support GTK+-2.0.x again. Ruby/GtkSourceView [Masao Mutoh]: - Fix bugs. == Ruby-GNOME2 0.10.0: 2004-08-09 Ruby/GLib [Masao Mutoh]: * Added: [Kazuhiro NISHIYAMA, Masao, Mutoh] * GLib::Spawn, sample/utils.rb, sample/type-register2.rb * Added some methods, improved, fixed bugs: [Laurent Sansonetti, Pascal Terjan, Masao Mutoh] * GLib, GLib::Object, GLib::Log, glib2.rb, Ruby/ATK [Masao Mutoh]: * None. Ruby/Pango [Masao Mutoh]: * Fix bugs. Ruby/GdkPixbuf [Masao Mutoh]: * Removed version information. Ruby/GTK: * Support GTK+-2.4.x. * Added: [Seiya Nishizawa, Masao, Mutoh] * Gtk::ToolButton, Gtk::ToolItem, Gtk::ToggleToolButton, Gtk::SeperatorToolItem, Gtk::ComboBox, Gtk::ComboBoxEntry, Gtk::Expander, Gtk::ColorButton, Gtk::FontButton, Gtk::FileChooserWidget, Gtk::FileChooser, Gtk::FileFilter, Gtk::FileChooserDialog, Gtk::Action, Gtk::ToggleAction, Gtk::IconInfo, Gtk::IconTheme, Gtk::UIManager, Gtk::RadioAction, Gtk::CellLayout, Gtk::ActionGroup, sample/misc/entrycompletion.c, filechooser.rb, combobox.rb, expander.rb, color_font_button.rb, uimanager.rb, uimanager2.rb, uimanager2.xml * Improved, fixed bugs: [Geoff Youngs, Vincent Isambart, Kazuhiro NISHIYAMA, Masao Mutoh] * Gtk::Style, Gtk::Widget, Gtk::TextView, Gtk::Container, Gdk::EventClient, Gtk::Dialog, Gtk::Entry, Gdk::Selection, Gtk::Drag, Gdk, Gdk::Atom, Gtk::Editable, Gtk::Stock, Gtk::TextIter, Gtk::TextMark, Gtk::Style, sample/misc/dialog2.rb, entry.rb, settings.rb, * Renamed, Moved: [Masao Mutoh] * Gtk::EventCrossing::CrossingMode to Gtk::EventCrossing::Mode, Gdk::SettingAction to Gdk::EventSetting::Action Gdk::Input.set_extension_events to Gdk::Device. * Deperecated: [Masao Mutoh] * Gtk::Combo, Gtk::OptionMenu since GTK+-2.4. Ruby/GNOME: * None. Ruby/GnomeCanvas: * None. Ruby/Libglade: * Added: [Masao Mutoh] * sample/l10n*, makemo.rb, sample/po/*. * Added methods: [Masao Mutoh] * GladeXML#get_tooltips. * Improved, fixed bugs: [Masao Mutoh] * GladeXML, bin/ruby-glade-create-template Ruby/Libart: * None. Ruby/GConf: * Added some methods, Improved, fixed bugs: [Giovanni Corriga, Pascal Terjan, Kazuhiro NISHIYAMA, Masao Mutoh] * GConf::Client * Deprecated: [Masao Mutoh] * GConf::Client.new. Use GConf::Client.default instead. Ruby/GStreamer: * Requires GStreamer-0.8.x or later. * Added: [Laurent Sansonetti] * Gst::Clock, Gst::Scheduler * Added methods, improved, Fixed bugs: [Laurent Sansonetti] * Gst::Element, Gst::Bin, Gst::Caps, Gst::Structure, * Removed: [Laurent Sansonetti] * Gst::Autoplug, Gst::AutoplugFactory, Gst::Type, Gst::TypeFactory, Gst::TypeFind Gst.set_debug, Ruby/GnomeVFS: * Fixed bugs: [Pascal Terjan, Giovanni Corriga, Masao Mutoh] Ruby/GtkHtml2: * None. Ruby/GtkGLExt: * Fixed bugs: [Vincent Isambart] Ruby/Libgda: * Added methods, fixed bugs: [Laurent Sansonetti] * Gda::Command, Gda::Connection * Removed: [Laurent Sansonetti] * Gda::Export Ruby/PanelApplet [NEW]: * Added. [Jamis Buck, Masao Mutoh] Ruby/GtkSourceView [NEW]: - Added. [Laurent Sansonetti] = GNOME2 0.9.1: 2004-03-14 Ruby/GLib [Masao Mutoh]: * Fix a compilation problem on MinGW. Ruby/ATK [Masao Mutoh]: * Fix a compilation problem on MinGW. * Improved extconf.rb Ruby/Pango [Masao Mutoh]: * Improved extconf.rb Ruby/GTK [Masao Mutoh]: * Fix a compilation problem on MinGW. * Fix a bug of Gtk::Combo. * Improved extconf.rb Ruby/GConf [Kazuhiro NISHIYAMA]: * Fix bugs. Ruby/Libgda [Laurent Sansonetti]: * Support libgda-1.0.3(stable branch). = Ruby-GNOME2 0.9.0: 2004-03-07 Ruby/GLib: * Improved, fixed bugs: [Kenichi Komiya, Vincent Isambart, Masao Mutoh] * GLib::Object, GLib::Param::Flags, mkmf-gnome2.rb, sample/type-register.rb * Added new macros: [Masao Mutoh] * G_DEF_CLASS3() Ruby/ATK [NEW]: * Added and compeleted: [Masao Mutoh] * Atk::Action, Atk::Document, Atk::GObjectAccessible, Atk::NoOpObject, Atk::NoOpObjectFactory, Atk::Value, Atk::Component, Atk::Image, Atk::HyperText, Atk::HyperLink, Atk::EditableText, Atk::Implementor, Atk::Object, Atk::Relation, Atk::Registry, Atk::ObjectFactory, Atk::State, Atk::StateSet, Atk::EditableText, Atk::Table * Added: [Masao Mutoh] * Atk::Util, Atk::Component, Atk::Selection, Atk::Text Ruby/GdkPixbuf: * None. Ruby/Pango: * None. Ruby/GTK: * Completed: [Masao Mutoh] * Added and completed: [Masao Mutoh] * Added: [Kenichi Komiya, Masao, Mutoh] * Gtk::TextAppearance, sample/misc/bindings.rb, properties.rb, style_property.rb, settings.rb * Added some methods, improved, fixed bugs: [Kenichi Komiya, Masahiro Sakai, Vincent Isambart, Dafydd Harries, Masao Mutoh] * Gdk::Window, Gtk::SizeGroup, Gtk::Object, Gtk::BindingSet, Gtk::TextTagTable, Gtk::TextTag, Gdk::Colormap, Gtk::TreeViewColumn, Gtk::TextIter, Gtk::SpinButton, Gtk::Allocation, Gtk::TextView, Gtk::TextBuffer, Gtk::Widget, Gtk::Container, Gtk::Setting, Gtk::TreePath, Gtk::TreeIter, Gdk::Display, Gtk::TextAttributes, Gdk::Property, Gdk::Keymap, Gdk::Pixmap, Gdk::Drawable, Gdk::Screen, Gdk::Event, Gdk::EventExpose, Gdk::Selection, Gdk::GC, sample/gtk-demo/main.rb, stock_browser.rb, list_store.rb, tree_store.rb, sample/testgtk/notebook.rb, sample/misc/label.rb, toolbar.rb, extconf.rb * Removed: [Masao Mutoh] * Gtk::Object#activate_binding * Use Gtk::Object#bindings_activate insted. * Gtk::TextAttribute#copy * Use GLib::Boxed#copy instead. * Gdk::EventKey#string, #length. * makedefconst.rb * Deperecated: [Masao Mutoh] * Gtk::TextBuffer#insert_with_tags, #insert_pixbuf, #insert_child_anchor. They will be removed until 1.0.0. Use Gtk::TextBuffer#insert instead. Ruby/GNOME: * Fixed bugs: [Masao Mutoh] * Gnome::Program Ruby/GnomeCanvas: * Added: [Masao Mutoh] * Gnome::CanvasShape, Gnome::CanvasRE, Gnome::CanvasClipgroup * Fixed bugs: [Vincent Isambart, Masao Mutoh] * extconf.rb, sample/canvas-curve.rb Ruby/Libglade: * Added: [Masao Mutoh] * sample/custom.[rb|glade] * Added methods: [Archit Baweja, Masao Mutoh] * GladeXML#widget_names, #filename, #[], #require, #provide * Improved, fixed bugs: [Masao Mutoh] * bin/ruby-glade-create-template Ruby/Libart: * Improved: [Masao Mutoh] * extconf.rb Ruby/GConf: * None. Ruby/GStreamer: * Added some methods, improved, fixed bugs: [Laurent Sansonetti] * Gst, Gst::Bin, Gst::Pad, Gst::PadTemplate, Gst::Type, Gst::Element sample/gst-inspect.rb, media-type2.rb Ruby/GnomeVFS: * Added some methods, improved, fixed bugs: [Masahiro Sakai, Masao Mutoh] * GnomeVFS::FileInfo, Gnome::VFS::File, GnomeVFS::ProtocolError, GnomeVFS::NoMasterBrowserError Ruby/GtkHtml2: * Added some methods, fixed bugs: [Vincent Isambart, Masao Mutoh] * Gtk::HtmlView, Gtk::HtmlStream, extconf.rb Ruby/GtkGLExt: * Added some methods, improved, fixed bugs: [Vincent Isambart, Masao Mutoh] * Gdk::GLDrawable, sample/*.rb Ruby/Libgda: * Added: [Laurent Sansonetti] GeometricPoint, Gda::Money, Gdak::Time * Added some methods, improved, fixed bugs: [Nikolai Weibull, Laurent Sansonetti] * Gda::Error, Gda::ParameterList, Gda::Provider, Gda::DataSource, Gda::Connection, Gda::Parameter, Gda::Command, Gda::Row, Gda::Value, Gda::DataModel, Gda::ModelList, Gda::FieldAttributes tests/*.rb, src/lib/libgda.rb == Ruby-GNOME2 0.8.1: 2003-11-23 Ruby/GTK: * Fixed compilation problems for GTK+-2.0.x. [Masao Mutoh] * Fixed some bugs. [Masahiro Sakai, Masao Mutoh] * Added Gtk::Tree* methods for GTK+-2.2.x. [Matthew Berg] Ruby/GtkHtml2: * Fixed compilation problems for libgtkhtml-2.4.1 [Masahiro Sakai] Ruby/Libgda: * Fixed a bug [Laurent Sansonetti] *Notice* Ruby/Libgda needs libgda-1.0.2(not released yet) or later. == Ruby-GNOME2 0.8.0: 2003-11-16 Ruby/GLib: * Provide methods for creating GObject from ruby side. Now you can create your own signals and properties: [Masahiro, Sakai] * GLib::MetaInterface, GLib::Instantiatable, GLib::Signal * Added some methods, improved and Fixed some bugs: [Masahiro Sakai, Masao Mutoh] * GLib::Closure, GLib, GLib::Instantiatable, GLib::Object, mkmf-gnome2.rb * Added new macros: [Masao Mutoh] * G_RENAME_NICK() * Added: [Masahiro, Sakai] * sample/type-register.rb, tests/*.rb Ruby/GdkPixbuf: * Added some methods, improved and Fixed some bugs: [KATO Kazuyoshi, Masao Mutoh] * Gdk::Pixbuf Ruby/Pango: * rbpango.h is installed with glib/gtk2 headers. * Added new methods: [Masao Mutoh] * Pango::Layout * Added: [Masao Mutoh] * PangoLogAttr, PangoAnalysis Ruby/GTK: * Completed: [Masao Mutoh] * Gdk::Geometry, Gdk::Event*, Gdk::Pixbuf, Gdk::Drawable, Gdk::DragContext, Gdk::Selection, Gdk::RGB, Gdk::GC, Gdk::Atom, Gdk::Image, Gdk::Colormap, Gdk::Keyval, Gdk::Screen, Gdk::Visual, Gdk::Window, Gdk::Display, Gdk * Added and completed: [Masao Mutoh] * Gdk::Property, Gdk::Keymap, Gdk::TimeCoord, * Added some methods, improved, fixed bugs: [Matthew Berg, Martin Povolny, KATO Kazuyoshi, Laurent Sansonetti, Masahiro Sakai, Masao Mutoh] * Gtk::AccelGroup, Gtk::Accelmap, Gtk::Clipboard, Gtk::Notebook, Gtk::Drag, Gtk::Menu, Gtk::Stock, Gtk::Style, Gtk::ListStore, Gtk::TreeStore, Gtk::Widget, Gtk::TextBuffer, Gtk::TreePath, Gtk::TreeRowReference * Added: [KATO Kazuyoshi] * sample/gtk-demo/changedisplay.rb, sample/gtk-demo/pixbufs.rb. * Removed: [Masao Mutoh] * Gtk::Clipboard#owner * Gdk::Span * Gdk::Region#eql?, #&, #-, #| Ruby/GNOME: * Added some methods, improved, fixed bugs: [Masao Mutoh] * Gnome::AppHelper, Gnome::DruidPageStandard * Apply Enum/Flags. [Masao Mutoh] Ruby/GnomeCanvas: * None. Ruby/Libglade: * None. Ruby/Libart: * None. Ruby/GConf: * None. Ruby/GStreamer: * Update maintainer's e-mail address [Laurent Sansonetti] Ruby/GnomeVFS: * None. Ruby/GtkHtml2: * Added and completed: [Masao Mutoh] * Gtk::HtmlContext, Gtk::HtmlBoxTable, Gtk::HtmlBoxTableRowGroup, * Completed: [Masao Mutoh] * Gtk::HtmlView * Added: [Masao Mutoh] * Gtk::HtmlBox, Gtk::HtmlBoxBlock, Gtk::HtmlBoxTableCaption, Gtk::HtmlBoxText, Gtk::BoxRoot, Gtk::BoxForm, Gtk::HtmlParser, Gtk::HtmlEmbedded, Gtk::HtmlBoxEmbedded Ruby/GtkGLExt: * None. Ruby/Libgda [NEW]: * Added and compeleted: [Laurent Sansonetti] * Gda, Gda::Client, Gda::Command, Gda::Provider, Gda::DataSource, Gda::Connection, Gda::DataModelArray, Gda::DataModelHash, Gda::DataModelList, Gda::Error, Gda::Export, Gda::FieldAttributes, Gda::Parameter, Gda::ParameterList, Gda::QuarkList, Gda::Row, Gda::Select, Gda::Table, Gda::Transaction * Added * Gda::DataModel sample/*.rb, tests/*.rb == Ruby-GNOME2 0.7.0: 2003-09-07 The whole Ruby-GNOME2: * Enum/Flags support. Enum/Flags constants are defined as classes. [Masahiro Sakai, Vincent Isambart, Masao Mutoh] * Improve extconf.rb. [Masao Mutoh] If the libraries are not found, they're ignored. And you can specify to target libraries. Ruby/GLib: * Improved and Fixed some bugs. [Masahiro Sakai, Masao Mutoh] * GLib::Type, GLib::Boxed, mkmf_gnome2.rb * Added lib/glib2.rb and improve to support Win32 platform. [TAMURA.KENICHI, Masahiro Sakai] * Added new class: [Masahiro Sakai] * GLib::Enum, GLib::Flags * Added new macros: [Masahiro Sakai] * RVAL2GENUM(), RVAL2GFLAGS(), GENUM2RVAL(), GFLAGS2RVAL(). * Removed some methods. [Masahiro Sakai] * GLib::Param#value_defaults? * Define GLib::BINDING_VERSION * Apply Enum/Flags. [Masahiro Sakai] * Follow extconf.rb changes. [Masao Mutoh] Ruby/GdkPixbuf: * Apply Enum/Flags. [Masahiro Sakai, Masao Mutoh] * Follow extconf.rb changes. [Masao Mutoh] Ruby/Pango: * Improved and Fixed some bugs: [Vincent Isambart, Masahiro Sakai, Masao Mutoh] * Pango::Font, sample/*.rb, extconf.rb * Added new methods: [Masahiro Sakai] * Pango::Language, Pango::FontMap, Pango::FontFamily, Pango::Context, Pango::FontDescription, * Apply Enum/Flags. [Masahiro Sakai, Masao Mutoh] * Follow extconf.rb changes. [Masao Mutoh] Ruby/GTK: * Follow Ruby/GLib changes. [Masahiro Sakai, Masao Mutoh] * Added some methods, improved, fixed bugs: [Martin Povoln, KATO Kazuyoshi, Masahiro Sakai, Masao Mutoh] * Gdk::Atom, Gdk::Input, Gdk::DragContext, Gdk::Event, Gdk::GC, Gdk, Gtk::Label, Gtk::TreeIter, Gtk::TreeView, Gtk::IconSize, gdk-demo/*.rb, extconf.rb * Added: [KATO Kazuyoshi] * Gdk::DisplayManager, gtk-demo.rb * Apply Enum/Flags. [Masahiro Sakai, Masao Mutoh] * Follow extconf.rb changes. [Masao Mutoh] Ruby/GNOME: * Follow extconf.rb changes. [Masao Mutoh] * Fix bugs. [Masahiro Sakai] Ruby/GnomeCanvas: * Follow extconf.rb changes. [Masao Mutoh] * Improve extconf.rb. [Masahiro Sakai] * Fix a sample. [Vincent Isambart] Ruby/Libglade: * Add a 'after' parameter to GladeXML.connect. It allows to connect signal_connect_after(). [Soila Jani] * Fix bugs: [Masao Mutoh] Ruby/Libart: * Follow extconf.rb changes. [Masao Mutoh] Ruby/GConf: * Apply Enum/Flags. [Masao Mutoh] * Follow extconf.rb changes. [Masao Mutoh] Ruby/GStreamer: * Improved and Fixed some bugs. [Laurent Sansonetti] * Gst, Gst::MediaInfo, Gst::Second, Gst::MediaType, sample/media-type.rb * Added some methods: [Laurent Sansonetti] * Gst::Bin, Gst::Registry, Gst::MediaInfoTrack * Added: [Laurent Sansonetti] * Gst::XML, Gst::ClockEntry, sample/xml-ogg-player.rb * Win32 support. [Masahiro Sakai] * Follow extconf.rb changes. [Masao Mutoh] Ruby/GnomeVFS: * Follow extconf.rb changes. [Masao Mutoh] Ruby/GtkHtml2: * Added: [Martin Povoln, Masao Mutoh] * Gtk::HtmlStream, lib/gtkhtml2.rb * Removed methods: [Martin Povoln] * Gtk::HtmlView#set_html * Follow extconf.rb changes. [Masao Mutoh] Ruby/GtkGLExt [NEW]: * Added and completed. [Vincent Isambart] * Gdk::GLConfig, Gdk::GLContext, Gdk::GLDrawable, Gdk::GLPixmap, Gdk::GLWindow, Gdk::Window, Gdk::Pixmap, Gtk::GL, Gtk::Widget * Added. [Vincent Isambart] * Gdk::GL, sample/*.rb * Follow extconf.rb changes. [Masao Mutoh] * Win32 support. [Masahiro Sakai] == Ruby-GNOME2 0.6.0: 2003-08-09 Ruby/GLib: * mkmf-gnome2.rb,rbglib.h, rbgobject.h, rbgutil.h are installed to site-ruby directories. The other libraries which depends on Ruby/GLib can compile in any directotires. [Masahiro Sakai, Masao Mutoh] * Support ruby-1.8.0 [Masao Mutoh] * Added new macros: [Geoff Youngs, Masao Mutoh] * CBOOL2RVAL/RVAL2CBOOL, G_DEF_CONSTANTS, G_RENAME_CONSTANT * Improved and Fixed some bugs. [Masahiro Sakai] * GLib::Object, GLib::Type, GLib::Closure, GLib::Signal, * Added some methods: [Masahiro Sakai] * GLib::Param, GLib::Param::*, GLib::Boxed, GLib::Signal, GLib::Pointer * Removed some methods. [Masahiro Sakai] * GLib::Param::*#default, #default_value Ruby/GdkPixbuf: * Follow Ruby/GLib changes. [Masao Mutoh] * Separate Gdk::Pixbuf#scale to #scale and #scale!, #composite to #composite and #composite!. [Masao Mutoh] Ruby/Pango: * Follow Ruby/GLib changes. [Masao Mutoh] Ruby/GTK: * Follow Ruby/GLib changes. [Sakai, Masahiro, Masao Mutoh] * rbgtk.h are installed to site-ruby directories. The other libraries which depends on Ruby/GTK can compile in any directotires. [Masao Mutoh] * Completed: [Geoff Youngs, Masao Mutoh] * Gtk::Clipboard, Gtk::Menu, Gtk::Notebook, Gtk::Socket, Gtk::Plug, Gtk::FileSelection, Gtk::ListStore, Gtk::TreeStore, Gtk::TreeModel, Gtk::TextView, Gtk::Notebook, Gtk::ColorSelection, Gtk::Style, Gtk::ItemFactory, Gtk::Invisible, Gtk::TreeSortable, Gtk::TreeView, Gtk::TreeSelection, Gtk::TreePath, Gtk::TreeViewColumn, Gtk::Drag, Gtk::TextTag, Gtk module * Added and completed. * Gtk::TreeDragSource, Gtk::TreeDragDest, * Added some methods, improved, fixed bugs: [Geoff Youngs, Masahiro Sakai, Masao Mutoh] * Gdk::Window, Gdk::Drawable, Gdk::EventProperty, Gdk module, Gtk::Object, Gtk::Editable, Gtk::TreeModel, Gtk module, Gtk::TextBuffer, Gtk::IMContext, Gtk::Menu * Added: [Geoff Youngs, Masao Mutoh] * Gtk::BingindSet, Gdk::Display, Gdk::Screen * Removed: [Masao Mutoh] * Gtk::Socket#xwindow, Gtk::Menu#set_path, Gtk::Notebook#popup_disable/enable, Gtk::ItemFactory.add_foreign Gtk::TreeSortable#sort_func=, Gtk::TreePath#to_s Ruby/GNOME: * Follow Ruby/GLib changes. [Masao Mutoh] * Add Gnome::PixmapEntry#set_preview. [Masao Mutoh] Ruby/GnomeCanvas: * Follow Ruby/GLib changes. [Masao Mutoh] Ruby/Libglade: * Follow Ruby/GLib changes. [Masao Mutoh] Ruby/Libart: * Follow Ruby/GLib changes. [Masao Mutoh] Ruby/GConf: * Fix a bug [744158] [Masao Mutoh] Ruby/GStreamer [NEW]: * Merged with Ruby-GStreamer project. [Laurent Sansonetti] * Version informations are also merged. * Completed: [Laurent Sansonetti] * Gst, Gst::Autoplug, Gst::Cpu, Gst::Format, Gst::Object, Gst::PadTemplate, Gst::Pipeline, Gst::PluginFeature, Gst::QueryType, Gst::Type * Added and completed. [Laurent Sansonetti] * Gst::AutoplugFactory, Gst::EventMask, Gsk::EventSeek, Gst::EventSegmentSeek, Gst::EventSize, Gst::Parse, Gst::SystemClock, Gst::Thread,Gst::MediaInfo, Gst::MediaInfoStream, Gst::MediaInfoTrack * Added some methods, improved, fixed bugs: [Laurent Sansonetti] * Gst::Caps, Gst::Clock, Gst::Plugin, Gst::Pad, Gst::Element, * Added: [Nikolai :: lone-star :: Weibull, Laurent Sansonetti] * sample/media-type.rb, gst-inspect.rb, mediap-type2.rb Ruby/GnomeVFS [NEW]: * Initial release. [Nikolai :: lone-star :: Weibull] * Completed: [Nikolai :: lone-star :: Weibull] * GnomeVFS module, GnomeVFS::Directory, GnomeVFS::Monitor, GnomeVFS::FileInfo, GnomeVFS::Error * Added: [Nikolai :: lone-star :: Weibull] * GnomeVFS::File, GnomeVFS::URI Ruby/GtkHtml2 [NEW]: * Initial release. [Martin Povoln] * Added: [Martin Povoln] * Gtk::HtmlDocument, Gtk::HtmlView == Ruby-GNOME2 0.5.0: 2003-05-24 Ruby/GLib: * Fixed warning for ruby-1.8.1. [Masao Mutoh] * Fixed some bugs, Added methods and improved: [Masahiro Sakai] * GLib::Object, GLib::ParamSpec, GLib::Signal, GLib::Type, GLib::Instantiatable, GLib::MetaInterface, GLib::Param::String * Added: [Geoff Youngs, Masao Mutoh] Ruby/GdkPixbuf: * Fixed a bug. [Geoff Youngs] Ruby/Pango: * Some constants were moved. [Masao Mutoh] * Moved Pango::Attribute::UNDERLINE_* to Pango::AttrUnderline::*. * Moved Pango::Attribute::SCALE_* to Pango::AttrScale::*. Ruby/GTK: * Completed: [Masao Mutoh] Gtk::AccelGroup, Gtk::Style, Gtk::Selection * Added some methods, improved: [Stephen Lewis, Masahiro Sakai, Masao Mutoh] * Gtk::TextBuffer, Gtk::TextIter, Gtk::TreeIter, Gtk::ListStore, Gtk::TreeStore, Gtk, Gtk::HandleBox, Gtk::Frame, Gtk::Container, Gtk::Table, Gdk::Input, Gtk::Widget, Gtk::Allocation, Gtk::RC, Gtk::ItemFactory, Gtk::Toolbar, Gtk::Window, Gtk::CellEditable, Gtk::Accessible, sample/misc/*.rb * Added and completed. [Nikolai :: lone-star :: Weibull, Masao Mutoh] * Gtk::RcStyle, Gtk::TargetList, Gtk::TreeSortable, Gtk::TreeModelSort, Gtk::IMContext, Gtk::IMContextSimple, Gtk::IMMulticontext * Added: [Masao Mutoh] * Gtk::Settings * Renamed some methods. [Masao Mutoh] * Gtk::Table, Gtk::Widget * Removed: [Masao Mutoh] * Gtk::Object#user_data, #user_data=, #set_user_data. Deprecated properties of Gtk::ProgressBar. Gtk::Requisition. Use [width, height] instead. Gtk::Widget#set_requisition, *_event, Gtk::Widget::NO_PARENT. Gtk::SelectionData.remove_all. Use Gtk::Selection.remove_all instead. Ruby/GNOME: * Cygwin support [Masahiro Sakai] * sample/test-gnome/color-picker.rb: Follow Ruby/GTK changes.[Masao Mutoh] Ruby/GnomeCanvas: * sample/canvas-primitives.rb: Follow Ruby/GTK changes.[Masao Mutoh] Ruby/Libglade: * Fix a bug of bin/ruby-glade-create-template. [Masao Mutoh] Ruby/Libart: * None Ruby/GConf: - Added GConf::MetaInfo. [Nikolai :: lone-star :: Weibull] - Fixed a bug [Masao Mutoh] == Ruby-GNOME2 0.4.0: 2003-03-23 The whole Ruby-GNOME2: * Add mkmf-gnome2.rb for sub/optional libraries. [Masahiro Sakai] Ruby/GLib: * Win32 platform support(Cygwin, Mingw32) [Masahiro Sakai] * Support mkmf-gnome2.rb [Masahiro Sakai] * Added some methods. [KUBO Takehiro, Masahiro Sakai] * Fix some bugs and improvement. [Masahiro Sakai, Masao Mutoh] Ruby/GdkPixbuf: * Win32 platform support(Cygwin, Mingw32) [Masahiro Sakai] * Support mkmf-gnome2.rb [Masahiro Sakai] * Fix some bugs and improvement. [Masahiro Sakai] Ruby/Pango: * Win32 platform support(Cygwin, Mingw32) [Masahiro Sakai] * Support mkmf-gnome2.rb [Masahiro Sakai] * Added a method(Pango.pixels) [Masao Mutoh] * Fix some bugs and improvement. [Masahiro Sakai] Ruby/GTK: * Win32 platform support(Cygwin, Mingw32) [Masahiro Sakai] * Support mkmf-gnome2.rb [Masahiro Sakai] * Multi-threading support. [Masao Mutoh] * Added some methods, improved: [Kazuo Saito, Geoff Youngs, KATO Kazuyoshi, Masahiro Sakai, Masao Mutoh] * Gtk::Toolbar, Gtk::ItemFactory, Gdk::Region, Gtk::AccelGroup, Gtk::AccelMap, Gtk::TextIter, Gtk::TextTagTable, Gtk::TreeModel, Gtk::TreeSelection, Gtk::Clipboard, Gtk::Box, Gdk::RGB, Gtk::AccelGroupEntry, Gdk::Window, Gtk::SeparatorMenuItem, Gtk::TreePath, Gtk::TreeView, Gtk::Combo, Gdk::Threads, Gtk::TreeIter, Gdk::Event, Gtk::Drag, * Added: [Kazuo Saito, KATO Kazuyoshi, Masao Mutoh] * sample/gtk-demo/*.rb, sample/misc/threads.rb * Removed: [Masao Mutoh] * Gtk::Toolbar#insert_item/widget/element, Gtk::Toolbar#prepend_item/widget/element, Gtk::Toolbar#append_item/widget/element. * Use Gtk::Toolbar#insert, prepend, append instead. Gtk::Combo#list, button, popup, popwin, set_item_string, Ruby/GNOME: * Support mkmf-gnome2.rb [Masahiro Sakai] Ruby/GnomeCanvas: * Support mkmf-gnome2.rb [Masahiro Sakai] Ruby/Libglade: * Support mkmf-gnome2.rb [Masahiro Sakai] * Improved: [Masao Mutoh] * bin/ruby-glade-create-template Ruby/Libart: * Support mkmf-gnome2.rb [Masahiro Sakai] * Fix some bugs and improvement. [Masahiro Sakai] Ruby/GConf: * Support mkmf-gnome2.rb [Masahiro Sakai] Misc: * Project website is moving from http://ruby-gnome2.sourceforge.net/ to http://ruby-gnome2.sourceforge.jp/. == Ruby-GNOME2 0.3.0: 2003-02-09 Ruby/GLib: * Miscellaneous bugfixes and some improvement internal. [Masahiro Sakai, Masao Mutoh] Ruby/GTK: * Miscellaneous bugfixes and some improvement internal. [Masao Mutoh] * Support GTK+-2.2.x. [KUBO Takehiro] * DnD enhancement. [Geoff Youngs, Masao Mutoh] * Require Ruby/Pango. [Masao Mutoh] * Completed: * Gdk::Drawable, Gdk::Rectangle, Gdk::Region, Gtk::AccelGroup, Gtk::Accelerator, Gtk::AccelGroupEntry, Gtk::AccelKey * Added and completed: * Gdk::Pango::Embossed, Gdk::Pango::Stipple, Gdk::Span * Added some methods, improved: * Gtk::Widget, Gtk::Calender, Gdk::GC, Gtk::Drag, Gtk::SelectionData, Gtk::RadioMenuItem,Gdk::Pixmap * Added: * sample/misc/dnd.rb, dndtreeview.rb, dnd.rb * Removed: * Gtk::AccelGroup#connect_by_path(use Gtk::AccelGroup#connect instead). Ruby/GdkPixbuf: * Added GdkPixbufLoader. [Geoff Youngs] Ruby/GNOME: * None. Ruby/GnomeCanvas: * Warning fixes for samples. [Masao Mutoh] Ruby/Libglade: * Added a sample(sample/treview.[glade|rb]). [Masao Mutoh] Ruby/Libart: * Added Art::Affine, Art::Bpath, Art::Canvas, Art::SVP, Art::Vpath [Tom Payne] * Added samples(sample/rose.rb, testlibart2.rb). [Tom Payne] Ruby/GConf: * None. Ruby/Pango(NEW): * Initial release. [Geoff Youngs, Masao Mutoh] * Added and completed: * Pango::Rectangle, Pango::FontDescription, Pango::FontMetrics, Pango::FontFace, Pango::Fontset, Pango::FontsetSimple, Pango::Attribute, Pango::AttrString, Pango::AttrLanguage, Pango::AttrColor, Pango::AttrInt, Pango::AttrFloat, Pango::AttrBool Pango::AttrFontDesc, Pango::AttrShape, Pango::AttrFamily, Pango::AttrStyle, Pango::AttrVariant, Pango::AttrStretch, Pango::AttrWeight, Pango::AttrSize, Pango::AttrForeground, Pango::AttrBackground, Pango::AttrStrikethrough, Pango::AttrUnderline, Pango::AttrScale, Pango::AttrRise, Pango::Color, Pango::Language, Pango::AttrList, Pango::AttrIterator, Pango::TabArray * Added: * Pango::Context, Pango::Item, Pango::ClyphString, Pango::Font, Pango::FontFamily, Pango::FontMap, Pango::Layout, Pango::LayoutIter, Pango::LayoutLine, sample/attribute.rb, gdk_layout.rb, label.rb, parse.rb. Misc * Project website http://ruby-gnome2.sourceforge.net/ * Ruby/GTK Tutorial http://ruby-gnome2.sourceforge.net/tut/toc.htm * Ruby-GNOME2 reference manual(This project has just started). http://rwiki.jin.gr.jp/cgi-bin/rw-cgi.rb?cmd=view;name=Ruby-GNOME2 == Ruby-GNOME2 0.2: 2002-12-28 Ruby/GLib: * Some bugfixes and some improvement internal. Ruby/GTK: * Some bugfixes and some improvement internal. * Require Ruby/GdkPixbuf. * Completed: * Gtk::TextIter, Gtk::Label, Gtk::Tooltips, Gtk::Viewport. * Added and completed: * Gtk::TextAttributes, Gtk::IconFactroy, Gtk::IconSet, Gtk::IconSource, Gtk::IconSize, Gtk::Accelerator, Gtk::AccelKey, Gtk::AccelGroupEntry, Gtk::SizeGroup, * Added some methods, improved: * Gtk module, Gtk::TextBuffer, Gtk::*MenuItem, Gtk::*Button, Gtk::ItemFactory, Gtk::Widget, Gtk::TreeViewColumn, Gtk::Notebook, Gtk::Image, Gtk::AccelLabel, Gtk::Invisible, Gtk::Dialog, Gtk::TreePath, Gdk::Keyval sample/misc/*button.rb, stock.rb sample/testgtk/savedposition.rb * Added: * Gtk::Clipboard, Gtk::AccelGroup, Gtk::AccelMap sample/misc/button2.rb, label.rb, dialog.rb, dialog2.rb, treeview.rb * Removed: * Gdk::Bitmap(use Gdk::Pixmap(depth = 1) instead) Ruby/GdkPixbuf: * Follow Ruby/GLib changes. * Add Gdk::Pixdata. Ruby/GNOME: * Follow Ruby/GLib changes. * Fix problems which Ruby/GNOME can't work with Ruby/GdkPixbuf. * Code cleanup. * Remove Bonobo codes(Move to Ruby/Bonobo). Ruby/GnomeCanvas: * Follow Ruby/GLib changes. * Follow Ruby 1.8.0pre1, 1.6.8. Ruby/Libglade: * Follow Ruby/GLib changes. * Add bin/ruby-glade-create-template(Create .rb from .glade) * Add sample/treeview* * Improve the behavior to work when handlers aren't undefined not to occur signal_proc.arity error. Ruby/Libart: * Follow Ruby/GLib changes. Ruby/GConf: * Follow Ruby/GLib changes. Misc: * Project website: http://ruby-gnome2.sourceforge.net/ * Ruby/GTK Tutorial: http://ruby-gnome2.sourceforge.net/tut/toc.htm * Ruby-GNOME2 reference manual(This project has just started). http://rwiki.jin.gr.jp/cgi-bin/rw-cgi.rb?cmd=view;name=Ruby-GNOME2 == Ruby-GNOME2 0.1: 2002-11-23 Initial release. * Ruby/GLib * Ruby/GTK * Ruby/GdkPixbuf * Ruby/GNOME * Ruby/GnomeCanvas * Ruby/Libglade * Ruby/Libart * Ruby/GConf ruby-gnome2-all-2.2.5/gdk_pixbuf2/0000755000175000017500000000000012516441042015015 5ustar koukouruby-gnome2-all-2.2.5/gdk_pixbuf2/extconf.rb0000644000175000017500000000223211701304107017002 0ustar koukou#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "gdk_pixbuf2" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ruby-gnome2-all-2.2.5/gdk_pixbuf2/Rakefile0000644000175000017500000000167712416346617016510 0ustar koukou# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x." package.description = "Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x." package.dependency.gem.runtime = ["glib2"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "gobject-introspection", ] package.external_packages = [ { :name => "gdk-pixbuf", :download_site => :gnome, :label => "gdk-pixbuf", :version => "2.30.8", :compression_method => "xz", :windows => { :configure_args => [ "--with-included-loaders", "--enable-introspection", ], :build_concurrently => false, :built_file => "bin/libgdk_pixbuf-2.0-0.dll", }, } ] end package_task.define ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/0000755000175000017500000000000011701304107015610 5ustar koukouruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/0000755000175000017500000000000012516441042020021 5ustar koukouruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbufanimationiter.c0000644000175000017500000000437611701304107025342 0ustar koukou/* -*- 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 "rbgdk-pixbuf2private.h" #define RG_TARGET_NAMESPACE cPixbufAnimationIter #define _SELF(i) (RVAL2GDKPIXBUFANIMATIONITER(i)) static VALUE rg_advance(int argc, VALUE *argv, VALUE self) { VALUE current_time_sec, current_time_usec; GTimeVal current_time; rb_scan_args(argc, argv, "02", ¤t_time_sec, ¤t_time_usec); if (NIL_P(current_time_sec)) return CBOOL2RVAL(gdk_pixbuf_animation_iter_advance(_SELF(self), NULL)); current_time.tv_sec = NUM2LONG(current_time_sec); current_time.tv_usec = NIL_P(current_time_usec) ? 0 : NUM2LONG(current_time_usec); return CBOOL2RVAL(gdk_pixbuf_animation_iter_advance(_SELF(self), ¤t_time)); } static VALUE rg_delay_time(VALUE self) { return INT2NUM(gdk_pixbuf_animation_iter_get_delay_time(_SELF(self))); } static VALUE rg_on_currently_loading_frame_p(VALUE self) { return CBOOL2RVAL(gdk_pixbuf_animation_iter_on_currently_loading_frame(_SELF(self))); } static VALUE rg_pixbuf(VALUE self) { return GOBJ2RVAL(gdk_pixbuf_animation_iter_get_pixbuf(_SELF(self))); } void Init_gdk_pixbuf_animation_iter(VALUE mGdk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF_ANIMATION_ITER, "PixbufAnimationIter", mGdk); RG_DEF_METHOD(advance, -1); RG_DEF_METHOD(delay_time, 0); RG_DEF_METHOD_P(on_currently_loading_frame, 0); RG_DEF_METHOD(pixbuf, 0); } ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf.c0000644000175000017500000006074612123512153022562 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002-2004 Masao Mutoh * Copyright (C) 2000 Yasushi Shoji * * 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 "rbgdk-pixbuf2private.h" #include #define RG_TARGET_NAMESPACE cPixbuf #define _SELF(s) RVAL2GDKPIXBUF(s) #define NOMEM_ERROR(error) g_set_error(error,\ GDK_PIXBUF_ERROR,\ GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,\ "Insufficient memory to load image file"); static ID id_pixdata; /****************************************************/ /* The GdkPixbuf Structure */ static int pixels_size(GdkPixbuf *pixbuf) { int height, width, rowstride, n_channels, bits_per_sample; height = gdk_pixbuf_get_height(pixbuf); width = gdk_pixbuf_get_width(pixbuf); rowstride = gdk_pixbuf_get_rowstride(pixbuf); n_channels = gdk_pixbuf_get_n_channels(pixbuf); bits_per_sample = gdk_pixbuf_get_bits_per_sample(pixbuf); return ((height - 1) * rowstride + width * ((n_channels * bits_per_sample + 7) / 8)); } static VALUE get_pixels(VALUE self) { GdkPixbuf *pixbuf = _SELF(self); int size; size = pixels_size(pixbuf); return rb_str_new((const char *)gdk_pixbuf_get_pixels(pixbuf), size); } static VALUE rg_operator_set_pixels(VALUE self, VALUE pixels) { GdkPixbuf *pixbuf = _SELF(self); int size; int arg_size; size = pixels_size(pixbuf); StringValue(pixels); arg_size = RSTRING_LEN(pixels); if (arg_size != size) rb_raise(rb_eRangeError, "Pixels are %i bytes, %i bytes supplied.", size, arg_size); /* The user currently cannot get a pointer to the actual * pixels, the data is copied to a String. */ memcpy(gdk_pixbuf_get_pixels(pixbuf), RSTRING_PTR(pixels), MIN(RSTRING_LEN(pixels), size)); return pixels; } static VALUE rg_get_option(VALUE self, VALUE key) { const gchar* ret = gdk_pixbuf_get_option(_SELF(self), RVAL2CSTR(key)); return ret ? CSTR2RVAL(ret) : Qnil; } /****************************************************/ /* File opening */ /* Image Data in Memory */ static GdkPixbuf * pixbuf_initialize_by_hash(VALUE self, VALUE arg, GError **error) { GdkPixbuf *buf = NULL; VALUE rb_colorspace, rb_has_alpha, rb_bits_per_sample, rb_width, rb_height, rb_data, rb_rowstride, rb_xpm, rb_inline, rb_copy_pixels, rb_src_pixbuf, rb_src_x, rb_src_y, rb_file, rb_scale_width, rb_scale_height, rb_preserve_aspect_ratio; rbg_scan_options(arg, "colorspace", &rb_colorspace, "has_alpha", &rb_has_alpha, "bits_per_sample", &rb_bits_per_sample, "width", &rb_width, "height", &rb_height, "data", &rb_data, "rowstride", &rb_rowstride, "xpm", &rb_xpm, "inline", &rb_inline, "copy_pixels", &rb_copy_pixels, "src_pixbuf", &rb_src_pixbuf, "src_x", &rb_src_x, "src_y", &rb_src_y, "file", &rb_file, "scale_width", &rb_scale_width, "scale_height", &rb_scale_height, "preserve_aspect_ratio", &rb_preserve_aspect_ratio, NULL); if (!NIL_P(rb_data)) { buf = gdk_pixbuf_new_from_data((const guchar*)RVAL2CSTR(rb_data), NIL_P(rb_colorspace) ? GDK_COLORSPACE_RGB : RVAL2GDKCOLORSPACE(rb_colorspace), RVAL2CBOOL(rb_has_alpha), NIL_P(rb_bits_per_sample) ? 8 : NUM2INT(rb_bits_per_sample), NUM2INT(rb_width), NUM2INT(rb_height), NUM2INT(rb_rowstride), NULL, NULL); if (buf == NULL) NOMEM_ERROR(error); // Save a reference to the string because the pixbuf doesn't copy it. G_RELATIVE(self, rb_data); } else if (!NIL_P(rb_xpm)) { const gchar **data = RVAL2STRV(rb_xpm); buf = gdk_pixbuf_new_from_xpm_data(data); g_free(data); if (buf == NULL) NOMEM_ERROR(error); } else if (!NIL_P(rb_inline)) { /* TODO: Is this really up to the caller to decide? */ long n; guint8 *data = RVAL2GUINT8S(rb_inline, n); buf = gdk_pixbuf_new_from_inline(n, data, RVAL2CBOOL(rb_copy_pixels), error); /* need to manage the returned value */ rb_ivar_set(self, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, data)); } else if (!NIL_P(rb_src_pixbuf)) { buf = gdk_pixbuf_new_subpixbuf(_SELF(rb_src_pixbuf), NUM2INT(rb_src_x), NUM2INT(rb_src_y), NUM2INT(rb_width), NUM2INT(rb_height)); if (buf == NULL) NOMEM_ERROR(error); } else if (!NIL_P(rb_file)) { if (!NIL_P(rb_width)) { #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) buf = gdk_pixbuf_new_from_file_at_size(RVAL2CSTR(rb_file), NUM2INT(rb_width), NUM2INT(rb_height), error); #else rb_warning("Sizing on load not supported in GTK+ < 2.4.0"); buf = gdk_pixbuf_new_from_file(RVAL2CSTR(rb_file), error); #endif } else if (!NIL_P(rb_scale_width)) { #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) int width = NUM2INT(rb_scale_width); int height = NUM2INT(rb_scale_height); #if !RBGDK_PIXBUF_CHECK_VERSION(2,8,0) if (width < 0 || height < 0) rb_warning("For scaling on load, a negative value for width or height are not supported in GTK+ < 2.8.0"); #endif buf = gdk_pixbuf_new_from_file_at_scale(RVAL2CSTR(rb_file), width, height, NIL_P(rb_preserve_aspect_ratio) ? TRUE : RVAL2CBOOL(rb_preserve_aspect_ratio), error); #else rb_warning("Scaling on load not supported in GTK+ < 2.6.0"); buf = gdk_pixbuf_new_from_file(RVAL2CSTR(rb_file), error); #endif } else { buf = gdk_pixbuf_new_from_file(RVAL2CSTR(rb_file), error); } } else { buf = gdk_pixbuf_new(NIL_P(rb_colorspace) ? GDK_COLORSPACE_RGB : RVAL2GDKCOLORSPACE(rb_colorspace), RVAL2CBOOL(rb_has_alpha), NIL_P(rb_bits_per_sample) ? 8 : NUM2INT(rb_bits_per_sample), NUM2INT(rb_width), NUM2INT(rb_height)); if (buf == NULL) NOMEM_ERROR(error); } return buf; } /* TODO: make deprecated */ static GdkPixbuf * pixbuf_initialize(VALUE self, int argc, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7, GError **error) { GdkPixbuf* buf; if (argc == 7){ buf = gdk_pixbuf_new_from_data((const guchar*)RVAL2CSTR(arg1), RVAL2GDKCOLORSPACE(arg2), RVAL2CBOOL(arg3), NUM2INT(arg4), NUM2INT(arg5), NUM2INT(arg6), NUM2INT(arg7), NULL, NULL); if (buf == NULL) NOMEM_ERROR(error); // Save a reference to the string because the pixbuf doesn't copy it. G_RELATIVE(self, arg1); } else if (argc == 5){ if (rb_obj_is_kind_of(arg1, GTYPE2CLASS(GDK_TYPE_PIXBUF))){ buf = gdk_pixbuf_new_subpixbuf(_SELF(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5)); if (buf == NULL) NOMEM_ERROR(error); } else if (rb_obj_is_kind_of(arg1, GTYPE2CLASS(GDK_TYPE_COLORSPACE))){ buf = gdk_pixbuf_new(RVAL2GDKCOLORSPACE(arg1), RVAL2CBOOL(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5)); if (buf == NULL) NOMEM_ERROR(error); } else { rb_raise(rb_eArgError, "Wrong type of 1st argument or wrong number of arguments"); } } else if (argc == 4) { #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) int width = NUM2INT(arg2); int height = NUM2INT(arg3); #if ! RBGDK_PIXBUF_CHECK_VERSION(2,8,0) if (width < 0 || height < 0) rb_warning("For scaling on load, a negative value for width or height are not supported in GTK+ < 2.8.0"); #endif buf = gdk_pixbuf_new_from_file_at_scale(RVAL2CSTR(arg1), width, height, RVAL2CBOOL(arg4), error); #else rb_warning("Scaling on load not supported in GTK+ < 2.6.0"); buf = gdk_pixbuf_new_from_file(RVAL2CSTR(arg1), error); #endif } else if (argc == 3) { #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) buf = gdk_pixbuf_new_from_file_at_size(RVAL2CSTR(arg1), NUM2INT(arg2), NUM2INT(arg3), error); #else rb_warning("Sizing on load not supported in GTK+ < 2.4.0"); buf = gdk_pixbuf_new_from_file(RVAL2CSTR(arg1), error); #endif } else if (argc == 2) { /* TODO: Is this really up to the caller to decide? */ gboolean copy_pixels = RVAL2CBOOL(arg2); long n; guint8 *data = RVAL2GUINT8S(arg1, n); buf = gdk_pixbuf_new_from_inline(n, data, copy_pixels, error); /* need to manage the returned value */ rb_ivar_set(self, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, data)); } else if (argc == 1){ if (TYPE(arg1) == T_STRING) { buf = gdk_pixbuf_new_from_file(RVAL2CSTR(arg1), error); } else if (TYPE(arg1) == T_ARRAY) { const gchar **data = RVAL2STRV(arg1); buf = gdk_pixbuf_new_from_xpm_data(data); g_free(data); if (buf == NULL) NOMEM_ERROR(error); } else if (TYPE(arg1) == T_HASH) { buf = pixbuf_initialize_by_hash(self, arg1, error); } else { rb_raise(rb_eArgError, "Wrong type of 1st argument or wrong number of arguments"); } } else { rb_raise(rb_eArgError, "Wrong number of arguments"); } return buf; } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3, arg4, arg5, arg6, arg7; GdkPixbuf *buf; GError *error = NULL; rb_scan_args(argc, argv, "16", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7); buf = pixbuf_initialize(self, argc, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &error); if (buf == NULL) { rb_gc(); g_error_free(error); error = NULL; buf = pixbuf_initialize(self, argc, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &error); } if (error || !buf) RAISE_GERROR(error); G_INITIALIZE(self, buf); return Qnil; } static VALUE rg_dup(VALUE self) { VALUE ret; GdkPixbuf* dest = gdk_pixbuf_copy(_SELF(self)); if (dest == NULL) return Qnil; ret = GOBJ2RVAL(dest); g_object_unref(dest); return ret; } #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) static VALUE rg_s_get_file_info(G_GNUC_UNUSED VALUE self, VALUE filename) { gint width, height; GdkPixbufFormat* format = gdk_pixbuf_get_file_info(RVAL2CSTR(filename), &width, &height); return format ? rb_ary_new3(3, GDKPIXBUFFORMAT2RVAL(format), INT2NUM(width), INT2NUM(height)) : Qnil; } #endif static VALUE save_to(VALUE self, const gchar *filename, const gchar *type, VALUE options) { VALUE result = self; GError *error = NULL; gchar **keys = NULL; gchar **values = NULL; if (!NIL_P(options)) { VALUE ary, key, value; ID to_s; gint len, i; Check_Type(options, T_HASH); to_s = rb_intern("to_s"); ary = rb_funcall(options, rb_intern("to_a"), 0); len = RARRAY_LEN(ary); keys = ALLOCA_N(gchar *, len + 1); values = ALLOCA_N(gchar *, len + 1); for (i = 0; i < len; i++) { key = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(key)) { const char *const_key; const_key = rb_id2name(SYM2ID(key)); keys[i] = (gchar *)const_key; } else { keys[i] = (gchar *)RVAL2CSTR(key); } value = rb_funcall(RARRAY_PTR(RARRAY_PTR(ary)[i])[1], to_s, 0); values[i] = (gchar *)RVAL2CSTR(value); } keys[len] = NULL; values[len] = NULL; } if (filename) { gdk_pixbuf_savev(_SELF(self), filename, type, keys, values, &error); } #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) else { gchar *buffer; gsize buffer_size; if (gdk_pixbuf_save_to_bufferv(_SELF(self), &buffer, &buffer_size, type, keys, values, &error)) result = rb_str_new(buffer, buffer_size); } #endif if (error) RAISE_GERROR(error); return result; } /****************************************************/ /* File saving */ static VALUE rg_save(int argc, VALUE *argv, VALUE self) { VALUE filename, type, options; rb_scan_args(argc, argv, "21", &filename, &type, &options); return save_to(self, RVAL2CSTR(filename), RVAL2CSTR(type), options); } #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) /* XXX gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, char **option_keys, char **option_values, GError **error); */ static VALUE rg_save_to_buffer(int argc, VALUE *argv, VALUE self) { VALUE type, options; rb_scan_args(argc, argv, "11", &type, &options); return save_to(self, NULL, RVAL2CSTR(type), options); } #endif /****************************************************/ /* Scaling */ static VALUE rg_scale(int argc, VALUE *argv, VALUE self) { GdkPixbuf* dest; VALUE dest_width, dest_height, interp_type, ret; GdkInterpType type = GDK_INTERP_BILINEAR; rb_scan_args(argc, argv, "21", &dest_width, &dest_height, &interp_type); if (!NIL_P(interp_type)) type = RVAL2GDKINTERPTYPE(interp_type); dest = gdk_pixbuf_scale_simple(_SELF(self), NUM2INT(dest_width), NUM2INT(dest_height), type); if (dest == NULL) return Qnil; ret = GOBJ2RVAL(dest); g_object_unref(dest); return ret; } static VALUE rg_scale_bang(int argc, VALUE *argv, VALUE self) { GdkInterpType type = GDK_INTERP_BILINEAR; VALUE src, src_x, src_y, src_width, src_height; VALUE offset_x, offset_y, scale_x, scale_y, interp_type; rb_scan_args(argc, argv, "91", &src, &src_x, &src_y, &src_width, &src_height, &offset_x, &offset_y, &scale_x, &scale_y, &interp_type); if (!NIL_P(interp_type)) type = RVAL2GDKINTERPTYPE(interp_type); gdk_pixbuf_scale(_SELF(src), _SELF(self), NUM2INT(src_x), NUM2INT(src_y), NUM2INT(src_width), NUM2INT(src_height), NUM2DBL(offset_x), NUM2DBL(offset_y), NUM2DBL(scale_x), NUM2DBL(scale_y), type); return self; } static VALUE rg_composite(VALUE self, VALUE dest_width, VALUE dest_height, VALUE interp_type, VALUE overall_alpha, VALUE check_size, VALUE color1, VALUE color2) { GdkPixbuf* dest; VALUE ret; GdkInterpType type = GDK_INTERP_BILINEAR; if (!NIL_P(interp_type)) type = RVAL2GDKINTERPTYPE(interp_type); dest = gdk_pixbuf_composite_color_simple( _SELF(self), NUM2INT(dest_width), NUM2INT(dest_height), type, NUM2INT(overall_alpha), NUM2INT(check_size), NUM2UINT(color1), NUM2UINT(color2)); if (dest == NULL) return Qnil; ret = GOBJ2RVAL(dest); g_object_unref(dest); return ret; } static VALUE rg_composite_bang(int argc, VALUE *argv, VALUE self) { VALUE ret; VALUE args[16]; GdkInterpType interp_type = GDK_INTERP_BILINEAR; rb_scan_args(argc, argv, "97", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], &args[14], &args[15]); switch (argc) { case 11: if (!NIL_P(args[9])) interp_type = RVAL2GDKINTERPTYPE(args[9]); gdk_pixbuf_composite(_SELF(args[0]), _SELF(self), NUM2INT(args[1]), NUM2INT(args[2]), NUM2INT(args[3]), NUM2INT(args[4]), NUM2DBL(args[5]), NUM2DBL(args[6]), NUM2DBL(args[7]), NUM2DBL(args[8]), interp_type, NUM2INT(args[10])); ret = self; break; case 16: if (!NIL_P(args[9])) interp_type = RVAL2GDKINTERPTYPE(args[9]); gdk_pixbuf_composite_color(_SELF(args[0]), _SELF(self), NUM2INT(args[1]), NUM2INT(args[2]), NUM2INT(args[3]), NUM2INT(args[4]), NUM2DBL(args[5]), NUM2DBL(args[6]), NUM2DBL(args[7]), NUM2DBL(args[8]), interp_type, NUM2INT(args[10]), NUM2INT(args[11]), NUM2INT(args[12]), NUM2INT(args[13]), NUM2UINT(args[14]), NUM2UINT(args[15])); ret = self; break; default: rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc); break; } return ret; } #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) static VALUE rg_rotate(VALUE self, VALUE angle) { VALUE ret; GdkPixbuf* dest = gdk_pixbuf_rotate_simple(_SELF(self), RVAL2GDKPIXBUFROTATION(angle)); if (dest == NULL) return Qnil; ret = GOBJ2RVAL(dest); g_object_unref(dest); return ret; } static VALUE rg_flip(VALUE self, VALUE horizontal) { VALUE ret; GdkPixbuf* dest = gdk_pixbuf_flip(_SELF(self), RVAL2CBOOL(horizontal)); if (dest == NULL) return Qnil; ret = GOBJ2RVAL(dest); g_object_unref(dest); return ret; } #endif static VALUE rg_add_alpha(VALUE self, VALUE substitute_color, VALUE r, VALUE g, VALUE b) { VALUE ret; GdkPixbuf* dest = gdk_pixbuf_add_alpha(_SELF(self), RVAL2CBOOL(substitute_color), FIX2INT(r), FIX2INT(g), FIX2INT(b)); if (dest == NULL) return Qnil; ret = GOBJ2RVAL(dest); g_object_unref(dest); return ret; } static VALUE rg_copy_area(VALUE self, VALUE src_x, VALUE src_y, VALUE width, VALUE height, VALUE dest, VALUE dest_x, VALUE dest_y) { gdk_pixbuf_copy_area(_SELF(self), NUM2INT(src_x), NUM2INT(src_y), NUM2INT(width), NUM2INT(height), _SELF(dest), NUM2INT(dest_x), NUM2INT(dest_y)); return dest; } static VALUE rg_saturate_and_pixelate(VALUE self, VALUE staturation, VALUE pixelate) { GdkPixbuf* dest = gdk_pixbuf_copy(_SELF(self)); gdk_pixbuf_saturate_and_pixelate(_SELF(self), dest, NUM2DBL(staturation), RVAL2CBOOL(pixelate)); return GOBJ2RVAL(dest); } static VALUE rg_fill_bang(VALUE self, VALUE pixel) { gdk_pixbuf_fill(_SELF(self), NUM2UINT(pixel)); return self; } /* From Module Interface */ #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) static VALUE rg_s_formats(G_GNUC_UNUSED VALUE self) { return GSLIST2ARY2(gdk_pixbuf_get_formats(), GDK_TYPE_PIXBUF_FORMAT); } #ifdef HAVE_GDK_PIXBUF_SET_OPTION static VALUE rg_set_option(VALUE self, VALUE key, VALUE value) { return CBOOL2RVAL(gdk_pixbuf_set_option(_SELF(self), RVAL2CSTR(key), RVAL2CSTR(value))); } #else static VALUE rg_set_option(G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE key, G_GNUC_UNUSED VALUE value) { rb_warning("not supported in this version of GTK+"); return Qfalse; } #endif #endif extern void Init_gdk_pixbuf2(void); void Init_gdk_pixbuf2(void) { VALUE mGdk = rb_define_module("Gdk"); VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF, "Pixbuf", mGdk); id_pixdata = rb_intern("pixdata"); /* gdk_rgb_init();*/ /* initialize it anyway */ /* * Initialization and Versions */ /* Removed. This crashes Ruby/GTK on Windows + GTK+-2.4.x. Pointed out by Laurent. #ifdef HAVE_GDK_PIXBUF_VERSION rb_define_const(RG_TARGET_NAMESPACE, "VERSION", CSTR2RVAL(gdk_pixbuf_version)); #endif */ rb_define_const(RG_TARGET_NAMESPACE, "MAJOR", INT2FIX(GDK_PIXBUF_MAJOR)); rb_define_const(RG_TARGET_NAMESPACE, "MINOR", INT2FIX(GDK_PIXBUF_MINOR)); rb_define_const(RG_TARGET_NAMESPACE, "MICRO", INT2FIX(GDK_PIXBUF_MICRO)); /* * The GdkPixbuf Structure */ G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "pixels", get_pixels, 0); RG_DEF_METHOD_OPERATOR("pixels=", set_pixels, 1); RG_DEF_METHOD(get_option, 1); /* GdkPixbufError */ G_DEF_ERROR(GDK_PIXBUF_ERROR, "PixbufError", mGdk, rb_eRuntimeError, GDK_TYPE_PIXBUF_ERROR); /* GdkColorspace */ G_DEF_CLASS(GDK_TYPE_COLORSPACE, "ColorSpace", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_COLORSPACE, "GDK_"); /* GdkPixbufAlphaMode */ G_DEF_CLASS(GDK_TYPE_PIXBUF_ALPHA_MODE, "AlphaMode", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_PIXBUF_ALPHA_MODE, "GDK_PIXBUF_"); /* * File Loading, Image Data in Memory */ RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(dup, 0); #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) RG_DEF_SMETHOD(get_file_info, 1); #endif /* * File saving */ RG_DEF_METHOD(save, -1); #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) RG_DEF_METHOD(save_to_buffer, -1); #endif /* * Scaling */ RG_DEF_METHOD(scale, -1); RG_DEF_METHOD_BANG(scale, -1); RG_DEF_METHOD(composite, 7); RG_DEF_METHOD_BANG(composite, -1); #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) RG_DEF_METHOD(rotate, 1); RG_DEF_METHOD(flip, 1); #endif /* GdkInterpType */ G_DEF_CLASS(GDK_TYPE_INTERP_TYPE, "InterpType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INTERP_TYPE, "GDK_"); #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) /* GdkPixbufRotation */ G_DEF_CLASS(GDK_TYPE_PIXBUF_ROTATION, "GdkPixbufRotation", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_PIXBUF_ROTATION, "GDK_PIXBUF_"); #endif /* * Utilities */ RG_DEF_METHOD(add_alpha, 4); RG_DEF_METHOD(copy_area, 7); RG_DEF_METHOD(saturate_and_pixelate, 2); RG_DEF_METHOD_BANG(fill, 1); /* * Module Interface */ #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) RG_DEF_SMETHOD(formats, 0); RG_DEF_METHOD(set_option, 2); #endif Init_gdk_pixbuf_animation(mGdk); Init_gdk_pixbuf_animation_iter(mGdk); #if RBGDK_PIXBUF_CHECK_VERSION(2,8,0) Init_gdk_pixbuf_simpleanim(mGdk); #endif Init_gdk_pixdata(mGdk); Init_gdk_pixbuf_loader(mGdk); Init_gdk_pixbuf_format(mGdk); } ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/extconf.rb0000644000175000017500000000361112446160551022022 0ustar koukou=begin extconf.rb for Ruby/GdkPixbuf2 extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "gdk_pixbuf2" package_id = "gdk-pixbuf-2.0" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ["glib2"].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 setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libgdk-pixbuf2.0-dev", :redhat => "gtk2-devel", :fedora => "gdk-pixbuf2-devel", :homebrew => "gdk-pixbuf", :macports => "gdk-pixbuf2") exit(false) end have_func("gdk_pixbuf_set_option", "gdk-pixbuf/gdk-pixbuf.h") do |src| "#define GDK_PIXBUF_ENABLE_BACKEND\n#{src}" end create_pkg_config_file("Ruby/GdkPixbuf2", package_id, nil, "ruby-gdk-pixbuf2.pc") 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 ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf-format.c0000664000175000017500000001114611740310343024041 0ustar koukou/* -*- 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 "rbgdk-pixbuf2private.h" #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) #ifdef HAVE_GDK_PIXBUF_GDK_PIXBUF_IO_H #include #endif #define RG_TARGET_NAMESPACE cPixbufFormat #define _SELF(r) (RVAL2GDKPIXBUFFORMAT(r)) /**********************************/ static GdkPixbufFormat* format_copy(const GdkPixbufFormat* val) { GdkPixbufFormat* new_val; g_return_val_if_fail (val != NULL, NULL); new_val = g_new(GdkPixbufFormat, 1); *new_val = *val; return new_val; } GType gdk_pixbuf_format_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GdkPixbufFormat", (GBoxedCopyFunc)format_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ /* Move to rbgdk-pixbuf.c gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf, const gchar *key, const gchar *value); GSList* gdk_pixbuf_get_formats (void); */ static VALUE rg_name(VALUE self) { return CSTR2RVAL_FREE(gdk_pixbuf_format_get_name(_SELF(self))); } static VALUE rg_description(VALUE self) { return CSTR2RVAL_FREE(gdk_pixbuf_format_get_description(_SELF(self))); } static VALUE rg_mime_types(VALUE self) { gint i = 0; gchar** mime_types = gdk_pixbuf_format_get_mime_types(_SELF(self)); VALUE array = rb_ary_new(); while(mime_types[i]){ rb_ary_push(array, CSTR2RVAL(mime_types[i])); i++; } g_strfreev(mime_types); return array; } static VALUE rg_extensions(VALUE self) { gint i = 0; gchar** extensions = gdk_pixbuf_format_get_extensions(_SELF(self)); VALUE array = rb_ary_new(); while(extensions[i]){ rb_ary_push(array, CSTR2RVAL(extensions[i])); i++; } g_strfreev(extensions); return array; } static VALUE rg_writable_p(VALUE self) { return CBOOL2RVAL(gdk_pixbuf_format_is_writable(_SELF(self))); } /* Structure */ static VALUE rg_domain(VALUE self) { return CSTR2RVAL(_SELF(self)->domain); } static VALUE rg_signature(VALUE self) { GdkPixbufModulePattern* signature = _SELF(self)->signature; VALUE array = rb_ary_new(); int i = 0; while(signature[i].prefix){ rb_ary_push(array, rb_ary_new3(3, CSTR2RVAL((const char*)signature[i].prefix), CSTR2RVAL((const char*)signature[i].mask), INT2NUM(signature[i].relevance))); i++; } return array; } #endif #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) static VALUE rg_scalable_p(VALUE self) { return CBOOL2RVAL(gdk_pixbuf_format_is_scalable(_SELF(self))); } static VALUE rg_disabled_p(VALUE self) { return CBOOL2RVAL(gdk_pixbuf_format_is_disabled(_SELF(self))); } static VALUE rg_set_disabled(VALUE self, VALUE disabled) { gdk_pixbuf_format_set_disabled(_SELF(self), RVAL2CBOOL(disabled)); return self; } static VALUE rg_license(VALUE self) { return CSTR2RVAL(gdk_pixbuf_format_get_license(_SELF(self))); } #endif void Init_gdk_pixbuf_format(VALUE mGdk) { #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF_FORMAT, "PixbufFormat", mGdk); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(description, 0); RG_DEF_METHOD(mime_types, 0); RG_DEF_METHOD(extensions, 0); RG_DEF_METHOD_P(writable, 0); RG_DEF_METHOD(domain, 0); RG_DEF_METHOD(signature, 0); #if RBGDK_PIXBUF_CHECK_VERSION(2,6,0) RG_DEF_METHOD_P(scalable, 0); RG_DEF_METHOD_P(disabled, 0); RG_DEF_METHOD(set_disabled, 1); RG_DEF_METHOD(license, 0); #endif #endif } ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf2conversions.h0000644000175000017500000000427511701304107025134 0ustar koukou/* -*- 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 */ #ifndef __RBGDK_PIXBUF2CONVERSIONS_H__ #define __RBGDK_PIXBUF2CONVERSIONS_H__ #define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o))) #define RVAL2GDKPIXBUFANIMATION(o) (GDK_PIXBUF_ANIMATION(RVAL2GOBJ(o))) #define RVAL2GDKPIXBUFANIMATIONITER(o) (GDK_PIXBUF_ANIMATION_ITER(RVAL2GOBJ(o))) #define RVAL2GDKPIXBUFLOADER(o) (GDK_PIXBUF_LOADER(RVAL2GOBJ(o))) #define RVAL2GDKPIXBUFSIMPLEANIM(o) (GDK_PIXBUF_SIMPLE_ANIM(RVAL2GOBJ(o))) #define RVAL2GDKPIXBUFFORMAT(o) ((GdkPixbufFormat*)RVAL2BOXED(o, GDK_TYPE_PIXBUF_FORMAT)) #define GDKPIXBUFFORMAT2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_PIXBUF_FORMAT)) #define RVAL2GDKPIXDATA(o) ((GdkPixdata*)RVAL2BOXED(o, GDK_TYPE_PIXDATA)) #define GDKPIXDATA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_PIXDATA)) #define RVAL2GDKCOLORSPACE(o) (RVAL2GENUM(o, GDK_TYPE_COLORSPACE)) #define GDKCOLORSPACE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_COLORSPACE)) #define RVAL2GDKINTERPTYPE(o) (RVAL2GENUM(o, GDK_TYPE_INTERP_TYPE)) #define GDKINTERPTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_INTERP_TYPE)) #define RVAL2GDKPIXBUFROTATION(o) (RVAL2GENUM(o, GDK_TYPE_PIXBUF_ROTATION)) #define GDKPIXBUFROTATION2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_PIXBUF_ROTATION)) #endif /* __RBGDK_PIXBUF2CONVERSIONS_H__ */ ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/depend0000644000175000017500000000052712064346475021223 0ustar koukouinstall-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rbgdk-pixbuf.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgdk-pixbuf2conversions.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gdk-pixbuf2.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf2private.h0000644000175000017500000000260711701304107024233 0ustar koukou/* -*- 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 */ #ifndef __RBGDK_PIXBUF2PRIVATE_H__ #define __RBGDK_PIXBUF2PRIVATE_H__ #include "rbgdk-pixbuf.h" G_GNUC_INTERNAL void Init_gdk_pixbuf_animation(VALUE mGLib); G_GNUC_INTERNAL void Init_gdk_pixbuf_animation_iter(VALUE mGLib); G_GNUC_INTERNAL void Init_gdk_pixbuf_format(VALUE mGLib); G_GNUC_INTERNAL void Init_gdk_pixbuf_loader(VALUE mGLib); #if RBGDK_PIXBUF_CHECK_VERSION(2,8,0) G_GNUC_INTERNAL void Init_gdk_pixbuf_simpleanim(VALUE mGLib); #endif G_GNUC_INTERNAL void Init_gdk_pixdata(VALUE mGLib); #endif /* __RBGDK_PIXBUF2PRIVATE_H__ */ ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbufanimation.c0000644000175000017500000000513711701304107024452 0ustar koukou/* -*- 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 "rbgdk-pixbuf2private.h" #define RG_TARGET_NAMESPACE cPixbufAnimation #define _SELF(s) (RVAL2GDKPIXBUFANIMATION(s)) static VALUE rg_initialize(VALUE self, VALUE filename) { GdkPixbufAnimation* ret; GError* error = NULL; ret = gdk_pixbuf_animation_new_from_file(RVAL2CSTR(filename), &error); if (ret == NULL) RAISE_GERROR(error); G_INITIALIZE(self, ret); return Qnil; } static VALUE rg_width(VALUE self) { return INT2NUM(gdk_pixbuf_animation_get_width(_SELF(self))); } static VALUE rg_height(VALUE self) { return INT2NUM(gdk_pixbuf_animation_get_height(_SELF(self))); } static VALUE rg_get_iter(int argc, VALUE *argv, VALUE self) { VALUE start_time_sec, start_time_usec; GTimeVal start_time; rb_scan_args(argc, argv, "02", &start_time_sec, &start_time_usec); if (NIL_P(start_time_sec)) return GOBJ2RVAL(gdk_pixbuf_animation_get_iter(_SELF(self), NULL)); start_time.tv_sec = NUM2LONG(start_time_sec); start_time.tv_usec = NIL_P(start_time_usec) ? 0 : NUM2LONG(start_time_usec); return GOBJ2RVAL(gdk_pixbuf_animation_get_iter(_SELF(self), &start_time)); } static VALUE rg_static_image_p(VALUE self) { return CBOOL2RVAL(gdk_pixbuf_animation_is_static_image(_SELF(self))); } static VALUE rg_static_image(VALUE self) { return GOBJ2RVAL(gdk_pixbuf_animation_get_static_image(_SELF(self))); } void Init_gdk_pixbuf_animation(VALUE mGdk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF_ANIMATION, "PixbufAnimation", mGdk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(width, 0); RG_DEF_METHOD(height, 0); RG_DEF_METHOD(get_iter, -1); RG_DEF_METHOD_P(static_image, 0); RG_DEF_METHOD(static_image, 0); } ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf.h0000644000175000017500000000302011701304107022544 0ustar koukou/* -*- 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 */ #ifndef __RBGDK_PIXBUF_H__ #define __RBGDK_PIXBUF_H__ #define GDK_PIXBUF_ENABLE_BACKEND #include #include #include "rbgobject.h" #include "rbgdk-pixbuf2conversions.h" extern GType gdk_pixbuf_format_get_type(void); #define RBGDK_PIXBUF_CHECK_VERSION(major,minor,micro) \ (GDK_PIXBUF_MAJOR > (major) || \ (GDK_PIXBUF_MAJOR == (major) && GDK_PIXBUF_MINOR > (minor)) || \ (GDK_PIXBUF_MAJOR == (major) && GDK_PIXBUF_MINOR == (minor) && \ GDK_PIXBUF_MICRO >= (micro))) #define GDK_TYPE_PIXBUF_FORMAT (gdk_pixbuf_format_get_type()) #endif /* __RBGDK_PIXBUF_H__ */ ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/gdk_pixbuf2.def0000644000175000017500000000003211701304107022673 0ustar koukouEXPORTS Init_gdk_pixbuf2 ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixdata.c0000644000175000017500000001515411701304107022707 0ustar koukou/* -*- 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 "rbgdk-pixbuf2private.h" #define GDK_TYPE_PIXDATA (gdk_pixdata_get_type()) #define RG_TARGET_NAMESPACE cPixdata #define _SELF(s) (RVAL2GDKPIXDATA(s)) static ID id_pixdata; /*****************************************/ static GdkPixdata * gdk_pixdata_copy(const GdkPixdata* src) { GdkPixdata* data; g_return_val_if_fail (src != NULL, NULL); data = g_new(GdkPixdata, 1); *data = *src; return data; } static GType gdk_pixdata_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GdkPixdata", (GBoxedCopyFunc)gdk_pixdata_copy, (GBoxedFreeFunc)g_free); return our_type; } /*****************************************/ static VALUE rg_s_from_pixbuf(G_GNUC_UNUSED VALUE self, VALUE pixbuf, VALUE use_rle) { GdkPixdata pixdata; gpointer rle_data = gdk_pixdata_from_pixbuf(&pixdata, RVAL2GDKPIXBUF(pixbuf), RVAL2CBOOL(use_rle)); VALUE ret = GDKPIXDATA2RVAL(&pixdata); if (use_rle){ /* need to manage the returned value */ rb_ivar_set(ret, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, rle_data)); } return ret; } static VALUE rg_to_pixbuf(VALUE self, VALUE copy_pixels) { GError* error = NULL; GdkPixbuf* ret = gdk_pixbuf_from_pixdata(_SELF(self), RVAL2CBOOL(copy_pixels), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(ret); } static VALUE rg_serialize(VALUE self) { guint stream_length; guint i; guint8* ret = gdk_pixdata_serialize(_SELF(self), &stream_length); VALUE ary = rb_ary_new2(stream_length); for (i = 0; i < stream_length; i++) { rb_ary_push(ary, UINT2NUM(ret[i])); } return ary; } static VALUE rg_s_deserialize(VALUE self, VALUE rbstream) { GdkPixdata pixdata; long n; guint8 *stream = RVAL2GUINT8S(rbstream, n); GError *error = NULL; /* TODO: Should we really be creating a new array here? As far as I can tell, the data is copied. */ if (!gdk_pixdata_deserialize(&pixdata, n, stream, &error)) RAISE_GERROR(error); /* need to manage the returned value */ rb_ivar_set(self, id_pixdata, Data_Wrap_Struct(rb_cData, NULL, g_free, stream)); return GDKPIXDATA2RVAL(&pixdata); } static VALUE rg_to_csource(VALUE self, VALUE name, VALUE dump_type) { GString* str = gdk_pixdata_to_csource(_SELF(self), RVAL2CSTR(name), FIX2INT(dump_type)); VALUE ret = CSTR2RVAL(str->str); g_string_free(str, TRUE); return ret; } /* GdkPixdata */ static VALUE rg_magic(VALUE self) { return UINT2NUM(_SELF(self)->magic); } static VALUE rg_length(VALUE self) { gint32 length = _SELF(self)->length; if(length > 0) length -= GDK_PIXDATA_HEADER_LENGTH; return INT2NUM(length); } static VALUE rg_pixdata_type(VALUE self) { return UINT2NUM(_SELF(self)->pixdata_type); } static VALUE rg_rowstride(VALUE self) { return INT2NUM(_SELF(self)->rowstride); } 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_pixel_data(VALUE self) { gint i; guint8* ret = _SELF(self)->pixel_data; gint32 length = _SELF(self)->length - GDK_PIXDATA_HEADER_LENGTH; VALUE ary = rb_ary_new2(length); for (i = 0; i < length; i++) { rb_ary_push(ary, UINT2NUM(ret[i])); } return ary; } void Init_gdk_pixdata(VALUE mGdk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXDATA, "Pixdata", mGdk); id_pixdata = rb_intern("pixdata"); RG_DEF_SMETHOD(from_pixbuf, 2); RG_DEF_SMETHOD(deserialize, 1); RG_DEF_METHOD(to_pixbuf, 1); RG_DEF_METHOD(serialize, 0); RG_DEF_METHOD(to_csource, 2); RG_DEF_METHOD(magic, 0); RG_DEF_METHOD(length, 0); RG_DEF_METHOD(pixdata_type, 0); RG_DEF_METHOD(rowstride, 0); RG_DEF_METHOD(width, 0); RG_DEF_METHOD(height, 0); RG_DEF_METHOD(pixel_data, 0); rb_define_const(RG_TARGET_NAMESPACE, "PIXBUF_MAGIC_NUMBER", INT2NUM(GDK_PIXBUF_MAGIC_NUMBER)); rb_define_const(RG_TARGET_NAMESPACE, "HEADER_LENGTH", INT2NUM(GDK_PIXDATA_HEADER_LENGTH)); /* GdkPixdataType */ rb_define_const(RG_TARGET_NAMESPACE, "COLOR_TYPE_RGB", INT2FIX(GDK_PIXDATA_COLOR_TYPE_RGB)); rb_define_const(RG_TARGET_NAMESPACE, "COLOR_TYPE_RGBA", INT2FIX(GDK_PIXDATA_COLOR_TYPE_RGBA)); rb_define_const(RG_TARGET_NAMESPACE, "COLOR_TYPE_MASK", INT2FIX(GDK_PIXDATA_COLOR_TYPE_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "SAMPLE_WIDTH_8", INT2FIX(GDK_PIXDATA_SAMPLE_WIDTH_8)); rb_define_const(RG_TARGET_NAMESPACE, "SAMPLE_WIDTH_MASK", INT2FIX(GDK_PIXDATA_SAMPLE_WIDTH_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "ENCODING_RAW", INT2FIX(GDK_PIXDATA_ENCODING_RAW)); rb_define_const(RG_TARGET_NAMESPACE, "ENCODING_RLE", INT2FIX(GDK_PIXDATA_ENCODING_RLE)); rb_define_const(RG_TARGET_NAMESPACE, "ENCODING_MASK", INT2FIX(GDK_PIXDATA_ENCODING_MASK)); /* GdkPixdataDumpType */ rb_define_const(RG_TARGET_NAMESPACE, "DUMP_PIXDATA_STREAM", INT2FIX(GDK_PIXDATA_DUMP_PIXDATA_STREAM)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_PIXDATA_STRUCT", INT2FIX(GDK_PIXDATA_DUMP_PIXDATA_STRUCT)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_MACROS", INT2FIX(GDK_PIXDATA_DUMP_MACROS)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_GTYPES", INT2FIX(GDK_PIXDATA_DUMP_GTYPES)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_CTYPES", INT2FIX(GDK_PIXDATA_DUMP_CTYPES)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_STATIC", INT2FIX(GDK_PIXDATA_DUMP_STATIC)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_CONST", INT2FIX(GDK_PIXDATA_DUMP_CONST)); rb_define_const(RG_TARGET_NAMESPACE, "DUMP_RLE_DECODER", INT2FIX(GDK_PIXDATA_DUMP_RLE_DECODER)); } ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbuf-loader.c0000644000175000017500000001037211701304107024013 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Masao Mutoh * 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 "rbgdk-pixbuf2private.h" #define RG_TARGET_NAMESPACE cPixbufLoader #define _SELF(s) RVAL2GDKPIXBUFLOADER(s) /****************************************************/ /* File opening */ /* Image Data in Memory */ static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GdkPixbufLoader* loader; GError* error = NULL; VALUE arg1, is_mime_type; rb_scan_args(argc, argv, "02", &arg1, &is_mime_type); if (NIL_P(arg1)) { loader = gdk_pixbuf_loader_new(); } else { if (is_mime_type == Qtrue) { #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) loader = gdk_pixbuf_loader_new_with_mime_type(RVAL2CSTR(arg1), &error); #else rb_warning("Not supported GTK+-2.0/2.2."); loader = gdk_pixbuf_loader_new(); #endif } else { /* Default behavior */ loader = gdk_pixbuf_loader_new_with_type(RVAL2CSTR(arg1), &error); } if(error) RAISE_GERROR(error); } G_INITIALIZE(self, loader); return Qnil; } #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) static VALUE rg_format(VALUE self) { GdkPixbufFormat* format = gdk_pixbuf_loader_get_format(_SELF(self)); return GDKPIXBUFFORMAT2RVAL(format); } #endif static VALUE rg_write(VALUE self, VALUE data) { GError *error = NULL; StringValue(data); if (!gdk_pixbuf_loader_write(_SELF(self), (const guchar *)RSTRING_PTR(data), RSTRING_LEN(data), &error)) RAISE_GERROR(error); return Qtrue; } static VALUE rg_last_write(VALUE self, VALUE data) { GError *error = NULL; StringValue(data); if (!gdk_pixbuf_loader_write(_SELF(self), (const guchar *)RSTRING_PTR(data), RSTRING_LEN(data), &error)) RAISE_GERROR(error); if (!gdk_pixbuf_loader_close(_SELF(self), &error)) RAISE_GERROR(error); return Qtrue; } #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) static VALUE rg_set_size(VALUE self, VALUE width, VALUE height) { gdk_pixbuf_loader_set_size(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } #endif static VALUE rg_close(VALUE self) { GError *error = NULL; gboolean res; res = gdk_pixbuf_loader_close(_SELF(self), &error); if(error) RAISE_GERROR(error); return CBOOL2RVAL(res); } /****************************************************/ /* Creating image */ static VALUE rg_pixbuf(VALUE self) { return GOBJ2RVAL(gdk_pixbuf_loader_get_pixbuf(_SELF(self))); } /* Creating animation */ static VALUE rg_animation(VALUE self) { return GOBJ2RVAL(gdk_pixbuf_loader_get_animation(_SELF(self))); } void Init_gdk_pixbuf_loader(VALUE mGdk) { VALUE RG_TARGET_NAMESPACE; /* initialize it */ RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF_LOADER, "PixbufLoader", mGdk); /* * File Loading, Image Data in Memory */ RG_DEF_METHOD(initialize, -1); rb_undef_method(RG_TARGET_NAMESPACE, "dup"); #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) RG_DEF_METHOD(format, 0); #endif RG_DEF_METHOD(write, 1); RG_DEF_METHOD(last_write, 1); #if RBGDK_PIXBUF_CHECK_VERSION(2,2,0) RG_DEF_METHOD(set_size, 2); #endif RG_DEF_METHOD(close, 0); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(animation, 0); }ruby-gnome2-all-2.2.5/gdk_pixbuf2/ext/gdk_pixbuf2/rbgdk-pixbufsimpleanim.c0000644000175000017500000000332611701304107024627 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 the ruby-gnome2 project * * 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 "rbgdk-pixbuf2private.h" #if RBGDK_PIXBUF_CHECK_VERSION(2,8,0) #define RG_TARGET_NAMESPACE cPixbufSimpleAnim #define _SELF(s) (RVAL2GDKPIXBUFSIMPLEANIM(s)) static VALUE rg_initialize(VALUE self, VALUE width, VALUE height, VALUE rate) { GdkPixbufSimpleAnim* ret = gdk_pixbuf_simple_anim_new(NUM2INT(width), NUM2INT(height), NUM2DBL(rate)); G_INITIALIZE(self, ret); return Qnil; } static VALUE rg_add_frame(VALUE self, VALUE pixbuf) { gdk_pixbuf_simple_anim_add_frame(_SELF(self), RVAL2GDKPIXBUF(pixbuf)); return self; } #endif void Init_gdk_pixbuf_simpleanim(VALUE mGdk) { #if RBGDK_PIXBUF_CHECK_VERSION(2,8,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXBUF_SIMPLE_ANIM, "PixbufSimpleAnim", mGdk); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(add_frame, 1); #endif } ruby-gnome2-all-2.2.5/gdk_pixbuf2/COPYING.LIB0000644000175000017500000006364212257552167016505 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/gdk_pixbuf2/lib/0000755000175000017500000000000012516441043015564 5ustar koukouruby-gnome2-all-2.2.5/gdk_pixbuf2/lib/gdk_pixbuf2.rb0000644000175000017500000000224712257552167020336 0ustar koukourequire 'glib2' base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) if vendor_dir.exist? require "cairo" end begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gdk_pixbuf2.so" rescue LoadError require "gdk_pixbuf2.so" end if vendor_dir.exist? begin require "gobject-introspection" vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) rescue LoadError end end module Gdk class PixbufLoader def self.open(type = nil, mime_type = false) loader = Gdk::PixbufLoader.new(type, mime_type) if block_given? begin yield(loader) ensure loader.close end end loader end end class Pixbuf LOG_DOMAIN = "GdkPixbuf" class << self def cairo_available? if Gdk.respond_to?(:cairo_available?) Gdk.cairo_available? else false end end end end end GLib::Log.set_log_domain(Gdk::Pixbuf::LOG_DOMAIN) ruby-gnome2-all-2.2.5/gdk_pixbuf2/README0000644000175000017500000000124012257552167015707 0ustar koukouRuby/GdkPixbuf2 =============== Ruby/GdkPixbuf2 is a Ruby binding of GdkPixbuf-2.x. Requirements ------------ Ruby: http://www.ruby-lang.org/ GTK+: http://www.gtk.org/ Ruby/GLib2, Ruby/GTK2: http://ruby-gnome2.sourceforge.net/ Install ------- 0. install ruby-1.9.x or later, GTK+, Ruby/GLib2 and Ruby/GTK2. 1. ruby extconf.rb 2. make 3. su 4. make install Copying ------- Copyright (c) 2002-2005 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/0000755000175000017500000000000011701304107016271 5ustar koukouruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/flip.rb0000644000175000017500000000143111701304107017547 0ustar koukou#!/usr/bin/env ruby =begin flip.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: flip.rb,v 1.3 2006/06/17 14:38:08 mutoh Exp $ =end require 'gtk2' filename = ARGV[0] unless filename puts "ruby #{$0} filename" exit(1) end if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end vbox = Gtk::VBox.new src = Gdk::Pixbuf.new(filename) vbox.add(Gtk::Image.new(src)) # Horizontal dst = src.flip(true) vbox.add(Gtk::Image.new(dst)) # Vertical dst2 = src.flip(false) vbox.add(Gtk::Image.new(dst2)) window = Gtk::Window.new window.signal_connect('delete-event') do Gtk.main_quit end window.add(vbox).show_all Gtk.main ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/anim.rb0000644000175000017500000000134111701304107017541 0ustar koukou#!/usr/bin/env ruby =begin anim.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: anim.rb,v 1.5 2006/06/17 14:38:08 mutoh Exp $ =end require 'gtk2' w = Gtk::Window.new w.signal_connect('delete-event') do Gtk.main_quit end box = Gtk::VBox.new src = Gdk::PixbufAnimation.new("floppybuddy.gif") box.pack_start(Gtk::Image.new(src)) p src.width p src.height p src.static_image? static_image = src.static_image box.pack_start(Gtk::Image.new(static_image)) iter = src.get_iter p iter.advance p iter.delay_time p iter.on_currently_loading_frame? box.pack_start(Gtk::Image.new(iter.pixbuf)) w.add(box) w.show_all Gtk.main ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/save.rb0000644000175000017500000000103211701304107017550 0ustar koukou#!/usr/bin/env ruby =begin save.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: save.rb,v 1.5 2006/06/17 14:38:08 mutoh Exp $ =end require 'gdk_pixbuf2' from = ARGV[0] to = ARGV[1] if ! from or ! to puts "ruby #{$0} from_file to_file" exit(1) end src = Gdk::Pixbuf.new(from) dst = src.scale(300, 300, Gdk::Pixbuf::INTERP_HYPER) # This doesn't work .... #dst.save(to, "jpeg", {:quality => 100}) dst.save(to, "png") ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/scale.rb0000644000175000017500000000177111701304107017713 0ustar koukou#!/usr/bin/env ruby =begin scale.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: scale.rb,v 1.10 2006/06/17 14:38:08 mutoh Exp $ =end require 'gtk2' filename = ARGV[0] unless filename puts "ruby #{$0} filename" exit(1) end vbox = Gtk::VBox.new src = Gdk::Pixbuf.new(filename) vbox.add(Gtk::Image.new(src)) dst = src.scale(200, 200, Gdk::Pixbuf::INTERP_NEAREST) dst.scale!(src, 60, 60, 90, 90, -50, 50, 6, 3) vbox.add(Gtk::Image.new(dst)) dst2 = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, true, 8, 200, 200) dst2.scale!(src, 0, 0, 100, 100, 0, 0, 1.5, 1.5) vbox.add(Gtk::Image.new(dst2)) dst3 = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, true, 8, 200, 200) dst3.scale!(src, 0, 0, 200, 200, 0, 0, 5, 3, Gdk::Pixbuf::INTERP_HYPER) vbox.add(Gtk::Image.new(dst3)) window = Gtk::Window.new window.signal_connect('delete-event') do Gtk.main_quit end window.add(vbox).show_all Gtk.main ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/utils.rb0000644000175000017500000000167011701304107017762 0ustar koukou#!/usr/bin/env ruby =begin utils.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: utils.rb,v 1.4 2006/06/17 14:38:08 mutoh Exp $ =end require 'gtk2' filename = ARGV[0] unless filename puts "ruby #{$0} filename" exit(1) end src = Gdk::Pixbuf.new(filename) vbox = Gtk::VBox.new dst = src.add_alpha(true, 0, 0, 0) vbox.pack_start(Gtk::Image.new(dst)) dst = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, true, 8, src.width + 20, src.height + 30) src.copy_area(0, 0, src.width / 2, src.height / 2, dst, 10, 20) vbox.pack_start(Gtk::Image.new(dst)) dst = src.saturate_and_pixelate(0.3, true) vbox.pack_start(Gtk::Image.new(dst)) dst = src.fill!(0xff000099) #RGBA vbox.pack_start(Gtk::Image.new(dst)) w = Gtk::Window.new.add(vbox) w.signal_connect('delete-event') do Gtk.main_quit end w.show_all Gtk.main ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/inline.rb0000644000175000017500000000210511701304107020072 0ustar koukou=begin inline.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: inline.rb,v 1.2 2006/06/17 14:38:08 mutoh Exp $ =end require 'gtk2' pixbuf = Gdk::Pixbuf.new("gnome-foot.png") #pixbuf = Gdk::Pixbuf.new(ARGV[0]) # Create Gdk::Pixbuf from pixels(String). pixbuf2 = Gdk::Pixbuf.new(pixbuf.pixels, Gdk::Pixbuf::COLORSPACE_RGB, true, pixbuf.bits_per_sample, pixbuf.width, pixbuf.height, pixbuf.rowstride) # Create Gdk::Pixbuf from an array of numbers # which created by Gdk::Pixdata#serialize. pixdata = Gdk::Pixdata.from_pixbuf(pixbuf, false) data = pixdata.serialize pixbuf3 = Gdk::Pixbuf.new(data, false) # Create Gdk::Pixbuf from Gdk::Pixbuf. pixbuf4 = Gdk::Pixbuf.new(pixbuf, 10, 10, 20, 20) vbox = Gtk::VBox.new vbox.add(Gtk::Image.new(pixbuf)) vbox.add(Gtk::Image.new(pixbuf2)) vbox.add(Gtk::Image.new(pixbuf3)) vbox.add(Gtk::Image.new(pixbuf4)) Gtk::Window.new.add(vbox).show_all Gtk.main ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/rotate.rb0000644000175000017500000000150211701304107020112 0ustar koukou#!/usr/bin/env ruby =begin rotate.rb - Ruby/GdkPixbuf sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: rotate.rb,v 1.3 2006/06/17 14:38:08 mutoh Exp $ =end require 'gtk2' filename = ARGV[0] unless filename puts "ruby #{$0} filename" exit(1) end if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end vbox = Gtk::VBox.new src = Gdk::Pixbuf.new(filename) vbox.add(Gtk::Image.new(src)) dst = src.rotate(Gdk::Pixbuf::ROTATE_COUNTERCLOCKWISE) vbox.add(Gtk::Image.new(dst)) dst2 = src.rotate(Gdk::Pixbuf::ROTATE_UPSIDEDOWN) vbox.add(Gtk::Image.new(dst2)) window = Gtk::Window.new window.signal_connect('delete-event') do Gtk.main_quit end window.add(vbox).show_all Gtk.main ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/floppybuddy.gif0000644000175000017500000001214011701304107021317 0ustar koukouGIF89aPF  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~ぁ=v{! NETSCAPE2.0! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@H 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gNAȚkhq8S)5Hgf>$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P vX(Dːյj7)֩VU{n*4YR{5*ʹ ,hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(ǁd`]&L%Db'\~ rуxvڌԈҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T!This GIF file was assembled by CDavis with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. ! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@H 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gNAȚkhq8S)5Hgf>$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P vX(Dːյj7)֩VU{n*4YR{5*ʹ ,hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(ǁd`]&L%Db'\~ rуxvڌԈҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T!This space for rent...! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@H 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gNAȚkhq8S)5Hgf>$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P vX(Dːյj7)֩VU{n*4YR{5*ʹ ,hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(ǁd`]&L%Db'\~ rуxvڌԈҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T!This GIF file was assembled with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set;ruby-gnome2-all-2.2.5/gdk_pixbuf2/sample/gnome-foot.png0000644000175000017500000000554411701304107021061 0ustar koukouPNG  IHDR/0#gAMA1_ IDATxYkly=wfvvfܗ)QŪl#HqdmT i4N A(n ] l<8v*#%RDY$MJ>?2T ,T\0s _e/ׇ o>Н:qj^ڷo߉mXpd WMjo1W[?kll,cСT*5:6M$eW2ob x3}3}xgPUjI3&c+wM& rտ%v{v$+Q):ښNƘUOdΑ/R7ODzHKR"xDb!zKAHiY0 RedLU(fyQݵr]] Cj6ѪU!J-a>奂Jz|q 琈E0ym{A=J|7xx#luS6}Wz6#gޘ%r[%-Mi|Zov,e |YQp"z}_wԪ_hUvyc ѦY|)B&_; qիtMb\^cϏ& G}F+8nu;hdhp6Zbew7%5 3 3j`*-nxw-8ph$Rwmcg.#\ٚmd몂g Kdj,J(*}k_z~'H^sk#-dz7vq5_VONKF8%5*'Qc]Xioiٟĥûo岹#vDP0Ƕ`YoozVYT?/l$,D!M%c-V0̟lV+T%drL\0y?mlВ'FGL%4D2IEM MF>Oy3׳ݽ}X|wo_o,l biuS/#[(=948Ǡ`zz{a[aYGPIg,# Hu^-Cm]X_;+{>VWU mX0, ϣ4C<ЪW`Y"Fni|e̤Pk $>\|r=N"6  CJYǒb!ǶZ@MC#\V˫V)c=vjn̻ [5 VIa[xAqD1׶ XYZd2gr[AWfD/Wk3GiZeyx'eBD1D8%kkeL%OO<^-Fޜ$ 1-;єdhF$EmS'eQ]Ӊm0M,g2x8v,~7|/jf0ֽ%ю^0l8$-I (J=j;.XaZbMo;MC| -Q8<<  :test def version @version ||= ENV["VERSION"] || guess_version end def guess_version versions = {} File.open("glib2/ext/glib2/rbglib.h") do |rbglib_h| rbglib_h.each_line do |line| if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line versions[$1.downcase] = $2.to_i end end end ["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".") end def dist_dir(base_name, _version=nil) _version ||= version "#{base_name}-#{_version}" end def archive_name(base_name, _version=nil) dist_dir(base_name, _version) + ".tar.gz" end @needless_paths = [ ".svn", ".test-result", ".gdb_history", "mkmf.log", "*.o", "*.so", "pkg", "vendor", "tmp", ] def package(base_name, paths, needless_paths=nil) _dist_dir = dist_dir(base_name) rm_rf(_dist_dir) mkdir_p(_dist_dir) cp_r(paths, _dist_dir, :preserve => true) needless_paths ||= @needless_paths Dir.glob("#{_dist_dir}/**/{#{needless_paths.join(',')}}") do |needless_path| rm_rf(needless_path) end Dir.glob("#{_dist_dir}/**/*/") do |directory| if (Dir.entries(directory) - [".", ".."]).empty? rm_r(directory) end end sh("tar", "cvfz", archive_name(base_name), _dist_dir) ensure rm_rf(_dist_dir) if _dist_dir end def download(url, local_path=nil) local_path ||= File.basename(url) open(url) do |remote_file| File.open(local_path, "wb") do |local_file| local_file.print(remote_file.read) end end local_path end def change_environment_variable(variables) original_variables = {} variables.each do |key, value| next if ENV[key] original_variables[key] = ENV[key] ENV[key] = value end begin yield ensure original_variables.each do |key, value| ENV[key] = value end end end desc "configure all packages" task :configure do ruby("extconf.rb") end file "Makefile" do task(:configure).invoke end desc "build all packages" task :build => ["Makefile"] do sh("make") end namespace :windows do desc "build all packages for Windows" task :build do cd("build") do sh("vagrant", "destroy", "--force") sh("vagrant", "up") end end end desc "clean all packages" task :clean do sh("make", "clean") if File.exist?("Makefile") end desc "more clean all packages" task :distclean do sh("make", "distclean") if File.exist?("Makefile") end desc "run tests for all packages" task :test => [:build] do ruby("run-test.rb") end gtk2_base_name = "ruby-gtk2" gtk3_base_name = "ruby-gtk3" gnome2_base_name = "ruby-gnome2-all" gtk2_packages = [ "glib2", "gobject-introspection", "gio2", "atk", "pango", "gdk_pixbuf2", "gtk2", ] gtk3_packages = gtk2_packages - ["gtk2"] + [ "cairo-gobject", "gdk3", "gtk3", ] gnome2_packages = gtk2_packages + gtk3_packages + [ "gstreamer", "gtksourceview2", "poppler", "rsvg2", "vte", "vte3", "gtksourceview3", "clutter", "clutter-gtk", "clutter-gstreamer", "webkit-gtk", "webkit-gtk2", ] gnome2_packages = gnome2_packages.uniq namespace :dist do base_files = ["AUTHORS", "COPYING.LIB", "NEWS", "README.md", "Rakefile", "exec_make.rb", "extconf.rb", "run-test.rb"] desc "make Ruby/GTK2 package" task :gtk2 do package(gtk2_base_name, base_files + gtk2_packages) end desc "make Ruby/GTK3 package" task :gtk3 do package(gtk3_base_name, base_files + gtk3_packages) end desc "make Ruby/GNOME2 package" task :gnome2 do package(gnome2_base_name, base_files + gnome2_packages) end ruby_versions = ["1.9.3-p545", "2.0.0-p451", "2.1.1"] namespace :test do ruby_base_url = "ftp://ftp.ruby-lang.org/pub/ruby" ruby_versions.each do |ruby_version| base_dir = "tmp/dist-test-#{version}/#{ruby_version}" directory base_dir prefix = Pathname.new(base_dir) + "local" ruby_tar_bz2_base = "ruby-#{ruby_version}.tar.bz2" file "#{base_dir}/#{ruby_tar_bz2_base}" => base_dir do generation = ruby_version.scan(/\A\d\.\d/)[0] ruby_tar_bz2_url = "#{ruby_base_url}/#{generation}/#{ruby_tar_bz2_base}" Dir.chdir(base_dir) do download(ruby_tar_bz2_url) end end ruby_path = "#{prefix}/bin/ruby" expanded_ruby_path = File.expand_path(ruby_path) file ruby_path => "#{base_dir}/#{ruby_tar_bz2_base}" do expanded_prefix = prefix.expand_path Dir.chdir(base_dir) do sh("tar", "xvf", ruby_tar_bz2_base) Dir.chdir(File.basename(ruby_tar_bz2_base, ".tar.bz2")) do sh("./configure", "--prefix=#{expanded_prefix}", "--with-out-ext=readline") sh("make", "-j8") sh("make", "install-nodoc") end end end rubygems_tgz_base = "rubygems-2.2.2.tgz" rubygems_tgz = "#{base_dir}/#{rubygems_tgz_base}" file rubygems_tgz => base_dir do rubygems_url_base = "http://production.cf.rubygems.org/rubygems" Dir.chdir(base_dir) do download("#{rubygems_url_base}/#{rubygems_tgz_base}") end end gem_path = "#{prefix}/bin/gem" expanded_gem_path = File.expand_path(gem_path) file gem_path => [ruby_path, rubygems_tgz] do Dir.chdir(base_dir) do sh("tar", "xvf", rubygems_tgz_base) Dir.chdir(File.basename(rubygems_tgz_base, ".tgz")) do sh(expanded_ruby_path, "setup.rb") end end end packages = { "gtk2" => { :archive_name => archive_name(gtk2_base_name), :packages => gtk2_packages, }, "gtk3" => { :archive_name => archive_name(gtk3_base_name), :packages => gtk3_packages, }, "gnome2" => { :archive_name => archive_name(gnome2_base_name), :packages => gnome2_packages, }, } namespace "ruby-#{ruby_version}" do packages.each do |name, attributes| namespace name do tar_gz = File.expand_path(attributes[:archive_name]) task :prepare => ["dist:#{name}", gem_path] do Dir.chdir(base_dir) do sh("tar", "xvf", tar_gz) end if /cairo/ !~ `#{expanded_gem_path} list cairo` sh(expanded_gem_path, "install", "cairo") end end attributes[:packages].each do |sub_package_name| task sub_package_name => :prepare do Dir.chdir(base_dir) do package_base_dir = File.basename(tar_gz, ".tar.gz") rm_rf(sub_package_name) sh("cp", "-a", "#{package_base_dir}/#{sub_package_name}", sub_package_name) Dir.chdir(sub_package_name) do if File.exist?("extconf.rb") sh(expanded_ruby_path, "extconf.rb") sh("make", "-j8") sh("make", "install") end end rm_rf(sub_package_name) end end end end end packages.each do |name, attributes| test_tasks = attributes[:packages].collect do |sub_package_name| "dist:test:ruby-#{ruby_version}:#{name}:#{sub_package_name}" end task name => test_tasks end end test_tasks = packages.collect do |name, attributes| "dist:test:ruby-#{ruby_version}:#{name}" end task "ruby-#{ruby_version}" => test_tasks end end test_tasks = ruby_versions.collect do |ruby_version| "dist:test:ruby-#{ruby_version}" end desc "run packages test" task :test => test_tasks end desc "make all packages" task :dist => ["dist:gtk2", "dist:gtk3", "dist:gnome2"] directory "misc" file "misc/release.rb" => "misc" do |task| release_rb = "https://raw.github.com/clear-code/cutter/master/misc/release.rb" open(release_rb) do |remote_release_rb| File.open(task.name, "w") do |local_release_rb| local_release_rb.print(remote_release_rb.read) end end end desc "release Ruby-GNOME2 packages" task :release => ["misc/release.rb", :dist] do sf_user_name = ENV["SF_USER"] || ENV["USER"] project_id = "ruby-gnome2" project_name = "Ruby-GNOME 2" package_name = "ruby-gnome2" release_name = "ruby-gnome2-#{version}" package_base_names = [gtk2_base_name, gtk3_base_name, gnome2_base_name] archive_names = package_base_names.collect do |base_name| archive_name(base_name) end ruby("misc/release.rb", sf_user_name, project_id, project_name, package_name, release_name, "README.md:1", "NEWS", *archive_names) end namespace :gem do desc "build all gems" task :build do gnome2_packages.each do |package| Dir.chdir(package) do ruby("-S", "rake", "gem") end end end desc "push all gems" task :push do gnome2_packages.each do |package| ruby("-S", "gem", "push", *Dir.glob(File.join(package, "pkg", "*-#{version}.gem"))) end end desc "install all gems" task :install do gnome2_packages.each do |package| ruby("-S", "gem", "install", "--user-install", *Dir.glob(File.join(package, "pkg", "*-#{version}.gem"))) end end desc "uninstall all gems" task :uninstall do gnome2_packages.each do |package| ruby("-S", "gem", "uninstall", "--version", version, package) end end namespace :windows do windows_unsupported_packages = [ "gtksourceview2", "vte", "vte3", "webkit-gtk", "webkit-gtk2", ] windows_gnome2_packages = gnome2_packages - windows_unsupported_packages namespace :build do desc "build all Windows binaries" task :vendor do windows_gnome2_packages.each do |package| Dir.chdir(package) do ruby("-S", "rake", "native:build", "windows:build") end end end desc "build all Windows bindings" task :ext do change_environment_variable("MAKE" => "make debugflags=") do windows_gnome2_packages.each do |package| Dir.chdir(package) do tasks = [ "cross", "windows:builder:build:prepare:pkg_config", "native", "gem", ] ruby_cc_version = ENV["RUBY_CC_VERSION"] || "2.0.0:2.1.5" ruby("-S", "rake", "RUBY_CC_VERSION=#{ruby_cc_version}", *tasks) end end end end desc "build GSettings schemas for all Windows binaries" task :schema do Dir.mktmpdir do |dir| windows_gnome2_packages.each do |package| gschema_xml_glob = File.join(package, "vendor", "local", "share", "glib-2.0", "schemas", "*.gschema.xml") Dir.glob(gschema_xml_glob).each do |schema| cp(schema, dir) end end sh("glib-compile-schemas", "--targetdir", "glib2/vendor/local/share/glib-2.0/schemas", dir) end end end desc "build all Windows gems" task :build => [ "gem:windows:build:vendor", "gem:windows:build:schema", "gem:windows:build:ext", ] desc "clean all Windows gems build" task :clean do windows_gnome2_packages.each do |package| rm_rf(File.join(package, "tmp")) end end desc "download DLL for Windows all gems" task :download do windows_gnome2_packages.each do |package| Dir.chdir(package) do ruby("-S", "rake", "windows:download") end end end desc "push all Windows gems" task :push do windows_gnome2_packages.each do |package| ruby("-S", "gem", "push", *Dir.glob(File.join(package, "pkg", "*-#{version}-x86-mingw32.gem"))) end end end end desc "tag the current release" task :tag do sh("git", "tag", "-a", version, "-m", "release #{version}!!!") end ruby-gnome2-all-2.2.5/poppler/0000755000175000017500000000000012516441042014272 5ustar koukouruby-gnome2-all-2.2.5/poppler/test/0000755000175000017500000000000012416346617015264 5ustar koukouruby-gnome2-all-2.2.5/poppler/test/test_document.rb0000644000175000017500000000233611701304107020452 0ustar koukouclass TestDocument < Test::Unit::TestCase def test_save saved_pdf = File.join(tmp_dir, "saved.pdf") FileUtils.rm_f(saved_pdf) document = Poppler::Document.new(form_pdf) find_first_text_field(document).text = "XXX" assert(document.save(saved_pdf)) assert(File.exist?(saved_pdf)) only_poppler_version(0, 8, 2) reread_document = Poppler::Document.new(saved_pdf) assert_equal("XXX", find_first_text_field(reread_document).text) end def test_save_a_copy only_poppler_version(0, 7, 2) copied_pdf = File.join(tmp_dir, "copied.pdf") FileUtils.rm_f(copied_pdf) document = Poppler::Document.new(form_pdf) first_text_field = find_first_text_field(document) default_text = first_text_field.text first_text_field.text = "XXX" assert(document.save_a_copy(copied_pdf)) assert(File.exist?(copied_pdf)) reread_document = Poppler::Document.new(copied_pdf) assert_equal(default_text, find_first_text_field(reread_document).text) end private def find_first_text_field(document) document.each do |page| page.form_field_mapping.each do |mapping| field = mapping.field return field if field.is_a?(Poppler::TextField) end end end end ruby-gnome2-all-2.2.5/poppler/test/test_constants.rb0000644000175000017500000000175211701304107020651 0ustar koukouclass TestConstants < Test::Unit::TestCase def test_annotation if later_version?(0, 7, 2) assertion = :assert_const_defined else assertion = :assert_not_const_defined end send(assertion, Poppler, :AnnotationType) if assertion == :assert_const_defined assert_equal("3d", Poppler::AnnotationType::TYPE_3D.nick) end send(assertion, Poppler, :AnnotationFlag) send(assertion, Poppler, :AnnotationMarkupReplyType) send(assertion, Poppler, :AnnotationExternalDataType) if assertion == :assert_const_defined assert_equal("3d", Poppler::AnnotationExternalDataType::TYPE_3D.nick) end if later_version?(0, 9, 0) assert_not_const_defined(Poppler, :AnnotationTextIcon) else send(assertion, Poppler, :AnnotationTextIcon) end send(assertion, Poppler, :AnnotationTextState) send(assertion, Poppler, :AnnotationFreeTextQuadding) end def test_permissions assert_const_defined(Poppler, :Permissions) end end ruby-gnome2-all-2.2.5/poppler/test/test_page.rb0000644000175000017500000000245412416346617017571 0ustar koukouclass TestPage < Test::Unit::TestCase def test_get_image omit("We don't have PDF that has image...") document = Poppler::Document.new(image_pdf) page, mapping = find_first_image_mapping(document) assert_kind_of(Cairo::ImageSurface, page.get_image(mapping.image_id)) assert_kind_of(Cairo::ImageSurface, mapping.image) end def test_selection_region document = Poppler::Document.new(form_pdf) page = document[0] rectangle = Poppler::Rectangle.new(0, 0, *page.size) region = page.get_selection_region(0.5, :word, rectangle) if later_version?(0, 7, 2) assert_kind_of(Poppler::Rectangle, region[0]) else assert_kind_of(Gdk::Region, region) end end def test_annotation_mapping only_poppler_version(0, 7, 2) document = Poppler::Document.new(form_pdf) page = document[0] assert_equal([Poppler::AnnotationMapping], page.annotation_mapping.collect {|mapping| mapping.class}.uniq) mapping = page.annotation_mapping[0] assert_kind_of(Poppler::Rectangle, mapping.area) assert_kind_of(Poppler::Annotation, mapping.annotation) end private def find_first_image_mapping(document) document.each do |page| page.image_mapping.each do |mapping| return [page, mapping] end end nil end end ruby-gnome2-all-2.2.5/poppler/test/run-test.rb0000755000175000017500000000163412307003726017367 0ustar koukou#!/usr/bin/env ruby base_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) have_make = system("which make > /dev/null") glib_dir = File.expand_path(File.join(base_dir, "..", "glib2")) gdk_pixbuf_dir = File.expand_path(File.join(base_dir, "..", "gdk_pixbuf2")) pango_dir = File.join(File.join(base_dir, ".." , "pango")) $LOAD_PATH.unshift(File.join(glib_dir, "test")) require 'glib-test-init' [[gdk_pixbuf_dir, "gdk_pixbuf2"], [pango_dir, "pango"], [glib_dir, "glib2"], [base_dir, "poppler"]].each do |dir, module_name| if have_make system("cd #{dir.dump} && make > /dev/null") or exit(false) end $LOAD_PATH.unshift(File.join(dir, "ext", module_name)) $LOAD_PATH.unshift(File.join(dir, "lib")) end require "poppler" $LOAD_PATH.unshift(File.join(base_dir, "test")) require 'poppler-test-utils' class Test::Unit::TestCase include PopplerTestUtils end exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/poppler/test/poppler-test-utils.rb0000644000175000017500000000230312126557022021373 0ustar koukourequire 'open-uri' require 'fileutils' module PopplerTestUtils def ensure_dir(dir) FileUtils.mkdir_p(dir) dir end def test_dir File.expand_path(File.dirname(__FILE__)) end def fixtures_dir ensure_dir(File.join(test_dir, "fixtures")) end def tmp_dir ensure_dir(File.join(test_dir, "tmp")) end def form_pdf file = File.join(fixtures_dir, "form.pdf") return file if File.exist?(file) pdf = open("http://www.irs.gov/pub/irs-pdf/fw9.pdf").read File.open(file, "wb") do |output| output.print(pdf) end file end def image_pdf File.join(fixtures_dir, "image.pdf") end def image_png File.join(fixtures_dir, "image.png") end def later_version?(major, minor, micro=nil) micro ||= 0 (Poppler::BUILD_VERSION <=> [major, minor, micro]) >= 0 end def only_poppler_version(major, minor, micro=nil) micro ||= 0 unless later_version?(major, minor, micro) omit("Require Poppler >= #{major}.#{minor}.#{micro}") end end def only_old_poppler_version(major, minor, micro=nil) micro ||= 0 if later_version?(major, minor, micro) omit("Require Poppler < #{major}.#{minor}.#{micro}") end end end ruby-gnome2-all-2.2.5/poppler/test/test_color.rb0000644000175000017500000000146211701304107017751 0ustar koukouclass TestColor < Test::Unit::TestCase def test_initialize only_poppler_version(0, 7, 2) rose = Poppler::Color.new(65535, 0, 32639) assert_equal([65535, 0, 32639], [rose.red, rose.green, rose.blue]) assert_equal([65535, 0, 32639], rose.to_a) end def test_accessor only_poppler_version(0, 7, 2) white = Poppler::Color.new(65535, 65535, 65535) red = white.dup red.green = 0 red.blue = 0 assert_equal([65535, 65535, 65535], [white.red, white.green, white.blue]) assert_equal([65535, 0, 0], [red.red, red.green, red.blue]) end def test_inspect only_poppler_version(0, 7, 2) color = Poppler::Color.new(0, 32767, 65535) rgb = '[0, 32767, 65535]' assert_match(/\A#\z/, color.inspect) end end ruby-gnome2-all-2.2.5/poppler/test/test_annotation.rb0000644000175000017500000000510712416346617021025 0ustar koukouclass TestAnnotation < Test::Unit::TestCase def test_type only_poppler_version(0, 7, 2) assert_kind_of(Poppler::AnnotationType, annotation.type) end def test_contents only_poppler_version(0, 7, 2) assert_nil(annotation.contents) end def test_name only_poppler_version(0, 7, 2) assert_nil(annotation.name) end def test_modified only_poppler_version(0, 7, 2) assert_nil(annotation.modified) end def test_flags only_poppler_version(0, 7, 2) assert_kind_of(Poppler::AnnotationFlag, annotation.flags) end def test_color only_poppler_version(0, 7, 2) assert_nil(annotation.color) end def test_markup only_poppler_version(0, 7, 2) # We don't have a PDF that has annotation markup... assert_method_defined(Poppler::AnnotationMarkup, :label) assert_method_defined(Poppler::AnnotationMarkup, :popup_is_open?) assert_method_defined(Poppler::AnnotationMarkup, :opacity) assert_method_defined(Poppler::AnnotationMarkup, :date) assert_method_defined(Poppler::AnnotationMarkup, :subject) assert_method_defined(Poppler::AnnotationMarkup, :reply_to) assert_method_defined(Poppler::AnnotationMarkup, :external_data) end def test_text only_poppler_version(0, 7, 2) # We don't have a PDF that has annotation text... assert_method_defined(Poppler::AnnotationText, :open?) assert_method_defined(Poppler::AnnotationText, :icon) assert_method_defined(Poppler::AnnotationText, :state) end def test_free_text only_poppler_version(0, 7, 2) # We don't have a PDF that has annotation free text... assert_method_defined(Poppler::AnnotationFreeText, :quadding) assert_method_defined(Poppler::AnnotationFreeText, :callout_line) end def test_callout_line only_poppler_version(0, 7, 2) callout_line = Poppler::AnnotationCalloutLine.new(true, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6) assert(callout_line.multiline?) assert_equal(1.1, callout_line.x1) assert_equal(2.2, callout_line.y1) assert_equal(3.3, callout_line.x2) assert_equal(4.4, callout_line.y2) assert_equal(5.5, callout_line.x3) assert_equal(6.6, callout_line.y3) assert_equal([true, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6], callout_line.to_a) end private def annotation document = Poppler::Document.new(form_pdf) page = document[0] page.annotation_mapping[0].annotation end def assert_method_defined(object, method) assert do object.method_defined?(method) end end end ruby-gnome2-all-2.2.5/poppler/test/fixtures/0000755000175000017500000000000012257552170017131 5ustar koukouruby-gnome2-all-2.2.5/poppler/test/fixtures/image.pdf0000644000175000017500000002222311701304107020673 0ustar koukou%PDF-1.4 % 2 0 obj << /Length 3 0 R /Filter /FlateDecode /Type /XObject /Subtype /Form /BBox [ 0 0 300 300 ] >> stream x endstream endobj 3 0 obj 10 endobj 4 0 obj << /Length 5 0 R /Type /XObject /Subtype /Image /Width 80 /Height 80 /ColorSpace /DeviceGray /BitsPerComponent 8 /Filter /FlateDecode >> stream xݘLeǿ; ..;p10V-('4s9[$5-V,HCI+A3tX PY0@Y àD׷y<y>|6>ŚhA$(اow`>Rc!)-)6xd3'ܚK.y!I$&: tGUOy9cl8]c pD+:KHBF#\+Tsb^2De-*2ӣpsFRAG1S@|c7{c 8 5񭺵X'\[RHM_x|&ؽ,yfX|+xtҮ3i>b_?!Kx A\˔}H3cxrPrxx8 of'@oJ6X,i(p-W*>ŮkzՏpOG+fZwa4R6(Qb; } H=#pe NR~E*J^T!8~o@^h Q ĥ%p1ݨ=(wXb*C;jǑh 6aWpPq9[CHvab!R2nZ êhP?lH<))*E.uCRwDJަ.s֘j]d@Gx݁7q-¨Rޒyܐ-8.^Yj↻Vu1l{?ewu8+V. ~^S+1 f%b:lOAc^J%NLo@P/I_$x5xRsp+ G&T'#&|͟ b6hfJ׊M#d5e^82o=П9Zń{(US<ι~W g}-B,#R8w#J()EK{{ ON6^wqn[ N.N}Tbc endstream endobj 5 0 obj 1340 endobj 6 0 obj << /Length 7 0 R /Type /XObject /Subtype /Image /Width 80 /Height 80 /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /FlateDecode /SMask 4 0 R >> stream xw\SWo !BBŪBWѶRꋣZ]H 6ȐF,"PQZ\Q MX>0_2|~?!~9ys1gYӖ-Ifڟ*".)ֶDK{kibh@%a"&{xq__^X_^^ejng9R|j}aasUUcYyHP}}QCÇ'zNOٽG[WG'jdDQSwTCޖ\-[Qdi5 >:22POOW"#C0wy@}4{Ϻ&@~Ѣ :[\_*(x{ÑmM(s F%;;?x9y&2UQ1G:1m._--7" گuO-~a&&7%z*+hhQ^drKK~-߅HaL6@}}7BA]||SJ ~S}|< Âg͚p4{&ER;tA[QQrrA1a I "RaaBCүg)8 8%I=]US̃{%+RL,\NSE9?>lYqV$|Α#$8WU^]bEնm5'O|s%m?6l%nxf94ŋβC7n9s9aX*0 ;aZ>khF{{M 7ITWl|,l|04ݸQ ֘*3)UaSH, K6 7 rtC*SYC|8 bEFmRJꥄDVfe  60p%a8|U#ʕ͖ffM @0?^9==ߖYZF`, <C ǰZ @ Eß,tsFW)4\i$kWtF!.'8 6 F .cHvS$i{ڼ _h0sti}>4q%ncX3`X+P|0˼ #/w#4xa4{-5Gp3qH`e%|ӧT)(v`îA"#,l^l,f`Xx*ɉ+*ꫫd0 *u>ALLN kaM@[l`"-: Wv4CM-ѡ|w,A5"(\Ez(-Oˎ&OuEӜ+sЛm>ΦMU;gjژ}SҞ|v@G^]2`N˖ HkO:!P=?Ҳ?Ȁwօ+]f:Tjm''cIQ#!z&X5; %)1בf"<|0=}LZjѾ~:1s(*!*Z p0aa~  );v$_xQ>t4ͩ^ -0|BI򿾠G ;w&]fjabS"x2L`<~; Ò:0S[S϶7wƍ^**^ꪰՅ`G?QSx]m-Y婩7Р_Kjkr%O yyAC G%\Q $$sQQrcb~pvŮ+Vx)))f75~W`{wy(LFy`=?G( >:}:f/Ue~::k:u8-66ttz;;{ގ^׬QUu1#辑t HH ECH?`X޾>DXXYzzwOz"80 hݍ uuݵ]. nNY K66n⾚ m\y񭁥Ka4G `j RXp@E^\\GeH]wM nbb2:++;+*pwuvovO_oEZѸO?OUVRU9;gNc &FΟ[@@KA; [Z*(\_wzՑߑ%o/?bg"&;x 9GN9ggg 1|B7liubio6Pnn۳gmO1mOzѣևq=xP c5˰w 6M°(#zb0bi˃99r>.Wݻ-wdgܾrVsV3))@W]^~R6ڱ[CݕHL_.3S#m yǣҒjy矛33qed4߸ќ|zkMWٱzz0q7M۳CA*/!#Sx ;~Ҕ&`ˍɍ./^M6xi\-ޞ0]RS\? \ò\ҘKA, II.\h8W||C\\CllCL -epG_>]޺&* /;%)11Q(4DG7DE5DF6DDԟ;+<'o38>($ Eӄ 60 ܰG@bcQ#z XuuAAuu|}qy{h^^,h}}{Ol__ s dKXX(4.$@ǧgRqyxԺR(7WZ3g[G;kh81`t;;oE'N  >#ɸjH3b|=ᆱۚӧkNU?0ΈdY[gy#SA,ɓ9qcǪS_W=Z}ȫ; ӈY5qF{zȔ;w?T TCx,'Nf9zs{^=kN}'o9K[P|?zD!X(AҘbf p8X_ߜc9p]*KM+(°"፲2ʊ{7k/׬񓑁%kk:}\vG55ؼyP N@gٳg/q >O,(/&x HK3W8|Ry33EFzv A#]PI$[G$\J"93V0kL4yyidNTU"G *DbNӾ<$OaW77OePUL ))@`bW(UvQU?SGpEC}vT(T%[_Evu+xkB4* `SfPE(M"YX>=m]n8S}45΢oRꑕ`^Ef ~:(,%Eә`AńDgp!FF?J7 *RȧGog +n?YN]"rF(M1h4?AP#˹*Λ~WS3/ˮ]k,.nl| }[_ɉ,)/\F$^V…WBip($KKϚַۖ--ooCCo}}ommoMM/b1SRh&UPMMy[ƠGDX8EOnnϳg= Fϓ'=<|ؓs~Ͻ{=w}&š5bblmNj!!vOٹc6!)>~+9ҥ:}|$Rkg``WttWTTWH#]]*ƛs47Tp0wXK<_z1&(YFJ;N2{PYJDLvǺu\Ge &];a`CB🌡͑:yտ-Vs Z~bbnj&!цj‹ =DEIEGy֠AsferPS6%˷,ZԮN ݷ &~}`D,2@CG8 YۆIEN&~Պ ._i<LZ ._ͨ^MB⼕s Ih6 )gQ,W:xfYW9Pwt{gv54pvͰ=UiDzW**D}9*CPPx8Y<ػ7`t7QD4hC4˯g{`D[?e !FƠE.w`׌"o`$Zz@@9D=h< i^lmKE r8vɏ?i31=|ėhh@ +[hv3Q^Be힊S/ a / a7DDއ=6i;yri96zQVczaq,-yif({D9e$t|TRB E QBD 3'fc B:=Ғnb4{EVULGS3މ03) endstream endobj 7 0 obj 5808 endobj 8 0 obj << /Length 9 0 R /BBox [0 0 80 80] /XStep 80 /YStep 80 /PatternType 1 /TilingType 1 /PaintType 1 /Matrix [ 0.375 -0.375 0.375 0.375 120 270 ] /Resources << /XObject << /res6 6 0 R >> >> >> stream q 80 0 0 80 0 0 cm /res6 Do Q endstream endobj 9 0 obj 31 endobj 10 0 obj << /Length 11 0 R /Filter /FlateDecode /Type /XObject /Subtype /Form /BBox [ 0 0 300 300 ] >> stream x+TH,)I-SH.V/J-P(NSO4PH/V245P060P ^0~4^@^.bD endstream endobj 11 0 obj 70 endobj 12 0 obj << /Type /Page /Parent 1 0 R /MediaBox [ 0 0 300 300 ] /Contents [ 2 0 R 10 0 R ] /Group << /Type /Group /S /Transparency /CS /DeviceRGB >> >> endobj 1 0 obj << /Type /Pages /Kids [ 12 0 R ] /Count 1 /Resources << /ExtGState << /a0 << /CA 1 /ca 1 >> >> /Pattern << /res8 8 0 R >> >> >> endobj 13 0 obj << /Creator (cairo 1.4.14 (http://cairographics.org)) /Producer (cairo 1.4.14 (http://cairographics.org)) >> endobj 14 0 obj << /Type /Catalog /Pages 1 0 R >> endobj xref 0 15 0000000000 65535 f 0000008582 00000 n 0000000017 00000 n 0000000174 00000 n 0000000198 00000 n 0000001741 00000 n 0000001767 00000 n 0000007794 00000 n 0000007820 00000 n 0000008110 00000 n 0000008134 00000 n 0000008353 00000 n 0000008378 00000 n 0000008776 00000 n 0000008909 00000 n trailer << /Size 15 /Root 14 0 R /Info 13 0 R >> startxref 8967 %%EOF ruby-gnome2-all-2.2.5/poppler/test/fixtures/image.png0000644000175000017500000010000212257552170020712 0ustar koukouPNG  IHDR,,y}ubKGD IDATxyXW^Fh$j!#fM܌qǏNf&ܛNkϝ1&hp#q DvYn^6"|:]UթSP( BP( BP( BP( BP( BP( BP( B \!ÕG펙ʶC=ͧBo^@y`CHpzciuIo~h,:qb<1OPT_/2KO e$e!!İi[EFJ> m@Zɑ%Kn-dh /^~ͯE}JB&#+WB.]cOUAAHBv\2TY-6ع j6f %90d |]8BvhrϬY u$ BGaVI$e1d@vLK| NǮ+R bl>1c&y~1T-YB 6 >6s%iZmXO+r@ ŷh1_/>yf|-Z~rvg|3XS\8 g $(#d[wz䵢: 8>H3@R"%?+:3. ̮)M\ <<ۃ\eHBQe1wk)#z6 ӱ;Ο-b(?ctc5:/m*G'M]±gy)#(io,)Znm6=-rb1y6++2|~T{D 辌5uT8ZTϥ2ٻ+*%ĭX0 CƔ2+Z^v'Ok7x àIǕQxxkKM)EDߖ\ >eo"[UBpÏ6H(0|nr>Oo@/(d拓_+d`e2gLF.O&C?n|ąIx㍫ڱc{-=AkXxS09!x\;i9}㳻q22btɁV,Y} 3e|g<lju{>,; amj7l KL\_^^5_eA %M8;0KDWP# Z Աh74D3}~tn6`< -@D8YY0;P}' X.^:G_ @hh:::g8NvOݺukک7Hn!$a!LsBF3FB&vX.ylyź8t<Ʈr F/$/0MNu9|%7oZikuNN &($O2 AnЀEšj^čvSO\Tryg#Sbٳ󂓒!J "Dg4ט651 h۾\Cdp F8VIJEAmC5PYc2R\Jߍ ,$Ȼફx&كYO(|h*RF84`Q0v3qcJ|$C!p(&S<6O( 2n9hdmv/5E}ha&ն44@]]HFeӹ"0>񄒴̫mom@|}L;v/suug}.>uRF,4`Q`Hy\]OUs;o:If7Ue5||<7))i,M X.0_ p"//{o|gta\/ zCקJϟ>uj),J^jVPҾ3֦pʴQQ7[.2Ws!̔+W"cfPccsOc򞋏iR3,(no_?'4T,mS8g*AURWf?3]"?4TB)+Ɨ2r5Ώ7 67VWD?6lĉ]2& ioZ*rj魖9v+KpP?l@mAEņB!HPQѼʓY1ݹ2*^};xF}QHGB98E/zy_ Nx߅sE_oWmۋTO_sfNfee)FD%#q|B&UA3sz!|~H9@XP#k ܢ:wBzwrsv'$=iM z /BvL>j6,mmVV(axb\ɓ˫{~xFpxsL 'tI$%q+V ӦXRlzZ$>>j>^FZ^v'OZ7x àIǕQxxkkmIyx{Kf{. Iݒ2[-۪p!Ow>xG`ik{P$Jj" e`rs7l kߖSu=[wW t(|)Ca拓_tgq%zp}veae2}"+ŋ$s1=V^SED@N.Rrqe O /#qv'}Z /FQDIćDzL$,Rz#2y&;:a|FbY+'&YjNZ<ԢX)̙/CRA3apZeGZZ5_2FDL6(1߾|^Z(j2iP|) XÜt)EMnFø3;珘LhJ#O䁁_gl”).-gɞL?__V$р;3X >{6yySsow2N*路s|RRP?e1A0fwr1?<˕av}Ϟ?n#"%"**oGzk]\ޟy6, ,|"#sgȱ!'_r߄`-ʮ񠊈@K;a(BagU8TZs g5,0!V.]z8=.eyyM 8?n6hxGF.9p`܊%K/aۃ8nϧ1e~x8׮ao6%&.//G ŗ㜡7*ne}mjp_JߡkR**9xp$1A:::k 12Y&?hB:˫ccnh8gg?(mp!Hq+D .VVpff&&faK4` Sb^;J_>w?޶685/u X~ !pd\ܵ{֭[NSɭ3",t8[ @>p|~%inUhh_^k{蓯;huMysB9}kT;}/K0%5{v^pRҸKa aCfwuGvskϮhh1Lh hgJUz,ȗk4a4x:VڬaBfHqG\ nrj0< YO(|h*v/ǹ}/Ѐ5La< y )0PXMbU>ȄΧe& q+)۶]dpo0/_!;F's\_}/_Ѐ5 a&״46Bm\HFeӹ"0>񄒴̫}: F2B v>V+*._-]|T]u$M&mih#h8R k@9G{xoSs;o޺6A.r5UXe/3xRyNSSYn0@nf*1E1 j/3gRyp)Å7`=qw>kva;p'_Dktޗ?蓒a$,zCקc*eϟ>ujG ^aa9=**>H)fe5tx+~AqkiiUӹݦpUJe樨-wr+_[KқTD_J fʕ+13[vtбYuy4T^?[JG/\&,?-ajZ%H\Jt%;RiᦦAi}焆͞~11~fd| W"/͂ !%=h,:qb  m@Zɑ%Kݷ Q 0H;@X=^SC'))m !#w]ppb}g{{Pz[DSۚWaFkV==`(DmGYYHي aQp5#-lGpGƪ@M[QKkXu<\׃+( 8?zPc{hNԴGll:7ؾ%7-*E•pS15(h!ׄʀR dTpbN/X٘ JÐj&q7^|!4tY<[A[}Xbv>bIͻ-QQ$-""qDʽ; j_}룯O@o7r3UIY5@ SbqU5:Ӥd+Ɍ3njT~n߿s'Y`Y﹒4W+Ҝ?GluqڠgF&mc. wǴė<|+⛗q)סĬQ"~PcSe!Jl?.>۶-TTl.*ͫ<sٝ PcWިQ_LGB98E/zy_ Nx߅T-&*m{_Q7~<|cbzڿ:ʢSï !-{M$8 pg<BRr,Y G֨Ee't:Iw'';7`wB ѓ;!A}}l…^KvL))TQy{>6'<כ]zbĦވ``Y>>e;CgPA'_r߄`-ʮ񠊈@;]$'ۣd, g,ptewj)9ϕb ?Jxpqq/kIq~}[I 䯼^J0b-=eeO}}]ӜCw_{ӷ`ڸm0)fslre<Ǯ!42/*ޑKbɒKi/;9N$pga0kMaK˫oy]|9}q|[WߦЀ %M8 y6e &gxX"}>?:7J\dhxH0Rt5C"J̬,Z}_WbH^zu(~:685u}nȄΧG&Mq+)۶]dpwo]|0v־|$C7Xq}.#n4*4@4Ԕ-7!'%~f^mq? h0חdhZQq2W_Ww7.nS_LVp'G X`Hy\?y0&琷w޼um6\j*1ű,%^fbdt_݀hl@U>8aY _ev=_*N#zpp;'BΡW7TP0P{|{NtF0}G:E/H~8t}ZXQ6S̟>}K W PQPGH^x5+[C >XKK:n\Aj '+]Tn r+}|W*FH|5Lr%Q8f&{+5664:6 Y.+5zK[) τ{%LU+WI11dg?3]*?tyzPq/&fճL Js57ol No.~OmFc։d(>ߴUJ[-sWJ/VexhaɗfBCKΟIIxPo?PR (*8#OJ¼oƷ$77=>)J|Q.GmIʌ3BBa&s!q:+(4Rai'G,wޖ&8xFd@l6 icYG{{M i'%$P.88߾=(-wCx }Hhj[31h>Ғjg ?(=)[Qsq1,*y5s9:ҎUɁ:!WP6:??p,++;~ҡƦwx15-E-3{џ3 oIq}`Qp%o{=dL xd5aereȿZ*m8s lH%@Jraz |]8BvhrϬY]tybw-1;m1wɖ(H}G>ΠK7_>$ vSnfDRV @6$c@t:vX\Uδ}2cL1c7U['?IX{$MJ4#AdrV,=C}G&mc. wǴė<|+⛗qʇ#%Q"~PcSe!Jl?.>۶-TTl.*ͫ<sٝPcWިQ_LGB98E/zy_ Nx;r|3*\U_m/+*R=}ƏoLLOYӱYYY筠 _'5"/BܷΛ'HTq ux}V$? )bYBA {Q3pNt&NNV5wn5'1Էݝ۾]iB vLC}}K``}.x؉a{sڴ-4~-2b5y6++0<^T{D =uOFxX_R8JxVJT&{wyEs$Y+VC}K[MObLJX\A-K}eDtC/}დ'Z-<aФ(<~<4Ң8P_RA(^JoD$d+7+s1Nq+]}JQS0 θ빓egpWY/qFƍ1/Lr.=BTeO S;&`Y"!gφ>/ot;M]݀O}oO ǹk//\g7߰Op 2dic~y<+/puv"=w>Jis#m}ٵ.fOlj Q X `X>ٹ3X{{wsO& q[]} A;Bw Q]$ʞ no, vU飈yq8ܩβk>W)p><*UK=,/i$GM!l%% @lz=V+!ԗ @гks:=]}yї[]V7PaM#$m&'0ϱ9}?㳻qwdƭXfK=x |:Yv zvfSXb*K}{QB6v8gh軯qoY_}w 1$5UTrI'Y6A:::. zp' PƢq~ѹQ"CC 꾓9 .VVpff&&fԗ _Wb@1bVիcGx| йs@hhp= 8i2.=u֭i_B :jP a>4*dk4c//7/'_waɭ3",rv^ w1RCȄΧ)&=q+)۶]dpw/ +d'bop FDb&״46B:]HFeӹ "0>񄒴̫}: F2B v>V+*._-]|T]uB}2YmKCÝζ ɈX`Hy\?sٯOs;o޺6A.r5UXe/3xRyNSSYn@}=M2 0,K̜ݮKw1pp,8///{o|B |uLw ^e8ɗ8ð(F̓IXAOOT+&t?}T՞ݧӓt߁bW:?Ԡ8."#WÉJW)n Zڗ}2m$j!rJpLVjlli>tlz]s1 WjR  >K9V Wcb&]~fT ' x=}bb&^=tD>ja͏7 'ʕ u0y>y}*V)WK{[')L!nw geJb;z8ꈩ|:{*Rߑk=rOu>}_Л!/>ItFH1lD:~.$?[G"#_w}\_Z6l Ȓ%[rO(lv+x@Ʋ-.X!V_O>IIoKHw N=~=_=(-wCx }Ax5^>3(-)!v{zPcڎݳ0âRjOGZZs=,\ΠK 7xϾ> wJ") 1u :Z,Fgbl>1c&BcoRi?d O~ڹ \IVriG/VlH@IkwnF<0|wLK|÷|/&I^FoXO+vI8kԨHck뤟TY6D[in"!3|=6Ŷm  J"kC=~!}9w4Ң8P_Nܨ/]=]yވH%&Z/;W LK EMW>b2Է+]}JQS0 p\gN)OiwٙJU"~Kholqc SK%{2|}YFݶ/W,X Hٳ˛2NSW7`oS_K};k//\g7߰Oyn?sv+`NN6>S{27DcW&= #"%"**oGzk]\ޟy6, ǧeYDF"gΐctϿGn{%7Mho O߄Ȑ|++ǃ*";wۯ.MeeOGX ;2tJ;YvJ矇XJfs IDATW^Mj%`\P_{Ono, NOouCG[]VדojXIb6 .ic2/*ޑKbɒKi/;9N$p)ga0kMaK˫G}=qr34]8FECͷۃ޶oXMMM^[v9`J\7D<8f3HGGgeXigx|X"}>?:7J\dhxH0RwtH$XYÙ5E ՍR_w_Wb7 >fSg9`^:v^|zS q]#{㺿p'M]nݺ50?Ց:CH>!BC\ 3 Ww\bVlfŹ_~7ߎ>Vw7Hn!$aQO<^%]ss>J uq;]k*w0` BCj lx`=-_+-}͵RPX[duz$OԶԗKi/Xgߐx g6oRw/<0>j C}=+ն44[V,['Ύ$>װ )oљ(tOYpsΛfBMU>8eYL:T씴CP_9HRv3_M 4ɸoZwf$ْ,Yren886.B~RgQ !޻ElH0=y\.vd![l9?, py=3gǚyg3EH ml^~`0LP*njTF*Xǥ  cཽŠ+K}5B+v3@bbYb'ݻZg-cƄuEL0[4_%ZE>r~Lo_[֬!ȼy/ 뢢>a|W}hi]=DrPr"aN"*\:hsrBe}vXo心Fӊش44=‚ho8]S0âT"# l:nv<)DmkhLԷ| IͶNsASee0T2|H Q754NovۗpO :۷==?޼yVx~Pt-n6?rڔf =b@FU oGŋ(|V짟m^ѢXWd0qjAƷVJqwD풩_t)?ެ\B}owM|/]r^/{"jAVJk:vuZ;䛟\ā^WIX*f| ga :dD\׺(2scܸh4rZh$E 04i2RnР^P/̛G\ݾ  jOԗ߹s>z .K}|8=[GuB,"p8YWk]|+<4y>:cwcT}cȫ@Hb+,Ԍ Dh@`~8 ߲mai隉"HP  XTÆ:wz}_Է}=R_|/{{topR+)IƌQN G~kdQoB܏㩳f?*=šo&JB/)H1@X\I矓*g0K}{=}T;ю1cT=K`ۨQ#WhӰa:m~ :oRI+7'&2? Էwe}/#VFɑhAa3Xʝ/ o8%07;`/+v]|KMVo(}>`m?[y ,uWb͜d"Q%qRU:'ݸp+ԪVk߉P5Z>>sݓ _L/Y8f6/Wk_%o5[m}~? ovWHdΚ]阞}Ptn̨Q^h;0/8a`͋{xccU)Yd<빝? Xy0"_Yq@`JKYca۳>/.b2=%Ij۫d}dfVQ@K}n== {DccU)EXg22Wr#N[%E ͍!^"atgg@pϴߕŃA[K/%Ν꘏?ho?=gʘhB8Ϝ !Cd(,$WRSX f:Q_{/߸؄!C:k7_hQ,($Ww'k7D5F"}.!<˺32mr¹y//&ƌW_} 9}YWQ_]pZ\ Zq x~xos0>`Y\ZXϏLqnu +)I*BUUmfBPR<.IK}o?$߳7aD+q"iQWv}&` J]Uͻ!BKՀ e<;Y-l6j؄ CCwA}Y<҈ ǰa"<úy)\ZXNt:n:ՁZJeo/}|;>ѭ \,%eͺ< 0n*v5 ;eDC7oub+mwy72"QZOv&}"`8/!U(~>YyCn5#-}\<<e5<}}v|kr)0Bk3Ԗ-D>>ӾEX @eJ2@jԪSe hcBoOWEZ䬪!Bj0"4Y(-)55ߟ{tM:OVJ`}L~j5&og'8RlW#`#6x~dΚdɼ"uyY8eo3k8,#g&wO@}o_!E ZQ_M\vC{=??aP*n&v{P*3ŷ3TCx,ww9?cޓ<.wur΢ϴH""kB֭'JҢam0nro.+P_Ɇq㔞9TL^+?_Ϳkihh.룢Jbb u+Qçl@lif|qOZ:}`pOQ'-%k"#'vu!LڼyQ)C^Ozh\}O2_ .߿ _#}!^.m%r ?$7(f$KQ⨩!ri比ʩ]U6mqOR9t)?O1Au*tBzyPmR^wݘ7}۷+})ĚuBKvnv^L,KLĺ{7WVVKLZe̘(מ^FtדUHrTG/pKњ51;7_9`"4t흾뢢>q\ I!!'$Տ !V >'ll,Y֧k]Fӊش44=‚ho8]S0âT"# l:nv<)DmkhLȷ4lt;'d.,=)[Vs^,J%*tl/.iFcXxAl6^] CVWJ_t n~[=:5.wh__s6Ϗ=+dpWw>g!+ (.WpZ@`2_s6鸯>7'm_JT& vi3@tI*neuQQeI dǸqohbq H@`3id"wݠAV_7T#};YlYo;S|z^KrqX{/X~#Dp^ȯtۻVxhey}7/uUYG76 @1?|1 $BBff{\sΞ-[(JСN>ls;חm>$kX{ۻ;|)IF2rdЮ$3f3FERS%(}ځ?1vwCYϼJOjI/K:@R <%rdJi={rlo]R]'mF\տMÆ16_|(H @.$Y.ܜ8(<+n[W}{>3hoh4 Ffn.>c}N]  @)SBaq ~ر3]\vwߎ޹oI ꍾ?u oX#VLVV$d8._ 8"SdwvZj;\FRV{{R3AK: %KƓ/Wk_%o5[m}~? ovWHdΚ]阞+Ѐlm~f(/Ut4\x{00TWŋ=~,2eşeݼe_8 0ҥ,ܰg}`1$@h^2>EHws23( }d_/}|/\@UUaa8w?_yp`ʍ;}o-47xD^ӝ} 9<Bi3?g}|РE-Ks:+ϭc|wϙ2&N9p 3gk2* ɕÂ٧io{Էq CtרoNߑ2tѢGYPHz߾mqx6D5F"}.!<˺32mr¹y//&ƌW_}Ѐq yW r0L pֺ̌G=Gy+;wKIII> !"Py$FM(*& IDATL]gzPs33/S߇^Yx5pwNFuh?vXU;=koaEG Տd޿6o^pk߻(D_Ufkf+/+Z%sOTOordKWw͛XXA[_Ce0V^"8|:4`ࠔUռ;ގL` /Z 8`г#biӮM0nyt4_=ǰa"<;Rxe\ZXNt:n:ՁZJe~'n A\Y߸M&ps,#HthͶnTlœ軼}('}hjp-(1C]P}Nj4&9NaG$ji}2[xay5e˖kϡ٪'͗mǷF{J b #t861a|OmrM=ס>0I*z(\WKQN1XqDa>]Ai?/ Q||`dԜ 5="ժTS,s;/ 8^O!?>} )6/P 0Q<fpcdp~RgZed^zpn~~˲A5TS['x|y7 *j}G}6Ap m8aB5B,s[߾ X@x\NཽE+tVq'͗q}uhE;H""kB֭EJҢam0nroȻ)}ַCV;OOmDx44h4%RwD2b{mB}]g})O[G <@ ƍO?jyO?GG$�iE Ix=9::^iq]a=K<R6 '@riLbY؎%b,/'NfJUem&$%3KS#Z_' ~KׯK)If⋻nLپܕC&22tPh9]iěWeS|'ll,Y֧k]Fӊش44=‚ho8]S0âT"# l:nw<)DmkhLվf[H9q sa)Hٲ2`Q*Q}pfg} u/54`=iFcXxAl6^] CVWJ_t n~[=:5yh__s6Ϗ-B}zsmߪ*J]| +5gssqr۶.P:舥2i{<>H:@VIu+,Hn8 ;ƍ{F.o%Mz>@RӞI&- ¼y`길6XΝ)t/ !8=[GuB,"p8YWk]|+<4y>,SG^PVD[af!B3_=.9g-o KKLXDnjPre6ԹsK6_o5vT'^#z7%Kt:'5AȑATϘkIM햋AG8cGAqWΚ%˫ k.~)]H9@Dz\Nr?Pv>zٳ]kwJ2rdPwR(O FE kqclT\H\^91qPOQ6jȕx7꫾O"t> h99"9\|k{_em;R~&cg̣;w-7a[їrwhcl?[y ,uWb͜d"Q%qRU:'ݸp+ԪVk߉P5Z>>sݓ _L/Y8G+6 _uW[|l,a_"U*-n:kwMczʗrhClm~f(/Ut4\x{00TWŋ=~,2eşeݼe_8 0ҥ,g}`1$@h^2>EHws23(`z{rOhl: l^FƹʃSnd{h4K$@ 8 X}9<BNnIv9Y4ju4=Rܹs1sf&S̙2LBr%5`3{ޣƅG& a_9}GΟE*fA!})t6D5F"}.!<˺33mr๧y//&ƌW_} !"Py$FM(*L]gzPs33/w_u"+.89cݾs2:ϗp~XL,.]ӡӢ;[-g0r9ppBBqWr[b=?2ǹ͛-*,\$D$ WUٚYK BIӧ$uqrdKWw͛XXA[_Ce0V^"8|) XA)y7w9@_z pgKł-Ӧ] 0a^k.4_A|R8 ݕ3 2:ru+ FQ_|}=8*T*{Xx|) !be}:+t,dm7n8wWW9_N$:4|f[7*neD<<4`RvB '9F;rјH,8?hly-[ ||>gjv|kr)0Bk3Ԗ-D>>Ӿ^dAҹuq 5jک?k4!̷ӧ+HCC"vrVUt{c㐀e!j5Vښs=}GDU.Xv|_76>pZ ?C 髫|{=Kyxh8Rlw@1FFmligHѽ|wWl^ϏcF-^#25Lo<4`RK?`=qw9?c*#܉})m)H""kB֭cJҢam0nroȻCNg}) X;hݼݭZB+u'O.S(n v{+[rR([G <@ ƍO?jyO?GG$�iE Ix=9::^iqŠr?e\3 >r_HKۜF "3eRb;z8jj|;m+rjWMClܓD|?O1Uژ7KׯK)If{ܕ  ]'mmNbWf]e)>Xw&JbjɞSsu^FtדUȺ]_*}uxhҘM̛ǯ0`a{]:7Rzt^NPr"aN"*]hsrBe}vXok4ZQ1MKC3(,,$ 6C:]Ή KwO!DʖR쫇44fznG=)1Cn_q]KЀH3+*dzy[K)`J"}v8/ 7:<pߋUU!Sg's 6a!+ (.`UU~݄ri1ow=p~לMm]KP舥2i۱{<.H:@VIu+,Hn8 ;ƍ{F.o%-|>@RӞI&- ܹ`길6_ޗKwX}z}sYUp^'! CE @~带+ŷC/32?8*-0P$ 5#=[-,-]3Q$b XC˕J|PwX/+8}wIwR(GF#H92hWR3w"rJ#~c7!꥓g{Uz 5Lz}Ca cYr].'NT;qm}SF ._ mԨ+pӰa:tn~:RI˫6'&2StQA4vNFr@l37>'߮;*v6N %&Lxctq)}(bO Zg|K,V)y"LVV$d8._ 8" YnPv<[}'@ hQ(R2Ⅵ՞Κ]L/Y8Gg<ЀEi CFREG3ށ`}}倷7 Cu5n^'N)>qs;va|E4ög}VIBsiH$@hq5^2>EHws23( 剁,}Y0d ;&g}|`ⷭ[FΟE*ϭc|wϙ2&N9p 3gk2nSX f:QOh lkD\Bx88ug\f&1uM _D%Mf/}ٲO&,U wRsrxo~Hc*`|&O( ^J%Ç1 x*+\CV{[ ^ X!:%yefZ͸3pfdZ-3+;{D veXZE;g`FpN /2&k7_ןZk_O_9C]o,lš ,X??òz ۷kjѵ JoLMM>, D-wMtYhHpSi1)\)H|uʱ?mC|de68Lt4;a1$!p֢i^ {=تaZ iâm6GVwU\=o~ Y2oL|?йoV yNAD!tE%e]/Rh`ZWy/:+na5yLtFHKryU\t/+3bCt#E6h%\)+CڡC 9}&h""ѯzaG``e2Q[b\u\ Xm9 Wv|ZCDHf.,>p0Y(-)u55o5="JЀEiϐ"0ܾ"& *jg8U'+u֬U&N& nhc1 JnJe}fjaK}S(A<?`=yqw9?|J99U\mBq^+xn TЗ kq㔻Lws1)O(4`QZ1?=W~3iFq3룢 ݕ˅bb] B>e@x8bH@6dO?j߆ M?DzoْX&2rbOB= 1.14.0"], "gdk_pixbuf2"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "gobject-introspection", "gdk_pixbuf2", ] package.windows.gobject_introspection_dependencies = [ "gdk_pixbuf2", ] package.external_packages = [ { :name => "libjpeg", :base_name => "jpeg-9a", :archive_base_name => "jpegsrc.v9a.tar.gz", :download_base_url => "http://www.ijg.org/files", :label => "libjpeg", :windows => { :configure_args => [], :built_file => "bin/libjpeg-9.dll", }, }, { :name => "sqlite-autoconf", :download_base_url => "http://www.sqlite.org/2014", :label => "SQLite", :version => "3080600", :compression_method => "gz", :windows => { :configure_args => [], :built_file => "bin/libsqlite3-0.dll", }, }, { :name => "poppler", :download_base_url => "http://poppler.freedesktop.org", :label => "Poppler", :version => "0.29.0", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :built_file => "bin/libpoppler-glib-8.dll", }, }, ] end package_task.define ruby-gnome2-all-2.2.5/poppler/ext/0000755000175000017500000000000011701304107015065 5ustar koukouruby-gnome2-all-2.2.5/poppler/ext/poppler/0000755000175000017500000000000012446160551016560 5ustar koukouruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-form-field.c0000664000175000017500000000617611740310343022757 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cFormField #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj) static VALUE cButtonField, cTextField, cChoiceField; static VALUE cUnknownField, cSignatureField; VALUE rb_poppler_ruby_object_from_form_field(PopplerFormField *field) { VALUE obj; obj = rbgobj_ruby_object_from_instance2(field, FALSE); if (NIL_P(obj)) { switch (poppler_form_field_get_field_type(field)) { case POPPLER_FORM_FIELD_UNKNOWN: obj = rbgobj_create_object(cUnknownField); break; case POPPLER_FORM_FIELD_BUTTON: obj = rbgobj_create_object(cButtonField); break; case POPPLER_FORM_FIELD_TEXT: obj = rbgobj_create_object(cTextField); break; case POPPLER_FORM_FIELD_CHOICE: obj = rbgobj_create_object(cChoiceField); break; case POPPLER_FORM_FIELD_SIGNATURE: obj = rbgobj_create_object(cSignatureField); break; } g_object_ref(field); G_INITIALIZE(obj, (gpointer)field); } return obj; } static VALUE rg_id(VALUE self) { return INT2NUM(poppler_form_field_get_id(_SELF(self))); } static VALUE rg_font_size(VALUE self) { return rb_float_new(poppler_form_field_get_font_size(_SELF(self))); } static VALUE rg_read_only_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_is_read_only(_SELF(self))); } void Init_poppler_form_field(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD, "FormField", mPoppler); cUnknownField = rb_define_class_under(mPoppler, "UnknownField", RG_TARGET_NAMESPACE); cSignatureField = rb_define_class_under(mPoppler, "SignatureField", RG_TARGET_NAMESPACE); RG_DEF_METHOD(id, 0); RG_DEF_METHOD(font_size, 0); RG_DEF_METHOD_P(read_only, 0); Init_poppler_button_field(mPoppler, RG_TARGET_NAMESPACE); Init_poppler_text_field(mPoppler, RG_TARGET_NAMESPACE); Init_poppler_choice_field(mPoppler, RG_TARGET_NAMESPACE); cButtonField = rb_const_get(mPoppler, rb_intern("ButtonField")); cTextField = rb_const_get(mPoppler, rb_intern("TextField")); cChoiceField = rb_const_get(mPoppler, rb_intern("ChoiceField")); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler.h0000644000175000017500000000364012257552170020743 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 __RBPOPPLER_H__ #define __RBPOPPLER_H__ #include #include #include #include #ifndef POPPLER_MAJOR_VERSION # include "rbpopplerversion.h" #endif #include "rbpopplerconversions.h" #ifndef POPPLER_TYPE_INDEX_ITER # define POPPLER_TYPE_INDEX_ITER (poppler_index_iter_get_type ()) #endif #ifndef POPPLER_TYPE_FONTS_ITER # define POPPLER_TYPE_FONTS_ITER (poppler_fonts_iter_get_type ()) #endif #ifndef POPPLER_TYPE_DEST extern GType poppler_dest_get_type (void) G_GNUC_CONST; # define POPPLER_TYPE_DEST (poppler_dest_get_type ()) # define RB_POPPLER_TYPE_DEST_NOT_DEFINED #endif #include #ifdef POPPLER_TYPE_COLOR extern PopplerColor *rb_poppler_ruby_object_to_color(VALUE color); extern VALUE rb_poppler_ruby_object_from_color_with_free(PopplerColor *color); #endif extern VALUE rb_poppler_ruby_object_from_form_field(PopplerFormField *field); extern VALUE rb_poppler_ruby_object_from_action(PopplerAction *action); extern PopplerAction *rb_poppler_action_from_ruby_object(VALUE action); #endif ruby-gnome2-all-2.2.5/poppler/ext/poppler/extconf.rb0000644000175000017500000000363112446160551020556 0ustar koukou=begin extconf.rb for Ruby/Poppler extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "poppler" package_id = "poppler-glib" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ["glib2", "atk", "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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package([package_id, 0, 12, 0], :debian => "libpoppler-glib-dev", :redhat => "poppler-glib-devel", :homebrew => "poppler", :macports => "poppler") exit(false) end unless have_macro("POPPLER_MAJOR_VERSION", ["poppler.h"]) make_version_header("POPPLER", package_id, ".") end create_pkg_config_file("Ruby/Poppler", package_id) $defs << " -DRUBY_POPPLER_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 ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-font-info.c0000644000175000017500000000331612257552170022633 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cFontInfo static VALUE RG_TARGET_NAMESPACE; static ID id_valid; static VALUE rg_initialize(VALUE self, VALUE document) { G_INITIALIZE(self, poppler_font_info_new(RVAL2POPPLERDOCUMENT(document))); return Qnil; } static VALUE rg_scan(VALUE self, VALUE n_pages) { VALUE rb_iter = Qnil; PopplerFontsIter *iter; if (poppler_font_info_scan(RVAL2FONTINFO(self), NUM2INT(n_pages), &iter)) { rb_iter = POPPLERFONTSITER2RVAL(iter); rb_ivar_set(rb_iter, id_valid, Qtrue); poppler_fonts_iter_free(iter); } return rb_iter; } void Init_poppler_font_info(VALUE mPoppler) { id_valid = rb_intern("valid?"); RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONT_INFO, "FontInfo", mPoppler); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(scan, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/depend0000644000175000017500000000024712064346475017754 0ustar koukouinstall: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-poppler.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-text-field.c0000644000175000017500000000463212257552170023003 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cTextField #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_type(VALUE self) { return POPPLERFORMTEXTTYPE2RVAL(poppler_form_field_text_get_text_type(_SELF(self))); } static VALUE rg_text(VALUE self) { return CSTR2RVAL(poppler_form_field_text_get_text(_SELF(self))); } static VALUE rg_set_text(VALUE self, VALUE text) { poppler_form_field_text_set_text(_SELF(self), RVAL2CSTR_ACCEPT_NIL(text)); return Qnil; } static VALUE rg_max_length(VALUE self) { return INT2NUM(poppler_form_field_text_get_max_len(_SELF(self))); } static VALUE rg_spell_check_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_text_do_spell_check(_SELF(self))); } static VALUE rg_scroll_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_text_do_scroll(_SELF(self))); } static VALUE rg_rich_text_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_text_is_rich_text(_SELF(self))); } static VALUE rg_password_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_text_is_password(_SELF(self))); } void Init_poppler_text_field(VALUE mPoppler, VALUE cFormField) { RG_TARGET_NAMESPACE = rb_define_class_under(mPoppler, "TextField", cFormField); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_text, 1); RG_DEF_METHOD(max_length, 0); RG_DEF_METHOD_P(spell_check, 0); RG_DEF_METHOD_P(scroll, 0); RG_DEF_METHOD_P(rich_text, 0); RG_DEF_METHOD_P(password, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-form-field-mapping.c0000644000175000017500000000346212257552170024413 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cFormFieldMapping DEF_ACCESSOR_WITH_SETTER(form_field_mapping, area, RVAL2POPPLERFORMFIELDMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET) DEF_ACCESSOR(form_field_mapping, field, RVAL2POPPLERFORMFIELDMAPPING, POPPLERFORMFIELD2RVAL, RVAL2POPPLERFORMFIELD) void Init_poppler_form_field_mapping(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD_MAPPING, "FormFieldMapping", mPoppler); rbg_define_method(RG_TARGET_NAMESPACE, "area", form_field_mapping_get_area, 0); rbg_define_method(RG_TARGET_NAMESPACE, "field", form_field_mapping_get_field, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_area", form_field_mapping_set_area, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_field", form_field_mapping_set_field, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-annotation-free-text.c0000644000175000017500000000303512257552170025005 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2008-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAnnotationFreeText #define SELF(self) (RVAL2POPPLERANNOTFREETEXT(self)) static VALUE rg_quadding(VALUE self) { return POPPLERANNOTFREETEXTQUADDING2RVAL(poppler_annot_free_text_get_quadding(SELF(self))); } static VALUE rg_callout_line(VALUE self) { return POPPLERANNOTCALLOUTLINE2RVAL(poppler_annot_free_text_get_callout_line(SELF(self))); } void Init_poppler_annotation_free_text(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_ANNOT_FREE_TEXT, "AnnotationFreeText", mPoppler); RG_DEF_METHOD(quadding, 0); RG_DEF_METHOD(callout_line, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-document.c0000664000175000017500000001444411740310343022546 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cDocument static ID id_new, id_pdf_data_p, id_ensure_uri; static VALUE cIndexIter; static VALUE cFontInfo; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { PopplerDocument *document = NULL; GError *error = NULL; VALUE uri_or_data, rb_password; const char *password; rb_scan_args(argc, argv, "11", &uri_or_data, &rb_password); password = RVAL2CSTR_ACCEPT_NIL(rb_password); if (RVAL2CBOOL(rb_funcall(self, id_pdf_data_p, 1, uri_or_data))) { document = poppler_document_new_from_data(RSTRING_PTR(uri_or_data), RSTRING_LEN(uri_or_data), password, &error); } if (!document && !error) { uri_or_data = rb_funcall(self, id_ensure_uri, 1, uri_or_data); document = poppler_document_new_from_file(RVAL2CSTR(uri_or_data), password, &error); } if (error) RAISE_GERROR(error); G_INITIALIZE(self, document); return Qnil; } static VALUE rg_save(VALUE self, VALUE uri) { gboolean result; GError *error = NULL; uri = rb_funcall(self, id_ensure_uri, 1, uri); result = poppler_document_save(RVAL2POPPLERDOCUMENT(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } static VALUE rg_save_a_copy(VALUE self, VALUE uri) { gboolean result; GError *error = NULL; uri = rb_funcall(self, id_ensure_uri, 1, uri); result = poppler_document_save_a_copy(RVAL2POPPLERDOCUMENT(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } static VALUE rg_n_pages(VALUE self) { return INT2NUM(poppler_document_get_n_pages(RVAL2POPPLERDOCUMENT(self))); } static VALUE rg_get_page(VALUE self, VALUE index_or_label) { VALUE rb_page; PopplerPage *page; if (RVAL2CBOOL(rb_obj_is_kind_of(index_or_label, rb_cInteger))) { page = poppler_document_get_page(RVAL2POPPLERDOCUMENT(self), NUM2INT(index_or_label)); } else if (RVAL2CBOOL(rb_obj_is_kind_of(index_or_label, rb_cString))) { page = poppler_document_get_page_by_label(RVAL2POPPLERDOCUMENT(self), RVAL2CSTR(index_or_label)); } else { VALUE inspect; inspect = rb_inspect(index_or_label); rb_raise(rb_eArgError, "%s must be Integer or String", RVAL2CSTR(inspect)); } rb_page = GOBJ2RVAL(page); if (page) g_object_unref(page); return rb_page; } static VALUE rg_has_attachments_p(VALUE self) { return CBOOL2RVAL(poppler_document_has_attachments(RVAL2POPPLERDOCUMENT(self))); } static VALUE rg_attachments(VALUE self) { return GLIST2ARYF(poppler_document_get_attachments(RVAL2POPPLERDOCUMENT(self))); } static VALUE rg_find_dest(VALUE self, VALUE link_name) { PopplerDest *dest; dest = poppler_document_find_dest(RVAL2POPPLERDOCUMENT(self), RVAL2CSTR(link_name)); return POPPLERDEST2RVAL(dest); } static VALUE rg_get_form_field(VALUE self, VALUE id) { return GOBJ2RVAL(poppler_document_get_form_field(RVAL2POPPLERDOCUMENT(self), NUM2INT(id))); } static VALUE rg_each(VALUE self) { PopplerDocument *document; int i, n_pages; document = RVAL2POPPLERDOCUMENT(self); n_pages = poppler_document_get_n_pages(document); for (i = 0; i < n_pages; i++) { PopplerPage *page; VALUE rb_page; page = poppler_document_get_page(document, i); rb_page = GOBJ2RVAL(page); if (page) g_object_unref(page); rb_yield(rb_page); } return self; } static VALUE rg_index_iter(VALUE self) { return rb_funcall(cIndexIter, id_new, 1, self); } static VALUE rg_font_info(VALUE self) { return rb_funcall(cFontInfo, id_new, 1, self); } void Init_poppler_document(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE; cIndexIter = rb_const_get(mPoppler, rb_intern("IndexIter")); cFontInfo = rb_const_get(mPoppler, rb_intern("FontInfo")); id_new = rb_intern("new"); id_pdf_data_p = rb_intern("pdf_data?"); id_ensure_uri = rb_intern("ensure_uri"); RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_DOCUMENT, "Document", mPoppler); G_DEF_CLASS(POPPLER_TYPE_PAGE_LAYOUT, "PageLayout", mPoppler); G_DEF_CLASS(POPPLER_TYPE_PAGE_MODE, "PageMode", mPoppler); G_DEF_CLASS(POPPLER_TYPE_FONT_TYPE, "FontType", mPoppler); G_DEF_CLASS(POPPLER_TYPE_VIEWER_PREFERENCES, "ViewerPreferences", mPoppler); G_DEF_CLASS(POPPLER_TYPE_PERMISSIONS, "Permissions", mPoppler); rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(save, 1); RG_DEF_METHOD(save_a_copy, 1); RG_DEF_METHOD(n_pages, 0); RG_DEF_ALIAS("size", "n_pages"); RG_DEF_METHOD(get_page, 1); RG_DEF_ALIAS("[]", "get_page"); RG_DEF_METHOD_P(has_attachments, 0); RG_DEF_ALIAS("have_attachments?", "has_attachments?"); RG_DEF_METHOD(attachments, 0); RG_DEF_METHOD(find_dest, 1); RG_DEF_ALIAS("get_destination", "find_dest"); RG_DEF_METHOD(get_form_field, 1); RG_DEF_METHOD(each, 0); RG_DEF_ALIAS("pages", "to_a"); RG_DEF_METHOD(index_iter, 0); RG_DEF_METHOD(font_info, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-image-mapping.c0000644000175000017500000000361412257552170023450 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cImageMapping DEF_ACCESSOR_WITH_SETTER(image_mapping, area, RVAL2POPPLERIMAGEMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET) DEF_ACCESSOR(image_mapping, image_id, RVAL2POPPLERIMAGEMAPPING, INT2NUM, NUM2INT) static VALUE rg_image(VALUE self) { return rb_funcall(rb_iv_get(self, "@page"), rb_intern("get_image"), 1, INT2NUM(RVAL2POPPLERIMAGEMAPPING(self)->image_id)); } void Init_poppler_image_mapping(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_IMAGE_MAPPING, "ImageMapping", mPoppler); rbg_define_method(RG_TARGET_NAMESPACE, "area", image_mapping_get_area, 0); rbg_define_method(RG_TARGET_NAMESPACE, "image_id", image_mapping_get_image_id, 0); RG_DEF_METHOD(image, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_area", image_mapping_set_area, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_image_id", image_mapping_set_image_id, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-color.c0000644000175000017500000000622612124610262022043 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 2006-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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE rb_cPopplerColor #ifdef POPPLER_TYPE_COLOR VALUE RG_TARGET_NAMESPACE; PopplerColor * rb_poppler_ruby_object_to_color(VALUE color) { return RVAL2BOXED(color, POPPLER_TYPE_COLOR); } VALUE rb_poppler_ruby_object_from_color_with_free(PopplerColor *color) { VALUE rb_color; rb_color = POPPLERCOLOR2RVAL(color); g_free(color); return rb_color; } static VALUE rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue) { PopplerColor color; color.red = NUM2UINT(red); color.green = NUM2UINT(green); color.blue = NUM2UINT(blue); G_INITIALIZE(self, g_boxed_copy(POPPLER_TYPE_COLOR, &color)); return Qnil; } DEF_ACCESSOR(color, red, RVAL2POPPLERCOLOR, UINT2NUM, NUM2UINT) DEF_ACCESSOR(color, green, RVAL2POPPLERCOLOR, UINT2NUM, NUM2UINT) DEF_ACCESSOR(color, blue, RVAL2POPPLERCOLOR, UINT2NUM, NUM2UINT) static VALUE rg_to_a(VALUE self) { PopplerColor *color; color = RVAL2POPPLERCOLOR(self); return rb_ary_new3(3, UINT2NUM(color->red), UINT2NUM(color->green), UINT2NUM(color->blue)); } static VALUE rg_inspect(VALUE self) { VALUE inspected; gchar *rgb; PopplerColor *color; color = RVAL2POPPLERCOLOR(self); inspected = rb_call_super(0, NULL); rb_str_resize(inspected, RSTRING_LEN(inspected) - 1); rgb = g_strdup_printf(": [%u, %u, %u]>", color->red, color->green, color->blue); rb_str_cat2(inspected, rgb); g_free(rgb); return inspected; } #endif void Init_poppler_color(VALUE mPoppler) { #ifdef POPPLER_TYPE_COLOR RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_COLOR, "Color", mPoppler); RG_DEF_METHOD(initialize, 3); rbg_define_method(RG_TARGET_NAMESPACE, "red", color_get_red, 0); rbg_define_method(RG_TARGET_NAMESPACE, "green", color_get_green, 0); rbg_define_method(RG_TARGET_NAMESPACE, "blue", color_get_blue, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_red", color_set_red, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_green", color_set_green, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_blue", color_set_blue, 1); RG_DEF_METHOD(to_a, 0); RG_DEF_METHOD(inspect, 0); #endif } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-choice-field.c0000644000175000017500000000674412257552170023257 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cChoiceField #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_type(VALUE self) { return POPPLERFORMCHOICETYPE2RVAL(poppler_form_field_choice_get_choice_type(_SELF(self))); } static VALUE rg_editable_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_choice_is_editable(_SELF(self))); } static VALUE rg_select_multiple_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_choice_can_select_multiple(_SELF(self))); } static VALUE rg_spell_check_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_choice_do_spell_check(_SELF(self))); } static VALUE rg_commit_on_change_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_choice_commit_on_change(_SELF(self))); } static VALUE rg_n_items(VALUE self) { return INT2NUM(poppler_form_field_choice_get_n_items(_SELF(self))); } static VALUE rg_operator_choice_field_get_item(VALUE self, VALUE index) { return CSTR2RVAL(poppler_form_field_choice_get_item(_SELF(self), NUM2INT(index))); } static VALUE rg_selected_p(VALUE self, VALUE index) { return CBOOL2RVAL(poppler_form_field_choice_is_item_selected(_SELF(self), NUM2INT(index))); } static VALUE rg_select(VALUE self, VALUE index) { poppler_form_field_choice_select_item(_SELF(self), NUM2INT(index)); return Qnil; } static VALUE rg_unselect_all(VALUE self) { poppler_form_field_choice_unselect_all(_SELF(self)); return Qnil; } static VALUE rg_toggle(VALUE self, VALUE index) { poppler_form_field_choice_toggle_item(_SELF(self), NUM2INT(index)); return Qnil; } static VALUE rg_set_text(VALUE self, VALUE text) { poppler_form_field_choice_set_text(_SELF(self), RVAL2CSTR_ACCEPT_NIL(text)); return Qnil; } static VALUE rg_text(VALUE self) { return CSTR2RVAL(poppler_form_field_choice_get_text(_SELF(self))); } void Init_poppler_choice_field(VALUE mPoppler, VALUE cFormField) { RG_TARGET_NAMESPACE = rb_define_class_under(mPoppler, "ChoiceField", cFormField); RG_DEF_METHOD(type, 0); RG_DEF_METHOD_P(editable, 0); RG_DEF_METHOD_P(select_multiple, 0); RG_DEF_METHOD_P(spell_check, 0); RG_DEF_METHOD_P(commit_on_change, 0); RG_DEF_METHOD(n_items, 0); RG_DEF_METHOD_OPERATOR("[]", choice_field_get_item, 1); RG_DEF_METHOD_P(selected, 1); RG_DEF_METHOD(select, 1); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(toggle, 1); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_text, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-attachment.c0000664000175000017500000000625211740310343023056 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAttachment #define SELF(self) (RVAL2POPPLERATTACHMENT(self)) static ID id_call; static gboolean attachment_save_func(const gchar *buf, gsize count, gpointer data, G_GNUC_UNUSED GError **error) { VALUE result; VALUE callback = (VALUE)data; result = rb_funcall(callback, id_call, 1, rb_str_new(buf, count)); return RVAL2CBOOL(result); } static VALUE rg_save(int argc, VALUE *argv, VALUE self) { VALUE filename; gboolean result; GError *error = NULL; rb_scan_args(argc, argv, "01", &filename); if (NIL_P(filename)) { if (rb_block_given_p()) { gpointer user_data = (gpointer)rb_block_proc(); result = poppler_attachment_save_to_callback(SELF(self), attachment_save_func, user_data, &error); } else { rb_raise(rb_eArgError, "must provide filename or block"); } } else { result = poppler_attachment_save(SELF(self), RVAL2CSTR(filename), &error); } if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } static VALUE rg_name(VALUE self) { return CSTR2RVAL(SELF(self)->name); } static VALUE rg_description(VALUE self) { return CSTR2RVAL(SELF(self)->description); } static VALUE rg_size(VALUE self) { return INT2NUM(SELF(self)->size); } static VALUE rg_mtime(VALUE self) { return rb_time_new(SELF(self)->mtime, 0); } static VALUE rg_ctime(VALUE self) { return rb_time_new(SELF(self)->ctime, 0); } static VALUE rg_checksum(VALUE self) { GString *checksum; checksum = SELF(self)->checksum; return rb_str_new(checksum->str, checksum->len); } void Init_poppler_attachment(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE; id_call = rb_intern("call"); RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_ATTACHMENT, "Attachment", mPoppler); RG_DEF_METHOD(save, -1); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(description, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(mtime, 0); RG_DEF_METHOD(ctime, 0); RG_DEF_METHOD(checksum, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-annotation-markup.c0000644000175000017500000000524212257552170024403 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2008-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAnnotationMarkup #define SELF(self) (RVAL2POPPLERANNOTMARKUP(self)) static ID id_new; static VALUE rb_cDate; static VALUE rg_label(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_markup_get_label(SELF(self))); } static VALUE rg_popup_is_open_p(VALUE self) { return CBOOL2RVAL(poppler_annot_markup_get_popup_is_open(SELF(self))); } static VALUE rg_opacity(VALUE self) { return rb_float_new(poppler_annot_markup_get_opacity(SELF(self))); } static VALUE rg_date(VALUE self) { GDate *date; VALUE rb_date; date = poppler_annot_markup_get_date(SELF(self)); rb_date = rb_funcall(rb_cDate, id_new, 3, UINT2NUM(g_date_get_year(date)), UINT2NUM(g_date_get_month(date)), UINT2NUM(g_date_get_day(date))); g_date_free(date); return rb_date; } static VALUE rg_subject(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_markup_get_subject(SELF(self))); } static VALUE rg_reply_to(VALUE self) { return POPPLERANNOTMARKUPREPLYTYPE2RVAL(poppler_annot_markup_get_reply_to(SELF(self))); } static VALUE rg_external_data(VALUE self) { return POPPLERANNOTEXTERNALDATATYPE2RVAL(poppler_annot_markup_get_external_data(SELF(self))); } void Init_poppler_annotation_markup(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE; id_new = rb_intern("new"); rb_cDate = rb_const_get(rb_cObject, rb_intern("Date")); RG_TARGET_NAMESPACE= G_DEF_CLASS(POPPLER_TYPE_ANNOT_MARKUP, "AnnotationMarkup", mPoppler); RG_DEF_METHOD(label, 0); RG_DEF_METHOD_P(popup_is_open, 0); RG_DEF_METHOD(opacity, 0); RG_DEF_METHOD(date, 0); RG_DEF_METHOD(subject, 0); RG_DEF_METHOD(reply_to, 0); RG_DEF_METHOD(external_data, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-annotation-mapping.c0000644000175000017500000000454112257552170024540 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAnnotationMapping static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE area, annotation; PopplerAnnotMapping *mapping; rb_scan_args(argc, argv, "02", &area, &annotation); mapping = poppler_annot_mapping_new(); mapping->area = *RVAL2POPPLERRECTANGLE(area); mapping->annot = RVAL2POPPLERANNOT(annotation); G_INITIALIZE(self, mapping); return Qnil; } DEF_ACCESSOR_WITH_SETTER(annot_mapping, area, RVAL2POPPLERANNOTMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET) DEF_READER(annot_mapping, annotation, annot, RVAL2POPPLERANNOTMAPPING, POPPLERANNOT2RVAL) static VALUE rg_set_annotation(VALUE self, VALUE annotation) { PopplerAnnotMapping *mapping; mapping = RVAL2POPPLERANNOTMAPPING(self); if (mapping->annot) g_object_unref(mapping->annot); mapping->annot = RVAL2POPPLERANNOT(annotation); return Qnil; } void Init_poppler_annotation_mapping(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_ANNOT_MAPPING, "AnnotationMapping", mPoppler); RG_DEF_METHOD(initialize, -1); rbg_define_method(RG_TARGET_NAMESPACE, "area", annot_mapping_get_area, 0); rbg_define_method(RG_TARGET_NAMESPACE, "annotation", annot_mapping_get_annotation, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_area", annot_mapping_set_area, 1); RG_DEF_METHOD(set_annotation, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-link-mapping.c0000644000175000017500000000342712257552170023325 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cLinkMapping void rectangle_set(PopplerRectangle *rect, VALUE rb_rect) { *rect = *(RVAL2POPPLERRECTANGLE(rb_rect)); } DEF_ACCESSOR_WITH_SETTER(link_mapping, area, RVAL2POPPLERLINKMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET) DEF_ACCESSOR(link_mapping, action, RVAL2POPPLERLINKMAPPING, POPPLERACTION2RVAL, RVAL2POPPLERACTION) void Init_poppler_link_mapping(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_LINK_MAPPING, "LinkMapping", mPoppler); rbg_define_method(RG_TARGET_NAMESPACE, "area", link_mapping_get_area, 0); rbg_define_method(RG_TARGET_NAMESPACE, "action", link_mapping_get_action, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_area", link_mapping_set_area, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_action", link_mapping_set_action, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-fonts-iter.c0000644000175000017500000000620512257552170023026 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cFontsIter #define CHECK_FITER_IS_VALID(iter) do { \ if (!RVAL2CBOOL(rg_valid_p(iter))) \ return Qnil; \ } while (0) static ID id_valid; static VALUE rg_valid_p(VALUE self) { return rb_ivar_get(self, id_valid); } static VALUE rg_name(VALUE self) { CHECK_FITER_IS_VALID(self); return CSTR2RVAL(poppler_fonts_iter_get_name(RVAL2POPPLERFONTSITER(self))); } static VALUE rg_full_name(VALUE self) { CHECK_FITER_IS_VALID(self); return CSTR2RVAL(poppler_fonts_iter_get_full_name(RVAL2POPPLERFONTSITER(self))); } static VALUE rg_file_name(VALUE self) { CHECK_FITER_IS_VALID(self); return CSTR2RVAL(poppler_fonts_iter_get_file_name(RVAL2POPPLERFONTSITER(self))); } static VALUE rg_font_type(VALUE self) { CHECK_FITER_IS_VALID(self); return POPPLERFONTTYPE2RVAL(poppler_fonts_iter_get_font_type(RVAL2POPPLERFONTSITER(self))); } static VALUE rg_embedded_p(VALUE self) { CHECK_FITER_IS_VALID(self); return CBOOL2RVAL(poppler_fonts_iter_is_embedded(RVAL2POPPLERFONTSITER(self))); } static VALUE rg_subset_p(VALUE self) { CHECK_FITER_IS_VALID(self); return CBOOL2RVAL(poppler_fonts_iter_is_subset(RVAL2POPPLERFONTSITER(self))); } static VALUE rg_next(VALUE self) { if (poppler_fonts_iter_next(RVAL2POPPLERFONTSITER(self))) { return Qtrue; } else { rb_ivar_set(self, id_valid, Qfalse); return Qfalse; } } static VALUE rg_each(VALUE self) { PopplerFontsIter *iter; CHECK_FITER_IS_VALID(self); iter = RVAL2POPPLERFONTSITER(self); do { rb_yield(self); } while (poppler_fonts_iter_next(iter)); rb_ivar_set(self, id_valid, Qfalse); return self; } void Init_poppler_fonts_iter(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE; id_valid = rb_intern("valid?"); RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONTS_ITER, "FontsIter", mPoppler); rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(full_name, 0); RG_DEF_METHOD(file_name, 0); RG_DEF_METHOD(font_type, 0); RG_DEF_METHOD_P(embedded, 0); RG_DEF_METHOD_P(subset, 0); RG_DEF_METHOD(next, 0); RG_DEF_METHOD_P(valid, 0); RG_DEF_METHOD(each, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-page-transition.c0000644000175000017500000000614112257552170024037 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cPageTransition DEF_ACCESSOR(page_trans, type, RVAL2POPPLERPAGETRANSITION, RVAL2POPPLERPAGETRANSITIONTYPE, POPPLERPAGETRANSITIONTYPE2RVAL) DEF_ACCESSOR(page_trans, alignment, RVAL2POPPLERPAGETRANSITION, RVAL2POPPLERPAGETRANSITIONALIGNMENT, POPPLERPAGETRANSITIONALIGNMENT2RVAL) DEF_ACCESSOR(page_trans, direction, RVAL2POPPLERPAGETRANSITION, RVAL2POPPLERPAGETRANSITIONDIRECTION, POPPLERPAGETRANSITIONDIRECTION2RVAL) DEF_ACCESSOR(page_trans, duration, RVAL2POPPLERPAGETRANSITION, NUM2INT, INT2NUM) DEF_ACCESSOR(page_trans, angle, RVAL2POPPLERPAGETRANSITION, NUM2INT, INT2NUM) DEF_ACCESSOR(page_trans, scale, RVAL2POPPLERPAGETRANSITION, NUM2DBL, rb_float_new) DEF_ACCESSOR(page_trans, rectangular, RVAL2POPPLERPAGETRANSITION, RVAL2CBOOL, CBOOL2RVAL) void Init_poppler_page_transition(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION, "PageTransition", mPoppler); rbg_define_method(RG_TARGET_NAMESPACE, "type", page_trans_get_type, 0); rbg_define_method(RG_TARGET_NAMESPACE, "alignment", page_trans_get_alignment, 0); rbg_define_method(RG_TARGET_NAMESPACE, "direction", page_trans_get_direction, 0); rbg_define_method(RG_TARGET_NAMESPACE, "duration", page_trans_get_duration, 0); rbg_define_method(RG_TARGET_NAMESPACE, "angle", page_trans_get_angle, 0); rbg_define_method(RG_TARGET_NAMESPACE, "scale", page_trans_get_scale, 0); rbg_define_method(RG_TARGET_NAMESPACE, "rectangular", page_trans_get_rectangular, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_type", page_trans_set_type, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_alignment", page_trans_set_alignment, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_direction", page_trans_set_direction, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_duration", page_trans_set_duration, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_angle", page_trans_set_angle, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_scale", page_trans_set_scale, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_rectangular", page_trans_set_rectangular, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-rectangle.c0000644000175000017500000000637312124610262022674 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006-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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cRectangle static VALUE RG_TARGET_NAMESPACE; static VALUE rg_initialize(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2) { PopplerRectangle rectangle; rectangle.x1 = NUM2DBL(x1); rectangle.y1 = NUM2DBL(y1); rectangle.x2 = NUM2DBL(x2); rectangle.y2 = NUM2DBL(y2); G_INITIALIZE(self, g_boxed_copy(POPPLER_TYPE_RECTANGLE, &rectangle)); return Qnil; } DEF_ACCESSOR(rectangle, x1, RVAL2POPPLERRECTANGLE, rb_float_new, NUM2DBL) DEF_ACCESSOR(rectangle, y1, RVAL2POPPLERRECTANGLE, rb_float_new, NUM2DBL) DEF_ACCESSOR(rectangle, x2, RVAL2POPPLERRECTANGLE, rb_float_new, NUM2DBL) DEF_ACCESSOR(rectangle, y2, RVAL2POPPLERRECTANGLE, rb_float_new, NUM2DBL) static VALUE rg_to_a(VALUE self) { PopplerRectangle *rectangle = RVAL2POPPLERRECTANGLE(self); return rb_ary_new3(4, rb_float_new(rectangle->x1), rb_float_new(rectangle->y1), rb_float_new(rectangle->x2), rb_float_new(rectangle->y2)); } static VALUE rg_inspect(VALUE self) { VALUE inspected; gchar *points; PopplerRectangle *rectangle; rectangle = RVAL2POPPLERRECTANGLE(self); inspected = rb_call_super(0, NULL); rb_str_resize(inspected, RSTRING_LEN(inspected) - 1); points = g_strdup_printf(": [%g, %g, %g, %g]>", rectangle->x1, rectangle->y1, rectangle->x2, rectangle->y2); rb_str_cat2(inspected, points); g_free(points); return inspected; } void Init_poppler_rectangle(VALUE mPoppler) { RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_RECTANGLE, "Rectangle", mPoppler); RG_DEF_METHOD(initialize, 4); rbg_define_method(RG_TARGET_NAMESPACE, "x1", rectangle_get_x1, 0); rbg_define_method(RG_TARGET_NAMESPACE, "y1", rectangle_get_y1, 0); rbg_define_method(RG_TARGET_NAMESPACE, "x2", rectangle_get_x2, 0); rbg_define_method(RG_TARGET_NAMESPACE, "y2", rectangle_get_y2, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_x1", rectangle_set_x1, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_y1", rectangle_set_y1, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_x2", rectangle_set_x2, 1); rbg_define_method(RG_TARGET_NAMESPACE, "set_y2", rectangle_set_y2, 1); RG_DEF_METHOD(to_a, 0); RG_DEF_METHOD(inspect, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-ps-file.c0000644000175000017500000000401112257552170022264 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cPSFile /* Export to ps */ static VALUE rg_initialize(VALUE self, VALUE document, VALUE filename, VALUE first_page, VALUE n_pages) { PopplerPSFile *ps_file; ps_file = poppler_ps_file_new(RVAL2POPPLERDOCUMENT(document), RVAL2CSTR(filename), NUM2INT(first_page), NUM2INT(n_pages)); if (!ps_file) rb_raise(rb_eRuntimeError, "can't create Poppler::PSFile"); G_INITIALIZE(self, ps_file); return Qnil; } static VALUE rg_set_paper_size(VALUE self, VALUE width, VALUE height) { poppler_ps_file_set_paper_size(RVAL2POPPLERPSFILE(self), NUM2DBL(width), NUM2DBL(height)); return Qnil; } static VALUE rg_set_duplex(VALUE self, VALUE duplex) { poppler_ps_file_set_duplex(RVAL2POPPLERPSFILE(self), RVAL2CBOOL(duplex)); return Qnil; } void Init_poppler_ps_file(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PS_FILE, "PSFile", mPoppler); /* Export to ps */ RG_DEF_METHOD(initialize, 4); RG_DEF_METHOD(set_paper_size, 2); RG_DEF_METHOD(set_duplex, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-index-iter.c0000644000175000017500000000641212257552170023004 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cIndexIter static VALUE RG_TARGET_NAMESPACE; static ID id_valid; /* Interface for getting the Index of a poppler_document */ #define CHECK_IITER_IS_VALID(iter) do { \ if (!RVAL2CBOOL(rg_valid_p(iter))) \ return Qnil; \ } while (0) static VALUE rg_valid_p(VALUE self) { return rb_ivar_get(self, id_valid); } static VALUE rg_initialize(VALUE self, VALUE document) { PopplerIndexIter *iter; iter = poppler_index_iter_new(RVAL2POPPLERDOCUMENT(document)); G_INITIALIZE(self, iter); poppler_index_iter_free(iter); rb_ivar_set(self, id_valid, CBOOL2RVAL(iter)); return Qnil; } static VALUE rg_child(VALUE self) { PopplerIndexIter *child; VALUE rb_child; CHECK_IITER_IS_VALID(self); child = poppler_index_iter_get_child(RVAL2POPPLERINDEXITER(self)); rb_child = POPPLERINDEXITER2RVAL(child); rb_ivar_set(rb_child, id_valid, CBOOL2RVAL(child)); poppler_index_iter_free(child); return rb_child; } static VALUE rg_open_p(VALUE self) { CHECK_IITER_IS_VALID(self); return CBOOL2RVAL(poppler_index_iter_is_open(RVAL2POPPLERINDEXITER(self))); } #ifndef HAVE_TYPE_POPPLERACTIONANY static VALUE rg_action(VALUE self) { CHECK_IITER_IS_VALID(self); return POPPLERACTION2RVAL(poppler_index_iter_get_action(RVAL2POPPLERINDEXITER(self))); } #endif static VALUE rg_next(VALUE self) { if (poppler_index_iter_next(RVAL2POPPLERINDEXITER(self))) { return Qtrue; } else { rb_ivar_set(self, id_valid, Qfalse); return Qfalse; } } static VALUE rg_each(VALUE self) { PopplerIndexIter *iter; CHECK_IITER_IS_VALID(self); iter = RVAL2POPPLERINDEXITER(self); do { rb_yield(self); } while (poppler_index_iter_next(iter)); rb_ivar_set(self, id_valid, Qfalse); return self; } void Init_poppler_index_iter(VALUE mPoppler) { id_valid = rb_intern("valid?"); RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_INDEX_ITER, "IndexIter", mPoppler); /* Interface for getting the Index of a poppler_document */ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(child, 0); RG_DEF_METHOD_P(open, 0); #ifndef HAVE_TYPE_POPPLERACTIONANY RG_DEF_METHOD(action, 0); #endif RG_DEF_METHOD(next, 0); RG_DEF_METHOD_P(valid, 0); RG_DEF_METHOD(each, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-page.c0000644000175000017500000002134312257552170021650 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006-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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cPage #define SELF(self) (RVAL2POPPLERPAGE(self)) static VALUE cRectangle; static VALUE cPSFile; static VALUE page_render(VALUE self, VALUE cairo) { poppler_page_render(SELF(self), RVAL2CRCONTEXT(cairo)); return Qnil; } static VALUE page_render_to_ps(VALUE self, VALUE ps_file) { poppler_page_render_to_ps(SELF(self), RVAL2POPPLERPSFILE(ps_file)); return Qnil; } static VALUE rg_render(VALUE self, VALUE ps_file_or_cairo) { if (RVAL2CBOOL(rb_obj_is_kind_of(ps_file_or_cairo, cPSFile))) { return page_render_to_ps(self, ps_file_or_cairo); } else { return page_render(self, ps_file_or_cairo); } } static VALUE page_render_for_printing(VALUE self, VALUE cairo) { poppler_page_render_for_printing(SELF(self), RVAL2CRCONTEXT(cairo)); return Qnil; } static VALUE rg_render_for_printing(VALUE self, VALUE cairo) { return page_render_for_printing(self, cairo); } static VALUE page_render_selection(VALUE self, VALUE cairo, VALUE selection, VALUE rb_old_selection, VALUE style, VALUE glyph_color, VALUE background_color) { PopplerRectangle *old_selection = NULL; if (!NIL_P(rb_old_selection)) old_selection = RVAL2POPPLERRECTANGLE(rb_old_selection); poppler_page_render_selection(SELF(self), RVAL2CRCONTEXT(cairo), RVAL2POPPLERRECTANGLE(selection), old_selection, RVAL2POPPLERSELECTIONSTYLE(style), RVAL2POPPLERCOLOR(glyph_color), RVAL2POPPLERCOLOR(background_color)); return Qnil; } static VALUE rg_render_selection(VALUE self, VALUE cairo, VALUE selection, VALUE old_selection, VALUE style, VALUE glyph_color, VALUE background_color) { return page_render_selection(self, cairo, selection, old_selection, style, glyph_color, background_color); } static VALUE rg_size(VALUE self) { double width, height; poppler_page_get_size(SELF(self), &width, &height); return rb_ary_new3(2, rb_float_new(width), rb_float_new(height)); } static VALUE rg_index(VALUE self) { return INT2NUM(poppler_page_get_index(SELF(self))); } static VALUE rg_duration(VALUE self) { return rb_float_new(poppler_page_get_duration(SELF(self))); } static VALUE rg_transition(VALUE self) { return POPPLERPAGETRANSITION2RVAL(poppler_page_get_transition(SELF(self))); } static VALUE rg_thumbnail(VALUE self) { return CRSURFACE2RVAL(poppler_page_get_thumbnail(SELF(self))); } static VALUE rg_thumbnail_size(VALUE self) { int width, height; if (poppler_page_get_thumbnail_size(SELF(self), &width, &height)) return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); else return Qnil; } static VALUE rg_find_text(VALUE self, VALUE text) { return GLIST2ARY2F(poppler_page_find_text(SELF(self), RVAL2CSTR(text)), POPPLER_TYPE_RECTANGLE); } static VALUE rg_get_text(int argc, VALUE *argv, VALUE self) { gchar *text; PopplerSelectionStyle style = POPPLER_SELECTION_GLYPH; VALUE rb_text, arg1, arg2, rb_rect; PopplerPage *page; rb_scan_args(argc, argv, "02", &arg1, &arg2); page = SELF(self); rb_rect = Qnil; if (!NIL_P(arg1)) { if (RTEST(rb_obj_is_kind_of(arg1, cRectangle))) { rb_rect = arg1; } else { rb_raise(rb_eArgError, "wrong first arrument. selection rectangle is expected."); } if (!NIL_P(arg2)) { style = RVAL2POPPLERSELECTIONSTYLE(arg2); } } if (NIL_P(rb_rect)) { #if POPPLER_CHECK_VERSION(0, 15, 0) text = poppler_page_get_text(page); #else PopplerRectangle rect; double width, height; rect.x1 = 0; rect.y1 = 0; poppler_page_get_size(page, &width, &height); rect.x2 = width; rect.y2 = height; text = poppler_page_get_text(page, style, &rect); #endif } else { PopplerRectangle *rect; rect = RVAL2POPPLERRECTANGLE(rb_rect); #if POPPLER_CHECK_VERSION(0, 15, 0) text = poppler_page_get_selected_text(page, style, rect); #else text = poppler_page_get_text(page, style, rect); #endif } rb_text = CSTR2RVAL(text); g_free(text); return rb_text; } #if POPPLER_CHECK_VERSION(0, 16, 0) static VALUE rg_text_layout(VALUE self) { PopplerRectangle *rectangles; guint n_rectangles; if (poppler_page_get_text_layout(SELF(self), &rectangles, &n_rectangles)) { VALUE *rb_list, *p; VALUE ary; guint i; rb_list = p = ALLOC_N(VALUE, n_rectangles); for (i = 0; i < n_rectangles; i++, p++) { *p = POPPLERRECTANGLE2RVAL(&rectangles[i]); } ary = rb_ary_new4(n_rectangles, rb_list); free(rb_list); free(rectangles); return ary; } else { return Qnil; } } #endif static VALUE rg_get_selection_region(VALUE self, VALUE scale, VALUE style, VALUE selection) { return GLIST2ARY2F(poppler_page_get_selection_region(SELF(self), NUM2DBL(scale), RVAL2POPPLERSELECTIONSTYLE(style), RVAL2POPPLERRECTANGLE(selection)), POPPLER_TYPE_RECTANGLE); } static VALUE rg_link_mapping(VALUE self) { return GLIST2ARY2F(poppler_page_get_link_mapping(SELF(self)), POPPLER_TYPE_LINK_MAPPING); } static VALUE rg_image_mapping(VALUE self) { VALUE mappings; GList *image_mapping, *node; mappings = rb_ary_new(); image_mapping = poppler_page_get_image_mapping(SELF(self)); for (node = image_mapping; node; node = g_list_next(node)) { PopplerImageMapping *image_mapping; VALUE mapping; image_mapping = node->data; mapping = POPPLERIMAGEMAPPING2RVAL(image_mapping); rb_iv_set(mapping, "@page", self); } poppler_page_free_image_mapping(image_mapping); return mappings; } static VALUE rg_get_image(VALUE self, VALUE image_id) { return CRSURFACE2RVAL(poppler_page_get_image(SELF(self), NUM2INT(image_id))); } static VALUE rg_form_field_mapping(VALUE self) { return GLIST2ARY2F(poppler_page_get_form_field_mapping(SELF(self)), POPPLER_TYPE_FORM_FIELD_MAPPING); } static VALUE rg_annotation_mapping(VALUE self) { return GLIST2ARY2F(poppler_page_get_annot_mapping(SELF(self)), POPPLER_TYPE_ANNOT_MAPPING); } static VALUE rg_crop_box(VALUE self) { PopplerRectangle rect; poppler_page_get_crop_box(SELF(self), &rect); return POPPLERRECTANGLE2RVAL(&rect); } void Init_poppler_page(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PAGE, "Page", mPoppler); cRectangle = rb_const_get(mPoppler, rb_intern("Rectangle")); cPSFile = rb_const_get(mPoppler, rb_intern("PSFile")); RG_DEF_METHOD(render, 1); RG_DEF_METHOD(render_for_printing, 1); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(index, 0); RG_DEF_METHOD(duration, 0); RG_DEF_METHOD(transition, 0); RG_DEF_METHOD(thumbnail, 0); RG_DEF_METHOD(thumbnail_size, 0); RG_DEF_METHOD(find_text, 1); RG_DEF_METHOD(get_text, -1); #if POPPLER_CHECK_VERSION(0, 16, 0) RG_DEF_METHOD(text_layout, 0); #endif RG_DEF_METHOD(get_selection_region, 3); RG_DEF_METHOD(link_mapping, 0); RG_DEF_METHOD(image_mapping, 0); RG_DEF_METHOD(get_image, 1); RG_DEF_METHOD(form_field_mapping, 0); RG_DEF_METHOD(annotation_mapping, 0); RG_DEF_METHOD(render_selection, 6); RG_DEF_METHOD(crop_box, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/poppler.def0000644000175000017500000000003111701304107020701 0ustar koukouEXPORTS Init_poppler ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-annotation-callout-line.c0000644000175000017500000001152612257552170025476 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2008-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAnnotation static VALUE rg_initialize(VALUE self, VALUE multiline, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3) { PopplerAnnotCalloutLine *line; line = poppler_annot_callout_line_new(); line->multiline = RVAL2CBOOL(multiline); line->x1 = NUM2DBL(x1); line->y1 = NUM2DBL(y1); line->x2 = NUM2DBL(x2); line->y2 = NUM2DBL(y2); line->x3 = NUM2DBL(x3); line->y3 = NUM2DBL(y3); G_INITIALIZE(self, line); return Qnil; } DEF_ACCESSOR(annot_callout_line, multiline, RVAL2POPPLERANNOTCALLOUTLINE, CBOOL2RVAL, RVAL2CBOOL) DEF_ACCESSOR(annot_callout_line, x1, RVAL2POPPLERANNOTCALLOUTLINE, rb_float_new, NUM2DBL) DEF_ACCESSOR(annot_callout_line, y1, RVAL2POPPLERANNOTCALLOUTLINE, rb_float_new, NUM2DBL) DEF_ACCESSOR(annot_callout_line, x2, RVAL2POPPLERANNOTCALLOUTLINE, rb_float_new, NUM2DBL) DEF_ACCESSOR(annot_callout_line, y2, RVAL2POPPLERANNOTCALLOUTLINE, rb_float_new, NUM2DBL) DEF_ACCESSOR(annot_callout_line, x3, RVAL2POPPLERANNOTCALLOUTLINE, rb_float_new, NUM2DBL) DEF_ACCESSOR(annot_callout_line, y3, RVAL2POPPLERANNOTCALLOUTLINE, rb_float_new, NUM2DBL) static VALUE rg_to_a(VALUE self) { PopplerAnnotCalloutLine *line; line = RVAL2POPPLERANNOTCALLOUTLINE(self); return rb_ary_new3(7, CBOOL2RVAL(line->multiline), rb_float_new(line->x1), rb_float_new(line->y1), rb_float_new(line->x2), rb_float_new(line->y2), rb_float_new(line->x3), rb_float_new(line->y3)); } static VALUE rg_inspect(VALUE self) { VALUE inspected; gchar *info; PopplerAnnotCalloutLine *line; line = RVAL2POPPLERANNOTCALLOUTLINE(self); inspected = rb_call_super(0, NULL); rb_str_resize(inspected, RSTRING_LEN(inspected) - 1); info = g_strdup_printf(": [%s, %g, %g, %g, %g, %g, %g]>", line->multiline ? "true" : "false", line->x1, line->y1, line->x2, line->y2, line->x3, line->y3); rb_str_cat2(inspected, info); g_free(info); return inspected; } void Init_poppler_annotation_callout_line(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_ANNOT_CALLOUT_LINE, "AnnotationCalloutLine", mPoppler); RG_DEF_METHOD(initialize, 7); rbg_define_method(RG_TARGET_NAMESPACE, "multiline?", annot_callout_line_get_multiline, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_multiline", annot_callout_line_set_multiline, 1); rbg_define_method(RG_TARGET_NAMESPACE, "x1", annot_callout_line_get_x1, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_x1", annot_callout_line_set_x1, 1); rbg_define_method(RG_TARGET_NAMESPACE, "y1", annot_callout_line_get_y1, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_y1", annot_callout_line_set_y1, 1); rbg_define_method(RG_TARGET_NAMESPACE, "x2", annot_callout_line_get_x2, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_x2", annot_callout_line_set_x2, 2); rbg_define_method(RG_TARGET_NAMESPACE, "y2", annot_callout_line_get_y2, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_y2", annot_callout_line_set_y2, 2); rbg_define_method(RG_TARGET_NAMESPACE, "x3", annot_callout_line_get_x3, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_x3", annot_callout_line_set_x3, 3); rbg_define_method(RG_TARGET_NAMESPACE, "y3", annot_callout_line_get_y3, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_y3", annot_callout_line_set_y3, 3); RG_DEF_METHOD(to_a, 0); RG_DEF_METHOD(inspect, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-action.c0000644000175000017500000003302212257552170022206 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" /* PopplerAction */ static VALUE rb_cPopplerAction; static VALUE rb_cPopplerActionDest; static VALUE rb_cPopplerActionAny; static VALUE rb_cPopplerActionUnknown; static VALUE rb_cPopplerActionGotoDest; static VALUE rb_cPopplerActionGotoRemote; static VALUE rb_cPopplerActionLaunch; static VALUE rb_cPopplerActionURI; static VALUE rb_cPopplerActionNamed; static VALUE rb_cPopplerActionMovie; static VALUE rb_cPopplerActionRendition; static VALUE rb_cPopplerActionOCGState; static VALUE rb_cPopplerActionJavaScript; #define DEFINE_ACTION_TYPE(type_lower_case, type_upper_case) \ static GType \ rb_poppler_action_ ## type_lower_case ## _get_type(void) \ { \ static GType type = 0; \ if (type == 0) { \ type = g_boxed_type_register_static("PopplerAction" # type_upper_case, \ (GBoxedCopyFunc)poppler_action_copy, \ (GBoxedFreeFunc)poppler_action_free); \ } \ return type; \ } DEFINE_ACTION_TYPE(any, Any) DEFINE_ACTION_TYPE(unknown, Unknown) DEFINE_ACTION_TYPE(goto_dest, GotoDest) DEFINE_ACTION_TYPE(goto_remote, GotoRemote) DEFINE_ACTION_TYPE(launch, Launch) DEFINE_ACTION_TYPE(uri, URI) DEFINE_ACTION_TYPE(named, Named) DEFINE_ACTION_TYPE(movie, Movie) DEFINE_ACTION_TYPE(rendition, Rendition) DEFINE_ACTION_TYPE(ocg_state, OCGState) DEFINE_ACTION_TYPE(javascript, JavaScript) #define POPPLER_ACTION_TYPE_ANY (rb_poppler_action_any_get_type()) #define POPPLER_ACTION_TYPE_UNKNOWN (rb_poppler_action_unknown_get_type()) #define POPPLER_ACTION_TYPE_GOTO_DEST (rb_poppler_action_goto_dest_get_type()) #define POPPLER_ACTION_TYPE_GOTO_REMOTE (rb_poppler_action_goto_remote_get_type()) #define POPPLER_ACTION_TYPE_LAUNCH (rb_poppler_action_launch_get_type()) #define POPPLER_ACTION_TYPE_URI (rb_poppler_action_uri_get_type()) #define POPPLER_ACTION_TYPE_NAMED (rb_poppler_action_named_get_type()) #define POPPLER_ACTION_TYPE_MOVIE (rb_poppler_action_movie_get_type()) #define POPPLER_ACTION_TYPE_RENDITION (rb_poppler_action_rendition_get_type()) #define POPPLER_ACTION_TYPE_OCG_STATE (rb_poppler_action_ocg_state_get_type()) #define POPPLER_ACTION_TYPE_JAVASCRIPT (rb_poppler_action_javascript_get_type()) static GType rb_poppler_action_type_to_gtype(PopplerActionType action_type) { GType gtype = POPPLER_ACTION_TYPE_ANY; switch (action_type) { case POPPLER_ACTION_NONE: break; case POPPLER_ACTION_UNKNOWN: gtype = POPPLER_ACTION_TYPE_UNKNOWN; break; case POPPLER_ACTION_GOTO_DEST: gtype = POPPLER_ACTION_TYPE_GOTO_DEST; break; case POPPLER_ACTION_GOTO_REMOTE: gtype = POPPLER_ACTION_TYPE_GOTO_REMOTE; break; case POPPLER_ACTION_LAUNCH: gtype = POPPLER_ACTION_TYPE_LAUNCH; break; case POPPLER_ACTION_URI: gtype = POPPLER_ACTION_TYPE_URI; break; case POPPLER_ACTION_NAMED: gtype = POPPLER_ACTION_TYPE_NAMED; break; #if POPPLER_CHECK_VERSION(0, 14, 0) case POPPLER_ACTION_MOVIE: gtype = POPPLER_ACTION_TYPE_MOVIE; break; case POPPLER_ACTION_RENDITION: gtype = POPPLER_ACTION_TYPE_RENDITION; break; case POPPLER_ACTION_OCG_STATE: gtype = POPPLER_ACTION_TYPE_OCG_STATE; break; #endif #if POPPLER_CHECK_VERSION(0, 18, 0) case POPPLER_ACTION_JAVASCRIPT: gtype = POPPLER_ACTION_TYPE_JAVASCRIPT; break; #endif default: break; } return gtype; } static GType rb_poppler_action_to_gtype(VALUE action) { VALUE klass; GType type = POPPLER_ACTION_TYPE_ANY; klass = rb_obj_class(action); if (klass == rb_cPopplerActionAny) { type = POPPLER_ACTION_TYPE_ANY; } else if (klass == rb_cPopplerActionUnknown) { type = POPPLER_ACTION_TYPE_UNKNOWN; } else if (klass == rb_cPopplerActionGotoDest) { type = POPPLER_ACTION_TYPE_GOTO_DEST; } else if (klass == rb_cPopplerActionGotoRemote) { type = POPPLER_ACTION_TYPE_GOTO_REMOTE; } else if (klass == rb_cPopplerActionLaunch) { type = POPPLER_ACTION_TYPE_LAUNCH; } else if (klass == rb_cPopplerActionURI) { type = POPPLER_ACTION_TYPE_URI; } else if (klass == rb_cPopplerActionNamed) { type = POPPLER_ACTION_TYPE_NAMED; #if POPPLER_CHECK_VERSION(0, 14, 0) } else if (klass == rb_cPopplerActionMovie) { type = POPPLER_ACTION_TYPE_MOVIE; } else if (klass == rb_cPopplerActionRendition) { type = POPPLER_ACTION_TYPE_RENDITION; } else if (klass == rb_cPopplerActionOCGState) { type = POPPLER_ACTION_TYPE_OCG_STATE; #endif #if POPPLER_CHECK_VERSION(0, 18, 0) } else if (klass == rb_cPopplerActionJavaScript) { type = POPPLER_ACTION_TYPE_JAVASCRIPT; #endif } else { rb_raise(rb_eArgError, "Not action object: %s", RBG_INSPECT(action)); } return type; } VALUE rb_poppler_ruby_object_from_action(PopplerAction *action) { return BOXED2RVAL(action, rb_poppler_action_type_to_gtype(action->any.type)); } PopplerAction * rb_poppler_action_from_ruby_object(VALUE action) { return RVAL2BOXED(action, rb_poppler_action_to_gtype(action)); } #define ACTION_ATTR_STR(type, name) \ static VALUE \ action_ ## type ## _ ## name (VALUE self) \ { \ return CSTR2RVAL(RVAL2POPPLERACTION(self)->type.name); \ } #define ACTION_ATTR_DEST(type, name) \ static VALUE \ action_ ## type ## _ ## name (VALUE self) \ { \ return POPPLERDEST2RVAL(RVAL2POPPLERACTION(self)->type.name); \ } #define DEFINE_ACCESSOR(prefix, target, name) \ rbg_define_method(target, G_STRINGIFY(name), prefix ## _ ## name, 0); #define DEFINE_ACTION_ACCESSOR(target, type, name) \ DEFINE_ACCESSOR(action_ ## type, target, name) /* PopplerActionAny */ static VALUE action_any_type(VALUE self) { return POPPLERACTIONTYPE2RVAL(RVAL2POPPLERACTION(self)->type); } ACTION_ATTR_STR(any, title); /* PopplerActionGotoDest */ ACTION_ATTR_DEST(goto_dest, dest); /* PopplerActionGotoRemote */ ACTION_ATTR_STR(goto_remote, file_name); ACTION_ATTR_DEST(goto_remote, dest); /* PopplerActionLaunch */ ACTION_ATTR_STR(launch, file_name); ACTION_ATTR_STR(launch, params); /* PopplerActionURI */ ACTION_ATTR_STR(uri, uri); /* PopplerActionNamed */ ACTION_ATTR_STR(named, named_dest); #if POPPLER_CHECK_VERSION(0, 14, 0) /* PopplerActionMovie */ ACTION_ATTR_DEST(movie, movie); /* PopplerActionRendition */ ACTION_ATTR_DEST(rendition, media); /* PopplerActionOCGState */ ACTION_ATTR_DEST(ocg_state, state_list); #endif #if POPPLER_CHECK_VERSION(0, 18, 0) /* PopplerActionJavascript */ ACTION_ATTR_STR(javascript, script); #endif /* PopplerDest */ #ifdef RB_POPPLER_TYPE_DEST_NOT_DEFINED GType poppler_dest_get_type (void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static("PopplerDest", (GBoxedCopyFunc)poppler_dest_copy, (GBoxedFreeFunc)poppler_dest_free); return our_type; } #endif static VALUE dest_get_type(VALUE self) { return POPPLERDESTTYPE2RVAL(RVAL2POPPLERDEST(self)->type); } #define DEST_ATTR_INT(name) \ static VALUE \ dest_ ## name (VALUE self) \ { \ return INT2NUM(RVAL2POPPLERDEST(self)->name); \ } #define DEST_ATTR_UINT(name) \ static VALUE \ dest_ ## name (VALUE self) \ { \ return UINT2NUM(RVAL2POPPLERDEST(self)->name); \ } #define DEST_ATTR_DOUBLE(name) \ static VALUE \ dest_ ## name (VALUE self) \ { \ return rb_float_new(RVAL2POPPLERDEST(self)->name); \ } #define DEST_ATTR_STR(name) \ static VALUE \ dest_ ## name (VALUE self) \ { \ return CSTR2RVAL(RVAL2POPPLERDEST(self)->name); \ } #define DEFINE_DEST_ACCESSOR(target, name) \ DEFINE_ACCESSOR(dest, target, name) DEST_ATTR_INT(page_num) DEST_ATTR_DOUBLE(left) DEST_ATTR_DOUBLE(bottom) DEST_ATTR_DOUBLE(right) DEST_ATTR_DOUBLE(top) DEST_ATTR_DOUBLE(zoom) DEST_ATTR_STR(named_dest) DEST_ATTR_UINT(change_left) DEST_ATTR_UINT(change_top) DEST_ATTR_UINT(change_zoom) void Init_poppler_action(VALUE mPoppler) { rb_cPopplerAction = G_DEF_CLASS(POPPLER_TYPE_ACTION, "Action", mPoppler); rb_cPopplerActionAny = rb_define_class_under(mPoppler, "ActionAny", rb_cPopplerAction); rbg_define_method(rb_cPopplerActionAny, "type", action_any_type, 0); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionAny, any, title); rb_cPopplerActionUnknown = rb_define_class_under(mPoppler, "ActionUnknown", rb_cPopplerAction); rb_cPopplerActionGotoDest = rb_define_class_under(mPoppler, "ActionGotoDest", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoDest, goto_dest, dest); rb_cPopplerActionGotoRemote = rb_define_class_under(mPoppler, "ActionGotoRemote", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoRemote, goto_remote, file_name); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoRemote, goto_remote, dest); rb_cPopplerActionLaunch = rb_define_class_under(mPoppler, "ActionLaunch", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionLaunch, launch, file_name); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionLaunch, launch, params); rb_cPopplerActionURI = rb_define_class_under(mPoppler, "ActionURI", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionURI, uri, uri); rb_cPopplerActionNamed = rb_define_class_under(mPoppler, "ActionNamed", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionNamed, named, named_dest); #if POPPLER_CHECK_VERSION(0, 14, 0) rb_cPopplerActionMovie = rb_define_class_under(mPoppler, "ActionMovie", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionMovie, movie, movie); rb_cPopplerActionRendition = rb_define_class_under(mPoppler, "ActionRendtion", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionRendition, rendition, media); rb_cPopplerActionOCGState = rb_define_class_under(mPoppler, "ActionOCGState", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionOCGState, ocg_state, state_list); #endif #if POPPLER_CHECK_VERSION(0, 18, 0) rb_cPopplerActionJavaScript = rb_define_class_under(mPoppler, "ActionJavaScript", rb_cPopplerActionAny); DEFINE_ACTION_ACCESSOR(rb_cPopplerActionJavaScript, javascript, script); #endif G_DEF_CLASS(POPPLER_TYPE_ACTION_TYPE, "ActionType", mPoppler); G_DEF_CLASS(POPPLER_TYPE_DEST_TYPE, "DestType", mPoppler); rb_cPopplerActionDest = G_DEF_CLASS(POPPLER_TYPE_DEST, "Dest", mPoppler); rbg_define_method(rb_cPopplerActionDest, "type", dest_get_type, 0); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, page_num); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, left); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, bottom); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, right); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, top); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, zoom); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, named_dest); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_left); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_top); DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_zoom); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-button-field.c0000644000175000017500000000327312257552170023332 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cButtonField #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_type(VALUE self) { return POPPLERFORMBUTTONTYPE2RVAL(poppler_form_field_button_get_button_type(_SELF(self))); } static VALUE rg_active_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_button_get_state(_SELF(self))); } static VALUE rg_set_active(VALUE self, VALUE state) { poppler_form_field_button_set_state(_SELF(self), RVAL2CBOOL(state)); return Qnil; } void Init_poppler_button_field(VALUE mPoppler, VALUE cFormField) { RG_TARGET_NAMESPACE = rb_define_class_under(mPoppler, "ButtonField", cFormField); RG_DEF_METHOD(type, 0); RG_DEF_METHOD_P(active, 0); RG_DEF_METHOD(set_active, 1); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-annotation.c0000644000175000017500000000373411701304107023076 0ustar koukou/* -*- 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAnnotation #define SELF(self) (RVAL2POPPLERANNOT(self)) static VALUE rg_type(VALUE self) { return POPPLERANNOTTYPE2RVAL(poppler_annot_get_annot_type(SELF(self))); } static VALUE rg_contents(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_get_contents(SELF(self))); } static VALUE rg_name(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_get_name(SELF(self))); } static VALUE rg_modified(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_get_modified(SELF(self))); } static VALUE rg_flags(VALUE self) { return POPPLERANNOTFLAG2RVAL(poppler_annot_get_flags(SELF(self))); } static VALUE rg_color(VALUE self) { return POPPLERCOLOR2RVAL_FREE(poppler_annot_get_color(SELF(self))); } void Init_poppler_annotation(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_ANNOT, "Annotation", mPoppler); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(contents, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(modified, 0); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(color, 0); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-private.h0000644000175000017500000000750712257552170022421 0ustar koukou#ifndef __RBPOPPLER_PRIVATE_H__ #define __RBPOPPLER_PRIVATE_H__ #include "rbpoppler.h" #define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o))) G_GNUC_INTERNAL void Init_poppler_index_iter(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_font_info(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_document(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_fonts_iter(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_ps_file(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_rectangle(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_page(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_color(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_link_mapping(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_page_transition(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_image_mapping(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_form_field_mapping(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_annotation_mapping(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_attachment(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_action(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_annotation(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_annotation_markup(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_annotation_text(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_annotation_free_text(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_annotation_callout_line(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_form_field(VALUE mPoppler); G_GNUC_INTERNAL void Init_poppler_button_field(VALUE mPoppler, VALUE cFormField); G_GNUC_INTERNAL void Init_poppler_text_field(VALUE mPoppler, VALUE cFormField); G_GNUC_INTERNAL void Init_poppler_choice_field(VALUE mPoppler, VALUE cFormField); G_GNUC_INTERNAL void rectangle_set(PopplerRectangle *rect, VALUE rb_rect); #define RECT_ENTITY2RVAL(rect) POPPLERRECTANGLE2RVAL(&(rect)) #define RECT_ENTITY_SET(rect, rb_rect) rectangle_set(&(rect), rb_rect) #define DEF_READER(prefix, name, member, self_to_c, member_to_rb) \ static VALUE \ prefix ## _get_ ## name(VALUE self) \ { \ return member_to_rb((self_to_c(self))->member); \ } #define DEF_WRITER(prefix, name, member, self_to_c, value_to_c) \ static VALUE \ prefix ## _set_ ## name(VALUE self, VALUE value) \ { \ (self_to_c(self))->member = value_to_c(value); \ return Qnil; \ } #define DEF_WRITER_WITH_SETTER(prefix, name, member, \ self_to_c, value_setter) \ static VALUE \ prefix ## _set_ ## name(VALUE self, VALUE value) \ { \ value_setter((self_to_c(self))->member, value); \ return Qnil; \ } #define DEF_ACCESSOR(prefix, member, self_to_c, member_to_rb, value_to_c) \ DEF_READER(prefix, member, member, self_to_c, member_to_rb) \ DEF_WRITER(prefix, member, member, self_to_c, value_to_c) \ #define DEF_ACCESSOR_WITH_SETTER(prefix, member, self_to_c, \ member_to_rb, value_setter) \ DEF_READER(prefix, member, member, self_to_c, member_to_rb) \ DEF_WRITER_WITH_SETTER(prefix, member, member, self_to_c, value_setter) #define DEF_ACCESSOR_WITH_NAME(prefix, name, member, self_to_c, \ member_to_rb, value_to_c) \ DEF_READER(prefix, name, member, self_to_c, member_to_rb) \ DEF_WRITER(prefix, name, member, self_to_c, value_to_c) #endif ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler.c0000644000175000017500000001056212257552170020737 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpoppler-private.h" extern void Init_poppler(void); #define RG_TARGET_NAMESPACE mPoppler static VALUE rg_s_backend(G_GNUC_UNUSED VALUE self) { return POPPLERBACKEND2RVAL(poppler_get_backend()); } static VALUE rg_s_version(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(poppler_get_version()); } static VALUE rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self) { return Qtrue; } void Init_poppler(void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module("Poppler"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(POPPLER_MAJOR_VERSION), INT2FIX(POPPLER_MINOR_VERSION), INT2FIX(POPPLER_MICRO_VERSION))); G_DEF_CLASS(POPPLER_TYPE_ERROR, "Error", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_ORIENTATION, "Orientation", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_TYPE, "PageTransitionType", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT, "PageTransitionAlignment", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_DIRECTION, "PageTransitionDirection", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_SELECTION_STYLE, "SelectionStyle", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_FORM_BUTTON_TYPE, "FormButtonType", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_FORM_TEXT_TYPE, "FormTextType", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_FORM_CHOICE_TYPE, "FormChoiceType", RG_TARGET_NAMESPACE); G_RENAME_NICK("3D", "TYPE_3D"); G_DEF_CLASS(POPPLER_TYPE_ANNOT_TYPE, "AnnotationType", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_ANNOT_FLAG, "AnnotationFlag", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE, "AnnotationMarkupReplyType", RG_TARGET_NAMESPACE); G_RENAME_NICK("3D", "TYPE_3D"); G_DEF_CLASS(POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE, "AnnotationExternalDataType", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_ANNOT_TEXT_STATE, "AnnotationTextState", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING, "AnnotationFreeTextQuadding", RG_TARGET_NAMESPACE); G_DEF_CLASS(POPPLER_TYPE_BACKEND, "Backend", RG_TARGET_NAMESPACE); RG_DEF_SMETHOD(backend, 0); RG_DEF_SMETHOD(version, 0); RG_DEF_SMETHOD_P(cairo_available, 0); Init_poppler_index_iter(RG_TARGET_NAMESPACE); Init_poppler_font_info(RG_TARGET_NAMESPACE); Init_poppler_document(RG_TARGET_NAMESPACE); Init_poppler_fonts_iter(RG_TARGET_NAMESPACE); Init_poppler_ps_file(RG_TARGET_NAMESPACE); Init_poppler_rectangle(RG_TARGET_NAMESPACE); Init_poppler_page(RG_TARGET_NAMESPACE); Init_poppler_color(RG_TARGET_NAMESPACE); Init_poppler_link_mapping(RG_TARGET_NAMESPACE); Init_poppler_page_transition(RG_TARGET_NAMESPACE); Init_poppler_image_mapping(RG_TARGET_NAMESPACE); Init_poppler_form_field_mapping(RG_TARGET_NAMESPACE); Init_poppler_annotation_mapping(RG_TARGET_NAMESPACE); Init_poppler_attachment(RG_TARGET_NAMESPACE); Init_poppler_action(RG_TARGET_NAMESPACE); Init_poppler_annotation(RG_TARGET_NAMESPACE); Init_poppler_annotation_markup(RG_TARGET_NAMESPACE); Init_poppler_annotation_text(RG_TARGET_NAMESPACE); Init_poppler_annotation_free_text(RG_TARGET_NAMESPACE); Init_poppler_annotation_callout_line(RG_TARGET_NAMESPACE); Init_poppler_form_field(RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpopplerconversions.h0000644000175000017500000002012512257552170023231 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 __RBPOPPLERCONVERSIONS_H__ #define __RBPOPPLERCONVERSIONS_H__ #define POPPLERANNOT2RVAL(o) (GOBJ2RVAL(o)) #define POPPLERFORMFIELD2RVAL(o) (rb_poppler_ruby_object_from_form_field(o)) #define RVAL2POPPLERACTION(o) (rb_poppler_action_from_ruby_object(o)) #define POPPLERACTION2RVAL(o) (rb_poppler_ruby_object_from_action(o)) #define RVAL2POPPLERCOLOR(o) (rb_poppler_ruby_object_to_color(o)) #define POPPLERCOLOR2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_COLOR)) #define POPPLERCOLOR2RVAL_FREE(o) (rb_poppler_ruby_object_from_color_with_free(o)) #define RVAL2POPPLERANNOT(o) (POPPLER_ANNOT(RVAL2GOBJ(o))) #define RVAL2POPPLERANNOTFREETEXT(o) (POPPLER_ANNOT_FREE_TEXT(RVAL2GOBJ(o))) #define RVAL2POPPLERANNOTMARKUP(o) (POPPLER_ANNOT_MARKUP(RVAL2GOBJ(o))) #define RVAL2POPPLERANNOTTEXT(o) (POPPLER_ANNOT_TEXT(RVAL2GOBJ(o))) #define RVAL2POPPLERATTACHMENT(o) (POPPLER_ATTACHMENT(RVAL2GOBJ(o))) #define RVAL2POPPLERDOCUMENT(o) (POPPLER_DOCUMENT(RVAL2GOBJ(o))) #define RVAL2POPPLERFORMFIELD(o) (POPPLER_FORM_FIELD(RVAL2GOBJ(o))) #define RVAL2POPPLERPAGE(o) (POPPLER_PAGE(RVAL2GOBJ(o))) #define RVAL2POPPLERANNOTCALLOUTLINE(o) ((PopplerAnnotCalloutLine*)RVAL2BOXED(o, POPPLER_TYPE_ANNOT_CALLOUT_LINE)) #define POPPLERANNOTCALLOUTLINE2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_ANNOT_CALLOUT_LINE)) #define RVAL2POPPLERANNOTMAPPING(o) ((PopplerAnnotMapping*)RVAL2BOXED(o, POPPLER_TYPE_ANNOT_MAPPING)) #define POPPLERANNOTMAPPING2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_ANNOT_MAPPING)) #define RVAL2POPPLERDEST(o) ((PopplerDest*)RVAL2BOXED(o, POPPLER_TYPE_DEST)) #define POPPLERDEST2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_DEST)) #define RVAL2FONTINFO(o) ((PopplerFontInfo*)RVAL2BOXED(o, POPPLER_TYPE_FONT_INFO)) #define FONTINFO2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_FONT_INFO)) #define RVAL2POPPLERFONTSITER(o) ((PopplerFontsIter*)RVAL2BOXED(o, POPPLER_TYPE_FONTS_ITER)) #define POPPLERFONTSITER2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_FONTS_ITER)) #define RVAL2POPPLERFORMFIELDMAPPING(o) ((PopplerFormFieldMapping*)RVAL2BOXED(o, POPPLER_TYPE_FORM_FIELD_MAPPING)) #define POPPLERFORMFIELDMAPPING2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_FORM_FIELD_MAPPING)) #define RVAL2POPPLERIMAGEMAPPING(o) ((PopplerImageMapping*)RVAL2BOXED(o, POPPLER_TYPE_IMAGE_MAPPING)) #define POPPLERIMAGEMAPPING2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_IMAGE_MAPPING)) #define RVAL2POPPLERINDEXITER(o) ((PopplerIndexIter*)RVAL2BOXED(o, POPPLER_TYPE_INDEX_ITER)) #define POPPLERINDEXITER2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_INDEX_ITER)) #define RVAL2POPPLERLINKMAPPING(o) ((PopplerLinkMapping*)RVAL2BOXED(o, POPPLER_TYPE_LINK_MAPPING)) #define POPPLERLINKMAPPING2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_LINK_MAPPING)) #define RVAL2POPPLERPAGETRANSITION(o) ((PopplerPageTransition*)RVAL2BOXED(o, POPPLER_TYPE_PAGE_TRANSITION)) #define POPPLERPAGETRANSITION2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_PAGE_TRANSITION)) #define RVAL2POPPLERPSFILE(o) ((PopplerPSFile*)RVAL2BOXED(o, POPPLER_TYPE_PS_FILE)) #define POPPLERPSFILE2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_PS_FILE)) #define RVAL2POPPLERRECTANGLE(o) ((PopplerRectangle*)RVAL2BOXED(o, POPPLER_TYPE_RECTANGLE)) #define POPPLERRECTANGLE2RVAL(o) (BOXED2RVAL(o, POPPLER_TYPE_RECTANGLE)) #define RVAL2POPPLERACTIONTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_ACTION_TYPE)) #define POPPLERACTIONTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ACTION_TYPE)) #define RVAL2POPPLERANNOTEXTERNALDATATYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE)) #define POPPLERANNOTEXTERNALDATATYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE)) #define RVAL2POPPLERANNOTFLAG(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_FLAG)) #define POPPLERANNOTFLAG2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_FLAG)) #define RVAL2POPPLERANNOTFREETEXTQUADDING(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING)) #define POPPLERANNOTFREETEXTQUADDING2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING)) #define RVAL2POPPLERANNOTMARKUPREPLYTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE)) #define POPPLERANNOTMARKUPREPLYTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE)) #define RVAL2POPPLERANNOTTEXTICON(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_TEXT_ICON)) #define POPPLERANNOTTEXTICON2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_TEXT_ICON)) #define RVAL2POPPLERANNOTTEXTSTATE(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_TEXT_STATE)) #define POPPLERANNOTTEXTSTATE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_TEXT_STATE)) #define RVAL2POPPLERANNOTTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_ANNOT_TYPE)) #define POPPLERANNOTTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_ANNOT_TYPE)) #define RVAL2POPPLERBACKEND(o) (RVAL2GENUM(o, POPPLER_TYPE_BACKEND)) #define POPPLERBACKEND2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_BACKEND)) #define RVAL2POPPLERDESTTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_DEST_TYPE)) #define POPPLERDESTTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_DEST_TYPE)) #define RVAL2POPPLERFONTTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_FONT_TYPE)) #define POPPLERFONTTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_FONT_TYPE)) #define RVAL2POPPLERFORMBUTTONTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_FORM_BUTTON_TYPE)) #define POPPLERFORMBUTTONTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_FORM_BUTTON_TYPE)) #define RVAL2POPPLERFORMCHOICETYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_FORM_CHOICE_TYPE)) #define POPPLERFORMCHOICETYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_FORM_CHOICE_TYPE)) #define RVAL2POPPLERFORMFIELDTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_FORM_FIELD_TYPE)) #define POPPLERFORMFIELDTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_FORM_FIELD_TYPE)) #define RVAL2POPPLERFORMTEXTTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_FORM_TEXT_TYPE)) #define POPPLERFORMTEXTTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_FORM_TEXT_TYPE)) #define RVAL2POPPLERPAGETRANSITIONALIGNMENT(o) (RVAL2GENUM(o, POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT)) #define POPPLERPAGETRANSITIONALIGNMENT2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT)) #define RVAL2POPPLERPAGETRANSITIONDIRECTION(o) (RVAL2GENUM(o, POPPLER_TYPE_PAGE_TRANSITION_DIRECTION)) #define POPPLERPAGETRANSITIONDIRECTION2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_PAGE_TRANSITION_DIRECTION)) #define RVAL2POPPLERPAGETRANSITIONTYPE(o) (RVAL2GENUM(o, POPPLER_TYPE_PAGE_TRANSITION_TYPE)) #define POPPLERPAGETRANSITIONTYPE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_PAGE_TRANSITION_TYPE)) #define RVAL2POPPLERSELECTIONSTYLE(o) (RVAL2GENUM(o, POPPLER_TYPE_SELECTION_STYLE)) #define POPPLERSELECTIONSTYLE2RVAL(o) (GENUM2RVAL(o, POPPLER_TYPE_SELECTION_STYLE)) #endif /* __RBPOPPLERCONVERSIONS_H__ */ ruby-gnome2-all-2.2.5/poppler/ext/poppler/rbpoppler-annotation-text.c0000644000175000017500000000311412257552170024064 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2008-2013 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 "rbpoppler-private.h" #define RG_TARGET_NAMESPACE cAnnotationText #define SELF(self) (RVAL2POPPLERANNOTTEXT(self)) static VALUE rg_open_p(VALUE self) { return CBOOL2RVAL(poppler_annot_text_get_is_open(SELF(self))); } static VALUE rg_icon(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_text_get_icon(SELF(self))); } static VALUE rg_state(VALUE self) { return POPPLERANNOTTEXTSTATE2RVAL(poppler_annot_text_get_state(SELF(self))); } void Init_poppler_annotation_text(VALUE mPoppler) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_ANNOT_TEXT, "AnnotationText", mPoppler); RG_DEF_METHOD_P(open, 0); RG_DEF_METHOD(icon, 0); RG_DEF_METHOD(state, 0); } ruby-gnome2-all-2.2.5/poppler/COPYING.LIB0000644000175000017500000006364212257552170015754 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/poppler/lib/0000755000175000017500000000000012446160551015045 5ustar koukouruby-gnome2-all-2.2.5/poppler/lib/poppler.rb0000644000175000017500000000466012446160551017061 0ustar koukou# Copyright(C) 2006-2009 Ruby-GNOME2 Project. # # 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. # # Foobar 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 Foobar. If not, see . require "tempfile" require "date" require "glib2" require "gdk_pixbuf2" require "cairo" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/poppler.so" rescue LoadError require "poppler.so" end module Poppler LOG_DOMAIN = "Poppler" VERSION = version.split(".").collect {|x| x.to_i} class Document private def pdf_data?(data) /\A%PDF-1\.\d/ =~ data end def ensure_uri(uri) if pdf_data?(uri) @pdf = Tempfile.new("ruby-poppler-pdf") @pdf.binmode @pdf.print(uri) @pdf.close uri = @pdf.path end if GLib.path_is_absolute?(uri) GLib.filename_to_uri(uri) elsif /\A[a-zA-Z][a-zA-Z\d\-+.]*:/.match(uri) uri else GLib.filename_to_uri(File.expand_path(uri)) end end end if defined?(TextField) class TextField def multiline? type == FormTextType::MULTILINE end def file_select? type == FormTextType::FILE_SELECT end def normal? type == FormTextType::NORMAL end end end if defined?(ChoiceField) class ChoiceField def combo? type == FormChioceType::COMBO end def list? type == FormChoiceType::LIST end end end end if Poppler.cairo_available? module Cairo class Context def render_poppler_page(page, *args, &block) page.render(self, *args, &block) end def render_poppler_page_selection(page, *args, &block) page.render_selection(self, *args, &block) end end end end GLib::Log.set_log_domain(Poppler::LOG_DOMAIN) ruby-gnome2-all-2.2.5/poppler/README0000644000175000017500000000140612257552170015162 0ustar koukouRuby/Poppler ============ Ruby/Poppler is a Ruby binding of poppler-glib. Requirements ------------ Ruby: http://www.ruby-lang.org/ poppler-glib [*]: http://poppler.freedesktop.org/ Ruby/GLib2: http://ruby-gnome2.sourceforge.net/ cairo/rcairo: http://cairographics.org/ (optional) [*]: 0.12.0 or later is requried. Install ------- 0. install ruby and poppler-glib. 1. ruby extconf.rb 2. make 3. su 4. make install Copying ------- Copyright (c) 2002-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/poppler/sample/0000755000175000017500000000000012257552170015562 5ustar koukouruby-gnome2-all-2.2.5/poppler/sample/pdf2.rb0000755000175000017500000000656112257552170016755 0ustar koukou#!/usr/bin/env ruby require "tempfile" require "optparse" require "poppler" require "gdk_pixbuf2" page = 0 scale = 1.0 rotate = 0 parser = OptionParser.new parser.banner = <<-BANNER Usage: #{parser.program_name} INPUT.PDF OUTPUT [options] #{parser.program_name} coverts the target page in INPUT.PDF to an image file. Many popular image formats such as PNG and JPEG are supported. You can specify output image format by OUTPUT file extension. For example, the following comand generates PNG file: % #{$0} INPUT.PDF OUTPUT.png BANNER parser.on("--page=PAGE", Integer, "Use PAGE as the target page", "(0-origin)", "[#{page}]") do |value| page = value.to_i end parser.on("--scale=RATIO", Float, "Scale the target page in INPUT.PDF RATIO times larger in OUTPUT", "[#{scale}]") do |value| scale = value.to_f end parser.on("--rotate=DEGREE", Integer, "Rotate the target page in INPUT.PDF DEGREE degrees clockwise in OUTPUT", "(available values: 0...360)", "[#{rotate}]") do |value| rotate = value.to_i % 360 end rest_args = parser.parse! if rest_args.size != 2 puts(parser.help) exit(false) end input, output = rest_args ext_name = File.extname(output)[1..-1] if ext_name output_type = ext_name.downcase output_type = "jpeg" if /jpg/ =~ output_type else output_type = "png" end def compute_size(width, height, rotate) width = width.to_f height = height.to_f radius = 0 unless rotate.zero? radius = rotate / 180.0 * Math::PI if (90 < rotate and rotate < 180) or (270 < rotate and rotate < 360) radius -= Math::PI / 2 end end inner_angle1 = Math.atan(width / height) inner_angle2 = Math.atan(height / width) diagonal = Math.sqrt(width ** 2 + height ** 2) angle1 = radius + inner_angle1 angle2 = radius + inner_angle2 bottom1 = diagonal * Math.cos(angle1) length1 = (bottom1 * Math.tan(angle1)).abs.to_i bottom2 = diagonal * Math.cos(angle2) length2 = (bottom2 * Math.tan(angle2)).abs.to_i if (0 <= rotate and rotate <= 90) or (180 <= rotate and rotate <= 270) [length1, length2] else [length2, length1] end end def to_pixbuf_with_cairo(input, page_number, scale, rotate) doc = Poppler::Document.new(input) page = doc[page_number] width, height = page.size.collect {|x| x * scale} surface_width, surface_height = compute_size(width, height, rotate) surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, surface_width, surface_height) cr = Cairo::Context.new(surface) half_width = surface_width / 2.0 half_height = surface_height / 2.0 cr.translate(half_width, half_height) cr.rotate(rotate / 180.0 * Math::PI) cr.translate(-half_width, -half_height) cr.translate((surface_width - width) / 2.0, (surface_height - height) / 2.0) cr.set_source_rgb(1, 1, 1) cr.rectangle(0, 0, width, height) cr.fill cr.scale(scale, scale) cr.render_poppler_page(page) temp = Tempfile.new("pdf2") cr.target.write_to_png(temp.path) cr.target.finish Gdk::Pixbuf.new(temp.path) end unless Poppler.cairo_available? puts "cairo isn't available." exit(false) end pixbuf = to_pixbuf_with_cairo(input, page, scale, rotate) if pixbuf.nil? puts "Is it a PDF file?: #{input}" exit(-1) end puts "saving to #{output}(#{pixbuf.width}x#{pixbuf.height})..." pixbuf.save(output, output_type) ruby-gnome2-all-2.2.5/poppler/sample/pdf2svg.rb0000755000175000017500000000074511701304107017457 0ustar koukou#!/usr/bin/env ruby require "poppler" if ARGV.size < 1 puts "usage: #{$0} input.pdf" exit(-1) end input, = ARGV output = input.sub(/\..+$/, ".svg") output = "#{output}.svg" if input == output doc = Poppler::Document.new(input) width, height = doc.pages[0].size Cairo::SVGSurface.new(output, width, height) do |surface| surface.restrict_to_version("1_2") context = Cairo::Context.new(surface) doc.each do |page| page.render(context) context.show_page end end ruby-gnome2-all-2.2.5/poppler/sample/pdf2text.rb0000755000175000017500000000040011701304107017630 0ustar koukou#!/usr/bin/env ruby require "poppler" if ARGV.size < 1 puts "usage: #{$0} input.pdf" exit(-1) end input = ARGV.shift input_uri = "file://#{File.expand_path(input)}" doc = Poppler::Document.new(input_uri) doc.each do |page| puts page.get_text end ruby-gnome2-all-2.2.5/poppler/sample/number-pdf.rb0000755000175000017500000000156311701304107020142 0ustar koukou#!/usr/bin/env ruby require 'poppler' input = ARGV.first output = input.sub(/\.pdf$/, "-numbered.pdf") doc = Poppler::Document.new(input) first_page = doc[0] Cairo::PDFSurface.new(output, *first_page.size) do |surface| context = Cairo::Context.new(surface) doc.each_with_index do |page, i| width, height = page.size surface.set_size(width, height) context.save do context.render_poppler_page(page) end context.save do layout = context.create_pango_layout layout.text = i.to_s layout.width = width * Pango::SCALE layout.alignment = Pango::Layout::ALIGN_CENTER layout.font_description = Pango::FontDescription.new("Sans 288") context.move_to(0, (height - layout.pixel_size[1]) / 2.0) context.set_source_rgba(0.1, 0.1, 0.1, 0.5) context.show_pango_layout(layout) end context.show_page end end ruby-gnome2-all-2.2.5/poppler/sample/pdfcrop.rb0000755000175000017500000000132511701304107017534 0ustar koukou#!/usr/bin/env ruby require "poppler" if ARGV.size != 2 puts "usage: #{$0} input.pdf output.pdf" exit(-1) end input, output = ARGV doc = Poppler::Document.new(input) width, height = doc.pages[0].size x_margin = width * 0.1 y_margin = height * 0.1 croped_width = width - (2 * x_margin) croped_height = height - (2 * y_margin) Cairo::PDFSurface.new(output, croped_width, croped_height) do |surface| context = Cairo::Context.new(surface) doc.each do |page| width, height = page.size context.save do context.translate(-x_margin, -y_margin) context.rectangle(x_margin, y_margin, croped_width, croped_height) context.clip page.render(context) context.show_page end end end ruby-gnome2-all-2.2.5/poppler/sample/pdfdiv.rb0000755000175000017500000000135211701304107017353 0ustar koukou#!/usr/bin/env ruby require "poppler" if ARGV.size != 2 puts "usage: #{$0} input.pdf output.pdf" exit(-1) end input, output = ARGV doc = Poppler::Document.new(input) width, height = doc.pages[0].size Cairo::PDFSurface.new(output, width / 2, height) do |surface| context = Cairo::Context.new(surface) doc.each do |page| width, height = page.size half_width = width / 2 context.save do context.rectangle(0, 0, half_width, height) context.clip page.render(context) context.show_page end context.save do context.translate(-half_width, 0) context.rectangle(half_width, 0, half_width, height) context.clip page.render(context) context.show_page end end end ruby-gnome2-all-2.2.5/README.md0000644000175000017500000000707612446160551014107 0ustar koukou# README [![Build Status](https://travis-ci.org/ruby-gnome2/ruby-gnome2.svg?branch=master)](https://travis-ci.org/ruby-gnome2/ruby-gnome2) ## Ruby-GNOME2 -- Ruby bindings for GNOME-2.x This is a set of bindings for the GNOME-2.x and GNOME-3.x libraries to use from Ruby 1.9.x, 2.0.0 and 2.1. ## Release packages ### ruby-gtk2 * Ruby/GLib2: GLib 2.12.x or later * Ruby/ATK: ATK 1.12.x or later * Ruby/Pango: Pango 1.14.x or later * Ruby/GdkPixbuf2: GTK+ 2.0.x or later * Ruby/GTK2: GTK+ 2.10.x or later * Ruby/GObjectIntrospection: GObject Introspection 1.32.1 or later ### ruby-gtk3 * ruby-gtk2 - Ruby/GTK2 * Ruby/GDK3: GTK+ 3.4.2 or later * Ruby/GTK3: GTK+ 3.4.2 or later ### ruby-gnome2-all * ruby-gtk2 + ruby-gtk3 * Ruby/RSVG: librsvg 2.8.0 or later * Ruby/Poppler: poppler-glib 0.8.0 or later * Ruby/VTE VTE 0.12.1 or later * Ruby/GtkSourceView2: GtkSourceView 2.0.0 or later * Ruby/GIO2: GIO 2.16.x or later * Ruby/CairoGObject: cairo-gobject 1.12.10 or later * Ruby/Clutter: Clutter 1.12.0 or later * Ruby/ClutterGTK: Clutter-GTK 1.2.0 or later * Ruby/ClutterGStreamer:Clutter-GStreamer 2.0.0 or later * Ruby/GtkSourceView3: GtkSourceView 3.4.2 or later * Ruby/VTE3: VTE 0.32.2 or later * Ruby/WebKitGTK: WebKitGTK+ 1.8.1 or later (for GTK+ 3) * Ruby/WebKitGTK2: WebKitGTK+ 1.8.1 or later (for GTK+ 2) * Ruby/GStreamer: GStreamer 1.0.0 or later ### Experimental / Incomplete: * ... ## Install % ruby extconf.rb % make % sudo make install To compile and install a particular sub-binding, you can add arguments: % ruby extconf.rb [subdir]... e.g.) ruby extconf.rb glib2 pango atk gdk_pixbuf2 gtk2 Or you can compile each sub-binding: % cd % ruby extconf.rb % make % sudo make install ### extconf.rb options * `--ruby` * ruby directory * `--topsrcdir` * top source directory * `--topdir` * top directory * `--strict` * if some libraries fail to compile/install, "make" command returns 1(exit 1) ### Environment Variables * `CAIRO_PATH` * rcairo path (for Win32). ### Dependencies You should install a sub-binding with its dependencies. The current dependencies are: * Ruby/GLib * none. * Ruby/ATK * depends on Ruby/GLib. * Ruby/Pango * depends on Ruby/GLib, rcairo. * Ruby/GdkPixbuf * depends on Ruby/GLib. * Ruby/GTK * depends on Ruby/GLib, Ruby/ATK, Ruby/Pango, Ruby/GdkPixbuf, rcairo * Ruby/RSVG * depends on Ruby/GLib, Ruby/GdkPixbuf2. * Ruby/Poppler * depends on Ruby/GLib, Ruby/GdkPixbuf(optional), rcairo. * Ruby/VTE * depends on Ruby/GTK. * Ruby/GtkSourceView2 * depends on Ruby/GTK. * Ruby/GIO2 * depends on Ruby/GLib. * Ruby/GStreamer * depends on Ruby/GLib. ### Experimental * ... ## Bugs Please report bugs either in our bug tracker * [https://github.com/ruby-gnome2/ruby-gnome2/issues](https://github.com/ruby-gnome2/ruby-gnome2/issues) (current) * [http://sourceforge.net/tracker/?group_id=53614&atid=470969](http://sourceforge.net/tracker/?group_id=53614&atid=470969) (previous) or on the ruby-gnome2-devel-en / ruby-gnome2-devel-ja mailing list * [http://sourceforge.net/mail/?group_id=53614](http://sourceforge.net/mail/?group_id=53614) ## Copying Copyright (c) 2002-2014 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website [http://ruby-gnome2.sourceforge.jp/](http://ruby-gnome2.sourceforge.jp/) ruby-gnome2-all-2.2.5/gtksourceview2/0000755000175000017500000000000012516441042015574 5ustar koukouruby-gnome2-all-2.2.5/gtksourceview2/test/0000755000175000017500000000000012307003726016554 5ustar koukouruby-gnome2-all-2.2.5/gtksourceview2/test/run-test.rb0000755000175000017500000000214511701304107020661 0ustar koukou#!/usr/bin/env ruby ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gtk_base = File.join(ruby_gnome2_base, "gtk2") gtk_source_view2_base = File.join(ruby_gnome2_base, "gtksourceview2") $LOAD_PATH.unshift(glib_base) require 'test/glib-test-init' [glib_base, atk_base, pango_base, gdk_pixbuf_base, gtk_base, gtk_source_view2_base].each do |target| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(1) end $LOAD_PATH.unshift(File.join(target, "ext", File.basename(target))) $LOAD_PATH.unshift(File.join(target, "src")) $LOAD_PATH.unshift(File.join(target, "src", "lib")) $LOAD_PATH.unshift(File.join(target)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(gtk_base, "test")) require 'gtk-test-utils' require 'gtksourceview2' exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/gtksourceview2/test/test_source_view.rb0000644000175000017500000000105412307003726022472 0ustar koukou# -*- coding: utf-8 -*- class TestSourceView < Test::Unit::TestCase def test_mark_category_background view = Gtk::SourceView.new red_rgb = [65535, 0, 0] red_color = Gdk::Color.parse("red") assert_nil(view.get_mark_category_background("new-category")) view.set_mark_category_background("new-category", red_color) assert_equal(red_rgb, view.get_mark_category_background("new-category").to_a) view.set_mark_category_background("new-category", nil) assert_nil(view.get_mark_category_background("new-category")) end end ruby-gnome2-all-2.2.5/gtksourceview2/extconf.rb0000644000175000017500000000223511701304107017564 0ustar koukou#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "gtksourceview2" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ruby-gnome2-all-2.2.5/gtksourceview2/Rakefile0000644000175000017500000000073312446160551017251 0ustar koukou# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2/rake/package-task' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x." package.description = "Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x." package.dependency.gem.runtime = ["gtk2"] package.windows.packages = ["gtksourceview"] package.windows.dependencies = ["libxml2"] end package_task.define ruby-gnome2-all-2.2.5/gtksourceview2/ext/0000755000175000017500000000000011701304107016367 5ustar koukouruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/0000755000175000017500000000000012446160551021364 5ustar koukouruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcebuffer.c0000644000175000017500000002526111701304107025250 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" #define RG_TARGET_NAMESPACE cSourceBuffer /* Class: Gtk::SourceBuffer * Text buffer object for Gtk::SourceView. */ #define _SELF(self) (GTK_SOURCE_BUFFER(RVAL2GOBJ(self))) #define RVAL2ITR(i) ((GtkTextIter*)RVAL2BOXED(i, GTK_TYPE_TEXT_ITER)) /* * Class method: new(obj=nil) * obj: either a Gtk::TextTagTable, a Gtk::SourceLanguage, or nil. * * Creates a new source buffer. If a Gtk::SourceTagTable is provided, the * buffer will use it, otherwise it will create a new one. * * If a Gtk::SourceLanguage object is given, the buffer will be created * using highlightings patterns in this language. This is equivalent to * creating a new source buffer with the default tag table and then setting * the 'language' property. * * Returns: a newly created Gtk::SourceBuffer object. */ static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE val; rb_scan_args (argc, argv, "01", &val); if (NIL_P (val)) { G_INITIALIZE (self, gtk_source_buffer_new (NULL)); } else if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_TEXT_TAG_TABLE))) { G_INITIALIZE (self, gtk_source_buffer_new (GTK_TEXT_TAG_TABLE (RVAL2GOBJ (val)))); } else if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_SOURCE_LANGUAGE))) { G_INITIALIZE (self, gtk_source_buffer_new_with_language (GTK_SOURCE_LANGUAGE (RVAL2GOBJ (val)))); } else { rb_raise (rb_eArgError, "invalid argument %s (expect nil, Gtk::TextTagTable or Gtk::SourceLanguage)", rb_class2name (CLASS_OF (val))); } return Qnil; } /* * Method: redo! * * Redoes the last undo operation. Use Gtk::SourceBuffer#can_redo? to check * whether a call to this function will have any effect. * * Returns: self. */ static VALUE rg_redo_bang(VALUE self) { gtk_source_buffer_redo (_SELF (self)); return self; } /* * Method: undo! * * Undoes the last user action which modified the buffer. * Use Gtk::SourceBuffer#can_undo? to check whether a call to this function * will have any effect. * * Actions are defined as groups of operations between a call to * Gtk::TextBuffer#begin_user_action and Gtk::TextBuffer#end_user_action, * or sequences of similar edits (inserts or deletes) on the same line. * * Returns: self. */ static VALUE rg_undo_bang(VALUE self) { gtk_source_buffer_undo (_SELF (self)); return self; } /* * Method: begin_not_undoable_action * Method: begin_not_undoable_action { ... } * * Marks the beginning of a not undoable action on the buffer, disabling the * undo manager. * * If a block is given, the block is called after marking the beginning * of a not undoable action on the buffer. * At the end of the block, marks the end of a not undoable action on the * buffer. When the last not undoable block is finished, the list of undo * actions is cleared and the undo manager is re-enabled. * * Returns: self */ static VALUE rg_begin_not_undoable_action(VALUE self) { gtk_source_buffer_begin_not_undoable_action (_SELF (self)); if (rb_block_given_p()) { VALUE block = rb_block_proc (); rb_funcall (block, rb_intern ("call"), 0); gtk_source_buffer_end_not_undoable_action (_SELF (self)); } return self; } /* * Method: end_not_undoable_action * * Marks the end of a not undoable action on the buffer. * When the last not undoable block is finished, the list of undo * actions is cleared and the undo manager is re-enabled. * * Returns: self */ static VALUE rg_end_not_undoable_action(VALUE self) { gtk_source_buffer_end_not_undoable_action (_SELF (self)); return self; } /* * Method: not_undoable_action { ... } * * Marks the beginning of a not undoable action on the buffer, disabling the * undo manager, then calls the provided block of code. * * At the end of the block, marks the end of a not undoable action on the * buffer. When the last not undoable block is finished, the list of undo * actions is cleared and the undo manager is re-enabled. * * ((*Deprecated*)). Use Gtk::SourceView#begin_not_undoable_action{ ... } instead. * * Returns: the return value of the provided block. */ static VALUE rg_not_undoable_action(VALUE self) { VALUE block, ret; block = rb_block_proc (); gtk_source_buffer_begin_not_undoable_action (_SELF (self)); ret = rb_funcall (block, rb_intern ("call"), 0); gtk_source_buffer_end_not_undoable_action (_SELF (self)); return ret; } #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE /* * Method: create_source_mark(name=nil, category, where) * name: the name of the mark. * type: a string defining the mark type. * where: a location to place the mark, as a Gtk::TreeIter object. * * Creates a mark in the buffer of the given type. A mark is semantically * very similar to a Gtk::TextMark, except it has a type which is used by the * Gtk::SourceView object displaying the buffer to show a pixmap on the left * margin, at the line the mark is in. Because of this, a mark is generally * associated to a line and not a character position. Marks are also * accessible through a position or range in the buffer. * * Marks are implemented using Gtk::TextMark, so all characteristics and * restrictions to marks apply to marks too. These includes life cycle issues * and "mark-set" and "mark-deleted" signal emissions. * * Like a Gtk::TextMark, a Gtk::SourceMark can be anonymous if the passed * name is nil. * * Marks always have left gravity and are moved to the beginning of the line * when the user deletes the line they were in. Also, if the user deletes a * region of text which contained lines with marks, those are deleted. * * Typical uses for a mark are bookmarks, breakpoints, current executing * instruction indication in a source file, etc.. * * Returns: a new Gtk::SourceMark object, owned by the buffer. */ static VALUE rg_create_source_mark(int argc, VALUE *argv, VALUE self) { VALUE name, category, where; if (argc == 2) rb_scan_args (argc, argv, "21", &where, &category, &name); else rb_scan_args (argc, argv, "30", &name, &category, &where); return GOBJ2RVAL (gtk_source_buffer_create_source_mark (_SELF (self), RVAL2CSTR (name), RVAL2CSTR (category), RVAL2ITR (where))); } static VALUE rg_get_source_marks_at_line(int argc, VALUE *argv, VALUE self) { GSList *list, *p; VALUE line, category; VALUE ary; rb_scan_args (argc, argv, "11", &line, &category); list = gtk_source_buffer_get_source_marks_at_line (_SELF (self), NUM2INT (line), NIL_P (category) ? NULL : RVAL2CSTR (category)); ary = rb_ary_new (); p = (GSList *) list; while (p) { rb_ary_push (ary, GOBJ2RVAL (p->data)); p = g_slist_next (p); } return ary; } static VALUE rg_get_source_marks_at_iter(int argc, VALUE *argv, VALUE self) { GSList *list, *p; VALUE iter, category; VALUE ary; rb_scan_args (argc, argv, "11", &iter, &category); list = gtk_source_buffer_get_source_marks_at_iter (_SELF (self), RVAL2ITR (iter), NIL_P (category) ? NULL : RVAL2CSTR (category)); ary = rb_ary_new (); p = (GSList *) list; while (p) { rb_ary_push (ary, GOBJ2RVAL (p->data)); p = g_slist_next (p); } return ary; } static VALUE rg_remove_source_marks(int argc, VALUE *argv, VALUE self) { VALUE start, end, category; rb_scan_args (argc, argv, "21", &start, &end, &category); gtk_source_buffer_remove_source_marks (_SELF (self), RVAL2ITR (start), RVAL2ITR (end), NIL_P (category) ? NULL : RVAL2CSTR (category)); return self; } static VALUE rg_forward_iter_to_source_mark(int argc, VALUE *argv, VALUE self) { VALUE iter, category; rb_scan_args (argc, argv, "11", &iter, &category); return CBOOL2RVAL (gtk_source_buffer_forward_iter_to_source_mark (_SELF (self), RVAL2ITR (iter), NIL_P (category) ? NULL : RVAL2CSTR (category))); } static VALUE rg_backward_iter_to_source_mark(int argc, VALUE *argv, VALUE self) { VALUE iter, category; rb_scan_args (argc, argv, "11", &iter, &category); return CBOOL2RVAL (gtk_source_buffer_backward_iter_to_source_mark (_SELF (self), RVAL2ITR (iter), NIL_P (category) ? NULL : RVAL2CSTR (category))); } #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */ static VALUE rg_ensure_highlight(VALUE self, VALUE start, VALUE end) { gtk_source_buffer_ensure_highlight (_SELF (self), RVAL2ITR (start), RVAL2ITR (end)); return self; } void Init_gtk_sourcebuffer (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_BUFFER, "SourceBuffer", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD_BANG(redo, 0); RG_DEF_METHOD_BANG(undo, 0); RG_DEF_METHOD(begin_not_undoable_action, 0); RG_DEF_METHOD(end_not_undoable_action, 0); RG_DEF_METHOD(not_undoable_action, 0); RG_DEF_ALIAS("non_undoable_action", "not_undoable_action"); #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE RG_DEF_METHOD(create_source_mark, -1); RG_DEF_METHOD(get_source_marks_at_line, -1); RG_DEF_METHOD(get_source_marks_at_iter, -1); RG_DEF_METHOD(remove_source_marks, -1); RG_DEF_METHOD(forward_iter_to_source_mark, -1); RG_DEF_METHOD(backward_iter_to_source_mark, -1); #endif RG_DEF_METHOD(ensure_highlight, 2); G_DEF_SETTERS (RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourceprintcompositor.c0000644000175000017500000001333311701304107027247 0ustar koukou/* -*- 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 "rbgtksourcemain.h" #ifdef HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE /* Module: Gtk::SourcePrintCompositor */ #define RG_TARGET_NAMESPACE cSourcePrintCompositor #define _SELF(self) (GTK_SOURCE_PRINT_COMPOSITOR(RVAL2GOBJ(self))) #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT)) /* * Class method: new(buffer) * buffer: a Gtk::SourceBuffer or Gtk::SourceView object. * * Creates a new print compositor to print buffer. * * Returns: the new print compositor object. */ static VALUE rg_initialize(VALUE self, VALUE val) { if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_SOURCE_BUFFER))) { G_INITIALIZE(self, gtk_source_print_compositor_new (GTK_SOURCE_BUFFER (RVAL2GOBJ (val)))); } else if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_SOURCE_VIEW))) { G_INITIALIZE(self, gtk_source_print_compositor_new_from_view (GTK_SOURCE_VIEW (RVAL2GOBJ (val)))); } else { rb_raise (rb_eArgError, "invalid argument %s (expect Gtk::SourceBuffer or Gtk::SourceView)", rb_class2name (CLASS_OF (val))); } return Qnil; } static VALUE rg_get_top_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_top_margin(_SELF(self), RVAL2UNIT (unit))); } static VALUE rg_set_top_margin(VALUE self, VALUE top, VALUE unit) { gtk_source_print_compositor_set_top_margin(_SELF(self), NUM2DBL(top), RVAL2UNIT (unit)); return self; } static VALUE rg_get_bottom_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_bottom_margin(_SELF(self), RVAL2UNIT (unit))); } static VALUE rg_set_bottom_margin(VALUE self, VALUE bottom, VALUE unit) { gtk_source_print_compositor_set_bottom_margin(_SELF(self), NUM2DBL(bottom), RVAL2UNIT (unit)); return self; } static VALUE rg_get_left_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_left_margin(_SELF(self), RVAL2UNIT (unit))); } static VALUE rg_set_left_margin(VALUE self, VALUE left, VALUE unit) { gtk_source_print_compositor_set_left_margin(_SELF(self), NUM2DBL(left), RVAL2UNIT (unit)); return self; } static VALUE rg_get_right_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_right_margin(_SELF(self), RVAL2UNIT (unit))); } static VALUE rg_set_right_margin(VALUE self, VALUE right, VALUE unit) { gtk_source_print_compositor_set_right_margin(_SELF(self), NUM2DBL(right), RVAL2UNIT (unit)); return self; } static VALUE rg_set_header_format(VALUE self, VALUE separator, VALUE left, VALUE center, VALUE right) { gtk_source_print_compositor_set_header_format(_SELF(self), RVAL2CBOOL(separator), RVAL2CSTR(left), RVAL2CSTR(center), RVAL2CSTR(right)); return self; } static VALUE rg_set_footer_format(VALUE self, VALUE separator, VALUE left, VALUE center, VALUE right) { gtk_source_print_compositor_set_footer_format(_SELF(self), RVAL2CBOOL(separator), RVAL2CSTR(left), RVAL2CSTR(center), RVAL2CSTR(right)); return self; } static VALUE rg_paginate(VALUE self, VALUE context) { return CBOOL2RVAL (gtk_source_print_compositor_paginate (_SELF (self), GTK_PRINT_CONTEXT (RVAL2GOBJ (context)))); } static VALUE rg_pagination_progress(VALUE self) { return DBL2NUM (gtk_source_print_compositor_get_pagination_progress (_SELF (self))); } static VALUE rg_draw_page(VALUE self, VALUE context, VALUE page_nr) { gtk_source_print_compositor_draw_page (_SELF (self), GTK_PRINT_CONTEXT (RVAL2GOBJ (context)), NUM2INT (page_nr)); return self; } #endif /* HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE */ void Init_gtk_sourceprintcompositor(VALUE mGtk) { #ifdef HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SOURCE_PRINT_COMPOSITOR, "SourcePrintCompositor", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(get_top_margin, 1); RG_DEF_METHOD(set_top_margin, 2); RG_DEF_METHOD(get_bottom_margin, 1); RG_DEF_METHOD(set_bottom_margin, 2); RG_DEF_METHOD(get_left_margin, 1); RG_DEF_METHOD(set_left_margin, 2); RG_DEF_METHOD(get_right_margin, 1); RG_DEF_METHOD(set_right_margin, 2); RG_DEF_METHOD(set_header_format, 4); RG_DEF_METHOD(set_footer_format, 4); RG_DEF_METHOD(paginate, 1); RG_DEF_METHOD(pagination_progress, 0); RG_DEF_METHOD(draw_page, 2); G_DEF_SETTERS(RG_TARGET_NAMESPACE); #endif /* HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE */ } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcestyle.c0000644000175000017500000000246411701304107025137 0ustar koukou/* -*- 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 "rbgtksourcemain.h" /* Module: Gtk::SourceStyle */ #define RG_TARGET_NAMESPACE cSourceStyle #define _SELF(self) (GTK_SOURCE_STYLE(RVAL2GOBJ(self))) static VALUE rg_copy(VALUE self) { return GOBJ2RVAL (gtk_source_style_copy (_SELF (self))); } void Init_gtk_sourcestyle (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE, "SourceStyle", mGtk); RG_DEF_METHOD(copy, 0); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/extconf.rb0000644000175000017500000000437712446160551023372 0ustar koukou=begin extconf.rb for Ruby/GtkSourceView2 extension library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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+)\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 = "gtksourceview2" package_id = "gtksourceview-2.0" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ["glib2", "atk", "pango", "gdk_pixbuf2", "gtk2"].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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libgtksourceview2.0-dev", :redhat => "gtksourceview2-devel", :homebrew => "gtksourceview", :macports => "gtksourceview2") exit(false) end # 2.2 have_func('gtk_source_mark_get_type', "gtksourceview/gtksourcemark.h") have_func('gtk_source_print_compositor_get_type', "gtksourceview/gtksourceprintcompositor.h") # 2.4 have_func('gtk_source_view_get_mark_category_background', "gtksourceview/gtksourceview.h") have_func('gtk_source_language_manager_guess_language', "gtksourceview/gtksourcelanguagemanager.h") make_version_header("GTKSOURCEVIEW2", package_id, ".") create_pkg_config_file("Ruby/GtkSourceView2", package_id) $defs << "-DRUBY_GTKSOURCEVIEW2_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 ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/depend0000644000175000017500000000026012064346475022553 0ustar koukouinstall: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gtksourceview2.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcestylescheme.c0000644000175000017500000000407611701304107026325 0ustar koukou/* -*- 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 "rbgtksourcemain.h" /* Module: Gtk::SourceStyleScheme */ #define RG_TARGET_NAMESPACE cSourceStyleScheme #define _SELF(self) (GTK_SOURCE_STYLE_SCHEME(RVAL2GOBJ(self))) /* Method: authors * * Returns: a list of authors for the given style scheme. */ static VALUE rg_authors(VALUE self) { VALUE ary; const gchar * const * authors = gtk_source_style_scheme_get_authors (_SELF (self)); if (!authors) return Qnil; ary = rb_ary_new(); while (*authors){ rb_ary_push(ary, CSTR2RVAL(*authors)); authors++; } return ary; } /* Method: get_style(style_id) * style_name: the name of a style. * * Gets the tag associated with the given style_name in the style scheme. * * Returns: Gtk::SourceStyle */ static VALUE rg_get_style(VALUE self, VALUE style_name) { return GOBJ2RVAL(gtk_source_style_scheme_get_style(_SELF(self), RVAL2CSTR(style_name))); } void Init_gtk_sourcestylescheme (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE_SCHEME, "SourceStyleScheme", mGtk); RG_DEF_METHOD(authors, 0); RG_DEF_METHOD(get_style, 1); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourceview.c0000644000175000017500000001453012307003726024754 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" /* Class: Gtk::SourceView * A view on a source. */ #define RG_TARGET_NAMESPACE cSourceView #define _SELF(self) (GTK_SOURCE_VIEW(RVAL2GOBJ(self))) /* * Class method: new(buffer=nil) * buffer: a Gtk::SourceBuffer object. * * Creates a new Gtk::SourceView. If buffer is not provided or nil, an empty * buffer will be created for you. Note that one buffer can be shared among * many widgets. * * Returns: a newly created Gtk::SourceView object. */ static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE buffer; GtkWidget *widget; rb_scan_args(argc, argv, "01", &buffer); if (NIL_P(buffer)) widget = gtk_source_view_new(); else widget = gtk_source_view_new_with_buffer(RVAL2GOBJ(buffer)); RBGTK_INITIALIZE(self, widget); return self; } #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE /* * Method: set_mark_category_pixbuf(category, pixbuf) * category: a category (as a string). * pixbuf: a Gdk::Pixbuf object. * * Associates a given pixbuf with a given category. * * Returns: self. */ static VALUE rg_set_mark_category_pixbuf(VALUE self, VALUE category, VALUE pixbuf) { gtk_source_view_set_mark_category_pixbuf(_SELF(self), RVAL2CSTR(category), GDK_PIXBUF(RVAL2GOBJ(pixbuf))); return self; } /* * Method: get_mark_category_pixbuf(category) * category: a category (as a string). * * Gets the pixbuf which is associated with the given category. * * Returns: a Gdk::Pixbuf object if found, or nil if not found. */ static VALUE rg_get_mark_category_pixbuf(VALUE self, VALUE category) { GdkPixbuf *pixbuf; pixbuf = gtk_source_view_get_mark_category_pixbuf(_SELF(self), RVAL2CSTR(category)); return GOBJ2RVAL(pixbuf); } /* * Method: set_mark_category_priority(category, priority) * category: a category (as a string). * priority: a priority (int). * * Associates a given priority with a given category. * * Returns: self. */ static VALUE rg_set_mark_category_priority(VALUE self, VALUE category, VALUE priority) { gtk_source_view_set_mark_category_priority(_SELF (self), RVAL2CSTR(category), NUM2INT(priority)); return self; } /* * Method: get_mark_category_priority(category) * category: a category (as a string). * * Gets the priority which is associated with the given category. * * Returns: the priority if found, or 0 if not found. */ static VALUE rg_get_mark_category_priority(VALUE self, VALUE category) { gint priority; priority = gtk_source_view_get_mark_category_priority(_SELF(self), RVAL2CSTR(category)); return INT2NUM(priority); } #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */ #ifdef HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND /* * Method: get_mark_category_background(category) * category: a category (as a string). * * Gets the background color which is associated with the given category. * * Returns: a Gdk::Color object if found, or nil if not found. */ static VALUE rg_get_mark_category_background(VALUE self, VALUE category) { GdkColor color; gboolean found; found = gtk_source_view_get_mark_category_background(_SELF (self), RVAL2CSTR(category), &color); if (found) { return GDKCOLOR2RVAL(&color); } else { return Qnil; } } /* * Method: set_mark_category_background(category, color) * category: a category (as a string). * color: a Gdk::Color. * * Sets given background color for mark category. If color is NULL, * the background color is unset. * * Returns: self. */ static VALUE rg_set_mark_category_background(VALUE self, VALUE category, VALUE color) { gtk_source_view_set_mark_category_background(_SELF (self), RVAL2CSTR (category), RVAL2GDKCOLOR((color))); return self; } # endif /* HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND */ void Init_gtk_sourceview (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_VIEW, "SourceView", mGtk); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(GTKSOURCEVIEW2_MAJOR_VERSION), INT2FIX(GTKSOURCEVIEW2_MINOR_VERSION), INT2FIX(GTKSOURCEVIEW2_MICRO_VERSION))); RG_DEF_METHOD(initialize, -1); #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE RG_DEF_METHOD(get_mark_category_pixbuf, 1); RG_DEF_METHOD(set_mark_category_pixbuf, 2); RG_DEF_METHOD(get_mark_category_priority, 1); RG_DEF_METHOD(set_mark_category_priority, 2); #endif #ifdef HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND RG_DEF_METHOD(get_mark_category_background, 1); RG_DEF_METHOD(set_mark_category_background, 2); #endif G_DEF_SETTERS (RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_SOURCE_SMART_HOME_END_TYPE, "SmartHomeEndType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SOURCE_SMART_HOME_END_TYPE, "GTK_SOURCE_"); #ifdef HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND G_DEF_CLASS(GTK_TYPE_SOURCE_DRAW_SPACES_FLAGS, "DrawSpacesFlags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SOURCE_DRAW_SPACES_FLAGS, "GTK_SOURCE_"); #endif } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcemain.h0000644000175000017500000000503212257552170024736 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 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 */ #ifndef __RBGTKSOURCEVIEWMAIN_H_ #define __RBGTKSOURCEVIEWMAIN_H_ #include #include #include #include #include #include #include #include #include #include #include #include "ruby.h" #include "rbgtk.h" #include "rbgtksourceview2version.h" #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) extern void Init_gtksourceview2 (void); G_GNUC_INTERNAL void Init_gtk_sourceview (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcebuffer (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourceiter (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcelanguage (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcelanguagemanager (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcemark (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourceprintcompositor (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcestyle (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcestylescheme (VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_sourcestyleschememanager (VALUE mGtk); #endif /* __RBGTKSOURCEVIEWMAIN_H_ */ ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcestyleschememanager.c0000644000175000017500000000764312307003726027671 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" /* Class: Gtk::SourceStyleSchemeManager * A class to manage source style scheme. */ #define RG_TARGET_NAMESPACE cSourceStyleSchemeManager #define _SELF(self) (GTK_SOURCE_STYLE_SCHEME_MANAGER(RVAL2GOBJ(self))) /* Class method: new * Returns: a newly created Gtk::SourceStyleSchemeManager object. */ static VALUE rg_initialize(VALUE self) { G_INITIALIZE (self, gtk_source_style_scheme_manager_new ()); return Qnil; } /* Class method: default * * Gets the default style scheme manager. * * Returns: a Gtk::SourceStyleSchemeManager */ static VALUE rg_s_default(VALUE self) { GtkSourceStyleSchemeManager* sssm = gtk_source_style_scheme_manager_get_default(); GType gtype = G_TYPE_FROM_INSTANCE(sssm); gchar *gtypename = (gchar *) g_type_name (gtype); if (strncmp (gtypename, "Gtk", 3) == 0) gtypename += 3; if (!rb_const_defined_at (mGtk, rb_intern (gtypename))) G_DEF_CLASS (gtype, gtypename, mGtk); return GOBJ2RVAL(sssm); } /* Method: append_search_path(path) * path: additional style scheme file directory path (string) * * Appends the style scheme files directory for the given style scheme manager. * * Returns: self. */ static VALUE rg_append_search_path(VALUE self, VALUE path) { gtk_source_style_scheme_manager_append_search_path (_SELF (self), RVAL2CSTR(path)); return self; } /* Method: prepend_search_path(path) * path: additional style scheme file directory path (string) * * Prepend the style scheme files directory for the given style scheme manager. * * Returns: self. */ static VALUE rg_prepend_search_path(VALUE self, VALUE path) { gtk_source_style_scheme_manager_prepend_search_path (_SELF (self), RVAL2CSTR(path)); return self; } /* * Method: scheme(scheme_id) * scheme_id: a style scheme id (as a string). * * Gets the Gtk::SourceStyleScheme which is associated with the given id * in the style scheme manager. * * Returns: a Gtk::SourceStyleScheme, or nil if there is no style scheme * associated with the given id. */ static VALUE rg_get_scheme(VALUE self, VALUE scheme_id) { return GOBJ2RVAL (gtk_source_style_scheme_manager_get_scheme (_SELF (self), RVAL2CSTR (scheme_id))); } /* * Method: force_rescan * * Forces all style schemes to be reloaded the next time the * Gtk::SourceStyleSchemeManager is accessed. * * Returns: self. */ static VALUE rg_force_rescan(VALUE self) { gtk_source_style_scheme_manager_force_rescan(_SELF (self)); return self; } void Init_gtk_sourcestyleschememanager (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE_SCHEME_MANAGER, "SourceStyleSchemeManager", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_search_path, 1); RG_DEF_METHOD(prepend_search_path, 1); RG_DEF_METHOD(get_scheme, 1); RG_DEF_METHOD(force_rescan, 0); RG_DEF_SMETHOD(default, 0); G_DEF_SETTERS (RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/gtksourceview2.def0000644000175000017500000000003511701304107025013 0ustar koukouEXPORTS Init_gtksourceview2 ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcemain.c0000644000175000017500000000263712257552170024741 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" void Init_gtksourceview2 (void) { Init_gtk_sourceview (mGtk); Init_gtk_sourcebuffer (mGtk); Init_gtk_sourceiter (mGtk); Init_gtk_sourcelanguage (mGtk); Init_gtk_sourcelanguagemanager (mGtk); Init_gtk_sourcemark (mGtk); Init_gtk_sourceprintcompositor (mGtk); Init_gtk_sourcestyle (mGtk); Init_gtk_sourcestylescheme (mGtk); Init_gtk_sourcestyleschememanager (mGtk); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcelanguagemanager.c0000644000175000017500000000713512307003726027123 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" /* Class: Gtk::SourceLanguageManager * A class to manage source language. */ #define RG_TARGET_NAMESPACE cSourceLanguageManager #define _SELF(self) (GTK_SOURCE_LANGUAGE_MANAGER(RVAL2GOBJ(self))) /* Class method: new * Returns: a newly created Gtk::SourceLanguageManager object. */ static VALUE rg_initialize(VALUE self) { G_INITIALIZE (self, gtk_source_language_manager_new ()); return Qnil; } /* Class method: default * * Gets the default language manager. * * Returns: a Gtk::SourceLanguageManager */ static VALUE rg_s_default(VALUE self) { GtkSourceLanguageManager* slm = gtk_source_language_manager_get_default(); GType gtype = G_TYPE_FROM_INSTANCE(slm); gchar *gtypename = (gchar *) g_type_name (gtype); if (strncmp (gtypename, "Gtk", 3) == 0) gtypename += 3; if (!rb_const_defined_at (mGtk, rb_intern (gtypename))) G_DEF_CLASS (gtype, gtypename, mGtk); return GOBJ2RVAL(slm); } /* * Method: get_language(id) * id: a language id (as a string). * * Gets the Gtk::SourceLanguage which is associated with the given id * in the language manager. * * Returns: a Gtk::SourceLanguage, or nil if there is no language associated * with the given id. */ static VALUE rg_get_language(VALUE self, VALUE id) { return GOBJ2RVAL (gtk_source_language_manager_get_language (_SELF (self), RVAL2CSTR (id))); } #ifdef HAVE_GTK_SOURCE_LANGUAGE_MANAGER_GUESS_LANGUAGE /* * Method: guess_language(filename, content_type) * filename: a file name (as a string), or nil. * content_type: content type (as a string), or nil. * * Guesses the Gtk::SourceLanguage for the given file name and content type. * * Returns: a Gtk::SourceLanguage, or nil if there is no language associated * with the given filename or content_type. */ static VALUE rg_guess_language(VALUE self, VALUE filename, VALUE content_type) { return GOBJ2RVAL (gtk_source_language_manager_guess_language (_SELF (self), NIL_P(filename) ? NULL : RVAL2CSTR (filename), NIL_P(content_type) ? NULL : RVAL2CSTR (content_type))); } #endif /* HAVE_GTK_SOURCE_LANGUAGE_MANAGER_GUESS_LANGUAGE */ void Init_gtk_sourcelanguagemanager (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_LANGUAGE_MANAGER, "SourceLanguageManager", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_language, 1); #ifdef HAVE_GTK_SOURCE_LANGUAGE_MANAGER_GUESS_LANGUAGE RG_DEF_METHOD(guess_language, 2); #endif RG_DEF_SMETHOD(default, 0); G_DEF_SETTERS (RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcelanguage.c0000644000175000017500000000634411701304107025563 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" /* Class: Gtk::SourceLanguage * Source language. */ #define RG_TARGET_NAMESPACE cSourceLanguage #define _SELF(self) (GTK_SOURCE_LANGUAGE(RVAL2GOBJ(self))) /* Method: get_metadata(name) * name: the metadata property name (string) * Returns: the localized metadata for the given name. */ static VALUE rg_get_metadata(VALUE self, VALUE name) { return CSTR2RVAL (gtk_source_language_get_metadata (_SELF (self), RVAL2CSTR(name))); } /* Method: mime_types * Returns: a list of mime types for the given language, as an array of strings. */ static VALUE rg_mime_types(VALUE self) { VALUE ary; char **types = gtk_source_language_get_mime_types (_SELF (self)); if (!types) return Qnil; ary = rb_ary_new(); while (*types){ rb_ary_push(ary, CSTR2RVAL(*types)); types++; } return ary; } /* Method: globs * Returns: a list of globs for the given language, as an array of strings. */ static VALUE rg_globs(VALUE self) { VALUE ary; char **globs = gtk_source_language_get_globs (_SELF (self)); if (!globs) return Qnil; ary = rb_ary_new(); while (*globs){ rb_ary_push(ary, CSTR2RVAL(*globs)); globs++; } return ary; } /* Method: get_style_name(style_id) * style_id: the style id (string) * Returns: the localized style name of the given id. */ static VALUE rg_get_style_name(VALUE self, VALUE style_id) { return CSTR2RVAL (gtk_source_language_get_style_name (_SELF (self), RVAL2CSTR(style_id))); } /* Method: style_id * Returns: the styles defined by the language. */ static VALUE rg_style_ids(VALUE self) { VALUE ary; gchar **ids = gtk_source_language_get_style_ids (_SELF (self)); if (!ids) return Qnil; ary = rb_ary_new(); while (*ids){ rb_ary_push(ary, CSTR2RVAL(*ids)); ids++; } return ary; } void Init_gtk_sourcelanguage (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_LANGUAGE, "SourceLanguage", mGtk); RG_DEF_METHOD(get_metadata, 1); RG_DEF_METHOD(mime_types, 0); RG_DEF_METHOD(globs, 0); RG_DEF_METHOD(get_style_name, 1); RG_DEF_METHOD(style_ids, 0); G_DEF_SETTERS (RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourceiter.c0000644000175000017500000001030112307003726024735 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 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 "rbgtksourcemain.h" #define RG_TARGET_NAMESPACE cTextIter #define _SELF(s) ((GtkTextIter*)RVAL2BOXED(s, GTK_TYPE_TEXT_ITER)) #define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER)) /* Method: forward_search(str, flags, limit) * str: the search string (string) * flags: flags affecting the search (Gtk::SourceSearchFlags) * limit: location of last possible match start, or NULL for start of buffer * Returns: locations of start and end of match. */ static VALUE rg_forward_search(int argc, VALUE *argv, VALUE self) { GtkTextIter m_start, m_end; VALUE str, flags, limit; VALUE ret = Qnil; rb_scan_args (argc, argv, "21", &str, &flags, &limit); if (rb_obj_is_kind_of (flags, GTYPE2CLASS (GTK_TYPE_SOURCE_SEARCH_FLAGS))) { if (gtk_source_iter_forward_search (_SELF (self), RVAL2CSTR (str), RVAL2GFLAGS (flags, GTK_TYPE_SOURCE_SEARCH_FLAGS), &m_start, &m_end, NIL_P (limit) ? NULL : _SELF (limit))) ret = rb_ary_new3 (2, ITR2RVAL (&m_start), ITR2RVAL (&m_end)); } else if (rb_obj_is_kind_of (flags, GTYPE2CLASS (GTK_TYPE_TEXT_SEARCH_FLAGS))) { if (gtk_text_iter_forward_search (_SELF (self), RVAL2CSTR (str), RVAL2GFLAGS (flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start, &m_end, NIL_P (limit) ? NULL : _SELF (limit))) ret = rb_ary_new3 (2, ITR2RVAL (&m_start), ITR2RVAL (&m_end)); } return ret; } /* Method: backward_search(str, flags, limit) * str: the search string (string) * flags: flags affecting the search (Gtk::SourceSearchFlags) * limit: location of last possible match end, or NULL for end of buffer * Returns: locations of start and end of match. */ static VALUE rg_backward_search(int argc, VALUE *argv, VALUE self) { GtkTextIter m_start, m_end; VALUE str, flags, limit; VALUE ret = Qnil; rb_scan_args (argc, argv, "21", &str, &flags, &limit); if (rb_obj_is_kind_of (flags, GTYPE2CLASS (GTK_TYPE_SOURCE_SEARCH_FLAGS))) { if (gtk_source_iter_backward_search (_SELF (self), RVAL2CSTR (str), RVAL2GFLAGS (flags, GTK_TYPE_SOURCE_SEARCH_FLAGS), &m_start, &m_end, NIL_P (limit) ? NULL : _SELF (limit))) ret = rb_ary_new3 (2, ITR2RVAL (&m_start), ITR2RVAL (&m_end)); } else if (rb_obj_is_kind_of (flags, GTYPE2CLASS (GTK_TYPE_TEXT_SEARCH_FLAGS))) { if (gtk_text_iter_backward_search (_SELF (self), RVAL2CSTR (str), RVAL2GFLAGS (flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start, &m_end, NIL_P (limit) ? NULL : _SELF (limit))) ret = rb_ary_new3 (2, ITR2RVAL (&m_start), ITR2RVAL (&m_end)); } return ret; } void Init_gtk_sourceiter (VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS (GTK_TYPE_TEXT_ITER); /* * They are override original Gtk::TextIter#[for|back]ward_search */ RG_REPLACE_ACTION(forward_search, -1); RG_REPLACE_ACTION(backward_search, -1); G_DEF_CLASS(GTK_TYPE_SOURCE_SEARCH_FLAGS, "SourceSearchFlags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SOURCE_SEARCH_FLAGS, "GTK_"); } ruby-gnome2-all-2.2.5/gtksourceview2/ext/gtksourceview2/rbgtksourcemark.c0000644000175000017500000000523111701304107024724 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourcemain.h" #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE /* Class: Gtk::SourceMark * A source mark. */ #define RG_TARGET_NAMESPACE cSourceMark #define _SELF(self) (GTK_SOURCE_MARK(RVAL2GOBJ(self))) /* Class method: new(name, category) * name: mark name (string) * category: marker category (string) * * Returns: a newly created Gtk::SourceMark object. */ static VALUE rg_initialize(VALUE self, VALUE name, VALUE category) { G_INITIALIZE (self, gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR(category))); return Qnil; } /* Method: next(category=nil) * category: the category (string), or nil. * * Returns: the next Gtk::SourceMark after the mark. */ static VALUE rg_next(int argc, VALUE *argv, VALUE self) { VALUE category; rb_scan_args (argc, argv, "01", &category); return GOBJ2RVAL (gtk_source_mark_next (_SELF (self), NIL_P (category) ? NULL : RVAL2CSTR(category))); } /* Method: prev(category=nil) * category: the category (string), or nil. * * Returns: the previous Gtk::SourceMark before the mark. */ static VALUE rg_prev(int argc, VALUE *argv, VALUE self) { VALUE category; rb_scan_args (argc, argv, "01", &category); return GOBJ2RVAL (gtk_source_mark_prev (_SELF (self), NIL_P (category) ? NULL : RVAL2CSTR(category))); } #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */ void Init_gtk_sourcemark (VALUE mGtk) { #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_TYPE_SOURCE_MARK, "SourceMark", mGtk); RG_DEF_METHOD(initialize, 2); RG_DEF_METHOD(next, -1); RG_DEF_METHOD(prev, -1); G_DEF_SETTERS (RG_TARGET_NAMESPACE); #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */ } ruby-gnome2-all-2.2.5/gtksourceview2/COPYING.LIB0000644000175000017500000006364212257552170017256 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/gtksourceview2/lib/0000755000175000017500000000000012307003726016343 5ustar koukouruby-gnome2-all-2.2.5/gtksourceview2/lib/gtksourceview2.rb0000644000175000017500000000075612307003726021663 0ustar koukou=begin gtksourceview2.rb Copyright (c) 2008-2011 Ruby-GNOME2 Project Team This program is licensed under the same licence as Ruby-GNOME2. =end require 'gtk2' base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gtksourceview2.so" rescue LoadError require "gtksourceview2.so" end ruby-gnome2-all-2.2.5/gtksourceview2/README0000644000175000017500000000133512257552170016465 0ustar koukouRuby/GtkSourceView2 =================== Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x. Requirements ------------ Ruby: http://www.ruby-lang.org/ Ruby-GNOME2: http://ruby-gnome2.sourceforge.jp/ GtkSourceView: ftp://ftp.gnome.org/pub/GNOME/sources/gtksourceview Install ------- 0. install ruby 1.9.x or newer, GtkSourceView 2.0.0 or newer, Ruby/GTK2. 1. ruby extconf.rb 2. make 3. su 4. make install Copying ------- Copyright (c) 2008 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/gtksourceview2/sample/0000755000175000017500000000000011701304107017050 5ustar koukouruby-gnome2-all-2.2.5/gtksourceview2/sample/sourcelanguagemanager.rb0000644000175000017500000000071011701304107023732 0ustar koukou#!/usr/bin/env ruby =begin sourcelanguagesmanager.rb - Ruby/GtkSourceView sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: sourcelanguagesmanager.rb,v 1.3 2007/06/03 02:11:07 mutoh Exp $ =end require 'gtksourceview2' s = Gtk::SourceLanguageManager.new s.language_ids.each do |v| puts v end s.search_path.each do |v| puts v end puts s.get_language("html").name ruby-gnome2-all-2.2.5/gtksourceview2/sample/test.rb0000644000175000017500000000142411701304107020355 0ustar koukou#!/usr/bin/env ruby =begin test.rb - Ruby/GtkSourceView2 sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: test.rb,v 1.4 2007/06/03 02:11:07 mutoh Exp $ =end require 'gtksourceview2' w = Gtk::Window.new w.signal_connect("delete-event"){Gtk::main_quit} view = Gtk::SourceView.new w.add(Gtk::ScrolledWindow.new.add(view)) view.show_line_numbers = true view.insert_spaces_instead_of_tabs = true view.indent_width = 4 view.show_right_margin = true view.right_margin_position = 80 lang = Gtk::SourceLanguageManager.new.get_language('ruby') view.buffer.language = lang view.buffer.highlight_syntax = true view.buffer.highlight_matching_brackets = true w.set_default_size(450,300) w.show_all Gtk.main ruby-gnome2-all-2.2.5/exec_make.rb0000644000175000017500000000154011701304107015052 0ustar koukou=begin exec_make.rb is called by top-level Makefile. $Id: exec_make.rb,v 1.5 2005/01/31 10:34:33 mutoh Exp $ Copyright (C) 2003-2005 Ruby-GNOME2 Project Team =end argv = ARGV strict = false if ARGV[0] == "--strict" || ARGV[0] == "-s" strict = true argv = ARGV[1..-1] end SUBDIRS = argv[0].split(" ") EXECUTE = argv[1..-1].join(' ') success = [] failure = [] SUBDIRS.each do |subdir| Dir.chdir(subdir) begin ret = system(EXECUTE) ensure Dir.chdir("..") end if ret success << subdir else failure << subdir end end success << "NONE" if success.size == 0 failure << "NONE" if failure.size == 0 puts "\n" puts "-----" puts "SUCCEEDED: #{success.join(' ')}" if success.size > 0 puts "FAILED: #{failure.join(' ')}" if failure.size > 0 puts "-----" puts "Done." if strict && (failure.select { |x| x != "NONE" }.length > 0) exit(1) end ruby-gnome2-all-2.2.5/gio2/0000755000175000017500000000000012516441042013451 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/0000755000175000017500000000000012516434313014433 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/test-charset-converter.rb0000644000175000017500000000166212307003726021376 0ustar koukou# Copyright (C) 2013 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 class TestCharsetConverter < Test::Unit::TestCase def test_converter assert_nothing_raised do Gio::CharsetConverter.new("UTF-8", "ASCII") end end end ruby-gnome2-all-2.2.5/gio2/test/test-inet-address.rb0000644000175000017500000000231212307003726020313 0ustar koukou# Copyright (C) 2013-2014 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 class TestInetAddress < Test::Unit::TestCase class TestConstructor < self def test_string address = Gio::InetAddress.new("127.0.0.1") assert_equal("127.0.0.1", address.to_s) end def test_any address = Gio::InetAddress.any(:ipv4) assert_predicate(address, :any?) end def test_loopback address = Gio::InetAddress.loopback(:ipv4) assert_predicate(address, :loopback?) end end end ruby-gnome2-all-2.2.5/gio2/test/test-data-input-stream.rb0000644000175000017500000000173312307003726021276 0ustar koukou# Copyright (C) 2013 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 class TestDataInputStream < Test::Unit::TestCase def test_byte_order_property assert_equal Gio::DataStreamByteOrder::BIG_ENDIAN, Gio::DataInputStream.new(Gio::MemoryInputStream.new).byte_order end end ruby-gnome2-all-2.2.5/gio2/test/test-content-type.rb0000644000175000017500000000244312446160551020373 0ustar koukou# Copyright (C) 2014 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 class TestContentType < Test::Unit::TestCase include GioTestUtils::Omissions def setup @content_type = Gio::ContentType.new("image/jpeg") end def test_icon assert_equal("image-jpeg", @content_type.icon.names.first) end def test_guess omit_on_os_x assert_equal(["audio/mpeg", false], Gio::ContentType.guess("filename.mp3")) end def test_executable content_type = Gio::ContentType.new("application/x-executable") assert_true(content_type.executable?) end end ruby-gnome2-all-2.2.5/gio2/test/test-dbus.rb0000644000175000017500000000254012446160551016675 0ustar koukou# Copyright (C) 2014 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 class TestDBus < Test::Unit::TestCase def test_dbus_guid guid = Gio::DBus.generate_guid assert_true(Gio::DBus.guid?(guid)) end def test_dbus_name name = "org.freedesktop.DBus" assert_true(Gio::DBus.name?(name)) end def test_dbus_unique_name name = ":org.freedesktop.DBus" assert_true(Gio::DBus.unique_name?(name)) end def test_dbus_interface_name name = "org.freedesktop.DBus" assert_true(Gio::DBus.interface_name?(name)) end def test_dbus_member_name member = "StartServiceByName" assert_true(Gio::DBus.member_name?(member)) end end ruby-gnome2-all-2.2.5/gio2/test/test-memory-input-stream.rb0000644000175000017500000000165412446160551021703 0ustar koukou# Copyright (C) 2014 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 class TestMemoryInputStream < Test::Unit::TestCase def test_memory_input_stream assert_nothing_raised do Gio::MemoryInputStream.new end end end ruby-gnome2-all-2.2.5/gio2/test/test-pollable-output-stream.rb0000644000175000017500000000271212307003726022356 0ustar koukou# Copyright (C) 2014 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 class TestPollableOutputStream < Test::Unit::TestCase include GioTestUtils::SocketClient def setup setup_socket_client @stream = @connection.output_stream end def teardown teardown_socket_client end def test_create_socket called = false source = @stream.create_source do |stream| called = true false end source.attach GLib::Idle.add do @loop.quit end @loop.run assert_true(called) end def test_write_nonblocking data = "Hello\n" assert_equal(data.bytesize, @stream.write_nonblocking(data)) client = @server.accept begin assert_equal(data, client.gets) ensure client.close end end end ruby-gnome2-all-2.2.5/gio2/test/test-pollable-input-stream.rb0000644000175000017500000000274512307003726022163 0ustar koukou# Copyright (C) 2014 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 class TestPollableInputStream < Test::Unit::TestCase include GioTestUtils::SocketClient def setup setup_socket_client @stream = @connection.input_stream end def teardown teardown_socket_client end def test_create_socket called = false source = @stream.create_source do |stream| called = true false end source.attach client = @server.accept client.write("Hello\n") client.flush GLib::Idle.add do client.close @loop.quit end @loop.run assert_true(called) end def test_read_nonblocking data = "Hello\n" client = @server.accept client.write(data) client.flush assert_equal(data, @stream.read_nonblocking) end end ruby-gnome2-all-2.2.5/gio2/test/run-test.rb0000755000175000017500000000337012516434313016547 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2013-2014 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") gio2_base = File.join(ruby_gnome2_base, "gio2") modules = [ [glib_base, "glib2"], [gobject_introspection_base, "gobject-introspection"], [gio2_base, "gio2"], ] modules.each do |target, module_name| makefile = File.join(target, "Makefile") if File.exist?(makefile) and system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $VERBOSE = false # TODO: remove me $LOAD_PATH.unshift(File.join(gio2_base, "test")) require "gio2-test-utils" require "gio2" exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/gio2/test/test-buffered-input-stream.rb0000644000175000017500000000171412307003726022146 0ustar koukou# Copyright (C) 2013 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 class TestBufferedInputStream < Test::Unit::TestCase def test_buffered_input_stream assert_nothing_raised do Gio::BufferedInputStream.new(Gio::FileInputStream.new) end end end ruby-gnome2-all-2.2.5/gio2/test/test-file.rb0000644000175000017500000000225412416346617016667 0ustar koukou# Copyright (C) 2014 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 class TestFile < Test::Unit::TestCase include GioTestUtils::Fixture include GioTestUtils::Omissions class TestContentType < self def test_guess_content_type omit_on_os_x path = fixture_path("content-type", "x-content", "unix-software") dir = Gio::File.path(path) assert_equal(["x-content/unix-software"], dir.guess_content_types.collect(&:to_s)) end end end ruby-gnome2-all-2.2.5/gio2/test/test-input-stream.rb0000644000175000017500000000217012307003726020363 0ustar koukou# Copyright (C) 2014 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 class TestInputStream < Test::Unit::TestCase include GioTestUtils::SocketClient def setup setup_socket_client @stream = @connection.input_stream end def teardown teardown_socket_client end def test_read data = "Hello\n" client = @server.accept client.write(data) client.flush assert_equal(data, @stream.read) end end ruby-gnome2-all-2.2.5/gio2/test/test-file-enumerator.rb0000644000175000017500000000204612307003726021033 0ustar koukou# Copyright (C) 2013-2014 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 class TestFileEnumerator < Test::Unit::TestCase include GioTestUtils::Fixture def test_container path = File.dirname(__FILE__) dir = Gio::File.path(path) enumerator = dir.enumerate_children("*", :none) assert_equal(path, enumerator.container.path) end end ruby-gnome2-all-2.2.5/gio2/test/test-file-monitor.rb0000644000175000017500000000223312516434313020341 0ustar koukou# Copyright (C) 2013 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 class TestFileMonitor < Test::Unit::TestCase class Flags < self def test_file_monitor_flags assert_nothing_raised do Gio::FileMonitorFlags.new(Gio::FileMonitorFlags::SEND_MOVED) end end end class Event < self def test_file_monitor_event assert_nothing_raised do Gio::FileMonitorEvent.new(Gio::FileMonitorEvent::CHANGED) end end end end ruby-gnome2-all-2.2.5/gio2/test/gio2-test-utils/0000755000175000017500000000000012416346617017416 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/gio2-test-utils/omissions.rb0000644000175000017500000000163212416346617021770 0ustar koukou# Copyright (C) 2014 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 module GioTestUtils module Omissions def omit_on_os_x omit("Skip this test on OS X") if RUBY_PLATFORM =~ /darwin/ end end end ruby-gnome2-all-2.2.5/gio2/test/gio2-test-utils/fixture.rb0000644000175000017500000000174012307003726021421 0ustar koukou# Copyright (C) 2013 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 module GioTestUtils module Fixture def fixture_path(*components) base_dir = File.join(File.dirname(__FILE__), "..", "fixture") File.expand_path(File.join(base_dir, *components)) end end end ruby-gnome2-all-2.2.5/gio2/test/gio2-test-utils/socket-client.rb0000644000175000017500000000272312307003726022501 0ustar koukou# Copyright (C) 2014 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 require "socket" module GioTestUtils module SocketClient def setup_socket_client setup_server setup_client setup_loop end def teardown_socket_client teardown_loop teardown_client teardown_server end def setup_server @host = "127.0.0.1" @server = TCPServer.new(@host, 0) @port = @server.addr[1] end def teardown_server @server.close end def setup_client @client = Gio::SocketClient.new @connection = @client.connect_to_host(@host, @port) end def teardown_client @connection.close end def setup_loop @loop = GLib::MainLoop.new end def teardown_loop end end end ruby-gnome2-all-2.2.5/gio2/test/fixture/0000755000175000017500000000000012307003726016117 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/fixture/content-type/0000755000175000017500000000000012307003726020550 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/fixture/content-type/x-content/0000755000175000017500000000000012307003726022467 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/fixture/content-type/x-content/unix-software/0000755000175000017500000000000012307003726025302 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/fixture/content-type/x-content/unix-software/autorun.sh0000755000175000017500000000001212307003726027327 0ustar koukou#!/bin/sh ruby-gnome2-all-2.2.5/gio2/test/fixture/resource/0000755000175000017500000000000012307003726017746 5ustar koukouruby-gnome2-all-2.2.5/gio2/test/fixture/resource/ruby-gio2.gresource.xml0000644000175000017500000000023012307003726024277 0ustar koukou logo.png ruby-gnome2-all-2.2.5/gio2/test/fixture/resource/Rakefile0000644000175000017500000000207512307003726021417 0ustar koukou# -*- ruby -*- # # Copyright (C) 2014 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 require "rake/clean" gresource = "ruby-gio2.gresource" gresource_xml = "#{gresource}.xml" contents = ["logo.png"] dependencies = contents + [gresource_xml] CLEAN << gresource file gresource => dependencies do sh("glib-compile-resources", gresource_xml) end task :default => gresource ruby-gnome2-all-2.2.5/gio2/test/fixture/resource/logo.png0000644000175000017500000001604012307003726021415 0ustar koukouPNG  IHDRPPbKGD pHYs  ~tIME (1IDATxwXT׾{f 0)6@XcIbTSǣѓ)7on<&1ĘfII`b%XPБiLS PL<뙙WoW?Sԟ?Z/m\, 9|Y))vX]@dDFQ#Kr /w^ƺeIvI " ʃdm}ϛ)]T}lMIɓ6}c|qc&%9]p(՝;*/w'ys…'2U˲2y7fJٗbxa` ?eM4RWq??uҕ"G$2E}͙Z J.jirW0}+j5r8dd,a ]OGY5Ĩ x8%es320yz*UDIqqbv]+M@b0+k H~aV+\VkZ]c6s-3׭GxL  8%HQ4-̞q4fOhJJg'4RGeetJ00@]#f/:cȈ eᬨi8bYBX"tpߪg 0R&@*W[QU9κ:pZ-t<`_w[?q Pa xc"'OoؠP6}`GX[ V W]\ՠNwpp* zw82 fpN. g1NE,MLX?l(.z9<57e\T*۱#vhhɘQTpr`*>  bфL;a @N+&vPPj4":ŽOVcb}|!Dp W^I .!P6xh?,BBdуR4}/!TZAj`op]-XxGHRFrtRBe'N-ʸ^faxaX-D qJ,N\ #Gx**S53pWz}=)o[ !4{ALxq@ר$-|X54:,NRpOx4F:,?Y p #L ^w 4ժB!h;ajeRfЃ٠rtl}*rgܩL>jнuX8"mTƨu3|;@駰xv{ ?M>wB2 ]nj.i|-&v Z0Ng <|U#N JQD*F,Rbvp޶y<Գ iؗpԷ=|Ww4nh͎ Bxl.i{EpwP3ca }vCt`C{hY/ y<$:rҟx`ʦw,=.oOqnjd  \N ǫ|徢~\ŝ^V+*7hu#XpV")'Bk(W~v`C~:,U7L/w|hz"OHx-*9߳ᠴ1,_DK$`ihKJ9P vGDJ"C9Nxsfa (~/9@s>${rl~n1EfYە32-9;X4hW1'v0~ ج,>p7pp#¦N%SIQ?ӬVKcƏ;~b923|}3>s {n%Y]v͆ h`̥QBЄP HuyR]ULՔHtTbL >zƬQ  dNL &[Spp?ry.},۽Cdݫ6t>Ze]}LÂc'Μ@L\.s M\PFr:Q4{vvYك-R%?+yzyjk'O 6V ]yAאړr1~CIOeVoh(11!JT a@x`ih5LU˃Y.8xض<9k-Hw&XP37@~{!z?%oC*OzDa KȌ Ď!C #@3!B? Kgn^ h۝0 3xo5@bbǤ7oO Tg|cc]zQk g 1%K?>BRR@9i޵vBu mۆc\b|g֮XVgjԣ1"ޞ-Q^X,~ 4e;f5>ck4DŌQ==iWY3{\Ck5Ho ws^pT=\tjF~j_rGESX.,a{mj C˟̽~JDr 0p ZY z亓eq7q-36IiOe'N0|6l_淬?=\s(JV0 d RxM::m~ە+6r9ܞȠ9hV{YֆU?Lz)R{T uO,Ayt`@vv~_TCA}Y0fje2)}_?fYN$Bsl `}쎏o78.q}ѩ.r_gqufqFlѩ٭%Ill+x]h:(k]Zg'!`aR2W_őc_:֬uu[zLު՗r}:}FQ 0gJO 7uXv4|D"~ Z `ϩOQ,KH.}F'PڅrSr,D:xOU̞RB_X8vlZy=҃kZa5㠮A\8iGOBS*m 17 RTf򈯳z?|.nGѶz 0O^HD' 4ju!p8@XeHoӎN5'O|~U'ѽ'Չz {[6[zbJ <H^={z;xV+eepTV¥R, Ph ´4""CA]]N9n4mڡ}>xnFHr, 6F+iX,8n-lv6Z*ubu:P*s2TNŋ |yyޯmHdٱ>qJ?1ASZ<<<ヌɓ>/l2i4pj5|XI&A ྖe}RMCV#Ny|ƛ4GgXd W}%7N_~8|RMwO8p&}>3u5@5E^bHbn*JS\ BxB)muu<IeK8EiC[/) =pL6ǢFHD])5ï'Nnz=MgN:z?ekl)-Np/++Fa@I  4TV'ESC?ޏx#HV6@Jb  6^Q n30w||HĒN1휥ə>@^vOCz5uy|J;]GHkO8]\ۛ?ZHTG9iUk w&rsAli@-'5; [ ߽լaC07O z SfH8F_o}5m_Vu.^}a4JSXJl, '\@`eutp7%<ܳ_ `ܧսY zn\uZ,H&K5#\,j(*poLqVmge-{+Y'w M8txu,p[M%o" M'້pW ?(#a_-{w֔lyf)ZpI/ Fm/:n{:(PTn!mogYÈDe,1Nq4}󉊮0}:]I|{$^WI_Zjj&5ﮇzh6rk;f!o )_} &@qv\8gH.@H=u}Ktu:DZjUɥOn074s8]ER\p(( (>+ҳ@(fi=cP֦K `@7a=^{xyB v&_[)|aZQ2*X~ pe~F\ %D3 }81fi\GGf7窋 !a4DpMVnLfU@TT8(h2֯7ӢOoV'&0$LR }JTZr:.%RJ+aczIENDB`ruby-gnome2-all-2.2.5/gio2/test/fixture/resource/ruby-gio2.gresource0000644000175000017500000001642012307003726023510 0ustar koukouGVariant(ԵLKP L`tL L$v/org/test/ruby-gnome2/logo.png PNG  IHDRPPbKGD pHYs  ~tIME (1IDATxwXT׾{f 0)6@XcIbTSǣѓ)7on<&1ĘfII`b%XPБiLS PL<뙙WoW?Sԟ?Z/m\, 9|Y))vX]@dDFQ#Kr /w^ƺeIvI " ʃdm}ϛ)]T}lMIɓ6}c|qc&%9]p(՝;*/w'ys…'2U˲2y7fJٗbxa` ?eM4RWq??uҕ"G$2E}͙Z J.jirW0}+j5r8dd,a ]OGY5Ĩ x8%es320yz*UDIqqbv]+M@b0+k H~aV+\VkZ]c6s-3׭GxL  8%HQ4-̞q4fOhJJg'4RGeetJ00@]#f/:cȈ eᬨi8bYBX"tpߪg 0R&@*W[QU9κ:pZ-t<`_w[?q Pa xc"'OoؠP6}`GX[ V W]\ՠNwpp* zw82 fpN. g1NE,MLX?l(.z9<57e\T*۱#vhhɘQTpr`*>  bфL;a @N+&vPPj4":ŽOVcb}|!Dp W^I .!P6xh?,BBdуR4}/!TZAj`op]-XxGHRFrtRBe'N-ʸ^faxaX-D qJ,N\ #Gx**S53pWz}=)o[ !4{ALxq@ר$-|X54:,NRpOx4F:,?Y p #L ^w 4ժB!h;ajeRfЃ٠rtl}*rgܩL>jнuX8"mTƨu3|;@駰xv{ ?M>wB2 ]nj.i|-&v Z0Ng <|U#N JQD*F,Rbvp޶y<Գ iؗpԷ=|Ww4nh͎ Bxl.i{EpwP3ca }vCt`C{hY/ y<$:rҟx`ʦw,=.oOqnjd  \N ǫ|徢~\ŝ^V+*7hu#XpV")'Bk(W~v`C~:,U7L/w|hz"OHx-*9߳ᠴ1,_DK$`ihKJ9P vGDJ"C9Nxsfa (~/9@s>${rl~n1EfYە32-9;X4hW1'v0~ ج,>p7pp#¦N%SIQ?ӬVKcƏ;~b923|}3>s {n%Y]v͆ h`̥QBЄP HuyR]ULՔHtTbL >zƬQ  dNL &[Spp?ry.},۽Cdݫ6t>Ze]}LÂc'Μ@L\.s M\PFr:Q4{vvYك-R%?+yzyjk'O 6V ]yAאړr1~CIOeVoh(11!JT a@x`ih5LU˃Y.8xض<9k-Hw&XP37@~{!z?%oC*OzDa KȌ Ď!C #@3!B? Kgn^ h۝0 3xo5@bbǤ7oO Tg|cc]zQk g 1%K?>BRR@9i޵vBu mۆc\b|g֮XVgjԣ1"ޞ-Q^X,~ 4e;f5>ck4DŌQ==iWY3{\Ck5Ho ws^pT=\tjF~j_rGESX.,a{mj C˟̽~JDr 0p ZY z亓eq7q-36IiOe'N0|6l_淬?=\s(JV0 d RxM::m~ە+6r9ܞȠ9hV{YֆU?Lz)R{T uO,Ayt`@vv~_TCA}Y0fje2)}_?fYN$Bsl `}쎏o78.q}ѩ.r_gqufqFlѩ٭%Ill+x]h:(k]Zg'!`aR2W_őc_:֬uu[zLު՗r}:}FQ 0gJO 7uXv4|D"~ Z `ϩOQ,KH.}F'PڅrSr,D:xOU̞RB_X8vlZy=҃kZa5㠮A\8iGOBS*m 17 RTf򈯳z?|.nGѶz 0O^HD' 4ju!p8@XeHoӎN5'O|~U'ѽ'Չz {[6[zbJ <H^={z;xV+eepTV¥R, Ph ´4""CA]]N9n4mڡ}>xnFHr, 6F+iX,8n-lv6Z*ubu:P*s2TNŋ |yyޯmHdٱ>qJ?1ASZ<<<ヌɓ>/l2i4pj5|XI&A ྖe}RMCV#Ny|ƛ4GgXd W}%7N_~8|RMwO8p&}>3u5@5E^bHbn*JS\ BxB)muu<IeK8EiC[/) =pL6ǢFHD])5ï'Nnz=MgN:z?ekl)-Np/++Fa@I  4TV'ESC?ޏx#HV6@Jb  6^Q n30w||HĒN1휥ə>@^vOCz5uy|J;]GHkO8]\ۛ?ZHTG9iUk w&rsAli@-'5; [ ߽լaC07O z SfH8F_o}5m_Vu.^}a4JSXJl, '\@`eutp7%<ܳ_ `ܧսY zn\uZ,H&K5#\,j(*poLqVmge-{+Y'w M8txu,p[M%o" M'້pW ?(#a_-{w֔lyf)ZpI/ Fm/:n{:(PTn!mogYÈDe,1Nq4}󉊮0}:]I|{$^WI_Zjj&5ﮇzh6rk;f!o )_} &@qv\8gH.@H=u}Ktu:DZjUɥOn074s8]ER\p(( (>+ҳ@(fi=cP֦K `@7a=^{xyB v&_[)|aZQ2*X~ pe~F\ %D3 }81fi\GGf7窋 !a4DpMVnLfU@TT8(h2֯7ӢOoV'&0$LR }JTZr:.%RJ+aczIENDB`(uuay)ruby-gnome2-all-2.2.5/gio2/test/test-resources.rb0000644000175000017500000000356712307010272017752 0ustar koukou# Copyright (C) 2014 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 class TestResources < Test::Unit::TestCase include GioTestUtils::Fixture def fixture_path(*components) super("resource", *components) end def setup gresource = fixture_path("ruby-gio2.gresource") @resource = Gio::Resource.load(gresource) Gio::Resources.register(@resource) end def teardown Gio::Resources.unregister(@resource) end def test_lookup_data data = Gio::Resources.lookup_data("/org/ruby-gnome2/test/logo.png") assert_equal(File.open(fixture_path("logo.png"), "rb", &:read), data) end def test_open_stream Gio::Resources.open_stream("/org/ruby-gnome2/test/logo.png") do |input| assert_equal(File.open(fixture_path("logo.png"), "rb", &:read), input.read) end end def test_enumerate_children assert_equal(["logo.png"], Gio::Resources.enumerate_children("/org/ruby-gnome2/test")) end def test_get_info data = File.open(fixture_path("logo.png"), "rb", &:read) assert_equal([true, data.bytesize, 0], Gio::Resources.get_info("/org/ruby-gnome2/test/logo.png")) end end ruby-gnome2-all-2.2.5/gio2/test/gio2-test-utils.rb0000644000175000017500000000165012416346617017745 0ustar koukou# Copyright (C) 2013 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 require "test-unit" require "test/unit/notify" require "gio2-test-utils/fixture" require "gio2-test-utils/omissions" require "gio2-test-utils/socket-client" ruby-gnome2-all-2.2.5/gio2/test/test-memory-output-stream.rb0000644000175000017500000000165712446160551022107 0ustar koukou# Copyright (C) 2014 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 class TestMemoryOutputStream < Test::Unit::TestCase def test_memory_output_stream assert_nothing_raised do Gio::MemoryOutputStream.new end end end ruby-gnome2-all-2.2.5/gio2/test/test-output-stream.rb0000644000175000017500000000227112307003726020566 0ustar koukou# Copyright (C) 2014 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 class TestOutputStream < Test::Unit::TestCase include GioTestUtils::SocketClient def setup setup_socket_client @stream = @connection.output_stream end def teardown teardown_socket_client end def test_write data = "Hello\n" assert_equal(data.bytesize, @stream.write(data)) client = @server.accept begin assert_equal(data, client.gets) ensure client.close end end end ruby-gnome2-all-2.2.5/gio2/extconf.rb0000755000175000017500000000365212307003726015456 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2014 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 require "pathname" require "mkmf" require "rbconfig" require "fileutils" package = "gio2" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-MAKEFILE) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib MAKEFILE end ruby-gnome2-all-2.2.5/gio2/Rakefile0000644000175000017500000000252012307003726015116 0ustar koukou# -*- ruby -*- # # Copyright (C) 2011-2013 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GIO2 is a Ruby binding of gio-2.x." package.description = "Ruby/GIO2 is a Ruby binding of gio-2.x." package.dependency.gem.runtime = ["glib2", "gobject-introspection"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = ["glib2", "gobject-introspection"] package.windows.gobject_introspection_dependencies = ["glib2"] end package_task.define ruby-gnome2-all-2.2.5/gio2/README.md0000644000175000017500000000075712307003726014742 0ustar koukou# Ruby/GIO2 Ruby/GIO2 is a Ruby binding of gio-2.0.x. ## Requirements * Ruby/GObjectIntrospection in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [GIO](http://library.gnome.org/devel/gio/stable) ## Install gem install gio2 ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/gio2/ext/0000755000175000017500000000000011701304107014244 5ustar koukouruby-gnome2-all-2.2.5/gio2/ext/gio2/0000755000175000017500000000000012516441042015111 5ustar koukouruby-gnome2-all-2.2.5/gio2/ext/gio2/extconf.rb0000755000175000017500000000477412446160551017130 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2014 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 require "pathname" base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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+)\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 = "gio2" package_id = "gio-2.0" require "mkmf-gnome2" ["glib2", "gobject-introspection"].each do |package| directory = "#{package}#{version_suffix}" build_base_path = "#{directory}/tmp/#{RUBY_PLATFORM}" package_library_name = package.gsub(/-/, "_") build_dir = "#{build_base_path}/#{package_library_name}/#{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 setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libglib2.0-dev", :redhat => "glib2-devel", :homebrew => "glib", :macports => "glib2") exit(false) end unless PKGConfig.have_package("gobject-introspection-1.0") exit(false) end create_pkg_config_file("Ruby/GIO2", package_id) $defs << "-DRUBY_GIO2_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 ruby-gnome2-all-2.2.5/gio2/ext/gio2/ruby-gio2.pc0000644000175000017500000000011612446173033017256 0ustar koukouName: Ruby/GIO2 Description: Ruby bindings for glib I/O library Version: 2.2.4ruby-gnome2-all-2.2.5/gio2/ext/gio2/depend0000644000175000017500000000024512416346617016307 0ustar koukouinstall: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gio2.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/gio2/ext/gio2/rb-gio2-pollable-source.c0000644000175000017500000000343412307003726021611 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rb-gio2.h" #define RG_TARGET_NAMESPACE mPollableSource #define _SELF(self) ((GSource *)RVAL2BOXED(self, G_TYPE_SOURCE)) static gboolean source_func(GObject *pollable_stream, gpointer user_data) { VALUE callback = (VALUE)user_data; ID id_call; id_call = rb_intern("call"); return RVAL2CBOOL(rb_funcall(callback, id_call, 1, GOBJ2RVAL(pollable_stream))); } static VALUE rg_set_callback(VALUE self) { VALUE callback; callback = rb_block_proc(); G_RELATIVE(self, callback); g_source_set_callback(_SELF(self), (GSourceFunc)source_func, (gpointer)callback, (GDestroyNotify)NULL); return self; } void rb_gio2_init_pollable_source (VALUE mGio) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module_under(mGio, "PollableSource"); RG_DEF_METHOD(set_callback, 0); } ruby-gnome2-all-2.2.5/gio2/ext/gio2/rb-gio2.h0000644000175000017500000000201712307003726016524 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 #include extern void Init_gio2 (void); G_GNUC_INTERNAL extern void rb_gio2_init_pollable_source (VALUE rb_mGio); ruby-gnome2-all-2.2.5/gio2/ext/gio2/rb-gio2.c0000644000175000017500000000211112516434313016514 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rb-gio2.h" #define RG_TARGET_NAMESPACE rb_mGio void Init_gio2 (void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module("Gio"); rb_gio2_init_pollable_source(RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gio2/ext/gio2/Makefile0000644000175000017500000002120412446173033016554 0ustar koukou SHELL = /bin/sh # V=0 quiet, V=1 verbose. other values don't work. V = 0 Q1 = $(V:1=) Q = $(Q1:0=@) ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gio2/ext/gio2 topdir = /usr/include/ruby-2.1.0 hdrdir = $(topdir) arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0 PATH_SEPARATOR = : VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby prefix = $(DESTDIR)/usr rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME) rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME) rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) exec_prefix = $(prefix) vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME) vendorhdrdir = $(rubyhdrdir)/vendor_ruby sitehdrdir = $(rubyhdrdir)/site_ruby rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version) vendorlibdir = $(vendordir)/$(ruby_version) vendordir = $(rubylibprefix)/vendor_ruby sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby sitelibdir = $(sitedir)/$(ruby_version) sitedir = $(DESTDIR)/usr/local/lib/site_ruby rubyarchdir = $(rubyarchprefix)/$(ruby_version) rubylibdir = $(rubylibprefix)/$(ruby_version) sitearchincludedir = $(includedir)/$(sitearch) archincludedir = $(includedir)/$(arch) sitearchlibdir = $(libdir)/$(sitearch) archlibdir = $(libdir)/$(arch) ridir = $(datarootdir)/$(RI_BASE_NAME) mandir = $(prefix)/share/man localedir = $(datarootdir)/locale libdir = $(exec_prefix)/lib psdir = $(docdir) pdfdir = $(docdir) dvidir = $(docdir) htmldir = $(docdir) infodir = $(prefix)/share/info docdir = $(datarootdir)/doc/$(PACKAGE) oldincludedir = $(DESTDIR)/usr/include includedir = $(prefix)/include localstatedir = $(DESTDIR)/var sharedstatedir = $(prefix)/com sysconfdir = $(DESTDIR)/etc datadir = $(datarootdir) datarootdir = $(prefix)/share libexecdir = $(prefix)/lib/ruby2.1 sbindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/bin archdir = $(rubyarchdir) CC = gcc CXX = g++ LIBRUBY = $(LIBRUBY_SO) LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static empty = OUTFLAG = -o $(empty) COUTFLAG = -o $(empty) RUBY_EXTCONF_H = cflags = $(optflags) $(debugflags) $(warnflags) optflags = -O3 -fno-fast-math debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration CCDLFLAGS = -fPIC CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $(ARCH_FLAG) INCFLAGS = -I. -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection -I/var/lib/gems/2.1.0/gems/gobject-introspection-2.2.3/ext/gobject-introspection -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/var/lib/gems/2.1.0/gems/glib2-2.2.3/ext/glib2 -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I$(vendorarchdir) DEFS = CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DRUBY_GIO2_COMPILATION -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags) CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG) ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu dldflags = ARCH_FLAG = DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) LDSHARED = $(CC) -shared LDSHAREDXX = $(CXX) -shared AR = ar EXEEXT = RUBY_INSTALL_NAME = ruby2.1 RUBY_SO_NAME = ruby-2.1 RUBYW_INSTALL_NAME = RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) RUBYW_BASE_NAME = rubyw RUBY_BASE_NAME = ruby arch = x86_64-linux-gnu sitearch = $(arch) ruby_version = 2.1.0 ruby = $(bindir)/ruby2.1 RUBY = $(ruby) ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h RM = rm -f RM_RF = $(RUBY) -run -e rm -- -rf RMDIRS = rmdir --ignore-fail-on-non-empty -p MAKEDIRS = /bin/mkdir -p INSTALL = /usr/bin/install -c INSTALL_PROG = $(INSTALL) -m 0755 INSTALL_DATA = $(INSTALL) -m 644 COPY = cp TOUCH = exit > #### End of system configuration section. #### preload = libpath = . $(archlibdir) LIBPATH = -L. -L$(archlibdir) DEFFILE = CLEANFILES = mkmf.log DISTCLEANFILES = ruby-gio2.pc DISTCLEANDIRS = extout = extout_prefix = target_prefix = LOCAL_LIBS = LIBS = $(LIBRUBYARG_SHARED) -lgio-2.0 -lglib-2.0 -lgobject-2.0 -lgirepository-1.0 -lglib-2.0 -lgobject-2.0 -lpthread -lgmp -ldl -lcrypt -lm -lc ORIG_SRCS = rb-gio2-pollable-source.c rb-gio2.c SRCS = $(ORIG_SRCS) OBJS = rb-gio2-pollable-source.o rb-gio2.o HDRS = $(srcdir)/rb-gio2.h TARGET = gio2 TARGET_NAME = gio2 TARGET_ENTRY = Init_$(TARGET_NAME) DLLIB = $(TARGET).so EXTSTATIC = STATIC_LIB = TIMESTAMP_DIR = . BINDIR = $(bindir) RUBYCOMMONDIR = $(sitedir)$(target_prefix) RUBYLIBDIR = $(sitelibdir)$(target_prefix) RUBYARCHDIR = $(sitearchdir)$(target_prefix) HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) TARGET_SO = $(DLLIB) CLEANLIBS = $(TARGET).so CLEANOBJS = *.o *.bak all: $(DLLIB) static: $(STATIC_LIB) .PHONY: all install static install-so install-rb .PHONY: clean clean-so clean-static clean-rb clean-static:: clean-rb-default:: clean-rb:: clean-so:: clean: clean-so clean-static clean-rb-default clean-rb -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time distclean-rb-default:: distclean-rb:: distclean-so:: distclean-static:: distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true realclean: distclean install: install-so install-rb install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR) clean-static:: -$(Q)$(RM) $(STATIC_LIB) install-rb: pre-install-rb install-rb-default install-rb-default: pre-install-rb-default pre-install-rb: Makefile pre-install-rb-default: Makefile pre-install-rb-default: $(ECHO) installing default gio2 libraries $(TIMESTAMP_DIR)/.RUBYARCHDIR.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR) $(Q) $(TOUCH) $@ site-install: site-install-so site-install-rb site-install-so: install-so site-install-rb: install-rb .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o .cc.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .mm.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .cxx.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .cpp.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .C.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .c.o: $(ECHO) compiling $(<) $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< .m.o: $(ECHO) compiling $(<) $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< $(DLLIB): $(OBJS) Makefile $(ECHO) linking shared-object $(DLLIB) -$(Q)$(RM) $(@) $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) ### install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gio2.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/gio2/COPYING.LIB0000644000175000017500000006364212307003726015125 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/gio2/lib/0000755000175000017500000000000012516441043014220 5ustar koukouruby-gnome2-all-2.2.5/gio2/lib/gio2/0000755000175000017500000000000012516434313015062 5ustar koukouruby-gnome2-all-2.2.5/gio2/lib/gio2/inet-address.rb0000644000175000017500000000213212307003726017765 0ustar koukou# Copyright (C) 2014 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 module Gio class InetAddress class << self def any(family) address = allocate address.__send__(:initialize_new_any, family) address end def loopback(family) address = allocate address.__send__(:initialize_new_loopback, family) address end end end end ruby-gnome2-all-2.2.5/gio2/lib/gio2/deprecated.rb0000644000175000017500000001557012307003726017515 0ustar koukou# Copyright (C) 2013 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 module GLib extend GLib::Deprecatable define_deprecated_const :AppInfo, 'Gio::AppInfo' define_deprecated_const :AppLaunchContext, 'Gio::AppLaunchContext' define_deprecated_const :AskPasswordFlags, 'Gio::AskPasswordFlags' define_deprecated_const :AsyncInitable, 'Gio::AsyncInitable' define_deprecated_const :AsyncResult, 'Gio::AsyncResult' define_deprecated_const :BufferedInputStream, 'Gio::BufferedInputStream' define_deprecated_const :BufferedOutputStream, 'Gio::BufferedOutputStream' define_deprecated_const :Cancellable, 'Gio::Cancellable' define_deprecated_const :CharsetConverter, 'Gio::CharsetConverter' define_deprecated_const :ContentType, 'Gio::ContentType' define_deprecated_const :Converter, 'Gio::Converter' define_deprecated_const :ConverterInputStream, 'Gio::ConverterInputStream' define_deprecated_const :ConverterOutputStream, 'Gio::ConverterOutputStream' define_deprecated_const :DataInputStream, 'Gio::DataInputStream' define_deprecated_const :DataOutputStream, 'Gio::DataOutputStream' define_deprecated_const :DataStreamByteOrder, 'Gio::DataStreamByteOrder' define_deprecated_const :DataStreamNewlineType, 'Gio::DataStreamNewlineType' define_deprecated_const :DesktopAppInfo, 'Gio::DesktopAppInfo' define_deprecated_const :Drive, 'Gio::Drive' define_deprecated_const :Emblem, 'Gio::Emblem' define_deprecated_const :EmblemedIcon, 'Gio::EmblemedIcon' define_deprecated_const :File, 'Gio::File' define_deprecated_const :FileAttribute, 'Gio::FileAttribute' define_deprecated_const :FileAttributeInfo, 'Gio::FileAttributeInfo' define_deprecated_const :FileAttributeMatcher, 'Gio::FileAttributeMatcher' define_deprecated_const :FileDescriptorBased, 'Gio::FileDescriptorBased' define_deprecated_const :FileEnumerator, 'Gio::FileEnumerator' define_deprecated_const :FileIOStream, 'Gio::FileIOStream' define_deprecated_const :FileIcon, 'Gio::FileIcon' define_deprecated_const :FileInfo, 'Gio::FileInfo' define_deprecated_const :FileInputStream, 'Gio::FileInputStream' define_deprecated_const :FileMonitor, 'Gio::FileMonitor' define_deprecated_const :FileOutputStream, 'Gio::FileOutputStream' define_deprecated_const :FilenameCompleter, 'Gio::FilenameCompleter' define_deprecated_const :FilesystemPreviewType, 'Gio::FilesystemPreviewType' define_deprecated_const :FilterInputStream, 'Gio::FilterInputStream' define_deprecated_const :FilterOutputStream, 'Gio::FilterOutputStream' define_deprecated_const :IO, 'Gio::IO' define_deprecated_const :IOModule, 'Gio::IOModule' define_deprecated_const :IOModules, 'Gio::IOModules' define_deprecated_const :IOScheduler, 'Gio::IOScheduler' define_deprecated_const :IOSchedulerJob, 'Gio::IOSchedulerJob' define_deprecated_const :IOStream, 'Gio::IOStream' define_deprecated_const :Icon, 'Gio::Icon' define_deprecated_const :InetAddress, 'Gio::InetAddress' define_deprecated_const :InetSocketAddress, 'Gio::InetSocketAddress' define_deprecated_const :Initable, 'Gio::Initable' define_deprecated_const :InputStream, 'Gio::InputStream' define_deprecated_const :LoadableIcon, 'Gio::LoadableIcon' define_deprecated_const :MemoryInputStream, 'Gio::MemoryInputStream' define_deprecated_const :MemoryOutputStream, 'Gio::MemoryOutputStream' define_deprecated_const :Mount, 'Gio::Mount' define_deprecated_const :MountOperation, 'Gio::MountOperation' define_deprecated_const :NetworkAddress, 'Gio::NetworkAddress' define_deprecated_const :NetworkService, 'Gio::NetworkService' define_deprecated_const :OutputStream, 'Gio::OutputStream' define_deprecated_const :PasswordSave, 'Gio::PasswordSave' define_deprecated_const :Resolver, 'Gio::Resolver' define_deprecated_const :Seekable, 'Gio::Seekable' define_deprecated_const :SimpleAsyncResult, 'Gio::SimpleAsyncResult' define_deprecated_const :Socket, 'Gio::Socket' define_deprecated_const :SocketAddress, 'Gio::SocketAddress' define_deprecated_const :SocketAddressEnumerator, 'Gio::SocketAddressEnumerator' define_deprecated_const :SocketClient, 'Gio::SocketClient' define_deprecated_const :SocketConnectable, 'Gio::SocketConnectable' define_deprecated_const :SocketConnection, 'Gio::SocketConnection' define_deprecated_const :SocketConnectionFactory, 'Gio::SocketConnectionFactory' define_deprecated_const :SocketControlMessage, 'Gio::SocketControlMessage' define_deprecated_const :SocketListener, 'Gio::SocketListener' define_deprecated_const :SocketService, 'Gio::SocketService' define_deprecated_const :SrvTarget, 'Gio::SrvTarget' define_deprecated_const :TcpConnection, 'Gio::TcpConnection' define_deprecated_const :ThemedIcon, 'Gio::ThemedIcon' define_deprecated_const :ThreadedSocketService, 'Gio::ThreadedSocketService' define_deprecated_const :UnixConnection, 'Gio::UnixConnection' define_deprecated_const :UnixFDList, 'Gio::UnixFDList' define_deprecated_const :UnixFDMessage, 'Gio::UnixFDMessage' define_deprecated_const :UnixInputStream, 'Gio::UnixInputStream' define_deprecated_const :UnixMount, 'Gio::UnixMount' define_deprecated_const :UnixMountMonitor, 'Gio::UnixMountMonitor' define_deprecated_const :UnixMountPoint, 'Gio::UnixMountPoint' define_deprecated_const :UnixMountPoints, 'Gio::UnixMountPoints' define_deprecated_const :UnixMounts, 'Gio::UnixMounts' define_deprecated_const :UnixOutputStream, 'Gio::UnixOutputStream' define_deprecated_const :UnixSocketAddress, 'Gio::UnixSocketAddress' define_deprecated_const :Vfs, 'Gio::Vfs' define_deprecated_const :Volume, 'Gio::Volume' define_deprecated_const :VolumeMonitor, 'Gio::VolumeMonitor' define_deprecated_const :ZlibCompressor, 'Gio::ZlibCompressor' define_deprecated_const :ZlibDecompressor, 'Gio::ZlibDecompressor' define_deprecated_enums 'Gio::FilesystemPreviewType', 'FILESYSTEM_PREVIEW_TYPE' define_deprecated_enums 'Gio::DataStreamByteOrder', 'DATA_STREAM_BYTE_ORDER' define_deprecated_enums 'Gio::DataStreamNewlineType', 'DATA_STREAM_NEWLINE_TYPE' define_deprecated_flags 'Gio::AskPasswordFlags', 'ASK_PASSWORD' define_deprecated_enums 'Gio::PasswordSave', 'PASSWORD_SAVE' define_deprecated_singleton_method :gio_has_unix?, :warn => "Use 'Gio.has_unix?'." do |_self| Gio.has_unix? end end ruby-gnome2-all-2.2.5/gio2/lib/gio2/pollable-input-stream.rb0000644000175000017500000000367712416346617021654 0ustar koukou# Copyright (C) 2014 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 module Gio module PollableInputStream alias_method :create_source_raw, :create_source def create_source(&block) source = create_source_raw source.extend(PollableSource) source.set_callback(&block) source end alias_method :read_nonblocking_raw, :read_nonblocking def read_nonblocking(size=nil) if size.nil? all = "".force_encoding("ASCII-8BIT") buffer_size = 8192 buffer = " ".force_encoding("ASCII-8BIT") * buffer_size loop do begin read_bytes = read_nonblocking_raw_compatible(buffer) rescue IOError::WouldBlock break end all << buffer.byteslice(0, read_bytes) break if read_bytes != buffer_size end all else buffer = " " * size read_bytes = read_nonblocking_raw_compatible(buffer) buffer.replace(buffer.byteslice(0, read_bytes)) buffer end end private def read_nonblocking_raw_compatible(buffer) if (GLib::VERSION <=> [2, 42, 0]) >= 0 read_nonblocking_raw(buffer) else read_nonblocking_raw(buffer, buffer.bytesize) end end end end ruby-gnome2-all-2.2.5/gio2/lib/gio2/input-stream.rb0000644000175000017500000000306012416346617020046 0ustar koukou# Copyright (C) 2014 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 module Gio class InputStream alias_method :read_raw, :read def read(size=nil) if size.nil? all = "".force_encoding("ASCII-8BIT") buffer_size = 8192 buffer = " ".force_encoding("ASCII-8BIT") * buffer_size loop do read_bytes = read_raw_compatible(buffer) all << buffer.byteslice(0, read_bytes) break if read_bytes != buffer_size end all else buffer = " " * size read_bytes = read_raw_compatible(buffer) buffer.replace(buffer.byteslice(0, read_bytes)) buffer end end private def read_raw_compatible(buffer) if (GLib::VERSION <=> [2, 36, 0]) >= 0 read_raw(buffer) else read_raw(buffer, buffer.bytesize) end end end end ruby-gnome2-all-2.2.5/gio2/lib/gio2/loader.rb0000644000175000017500000001534312516434313016663 0ustar koukou# Copyright (C) 2013-2014 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 module Gio class Loader < GObjectIntrospection::Loader private def pre_load(repository, namespace) define_content_type_class define_mime_type_class define_dbus_module define_resources_module @content_type_guess_for_tree_info = nil end def post_load(repository, namespace) if @content_type_guess_for_tree_info content_type_class = @content_type_class info = @content_type_guess_for_tree_info file_module = @base_module.const_get("File") file_module.__send__(:define_method, "guess_content_types") do info.invoke(:arguments => [self]).collect do |type| content_type_class.new(type) end end end require_extension require_libraries end def require_extension begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gio2.so" rescue LoadError require "gio2.so" end end def require_libraries require "gio2/resources" require "gio2/inet-address" require "gio2/input-stream" require "gio2/pollable-input-stream" require "gio2/pollable-output-stream" end def define_content_type_class @content_type_class = Class.new do def initialize(type) @type = type end def to_s @type end end @base_module.const_set("ContentType", @content_type_class) end def define_mime_type_class @mime_type_class = Class.new do def initialize(type) @type = type end def to_s @type end end @base_module.const_set("MimeType", @mime_type_class) end def define_dbus_module @dbus_module = Module.new @base_module.const_set("DBus", @dbus_module) end def define_resources_module @resources_module = Module.new @base_module.const_set("Resources", @resources_module) end def load_function_info(info) name = info.name case name when "init" # ignore when /\Acontent_type_/ load_function_info_content_type(info) when "content_types_get_registered" @content_type_class.define_singleton_method(:registered) do info.invoke(:arguments => []).collect do |type| new(type) end end when /\Aresources_/ name = rubyish_method_name(info, :prefix => "resources_") define_module_function(@resources_module, name, info) when /\Adbus_/ name = rubyish_method_name(info, :prefix => "dbus_") define_module_function(@dbus_module, name, info) else super end end def load_function_info_content_type(info) name = info.name.gsub(/\Acontent_type_/, "") case name when "equals", "is_a" case name when "equals" method_name = "==" when "is_a" method_name = "#{name}?" end @content_type_class.__send__(:define_method, method_name) do |other| if other.is_a?(self.class) other = other.to_s end if other.is_a?(String) info.invoke(:arguments => [to_s, other]) else false end end when "from_mime_type" @mime_type_class.__send__(:define_method, "content_type") do info.invoke(:arguments => [to_s]) end when "get_mime_type" mime_type_class = @mime_type_class @content_type_class.__send__(:define_method, "mime_type") do mime_type = info.invoke(:arguments => [to_s]) if mime_type mime_type_class.new(mime_type) else nil end end when "guess_for_tree" @content_type_guess_for_tree_info = info when "guess" validate = lambda do |arguments| method_name = "#{@content_type_class}.#{name}" validate_arguments(info, method_name, arguments) end @content_type_class.define_singleton_method(:guess) do |*arguments| validate.call(arguments) info.invoke(:arguments => arguments) end else case name when /\Acan_be_/ method_name = "#{$POSTMATCH}?" when /\Ais_/ method_name = "#{$POSTMATCH}?" when /\Aget_/ method_name = $POSTMATCH else method_name = name end @content_type_class.__send__(:define_method, method_name) do info.invoke(:arguments => [to_s]) end end end def load_function_infos(infos, klass) case klass.name when "Gio::File" load_function_infos_file(infos, klass) super else super end end def load_function_infos_file(infos, klass) new_for_commandline_arg_infos = [] infos.each do |info| name = info.name case name when /\Anew_for_commandline_arg/ new_for_commandline_arg_infos << info when /\Anew_(?:for_)?/ method_name = $POSTMATCH define_singleton_method(klass, method_name, info) else define_singleton_method(klass, name, info) end end define_file_commandline_arg(new_for_commandline_arg_infos, klass) end def define_file_commandline_arg(infos, klass) method_name = "commandline_arg" find_info = lambda do |arguments| find_suitable_callable_info(infos, arguments) end validate = lambda do |info, arguments| validate_arguments(info, "#{klass}.#{method_name}", arguments) end klass.__send__(:define_method, method_name) do |*arguments| info = find_info.call(arguments) validate.call(info, arguments) info.invoke(:arguments => arguments) end end def error_class_name(info) name = info.name case name when /Enum\z/ $PREMATCH else name end end def error_parent_class(info) Error end end end ruby-gnome2-all-2.2.5/gio2/lib/gio2/resources.rb0000644000175000017500000000357612307010272017424 0ustar koukou# Copyright (C) 2014 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 module Gio module Resources class << self def register(resource) resource._register end def unregister(resource) resource._unregister end alias_method :lookup_data_raw, :lookup_data def lookup_data(path, flags=nil) flags ||= ResourceLookupFlags::NONE lookup_data_raw(path, flags) end alias_method :open_stream_raw, :open_stream def open_stream(path, flags=nil) flags ||= ResourceLookupFlags::NONE input_stream = open_stream_raw(path, flags) if block_given? begin yield(input_stream) ensure input_stream.close end else input_stream end end alias_method :enumerate_children_raw, :enumerate_children def enumerate_children(path, flags=nil) flags ||= ResourceLookupFlags::NONE enumerate_children_raw(path, flags) end alias_method :get_info_raw, :get_info def get_info(path, flags=nil) flags ||= ResourceLookupFlags::NONE get_info_raw(path, flags) end end end end ruby-gnome2-all-2.2.5/gio2/lib/gio2/pollable-output-stream.rb0000644000175000017500000000201312416346617022034 0ustar koukou# Copyright (C) 2014 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 module Gio module PollableOutputStream alias_method :create_source_raw, :create_source def create_source(&block) source = create_source_raw source.extend(PollableSource) source.set_callback(&block) source end end end ruby-gnome2-all-2.2.5/gio2/lib/gio2.rb0000644000175000017500000000315112516434313015407 0ustar koukou# Copyright (C) 2013-2014 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 require "gobject-introspection" require "glib2" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) require "gio2/deprecated" require "gio2/loader" module Gio LOG_DOMAIN = "Gio" GLib::Log.set_log_domain(LOG_DOMAIN) class Error < StandardError end class << self def const_missing(name) init if const_defined?(name) const_get(name) else super end end def init class << self remove_method(:init) remove_method(:const_missing) end loader = Loader.new(self) loader.load("Gio") end end end ruby-gnome2-all-2.2.5/gio2/Makefile.lib0000644000175000017500000001752412446173033015673 0ustar koukou SHELL = /bin/sh # V=0 quiet, V=1 verbose. other values don't work. V = 0 Q1 = $(V:1=) Q = $(Q1:0=@) ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gio2 topdir = /usr/include/ruby-2.1.0 hdrdir = $(topdir) arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0 PATH_SEPARATOR = : VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby prefix = $(DESTDIR)/usr rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME) rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME) rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) exec_prefix = $(prefix) vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME) vendorhdrdir = $(rubyhdrdir)/vendor_ruby sitehdrdir = $(rubyhdrdir)/site_ruby rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version) vendorlibdir = $(vendordir)/$(ruby_version) vendordir = $(rubylibprefix)/vendor_ruby sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby sitelibdir = $(sitedir)/$(ruby_version) sitedir = $(DESTDIR)/usr/local/lib/site_ruby rubyarchdir = $(rubyarchprefix)/$(ruby_version) rubylibdir = $(rubylibprefix)/$(ruby_version) sitearchincludedir = $(includedir)/$(sitearch) archincludedir = $(includedir)/$(arch) sitearchlibdir = $(libdir)/$(sitearch) archlibdir = $(libdir)/$(arch) ridir = $(datarootdir)/$(RI_BASE_NAME) mandir = $(prefix)/share/man localedir = $(datarootdir)/locale libdir = $(exec_prefix)/lib psdir = $(docdir) pdfdir = $(docdir) dvidir = $(docdir) htmldir = $(docdir) infodir = $(prefix)/share/info docdir = $(datarootdir)/doc/$(PACKAGE) oldincludedir = $(DESTDIR)/usr/include includedir = $(prefix)/include localstatedir = $(DESTDIR)/var sharedstatedir = $(prefix)/com sysconfdir = $(DESTDIR)/etc datadir = $(datarootdir) datarootdir = $(prefix)/share libexecdir = $(prefix)/lib/ruby2.1 sbindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/bin archdir = $(rubyarchdir) CC = gcc CXX = g++ LIBRUBY = $(LIBRUBY_SO) LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static empty = OUTFLAG = -o $(empty) COUTFLAG = -o $(empty) RUBY_EXTCONF_H = cflags = $(optflags) $(debugflags) $(warnflags) optflags = -O3 -fno-fast-math debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration CCDLFLAGS = -fPIC CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC $(ARCH_FLAG) INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) DEFS = CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags) CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG) ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic dldflags = ARCH_FLAG = DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) LDSHARED = $(CC) -shared LDSHAREDXX = $(CXX) -shared AR = ar EXEEXT = RUBY_INSTALL_NAME = ruby2.1 RUBY_SO_NAME = ruby-2.1 RUBYW_INSTALL_NAME = RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) RUBYW_BASE_NAME = rubyw RUBY_BASE_NAME = ruby arch = x86_64-linux-gnu sitearch = $(arch) ruby_version = 2.1.0 ruby = $(bindir)/ruby2.1 RUBY = $(ruby) ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h RM = rm -f RM_RF = $(RUBY) -run -e rm -- -rf RMDIRS = rmdir --ignore-fail-on-non-empty -p MAKEDIRS = /bin/mkdir -p INSTALL = /usr/bin/install -c INSTALL_PROG = $(INSTALL) -m 0755 INSTALL_DATA = $(INSTALL) -m 644 COPY = cp TOUCH = exit > #### End of system configuration section. #### preload = libpath = . $(archlibdir) LIBPATH = -L. -L$(archlibdir) DEFFILE = CLEANFILES = mkmf.log DISTCLEANFILES = DISTCLEANDIRS = extout = extout_prefix = target_prefix = LOCAL_LIBS = LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc ORIG_SRCS = SRCS = $(ORIG_SRCS) OBJS = HDRS = TARGET = TARGET_NAME = TARGET_ENTRY = Init_$(TARGET_NAME) DLLIB = EXTSTATIC = STATIC_LIB = TIMESTAMP_DIR = . BINDIR = $(bindir) RUBYCOMMONDIR = $(sitedir)$(target_prefix) RUBYLIBDIR = $(sitelibdir)$(target_prefix) RUBYARCHDIR = $(sitearchdir)$(target_prefix) HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) TARGET_SO = $(DLLIB) CLEANLIBS = $(TARGET).so CLEANOBJS = *.o *.bak all: Makefile static: $(STATIC_LIB) .PHONY: all install static install-so install-rb .PHONY: clean clean-so clean-static clean-rb clean-static:: clean-rb-default:: clean-rb:: clean-so:: clean: clean-so clean-static clean-rb-default clean-rb -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time distclean-rb-default:: distclean-rb:: distclean-so:: distclean-static:: distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true realclean: distclean install: install-so install-rb install-so: Makefile install-rb: pre-install-rb install-rb-default install-rb-default: pre-install-rb-default pre-install-rb: Makefile pre-install-rb-default: Makefile pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time install-rb-default: $(RUBYLIBDIR)/gio2/inet-address.rb $(RUBYLIBDIR)/gio2/inet-address.rb: $(srcdir)/lib/gio2/inet-address.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/inet-address.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gio2/deprecated.rb $(RUBYLIBDIR)/gio2/deprecated.rb: $(srcdir)/lib/gio2/deprecated.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/deprecated.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gio2/pollable-input-stream.rb $(RUBYLIBDIR)/gio2/pollable-input-stream.rb: $(srcdir)/lib/gio2/pollable-input-stream.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/pollable-input-stream.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gio2/input-stream.rb $(RUBYLIBDIR)/gio2/input-stream.rb: $(srcdir)/lib/gio2/input-stream.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/input-stream.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gio2/loader.rb $(RUBYLIBDIR)/gio2/loader.rb: $(srcdir)/lib/gio2/loader.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/loader.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gio2/resources.rb $(RUBYLIBDIR)/gio2/resources.rb: $(srcdir)/lib/gio2/resources.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/resources.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gio2/pollable-output-stream.rb $(RUBYLIBDIR)/gio2/pollable-output-stream.rb: $(srcdir)/lib/gio2/pollable-output-stream.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2/pollable-output-stream.rb $(@D) pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.time install-rb-default: $(RUBYLIBDIR)/gio2.rb $(RUBYLIBDIR)/gio2.rb: $(srcdir)/lib/gio2.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gio2.rb $(@D) pre-install-rb-default: $(ECHO) installing default libraries $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gio2.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/gio2 $(Q) $(TOUCH) $@ $(TIMESTAMP_DIR)/.RUBYLIBDIR.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR) $(Q) $(TOUCH) $@ site-install: site-install-so site-install-rb site-install-so: install-so site-install-rb: install-rb ruby-gnome2-all-2.2.5/gio2/Makefile0000644000175000017500000000062012446173033015113 0ustar koukouall: (cd ext/gio2 && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/gio2 && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/gio2 && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/gio2 && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/gio2 && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib ruby-gnome2-all-2.2.5/cairo-gobject/0000755000175000017500000000000012516441042015321 5ustar koukouruby-gnome2-all-2.2.5/cairo-gobject/test/0000755000175000017500000000000012257552167016315 5ustar koukouruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairocontent.rb0000644000175000017500000000167612257552167022403 0ustar koukou# Copyright (C) 2013 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 class TestCairoContent < Test::Unit::TestCase def test_cairo_content assert_nothing_raised do CairoGObject::Content.new(CairoGObject::Content::COLOR) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairodevicetype.rb0000644000175000017500000000171012257552167023057 0ustar koukou# Copyright (C) 2013 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 class TestCairoDeviceType < Test::Unit::TestCase def test_cairo_device_type assert_nothing_raised do CairoGObject::DeviceType.new(CairoGObject::DeviceType::GL) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairotextclusterflags.rb0000644000175000017500000000174712257552167024333 0ustar koukou# Copyright (C) 2013 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 class TestCairoTextClusterFlags < Test::Unit::TestCase def test_cairo_text_clutter_flags assert_nothing_raised do CairoGObject::TextClusterFlags.new(CairoGObject::TextClusterFlags::BACKWARD) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairostatus.rb0000644000175000017500000000167412257552167022252 0ustar koukou# Copyright (C) 2013 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 class TestCairoStatus < Test::Unit::TestCase def test_cairo_status assert_nothing_raised do CairoGObject::Status.new(CairoGObject::Status::SUCCESS) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairofontweight.rb0000644000175000017500000000170312257552167023076 0ustar koukou# Copyright (C) 2013 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 class TestCaitoFontWeight < Test::Unit::TestCase def test_cairo_font_weight assert_nothing_raised do CairoGObject::FontWeight.new(Cairo::FontWeight::BOLD) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairofonttype.rb0000644000175000017500000000170012257552167022565 0ustar koukou# Copyright (C) 2013 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 class TestCairoFontType < Test::Unit::TestCase def test_caito_font_type assert_nothing_raised do CairoGObject::FontType.new(CairoGObject::FontType::FT) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairooperator.rb0000644000175000017500000000167212257552167022560 0ustar koukou# Copyright (C) 2013 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 class TestCairoOperator < Test::Unit::TestCase def test_cairo_operator assert_nothing_raised do CairoGObject::Operator.new(Cairo::Operator::OVER) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoscaledfont.rb0000644000175000017500000000237112257552167023044 0ustar koukou# Copyright (C) 2013 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 class TestCairoScaledFont < Test::Unit::TestCase def setup surface = Cairo::ImageSurface.new(Cairo::Format::ARGB32, 290, 200) context = Cairo::Context.new(surface) @font_face = context.font_face @font_matrix = Cairo::Matrix.identity @scale = Cairo::Matrix.scale(0.5, 1.0) @font_option = Cairo::FontOptions.new end def test_cairo_scaled_font assert_nothing_raised do Cairo::ScaledFont.new(@font_face, @font_matrix, @scale, @font_option) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairosubpixelorder.rb0000644000175000017500000000172212257552167023610 0ustar koukou# Copyright (C) 2013 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 class TestCairoSubpixelOrder < Test::Unit::TestCase def test_cairo_subpixel_order assert_nothing_raised do CairoGObject::SubpixelOrder.new(Cairo::SubpixelOrder::DEFAULT) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoregionoverlap.rb0000644000175000017500000000171612257552167023600 0ustar koukou# Copyright (C) 2013 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 class TestCairoRegionOverlap < Test::Unit::TestCase def test_cairo_regin_overlap assert_nothing_raised do CairoGObject::RegionOverlap.new(Cairo::RegionOverlap::PART) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoextend.rb0000644000175000017500000000167312257552167022215 0ustar koukou# Copyright (C) 2013 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 class TestCairoExtend < Test::Unit::TestCase def test_cairo_extend assert_nothing_raised do CairoGObject::Extend.new(CairoGObject::Extend::REPEAT) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoantialias.rb0000644000175000017500000000171012257552167022663 0ustar koukou# Copyright (C) 2013 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 class TestCaitoAntialias < Test::Unit::TestCase def test_cairo_antialias assert_nothing_raised do CairoGObject::Antialias.new(CairoGObject::Antialias::DEFAULT) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/run-test.rb0000755000175000017500000000346612077252561020432 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2013 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") modules = [ [glib_base, "glib2"], [gobject_introspection_base, "gobject-introspection"], [cairo_gobject_base, "cairo-gobject"], ] modules.each do |target, module_name| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" $LOAD_PATH.unshift(File.join(cairo_gobject_base, "test")) require "cairo-gobject-test-utils" require "cairo-gobject" exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/cairo-gobject/test/cairo-gobject-test-utils.rb0000644000175000017500000000153312077252561023462 0ustar koukou# Copyright (C) 2013 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 require "test-unit" require "test/unit/notify" module CairoGObjectTestUtils end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairosurfacetype.rb0000644000175000017500000000171712257552167023257 0ustar koukou# Copyright (C) 2013 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 class TestCairoSurfaceType < Test::Unit::TestCase def test_cairo_surface_type assert_nothing_raised do CairoGObject::SurfaceType.new(CairoGObject::SurfaceType::IMAGE) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairopatterntype.rb0000644000175000017500000000172012257552167023276 0ustar koukou# Copyright (C) 2013 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 class TestCairoPatternType < Test::Unit::TestCase def test_caito_pattern_type assert_nothing_raised do CairoGObject::PatternType.new(CairoGObject::PatternType::LINEAR) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairohintstyle.rb0000644000175000017500000000170012257552167022740 0ustar koukou# Copyright (C) 2013 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 class TestCairoHintStyle < Test::Unit::TestCase def test_cairo_hintstyle assert_nothing_raised do CairoGObject::HintStyle.new(Cairo::HintStyle::MEDIUM) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoregion.rb0000644000175000017500000000162612257552167022207 0ustar koukou# Copyright (C) 2013 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 class TestCairoRegion < Test::Unit::TestCase def test_cairo_region assert_nothing_raised do Cairo::Region.new end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairofilter.rb0000644000175000017500000000166612257552167022215 0ustar koukou# Copyright (C) 2013 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 class TestCairoFilter < Test::Unit::TestCase def test_cairo_filter assert_nothing_raised do CairoGObject::Filter.new(Cairo::Filter::GAUSSIAN) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairolinejoin.rb0000644000175000017500000000167312257552167022535 0ustar koukou# Copyright (C) 2013 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 class TestCairoLineJoin < Test::Unit::TestCase def test_cairo_linejoin assert_nothing_raised do CairoGObject::LineJoin.new(Cairo::LineJoin::ROUND) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoformat.rb0000644000175000017500000000166312257552167022215 0ustar koukou# Copyright (C) 2013 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 class TestCairoFormat < Test::Unit::TestCase def test_cairo_format assert_nothing_raised do CairoGObject::Format.new(Cairo::Format::RGB24) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairocontext.rb0000644000175000017500000000175312257552167022411 0ustar koukou# Copyright (C) 2013 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 class TestCairoContext < Test::Unit::TestCase def test_cairo_context assert_nothing_raised do surface = Cairo::ImageSurface.new(Cairo::Format::ARGB32, 290, 200) Cairo::Context.new(surface) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairofillrule.rb0000644000175000017500000000170512257552167022540 0ustar koukou# Copyright (C) 2013 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 class TestCairoFullRule < Test::Unit::TestCase def test_cairo_fill_rule assert_nothing_raised do CairoGObject::FillRule.new(CairoGObject::FillRule::WINDING) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairoimagesurface.rb0000644000175000017500000000171212257552167023353 0ustar koukou# Copyright (C) 2013 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 class TestCairoImageSurface < Test::Unit::TestCase def test_cairo_image_surface assert_nothing_raised do Cairo::ImageSurface.new(Cairo::Format::ARGB32, 290, 200) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairopathdatatype.rb0000644000175000017500000000171712257552167023415 0ustar koukou# Copyright (C) 2013 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 class TestCairoPathDataType < Test::Unit::TestCase def test_cairo_path_data_type assert_nothing_raised do CairoGObject::PathDataType.new(Cairo::PathDataType::LINE_TO) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairolinecap.rb0000644000175000017500000000166212257552167022337 0ustar koukou# Copyright (C) 2013 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 class TestLineCap < Test::Unit::TestCase def test_cairo_linecap assert_nothing_raised do CairoGObject::LineCap.new(Cairo::LineCap::ROUND) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairofontslant.rb0000644000175000017500000000170112257552167022726 0ustar koukou# Copyright (C) 2013 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 class TestCairoFontSlant < Test::Unit::TestCase def test_cairo_font_slant assert_nothing_raised do CairoGObject::FontSlant.new(Cairo::FontSlant::NORMAL) end end end ruby-gnome2-all-2.2.5/cairo-gobject/test/test_cairohintmetrics.rb0000644000175000017500000000170512257552167023253 0ustar koukou# Copyright (C) 2013 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 class TestCairoHintMetrics < Test::Unit::TestCase def test_cairo_hint_metrics assert_nothing_raised do CairoGObject::HintMetrics.new(Cairo::HintMetrics::ON) end end end ruby-gnome2-all-2.2.5/cairo-gobject/extconf.rb0000755000175000017500000000402712077252561017332 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2013 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 require "pathname" require "mkmf" require "rbconfig" require "fileutils" module_name = "cairo_gobject" package = "cairo-gobject" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' if RbConfig.respond_to?(:ruby) ruby = RbConfig.ruby else ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) end build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" unless system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) exit(false) end create_makefile(module_name) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ruby-gnome2-all-2.2.5/cairo-gobject/Rakefile0000644000175000017500000000255012446160551016775 0ustar koukou# -*- ruby -*- # # Copyright (C) 2012 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/CairoGObject is a Ruby binding of cairo-gobject." package.description = "Ruby/CairoGObject is a Ruby binding of cairo-gobject." package.dependency.gem.runtime = ["cairo", "glib2"] package.dependency.gem.development = ["test-unit-notify"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = ["cairo", "glib2"] package.windows.build_packages = [] end package_task.define ruby-gnome2-all-2.2.5/cairo-gobject/README.md0000644000175000017500000000106112077252561016606 0ustar koukou# Ruby/CairoGObject Ruby/CairoGObject is a Ruby binding of cairo-gobject. ## Requirements * Ruby/GLib2 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [rcairo](https://github.com/rcairo/rcairo) * [cairo](http://cairographics.org/) GObject binding ## Install gem install cairo-gobject ## License Copyright (c) 2012-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/cairo-gobject/ext/0000755000175000017500000000000012077252561016131 5ustar koukouruby-gnome2-all-2.2.5/cairo-gobject/ext/cairo-gobject/0000755000175000017500000000000012446160551020636 5ustar koukouruby-gnome2-all-2.2.5/cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.h0000644000175000017500000000252512077252561024127 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 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_CAIRO_GOBJECT_H #define RB_CAIRO_GOBJECT_H #include #include #include #include #ifndef CAIRO_GOBJECT_TYPE_HINT_METRICS # define CAIRO_GOBJECT_TYPE_HINT_METRICS CAIRO_GOBJECT_TYPE_HNT_METRICS #endif #ifndef CAIRO_GOBJECT_TYPE_TEXT_CLUSTER_FLAGS # define CAIRO_GOBJECT_TYPE_TEXT_CLUSTER_FLAGS cairo_gobject_text_cluster_flags_get_type () #endif #include extern void Init_cairo_gobject(void); #endif ruby-gnome2-all-2.2.5/cairo-gobject/ext/cairo-gobject/extconf.rb0000755000175000017500000000511012446160551022631 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2013 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 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 = "cairo_gobject" package_id = "cairo-gobject" begin require "mkmf-gnome2" rescue LoadError require "rubygems" gem "glib2" require "mkmf-gnome2" end ["glib2"].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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libcairo2-dev", :fedora => "cairo-gobject-devel", :homebrew => "cairo") exit(false) end create_pkg_config_file("Ruby/CairoGObject", package_id, ruby_gnome2_version, "ruby-cairo-gobject.pc") ensure_objs $defs << "-DRUBY_CAIRO_GOBJECT_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 ruby-gnome2-all-2.2.5/cairo-gobject/ext/cairo-gobject/rb-cairo-gobject.c0000644000175000017500000001743412416346617024132 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 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 "rb-cairo-gobject.h" #define RG_TARGET_NAMESPACE rb_mCairoGObject #define DEFINE_CONVERSION(prefix, gtype, rb_klass, RVAL2CR, CR2RVAL) \ static gpointer \ prefix ## _robj2instance(VALUE rb_object, \ G_GNUC_UNUSED gpointer user_data) \ { \ ID id_gboxed; \ VALUE rb_boxed = Qnil; \ \ CONST_ID(id_gboxed, "gboxed"); \ if (rb_ivar_defined(rb_object, id_gboxed)) { \ rb_boxed = rb_ivar_get(rb_object, id_gboxed); \ } \ if (NIL_P(rb_boxed)) { \ gpointer cr_object = RVAL2CR(rb_object); \ rb_boxed = rbgobj_make_boxed_default(cr_object, gtype); \ rb_ivar_set(rb_object, id_gboxed, rb_boxed); \ } \ \ return rbgobj_boxed_get_default(rb_boxed, gtype); \ } \ \ static VALUE \ prefix ## _instance2robj(gpointer cr_object, \ G_GNUC_UNUSED gpointer user_data) \ { \ return CR2RVAL(cr_object); \ } \ \ static void \ define_ ## prefix ## _conversion(void) \ { \ RGConvertTable table; \ \ memset(&table, 0, sizeof(RGConvertTable)); \ table.type = gtype; \ table.klass = rb_klass; \ table.robj2instance = prefix ## _robj2instance; \ table.instance2robj = prefix ## _instance2robj; \ \ RG_DEF_CONVERSION(&table); \ } DEFINE_CONVERSION(context, CAIRO_GOBJECT_TYPE_CONTEXT, rb_cCairo_Context, RVAL2CRCONTEXT, CRCONTEXT2RVAL) DEFINE_CONVERSION(device, CAIRO_GOBJECT_TYPE_DEVICE, rb_cCairo_Device, RVAL2CRDEVICE, CRDEVICE2RVAL) DEFINE_CONVERSION(pattern, CAIRO_GOBJECT_TYPE_PATTERN, rb_cCairo_Pattern, RVAL2CRPATTERN, CRPATTERN2RVAL) DEFINE_CONVERSION(surface, CAIRO_GOBJECT_TYPE_SURFACE, rb_cCairo_Surface, RVAL2CRSURFACE, CRSURFACE2RVAL) DEFINE_CONVERSION(scaled_font, CAIRO_GOBJECT_TYPE_SCALED_FONT, rb_cCairo_ScaledFont, RVAL2CRSCALEDFONT, CRSCALEDFONT2RVAL) DEFINE_CONVERSION(font_face, CAIRO_GOBJECT_TYPE_FONT_FACE, rb_cCairo_FontFace, RVAL2CRFONTFACE, CRFONTFACE2RVAL) DEFINE_CONVERSION(font_options, CAIRO_GOBJECT_TYPE_FONT_OPTIONS, rb_cCairo_FontOptions, RVAL2CRFONTOPTIONS, CRFONTOPTIONS2RVAL) DEFINE_CONVERSION(region, CAIRO_GOBJECT_TYPE_REGION, rb_cCairo_Region, RVAL2CRREGION, CRREGION2RVAL) void Init_cairo_gobject(void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module("CairoGObject"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(CAIRO_VERSION_MAJOR), INT2FIX(CAIRO_VERSION_MINOR), INT2FIX(CAIRO_VERSION_MICRO))); define_context_conversion(); define_device_conversion(); define_pattern_conversion(); define_surface_conversion(); define_scaled_font_conversion(); define_font_face_conversion(); define_font_options_conversion(); define_region_conversion(); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_STATUS, "Status", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_CONTENT, "Content", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_OPERATOR, "Operator", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_ANTIALIAS, "Antialias", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FILL_RULE, "FillRule", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_LINE_CAP, "LineCap", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_LINE_JOIN, "LineJoin", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_TEXT_CLUSTER_FLAGS, "TextClusterFlags", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FONT_SLANT, "FontSlant", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FONT_WEIGHT, "FontWeight", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_SUBPIXEL_ORDER, "SubpixelOrder", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_HINT_STYLE, "HintStyle", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_HINT_METRICS, "HintMetrics", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FONT_TYPE, "FontType", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_PATH_DATA_TYPE, "PathDataType", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_DEVICE_TYPE, "DeviceType", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_SURFACE_TYPE, "SurfaceType", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FORMAT, "Format", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_PATTERN_TYPE, "PatternType", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_EXTEND, "Extend", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_FILTER, "Filter", RG_TARGET_NAMESPACE); G_DEF_CLASS(CAIRO_GOBJECT_TYPE_REGION_OVERLAP, "RegionOverlap", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/cairo-gobject/COPYING.LIB0000644000175000017500000006364212077252561017004 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/cairo-gobject/lib/0000755000175000017500000000000012077252561016077 5ustar koukouruby-gnome2-all-2.2.5/cairo-gobject/lib/cairo-gobject.rb0000644000175000017500000000203512077252561021134 0ustar koukou# Copyright (C) 2013 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 require "cairo" require "glib2" begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/cairo_gobject.so" rescue LoadError require "cairo_gobject.so" end module CairoGObject LOG_DOMAIN = "CairoGObject" GLib::Log.set_log_domain(LOG_DOMAIN) end ruby-gnome2-all-2.2.5/pango/0000755000175000017500000000000012516441042013715 5ustar koukouruby-gnome2-all-2.2.5/pango/test/0000755000175000017500000000000012516434313014677 5ustar koukouruby-gnome2-all-2.2.5/pango/test/test-color.rb0000644000175000017500000000265212124610262017316 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestPangoColor < Test::Unit::TestCase include PangoTestUtils def test_red color = Pango::Color.new(0, 0, 0) assert_equal(0, color.red) color.red = 32768 assert_equal(32768, color.red) end def test_blue color = Pango::Color.new(0, 0, 0) assert_equal(0, color.blue) color.blue = 32768 assert_equal(32768, color.blue) end def test_green color = Pango::Color.new(0, 0, 0) assert_equal(0, color.green) color.green = 32768 assert_equal(32768, color.green) end def test_to_a color = Pango::Color.new(65535, 32768, 0) assert_equal([65535, 32768, 0], color.to_a) end end ruby-gnome2-all-2.2.5/pango/test/test-language.rb0000644000175000017500000000025112516434313017762 0ustar koukouclass TestLanguage < Test::Unit::TestCase include PangoTestUtils def test_default assert_match(/\A[a-z]{2}-[a-z]{2}\z/, Pango::Language.default.to_s) end end ruby-gnome2-all-2.2.5/pango/test/test-analysis.rb0000644000175000017500000000171712124610262020024 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestPangoAnalysis < Test::Unit::TestCase include PangoTestUtils def test_level analysis = Pango::Analysis.new assert_equal(0, analysis.level) end end ruby-gnome2-all-2.2.5/pango/test/test-layout.rb0000644000175000017500000000146712516434313017526 0ustar koukouclass TestLayout < Test::Unit::TestCase include PangoTestUtils def setup @context = Pango::Context.new @layout = Pango::Layout.new(@context) end def test_set_font_description assert_nil(@layout.font_description) @layout.font_description = "sans 14" assert_equal("sans 14", @layout.font_description.to_s) description = Pango::FontDescription.new("monospace") description.size = 10 * Pango::SCALE @layout.font_description = description assert_equal("monospace 10", @layout.font_description.to_s) end def test_height assert_equal(-1, @layout.height) end def test_set_height new_height = 29 * Pango::SCALE @layout.height = new_height assert_equal(new_height, @layout.height) end def test_ellipsized? assert_false(@layout.ellipsized?) end end ruby-gnome2-all-2.2.5/pango/test/run-test.rb0000755000175000017500000000135711701304107017006 0ustar koukou#!/usr/bin/env ruby $VERBOSE = true ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") pango_base = File.join(ruby_gnome2_base, "pango") $LOAD_PATH.unshift(File.join(glib_base, "test")) require 'glib-test-init' [[glib_base, "glib2"], [pango_base, "pango"]].each do |target, module_name| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(1) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(pango_base, "test")) require 'pango-test-utils' require 'pango' exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/pango/test/test-rectangle.rb0000644000175000017500000000174312124610262020144 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestPangoRectangle < Test::Unit::TestCase include PangoTestUtils def test_width rectangle = Pango::Rectangle.new(0, 10, 20, 30) assert_equal(20, rectangle.width) end end ruby-gnome2-all-2.2.5/pango/test/test-matrix.rb0000644000175000017500000000170312124610262017500 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestPangoMatrix < Test::Unit::TestCase include PangoTestUtils def test_xx matrix = Pango::Matrix.new assert_equal(1.0, matrix.xx) end end ruby-gnome2-all-2.2.5/pango/test/pango-test-utils.rb0000644000175000017500000000034311701304107020433 0ustar koukoumodule PangoTestUtils private def only_pango_version(major, minor, micro=nil) micro ||= 0 unless Pango.check_version?(major, minor, micro) omit("Require Pango >= #{major}.#{minor}.#{micro}") end end end ruby-gnome2-all-2.2.5/pango/test/test-attribute.rb0000644000175000017500000000071311701304107020175 0ustar koukouclass TestAttribute < Test::Unit::TestCase include PangoTestUtils def setup @attribute = Pango::AttrLanguage.new(Pango::Language.default) end def test_start_index assert_equal(0, @attribute.start_index) @attribute.start_index = 5 assert_equal(5, @attribute.start_index) end def test_end_index assert_equal(GLib::MAXUINT, @attribute.end_index) @attribute.end_index = 5 assert_equal(5, @attribute.end_index) end end ruby-gnome2-all-2.2.5/pango/test/test-log-attr.rb0000644000175000017500000000173012124610262017725 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestPangoLogAttr < Test::Unit::TestCase include PangoTestUtils def test_line_break? attribute = Pango::LogAttr.new assert_false(attribute.line_break?) end end ruby-gnome2-all-2.2.5/pango/extconf.rb0000644000175000017500000000222411701304107015703 0ustar koukou#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "pango" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ruby-gnome2-all-2.2.5/pango/Rakefile0000644000175000017500000000355412446160551015376 0ustar koukou# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/Pango is a Ruby binding of pango-1.x." package.description = "Ruby/Pango is a Ruby binding of pango-1.x." package.dependency.gem.runtime = [["cairo", ">= 1.14.0"], "glib2"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = ["glib2", "gobject-introspection"] package.external_packages = [ { :name => "icu", :download_base_url => "http://download.icu-project.org/files/icu4c/54.1", :label => "gobject-introspection", :base_name => "icu", :archive_base_name => "icu4c-54_1-src.tgz", :compression_method => "gz", :base_dir_in_package => "source", :windows => { :configure_args => [ "--with-cross-build=#{package.package.tmp_dir}/native/icu/icu/source", ], :built_file => "bin/icu-config", }, :native => { :build => true, :built_file => "bin/icu-config", }, }, { :name => "harfbuzz", :download_base_url => "http://www.freedesktop.org/software/harfbuzz/release", :label => "HarfBuzz", :version => "0.9.35", :compression_method => "bz2", :windows => { :configure_args => [ ], :patches => [ ], :built_file => "bin/libharfbuzz-0.dll", }, }, { :name => "pango", :download_site => :gnome, :label => "pango", :version => "1.36.8", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :patches => [ "pango-1.34.0-enable-fc-font.diff", ], :built_file => "bin/libpango-1.0-0.dll", }, }, ] end package_task.define ruby-gnome2-all-2.2.5/pango/ext/0000755000175000017500000000000011701304107014510 5ustar koukouruby-gnome2-all-2.2.5/pango/ext/pango/0000755000175000017500000000000012516434313015624 5ustar koukouruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoconversions.h0000644000175000017500000001743011701304107021713 0ustar koukou/* -*- 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 */ #ifndef __PANGOCONVERSIONS_H__ #define __PANGOCONVERSIONS_H__ #define RVAL2PANGOCAIROFONTMAP(o) (PANGO_CAIRO_FONT_MAP(RVAL2GOBJ(o))) #define RVAL2PANGOCONTEXT(o) (PANGO_CONTEXT(RVAL2GOBJ(o))) #define RVAL2PANGOENGINE(o) (PANGO_ENGINE(RVAL2GOBJ(o))) #define RVAL2PANGOENGINELANG(o) (PANGO_ENGINE_LANG(RVAL2GOBJ(o))) #define RVAL2PANGOENGINESHAPE(o) (PANGO_ENGINE_SHAPE(RVAL2GOBJ(o))) #define RVAL2PANGOFONT(o) (PANGO_FONT(RVAL2GOBJ(o))) #define RVAL2PANGOFONTSET(o) (PANGO_FONTSET(RVAL2GOBJ(o))) #define RVAL2PANGOFONTSETSIMPLE(o) (PANGO_FONTSET_SIMPLE(RVAL2GOBJ(o))) #define RVAL2PANGOFONTFACE(o) (PANGO_FONT_FACE(RVAL2GOBJ(o))) #define RVAL2PANGOFONTFAMILY(o) (PANGO_FONT_FAMILY(RVAL2GOBJ(o))) #define RVAL2PANGOFONTMAP(o) (PANGO_FONT_MAP(RVAL2GOBJ(o))) #define RVAL2PANGOLAYOUT(o) (PANGO_LAYOUT(RVAL2GOBJ(o))) #define RVAL2PANGORENDERER(o) (PANGO_RENDERER(RVAL2GOBJ(o))) #define RVAL2PANGOANALYSIS(o) ((PangoAnalysis*)RVAL2BOXED(o, PANGO_TYPE_ANALYSIS)) #define PANGOANALYSIS2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_ANALYSIS)) #define RVAL2PANGOATTRITERATOR(o) ((PangoAttrIterator*)RVAL2BOXED(o, PANGO_TYPE_ATTR_ITERATOR)) #define PANGOATTRITERATOR2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_ATTR_ITERATOR)) #define RVAL2PANGOATTRLIST(o) ((PangoAttrList*)RVAL2BOXED(o, PANGO_TYPE_ATTR_LIST)) #define PANGOATTRLIST2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_ATTR_LIST)) #define RVAL2PANGOCOLOR(o) ((PangoColor*)RVAL2BOXED(o, PANGO_TYPE_COLOR)) #define PANGOCOLOR2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_COLOR)) #define RVAL2PANGOCOVERAGE(o) ((PangoCoverage*)RVAL2BOXED(o, PANGO_TYPE_COVERAGE)) #define PANGOCOVERAGE2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_COVERAGE)) #define RVAL2PANGOFONTDESCRIPTION(o) ((PangoFontDescription*)RVAL2BOXED(o, PANGO_TYPE_FONT_DESCRIPTION)) #define PANGOFONTDESCRIPTION2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_FONT_DESCRIPTION)) #define RVAL2PANGOFONTMETRICS(o) ((PangoFontMetrics*)RVAL2BOXED(o, PANGO_TYPE_FONT_METRICS)) #define PANGOFONTMETRICS2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_FONT_METRICS)) #define RVAL2PANGOGLYPHINFO(o) ((PangoGlyphInfo*)RVAL2BOXED(o, PANGO_TYPE_GLYPH_INFO)) #define PANGOGLYPHINFO2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_GLYPH_INFO)) #define RVAL2PANGOGLYPHITEM(o) ((PangoGlyphItem*)RVAL2BOXED(o, PANGO_TYPE_GLYPH_ITEM)) #define PANGOGLYPHITEM2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_GLYPH_ITEM)) #define RVAL2PANGOGLYPHSTRING(o) ((PangoGlyphString*)RVAL2BOXED(o, PANGO_TYPE_GLYPH_STRING)) #define PANGOGLYPHSTRING2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_GLYPH_STRING)) #define RVAL2PANGOITEM(o) ((PangoItem*)RVAL2BOXED(o, PANGO_TYPE_ITEM)) #define PANGOITEM2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_ITEM)) #define RVAL2PANGOLANGUAGE(o) ((PangoLanguage*)RVAL2BOXED(o, PANGO_TYPE_LANGUAGE)) #define PANGOLANGUAGE2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_LANGUAGE)) #define RVAL2PANGOLAYOUTITER(o) ((PangoLayoutIter*)RVAL2BOXED(o, PANGO_TYPE_LAYOUT_ITER)) #define PANGOLAYOUTITER2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_LAYOUT_ITER)) #define RVAL2PANGOLAYOUTLINE(o) ((PangoLayoutLine*)RVAL2BOXED(o, PANGO_TYPE_LAYOUT_LINE)) #define PANGOLAYOUTLINE2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_LAYOUT_LINE)) #define RVAL2PANGOLOGATTR(o) ((PangoLogAttr*)RVAL2BOXED(o, PANGO_TYPE_LOG_ATTR)) #define PANGOLOGATTR2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_LOG_ATTR)) #define RVAL2PANGOMATRIX(o) ((PangoMatrix*)RVAL2BOXED(o, PANGO_TYPE_MATRIX)) #define PANGOMATRIX2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_MATRIX)) #define RVAL2PANGORECTANGLE(o) ((PangoRectangle*)RVAL2BOXED(o, PANGO_TYPE_RECTANGLE)) #define PANGORECTANGLE2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_RECTANGLE)) #define RVAL2PANGOSCRIPTITER(o) ((PangoScriptIter*)RVAL2BOXED(o, PANGO_TYPE_SCRIPT_ITER)) #define PANGOSCRIPTITER2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_SCRIPT_ITER)) #define RVAL2PANGOTABARRAY(o) ((PangoTabArray*)RVAL2BOXED(o, PANGO_TYPE_TAB_ARRAY)) #define PANGOTABARRAY2RVAL(o) (BOXED2RVAL(o, PANGO_TYPE_TAB_ARRAY)) #define RVAL2PANGOALIGNMENT(o) (RVAL2GENUM(o, PANGO_TYPE_ALIGNMENT)) #define PANGOALIGNMENT2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_ALIGNMENT)) #define RVAL2PANGOCOVERAGELEVEL(o) (RVAL2GENUM(o, PANGO_TYPE_COVERAGE_LEVEL)) #define PANGOCOVERAGELEVEL2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_COVERAGE_LEVEL)) #define RVAL2PANGODIRECTION(o) (RVAL2GENUM(o, PANGO_TYPE_DIRECTION)) #define PANGODIRECTION2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_DIRECTION)) #define RVAL2PANGOELLIPSIZEMODE(o) (RVAL2GENUM(o, PANGO_TYPE_ELLIPSIZE_MODE)) #define PANGOELLIPSIZEMODE2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_ELLIPSIZE_MODE)) #define RVAL2PANGOGRAVITY(o) (RVAL2GENUM(o, PANGO_TYPE_GRAVITY)) #define PANGOGRAVITY2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_GRAVITY)) #define RVAL2PANGOGRAVITYHINT(o) (RVAL2GENUM(o, PANGO_TYPE_GRAVITY_HINT)) #define PANGOGRAVITYHINT2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_GRAVITY_HINT)) #define RVAL2PANGORENDERPART(o) (RVAL2GENUM(o, PANGO_TYPE_RENDER_PART)) #define PANGORENDERPART2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_RENDER_PART)) #define RVAL2PANGOSCRIPT(o) (RVAL2GENUM(o, PANGO_TYPE_SCRIPT)) #define PANGOSCRIPT2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_SCRIPT)) #define RVAL2PANGOSTRETCH(o) (RVAL2GENUM(o, PANGO_TYPE_STRETCH)) #define PANGOSTRETCH2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_STRETCH)) #define RVAL2PANGOSTYLE(o) (RVAL2GENUM(o, PANGO_TYPE_STYLE)) #define PANGOSTYLE2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_STYLE)) #define RVAL2PANGOTABALIGN(o) (RVAL2GENUM(o, PANGO_TYPE_TAB_ALIGN)) #define PANGOTABALIGN2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_TAB_ALIGN)) #define RVAL2PANGOUNDERLINE(o) (RVAL2GENUM(o, PANGO_TYPE_UNDERLINE)) #define PANGOUNDERLINE2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_UNDERLINE)) #define RVAL2PANGOVARIANT(o) (RVAL2GENUM(o, PANGO_TYPE_VARIANT)) #define PANGOVARIANT2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_VARIANT)) #define RVAL2PANGOWEIGHT(o) (RVAL2GENUM(o, PANGO_TYPE_WEIGHT)) #define PANGOWEIGHT2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_WEIGHT)) #define RVAL2PANGOWRAPMODE(o) (RVAL2GENUM(o, PANGO_TYPE_WRAP_MODE)) #define PANGOWRAPMODE2RVAL(o) (GENUM2RVAL(o, PANGO_TYPE_WRAP_MODE)) #define RVAL2PANGOFONTMASK(o) (RVAL2GFLAGS(o, PANGO_TYPE_FONT_MASK)) #define PANGOFONTMASK2RVAL(o) (GFLAGS2RVAL(o, PANGO_TYPE_FONT_MASK)) #endif /* __PANGOCONVERSIONS_H__ */ ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoengine.c0000644000175000017500000000402411701304107020576 0ustar koukou/* -*- 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 "rbpangoprivate.h" #ifdef PANGO_TYPE_ENGINE #define _SELF(self) (RVAL2PANGOENGINE(self)) /* FIXME static VALUE rbpango_s_engine_list(VALUE self) { PangoEngineInfo* engines = g_new(PangoEngineInfo, 1); int i, n; VALUE ary; script_engine_list(&engines, &n); ary = rb_ary_new(); for(i = 0; i < n; i++){ rb_ary_push(ary, GOBJ2RVAL(&engines[i])); } return ary; } static VALUE rbpango_s_engine_create(VALUE self, VALUE id) { return GOBJ2RVAL(script_engine_create(RVAL2CSTR(id))); } */ /* void script_engine_init (GTypeModule *module); void script_engine_exit (void); PangoEngine* script_engine_create (const char *id); */ #endif void Init_pango_engine(VALUE mPango) { #ifdef PANGO_TYPE_ENGINE G_DEF_CLASS(PANGO_TYPE_ENGINE, "Engine", mPango); /* FIXME rb_define_singleton_method(engine, "engines", rbpango_s_engine_list, 0); rb_define_singleton_method(engine, "create", rbpango_s_engine_create, 1); */ G_DEF_CLASS(PANGO_TYPE_ENGINE_LANG, "EngineLang", mPango); G_DEF_CLASS(PANGO_TYPE_ENGINE_SHAPE, "EngineShape", mPango); #endif } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontdescription.c0000644000175000017500000001720012516434313022553 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFontDescription #define _SELF(self) (RVAL2PANGOFONTDESCRIPTION(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE str; PangoFontDescription *description; rb_scan_args(argc, argv, "01", &str); if (NIL_P(str)) { description = pango_font_description_new(); } else { description = pango_font_description_from_string(RVAL2CSTR(str)); } G_INITIALIZE(self, description); return Qnil; } /* PangoFontDescription* pango_font_description_copy (const PangoFontDescription *desc); PangoFontDescription* pango_font_description_copy_static (const PangoFontDescription *desc); */ static VALUE rg_hash(VALUE self) { return UINT2NUM(pango_font_description_hash(_SELF(self))); } static VALUE rg_operator_font_desc_equal(VALUE self, VALUE other) { return CBOOL2RVAL(pango_font_description_equal(_SELF(self), _SELF(other))); } /* Don't we need this? void pango_font_descriptions_free (PangoFontDescription **descs, int n_descs); */ static VALUE rg_set_family(VALUE self, VALUE family) { pango_font_description_set_family(_SELF(self), RVAL2CSTR(family)); return self; } /* Don't we need this? void pango_font_description_set_family_static (PangoFontDescription *desc, const char *family); */ static VALUE rg_family(VALUE self) { return CSTR2RVAL(pango_font_description_get_family(_SELF(self))); } static VALUE rg_set_style(VALUE self, VALUE style) { pango_font_description_set_style(_SELF(self), RVAL2PANGOSTYLE(style)); return self; } static VALUE rg_style(VALUE self) { return PANGOSTYLE2RVAL(pango_font_description_get_style(_SELF(self))); } static VALUE rg_set_variant(VALUE self, VALUE variant) { pango_font_description_set_variant(_SELF(self), RVAL2PANGOVARIANT(variant)); return self; } static VALUE rg_variant(VALUE self) { return PANGOVARIANT2RVAL(pango_font_description_get_variant(_SELF(self))); } static VALUE rg_set_weight(VALUE self, VALUE weight) { pango_font_description_set_weight(_SELF(self), RVAL2PANGOWEIGHT(weight)); return self; } static VALUE rg_weight(VALUE self) { return PANGOWEIGHT2RVAL(pango_font_description_get_weight(_SELF(self))); } static VALUE rg_set_stretch(VALUE self, VALUE stretch) { pango_font_description_set_stretch(_SELF(self), RVAL2PANGOSTRETCH(stretch)); return self; } static VALUE rg_stretch(VALUE self) { return PANGOSTRETCH2RVAL(pango_font_description_get_stretch(_SELF(self))); } static VALUE rg_set_size(VALUE self, VALUE size) { pango_font_description_set_size(_SELF(self), NUM2INT(size)); return self; } static VALUE rg_size(VALUE self) { return INT2NUM(pango_font_description_get_size(_SELF(self))); } static VALUE rg_set_absolute_size(VALUE self, VALUE size) { pango_font_description_set_absolute_size(_SELF(self), NUM2INT(size)); return self; } static VALUE rg_size_is_absolute_p(VALUE self) { return CBOOL2RVAL(pango_font_description_get_size_is_absolute(_SELF(self))); } #if PANGO_CHECK_VERSION(1,16,0) static VALUE rg_gravity(VALUE self) { return PANGOGRAVITY2RVAL(pango_font_description_get_gravity(_SELF(self))); } static VALUE rg_set_gravity(VALUE self, VALUE gravity) { pango_font_description_set_gravity(_SELF(self), RVAL2PANGOGRAVITY(gravity)); return self; } #endif static VALUE rg_set_fields(VALUE self) { return PANGOFONTMASK2RVAL(pango_font_description_get_set_fields(_SELF(self))); } static VALUE rg_unset_fields(VALUE self, VALUE to_unset) { pango_font_description_unset_fields(_SELF(self), RVAL2PANGOFONTMASK(to_unset)); return self; } static VALUE rg_merge(VALUE self, VALUE desc_to_merge, VALUE replace_existing) { pango_font_description_merge(_SELF(self), _SELF(desc_to_merge), RVAL2CBOOL(replace_existing)); return self; } /* Don't we need this? void pango_font_description_merge_static (PangoFontDescription *desc, const PangoFontDescription *desc_to_merge, gboolean replace_existing); */ static VALUE rg_better_match(VALUE self, VALUE old_match, VALUE new_match) { return CBOOL2RVAL(pango_font_description_better_match(_SELF(self), _SELF(old_match), _SELF(new_match))); } static VALUE rg_to_str(VALUE self) { return CSTR2RVAL(pango_font_description_to_string(_SELF(self))); } static VALUE rg_to_filename(VALUE self) { return CSTR2RVAL(pango_font_description_to_filename(_SELF(self))); } void Init_pango_font_description(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONT_DESCRIPTION, "FontDescription", mPango); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(hash, 0); RG_DEF_METHOD_OPERATOR("==", font_desc_equal, 1); RG_DEF_METHOD(set_family, 1); RG_DEF_METHOD(family, 0); RG_DEF_METHOD(set_style, 1); RG_DEF_METHOD(style, 0); RG_DEF_METHOD(set_variant, 1); RG_DEF_METHOD(variant, 0); RG_DEF_METHOD(set_weight, 1); RG_DEF_METHOD(weight, 0); RG_DEF_METHOD(set_stretch, 1); RG_DEF_METHOD(stretch, 0); RG_DEF_METHOD(set_size, 1); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(set_absolute_size, 1); RG_DEF_METHOD_P(size_is_absolute, 0); #if PANGO_CHECK_VERSION(1,16,0) RG_DEF_METHOD(set_gravity, 1); RG_DEF_METHOD(gravity, 0); #endif RG_DEF_METHOD(set_fields, 0); RG_DEF_METHOD(unset_fields, 1); RG_DEF_METHOD(merge, 2); RG_DEF_METHOD(better_match, 2); RG_DEF_METHOD(to_str, 0); RG_DEF_ALIAS("to_s", "to_str"); RG_DEF_METHOD(to_filename, 0); /* PangoStyle */ G_DEF_CLASS(PANGO_TYPE_STYLE, "Style", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_STYLE, "PANGO_"); /* PangoWeight */ G_DEF_CLASS(PANGO_TYPE_WEIGHT, "Weight", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_WEIGHT, "PANGO_"); /* PangoVariant */ G_DEF_CLASS(PANGO_TYPE_VARIANT, "Variant", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_VARIANT, "PANGO_"); /* PangoStretch */ G_DEF_CLASS(PANGO_TYPE_STRETCH, "Stretch", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_STRETCH, "PANGO_"); /* PangoFontMask */ G_DEF_CLASS(PANGO_TYPE_FONT_MASK, "FontMask", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_FONT_MASK, "PANGO_"); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontsetsimple.c0000644000175000017500000000330511701304107022226 0ustar koukou/* -*- 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 "rbpangoprivate.h" #ifdef PANGO_ENABLE_BACKEND #define RG_TARGET_NAMESPACE cFontsetSimple #define _SELF(self) (RVAL2PANGOFONTSETSIMPLE(self)) static VALUE rg_initialize(VALUE self, VALUE lang) { G_INITIALIZE(self, pango_fontset_simple_new(RVAL2PANGOLANGUAGE(lang))); return Qnil; } static VALUE rg_append(VALUE self, VALUE font) { pango_fontset_simple_append(_SELF(self), RVAL2PANGOFONT(font)); return self; } static VALUE rg_size(VALUE self) { return INT2NUM(pango_fontset_simple_size(_SELF(self))); } #endif void Init_pango_fontset_simple(VALUE mPango) { #ifdef PANGO_ENABLE_BACKEND VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONTSET_SIMPLE, "FontsetSimple", mPango); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(append, 1); RG_DEF_METHOD(size, 0); #endif } ruby-gnome2-all-2.2.5/pango/ext/pango/extconf.rb0000644000175000017500000000505512516434313017624 0ustar koukou=begin extconf.rb for Ruby/Pango extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "pango" package_id = "pango" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ruby_header = "ruby.h" have_func("rb_errinfo", ruby_header) ["glib2"].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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package([package_id, 1, 14, 0], :debian => "libpango1.0-dev", :redhat => "pango-devel", :homebrew => "pango", :macports => "pango") exit(false) end PKGConfig.have_package('pangocairo') if PKGConfig.have_package("pangowin32") $defs << " -DHAVE_PANGO_WIN32" end if PKGConfig.have_package("pangoft2") $defs << " -DHAVE_PANGO_FT2" end pango_header = "pango/pango.h" have_func("pango_layout_iter_get_type", pango_header) have_func("pango_render_part_get_type", pango_header) have_func("pango_attr_strikethrough_color_new", pango_header) have_func("pango_attr_underline_color_new", pango_header) have_func("pango_glyph_item_free", pango_header) have_func("pango_glyph_item_get_type", pango_header) have_func("pango_attr_iterator_get_attrs", pango_header) have_func("pango_itemize_with_base_dir", pango_header) have_func("pango_font_family_is_monospace", pango_header) make_version_header("PANGO", "pango", ".") create_pkg_config_file("Ruby/Pango", package_id) $defs << " -DRUBY_PANGO_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 ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangogravity.c0000644000175000017500000000344012516434313021027 0ustar koukou/* -*- 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 "rbpangoprivate.h" #if PANGO_CHECK_VERSION(1,16,0) #define RG_TARGET_NAMESPACE mGravity static VALUE rg_s_to_rotation(G_GNUC_UNUSED VALUE self, VALUE gravity) { return rb_float_new(pango_gravity_to_rotation(RVAL2PANGOGRAVITY(gravity))); } static VALUE rg_s_vertical_p(G_GNUC_UNUSED VALUE self, VALUE gravity) { return CBOOL2RVAL(PANGO_GRAVITY_IS_VERTICAL(RVAL2PANGOGRAVITY(gravity))); } #endif void Init_pango_gravity(VALUE mPango) { #if PANGO_CHECK_VERSION(1,16,0) VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mPango, "Gravity"); RG_DEF_SMETHOD(to_rotation, 1); RG_DEF_SMETHOD_P(vertical, 1); G_DEF_CLASS(PANGO_TYPE_GRAVITY, "Gravity", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_GRAVITY, "PANGO_GRAVITY_"); G_DEF_CLASS(PANGO_TYPE_GRAVITY_HINT, "Hint", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_GRAVITY_HINT, "PANGO_GRAVITY_"); #endif } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontmap.c0000644000175000017500000000631712257552170021020 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFontMap #define _SELF(self) (RVAL2PANGOFONTMAP(self)) /* static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, pango_ft2_font_map_new()); return Qnil; } */ static VALUE rg_load_font(VALUE self, VALUE context, VALUE desc) { return GOBJ2RVAL(pango_font_map_load_font(_SELF(self), RVAL2PANGOCONTEXT(context), RVAL2PANGOFONTDESCRIPTION(desc))); } static VALUE rg_load_fontset(VALUE self, VALUE context, VALUE desc, VALUE lang) { return GOBJ2RVAL(pango_font_map_load_fontset(_SELF(self), RVAL2PANGOCONTEXT(context), RVAL2PANGOFONTDESCRIPTION(desc), RVAL2PANGOLANGUAGE(lang))); } static VALUE rg_families(VALUE self) { int n_families; PangoFontFamily** families; int i; VALUE result; pango_font_map_list_families(_SELF(self), &families, &n_families); result = rb_ary_new2(n_families); for (i = 0; i < n_families; i++) rb_ary_store(result, i, GOBJ2RVAL(families[i])); g_free(families); return result; } static VALUE rg_shape_engine_type(VALUE self) { return CSTR2RVAL(pango_font_map_get_shape_engine_type(_SELF(self))); } void Init_pango_font_map(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONT_MAP, "FontMap", mPango); /* RG_DEF_METHOD(initialize, 0); */ RG_DEF_METHOD(load_font, 2); RG_DEF_METHOD(load_fontset, 3); RG_DEF_METHOD(families, 0); RG_DEF_METHOD(shape_engine_type, 0); G_DEF_CLASS3("PangoFcFontMap", "FcFontMap", mPango); G_DEF_CLASS3("PangoXftFontMap", "XftFontMap", mPango); G_DEF_CLASS3("PangoFT2FontMap", "FT2FontMap", mPango); G_DEF_CLASS3("PangoXFontMap", "XFontMap", mPango); G_DEF_CLASS3("PangoWin32FontMap", "Win32FontMap", mPango); G_DEF_CLASS3("PangoCoreTextFontMap", "CoreTextFontMap", mPango); G_DEF_CLASS3("PangoCairoFcFontMap", "CairoFcFontMap", mPango); G_DEF_CLASS3("PangoCairoWin32FontMap", "CairoWin32FontMap", mPango); G_DEF_CLASS3("PangoCairoCoreTextFontMap", "CairoCoreTextFontMap", mPango); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontface.c0000644000175000017500000000422012257552170021130 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFontFace #define _SELF(self) (RVAL2PANGOFONTFACE(self)) static VALUE rg_name(VALUE self) { return CSTR2RVAL(pango_font_face_get_face_name(_SELF(self))); } static VALUE rg_describe(VALUE self) { return PANGOFONTDESCRIPTION2RVAL(pango_font_face_describe(_SELF(self))); } static VALUE rg_sizes(VALUE self) { int n_sizes; int* sizes; int i; VALUE result; pango_font_face_list_sizes(_SELF(self), &sizes, &n_sizes); result = rb_ary_new(); for (i = 0; i < n_sizes; i++) rb_ary_push(result, GOBJ2RVAL(&sizes[i])); g_free(sizes); return result; } void Init_pango_font_face(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONT_FACE, "FontFace", mPango); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(describe, 0); RG_DEF_METHOD(sizes, 0); G_DEF_CLASS3("PangoFcFace", "FcFace", mPango); G_DEF_CLASS3("PangoFT2Face", "FT2Face", mPango); G_DEF_CLASS3("PangoXftFace", "XftFace", mPango); G_DEF_CLASS3("PangoXFace", "XFace", mPango); G_DEF_CLASS3("PangoWin32Face", "Win32Face", mPango); G_DEF_CLASS3("PangoATSUIFace", "ATSUIFace", mPango); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoattrlist.c0000644000175000017500000000521012257552170021211 0ustar koukou/* -*- 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 "rbpangoprivate.h" static ID id_call; #define RG_TARGET_NAMESPACE cAttrList #define _SELF(self) (RVAL2PANGOATTRLIST(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, pango_attr_list_new()); return Qnil; } static VALUE rg_insert(VALUE self, VALUE attr) { pango_attr_list_insert(_SELF(self), RVAL2ATTR(attr)); return self; } static VALUE rg_insert_before(VALUE self, VALUE attr) { pango_attr_list_insert_before(_SELF(self), RVAL2ATTR(attr)); return self; } static VALUE rg_change(VALUE self, VALUE attr) { pango_attr_list_change(_SELF(self), RVAL2ATTR(attr)); return self; } static VALUE rg_splice(VALUE self, VALUE other, VALUE pos, VALUE len) { pango_attr_list_splice(_SELF(self), _SELF(other), NUM2INT(pos), NUM2INT(len)); return self; } static gboolean filter_func(PangoAttribute *attr, gpointer data) { return CBOOL2RVAL(rb_funcall((VALUE)data, id_call, 1, ATTR2RVAL(attr))); } static VALUE rg_filter(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); return PANGOATTRLIST2RVAL(pango_attr_list_filter(_SELF(self), (PangoAttrFilterFunc)filter_func, (gpointer)func)); } static VALUE rg_iterator(VALUE self) { return PANGOATTRITERATOR2RVAL(pango_attr_list_get_iterator(_SELF(self))); } void Init_pango_attrlist(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ATTR_LIST, "AttrList", mPango); id_call = rb_intern("call"); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(insert, 1); RG_DEF_METHOD(insert_before, 1); RG_DEF_METHOD(change, 1); RG_DEF_METHOD(splice, 3); RG_DEF_METHOD(filter, 0); RG_DEF_METHOD(iterator, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoitem.c0000644000175000017500000000517312257552170020311 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cItem #define _SELF(self) (RVAL2PANGOITEM(self)) #define ATTR_INT(name)\ static VALUE \ item_int_ ## name (VALUE self)\ {\ return INT2NUM(_SELF(self)->name);\ }\ static VALUE \ item_int_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = NUM2INT(val); \ return self;\ } #define DEF_INT_ACCESSOR(name) \ rbg_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(name), item_int_ ## name, 0);\ rbg_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(set_ ## name), item_int_set_ ## name, 1); static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, pango_item_new()); return Qnil; } static VALUE rg_split(VALUE self, VALUE split_index, VALUE split_offset) { return PANGOITEM2RVAL(pango_item_split(_SELF(self), NUM2INT(split_index), NUM2INT(split_offset))); } /* Move to Pango module (rbpangomain.c) GList* pango_reorder_items (GList *logical_items); */ ATTR_INT(offset); ATTR_INT(length); ATTR_INT(num_chars); static VALUE rg_analysis(VALUE self) { PangoAnalysis ana = _SELF(self)->analysis; return PANGOANALYSIS2RVAL(&ana); } static VALUE rg_set_analysis(VALUE self, VALUE val) { PangoAnalysis* ana = RVAL2PANGOANALYSIS(val); _SELF(self)->analysis = *ana; return self; } void Init_pango_item(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ITEM, "Item", mPango); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(split, 2); DEF_INT_ACCESSOR(offset); DEF_INT_ACCESSOR(length); DEF_INT_ACCESSOR(num_chars); RG_DEF_METHOD(analysis, 0); RG_DEF_METHOD(set_analysis, 1); } ruby-gnome2-all-2.2.5/pango/ext/pango/depend0000644000175000017500000000056712516434313017016 0ustar koukouinstall-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rbpango.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbpangoconversions.h $(RUBYARCHDIR) $(INSTALL_DATA) rbpangoversion.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-pango.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoglyphstring.c0000644000175000017500000001146312257552170021724 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cGlyphString #define _SELF(self) (RVAL2PANGOGLYPHSTRING(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, pango_glyph_string_new()); return Qnil; } static VALUE rg_set_size(VALUE self, VALUE len) { pango_glyph_string_set_size(_SELF(self), NUM2INT(len)); return self; } static VALUE rg_extents(int argc, VALUE *argv, VALUE self) { VALUE font, start_index, end_index; PangoRectangle ink_rect; PangoRectangle logical_rect; rb_scan_args(argc, argv, "12", &font, &start_index, &end_index); if (NIL_P(start_index)){ pango_glyph_string_extents(_SELF(self), RVAL2PANGOFONT(font), &ink_rect, &logical_rect); } else { pango_glyph_string_extents_range(_SELF(self), NUM2INT(start_index), NUM2INT(end_index), RVAL2PANGOFONT(font), &ink_rect, &logical_rect); } return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_width(VALUE self) { return INT2NUM(pango_glyph_string_get_width(_SELF(self))); } static VALUE rg_index_to_x(VALUE self, VALUE text, VALUE analysis, VALUE index, VALUE trailing) { int x_pos; StringValue(text); pango_glyph_string_index_to_x(_SELF(self), /* NOTE: This is a bug in the signature of * pango_glyph_string_index_to_x */ (char *)RSTRING_PTR(text), RSTRING_LEN(text), RVAL2PANGOANALYSIS(analysis), NUM2INT(index), RVAL2CBOOL(trailing), &x_pos); return INT2NUM(x_pos); } static VALUE rg_x_to_index(VALUE self, VALUE text, VALUE analysis, VALUE x_pos) { int index; int trailing; StringValue(text); pango_glyph_string_x_to_index(_SELF(self), /* NOTE: This is a bug in the signature of * pango_glyph_string_index_to_x */ (char *)RSTRING_PTR(text), RSTRING_LEN(text), RVAL2PANGOANALYSIS(analysis), NUM2INT(x_pos), &index, &trailing); return rb_assoc_new(INT2NUM(index), CBOOL2RVAL(trailing)); } static VALUE rg_get_logical_widths(VALUE self, VALUE rbtext, VALUE rbembedding_level) { PangoGlyphString *glyphs = _SELF(self); const char *text = RVAL2CSTR(rbtext); long length = RSTRING_LEN(rbtext); int embedding_level = NUM2INT(rbembedding_level); glong n = g_utf8_strlen(text, length); int *logical_widths = g_new(int, n); pango_glyph_string_get_logical_widths(glyphs, text, length, embedding_level, logical_widths); return GINTS2RVAL_FREE(logical_widths, n); } static VALUE rg_glyphs(VALUE self) { int i; PangoGlyphInfo *glyphs = _SELF(self)->glyphs; gint* log_clusters = _SELF(self)->log_clusters; VALUE ret = rb_ary_new(); for (i = 0; i < _SELF(self)->num_glyphs; i++) { rb_ary_push(ret, rb_assoc_new(PANGOGLYPHINFO2RVAL(glyphs + i), INT2NUM(log_clusters[i]))); } return ret; } void Init_pango_glyph_string(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_STRING, "GlyphString", mPango); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_size, 1); RG_DEF_METHOD(extents, -1); RG_DEF_METHOD(width, 0); RG_DEF_METHOD(index_to_x, 4); RG_DEF_METHOD(x_to_index, 3); RG_DEF_METHOD(get_logical_widths, 2); RG_DEF_METHOD(glyphs, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofont.c0000644000175000017500000000666712257552170020332 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFont #define _SELF(self) (RVAL2PANGOFONT(self)) static VALUE rg_find_shaper(VALUE self, VALUE language, VALUE ch) { return GOBJ2RVAL(pango_font_find_shaper(_SELF(self), RVAL2PANGOLANGUAGE(language), NUM2UINT(ch))); } static VALUE rg_describe(int argc, VALUE *argv, VALUE self) { VALUE desc, absolute_size; rb_scan_args(argc, argv, "01", &absolute_size); if (NIL_P(absolute_size) || ! RVAL2CBOOL(absolute_size)){ desc = PANGOFONTDESCRIPTION2RVAL(pango_font_describe(_SELF(self))); } else { desc = PANGOFONTDESCRIPTION2RVAL(pango_font_describe_with_absolute_size(_SELF(self))); } return desc; } static VALUE rg_get_coverage(VALUE self, VALUE language) { PangoCoverage* c = pango_font_get_coverage(_SELF(self), RVAL2PANGOLANGUAGE(language)); return PANGOCOVERAGE2RVAL(c); } static VALUE rg_get_glyph_extents(VALUE self, VALUE glyph) { PangoRectangle ink_rect, logical_rect; pango_font_get_glyph_extents(_SELF(self), NUM2UINT(glyph), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_metrics(int argc, VALUE *argv, VALUE self) { VALUE language; PangoLanguage* lang = NULL; rb_scan_args(argc, argv, "01", &language); if (!NIL_P(language)) lang = RVAL2PANGOLANGUAGE(language); return PANGOFONTMETRICS2RVAL(pango_font_get_metrics(_SELF(self), lang)); } static VALUE rg_font_map(VALUE self) { return GOBJ2RVAL(pango_font_get_font_map(_SELF(self))); } void Init_pango_font(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONT, "Font", mPango); RG_DEF_METHOD(find_shaper, 2); RG_DEF_METHOD(describe, -1); RG_DEF_METHOD(get_coverage, 1); RG_DEF_METHOD(get_glyph_extents, 1); RG_DEF_METHOD(metrics, -1); RG_DEF_METHOD(font_map, 0); G_DEF_CLASS3("PangoXFont", "XFont", mPango); G_DEF_CLASS3("PangoFT2Font", "FT2Font", mPango); G_DEF_CLASS3("PangoFcFont", "FcFont", mPango); G_DEF_CLASS3("PangoXftFont", "XftFont", mPango); G_DEF_CLASS3("PangoCairoFcFont", "CairoFcFont", mPango); G_DEF_CLASS3("PangoCairoFont", "CairoFont", mPango); G_DEF_CLASS3("PangoCairoWin32Font", "CairoWin32Font", mPango); G_DEF_CLASS3("PangoATSUIFont", "ATSUIFont", mPango); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangolanguage.c0000644000175000017500000000470512516434313021132 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2009 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cLanguage #define _SELF(self) (RVAL2PANGOLANGUAGE(self)) static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return PANGOLANGUAGE2RVAL(pango_language_get_default()); } static VALUE rg_initialize(VALUE self, VALUE language) { G_INITIALIZE(self, pango_language_from_string(RVAL2CSTR(language))); return Qnil; } static VALUE rg_s_to_string(G_GNUC_UNUSED VALUE self, VALUE language) { return CSTR2RVAL(pango_language_to_string(RVAL2CSTR(language))); } static VALUE rg_matches(int argc, VALUE *argv, VALUE self) { VALUE range_list; rb_scan_args(argc, argv, "01", &range_list); return CBOOL2RVAL(pango_language_matches(_SELF(self), RVAL2CSTR_ACCEPT_NIL(range_list))); } static VALUE rg_to_str(VALUE self) { return CSTR2RVAL(pango_language_to_string(_SELF(self))); } /* Moved from Pango::Script */ static VALUE rg_includes_script(VALUE self, VALUE script) { return CBOOL2RVAL(pango_language_includes_script(_SELF(self), RVAL2PANGOSCRIPT(script))); } void Init_pango_language(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LANGUAGE, "Language", mPango); RG_DEF_SMETHOD(default, 0); RG_DEF_METHOD(initialize, 1); RG_DEF_SMETHOD(to_string, 1); RG_DEF_METHOD(matches, -1); RG_DEF_METHOD(to_str, 0); RG_DEF_ALIAS("to_s", "to_str"); RG_DEF_METHOD(includes_script, 1); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoscript.c0000644000175000017500000000525112516434313020650 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cScript #define _SELF(r) (RVAL2PANGOSCRIPT(r)) static VALUE rg_s_for_unichar(G_GNUC_UNUSED VALUE self, VALUE ch) { return PANGOSCRIPT2RVAL(pango_script_for_unichar(NUM2UINT(ch))); } static VALUE rg_sample_language(VALUE self) { PangoLanguage* lang = pango_script_get_sample_language(_SELF(self)); return PANGOLANGUAGE2RVAL(lang); } #if PANGO_CHECK_VERSION(1,16,0) static VALUE rg_get_gravity(int argc, VALUE *argv, VALUE self) { VALUE wide, gravity, gravity_hint; int n; PangoGravity g; n = rb_scan_args(argc, argv, "21", &gravity, &gravity_hint, &wide); if (n == 2) { g = pango_gravity_get_for_script(_SELF(self), RVAL2PANGOGRAVITY(gravity), RVAL2PANGOGRAVITYHINT(gravity_hint)); } else { # if PANGO_CHECK_VERSION(1,26,0) g = pango_gravity_get_for_script_and_width(_SELF(self), RVAL2CBOOL(wide), RVAL2PANGOGRAVITY(gravity), RVAL2PANGOGRAVITYHINT(gravity_hint)); # else rb_raise(rb_eArgError, "the 3rd 'wide' argument requires Pango >= 1.26"); # endif } return PANGOGRAVITY2RVAL(g); } #endif /* Move to Pango::Language gboolean pango_language_includes_script (PangoLanguage *language, PangoScript script); */ void Init_pango_script(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_SCRIPT, "Script", mPango); RG_DEF_SMETHOD(for_unichar, 1); RG_DEF_METHOD(sample_language, 0); #if PANGO_CHECK_VERSION(1,16,0) RG_DEF_METHOD(get_gravity, -1); #endif } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangocontext.c0000644000175000017500000002142212516434313021026 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cContext #define _SELF(self) (RVAL2PANGOCONTEXT(self)) static VALUE rg_itemize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3, arg4, arg5, arg6; GList* list; rb_scan_args(argc, argv, "42", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6); if (TYPE(arg1) == T_STRING) { list = pango_itemize(_SELF(self), RVAL2CSTR(arg1), /* text */ NUM2INT(arg2), /* start_index */ NUM2INT(arg3), /* length */ RVAL2PANGOATTRLIST(arg4), /* attrs */ NIL_P(arg5) ? NULL : RVAL2PANGOATTRITERATOR(arg5)); /* cached_iter */ } else { #ifdef HAVE_PANGO_ITEMIZE_WITH_BASE_DIR list = pango_itemize_with_base_dir(_SELF(self), RVAL2PANGODIRECTION(arg1), /* base_dir */ RVAL2CSTR(arg2), /* text */ NUM2INT(arg3), /* start_index */ NUM2INT(arg4), /* length */ RVAL2PANGOATTRLIST(arg5), /* attrs */ NIL_P(arg6) ? NULL : RVAL2PANGOATTRITERATOR(arg6)); /* cached_iter */ #else rb_warn("Pango::Context#itemize(base_dir, text, start_index, length, attrs, cached_iter) isn't supported on this environment."); list = pango_itemize(_SELF(self), RVAL2CSTR(arg1), /* text */ NUM2INT(arg2), /* start_index */ NUM2INT(arg3), /* length */ RVAL2PANGOATTRLIST(arg4), /* attrs */ NIL_P(arg5) ? NULL : RVAL2PANGOATTRITERATOR(arg5)); /* cached_iter */ #endif } return GLIST2ARY2F(list, PANGO_TYPE_ITEM); } /* Move to Pango module (rbpangomain.c) GList* pango_reorder_items (GList *logical_items); */ #ifdef PANGO_ENABLE_BACKEND static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, pango_context_new()); return Qnil; } static VALUE rg_set_font_map(VALUE self, VALUE font_map) { pango_context_set_font_map(_SELF(self), RVAL2PANGOFONTMAP(font_map)); return self; } static VALUE rg_font_map(VALUE self) { return GOBJ2RVAL(pango_context_get_font_map(_SELF(self))); } #endif /* PANGO_ENABLE_BACKEND */ static VALUE rg_font_description(VALUE self) { PangoFontDescription* ret = pango_context_get_font_description(_SELF(self)); return PANGOFONTDESCRIPTION2RVAL(ret); } static VALUE rg_set_font_description(VALUE self, VALUE desc) { pango_context_set_font_description(_SELF(self), RVAL2PANGOFONTDESCRIPTION(desc)); return self; } static VALUE rg_language(VALUE self) { PangoLanguage* ret = pango_context_get_language(_SELF(self)); return PANGOLANGUAGE2RVAL(ret); } static VALUE rg_set_language(VALUE self, VALUE lang) { pango_context_set_language(_SELF(self), RVAL2PANGOLANGUAGE(lang)); return self; } static VALUE rg_base_dir(VALUE self) { return PANGODIRECTION2RVAL(pango_context_get_base_dir(_SELF(self))); } static VALUE rg_set_base_dir(VALUE self, VALUE direction) { pango_context_set_base_dir(_SELF(self), RVAL2PANGODIRECTION(direction)); return self; } #if PANGO_CHECK_VERSION(1,16,0) static VALUE rg_base_gravity(VALUE self) { return PANGOGRAVITY2RVAL(pango_context_get_base_gravity(_SELF(self))); } static VALUE rg_set_base_gravity(VALUE self, VALUE gravity) { pango_context_set_base_gravity(_SELF(self), RVAL2PANGOGRAVITY(gravity)); return self; } static VALUE rg_gravity_hint(VALUE self) { return PANGOGRAVITYHINT2RVAL(pango_context_get_gravity_hint(_SELF(self))); } static VALUE rg_set_gravity_hint(VALUE self, VALUE gravity_hint) { pango_context_set_gravity_hint(_SELF(self), RVAL2PANGOGRAVITYHINT(gravity_hint)); return self; } #endif static VALUE rg_matrix(VALUE self) { const PangoMatrix* matrix = pango_context_get_matrix(_SELF(self)); return PANGOMATRIX2RVAL((PangoMatrix*)matrix); } static VALUE rg_set_matrix(VALUE self, VALUE matrix) { pango_context_set_matrix(_SELF(self), RVAL2PANGOMATRIX(matrix)); return self; } static VALUE rg_load_font(VALUE self, VALUE desc) { return GOBJ2RVAL(pango_context_load_font(_SELF(self), RVAL2PANGOFONTDESCRIPTION(desc))); } static VALUE rg_load_fontset(VALUE self, VALUE desc, VALUE lang) { return GOBJ2RVAL(pango_context_load_fontset(_SELF(self), RVAL2PANGOFONTDESCRIPTION(desc), RVAL2PANGOLANGUAGE(lang))); } static VALUE rg_get_metrics(int argc, VALUE *argv, VALUE self) { VALUE desc, lang; rb_scan_args(argc, argv, "11", &desc, &lang); return PANGOFONTMETRICS2RVAL(pango_context_get_metrics(_SELF(self), RVAL2PANGOFONTDESCRIPTION(desc), NIL_P(lang) ? NULL : RVAL2PANGOLANGUAGE(lang))); } static VALUE rg_families(VALUE self) { int n_families; PangoFontFamily** families; int i; VALUE result; pango_context_list_families(_SELF(self), &families, &n_families); result = rb_ary_new2(n_families); for (i = 0; i < n_families; i++) rb_ary_store(result, i, GOBJ2RVAL(families[i])); g_free(families); return result; } #ifdef HAVE_RB_CAIRO_H static VALUE rg_set_font_options(VALUE self, VALUE options) { if (NIL_P(options)) pango_cairo_context_set_font_options(_SELF(self), NULL); else pango_cairo_context_set_font_options(_SELF(self), RVAL2CRFONTOPTIONS(options)); return self; } static VALUE rg_font_options(VALUE self) { const cairo_font_options_t *options; options = pango_cairo_context_get_font_options(_SELF(self)); if (options) return CRFONTOPTIONS2RVAL(cairo_font_options_copy(options)); else return Qnil; } static VALUE rg_set_resolution(VALUE self, VALUE dpi) { pango_cairo_context_set_resolution(_SELF(self), NUM2DBL(dpi)); return self; } static VALUE rg_resolution(VALUE self) { return rb_float_new(pango_cairo_context_get_resolution(_SELF(self))); } #endif static VALUE rg_list_families(VALUE self) { rb_warn("Deprecated. Use Pango::Context#families instead."); return rg_families(self); } void Init_pango_context(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_CONTEXT, "Context", mPango); RG_DEF_METHOD(itemize, -1); #ifdef PANGO_ENABLE_BACKEND RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_font_map, 1); RG_DEF_METHOD(font_map, 0); #endif /* PANGO_ENABLE_BACKEND */ RG_DEF_METHOD(font_description, 0); RG_DEF_METHOD(set_font_description, 1); RG_DEF_METHOD(language, 0); RG_DEF_METHOD(set_language, 1); RG_DEF_METHOD(base_dir, 0); RG_DEF_METHOD(set_base_dir, 1); #if PANGO_CHECK_VERSION(1,16,0) RG_DEF_METHOD(base_gravity, 0); RG_DEF_METHOD(set_base_gravity, 1); RG_DEF_METHOD(gravity_hint, 0); RG_DEF_METHOD(set_gravity_hint, 1); #endif RG_DEF_METHOD(matrix, 0); RG_DEF_METHOD(set_matrix, 1); RG_DEF_METHOD(load_font, 1); RG_DEF_METHOD(load_fontset, 2); RG_DEF_METHOD(get_metrics, -1); RG_DEF_METHOD(families, 0); #ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(set_font_options, 1); RG_DEF_METHOD(font_options, 0); RG_DEF_METHOD(set_resolution, 1); RG_DEF_METHOD(resolution, 0); #endif /* This will remove 2 or 3 releases later since 0.14.0. */ RG_DEF_METHOD(list_families, 0); /* PangoDirection */ G_DEF_CLASS(PANGO_TYPE_DIRECTION, "Direction", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_DIRECTION, "PANGO_"); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoattribute.c0000644000175000017500000004006612516434313021352 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE pattr VALUE RG_TARGET_NAMESPACE, attrstring, pattrint, pattrfloat, pattrcolor, pattrbool; static VALUE type_to_klass; /***********************************************/ void pango_add_attribute(int attr_type, VALUE klass) { rb_hash_aset(type_to_klass, INT2FIX(attr_type), klass); } /* This is for Attributes which has PangoAttrType. */ VALUE pango_get_attribute_klass(VALUE attr_type) { VALUE type = Qnil; if (TYPE(attr_type) == T_STRING){ const char *strtype = RVAL2CSTR(attr_type); if (strcmp(strtype, "Attribute") == 0){ type = RG_TARGET_NAMESPACE; } else if (strcmp(strtype, "AttrString") == 0){ type = attrstring; } else if (strcmp(strtype, "AttrInt") == 0){ type = pattrint; } else if (strcmp(strtype, "AttrFloat") == 0){ type = pattrfloat; } else if (strcmp(strtype, "AttrColor") == 0){ type = pattrcolor; } else if (strcmp(strtype, "AttrBool") == 0){ type = pattrbool; } } else { type = rb_hash_aref(type_to_klass, INT2FIX(attr_type)); } return type; } VALUE pango_make_attribute(PangoAttribute *attr) { if (attr == NULL) return Qnil; return Data_Wrap_Struct(rb_hash_aref(type_to_klass, INT2FIX(attr->klass->type)), 0, pango_attribute_destroy, pango_attribute_copy(attr)); } PangoAttribute* pango_get_attribute(VALUE attr) { PangoAttribute *gattr; if (NIL_P(attr)) return NULL; if (!rb_obj_is_kind_of(attr, RG_TARGET_NAMESPACE)) { rb_raise(rb_eTypeError, "not a Pango::Attribute..."); } Data_Get_Struct(attr, PangoAttribute, gattr); return gattr; } /***********************************************/ static VALUE rg_s_allocate(VALUE klass) { /* Don't define destroy method here. return Data_Wrap_Struct(klass, 0, pango_attribute_destroy, 0); */ return Data_Wrap_Struct(klass, NULL, NULL, 0); } #ifdef HAVE_OBJECT_ALLOCATE #define attr_s_new rb_class_new_instance #else static VALUE rg_s_new(int argc, VALUE *argv, VALUE klass) { VALUE obj = rg_s_allocate(klass); rb_obj_call_init(obj, argc, argv); return obj; } #endif /***********************************************/ /* This method implemented at rbpangomain.c gboolean pango_parse_markup (const char *markup_text, int length, gunichar accel_marker, PangoAttrList **attr_list, char **text, gunichar *accel_char, GError **error); */ static VALUE rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name) { return INT2NUM(pango_attr_type_register(RVAL2CSTR(name))); } static VALUE rg_operator_attr_equal(VALUE self, VALUE other) { return CBOOL2RVAL(pango_attribute_equal(RVAL2ATTR(self), RVAL2ATTR(other))); } /* * Structure accessors */ /* PangoAttribute */ static VALUE rg_start_index(VALUE self) { return UINT2NUM(RVAL2ATTR(self)->start_index); } static VALUE rg_set_start_index(VALUE self, VALUE value) { RVAL2ATTR(self)->start_index = NUM2UINT(value); return Qnil; } static VALUE rg_end_index(VALUE self) { return UINT2NUM(RVAL2ATTR(self)->end_index); } static VALUE rg_set_end_index(VALUE self, VALUE value) { RVAL2ATTR(self)->end_index = NUM2UINT(value); return Qnil; } /* PangoAttrString */ static VALUE attr_string_value(VALUE self) { return CSTR2RVAL(((PangoAttrString*)RVAL2ATTR(self))->value); } /* PangoAttrLanguage */ static VALUE attr_language_value(VALUE self) { return PANGOLANGUAGE2RVAL(((PangoAttrLanguage*)RVAL2ATTR(self))->value); } /* PangoAttrColor */ static VALUE attr_color_value(VALUE self) { PangoColor color = ((PangoAttrColor*)RVAL2ATTR(self))->color; return PANGOCOLOR2RVAL(&color); } /* PangoAttrInt */ static VALUE attr_int_value(VALUE self) { return INT2NUM(((PangoAttrInt*)RVAL2ATTR(self))->value); } /* PangoAttrFloat */ static VALUE attr_float_value(VALUE self) { return rb_float_new(((PangoAttrFloat*)RVAL2ATTR(self))->value); } /* PangoAttrBool(This is Ruby/Pango's original class) */ static VALUE attr_bool_value(VALUE self) { return CBOOL2RVAL(((PangoAttrInt*)RVAL2ATTR(self))->value); } /* PangoAttrFontDesc */ static VALUE attr_fontdesc_value(VALUE self) { return PANGOFONTDESCRIPTION2RVAL(((PangoAttrFontDesc*)RVAL2ATTR(self))->desc); } /* PangoAttrShape */ static VALUE attr_shape_ink_rect(VALUE self) { PangoRectangle rect = ((PangoAttrShape*)RVAL2ATTR(self))->ink_rect; return PANGORECTANGLE2RVAL(&rect); } static VALUE attr_shape_logical_rect(VALUE self) { PangoRectangle rect = ((PangoAttrShape*)RVAL2ATTR(self))->logical_rect; return PANGORECTANGLE2RVAL(&rect); } static VALUE attr_shape_value(VALUE self) { return rb_ary_new3(2, attr_shape_ink_rect(self), attr_shape_logical_rect(self)); } /* * Initialize methods */ #define MAKE_ATTRINT_INIT(klassname, funcname)\ static VALUE \ attr_ ## klassname ## _initialize(VALUE self, VALUE val)\ {\ DATA_PTR(self) = pango_attr_ ## funcname ## _new(NUM2INT(val));\ return Qnil;\ } #define MAKE_ATTRENUM_INIT(klassname, funcname, type)\ static VALUE \ attr_ ## klassname ## _initialize(VALUE self, VALUE val)\ {\ DATA_PTR(self) = pango_attr_ ## funcname ## _new(RVAL2GENUM(val, type));\ return Qnil;\ } static VALUE attr_AttrLanguage_initialize(VALUE self, VALUE lang) { DATA_PTR(self) = pango_attr_language_new( RVAL2PANGOLANGUAGE(lang)); return Qnil; } static VALUE attr_AttrFamily_initialize(VALUE self, VALUE family) { DATA_PTR(self) = pango_attr_family_new(RVAL2CSTR(family)); return Qnil; } MAKE_ATTRENUM_INIT(AttrStyle, style, PANGO_TYPE_STYLE); MAKE_ATTRENUM_INIT(AttrVariant, variant, PANGO_TYPE_VARIANT); MAKE_ATTRENUM_INIT(AttrStretch, stretch, PANGO_TYPE_STRETCH); MAKE_ATTRENUM_INIT(AttrWeight, weight, PANGO_TYPE_WEIGHT); static VALUE attr_AttrSize_initialize(VALUE self, VALUE size) { DATA_PTR(self) = pango_attr_size_new(NUM2INT(size)); return Qnil; } static VALUE attr_AttrAbsoluteSize_initialize(VALUE self, VALUE size) { DATA_PTR(self) = pango_attr_size_new_absolute(NUM2INT(size)); return Qnil; } #if PANGO_CHECK_VERSION(1,16,0) static VALUE attr_AttrGravity_initialize(VALUE self, VALUE gravity) { DATA_PTR(self) = pango_attr_gravity_new(RVAL2PANGOGRAVITY(gravity)); return Qnil; } static VALUE attr_AttrGravityHint_initialize(VALUE self, VALUE gravity_hint) { DATA_PTR(self) = pango_attr_gravity_hint_new(RVAL2PANGOGRAVITYHINT(gravity_hint)); return Qnil; } #endif static VALUE attr_AttrFontDescription_initialize(VALUE self, VALUE fontdescription) { DATA_PTR(self) = pango_attr_font_desc_new(RVAL2PANGOFONTDESCRIPTION(fontdescription)); return Qnil; } static VALUE attr_AttrForeground_initialize(VALUE self, VALUE r, VALUE g, VALUE b) { DATA_PTR(self) = pango_attr_foreground_new(FIX2UINT(r), FIX2UINT(g), FIX2UINT(b)); return Qnil; } static VALUE attr_AttrBackground_initialize(VALUE self, VALUE r, VALUE g, VALUE b) { DATA_PTR(self) = pango_attr_background_new(FIX2UINT(r), FIX2UINT(g), FIX2UINT(b)); return Qnil; } static VALUE attr_AttrStrikethrough_initialize(VALUE self, VALUE strikethrough) { DATA_PTR(self) = pango_attr_strikethrough_new(RVAL2CBOOL(strikethrough)); return Qnil; } #ifdef HAVE_PANGO_ATTR_STRIKETHROUGH_COLOR_NEW static VALUE attr_AttrStrikethroughColor_initialize(VALUE self, VALUE r, VALUE g, VALUE b) { DATA_PTR(self) = pango_attr_strikethrough_color_new(FIX2UINT(r), FIX2UINT(g), FIX2UINT(b)); return Qnil; } #endif MAKE_ATTRENUM_INIT(AttrUnderline, underline, PANGO_TYPE_UNDERLINE); #ifdef HAVE_PANGO_ATTR_UNDERLINE_COLOR_NEW static VALUE attr_AttrUnderlineColor_initialize(VALUE self, VALUE r, VALUE g, VALUE b) { DATA_PTR(self) = pango_attr_underline_color_new(FIX2UINT(r), FIX2UINT(g), FIX2UINT(b)); return Qnil; } #endif static VALUE attr_AttrShape_initialize(int argc, VALUE *argv, VALUE self) { VALUE ink_rect, logical_rect, data; rb_scan_args(argc, argv, "21", &ink_rect, &logical_rect, &data); if (NIL_P(data)){ DATA_PTR(self) = pango_attr_shape_new( RVAL2PANGORECTANGLE(ink_rect), RVAL2PANGORECTANGLE(logical_rect)); } else { G_RELATIVE(self, data); DATA_PTR(self) = pango_attr_shape_new_with_data( RVAL2PANGORECTANGLE(ink_rect), RVAL2PANGORECTANGLE(logical_rect), (gpointer)data, NULL, NULL); } return Qnil; } static VALUE attr_AttrScale_initialize(VALUE self, VALUE scale) { DATA_PTR(self) = pango_attr_scale_new(NUM2DBL(scale)); return Qnil; } static VALUE attr_AttrFallback_initialize(VALUE self, VALUE enable_fallback) { DATA_PTR(self) = pango_attr_fallback_new(RVAL2CBOOL(enable_fallback)); return Qnil; } MAKE_ATTRINT_INIT(AttrRise, rise); MAKE_ATTRINT_INIT(AttrLetterSpacing, letter_spacing); #define MAKE_ATTR(gtype, name, parent, num)\ tmpklass = rb_define_class_under(mPango, #name, parent);\ rb_hash_aset(type_to_klass, INT2FIX(gtype), tmpklass);\ rbg_define_method(tmpklass, "initialize", attr_## name ## _initialize , num); void Init_pango_attribute(VALUE mPango) { VALUE tmpklass; RG_TARGET_NAMESPACE = rb_define_class_under(mPango, "Attribute", rb_cData); RG_DEF_SMETHOD(type_register, 1); RG_DEF_METHOD_OPERATOR("==", attr_equal, 1); RG_DEF_METHOD(start_index, 0); RG_DEF_METHOD(set_start_index, 1); RG_DEF_METHOD(end_index, 0); RG_DEF_METHOD(set_end_index, 1); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC RG_DEF_SMETHOD(allocate, 0); #else rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))rg_s_allocate); #endif #ifndef HAVE_OBJECT_ALLOCATE RG_DEF_SMETHOD(new, -1); #endif attrstring = rb_define_class_under(mPango, "AttrString", RG_TARGET_NAMESPACE); rbg_define_method(attrstring, "value", attr_string_value, 0); pattrint = rb_define_class_under(mPango, "AttrInt", RG_TARGET_NAMESPACE); rbg_define_method(pattrint, "value", attr_int_value, 0); pattrfloat = rb_define_class_under(mPango, "AttrFloat", RG_TARGET_NAMESPACE); rbg_define_method(pattrfloat, "value", attr_float_value, 0); pattrcolor = rb_define_class_under(mPango, "AttrColor", RG_TARGET_NAMESPACE); rbg_define_method(pattrcolor, "value", attr_color_value, 0); pattrbool = rb_define_class_under(mPango, "AttrBool", RG_TARGET_NAMESPACE); rbg_define_method(pattrbool, "value", attr_bool_value, 0); rb_global_variable(&type_to_klass); type_to_klass = rb_hash_new(); MAKE_ATTR(PANGO_ATTR_LANGUAGE, AttrLanguage, RG_TARGET_NAMESPACE, 1); rbg_define_method(tmpklass, "value", attr_language_value, 0); MAKE_ATTR(PANGO_ATTR_FAMILY, AttrFamily, attrstring, 1); MAKE_ATTR(PANGO_ATTR_STYLE, AttrStyle, pattrint, 1); MAKE_ATTR(PANGO_ATTR_WEIGHT, AttrWeight, pattrint, 1); MAKE_ATTR(PANGO_ATTR_VARIANT, AttrVariant, pattrint, 1); MAKE_ATTR(PANGO_ATTR_STRETCH, AttrStretch, pattrint, 1); MAKE_ATTR(PANGO_ATTR_SIZE, AttrSize, pattrint, 1); MAKE_ATTR(PANGO_ATTR_ABSOLUTE_SIZE, AttrAbsoluteSize, pattrint, 1); #if PANGO_CHECK_VERSION(1,16,0) MAKE_ATTR(PANGO_ATTR_GRAVITY, AttrGravity, pattrint, 1); MAKE_ATTR(PANGO_ATTR_GRAVITY_HINT, AttrGravityHint, pattrint, 1); #endif MAKE_ATTR(PANGO_ATTR_FONT_DESC, AttrFontDescription, RG_TARGET_NAMESPACE, 1); rbg_define_method(tmpklass, "value", attr_fontdesc_value, 0); MAKE_ATTR(PANGO_ATTR_FOREGROUND, AttrForeground, pattrcolor, 3); MAKE_ATTR(PANGO_ATTR_BACKGROUND, AttrBackground, pattrcolor, 3); MAKE_ATTR(PANGO_ATTR_UNDERLINE, AttrUnderline, pattrint, 1); /* PangoUnderline */ G_DEF_CLASS(PANGO_TYPE_UNDERLINE, "Underline", tmpklass); G_DEF_CONSTANTS(tmpklass, PANGO_TYPE_UNDERLINE, "PANGO_UNDERLINE_"); #ifdef HAVE_PANGO_ATTR_UNDERLINE_COLOR_NEW MAKE_ATTR(PANGO_ATTR_UNDERLINE_COLOR, AttrUnderlineColor, pattrcolor, 3); #endif MAKE_ATTR(PANGO_ATTR_STRIKETHROUGH, AttrStrikethrough, pattrbool, 1); #ifdef HAVE_PANGO_ATTR_STRIKETHROUGH_COLOR_NEW MAKE_ATTR(PANGO_ATTR_STRIKETHROUGH_COLOR, AttrStrikethroughColor, pattrcolor, 3); #endif MAKE_ATTR(PANGO_ATTR_RISE, AttrRise, pattrint, 1); MAKE_ATTR(PANGO_ATTR_LETTER_SPACING, AttrLetterSpacing, pattrint, 1); MAKE_ATTR(PANGO_ATTR_SHAPE, AttrShape, RG_TARGET_NAMESPACE, -1); rbg_define_method(tmpklass, "ink_rect", attr_shape_ink_rect, 0); rbg_define_method(tmpklass, "logical_rect", attr_shape_logical_rect, 0); rbg_define_method(tmpklass, "value", attr_shape_value, 0); MAKE_ATTR(PANGO_ATTR_SCALE, AttrScale, pattrfloat, 1); /* PangoScale */ rb_define_const(tmpklass, "XX_SMALL", rb_float_new(PANGO_SCALE_XX_SMALL)); rb_define_const(tmpklass, "X_SMALL", rb_float_new(PANGO_SCALE_X_SMALL)); rb_define_const(tmpklass, "SMALL", rb_float_new(PANGO_SCALE_SMALL)); rb_define_const(tmpklass, "MEDIUM", rb_float_new(PANGO_SCALE_MEDIUM)); rb_define_const(tmpklass, "LARGE", rb_float_new(PANGO_SCALE_LARGE)); rb_define_const(tmpklass, "X_LARGE", rb_float_new(PANGO_SCALE_X_LARGE)); rb_define_const(tmpklass, "XX_LARGE", rb_float_new(PANGO_SCALE_XX_LARGE)); MAKE_ATTR(PANGO_ATTR_FALLBACK, AttrFallback, pattrbool, 1); /* PangoAttrType */ G_DEF_CLASS(PANGO_TYPE_ATTR_TYPE, "Type", RG_TARGET_NAMESPACE); #define INT2ATTRTYPE(x) rbgobj_make_enum((x), PANGO_TYPE_ATTR_TYPE) rb_define_const(RG_TARGET_NAMESPACE, "TYPE_INVALID", INT2ATTRTYPE(PANGO_ATTR_INVALID)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_LANGUAGE", INT2ATTRTYPE(PANGO_ATTR_LANGUAGE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FAMILY", INT2ATTRTYPE(PANGO_ATTR_FAMILY)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STYLE", INT2ATTRTYPE(PANGO_ATTR_STYLE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_WEIGHT", INT2ATTRTYPE(PANGO_ATTR_WEIGHT)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_VARIANT", INT2ATTRTYPE(PANGO_ATTR_VARIANT)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRETCH", INT2ATTRTYPE(PANGO_ATTR_STRETCH)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_SIZE", INT2ATTRTYPE(PANGO_ATTR_SIZE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FONT_DESC", INT2ATTRTYPE(PANGO_ATTR_FONT_DESC)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FOREGROUND", INT2ATTRTYPE(PANGO_ATTR_FOREGROUND)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_BACKGROUND", INT2ATTRTYPE(PANGO_ATTR_BACKGROUND)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_UNDERLINE", INT2ATTRTYPE(PANGO_ATTR_UNDERLINE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRIKETHROUGH", INT2ATTRTYPE(PANGO_ATTR_STRIKETHROUGH)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STRIKETHROUGH_COLOR", INT2ATTRTYPE(PANGO_ATTR_STRIKETHROUGH_COLOR)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_RISE", INT2ATTRTYPE(PANGO_ATTR_RISE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_SHAPE", INT2ATTRTYPE(PANGO_ATTR_SHAPE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_SCALE", INT2ATTRTYPE(PANGO_ATTR_SCALE)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_FALLBACK", INT2ATTRTYPE(PANGO_ATTR_FALLBACK)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_LETTER_SPACING", INT2ATTRTYPE(PANGO_ATTR_LETTER_SPACING)); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangorenderer.c0000644000175000017500000001371112257552170021156 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cRenderer #define _SELF(self) (RVAL2PANGORENDERER(self)) static VALUE rg_draw_layout(VALUE self, VALUE layout, VALUE x, VALUE y) { pango_renderer_draw_layout(_SELF(self), RVAL2PANGOLAYOUT(layout), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_draw_layout_line(VALUE self, VALUE line, VALUE x, VALUE y) { pango_renderer_draw_layout_line(_SELF(self), RVAL2PANGOLAYOUTLINE(line), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_draw_glyphs(VALUE self, VALUE font, VALUE glyphs, VALUE x, VALUE y) { pango_renderer_draw_glyphs(_SELF(self), RVAL2PANGOFONT(font), RVAL2PANGOGLYPHSTRING(glyphs), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_draw_rectangle(VALUE self, VALUE part, VALUE x, VALUE y, VALUE width, VALUE height) { #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE pango_renderer_draw_rectangle(_SELF(self), RVAL2PANGORENDERPART(part), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); #else pango_renderer_draw_rectangle(_SELF(self), NUM2INT(part), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); #endif return self; } static VALUE rg_draw_error_underline(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { pango_renderer_draw_error_underline(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_draw_trapezoid(VALUE self, VALUE part, VALUE y1, VALUE x11, VALUE x21, VALUE y2, VALUE x12, VALUE x22) { #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE pango_renderer_draw_trapezoid(_SELF(self), RVAL2PANGORENDERPART(part), NUM2DBL(y1), NUM2DBL(x11), NUM2DBL(x21), NUM2DBL(y2), NUM2DBL(x12), NUM2DBL(x22)); #else pango_renderer_draw_trapezoid(_SELF(self), NUM2INT(part), NUM2DBL(y1), NUM2DBL(x11), NUM2DBL(x21), NUM2DBL(y2), NUM2DBL(x12), NUM2DBL(x22)); #endif return self; } static VALUE rg_draw_glyph(VALUE self, VALUE font, VALUE glyph, VALUE x, VALUE y) { pango_renderer_draw_glyph(_SELF(self), RVAL2PANGOFONT(font), NUM2INT(glyph), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_deactivate(VALUE self) { pango_renderer_deactivate(_SELF(self)); return self; } static VALUE rg_activate(VALUE self) { pango_renderer_activate(_SELF(self)); if (rb_block_given_p()) { rb_ensure(rb_yield, self, rg_deactivate, self); } return self; } static VALUE rg_part_changed(VALUE self, VALUE part) { #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE pango_renderer_part_changed(_SELF(self), RVAL2PANGORENDERPART(part)); #else pango_renderer_part_changed(_SELF(self), NUM2INT(part)); #endif return self; } static VALUE rg_set_color(VALUE self, VALUE part, VALUE color) { #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE pango_renderer_set_color(_SELF(self), RVAL2PANGORENDERPART(part), NIL_P(color) ? NULL : RVAL2PANGOCOLOR(color)); #else pango_renderer_set_color(_SELF(self), NUM2INT(part), NIL_P(color) ? NULL : RVAL2PANGOCOLOR(color)); #endif return self; } static VALUE rg_get_color(VALUE self, VALUE part) { #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE PangoColor* color = pango_renderer_get_color(_SELF(self), RVAL2PANGORENDERPART(part)); #else PangoColor* color = pango_renderer_get_color(_SELF(self),NUM2INT(part)); #endif return PANGOCOLOR2RVAL(color); } static VALUE rg_set_matrix(VALUE self, VALUE matrix) { pango_renderer_set_matrix(_SELF(self), NIL_P(matrix) ? NULL : RVAL2PANGOMATRIX(matrix)); return self; } static VALUE rg_matrix(VALUE self) { const PangoMatrix* matrix = pango_renderer_get_matrix(_SELF(self)); return PANGOMATRIX2RVAL((PangoMatrix*)matrix); } void Init_pangorenderer(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_RENDERER, "Renderer", mPango); RG_DEF_METHOD(draw_layout, 3); RG_DEF_METHOD(draw_layout_line, 3); RG_DEF_METHOD(draw_glyphs, 4); RG_DEF_METHOD(draw_rectangle, 5); RG_DEF_METHOD(draw_error_underline, 4); RG_DEF_METHOD(draw_trapezoid, 7); RG_DEF_METHOD(draw_glyph, 4); RG_DEF_METHOD(activate, 0); RG_DEF_METHOD(deactivate, 0); RG_DEF_METHOD(part_changed, 1); RG_DEF_METHOD(set_color, 2); RG_DEF_METHOD(get_color, 1); RG_DEF_METHOD(set_matrix, 1); RG_DEF_METHOD(matrix, 0); /* PangoRenderPart */ #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE G_DEF_CLASS(PANGO_TYPE_RENDER_PART, "Part", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_RENDER_PART, "PANGO_RENDER_"); #endif } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoglyphinfo.c0000664000175000017500000000603311740310343021336 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cGlyphInfo #define _SELF(self) (RVAL2PANGOGLYPHINFO(self)) /**********************************/ static PangoGlyphInfo * pango_glyph_info_copy(const PangoGlyphInfo *info) { PangoGlyphInfo *data; g_return_val_if_fail(info != NULL, NULL); data = g_new(PangoGlyphInfo, 1); *data = *info; return data; } GType pango_glyph_info_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoGlyphInfo", (GBoxedCopyFunc)pango_glyph_info_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, g_new0(PangoGlyphInfo, 1)); return Qnil; } static VALUE rg_glyph(VALUE self) { return UINT2NUM(_SELF(self)->glyph); } static VALUE rg_set_glyph(VALUE self, VALUE val) { _SELF(self)->glyph = NUM2UINT(val); return self; } static VALUE rg_geometry(VALUE self) { PangoGlyphGeometry geo = _SELF(self)->geometry; return rb_ary_new3(3, INT2NUM(geo.width), INT2NUM(geo.x_offset), INT2NUM(geo.y_offset)); } static VALUE rg_set_geometry(VALUE self, VALUE width, VALUE x_offset, VALUE y_offset) { PangoGlyphGeometry geo = _SELF(self)->geometry; geo.width = NUM2INT(width); geo.x_offset = NUM2INT(x_offset); geo.y_offset = NUM2INT(y_offset); return self; } /* This method may be changed in the future following Pango implementation. */ static VALUE rg_cluster_start_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->attr.is_cluster_start); } static VALUE rg_set_cluster_start(VALUE self, VALUE val) { _SELF(self)->attr.is_cluster_start = RVAL2CBOOL(val); return self; } void Init_pango_glyph_info(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_INFO, "GlyphInfo", mPango); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(glyph, 0); RG_DEF_METHOD(set_glyph, 1); RG_DEF_METHOD(geometry, 0); RG_DEF_METHOD(set_geometry, 3); RG_DEF_METHOD_P(cluster_start, 0); RG_DEF_METHOD(set_cluster_start, 1); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoanalysis.c0000644000175000017500000001230412257552170021170 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cAnalysis #define _SELF(s) (RVAL2PANGOANALYSIS(s)) /**********************************/ static PangoAnalysis* ana_copy(const PangoAnalysis* val) { PangoAnalysis* new_val; g_return_val_if_fail (val != NULL, NULL); new_val = g_new(PangoAnalysis, 1); *new_val = *val; return new_val; } GType pango_analysis_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoAnalysis", (GBoxedCopyFunc)ana_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ static VALUE rg_initialize(VALUE self) { PangoAnalysis analysis = { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL }; G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_ANALYSIS, &analysis)); return Qnil; } static VALUE rg_set_shape_engine(VALUE self, VALUE engine) { _SELF(self)->shape_engine = RVAL2PANGOENGINESHAPE(engine); return self; } static VALUE rg_shape_engine(VALUE self) { VALUE ret; if (_SELF(self)->shape_engine){ const gchar* gname = G_OBJECT_TYPE_NAME(_SELF(self)->shape_engine); gchar* name = g_strdup(gname); name[0] = g_ascii_toupper(name[0]); G_DEF_CLASS3(gname, name, mPango); ret = GOBJ2RVAL(_SELF(self)->shape_engine); } else { ret = Qnil; } return ret; } static VALUE rg_set_lang_engine(VALUE self, VALUE engine) { _SELF(self)->lang_engine = RVAL2PANGOENGINELANG(engine); return self; } static VALUE rg_lang_engine(VALUE self) { VALUE ret; if (_SELF(self)->lang_engine){ const gchar* gname = G_OBJECT_TYPE_NAME(_SELF(self)->lang_engine); gchar* name = g_strdup(gname); name[0] = g_ascii_toupper(name[0]); G_DEF_CLASS3(name, name, mPango); ret = GOBJ2RVAL(_SELF(self)->lang_engine); } else { ret = Qnil; } return ret; } static VALUE rg_set_font(VALUE self, VALUE font) { _SELF(self)->font = RVAL2PANGOFONT(font); return self; } static VALUE rg_font(VALUE self) { return GOBJ2RVAL(_SELF(self)->font); } static VALUE rg_set_level(VALUE self, VALUE level) { _SELF(self)->level = NUM2UINT(level); return self; } static VALUE rg_level(VALUE self) { return UINT2NUM(_SELF(self)->level); } static VALUE rg_set_language(VALUE self, VALUE lang) { _SELF(self)->language = RVAL2PANGOLANGUAGE(lang); return self; } static VALUE rg_language(VALUE self) { return PANGOLANGUAGE2RVAL(_SELF(self)->language); } struct ana_set_extra_attrs_args { PangoAnalysis *analysis; VALUE ary; long n; GSList *result; }; static VALUE ana_set_extra_attrs_body(VALUE value) { struct ana_set_extra_attrs_args *args = (struct ana_set_extra_attrs_args *)value; long i; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, RVAL2ATTR(RARRAY_PTR(args->ary)[i])); args->analysis->extra_attrs = args->result; return Qnil; } static G_GNUC_NORETURN VALUE ana_set_extra_attrs_rescue(VALUE value) { g_slist_free(((struct ana_set_extra_attrs_args *)value)->result); rb_exc_raise(rb_errinfo()); } static VALUE rg_set_extra_attrs(VALUE self, VALUE attrs) { struct ana_set_extra_attrs_args args; args.analysis = _SELF(self); args.ary = rb_ary_to_ary(attrs); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(ana_set_extra_attrs_body, (VALUE)&args, ana_set_extra_attrs_rescue, (VALUE)&args); return self; } static VALUE rg_extra_attrs(VALUE self) { VALUE ary = rb_ary_new(); GSList* list = _SELF(self)->extra_attrs; while (list) { rb_ary_push(ary, ATTR2RVAL(list->data)); list = list->next; } return ary; } void Init_pango_analysis(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ANALYSIS, "Analysis", mPango); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_shape_engine, 1); RG_DEF_METHOD(shape_engine, 0); RG_DEF_METHOD(set_lang_engine, 1); RG_DEF_METHOD(lang_engine, 0); RG_DEF_METHOD(set_font, 1); RG_DEF_METHOD(font, 0); RG_DEF_METHOD(set_level, 1); RG_DEF_METHOD(level, 0); RG_DEF_METHOD(set_language, 1); RG_DEF_METHOD(language, 0); RG_DEF_METHOD(set_extra_attrs, 1); RG_DEF_METHOD(extra_attrs, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangolayout.c0000644000175000017500000003410212516434313020656 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cLayout #define _SELF(self) (RVAL2PANGOLAYOUT(self)) static VALUE rg_initialize(VALUE self, VALUE context) { G_INITIALIZE(self, pango_layout_new(RVAL2PANGOCONTEXT(context))); return Qnil; } static VALUE rg_copy(VALUE self) { return GOBJ2RVAL_UNREF(pango_layout_copy(_SELF(self))); } static VALUE rg_context(VALUE self) { return GOBJ2RVAL(pango_layout_get_context(_SELF(self))); } static VALUE rg_context_changed(VALUE self) { pango_layout_context_changed(_SELF(self)); return Qnil; } static VALUE rg_set_text(VALUE self, VALUE text) { StringValue(text); pango_layout_set_text(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text)); return self; } static VALUE rg_text(VALUE self) { return CSTR2RVAL(pango_layout_get_text(_SELF(self))); } static VALUE rg_set_markup(int argc, VALUE *argv, VALUE self) { VALUE markup, accel_marker; gunichar accel_char = 0; rb_scan_args(argc, argv, "11", &markup, &accel_marker); StringValue(markup); if (NIL_P(accel_marker)){ pango_layout_set_markup(_SELF(self), RSTRING_PTR(markup), RSTRING_LEN(markup)); } else { pango_layout_set_markup_with_accel(_SELF(self), RSTRING_PTR(markup), RSTRING_LEN(markup), NUM2CHR(accel_marker), &accel_char); } return CHR2FIX(accel_char); } static VALUE rg_operator_layout_set_markup_eq(VALUE self, VALUE markup) { StringValue(markup); pango_layout_set_markup(_SELF(self), RSTRING_PTR(markup), RSTRING_LEN(markup)); return markup; } static VALUE rg_set_attributes(VALUE self, VALUE attrs) { pango_layout_set_attributes(_SELF(self), RVAL2PANGOATTRLIST(attrs)); return self; } static VALUE rg_attributes(VALUE self) { return PANGOATTRLIST2RVAL(pango_layout_get_attributes(_SELF(self))); } static VALUE rg_set_font_description(VALUE self, VALUE rb_desc) { PangoFontDescription *desc; gboolean desc_created = FALSE; if (RVAL2CBOOL(rb_obj_is_kind_of(rb_desc, rb_cString))) { desc = pango_font_description_from_string(RVAL2CSTR(rb_desc)); desc_created = TRUE; } else { desc = RVAL2PANGOFONTDESCRIPTION(rb_desc); } pango_layout_set_font_description(_SELF(self), desc); if (desc_created) pango_font_description_free(desc); return self; } static VALUE rg_font_description(VALUE self) { const PangoFontDescription* desc = pango_layout_get_font_description(_SELF(self)); return PANGOFONTDESCRIPTION2RVAL((gpointer)desc); } static VALUE rg_set_width(VALUE self, VALUE width) { pango_layout_set_width(_SELF(self), NUM2INT(width)); return self; } static VALUE rg_width(VALUE self) { return INT2NUM(pango_layout_get_width(_SELF(self))); } #if PANGO_CHECK_VERSION(1, 20, 0) static VALUE rg_set_height(VALUE self, VALUE width) { pango_layout_set_height(_SELF(self), NUM2INT(width)); return self; } static VALUE rg_height(VALUE self) { return INT2NUM(pango_layout_get_height(_SELF(self))); } #endif static VALUE rg_set_wrap(VALUE self, VALUE wrap) { pango_layout_set_wrap(_SELF(self), RVAL2PANGOWRAPMODE(wrap)); return self; } static VALUE rg_wrap(VALUE self) { return PANGOWRAPMODE2RVAL(pango_layout_get_wrap(_SELF(self))); } static VALUE rg_set_ellipsize(VALUE self, VALUE ellipsize) { pango_layout_set_ellipsize(_SELF(self), RVAL2PANGOELLIPSIZEMODE(ellipsize)); return self; } static VALUE rg_ellipsize(VALUE self) { return PANGOELLIPSIZEMODE2RVAL(pango_layout_get_ellipsize(_SELF(self))); } #if PANGO_CHECK_VERSION(1, 16, 0) static VALUE rg_ellipsized_p(VALUE self) { return CBOOL2RVAL(pango_layout_is_ellipsized(_SELF(self))); } #endif static VALUE rg_set_indent(VALUE self, VALUE indent) { pango_layout_set_indent(_SELF(self), NUM2INT(indent)); return self; } static VALUE rg_indent(VALUE self) { return INT2NUM(pango_layout_get_indent(_SELF(self))); } static VALUE rg_spacing(VALUE self) { return INT2NUM(pango_layout_get_spacing(_SELF(self))); } static VALUE rg_set_spacing(VALUE self, VALUE spacing) { pango_layout_set_spacing(_SELF(self), NUM2INT(spacing)); return self; } static VALUE rg_set_justify(VALUE self, VALUE justify) { pango_layout_set_justify(_SELF(self), RVAL2CBOOL(justify)); return self; } static VALUE rg_justify_p(VALUE self) { return CBOOL2RVAL(pango_layout_get_justify(_SELF(self))); } static VALUE rg_set_auto_dir(VALUE self, VALUE auto_dir) { pango_layout_set_auto_dir(_SELF(self), RVAL2CBOOL(auto_dir)); return self; } static VALUE rg_auto_dir_p(VALUE self) { return CBOOL2RVAL(pango_layout_get_auto_dir(_SELF(self))); } static VALUE rg_set_alignment(VALUE self, VALUE align) { pango_layout_set_alignment(_SELF(self), RVAL2PANGOALIGNMENT(align)); return self; } static VALUE rg_alignment(VALUE self) { return PANGOALIGNMENT2RVAL(pango_layout_get_alignment(_SELF(self))); } static VALUE rg_set_tabs(VALUE self, VALUE tabs) { pango_layout_set_tabs(_SELF(self), RVAL2PANGOTABARRAY(tabs)); return self; } static VALUE rg_tabs(VALUE self) { VALUE ret = Qnil; PangoTabArray* tabs = pango_layout_get_tabs(_SELF(self)); if (tabs) { ret = PANGOTABARRAY2RVAL(tabs); pango_tab_array_free(tabs); } return ret; } static VALUE rg_set_single_paragraph_mode(VALUE self, VALUE setting) { pango_layout_set_single_paragraph_mode(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_single_paragraph_mode_p(VALUE self) { return CBOOL2RVAL(pango_layout_get_single_paragraph_mode(_SELF(self))); } static VALUE rg_log_attrs(VALUE self) { PangoLogAttr* attrs; gint i, n_attrs; VALUE ary; pango_layout_get_log_attrs(_SELF(self), &attrs, &n_attrs); ary = rb_ary_new(); for (i = 0; i < n_attrs; i++) { rb_ary_assoc(ary, PANGOLOGATTR2RVAL(&attrs[i])); } g_free(attrs); return ary; } static VALUE rg_xy_to_index(VALUE self, VALUE x, VALUE y) { int index, trailing; gboolean ret = pango_layout_xy_to_index(_SELF(self), NUM2INT(x), NUM2INT(y), &index, &trailing); return rb_ary_new3(3, CBOOL2RVAL(ret), INT2NUM(index), INT2NUM(trailing)); } static VALUE rg_index_to_pos(VALUE self, VALUE index) { PangoRectangle pos; pango_layout_index_to_pos(_SELF(self), NUM2INT(index), &pos); return PANGORECTANGLE2RVAL(&pos); } static VALUE rg_get_cursor_pos(VALUE self, VALUE index) { PangoRectangle strong_pos, weak_pos; pango_layout_get_cursor_pos(_SELF(self), NUM2INT(index), &strong_pos, &weak_pos); return rb_ary_new3(2, PANGORECTANGLE2RVAL(&strong_pos), PANGORECTANGLE2RVAL(&weak_pos)); } static VALUE rg_move_cursor_visually(VALUE self, VALUE strong, VALUE old_index, VALUE old_trailing, VALUE direction) { int new_index, new_trailing; pango_layout_move_cursor_visually(_SELF(self), RVAL2CBOOL(strong), NUM2INT(old_index), NUM2INT(old_trailing), NUM2INT(direction), &new_index, &new_trailing); return rb_ary_new3(2, INT2NUM(new_index), INT2NUM(new_trailing)); } static VALUE rg_get_extents(int argc, VALUE *argv, VALUE self) { VALUE ink_rect, logical_rect; PangoRectangle rink, rlog; rb_scan_args(argc, argv, "02", &ink_rect, &logical_rect); if (NIL_P(ink_rect)){ rink.x = 0; rink.y = 0; rink.width = 0; rink.height = 0; } else { PangoRectangle* rect = RVAL2PANGORECTANGLE(ink_rect); rink.x = rect->x; rink.y = rect->y; rink.width = rect->width; rink.height = rect->height; } if (NIL_P(logical_rect)){ rlog.x = 0; rlog.y = 0; rlog.width = 0; rlog.height = 0; } else { PangoRectangle* rect = RVAL2PANGORECTANGLE(logical_rect); rlog.x = rect->x; rlog.y = rect->y; rlog.width = rect->width; rlog.height = rect->height; } pango_layout_get_extents(_SELF(self), &rink, &rlog); return rb_assoc_new(PANGORECTANGLE2RVAL(&rink), PANGORECTANGLE2RVAL(&rlog)); } static VALUE rg_extents(VALUE self) { PangoRectangle rink = {0, 0, 0, 0}; PangoRectangle rlog = {0, 0, 0, 0}; pango_layout_get_extents(_SELF(self), &rink, &rlog); return rb_assoc_new(PANGORECTANGLE2RVAL(&rink), PANGORECTANGLE2RVAL(&rlog)); } static VALUE rg_get_pixel_extents(int argc, VALUE *argv, VALUE self) { VALUE ink_rect, logical_rect; PangoRectangle rink, rlog; rb_scan_args(argc, argv, "02", &ink_rect, &logical_rect); if (NIL_P(ink_rect)){ rink.x = 0; rink.y = 0; rink.width = 0; rink.height = 0; } else { PangoRectangle* rect = RVAL2PANGORECTANGLE(ink_rect); rink.x = rect->x; rink.y = rect->y; rink.width = rect->width; rink.height = rect->height; } if (NIL_P(logical_rect)){ rlog.x = 0; rlog.y = 0; rlog.width = 0; rlog.height = 0; } else { PangoRectangle* rect = RVAL2PANGORECTANGLE(logical_rect); rlog.x = rect->x; rlog.y = rect->y; rlog.width = rect->width; rlog.height = rect->height; } pango_layout_get_pixel_extents(_SELF(self), &rink, &rlog); return rb_assoc_new(PANGORECTANGLE2RVAL(&rink), PANGORECTANGLE2RVAL(&rlog)); } static VALUE rg_pixel_extents(VALUE self) { PangoRectangle rink = {0, 0, 0, 0}; PangoRectangle rlog = {0, 0, 0, 0}; pango_layout_get_pixel_extents(_SELF(self), &rink, &rlog); return rb_assoc_new(PANGORECTANGLE2RVAL(&rink), PANGORECTANGLE2RVAL(&rlog)); } static VALUE rg_size(VALUE self) { int width, height; pango_layout_get_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_pixel_size(VALUE self) { int width, height; pango_layout_get_pixel_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_line_count(VALUE self) { return INT2NUM(pango_layout_get_line_count(_SELF(self))); } static VALUE rg_get_line(VALUE self, VALUE line) { return PANGOLAYOUTLINE2RVAL(pango_layout_get_line(_SELF(self), NUM2INT(line))); } static VALUE rg_lines(VALUE self) { return GSLIST2ARY2(pango_layout_get_lines(_SELF(self)), PANGO_TYPE_LAYOUT_LINE); } static VALUE rg_iter(VALUE self) { return PANGOLAYOUTITER2RVAL(pango_layout_get_iter(_SELF(self))); } void Init_pango_layout(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LAYOUT, "Layout", mPango); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(copy, 0); RG_DEF_METHOD(context, 0); RG_DEF_METHOD(context_changed, 0); RG_DEF_METHOD(set_text, 1); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_markup, -1); RG_DEF_METHOD_OPERATOR("markup=", layout_set_markup_eq, 1); RG_DEF_METHOD(set_attributes, 1); RG_DEF_METHOD(attributes, 0); RG_DEF_METHOD(set_font_description, 1); RG_DEF_METHOD(font_description, 0); RG_DEF_METHOD(set_width, 1); RG_DEF_METHOD(width, 0); #if PANGO_CHECK_VERSION(1, 20, 0) RG_DEF_METHOD(set_height, 1); RG_DEF_METHOD(height, 0); #endif RG_DEF_METHOD(set_wrap, 1); RG_DEF_METHOD(wrap, 0); RG_DEF_METHOD(set_ellipsize, 1); RG_DEF_METHOD(ellipsize, 0); #if PANGO_CHECK_VERSION(1, 16, 0) RG_DEF_METHOD_P(ellipsized, 0); #endif RG_DEF_METHOD(set_indent, 1); RG_DEF_METHOD(indent, 0); RG_DEF_METHOD(spacing, 0); RG_DEF_METHOD(set_spacing, 1); RG_DEF_METHOD(set_justify, 1); RG_DEF_METHOD_P(justify, 0); RG_DEF_METHOD(set_auto_dir, 1); RG_DEF_METHOD_P(auto_dir, 0); RG_DEF_METHOD(set_alignment, 1); RG_DEF_METHOD(alignment, 0); RG_DEF_METHOD(set_tabs, 1); RG_DEF_METHOD(tabs, 0); RG_DEF_METHOD(set_single_paragraph_mode, 1); RG_DEF_METHOD_P(single_paragraph_mode, 0); RG_DEF_METHOD(log_attrs, 0); RG_DEF_METHOD(xy_to_index, 2); RG_DEF_METHOD(index_to_pos, 1); RG_DEF_METHOD(get_cursor_pos, 1); RG_DEF_METHOD(move_cursor_visually, 4); RG_DEF_METHOD(get_extents, -1); RG_DEF_METHOD(extents, 0); RG_DEF_METHOD(get_pixel_extents, -1); RG_DEF_METHOD(pixel_extents, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(pixel_size, 0); RG_DEF_METHOD(line_count, 0); RG_DEF_METHOD(get_line, 1); RG_DEF_METHOD(lines, 0); RG_DEF_METHOD(iter, 0); /* PangoWrapMode */ G_DEF_CLASS(PANGO_TYPE_WRAP_MODE, "WrapMode", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_WRAP_MODE, "PANGO_"); /* PangoAlignment */ G_DEF_CLASS(PANGO_TYPE_ALIGNMENT, "Alignment", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_ALIGNMENT, "PANGO_"); /* PangoEllipsizeMode */ G_DEF_CLASS(PANGO_TYPE_ELLIPSIZE_MODE, "EllipsizeMode", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_ELLIPSIZE_MODE, "PANGO_"); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangocairocontext.c0000644000175000017500000000765012257552170022057 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2013 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE rb_cCairo_Context static VALUE rg_update_pango_context(VALUE self, VALUE context) { pango_cairo_update_context(RVAL2CRCONTEXT(self), RVAL2PANGOCONTEXT(context)); return self; } /* Convenience */ static VALUE rg_create_pango_layout(VALUE self) { return GOBJ2RVAL_UNREF(pango_cairo_create_layout(RVAL2CRCONTEXT(self))); } static VALUE rg_update_pango_layout(VALUE self, VALUE layout) { pango_cairo_update_layout(RVAL2CRCONTEXT(self), RVAL2PANGOLAYOUT(layout)); return self; } /* Rendering */ static VALUE rg_show_pango_glyph_string(VALUE self, VALUE font, VALUE glyphs) { pango_cairo_show_glyph_string(RVAL2CRCONTEXT(self), RVAL2PANGOFONT(font), RVAL2PANGOGLYPHSTRING(glyphs)); return self; } static VALUE rg_show_pango_layout_line(VALUE self, VALUE line) { pango_cairo_show_layout_line(RVAL2CRCONTEXT(self), RVAL2PANGOLAYOUTLINE(line)); return self; } static VALUE rg_show_pango_layout(VALUE self, VALUE layout) { pango_cairo_show_layout(RVAL2CRCONTEXT(self), RVAL2PANGOLAYOUT(layout)); return self; } static VALUE rg_show_pango_error_underline(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { pango_cairo_show_error_underline(RVAL2CRCONTEXT(self), NUM2DBL(x), NUM2DBL(y), NUM2DBL(width), NUM2DBL(height)); return self; } /* Rendering to a path */ static VALUE rg_pango_glyph_string_path(VALUE self, VALUE font, VALUE glyphs) { pango_cairo_glyph_string_path(RVAL2CRCONTEXT(self), RVAL2PANGOFONT(font), RVAL2PANGOGLYPHSTRING(glyphs)); return self; } static VALUE rg_pango_layout_line_path(VALUE self, VALUE line) { pango_cairo_layout_line_path(RVAL2CRCONTEXT(self), RVAL2PANGOLAYOUTLINE(line)); return self; } static VALUE rg_pango_layout_path(VALUE self, VALUE layout) { pango_cairo_layout_path(RVAL2CRCONTEXT(self), RVAL2PANGOLAYOUT(layout)); return self; } static VALUE rg_pango_error_underline_path(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { pango_cairo_error_underline_path(RVAL2CRCONTEXT(self), NUM2DBL(x), NUM2DBL(y), NUM2DBL(width), NUM2DBL(height)); return self; } void Init_pango_cairo_context(G_GNUC_UNUSED VALUE mPango) { /* Cairo::Context */ RG_DEF_METHOD(update_pango_context, 1); /* Convenience */ RG_DEF_METHOD(create_pango_layout, 0); RG_DEF_METHOD(update_pango_layout, 1); /* Rendering */ RG_DEF_METHOD(show_pango_glyph_string, 2); RG_DEF_METHOD(show_pango_layout_line, 1); RG_DEF_METHOD(show_pango_layout, 1); RG_DEF_METHOD(show_pango_error_underline, 4); /* Rendering to a path */ RG_DEF_METHOD(pango_glyph_string_path, 2); RG_DEF_METHOD(pango_layout_line_path, 1); RG_DEF_METHOD(pango_layout_path, 1); RG_DEF_METHOD(pango_error_underline_path, 4); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoglyphitem.c0000644000175000017500000000661212257552170021354 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cGlyphItem #define _SELF(r) (RVAL2PANGOGLYPHITEM(r)) /**********************************/ #ifndef HAVE_PANGO_GLYPH_ITEM_GET_TYPE static PangoGlyphItem* glyph_item_copy(const PangoGlyphItem *ref) { PangoGlyphItem* new_ref; g_return_val_if_fail (ref != NULL, NULL); new_ref = g_new(PangoGlyphItem, 1); *new_ref = *ref; return new_ref; } # ifndef HAVE_PANGO_GLYPH_ITEM_FREE void pango_glyph_item_free(PangoGlyphItem* glyph_item) { if (glyph_item->item) pango_item_free(glyph_item->item); if (glyph_item->glyphs) pango_glyph_string_free(glyph_item->glyphs); g_free(glyph_item); } # endif GType pango_glyph_item_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoGlyphItem", (GBoxedCopyFunc)glyph_item_copy, (GBoxedFreeFunc)pango_glyph_item_free); return our_type; } #endif /**********************************/ static VALUE rg_item(VALUE self) { PangoItem* item = _SELF(self)->item; return PANGOITEM2RVAL(item); } static VALUE rg_glyphs(VALUE self) { PangoGlyphString* glyphs = _SELF(self)->glyphs; return PANGOGLYPHSTRING2RVAL(glyphs); } static VALUE rg_split(VALUE self, VALUE text, VALUE split_index) { return PANGOGLYPHITEM2RVAL(pango_glyph_item_split(_SELF(self), RVAL2CSTR(text), NUM2INT(split_index))); } static VALUE rg_appy_attrs(VALUE self, VALUE text, VALUE attrs) { GSList* list = pango_glyph_item_apply_attrs(_SELF(self), RVAL2CSTR(text), RVAL2PANGOATTRLIST(attrs)); VALUE ret = rb_ary_new(); while (list) { rb_ary_push(ret, PANGOGLYPHITEM2RVAL(list->data)); pango_glyph_item_free(list->data); list = list->next; } g_slist_free(list); return ret; } static VALUE rg_letter_space(VALUE self, VALUE text, VALUE log_attrs, VALUE letter_spacing) { pango_glyph_item_letter_space(_SELF(self), RVAL2CSTR(text), RVAL2PANGOLOGATTR(log_attrs), NUM2INT(letter_spacing)); return self; } void Init_pango_glyph_item(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_GLYPH_ITEM, "GlyphItem", mPango); RG_DEF_METHOD(item, 0); RG_DEF_METHOD(glyphs, 0); RG_DEF_METHOD(split, 2); RG_DEF_METHOD(appy_attrs, 2); RG_DEF_METHOD(letter_space, 3); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangorectangle.c0000644000175000017500000000746512124610262021313 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cRectangle #define _SELF(s) (RVAL2PANGORECTANGLE(s)) /**********************************/ static PangoRectangle* pango_rectangle_copy(const PangoRectangle *ref) { PangoRectangle* new_ref; g_return_val_if_fail (ref != NULL, NULL); new_ref = g_new(PangoRectangle, 1); *new_ref = *ref; return new_ref; } GType pango_rectangle_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoRectangle", (GBoxedCopyFunc)pango_rectangle_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ static VALUE rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { PangoRectangle rectangle; rectangle.x = NUM2INT(x); rectangle.y = NUM2INT(y); rectangle.width = NUM2INT(width); rectangle.height = NUM2INT(height); G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_RECTANGLE, &rectangle)); return Qnil; } 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) { PangoRectangle* a = _SELF(self); return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y), INT2FIX(a->width), INT2FIX(a->height)); } static VALUE rg_ascent(VALUE self) { PangoRectangle* r =_SELF(self); return INT2NUM(PANGO_ASCENT(*r)); } static VALUE rg_descent(VALUE self) { PangoRectangle* r =_SELF(self); return INT2NUM(PANGO_DESCENT(*r)); } static VALUE rg_lbearing(VALUE self) { PangoRectangle* r =_SELF(self); return INT2NUM(PANGO_LBEARING(*r)); } static VALUE rg_rbearing(VALUE self) { PangoRectangle* r =_SELF(self); return INT2NUM(PANGO_RBEARING(*r)); } void Init_pango_rectangle(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_RECTANGLE, "Rectangle", mPango); RG_DEF_METHOD(initialize, 4); 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(ascent, 0); RG_DEF_METHOD(descent, 0); RG_DEF_METHOD(lbearing, 0); RG_DEF_METHOD(rbearing, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoscriptiter.c0000644000175000017500000000477312257552170021550 0ustar koukou/* -*- 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 "rbpangoprivate.h" /**********************************/ static PangoScriptIter* rbpango_script_iter_copy(PangoScriptIter *ref) { /* PangoScriptIter* new_ref = pango_script_iter_new("", 0); g_return_val_if_fail (ref != NULL, NULL); new_ref = g_new(PangoScriptIter, 1); *new_ref = *ref; return new_ref; */ return ref; } GType pango_script_iter_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoScriptIter", (GBoxedCopyFunc)rbpango_script_iter_copy, (GBoxedFreeFunc)pango_script_iter_free); return our_type; } /**********************************/ #define RG_TARGET_NAMESPACE cScriptIter #define _SELF(r) (RVAL2PANGOSCRIPTITER(r)) static VALUE rg_initialize(VALUE self, VALUE text) { PangoScriptIter* iter; StringValue(text); iter = pango_script_iter_new(RSTRING_PTR(text), RSTRING_LEN(text)); G_INITIALIZE(self, iter); return Qnil; } static VALUE rg_range(VALUE self) { G_CONST_RETURN char* start; G_CONST_RETURN char* end; PangoScript script; pango_script_iter_get_range(_SELF(self), &start, &end, &script); return rb_ary_new3(3, CSTR2RVAL(start), CSTR2RVAL(end), PANGOSCRIPT2RVAL(script)); } static VALUE rg_next_bang(VALUE self) { return CBOOL2RVAL(pango_script_iter_next(_SELF(self))); } void Init_pango_script_iter(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_SCRIPT_ITER, "ScriptIter", mPango); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(range, 0); RG_DEF_METHOD_BANG(next, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangolayoutline.c0000644000175000017500000001346512257552170021543 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cLayoutLine #define _SELF(r) (RVAL2PANGOLAYOUTLINE(r)) static VALUE rg_extents(VALUE self) { PangoRectangle ink_rect, logical_rect; pango_layout_line_get_extents(_SELF(self), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_pixel_extents(VALUE self) { PangoRectangle ink_rect, logical_rect; pango_layout_line_get_pixel_extents(_SELF(self), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_index_to_x(VALUE self, VALUE index, VALUE trailing) { int x_pos; pango_layout_line_index_to_x(_SELF(self), NUM2INT(index), RVAL2CBOOL(trailing), &x_pos); return INT2NUM(x_pos); } static VALUE rg_x_to_index(VALUE self, VALUE x_pos) { int index, trailing; gboolean ret = pango_layout_line_x_to_index(_SELF(self), NUM2INT(x_pos), &index, &trailing); return rb_ary_new3(CBOOL2RVAL(ret), INT2NUM(index), INT2NUM(trailing)); } static VALUE rg_get_x_ranges(VALUE self, VALUE start_index, VALUE end_index) { int* ranges; int i, n_ranges; VALUE ary; pango_layout_line_get_x_ranges(_SELF(self), NUM2INT(start_index), NUM2INT(end_index), &ranges, &n_ranges); ary = rb_ary_new(); for (i = 0; i < n_ranges; i++) { rb_ary_push(ary, INT2NUM(ranges[i])); } g_free(ranges); return ary; } /* Structure members */ static VALUE rg_layout(VALUE self) { return GOBJ2RVAL(_SELF(self)->layout); } static VALUE rg_set_layout(VALUE self, VALUE val) { _SELF(self)->layout = RVAL2PANGOLAYOUT(val); return self; } static VALUE rg_start_index(VALUE self) { return INT2NUM(_SELF(self)->start_index); } static VALUE rg_set_start_index(VALUE self, VALUE val) { _SELF(self)->start_index = NUM2INT(val); return self; } static VALUE rg_length(VALUE self) { return INT2NUM(_SELF(self)->length); } static VALUE rg_set_length(VALUE self, VALUE val) { _SELF(self)->length = NUM2INT(val); return self; } static VALUE rg_runs(VALUE self) { GSList* list = _SELF(self)->runs; VALUE ary = rb_ary_new(); while (list) { PangoGlyphItem* old_item = (PangoGlyphItem*)list->data; PangoGlyphItem new_item; new_item.item = pango_item_copy(old_item->item); new_item.glyphs = pango_glyph_string_copy(old_item->glyphs); rb_ary_push(ary, PANGOGLYPHITEM2RVAL(&new_item)); list = list->next; } return ary; } struct layout_line_set_runs_args { PangoLayoutLine *line; VALUE ary; long n; GSList *result; }; static VALUE layout_line_set_runs_body(VALUE value) { struct layout_line_set_runs_args *args = (struct layout_line_set_runs_args *)value; long i; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, RVAL2PANGOGLYPHITEM(RARRAY_PTR(args->ary)[i])); g_slist_free(args->line->runs); args->line->runs = args->result; return Qnil; } static G_GNUC_NORETURN VALUE layout_line_set_runs_rescue(VALUE value) { g_slist_free(((struct layout_line_set_runs_args *)value)->result); rb_exc_raise(rb_errinfo()); } static VALUE rg_set_runs(VALUE self, VALUE attrs) { struct layout_line_set_runs_args args; args.line = _SELF(self); args.ary = rb_ary_to_ary(attrs); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(layout_line_set_runs_body, (VALUE)&args, layout_line_set_runs_rescue, (VALUE)&args); return self; } static VALUE rg_paragraph_start_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->is_paragraph_start); } static VALUE rg_set_paragraph_start(VALUE self, VALUE val) { _SELF(self)->is_paragraph_start = RVAL2CBOOL(val); return self; } static VALUE rg_resolved_dir(VALUE self) { return UINT2NUM(_SELF(self)->resolved_dir); } static VALUE rg_set_resolved_dir(VALUE self, VALUE val) { _SELF(self)->resolved_dir = NUM2UINT(val); return self; } void Init_pango_layout_line(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LAYOUT_LINE, "LayoutLine", mPango); RG_DEF_METHOD(extents, 0); RG_DEF_METHOD(pixel_extents, 0); RG_DEF_METHOD(index_to_x, 2); RG_DEF_METHOD(x_to_index, 1); RG_DEF_METHOD(get_x_ranges, 2); RG_DEF_METHOD(layout, 0); RG_DEF_METHOD(set_layout, 1); RG_DEF_METHOD(start_index, 0); RG_DEF_METHOD(set_start_index, 1); RG_DEF_METHOD(length, 0); RG_DEF_METHOD(set_length, 1); RG_DEF_METHOD(runs, 0); RG_DEF_METHOD(set_runs, 1); RG_DEF_METHOD_P(paragraph_start, 0); RG_DEF_METHOD(set_paragraph_start, 1); RG_DEF_METHOD(resolved_dir, 0); RG_DEF_METHOD(set_resolved_dir, 1); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpango.h0000644000175000017500000000650712516434313017435 0ustar koukou/* -*- 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 "ruby.h" #define PANGO_ENABLE_ENGINE #define PANGO_ENABLE_BACKEND #include #ifdef HAVE_FREETYPE2 #include #endif #include "rbgobject.h" #include "rbpangoversion.h" #include "rbpangoconversions.h" #include #ifdef HAVE_RB_CAIRO_H #include #endif #if defined(G_PLATFORM_WIN32) && !defined(RUBY_PANGO_STATIC_COMPILATION) # ifdef RUBY_PANGO_COMPILATION # define RUBY_PANGO_VAR __declspec(dllexport) # else # define RUBY_PANGO_VAR extern __declspec(dllimport) # endif #else # define RUBY_PANGO_VAR extern #endif extern void Init_pango_inits(); RUBY_PANGO_VAR VALUE mPango; #ifndef PANGO_TYPE_ITEM #define PANGO_TYPE_ITEM (pango_item_get_type()) #endif #define PANGO_TYPE_ANALYSIS (pango_analysis_get_type()) #define PANGO_TYPE_LOG_ATTR (pango_log_attr_get_type()) #ifndef PANGO_TYPE_LAYOUT_ITER #define PANGO_TYPE_LAYOUT_ITER (pango_layout_iter_get_type()) #endif #ifndef PANGO_TYPE_LAYOUT_LINE #define PANGO_TYPE_LAYOUT_LINE (pango_layout_line_get_type()) #endif #define PANGO_TYPE_RECTANGLE (pango_rectangle_get_type()) #define PANGO_TYPE_ATTR_ITERATOR (pango_attr_iter_get_type()) #define PANGO_TYPE_COVERAGE (pango_coverage_get_type()) #define PANGO_TYPE_GLYPH_INFO (pango_glyph_info_get_type()) #ifndef PANGO_TYPE_GLYPH_ITEM # define PANGO_TYPE_GLYPH_ITEM (pango_glyph_item_get_type()) #endif #define PANGO_TYPE_SCRIPT_ITER (pango_script_iter_get_type()) #define ATTR2RVAL(attr) (pango_make_attribute(attr)) #define RVAL2ATTR(attr) (pango_get_attribute(attr)) #define ATTRTYPE2CLASS(attr_type) (pango_get_attribute_klass(attr_type)) #define RBPANGO_ADD_ATTRIBUTE(type, klass) (pango_add_attribute(type, klass)) extern VALUE pango_make_attribute(PangoAttribute* attr); extern PangoAttribute* pango_get_attribute(VALUE attr); extern GType pango_item_get_type(void); extern GType pango_analysis_get_type(void); extern GType pango_log_attr_get_type(void); extern GType pango_layout_iter_get_type(void); extern GType pango_layout_line_get_type(void); extern GType pango_rectangle_get_type(void); extern GType pango_attr_iter_get_type(void); extern GType pango_coverage_get_type(void); extern GType pango_glyph_info_get_type(void); #ifndef HAVE_PANGO_GLYPH_ITEM_GET_TYPE extern GType pango_glyph_item_get_type(void); #endif extern GType pango_script_iter_get_type(void); extern VALUE pango_get_attribute_klass(VALUE attr_type); extern void pango_add_attribute(int attr_type, VALUE klass); ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangotabarray.c0000664000175000017500000000767611740310343021162 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cTabArray #define _SELF(self) (RVAL2PANGOTABARRAY(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE size, positions_in_pixels, attr_ary; PangoTabArray *array; int i; rb_scan_args(argc, argv, "2*", &size, &positions_in_pixels, &attr_ary); array = pango_tab_array_new(NUM2INT(size), RVAL2CBOOL(positions_in_pixels)); G_INITIALIZE(self, array); if (! NIL_P(attr_ary)){ for (i = 0; i < RARRAY_LEN(attr_ary); i++) { pango_tab_array_set_tab(array, i, RVAL2PANGOTABALIGN(RARRAY_PTR(RARRAY_PTR(attr_ary)[i])[0]), FIX2INT(RARRAY_PTR(RARRAY_PTR(attr_ary)[i])[1])); } } return Qnil; } /* This is implemented in rtab_initialize. PangoTabArray* pango_tab_array_new_with_positions (gint size, gboolean positions_in_pixels, PangoTabAlign first_alignment, gint first_position, ...); */ static VALUE rg_size(VALUE self) { return INT2NUM(pango_tab_array_get_size(_SELF(self))); } static VALUE rg_resize(VALUE self, VALUE size) { pango_tab_array_resize(_SELF(self), NUM2INT(size)); return self; } static VALUE rg_set_tab(VALUE self, VALUE tab_index, VALUE align, VALUE location) { pango_tab_array_set_tab(_SELF(self), NUM2INT(tab_index), RVAL2PANGOTABALIGN(align), NUM2INT(location)); return self; } static VALUE rg_get_tab(VALUE self, VALUE tab_index) { PangoTabAlign align; gint location; pango_tab_array_get_tab(_SELF(self), NUM2INT(tab_index), &align, &location); return rb_ary_new3(2, PANGOTABALIGN2RVAL(align), INT2NUM(location)); } static VALUE rg_tabs(VALUE self) { PangoTabAlign* aligns; gint* locations; VALUE ary = rb_ary_new(); PangoTabArray* tab_array = _SELF(self); gint i; pango_tab_array_get_tabs(tab_array, &aligns, &locations); for (i = 0; i < pango_tab_array_get_size(tab_array); i++){ rb_ary_push(ary, rb_ary_new3(2, PANGOTABALIGN2RVAL(aligns[i]), INT2NUM(locations[i]))); } return ary; } static VALUE rg_positions_in_pixels_p(VALUE self) { return CBOOL2RVAL(pango_tab_array_get_positions_in_pixels(_SELF(self))); } void Init_pango_array(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_TAB_ARRAY, "TabArray", mPango); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(resize, 1); RG_DEF_METHOD(set_tab, 3); RG_DEF_METHOD(get_tab, 1); RG_DEF_METHOD(tabs, 0); RG_DEF_METHOD_P(positions_in_pixels, 0); /* PangoTabAlign */ G_DEF_CLASS(PANGO_TYPE_TAB_ALIGN, "TabAlign", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_TAB_ALIGN, "PANGO_"); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangocairo.c0000644000175000017500000000703312516434313020441 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-2014 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cCairoFontMap #define _SELF(self) (RVAL2PANGOCAIROFONTMAP(self)) static VALUE rg_s_create(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass) { VALUE rb_font_type; PangoFontMap *font_map = NULL; rb_scan_args(argc, argv, "01", &rb_font_type); if (NIL_P(rb_font_type)) { font_map = pango_cairo_font_map_new(); } else { #if PANGO_CHECK_VERSION(1, 18, 0) cairo_font_type_t font_type = CAIRO_FONT_TYPE_USER; if (rbgutil_key_equal(rb_font_type, "ft") || rbgutil_key_equal(rb_font_type, "freetype")) { font_type = CAIRO_FONT_TYPE_FT; } else if (rbgutil_key_equal(rb_font_type, "win32")) { font_type = CAIRO_FONT_TYPE_WIN32; } else if (rbgutil_key_equal(rb_font_type, "quartz")) { font_type = CAIRO_FONT_TYPE_QUARTZ; } else { rb_raise(rb_eArgError, "font type must be one of " ":ft, :freetype, :win32 or :quartz: %s", RBG_INSPECT(rb_font_type)); } font_map = pango_cairo_font_map_new_for_font_type(font_type); #else rb_raise(rb_eArgError, "Pango::CairoFontMap.create with font type " "requires Pango 1.18.0 or later"); #endif } return GOBJ2RVAL(font_map); } static VALUE rg_s_default(G_GNUC_UNUSED VALUE klass) { return GOBJ2RVAL(pango_cairo_font_map_get_default()); } #if PANGO_CHECK_VERSION(1, 22, 0) static VALUE rg_s_set_default(VALUE klass, VALUE font_map) { pango_cairo_font_map_set_default(RVAL2GOBJ(font_map)); return klass; } #endif static VALUE rg_set_resolution(VALUE self, VALUE dpi) { pango_cairo_font_map_set_resolution(_SELF(self), NUM2DBL(dpi)); return self; } static VALUE rg_resolution(VALUE self) { return rb_float_new(pango_cairo_font_map_get_resolution(_SELF(self))); } static VALUE rg_create_context(VALUE self) { PangoContext *pango_context; #if PANGO_CHECK_VERSION(1, 22, 0) pango_context = pango_font_map_create_context(PANGO_FONT_MAP(_SELF(self))); #else pango_context = pango_cairo_font_map_create_context(_SELF(self)); #endif return GOBJ2RVAL_UNREF(pango_context); } void Init_pango_cairo(VALUE mPango) { VALUE RG_TARGET_NAMESPACE; /* Pango::CairoFontMap */ RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_CAIRO_FONT_MAP, "CairoFontMap", mPango); RG_DEF_SMETHOD(create, -1); RG_DEF_SMETHOD(default, 0); #if PANGO_CHECK_VERSION(1, 22, 0) RG_DEF_SMETHOD(set_default, 1); #endif RG_DEF_METHOD(set_resolution, 1); RG_DEF_METHOD(resolution, 0); RG_DEF_METHOD(create_context, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/pango.def0000644000175000017500000000063211701304107017401 0ustar koukouEXPORTS Init_pango mPango DATA attrstring DATA pattr DATA pattrbool DATA pattrcolor DATA pattrfloat DATA pattrint DATA pango_add_attribute pango_attr_iter_get_type pango_get_attribute pango_get_attribute_klass pango_item_get_type pango_layout_iter_get_type pango_layout_line_get_type pango_make_attribute pango_rectangle_get_type ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangocoverage.c0000644000175000017500000000564411701304107021135 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cCoverage #define _SELF(self) (RVAL2PANGOCOVERAGE(self)) /**********************************/ GType pango_coverage_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoCoverage", (GBoxedCopyFunc)pango_coverage_copy, (GBoxedFreeFunc)pango_coverage_unref); return our_type; } /**********************************/ static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, pango_coverage_new()); return Qnil; } static VALUE rg_get_level(VALUE self, VALUE index_) { return PANGOCOVERAGELEVEL2RVAL(pango_coverage_get(_SELF(self), NUM2INT(index_))); } static VALUE rg_max_bang(VALUE self, VALUE other) { pango_coverage_max(_SELF(self), _SELF(other)); return self; } static VALUE rg_set(VALUE self, VALUE index_, VALUE level) { pango_coverage_set(_SELF(self), NUM2INT(index_), RVAL2PANGOCOVERAGELEVEL(level)); return self; } static VALUE rg_to_bytes(VALUE self) { guchar* bytes; int n_bytes; VALUE ret; pango_coverage_to_bytes(_SELF(self), &bytes, &n_bytes); ret = rb_str_new((const char*)bytes, n_bytes); g_free(bytes); return ret; } static VALUE rg_s_from_bytes(G_GNUC_UNUSED VALUE self, VALUE bytes) { StringValue(bytes); return PANGOCOVERAGE2RVAL(pango_coverage_from_bytes((guchar *)RSTRING_PTR(bytes), RSTRING_LEN(bytes))); } void Init_pango_coverage(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_COVERAGE, "Coverage", mPango); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_level, 0); RG_DEF_METHOD_BANG(max, 1); RG_DEF_METHOD(set, 2); RG_DEF_METHOD(to_bytes, 0); RG_DEF_SMETHOD(from_bytes, 1); /* PangoCoverageLevel */ G_DEF_CLASS(PANGO_TYPE_COVERAGE_LEVEL, "Level", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, PANGO_TYPE_COVERAGE_LEVEL, "PANGO_COVERAGE_"); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangologattr.c0000644000175000017500000000666012257552170021031 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cLogAttr #define _SELF(s) (RVAL2PANGOLOGATTR(s)) /**********************************/ static PangoLogAttr* log_copy(const PangoLogAttr* val) { PangoLogAttr* new_val; g_return_val_if_fail (val != NULL, NULL); new_val = g_new(PangoLogAttr, 1); *new_val = *val; return new_val; } GType pango_log_attr_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoLogAttr", (GBoxedCopyFunc)log_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ #define ATTR_BOOL(name)\ static VALUE \ log_get_ ## name (VALUE self)\ {\ return CBOOL2RVAL(_SELF(self)->name);\ }\ static VALUE \ log_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2CBOOL(val);\ return self;\ } static VALUE rg_initialize(VALUE self) { PangoLogAttr attribute; memset(&attribute, 0, sizeof(PangoLogAttr)); G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_LOG_ATTR, &attribute)); return Qnil; } #define DEFINE_ACCESSOR(logattr, name) \ rbg_define_method(logattr, G_STRINGIFY(name?), log_get_is_ ## name, 0);\ rbg_define_method(logattr, G_STRINGIFY(set_ ## name), log_set_is_ ## name, 1); ATTR_BOOL(is_line_break); ATTR_BOOL(is_mandatory_break); ATTR_BOOL(is_char_break); ATTR_BOOL(is_white); ATTR_BOOL(is_cursor_position); ATTR_BOOL(is_word_start); ATTR_BOOL(is_word_end); ATTR_BOOL(is_sentence_boundary); ATTR_BOOL(is_sentence_start); ATTR_BOOL(is_sentence_end); ATTR_BOOL(backspace_deletes_character); void Init_pango_logattr(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LOG_ATTR, "LogAttr", mPango); RG_DEF_METHOD(initialize, 0); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, line_break); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, mandatory_break); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, char_break); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, white); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, cursor_position); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, word_start); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, word_end); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, sentence_boundary); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, sentence_start); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, sentence_end); rbg_define_method(RG_TARGET_NAMESPACE, "backspace_deletes_character?", log_get_backspace_deletes_character, 0); rbg_define_method(RG_TARGET_NAMESPACE, "set_backspace_deletes_character", log_set_backspace_deletes_character, 1); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontset.c0000644000175000017500000000374512257552170021040 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFontset #define _SELF(self) (RVAL2PANGOFONTSET(self)) static ID id_call; static VALUE rg_get_font(VALUE self, VALUE wc) { return GOBJ2RVAL(pango_fontset_get_font(_SELF(self), NUM2UINT(wc))); } static VALUE rg_metrics(VALUE self) { return PANGOFONTMETRICS2RVAL(pango_fontset_get_metrics(_SELF(self))); } static gboolean fontset_each(PangoFontset *fontset, PangoFont *font, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(fontset), GOBJ2RVAL(font))); } static VALUE rg_each(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); pango_fontset_foreach(_SELF(self), (PangoFontsetForeachFunc)fontset_each, (gpointer)func); return self; } void Init_pango_fontset(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONTSET, "Fontset", mPango); id_call = rb_intern("call"); RG_DEF_METHOD(get_font, 1); RG_DEF_METHOD(metrics, 0); RG_DEF_METHOD(each, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangocolor.c0000644000175000017500000000555212124610262020460 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cColor #define _SELF(self) (RVAL2PANGOCOLOR(self)) static VALUE rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue) { PangoColor color; color.red = NUM2UINT(red); color.green = NUM2UINT(green); color.blue = NUM2UINT(blue); G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_COLOR, &color)); return Qnil; } static VALUE rg_parse(VALUE self, VALUE spec) { return CBOOL2RVAL(pango_color_parse(_SELF(self), RVAL2CSTR(spec))); } static VALUE rg_red(VALUE self) { return UINT2NUM(_SELF(self)->red); } static VALUE rg_set_red(VALUE self, VALUE red) { _SELF(self)->red = NUM2UINT(red); return self; } static VALUE rg_green(VALUE self) { return UINT2NUM(_SELF(self)->green); } static VALUE rg_set_green(VALUE self, VALUE green) { _SELF(self)->green = NUM2UINT(green); return self; } static VALUE rg_blue(VALUE self) { return UINT2NUM(_SELF(self)->blue); } static VALUE rg_set_blue(VALUE self, VALUE blue) { _SELF(self)->blue = NUM2UINT(blue); return self; } static VALUE rg_to_a(VALUE self) { PangoColor *c = _SELF(self); return rb_ary_new3(3, UINT2NUM(c->red), UINT2NUM(c->green), UINT2NUM(c->blue)); } static VALUE rg_operator_color_equal(VALUE self, VALUE other) { PangoColor* c1 = _SELF(self); PangoColor* c2 = _SELF(other); return CBOOL2RVAL((c1->red == c2->red) && (c1->green == c2->green) && (c1->blue == c2->blue)); } void Init_pango_color(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_COLOR, "Color", mPango); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(parse, 1); 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("==", color_equal, 1); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontmetrics.c0000644000175000017500000000473112257552170021707 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFontMetrics #define _SELF(self) (RVAL2PANGOFONTMETRICS(self)) static VALUE rg_ascent(VALUE self) { return INT2NUM(pango_font_metrics_get_ascent(_SELF(self))); } static VALUE rg_descent(VALUE self) { return INT2NUM(pango_font_metrics_get_descent(_SELF(self))); } static VALUE rg_approximate_char_width(VALUE self) { return INT2NUM(pango_font_metrics_get_approximate_char_width(_SELF(self))); } static VALUE rg_approximate_digit_width(VALUE self) { return INT2NUM(pango_font_metrics_get_approximate_digit_width(_SELF(self))); } static VALUE rg_underline_thickness(VALUE self) { return INT2NUM(pango_font_metrics_get_underline_thickness(_SELF(self))); } static VALUE rg_underline_position(VALUE self) { return INT2NUM(pango_font_metrics_get_underline_position(_SELF(self))); } static VALUE rg_strikethrough_thickness(VALUE self) { return INT2NUM(pango_font_metrics_get_strikethrough_thickness(_SELF(self))); } static VALUE rg_strikethrough_position(VALUE self) { return INT2NUM(pango_font_metrics_get_strikethrough_position(_SELF(self))); } void Init_pango_font_metrics(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONT_METRICS, "FontMetrics", mPango); RG_DEF_METHOD(ascent, 0); RG_DEF_METHOD(descent, 0); RG_DEF_METHOD(approximate_char_width, 0); RG_DEF_METHOD(approximate_digit_width, 0); RG_DEF_METHOD(underline_thickness, 0); RG_DEF_METHOD(underline_position, 0); RG_DEF_METHOD(strikethrough_thickness, 0); RG_DEF_METHOD(strikethrough_position, 0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoattriterator.c0000644000175000017500000000723311701304107022062 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cAttrIterator #define _SELF(self) (RVAL2PANGOATTRITERATOR(self)) /**********************************/ GType pango_attr_iter_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoAttrIterator", (GBoxedCopyFunc)pango_attr_iterator_copy, (GBoxedFreeFunc)pango_attr_iterator_destroy); return our_type; } /**********************************/ static VALUE rg_next_bang(VALUE self) { return CBOOL2RVAL(pango_attr_iterator_next(_SELF(self))); } static VALUE rg_range(VALUE self) { gint start = 0; gint end = 0; pango_attr_iterator_range(_SELF(self), &start, &end); return rb_ary_new3(2, INT2NUM(start), INT2NUM(end)); } static VALUE rg_get(int argc, VALUE *argv, VALUE self) { VALUE type, ret; PangoAttribute* attr; int i; rb_scan_args(argc, argv, "01", &type); if (NIL_P(type)){ PangoAttrIterator* iter = _SELF(self); ret = rb_ary_new(); for (i = 0; i < PANGO_ATTR_SCALE + 1; i++){ attr = pango_attr_iterator_get(iter, i); if (attr) rb_ary_push(ret, ATTR2RVAL(attr)); } } else { attr = pango_attr_iterator_get(_SELF(self), FIX2INT(type)); ret = attr ? ATTR2RVAL(attr) : Qnil; } return ret; } static VALUE rg_font(VALUE self) { PangoFontDescription* desc; PangoLanguage* lang; GSList* extra_attrs; VALUE ary, ret; desc = pango_font_description_new(); pango_attr_iterator_get_font(_SELF(self), desc, &lang, &extra_attrs); ary = rb_ary_new(); while(extra_attrs) { rb_ary_push(ary, ATTR2RVAL(extra_attrs->data)); extra_attrs = extra_attrs->next; } ret = rb_ary_new3(3, PANGOFONTDESCRIPTION2RVAL(desc), PANGOLANGUAGE2RVAL(lang), ary); pango_font_description_free(desc); return ret; } #ifdef HAVE_PANGO_ATTR_ITERATOR_GET_ATTRS static VALUE rg_attrs(VALUE self) { GSList* list = pango_attr_iterator_get_attrs(_SELF(self)); GSList* base = list; GSList* old = list; VALUE ary = rb_ary_new(); while (list) { rb_ary_push(ary, ATTR2RVAL(list->data)); list = list->next; } while (old) { pango_attribute_destroy((PangoAttribute*)old); old = old->next; } g_slist_free(base); return ary; } #endif void Init_pango_attriterator(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_ATTR_ITERATOR, "AttrIterator", mPango); RG_DEF_METHOD_BANG(next, 0); RG_DEF_METHOD(range, 0); RG_DEF_METHOD(get, -1); RG_DEF_METHOD(font, 0); #ifdef HAVE_PANGO_ATTR_ITERATOR_GET_ATTRS RG_DEF_METHOD(attrs, 0); #endif } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangofontfamily.c0000644000175000017500000000443112257552170021517 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cFontFamily #define _SELF(self) (RVAL2PANGOFONTFAMILY(self)) static VALUE rg_name(VALUE self) { return CSTR2RVAL(pango_font_family_get_name(_SELF(self))); } #ifdef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE static VALUE rg_monospace_p(VALUE self) { return CBOOL2RVAL(pango_font_family_is_monospace(_SELF(self))); } #endif static VALUE rg_faces(VALUE self) { int n_faces; PangoFontFace** faces; int i; VALUE result; pango_font_family_list_faces(_SELF(self), &faces, &n_faces); result = rb_ary_new2(n_faces); for (i = 0; i < n_faces; i++) rb_ary_store(result, i, GOBJ2RVAL(faces[i])); g_free(faces); return result; } void Init_pango_font_family(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_FONT_FAMILY, "FontFamily", mPango); RG_DEF_METHOD(name, 0); #ifdef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE RG_DEF_METHOD_P(monospace, 0); #endif RG_DEF_METHOD(faces, 0); G_DEF_CLASS3("PangoFcFamily", "FcFamily", mPango); G_DEF_CLASS3("PangoFT2Family", "FT2Family", mPango); G_DEF_CLASS3("PangoXftFamily", "XftFamily", mPango); G_DEF_CLASS3("PangoXFamily", "XFamily", mPango); G_DEF_CLASS3("PangoWin32Family", "Win32Family", mPango); G_DEF_CLASS3("PangoATSUIFamily", "ATSUIFamily", mPango); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpango.c0000644000175000017500000002264312516434313017427 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE mPango VALUE RG_TARGET_NAMESPACE; extern void Init_pango(void); /* * Rendering */ struct rpango_reorder_items_args { PangoItem *item; VALUE ary; long n; GList *result; }; static VALUE rpango_reorder_items_body(VALUE value) { struct rpango_reorder_items_args *args = (struct rpango_reorder_items_args *)value; long i; GList *result; for (i = 0; i < args->n; i++) args->result = g_list_append(args->result, RVAL2PANGOITEM(RARRAY_PTR(args->ary)[i])); result = pango_reorder_items(args->result); g_list_free(args->result); return GLIST2ARY2(result, PANGO_TYPE_ITEM); } static VALUE rpango_reorder_items_ensure(VALUE value) { g_list_free(((struct rpango_reorder_items_args *)value)->result); return Qnil; } static VALUE rg_s_reorder_items(G_GNUC_UNUSED VALUE self, VALUE attrs) { struct rpango_reorder_items_args args; args.ary = rb_ary_to_ary(attrs); args.n = RARRAY_LEN(args.ary); args.result = NULL; return rb_ensure(rpango_reorder_items_body, (VALUE)&args, rpango_reorder_items_ensure, (VALUE)&args); } static VALUE rg_s_unichar_direction(G_GNUC_UNUSED VALUE self, VALUE ch) { return PANGODIRECTION2RVAL(pango_unichar_direction(NUM2UINT(ch))); } static VALUE rg_s_find_base_dir(G_GNUC_UNUSED VALUE self, VALUE text) { StringValue(text); return PANGODIRECTION2RVAL(pango_find_base_dir(RSTRING_PTR(text), RSTRING_LEN(text))); } struct rbg_pangologattrs2rval_free_args { PangoLogAttr *attrs; long n; }; static VALUE rbg_pangologattrs2rval_free_body(VALUE value) { struct rbg_pangologattrs2rval_free_args *args = (struct rbg_pangologattrs2rval_free_args *)value; long i; VALUE ary = rb_ary_new(); for (i = 0; i < args->n; i++) rb_ary_push(ary, PANGOLOGATTR2RVAL(&args->attrs[i])); return ary; } static VALUE rbg_pangologattrs2rval_free_ensure(VALUE value) { g_free(((struct rbg_pangologattrs2rval_free_args *)value)->attrs); return Qnil; } static VALUE rbg_pangologattrs2rval_free(PangoLogAttr *attrs, long n) { struct rbg_pangologattrs2rval_free_args args = { attrs, n }; return rb_ensure(rbg_pangologattrs2rval_free_body, (VALUE)&args, rbg_pangologattrs2rval_free_ensure, (VALUE)&args); } #define PANGOLOGATTRS2RVAL_FREE(attrs, n) rbg_pangologattrs2rval_free(attrs, n) static VALUE rg_s_break(G_GNUC_UNUSED VALUE self, VALUE rbtext, VALUE rbanalysis) { const gchar *text = RVAL2CSTR(rbtext); long length = RSTRING_LEN(rbtext); PangoAnalysis *analysis = RVAL2PANGOANALYSIS(rbanalysis); long n = g_utf8_strlen(text, length) + 1; PangoLogAttr *attrs = g_new(PangoLogAttr, n); pango_break(text, length, analysis, attrs, n); return PANGOLOGATTRS2RVAL_FREE(attrs, n); } static VALUE rg_s_get_log_attrs(G_GNUC_UNUSED VALUE self, VALUE rbtext, VALUE rblevel, VALUE rblanguage) { const gchar *text = RVAL2CSTR(rbtext); long length = RSTRING_LEN(rbtext); int level = NUM2INT(rblevel); PangoLanguage *language = RVAL2PANGOLANGUAGE(rblanguage); long n = g_utf8_strlen(text, length) + 1; PangoLogAttr *attrs = g_new(PangoLogAttr, n); pango_get_log_attrs(text, length, level, language, attrs, n); return PANGOLOGATTRS2RVAL_FREE(attrs, n); } static VALUE rg_s_find_paragraph_boundary(G_GNUC_UNUSED VALUE self, VALUE text) { gint paragraph_delimiter_index, next_paragraph_start; StringValue(text); pango_find_paragraph_boundary(RSTRING_PTR(text), RSTRING_LEN(text), ¶graph_delimiter_index, &next_paragraph_start); return rb_ary_new3(2, INT2NUM(paragraph_delimiter_index), INT2NUM(next_paragraph_start)); } /* Don't need to implement this. Use pango_break instead. void pango_default_break (const gchar *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, int attrs_len); */ static VALUE rpango_shape_result(VALUE value) { return PANGOGLYPHSTRING2RVAL((PangoGlyphString *)value); } static VALUE rpango_shape_ensure(VALUE value) { pango_glyph_string_free((PangoGlyphString *)value); return Qnil; } static VALUE rg_s_shape(G_GNUC_UNUSED VALUE self, VALUE rbtext, VALUE rbanalysis) { const gchar *text = RVAL2CSTR(rbtext); long length = RSTRING_LEN(rbtext); PangoAnalysis *analysis = RVAL2PANGOANALYSIS(rbanalysis); PangoGlyphString *glyphs = pango_glyph_string_new(); pango_shape(text, length, analysis, glyphs); return rb_ensure(rpango_shape_result, (VALUE)glyphs, rpango_shape_ensure, (VALUE)glyphs); } /* This method is from rbpangoattribute.c */ static VALUE rg_s_parse_markup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE markup_text, accel_marker; PangoAttrList *pattr_list; gchar* gtext; gunichar accel_char; GError *error = NULL; gboolean ret; char c; VALUE text = Qnil; VALUE attr_list = Qnil; rb_scan_args(argc, argv, "11", &markup_text, &accel_marker); if (NIL_P(markup_text)) rb_raise(rb_eRuntimeError, "1st argument can't accept nil"); StringValue(markup_text); ret = pango_parse_markup(RSTRING_PTR(markup_text), RSTRING_LEN(markup_text), NIL_P(accel_marker) ? 0 : NUM2CHR(accel_marker), &pattr_list, >ext, &accel_char, &error); if (!ret) RAISE_GERROR(error); if (pattr_list){ attr_list = PANGOATTRLIST2RVAL(pattr_list); pango_attr_list_unref(pattr_list); } c = (char)accel_char; if (text){ text = CSTR2RVAL(gtext); g_free(gtext); } return rb_ary_new3(3, attr_list, text, accel_char ? rb_str_new(&c, 1) : Qnil); } static VALUE rg_s_pixels(G_GNUC_UNUSED VALUE self, VALUE pixels) { return rb_float_new(PANGO_PIXELS(NUM2DBL(pixels))); } static VALUE rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self) { return Qtrue; } void Init_pango(void) { RG_TARGET_NAMESPACE = rb_define_module("Pango"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(PANGO_MAJOR_VERSION), INT2FIX(PANGO_MINOR_VERSION), INT2FIX(PANGO_MICRO_VERSION))); RG_DEF_SMETHOD(reorder_items, 1); RG_DEF_SMETHOD(unichar_direction, 1); RG_DEF_SMETHOD(find_base_dir, 1); RG_DEF_SMETHOD(break, 2); RG_DEF_SMETHOD(get_log_attrs, 3); RG_DEF_SMETHOD(find_paragraph_boundary, 1); RG_DEF_SMETHOD(shape, 2); RG_DEF_SMETHOD(parse_markup, -1); RG_DEF_SMETHOD(pixels, 1); rb_define_const(RG_TARGET_NAMESPACE, "SCALE", INT2FIX(PANGO_SCALE)); RG_DEF_SMETHOD_P(cairo_available, 0); Init_pango_analysis(RG_TARGET_NAMESPACE); Init_pango_attribute(RG_TARGET_NAMESPACE); Init_pango_attriterator(RG_TARGET_NAMESPACE); Init_pango_attrlist(RG_TARGET_NAMESPACE); Init_pango_cairo(RG_TARGET_NAMESPACE); Init_pango_cairo_context(RG_TARGET_NAMESPACE); Init_pango_color(RG_TARGET_NAMESPACE); Init_pango_context(RG_TARGET_NAMESPACE); Init_pango_coverage(RG_TARGET_NAMESPACE); Init_pango_engine(RG_TARGET_NAMESPACE); Init_pango_font(RG_TARGET_NAMESPACE); Init_pango_font_description(RG_TARGET_NAMESPACE); Init_pango_font_face(RG_TARGET_NAMESPACE); Init_pango_font_family(RG_TARGET_NAMESPACE); Init_pango_font_map(RG_TARGET_NAMESPACE); Init_pango_font_metrics(RG_TARGET_NAMESPACE); Init_pango_fontset(RG_TARGET_NAMESPACE); Init_pango_fontset_simple(RG_TARGET_NAMESPACE); Init_pango_glyph_info(RG_TARGET_NAMESPACE); Init_pango_glyph_item(RG_TARGET_NAMESPACE); Init_pango_glyph_string(RG_TARGET_NAMESPACE); Init_pango_gravity(RG_TARGET_NAMESPACE); Init_pango_item(RG_TARGET_NAMESPACE); Init_pango_language(RG_TARGET_NAMESPACE); Init_pango_layout(RG_TARGET_NAMESPACE); Init_pango_layout_iter(RG_TARGET_NAMESPACE); Init_pango_layout_line(RG_TARGET_NAMESPACE); Init_pango_logattr(RG_TARGET_NAMESPACE); Init_pango_matrix(RG_TARGET_NAMESPACE); Init_pango_rectangle(RG_TARGET_NAMESPACE); Init_pangorenderer(RG_TARGET_NAMESPACE); Init_pango_script(RG_TARGET_NAMESPACE); Init_pango_script_iter(RG_TARGET_NAMESPACE); Init_pango_array(RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangoprivate.h0000644000175000017500000000412412257552170021025 0ustar koukou#ifndef RB_PANGO_PRIVATE_H #define RB_PANGO_PRIVATE_H #include "rbpango.h" #ifndef HAVE_RB_ERRINFO # define rb_errinfo() (ruby_errinfo) #endif G_BEGIN_DECLS G_GNUC_INTERNAL void Init_pango_analysis(VALUE mPango); G_GNUC_INTERNAL void Init_pango_attribute(VALUE mPango); G_GNUC_INTERNAL void Init_pango_attriterator(VALUE mPango); G_GNUC_INTERNAL void Init_pango_attrlist(VALUE mPango); G_GNUC_INTERNAL void Init_pango_cairo(VALUE mPango); G_GNUC_INTERNAL void Init_pango_cairo_context(VALUE mPango); G_GNUC_INTERNAL void Init_pango_color(VALUE mPango); G_GNUC_INTERNAL void Init_pango_context(VALUE mPango); G_GNUC_INTERNAL void Init_pango_coverage(VALUE mPango); G_GNUC_INTERNAL void Init_pango_engine(VALUE mPango); G_GNUC_INTERNAL void Init_pango_font(VALUE mPango); G_GNUC_INTERNAL void Init_pango_font_description(VALUE mPango); G_GNUC_INTERNAL void Init_pango_font_face(VALUE mPango); G_GNUC_INTERNAL void Init_pango_font_family(VALUE mPango); G_GNUC_INTERNAL void Init_pango_font_map(VALUE mPango); G_GNUC_INTERNAL void Init_pango_font_metrics(VALUE mPango); G_GNUC_INTERNAL void Init_pango_fontset(VALUE mPango); G_GNUC_INTERNAL void Init_pango_fontset_simple(VALUE mPango); G_GNUC_INTERNAL void Init_pango_glyph_info(VALUE mPango); G_GNUC_INTERNAL void Init_pango_glyph_item(VALUE mPango); G_GNUC_INTERNAL void Init_pango_glyph_string(VALUE mPango); G_GNUC_INTERNAL void Init_pango_gravity(VALUE mPango); G_GNUC_INTERNAL void Init_pango_item(VALUE mPango); G_GNUC_INTERNAL void Init_pango_language(VALUE mPango); G_GNUC_INTERNAL void Init_pango_layout(VALUE mPango); G_GNUC_INTERNAL void Init_pango_layout_iter(VALUE mPango); G_GNUC_INTERNAL void Init_pango_layout_line(VALUE mPango); G_GNUC_INTERNAL void Init_pango_logattr(VALUE mPango); G_GNUC_INTERNAL void Init_pango_matrix(VALUE mPango); G_GNUC_INTERNAL void Init_pango_rectangle(VALUE mPango); G_GNUC_INTERNAL void Init_pangorenderer(VALUE mPango); G_GNUC_INTERNAL void Init_pango_script(VALUE mPango); G_GNUC_INTERNAL void Init_pango_script_iter(VALUE mPango); G_GNUC_INTERNAL void Init_pango_array(VALUE mPango); G_END_DECLS #endif /* RB_PANGO_PRIVATE_H */ ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangomatrix.c0000644000175000017500000000734112516434313020652 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cMatrix #define _SELF(self) (RVAL2PANGOMATRIX(self)) #define ATTR_FLOAT(name)\ static VALUE \ matrix_get_ ## name (VALUE self)\ {\ return rb_float_new(_SELF(self)->name);\ }\ static VALUE \ matrix_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = NUM2DBL(val);\ return self;\ } #define DEFINE_ACCESSOR(name) \ rbg_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(name), matrix_get_ ## name, 0);\ rbg_define_method(RG_TARGET_NAMESPACE, G_STRINGIFY(set_ ## name), matrix_set_## name, 1); static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { PangoMatrix matrix = PANGO_MATRIX_INIT; VALUE xx, xy, yx, yy, x0, y0; rb_scan_args(argc, argv, "06", &xx, &xy, &yx, &yy, &x0, &y0); if (argc > 0){ matrix.xx = NUM2DBL(xx); matrix.xy = NUM2DBL(xy); matrix.yx = NUM2DBL(yx); matrix.yy = NUM2DBL(yy); matrix.x0 = NUM2DBL(x0); matrix.y0 = NUM2DBL(y0); } G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_MATRIX, &matrix)); return Qnil; } static VALUE rg_translate_bang(VALUE self, VALUE tx, VALUE ty) { pango_matrix_translate(_SELF(self), NUM2DBL(tx), NUM2DBL(ty)); return self; } static VALUE rg_scale_bang(VALUE self, VALUE scale_x, VALUE scale_y) { pango_matrix_scale(_SELF(self), NUM2DBL(scale_x), NUM2DBL(scale_y)); return self; } static VALUE rg_rotate_bang(VALUE self, VALUE degrees) { pango_matrix_rotate(_SELF(self), NUM2DBL(degrees)); return self; } #if PANGO_CHECK_VERSION(1,16,0) static VALUE rg_gravity(VALUE self) { return PANGOGRAVITY2RVAL(pango_gravity_get_for_matrix(_SELF(self))); } #endif static VALUE rg_concat_bang(VALUE self, VALUE new_matrix) { pango_matrix_concat(_SELF(self), _SELF(new_matrix)); return self; } static VALUE rg_font_scale_factor(VALUE self) { return rb_float_new(pango_matrix_get_font_scale_factor(_SELF(self))); } ATTR_FLOAT(xx); ATTR_FLOAT(xy); ATTR_FLOAT(yx); ATTR_FLOAT(yy); ATTR_FLOAT(x0); ATTR_FLOAT(y0); static VALUE rg_to_a(VALUE self) { PangoMatrix* matrix = _SELF(self); return rb_ary_new3(6, INT2NUM(matrix->xx), INT2NUM(matrix->xy), INT2NUM(matrix->yx), INT2NUM(matrix->yy), INT2NUM(matrix->x0), INT2NUM(matrix->y0)); } void Init_pango_matrix(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_MATRIX, "Matrix", mPango); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD_BANG(translate, 2); RG_DEF_METHOD_BANG(scale, 2); RG_DEF_METHOD_BANG(rotate, 1); RG_DEF_METHOD_BANG(concat, 1); RG_DEF_METHOD(font_scale_factor, 0); #if PANGO_CHECK_VERSION(1,16,0) RG_DEF_METHOD(gravity, 0); #endif RG_DEF_METHOD(to_a, 0); DEFINE_ACCESSOR(xx); DEFINE_ACCESSOR(xy); DEFINE_ACCESSOR(yx); DEFINE_ACCESSOR(yy); DEFINE_ACCESSOR(x0); DEFINE_ACCESSOR(y0); } ruby-gnome2-all-2.2.5/pango/ext/pango/rbpangolayoutiter.c0000644000175000017500000001150211701304107021531 0ustar koukou/* -*- 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 "rbpangoprivate.h" #define RG_TARGET_NAMESPACE cLayoutIter #define _SELF(r) (RVAL2PANGOLAYOUTITER(r)) /**********************************/ #ifndef HAVE_PANGO_LAYOUT_ITER_GET_TYPE static PangoLayoutIter * layout_iter_copy(const PangoLayoutIter *ref) { return (PangoLayoutIter *)ref; } GType pango_layout_iter_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("PangoLayoutIter", (GBoxedCopyFunc)layout_iter_copy, (GBoxedFreeFunc)pango_layout_iter_free); return our_type; } #endif /**********************************/ static VALUE rg_next_run_bang(VALUE self) { return CBOOL2RVAL(pango_layout_iter_next_run(_SELF(self))); } static VALUE rg_next_char_bang(VALUE self) { return CBOOL2RVAL(pango_layout_iter_next_char(_SELF(self))); } static VALUE rg_next_cluster_bang(VALUE self) { return CBOOL2RVAL(pango_layout_iter_next_cluster(_SELF(self))); } static VALUE rg_next_line_bang(VALUE self) { return CBOOL2RVAL(pango_layout_iter_next_line(_SELF(self))); } static VALUE rg_at_last_line_p(VALUE self) { return CBOOL2RVAL(pango_layout_iter_at_last_line(_SELF(self))); } static VALUE rg_index(VALUE self) { return INT2NUM(pango_layout_iter_get_index(_SELF(self))); } static VALUE rg_baseline(VALUE self) { return INT2NUM(pango_layout_iter_get_baseline(_SELF(self))); } static VALUE rg_run(VALUE self) { PangoLayoutRun* run = pango_layout_iter_get_run(_SELF(self)); return PANGOGLYPHITEM2RVAL(run); } static VALUE rg_line(VALUE self) { return PANGOLAYOUTLINE2RVAL(pango_layout_iter_get_line(_SELF(self))); } static VALUE rg_char_extents(VALUE self) { PangoRectangle logical_rect; pango_layout_iter_get_char_extents(_SELF(self), &logical_rect); return PANGORECTANGLE2RVAL(&logical_rect); } static VALUE rg_cluster_extents(VALUE self) { PangoRectangle ink_rect, logical_rect; pango_layout_iter_get_cluster_extents(_SELF(self), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_run_extents(VALUE self) { PangoRectangle ink_rect, logical_rect; pango_layout_iter_get_run_extents(_SELF(self), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_line_yrange(VALUE self) { int y0, y1; pango_layout_iter_get_line_yrange(_SELF(self), &y0, &y1); return rb_assoc_new(INT2NUM(y0), INT2NUM(y1)); } static VALUE rg_line_extents(VALUE self) { PangoRectangle ink_rect, logical_rect; pango_layout_iter_get_line_extents(_SELF(self), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } static VALUE rg_layout_extents(VALUE self) { PangoRectangle ink_rect, logical_rect; pango_layout_iter_get_layout_extents(_SELF(self), &ink_rect, &logical_rect); return rb_assoc_new(PANGORECTANGLE2RVAL(&ink_rect), PANGORECTANGLE2RVAL(&logical_rect)); } void Init_pango_layout_iter(VALUE mPango) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_LAYOUT_ITER, "LayoutIter", mPango); rbgobj_boxed_not_copy_obj(PANGO_TYPE_LAYOUT_ITER); RG_DEF_METHOD_BANG(next_run, 0); RG_DEF_METHOD_BANG(next_char, 0); RG_DEF_METHOD_BANG(next_cluster, 0); RG_DEF_METHOD_BANG(next_line, 0); RG_DEF_METHOD_P(at_last_line, 0); /* for backword compatibility. :< */ RG_DEF_ALIAS("at_last_line!", "at_last_line?"); RG_DEF_METHOD(index, 0); RG_DEF_METHOD(baseline, 0); RG_DEF_METHOD(run, 0); RG_DEF_METHOD(line, 0); RG_DEF_METHOD(char_extents, 0); RG_DEF_METHOD(cluster_extents, 0); RG_DEF_METHOD(run_extents, 0); RG_DEF_METHOD(line_yrange, 0); RG_DEF_METHOD(line_extents, 0); RG_DEF_METHOD(layout_extents, 0); } ruby-gnome2-all-2.2.5/pango/COPYING.LIB0000644000175000017500000006364212257552170015377 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/pango/lib/0000755000175000017500000000000012516441043014464 5ustar koukouruby-gnome2-all-2.2.5/pango/lib/pango.rb0000644000175000017500000000403712137115065016122 0ustar koukou# # pango.rb # Copyright(C) 2005, 2009 Ruby-GNOME2 Project. # # This program is licenced under the same # license of Ruby-GNOME2. # require 'glib2' begin begin require 'cairo' rescue LoadError require 'rubygems' require 'cairo' end rescue LoadError end base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/pango.so" rescue LoadError require "pango.so" end if vendor_dir.exist? begin require "gobject-introspection" vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) rescue LoadError end end module Pango LOG_DOMAIN = "Pango" class AttrList def each(text = nil) iter = iterator begin if text s, e = iter.range yield(iter, text[s, e - s], s, e) else yield(iter) end end while iter.next! end end # [[klass, prefix], ....]] targets = [[Layout::Alignment, "ALIGN_"], [AttrScale, "SCALE_"], [Coverage::Level, "COVERAGE_"], [Context::Direction, "DIRECTION_"], [Layout::WrapMode, "WRAP_"], [FontDescription::FontMask, "FONT_MASK_"], [FontDescription::Stretch, "STRETCH_"], [FontDescription::Style, "STYLE_"], [FontDescription::Variant, "VARIANT_"], [FontDescription::Weight, "WEIGHT_"], [TabArray::TabAlign, "TAB_"], [AttrUnderline::Underline, "UNDERLINE_"]] targets << [Script, "SCRIPT_"] if defined? Script targets << [Layout::EllipsizeMode, "ELLIPSIZE_"] if defined? Layout::EllipsizeMode targets << [Renderer::Part, "PART_"] if defined? Renderer::Part targets.each do |klass, prefix| (klass.constants - klass.superclass.constants).each do |name| unless klass.const_get(name).is_a? Class const_set("#{prefix}#{name}", klass.const_get(name)) end end end end GLib::Log.set_log_domain(Pango::LOG_DOMAIN) ruby-gnome2-all-2.2.5/pango/README0000644000175000017500000000152712257552170014611 0ustar koukouRuby/Pango ========== Ruby/Pango is a Ruby binding of pango-1.14.x. Requirements ------------ Ruby: http://www.ruby-lang.org/ GLib: http://www.gtk.org/ Pango: http://www.pango.org/ cairo/rcairo: http://cairographics.org/ (optional) Ruby/GLib2: http://ruby-gnome2.sourceforge.net/ Install ------- 0. install ruby-1.9.x or later, GLib, Pango-1.14.x or later, Ruby/GLib2, Ruby/GTK2 (and cairo/rcairo). 1. ruby extconf.rb (To use rcairo on Win32, set CAIRO_PATH as a environment variable first) 2. make 3. su 4. make install Copying ------- Copyright (c) 2002-2005 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/pango/sample/0000755000175000017500000000000012150300275015172 5ustar koukouruby-gnome2-all-2.2.5/pango/sample/label.rb0000644000175000017500000000101412150300275016572 0ustar koukou=begin label.rb - Ruby/Pango sample script. Copyright (c) 2002,2003 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: label.rb,v 1.4 2006/06/17 13:36:11 mutoh Exp $ =end require 'gtk2' str = File.read("sample.txt") attrs, text, accel_char = Pango.parse_markup(str, '$') #This is same as Gtk::Label#set_markup() label = Gtk::Label.new(text) label.attributes = attrs win = Gtk::Window.new win.signal_connect("destroy"){Gtk.main_quit} win.add(label).show_all Gtk.main ruby-gnome2-all-2.2.5/pango/sample/gdk_layout.rb0000644000175000017500000000116412150300275017663 0ustar koukou=begin gdk_layout.rb - Ruby/Pango sample script. Copyright (c) 2003-2006 Ruby-GNOME2 Project This program is licenced under the same licence as Ruby-GNOME2. $Id: gdk_layout.rb,v 1.7 2006/06/17 13:36:11 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Ruby/Pango sample") window.signal_connect("destroy"){Gtk.main_quit} window.realize gdkwin = window.window gc = Gdk::GC.new(gdkwin) layout = window.create_pango_layout layout.set_markup(File.read("sample.txt"), "$") window.signal_connect("expose_event") do gdkwin.draw_layout(gc, 10, 10, layout) end window.set_default_size(500,400).show_all Gtk.main ruby-gnome2-all-2.2.5/pango/sample/layout.rb0000644000175000017500000000462612150300275017044 0ustar koukou#!/usr/local/bin/ruby =begin layout.rb - Ruby/Pango sample script. Copyright (c) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: layout.rb,v 1.2 2006/06/17 13:36:11 mutoh Exp $ =end require 'gtk2' require 'pp' puts puts "Start----------" puts str = File.read("sample.txt") context = Gdk::Pango.context context.base_dir = Pango::Context::DIRECTION_LTR context.language = Pango::Language.new("ja_JP") fd = Pango::FontDescription.new("Sans 18") font = context.load_font(fd) font_map = context.font_map p "context: #{context}" p "font_desc: #{fd}" p "font: #{font}" p "font_map: #{font_map}" puts puts "Pango::Layout----------" puts p layout = Pango::Layout.new(context) layout.set_markup(str) layout.font_description = fd layout.auto_dir = true layout.alignment = Pango::Layout::ALIGN_LEFT p "attributes: #{layout.attributes}" p "font_description: #{layout.font_description}" p "width: #{layout.width}" p "wrap: #{layout.wrap}" p "ellipsize: #{layout.ellipsize}" p "indent: #{layout.indent}" p "spacing: #{layout.spacing}" p "justify?: #{layout.justify?}" p "auto_dir?: #{layout.auto_dir?}" p "alignment: #{layout.alignment.inspect}" p "tabs: #{layout.tabs}" p "single_paragraph_mode?: #{layout.single_paragraph_mode?}" p "size: #{layout.size}" p "pixel_size: #{layout.pixel_size}" p "line_count: #{layout.line_count}" puts "lines:" pp layout.lines puts puts "Pango::LayoutIter--------" puts iter = layout.iter p "iter: #{iter}" p "index: #{iter.index}" p "baseline: #{iter.baseline}" p "line: #{iter.line}" p "char_extents: #{iter.char_extents}" p "cluster_extents: #{iter.cluster_extents}" p "run_extents: #{iter.run_extents}" p "layout_extents: #{iter.layout_extents}" p "line_extents: #{iter.line_extents}" p "line_yrange: #{iter.line_yrange}" puts puts "Pango::GlyphItem-------" puts glyph = iter.run p "glyph: #{glyph}" p "item: #{glyph.item}" p "glyphs: #{glyph.glyphs}" puts puts "Pango::LayoutLine ----------" puts line = iter.line p "line = #{line}" p "extents: #{line.extents}" p "pixel_extents: #{line.pixel_extents}" p "index_to_x: #{line.index_to_x(1, true)}" p "x_to_index: #{line.x_to_index(1)}" p "x_ranges: #{line.get_x_ranges(0, 2)}" p "layout: #{line.layout}" p "start_index: #{line.start_index}" p "length: #{line.length}" p "paragraph_start?: #{line.paragraph_start?}" p "resolved_dir: #{line.resolved_dir}" puts "runs:" pp line.runs puts puts "End----------" ruby-gnome2-all-2.2.5/pango/sample/pango_cairo.rb0000644000175000017500000000325111701304107020000 0ustar koukou=begin cairo.rb - Ruby/Pango with cairo sample script. Copyright (c) 2005 Ruby-GNOME2 Project This program is licenced under the same licence as Ruby-GNOME2. $Id: pango_cairo.rb,v 1.1 2005/10/15 07:57:52 mutoh Exp $ =end require 'pango' unless Pango.cairo_available? STDERR.puts "This sample requires Pango 1.0.0 or later and cairo support" exit 1 end filename = ARGV.shift filename ||= "cairo.png" RADIUS = 150 N_WORDS = 10 FONT = "Sans Bold 27" def draw_text(cr) # Center coordinates on the middle of the region we are drawing cr.translate(RADIUS, RADIUS); # Create a PangoLayout, set the font and text layout = cr.create_pango_layout layout.set_text("Text") desc = Pango::FontDescription.new(FONT) layout.set_font_description(desc) # Draw the layout N_WORDS times in a circle N_WORDS.times do |i| angle = (360.0 * i) / N_WORDS; cr.save do # Gradient from red at angle == 60 to blue at angle == 300 red = (1 + Math.cos((angle - 60) * Math::PI / 180.0)) / 2 cr.set_source_rgb(red, 0, 1.0 - red) cr.rotate(angle * Math::PI / 180.0) # Inform Pango to re-layout the text with the new transformation cr.update_pango_layout(layout) width, height = layout.size cr.move_to(-(width.to_f / Pango::SCALE) / 2, -RADIUS) cr.show_pango_layout(layout) end end end diameter = 2 * RADIUS surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, diameter, diameter) cr = Cairo::Context.new(surface) cr.set_source_rgb(1.0, 1.0, 1.0) cr.rectangle(0, 0, diameter, diameter); cr.fill draw_text(cr) File.open(filename, "wb") do |f| cr.target.write_to_png(f) end # or # cr.target.write_to_png(filename) ruby-gnome2-all-2.2.5/pango/sample/parse.rb0000644000175000017500000000132712150300275016634 0ustar koukou#!/usr/bin/env ruby =begin parse.rb - Ruby/Pango sample script. Copyright (c) 2002,2003 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: parse.rb,v 1.4 2005/03/22 17:41:29 silicio Exp $ =end require 'pango' str = File.read("sample.txt") puts str puts "------" attr_list, text, accel_char = Pango.parse_markup(str, '$') puts "attr_list = #{attr_list}" puts "text = #{text}" puts "accel_char = #{accel_char}" puts "------" iterator = attr_list.iterator attr_list.each(text) do |iterator, text, start_pos, end_pos| puts "range = #{start_pos}, #{end_pos}" puts "text = #{text}" iterator.get.each do |attr| puts "#{attr} = #{attr.value}" end puts "---" end ruby-gnome2-all-2.2.5/pango/sample/attribute.rb0000644000175000017500000000342211701304107017522 0ustar koukou=begin attribute.rb - Ruby/Pango sample script. Copyright (c) 2002,2003 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: attribute.rb,v 1.6 2006/06/17 13:37:01 mutoh Exp $ =end require 'pango' p a = Pango::AttrSize.new(1) puts "value = #{a.value}" puts "start_index = #{a.start_index}" puts "end_index = #{a.end_index}" p a = Pango::AttrStyle.new(Pango::FontDescription::STYLE_NORMAL) puts "value = #{a.value}" p a = Pango::AttrVariant.new(Pango::FontDescription::VARIANT_SMALL_CAPS) puts "value = #{a.value}" p a = Pango::AttrStretch.new(Pango::FontDescription::STRETCH_EXPANDED) puts "value = #{a.value}" p a = Pango::AttrWeight.new(Pango::FontDescription::WEIGHT_BOLD) puts "value = #{a.value}" p a = Pango::AttrRise.new(10) puts "value = #{a.value}" p a = Pango::AttrLanguage.new(Pango::Language.new("ja")) p a.value p a.value.to_str p a = Pango::AttrFamily.new("family") p a.value p b = Pango::FontDescription.new p b.to_str p a = Pango::AttrFontDescription.new(b) p a.value p a.value.to_str p a = Pango::AttrForeground.new(10, 20, 30) p a.value p a.value.to_a p a = Pango::AttrBackground.new(20, 30, 40) p a.value p a.value.to_a p a = Pango::AttrStrikethrough.new(true) p a.value p Pango::AttrUnderline::SINGLE p a = Pango::AttrUnderline.new(Pango::AttrUnderline::SINGLE) p a.value p ink = Pango::Rectangle.new(1, 2, 3, 4) p log = Pango::Rectangle.new(5, 6, 7, 8) p a = Pango::AttrShape.new(ink, log) p a.value[0].to_a p a.value[1].to_a p a = Pango::AttrScale.new(2.3) p a.value begin require 'gtk2' rescue p "Ruby/GTK2 is not existed." exit 0 end p a = Gdk::PangoAttrEmbossed.new(true) p a.value mask = Gdk::Pixmap.new(Gtk::Window.new.realize.window, 100, 100, 1) p a = Gdk::PangoAttrStipple.new(mask) p a.value ruby-gnome2-all-2.2.5/pango/sample/sample.txt0000644000175000017500000000101411701304107017207 0ustar koukouHello World! こんにちわ世界! Ruby/Pango $Ruby-GNOME2 ABCDEF ruby-gnome2-all-2.2.5/pango/sample/glyphstring.rb0000755000175000017500000000263412150300275020101 0ustar koukou#!/usr/bin/env ruby =begin glyphstring.rb - Ruby/Pango sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: glyphstring.rb,v 1.3 2006/06/17 14:16:53 ktou Exp $ =end require 'gtk2' str = "Hello World" lang = Pango::Language.new("ja_JP") fd = Pango::FontDescription.new("Sans 18") context = Gdk::Pango.context context.language = lang context.base_dir = Pango::DIRECTION_LTR context.font_description = fd p font = context.load_font(fd) family = context.families[10] puts "#{family.class}, #{family.name}" family.faces.each do |face| puts face.name end p fmap = font.font_map p fset = fmap.load_fontset(context, fd, lang) gs = Pango::GlyphString.new ink_rect, logical_rect = gs.extents(font) p ink_rect.to_a p logical_rect.to_a item = Pango::Item.new item.analysis.font = font item.analysis.shape_engine = font.find_shaper(lang, str.codepoints.first) gs = Pango.shape(str, item.analysis) ink_rect, logical_rect = gs.extents(font, 0, 11) p ink_rect.to_a p logical_rect.to_a gs.glyphs.each do |info, log_clusters| puts "Pango::GlyphInfo: log_clusters = #{log_clusters}, glyph = #{info.glyph}, geometry = #{info.geometry.inspect}, cluster_start? = #{info.cluster_start?}" end p gs.index_to_x(str, item.analysis, 3, false) p gs.x_to_index(str, item.analysis, 103) p logical_widths = gs.get_logical_widths(str, item.analysis.level) ruby-gnome2-all-2.2.5/pango/sample/script.rb0000644000175000017500000000117212150300275017024 0ustar koukou# -*- coding: utf-8 -*- =begin script.rb - Ruby/Pango sample script. Copyright (c) 2005 Ruby-GNOME2 Project This program is licenced under the same licence as Ruby-GNOME2. $Id: script.rb,v 1.1 2005/09/17 17:09:12 mutoh Exp $ =end require 'pango' iter = Pango::ScriptIter.new("Helloこんにちはコンニチハ안녕하세요السلام عليكمΕλληνικάவணக்கம்") begin start_pos, end_pos, script = iter.range puts "-----" puts "start : #{start_pos}" puts "end : #{end_pos}" puts "script: #{script.nick}" puts "sample_language: #{script.sample_language.to_s}" end while iter.next! ruby-gnome2-all-2.2.5/pango/sample/item.rb0000644000175000017500000000200112150300275016446 0ustar koukou# -*- coding: utf-8 -*- =begin item.rb - Ruby/Pango sample script. Copyright (c) 2005 Ruby-GNOME2 Project This program is licenced under the same licence as Ruby-GNOME2. $Id: item.rb,v 1.3 2006/06/17 13:37:01 mutoh Exp $ =end require 'gtk2' str = "Ruby-GNOME2こんにちわ" win = Gtk::Window.new("Ruby/Pango sample") win.realize p screen = Gdk::Screen.default p context = Gdk::Pango.context(screen) p attrlist = Pango::AttrList.new p a = Pango::AttrBackground.new(65535, 0, 0) attrlist.insert(Pango::AttrBackground.new(65535, 0,0)) attrs = [Pango::AttrBackground.new(65535, 0,0), Pango::AttrForeground.new(65535, 0,0)] items = context.itemize(Pango::Context::DIRECTION_RTL, str, 0, 40, attrlist) items.each do |v| ana = v.analysis puts "shape_engine = #{ana.shape_engine}, lang_engine = #{ana.lang_engine}, font = #{ana.font}, level = #{ana.level}" puts "language = #{ana.language}" p ana.font.get_glyph_extents("a".codepoints.first)[0].to_a ana.set_extra_attrs(attrs) p ana.extra_attrs end ruby-gnome2-all-2.2.5/pango/sample/break.rb0000644000175000017500000000143412150300275016605 0ustar koukou# -*- coding: utf-8 -*- =begin break.rb - Ruby/Pango sample script. Copyright (c) 2005 Ruby-GNOME2 Project This program is licenced under the same licence as Ruby-GNOME2. $Id: break.rb,v 1.1 2005/09/17 17:09:12 mutoh Exp $ =end require 'pango' attr = Pango.break("Hello Worldです\n2nd line", Pango::Analysis.new) p attr.length attr.each do |v| print "line_break:#{v.line_break?}" print ", mandatory_break:#{v.mandatory_break?}" print ", char_break:#{v.char_break?}" print ", white:#{v.white?}" print ", cursor_position:#{v.cursor_position?}" print ", word_start:#{v.word_start?}" print ", word_end:#{v.word_end?}" print ", sentence_boundary:#{v.sentence_boundary?}" print ", sentence_start:#{v.sentence_start?}" print ", sentence_end:#{v.sentence_end?}\n" end ruby-gnome2-all-2.2.5/pango/patches/0000755000175000017500000000000012257552167015361 5ustar koukouruby-gnome2-all-2.2.5/pango/patches/pango-1.34.0-enable-fc-font.diff0000644000175000017500000000110212147676243022610 0ustar koukoudiff -ru pango-1.34.0.orig/pango/pangocairo.def pango-1.34.0/pango/pangocairo.def --- pango-1.34.0.orig/pango/pangocairo.def 2013-01-24 12:39:14.000000000 +0900 +++ pango-1.34.0/pango/pangocairo.def 2013-05-18 20:28:04.017761164 +0900 @@ -8,8 +8,8 @@ pango_cairo_create_context pango_cairo_create_layout pango_cairo_error_underline_path -; pango_cairo_fc_font_get_type -; pango_cairo_fc_font_map_get_type + pango_cairo_fc_font_get_type + pango_cairo_fc_font_map_get_type pango_cairo_font_get_type pango_cairo_font_get_scaled_font pango_cairo_font_map_create_context ruby-gnome2-all-2.2.5/run-test.rb0000755000175000017500000000224712516434313014732 0ustar koukou#!/usr/bin/env ruby # quick & dirty script for running all available tests for each module # Author: Joachim Glauche require "rbconfig" require "pathname" ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'] + RbConfig::CONFIG['EXEEXT']) # for creating a separating line def separator "-" * 80 end targets = [] includes = [] base_dir = Pathname(File.dirname(__FILE__)) Pathname.glob((base_dir + "*").to_s) do |dir| next unless dir.directory? dir = dir.expand_path ext_dir = dir + "ext" + dir.basename includes.concat(["-I", (dir + "lib").to_s, "-I", ext_dir.to_s]) next unless (dir + "test").directory? targets << dir end ignored_modules = [ "gstreamer-no-gi", "gdk3-no-gi", "gtk3-gi", ] succeeded = true targets.each do |target| next if ignored_modules.include?(target.basename.to_s) Dir.chdir(target.to_s) do puts "#{Time.now} running test for #{target}" puts separator args = includes + ["test/run-test.rb"] command = [ruby, *args] unless system(command.collect {|arg| "'#{arg.gsub(/'/, '\\\'')}'"}.join(' ')) succeeded = false end puts separator end end exit(succeeded) ruby-gnome2-all-2.2.5/rsvg2/0000755000175000017500000000000012516441043013655 5ustar koukouruby-gnome2-all-2.2.5/rsvg2/test/0000755000175000017500000000000012516434313014636 5ustar koukouruby-gnome2-all-2.2.5/rsvg2/test/rsvg2-test-utils.rb0000644000175000017500000000155112516434313020343 0ustar koukou# Copyright (C) 2014 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 require "test-unit" require "test/unit/notify" require "fileutils" module RSVG2TestUtils end ruby-gnome2-all-2.2.5/rsvg2/test/test-handle.rb0000644000175000017500000000520512516434313017375 0ustar koukou# Copyright (C) 2014 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 class TestHandle < Test::Unit::TestCase sub_test_case ".new_from_file" do sub_test_case "options" do def setup setup_svg end def setup_svg @svg_path = "tmp/empty.svg" return if File.exist?(@svg_path) FileUtils.mkdir_p(File.dirname(@svg_path)) File.open(@svg_path, "w") do |svg| svg.puts(<<-SVG) SVG end end def test_empty_options handle = RSVG::Handle.new_from_file(@svg_path, {}) assert_equal([0, 0, 0.0, 0.0], handle.dimensions.to_a) end end sub_test_case ":flags => :unlimited" do def setup setup_large_svg end def setup_large_svg @large_svg_path = "tmp/large-file.svg" return if File.exist?(@large_svg_path) FileUtils.mkdir_p(File.dirname(@large_svg_path)) large_byte = (10 * 1024 * 1024).to_i File.open(@large_svg_path, "w") do |svg| svg.puts(<<-SVG_HEADER) SVG_HEADER large_byte.times do svg.puts("\n") end svg.puts(<<-SVG_FOOTER) SVG_FOOTER end end def test_no_option assert_raise(RSVG::Error::Failed) do RSVG::Handle.new_from_file(@large_svg_path) end end def test_unlimited handle = RSVG::Handle.new_from_file(@large_svg_path, :flags => :flag_unlimited) assert_equal([0, 0, 0.0, 0.0], handle.dimensions.to_a) end def test_base_uri handle = RSVG::Handle.new uri_string = "test_base_uri" handle.base_uri = uri_string assert_match(uri_string, handle.base_uri) end end end end ruby-gnome2-all-2.2.5/rsvg2/test/run-test.rb0000755000175000017500000000325612446160551016757 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2014 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gdk_pixbuf2_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") rsvg2_base = File.join(ruby_gnome2_base, "rsvg2") have_make = system("which make > /dev/null") modules = [ [glib_base, "glib2"], [gdk_pixbuf2_base, "gdk_pixbuf2"], [rsvg2_base, "rsvg2"], ] modules.each do |target, module_name| if File.exist?(File.join(target, "Makefile")) and have_make `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(rsvg2_base, "test")) require "rsvg2-test-utils" require "rsvg2" exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/rsvg2/extconf.rb0000644000175000017500000000222411701304107015642 0ustar koukou#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "rsvg2" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ruby-gnome2-all-2.2.5/rsvg2/Rakefile0000644000175000017500000000411212446235712015326 0ustar koukou# -*- ruby -*- # # Copyright (C) 2010-2013 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 $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2-raketask' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/RSVG is a Ruby binding of librsvg-2.x." package.description = "Ruby/RSVG is a Ruby binding of librsvg-2.x." package.dependency.gem.runtime = [["cairo", ">= 1.12.8"], "gdk_pixbuf2"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "gobject-introspection", "pango", "gdk_pixbuf2", ] package.windows.gobject_introspection_dependencies = [ "gdk_pixbuf2", ] package.external_packages = [ { :name => "libcroco", :download_site => :gnome, :label => "libcroco", :version => "0.6.8", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :built_file => "bin/libcroco-0.6-3.dll", }, }, { :name => "librsvg", :download_site => :gnome, :label => "librsvg", :version => "2.40.6", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :patches => [ ], :built_file => "bin/librsvg-2-2.dll", }, }, ] end package_task.define ruby-gnome2-all-2.2.5/rsvg2/ext/0000755000175000017500000000000011701304107014447 5ustar koukouruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/0000755000175000017500000000000012516434313015522 5ustar koukouruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/rsvg2.h0000644000175000017500000000401012516434313016731 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 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 */ #ifndef RSVG2_H #define RSVG2_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include #include #include #ifdef HAVE_LIBRSVG_RSVG_GZ_H # include #else # include #endif #ifdef HAVE_RB_CAIRO_H # include # include #endif #ifdef HAVE_LIBRSVG_LIBRSVG_ENUM_TYPES_H # include #else # include "librsvg-enum-types.h" #endif #define LIBRSVG_CHECK_VERSION(major, minor, micro) \ (LIBRSVG_MAJOR_VERSION > (major) || \ (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION > (minor)) || \ (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && \ LIBRSVG_MICRO_VERSION >= (micro))) #if !LIBRSVG_CHECK_VERSION(2, 36, 2) # include #endif G_GNUC_INTERNAL void Init_rsvg_handle(VALUE mRSVG); G_GNUC_INTERNAL void Init_rsvg_dimensiondata(VALUE mRSVG); #ifdef __cplusplus } #endif #endif ruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/extconf.rb0000644000175000017500000000520412516434313017516 0ustar koukou=begin extconf.rb for Ruby/RSVG extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "rsvg2" package_id = "librsvg-2.0" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ["glib2", "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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "librsvg2-dev", :redhat => "librsvg2-devel", :homebrew => "librsvg", :macports => "librsvg") exit(false) end rsvg_header = "librsvg/rsvg.h" have_func("rsvg_set_default_dpi", rsvg_header) have_func("rsvg_set_default_dpi_x_y", rsvg_header) have_func("rsvg_handle_set_dpi", rsvg_header) have_func("rsvg_handle_set_dpi_x_y", rsvg_header) have_func("rsvg_handle_get_metadata", rsvg_header) have_func("rsvg_handle_free", rsvg_header) have_func("rsvg_handle_get_pixbuf_sub", rsvg_header) have_header("librsvg/rsvg-gz.h") have_type("RsvgDimensionData", "librsvg/rsvg.h") have_header("librsvg/rsvg-cairo.h") create_pkg_config_file("Ruby/RSVG", package_id, nil, "ruby-rsvg2.pc") $defs << " -DRUBY_RSVG2_COMPILATION" enum_type_prefix = "librsvg-enum-types" unless have_header("librsvg/#{enum_type_prefix}.h") include_paths = PKGConfig.cflags_only_I("librsvg-2.0") include_path = include_paths.split.find do |x| /librsvg/.match(x) end.sub(/^-I/, "") headers = Dir.glob(File.join(include_path, "librsvg", "*.h")) glib_mkenums(enum_type_prefix, headers, "RSVG_TYPE_", ["librsvg/rsvg.h"]) end 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 ruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/depend0000644000175000017500000000024512064346475016716 0ustar koukouinstall: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-rsvg2.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/rbrsvghandle.c0000644000175000017500000003177712516434313020366 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 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 "rsvg2.h" #define RG_TARGET_NAMESPACE cHandle #ifdef RSVG_TYPE_HANDLE # define _SELF(self) (RSVG_HANDLE(RVAL2GOBJ(self))) #else # define _SELF(self) ((RsvgHandle *)DATA_PTR(self)) #endif static VALUE RG_TARGET_NAMESPACE; static ID id_call; static ID id_callback; static ID id_closed; static void exec_callback(gint *width, gint *height, gpointer self) { VALUE result; result = rb_funcall(rb_ivar_get((VALUE)self, id_callback), id_call, 2, INT2NUM(*width), INT2NUM(*height)); if (T_ARRAY == TYPE(result)) { VALUE w, h; w = rb_ary_entry(result, 0); h = rb_ary_entry(result, 1); if (!NIL_P(w)) { *width = NUM2INT(w); } if (!NIL_P(h)) { *height = NUM2INT(h); } } } static VALUE rg_set_dpi(VALUE self, VALUE dpi) { #ifdef HAVE_RSVG_HANDLE_SET_DPI rsvg_handle_set_dpi(_SELF(self), NUM2DBL(dpi)); #else rb_warning("rsvg_handle_set_dpi isn't supported in your librsvg"); #endif return self; } static VALUE rg_set_dpi_x_y(VALUE self, VALUE dpi_x, VALUE dpi_y) { #ifdef HAVE_RSVG_HANDLE_SET_DPI_X_Y rsvg_handle_set_dpi_x_y(_SELF(self), NUM2DBL(dpi_x), NUM2DBL(dpi_y)); #else rb_warning("rsvg_handle_set_dpi_x_y isn't supported in your librsvg"); #endif return self; } #ifndef RSVG_TYPE_HANDLE static void rb_rsvg_handle_free(RsvgHandle *handle) { if (handle) { rsvg_handle_free(handle); } } static VALUE rb_rsvg_handle_alloc(VALUE klass) { return Data_Wrap_Struct(klass, 0, rb_rsvg_handle_free, 0); } #endif #if LIBRSVG_CHECK_VERSION(2, 14, 0) static VALUE rg_s_new_from_data(G_GNUC_UNUSED VALUE self, VALUE data) { GError *error = NULL; RsvgHandle *handle; handle = rsvg_handle_new_from_data((const guint8 *)RVAL2CSTR(data), RSTRING_LEN(data), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(handle); } static VALUE rg_s_new_from_file(int argc, VALUE *argv, VALUE self) { VALUE rb_file_path, rb_options, rb_flags; GError *error = NULL; RsvgHandle *handle; rb_scan_args(argc, argv, "11", &rb_file_path, &rb_options); rbg_scan_options(rb_options, "flags", &rb_flags, NULL); #if LIBRSVG_CHECK_VERSION(2, 40, 3) { GFile *file; GCancellable *cancellable = NULL; RsvgHandleFlags flags = RSVG_HANDLE_FLAGS_NONE; if (!NIL_P(rb_flags)) { flags = RVAL2GFLAGS(rb_flags, RSVG_TYPE_HANDLE_FLAGS); } file = g_file_new_for_path((const char *)RVAL2CSTR(rb_file_path)); handle = rsvg_handle_new_from_gfile_sync(file, flags, cancellable, &error); g_object_unref(file); } #else if (!NIL_P(rb_flags)) { rb_raise(rb_eArgError, "librsvg 2.40.3 or later is required for :flags: <%d.%d.%d>", LIBRSVG_MAJOR_VERSION, LIBRSVG_MINOR_VERSION, LIBRSVG_MICRO_VERSION); } handle = rsvg_handle_new_from_file((const gchar *)RVAL2CSTR(rb_file_path), &error); #endif if (error) RAISE_GERROR(error); return GOBJ2RVAL(handle); } #endif static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { RsvgHandle *handle; VALUE gz; rb_scan_args(argc, argv, "01", &gz); #if LIBRSVG_CHECK_VERSION(2, 11, 0) handle = rsvg_handle_new(); #else if (RVAL2CBOOL(gz)) { # ifdef HAVE_LIBRSVG_RSVG_GZ_H handle = rsvg_handle_new_gz(); # else rb_warning("gz handling is not supported in your librsvg"); handle = rsvg_handle_new(); # endif } else { handle = rsvg_handle_new(); } #endif #ifdef RSVG_TYPE_HANDLE G_INITIALIZE(self, handle); #else DATA_PTR(self) = handle; #endif rb_ivar_set(self, id_closed, Qfalse); return Qnil; } static VALUE rg_set_size_callback(VALUE self) { rb_ivar_set(self, id_callback, rb_block_proc()); rsvg_handle_set_size_callback(_SELF(self), exec_callback, (gpointer)self, NULL); return self; } static VALUE rg_write(VALUE self, VALUE buf) { gboolean result; GError *error = NULL; result = rsvg_handle_write(_SELF(self), (const guchar*)RVAL2CSTR(buf), RSTRING_LEN(buf), &error); if (!result) RAISE_GERROR(error); return CBOOL2RVAL(result); } static VALUE rg_close(VALUE self) { gboolean result; GError *error = NULL; if (RVAL2CBOOL(rb_ivar_get(self, id_closed))) { return Qnil; } result = rsvg_handle_close(_SELF(self), &error); if (result) { rb_ivar_set(self, id_closed, Qtrue); } else { RAISE_GERROR(error); } return CBOOL2RVAL(result); } static VALUE rg_closed_p(VALUE self) { return rb_ivar_get(self, id_closed); } static VALUE rg_pixbuf(int argc, VALUE *argv, VALUE self) { VALUE id; VALUE rb_pixbuf; GdkPixbuf *pixbuf = NULL; rb_scan_args(argc, argv, "01", &id); if (NIL_P(id)) { pixbuf = rsvg_handle_get_pixbuf(_SELF(self)); } else { #ifdef HAVE_RSVG_HANDLE_GET_PIXBUF_SUB pixbuf = rsvg_handle_get_pixbuf_sub(_SELF(self), (const char *)RVAL2CSTR(id)); #else rb_warning("rsvg_handle_get_pixbuf_sub isn't " "supported in your librsvg"); #endif } rb_pixbuf = GOBJ2RVAL(pixbuf); if (pixbuf) g_object_unref(pixbuf); return rb_pixbuf; } #ifdef HAVE_TYPE_RSVGDIMENSIONDATA static VALUE rg_dimensions(VALUE self) { RsvgDimensionData dim; VALUE args[4]; VALUE cDimensionData = rb_const_get(rb_const_get(rb_cObject, rb_intern("RSVG")), rb_intern("DimensionData")); rsvg_handle_get_dimensions(_SELF(self), &dim); args[0] = INT2NUM(dim.width); args[1] = INT2NUM(dim.height); args[2] = rb_float_new(dim.em); args[3] = rb_float_new(dim.ex); return rb_class_new_instance(sizeof(args) / sizeof(VALUE), args, cDimensionData); } #endif #if !LIBRSVG_CHECK_VERSION(2, 36, 0) /* Accessibility API */ static VALUE rg_title(VALUE self) { return CSTR2RVAL(rsvg_handle_get_title(_SELF(self))); } static VALUE rg_desc(VALUE self) { return CSTR2RVAL(rsvg_handle_get_desc(_SELF(self))); } # ifdef HAVE_RSVG_HANDLE_GET_METADATA static VALUE rg_metadata(VALUE self) { return CSTR2RVAL(rsvg_handle_get_metadata(_SELF(self))); } # endif #endif #if !LIBRSVG_CHECK_VERSION(2, 11, 0) /* Extended Convenience API */ static VALUE rg_pixbuf_from_file_at_size(VALUE self, VALUE file_name, VALUE width, VALUE height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_size_ex(_SELF(self), RVAL2CSTR(file_name), NUM2INT(width), NUM2INT(height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_pixbuf_from_file(VALUE self, VALUE file_name) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_ex(_SELF(self), RVAL2CSTR(file_name), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_pixbuf_from_file_at_zoom(VALUE self, VALUE file_name, VALUE x_zoom, VALUE y_zoom) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_zoom_ex(_SELF(self), RVAL2CSTR(file_name), NUM2DBL(x_zoom), NUM2DBL(y_zoom), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_pixbuf_from_file_at_max_size(VALUE self, VALUE file_name, VALUE max_width, VALUE max_height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_max_size_ex(_SELF(self), RVAL2CSTR(file_name), NUM2INT(max_width), NUM2INT(max_height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_pixbuf_from_file_at_zoom_with_max(VALUE self, VALUE file_name, VALUE x_zoom, VALUE y_zoom, VALUE max_width, VALUE max_height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max_ex(_SELF(self), RVAL2CSTR(file_name), NUM2DBL(x_zoom), NUM2DBL(y_zoom), NUM2INT(max_width), NUM2INT(max_height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } #endif #ifdef HAVE_LIBRSVG_RSVG_CAIRO_H static VALUE rg_render_cairo(int argc, VALUE *argv, VALUE self) { VALUE cr, id; rb_scan_args(argc, argv, "11", &cr, &id); if (NIL_P(id)) { rsvg_handle_render_cairo( _SELF(self), RVAL2CRCONTEXT(cr)); } else { rsvg_handle_render_cairo_sub( _SELF(self), RVAL2CRCONTEXT(cr), (const char *)RVAL2CSTR(id)); } return Qnil; } #endif void Init_rsvg_handle(VALUE mRSVG) { id_call = rb_intern("call"); id_callback = rb_intern("callback"); id_closed = rb_intern("closed"); #ifdef RSVG_TYPE_HANDLE RG_TARGET_NAMESPACE = G_DEF_CLASS(RSVG_TYPE_HANDLE, "Handle", mRSVG); #else RG_TARGET_NAMESPACE = rb_define_class_under(mRSVG, "Handle", rb_cObject); rb_define_alloc_func(RG_TARGET_NAMESPACE, rb_rsvg_handle_alloc); #endif #if LIBRSVG_CHECK_VERSION(2, 14, 0) RG_DEF_SMETHOD(new_from_data, 1); RG_DEF_SMETHOD(new_from_file, -1); #endif RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_size_callback, 0); RG_DEF_METHOD(set_dpi, 1); RG_DEF_METHOD(set_dpi_x_y, 2); RG_DEF_METHOD(write, 1); RG_DEF_METHOD(close, 0); RG_DEF_METHOD_P(closed, 0); RG_DEF_METHOD(pixbuf, -1); #ifdef HAVE_TYPE_RSVGDIMENSIONDATA RG_DEF_METHOD(dimensions, 0); #endif #if !LIBRSVG_CHECK_VERSION(2, 36, 0) /* Accessibility API */ RG_DEF_METHOD(title, 0); RG_DEF_METHOD(desc, 0); # ifdef HAVE_RSVG_HANDLE_GET_METADATA RG_DEF_METHOD(metadata, 0); # endif #endif #if !LIBRSVG_CHECK_VERSION(2, 11, 0) /* Extended Convenience API */ RG_DEF_METHOD(pixbuf_from_file_at_size, 3); RG_DEF_METHOD(pixbuf_from_file, 1); RG_DEF_METHOD(pixbuf_from_file_at_zoom, 3); RG_DEF_METHOD(pixbuf_from_file_at_max_size, 3); RG_DEF_METHOD(pixbuf_from_file_at_zoom_with_max, 5); #endif #ifdef HAVE_LIBRSVG_RSVG_CAIRO_H RG_DEF_METHOD(render_cairo, -1); #endif #if LIBRSVG_CHECK_VERSION(2, 40, 3) /* RsvgHandleFlags */ G_DEF_CLASS(RSVG_TYPE_HANDLE_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, RSVG_TYPE_HANDLE_FLAGS, "RSVG_HANDLE_"); #endif } ruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/rsvg2.def0000644000175000017500000000002711701304107017234 0ustar koukouEXPORTS Init_rsvg2 ruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/rbrsvg.c0000644000175000017500000001432512516434313017200 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 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 "rsvg2.h" #define RG_TARGET_NAMESPACE mRSVG #define RBRSVG_MAJOR_VERSION RBGLIB_MAJOR_VERSION #define RBRSVG_MINOR_VERSION RBGLIB_MINOR_VERSION #define RBRSVG_MICRO_VERSION RBGLIB_MICRO_VERSION void Init_rsvg2(void); static VALUE rg_s_set_default_dpi(VALUE self, VALUE dpi) { #ifdef HAVE_RSVG_SET_DEFAULT_DPI rsvg_set_default_dpi(NUM2DBL(dpi)); #else rb_warning("rsvg_set_default_dpi isn't supported in your librsvg"); #endif return self; } static VALUE rg_s_set_default_dpi_x_y(VALUE self, VALUE dpi_x, VALUE dpi_y) { #ifdef HAVE_RSVG_SET_DEFAULT_DPI_X_Y rsvg_set_default_dpi_x_y(NUM2DBL(dpi_x), NUM2DBL(dpi_y)); #else rb_warning("rsvg_set_default_dpi_x_y isn't supported in your librsvg"); #endif return self; } /* Convenience API */ static VALUE rg_s_pixbuf_from_file(G_GNUC_UNUSED VALUE self, VALUE file_name) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file(RVAL2CSTR(file_name), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_s_pixbuf_from_file_at_zoom(G_GNUC_UNUSED VALUE self, VALUE file_name, VALUE x_zoom, VALUE y_zoom) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_zoom(RVAL2CSTR(file_name), NUM2DBL(x_zoom), NUM2DBL(y_zoom), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_s_pixbuf_from_file_at_size(G_GNUC_UNUSED VALUE self, VALUE file_name, VALUE width, VALUE height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_size(RVAL2CSTR(file_name), NUM2INT(width), NUM2INT(height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_s_pixbuf_from_file_at_max_size(G_GNUC_UNUSED VALUE self, VALUE file_name, VALUE max_width, VALUE max_height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_max_size(RVAL2CSTR(file_name), NUM2INT(max_width), NUM2INT(max_height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_s_pixbuf_from_file_at_zoom_with_max(G_GNUC_UNUSED VALUE self, VALUE file_name, VALUE x_zoom, VALUE y_zoom, VALUE max_width, VALUE max_height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max(RVAL2CSTR(file_name), NUM2DBL(x_zoom), NUM2DBL(y_zoom), NUM2INT(max_width), NUM2INT(max_height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } static VALUE rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self) { #ifdef HAVE_LIBRSVG_RSVG_CAIRO_H return Qtrue; #else return Qfalse; #endif } void Init_rsvg2(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module("RSVG"); #if LIBRSVG_CHECK_VERSION(2, 9, 0) rsvg_init(); atexit(rsvg_term); #endif G_DEF_ERROR(RSVG_ERROR, "Error", RG_TARGET_NAMESPACE, rb_eRuntimeError, RSVG_TYPE_ERROR); rb_define_const(RG_TARGET_NAMESPACE, "BINDING_VERSION", rb_ary_new3(3, INT2FIX(RBRSVG_MAJOR_VERSION), INT2FIX(RBRSVG_MINOR_VERSION), INT2FIX(RBRSVG_MICRO_VERSION))); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(LIBRSVG_MAJOR_VERSION), INT2FIX(LIBRSVG_MINOR_VERSION), INT2FIX(LIBRSVG_MICRO_VERSION))); RG_DEF_SMETHOD(set_default_dpi, 1); RG_DEF_SMETHOD(set_default_dpi_x_y, 2); /* Convenience API */ RG_DEF_SMETHOD(pixbuf_from_file, 1); RG_DEF_SMETHOD(pixbuf_from_file_at_zoom, 3); RG_DEF_SMETHOD(pixbuf_from_file_at_size, 3); RG_DEF_SMETHOD(pixbuf_from_file_at_max_size, 3); RG_DEF_SMETHOD(pixbuf_from_file_at_zoom_with_max, 5); RG_DEF_SMETHOD_P(cairo_available, 0); Init_rsvg_handle(RG_TARGET_NAMESPACE); Init_rsvg_dimensiondata(RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/rsvg2/ext/rsvg2/rbrsvgdimensiondata.c0000664000175000017500000001046411740310343021734 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 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 "rsvg2.h" #ifdef HAVE_TYPE_RSVGDIMENSIONDATA #define RG_TARGET_NAMESPACE cDimensionData #define RVAL2DIM(obj) ((RsvgDimensionData *)DATA_PTR(obj)) static VALUE RG_TARGET_NAMESPACE; static ID id_closed; static ID id_to_s; static VALUE to_s(VALUE obj) { return rb_funcall(obj, id_to_s, 0); } static void rb_rsvg_dim_free(RsvgDimensionData *dimp) { if (dimp) { free(dimp); } } static VALUE rb_rsvg_dim_alloc(VALUE klass) { RsvgDimensionData *dimp; return Data_Make_Struct(klass, RsvgDimensionData, 0, rb_rsvg_dim_free, dimp); } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE width, height, em, ex; RsvgDimensionData *dimp; dimp = RVAL2DIM(self); rb_scan_args(argc, argv, "04", &width, &height, &em, &ex); if (!NIL_P(width)) dimp->width = NUM2INT(width); if (!NIL_P(height)) dimp->height = NUM2INT(height); if (!NIL_P(em)) dimp->em = NUM2DBL(em); if (!NIL_P(ex)) dimp->ex = NUM2DBL(ex); return Qnil; } static VALUE rg_width(VALUE self) { return INT2NUM(RVAL2DIM(self)->width); } static VALUE rg_set_width(VALUE self, VALUE width) { RVAL2DIM(self)->width = NUM2INT(width); return Qnil; } static VALUE rg_height(VALUE self) { return INT2NUM(RVAL2DIM(self)->height); } static VALUE rg_set_height(VALUE self, VALUE height) { RVAL2DIM(self)->height = NUM2INT(height); return Qnil; } static VALUE rg_em(VALUE self) { return rb_float_new(RVAL2DIM(self)->em); } static VALUE rg_set_em(VALUE self, VALUE em) { RVAL2DIM(self)->em = NUM2DBL(em); return Qnil; } static VALUE rg_ex(VALUE self) { return rb_float_new(RVAL2DIM(self)->ex); } static VALUE rg_set_ex(VALUE self, VALUE ex) { RVAL2DIM(self)->ex = NUM2DBL(ex); return Qnil; } static VALUE rg_to_a(VALUE self) { return rb_ary_new3(4, rg_width(self), rg_height(self), rg_em(self), rg_ex(self)); } static VALUE rg_to_s(VALUE self) { VALUE ret; ret = rb_str_new2("#<"); rb_str_cat2(ret, rb_obj_classname(self)); rb_str_cat2(ret, ":"); rb_str_concat(ret, rb_funcall(INT2NUM(self), id_to_s, 0)); rb_str_cat2(ret, " "); rb_str_cat2(ret, "width="); rb_str_concat(ret, to_s(rg_width(self))); rb_str_cat2(ret, ", "); rb_str_cat2(ret, "height="); rb_str_concat(ret, to_s(rg_height(self))); rb_str_cat2(ret, ", "); rb_str_cat2(ret, "em="); rb_str_concat(ret, to_s(rg_em(self))); rb_str_cat2(ret, ", "); rb_str_cat2(ret, "ex="); rb_str_concat(ret, to_s(rg_ex(self))); rb_str_cat2(ret, ">"); return ret; } #endif void Init_rsvg_dimensiondata(VALUE mRSVG) { #ifdef HAVE_TYPE_RSVGDIMENSIONDATA id_closed = rb_intern("closed"); id_to_s = rb_intern("to_s"); RG_TARGET_NAMESPACE = rb_define_class_under(mRSVG, "DimensionData", rb_cObject); rb_define_alloc_func(RG_TARGET_NAMESPACE, rb_rsvg_dim_alloc); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(width, 0); RG_DEF_METHOD(set_width, 1); RG_DEF_METHOD(height, 0); RG_DEF_METHOD(set_height, 1); RG_DEF_METHOD(em, 0); RG_DEF_METHOD(set_em, 1); RG_DEF_METHOD(ex, 0); RG_DEF_METHOD(set_ex, 1); RG_DEF_METHOD(to_s, 0); RG_DEF_METHOD(to_a, 0); RG_DEF_ALIAS("to_ary", "to_a"); #endif } ruby-gnome2-all-2.2.5/rsvg2/COPYING.LIB0000644000175000017500000006364212257552170015336 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/rsvg2/lib/0000755000175000017500000000000012516434313014425 5ustar koukouruby-gnome2-all-2.2.5/rsvg2/lib/rsvg2.rb0000644000175000017500000000124212516434313016014 0ustar koukourequire "glib2" require "gdk_pixbuf2" begin require "cairo" rescue LoadError end base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, micro, = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/rsvg2.so" rescue LoadError require "rsvg2.so" end module RSVG LOG_DOMAIN = "librsvg" end if RSVG.cairo_available? module Cairo class Context def render_rsvg_handle(handle, *args, &block) handle.render_cairo(self, *args, &block) end end end end GLib::Log.set_log_domain(RSVG::LOG_DOMAIN) ruby-gnome2-all-2.2.5/rsvg2/README0000644000175000017500000000136511701304107014534 0ustar koukouRuby/RSVG ========= Ruby/RSVG is a Ruby binding of librsvg. Requirements ------------ Ruby: http://www.ruby-lang.org/ librsvg [*]: http://librsvg.sourceforge.net/ Ruby/GLib2: http://ruby-gnome2.sourceforge.net/ Ruby/GdkPixbuf2: http://ruby-gnome2.sourceforge.net/ [*]: 2.8 or later is requried. Install ------- 0. install ruby and librsvg. 1. ruby extconf.rb 2. make 3. su 4. make install Copying ------- Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/rsvg2/sample/0000755000175000017500000000000011701304107015130 5ustar koukouruby-gnome2-all-2.2.5/rsvg2/sample/svg-viewer.rb0000755000175000017500000000155011701304107017557 0ustar koukou#!/usr/bin/env ruby require 'gtk2' require 'rsvg2' unless RSVG.cairo_available? puts "this sample needs RSVG with cairo support" exit(-1) end unless Gdk.cairo_available? puts "this sample needs GDK with cairo support" exit(-1) end if ARGV.size != 1 puts "usage: #{$0} input.svg" exit(-1) end input = ARGV.shift handle = RSVG::Handle.new_from_file(input) width, height = handle.dimensions.to_a window = Gtk::Window.new window.set_default_size(width, height) area = Gtk::DrawingArea.new window.signal_connect("destroy") do Gtk.main_quit end area.signal_connect("expose_event") do |widget, event| context = widget.window.create_cairo_context window_width, window_height = widget.window.size context.scale(window_width.to_f / width, window_height.to_f / height) context.render_rsvg_handle(handle) end window.add(area) window.show_all Gtk.main ruby-gnome2-all-2.2.5/rsvg2/sample/svg2.rb0000644000175000017500000000263511701304107016344 0ustar koukou#!/usr/bin/env ruby =begin svg2.rb - Ruby/RSVG sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: svg2.rb,v 1.5 2006/06/17 13:30:25 mutoh Exp $ =end require 'tempfile' require "rsvg2" if ARGV.size < 2 puts "usage: #{$0} input.svg output [scale_ratio]" exit(-1) end input, output, ratio = ARGV ratio ||= 1.0 ratio = ratio.to_f output_type = File.extname(output)[1..-1].downcase output_type = "jpeg" if /jpg/ =~ output_type def to_pixbuf_with_cairo(input, ratio) handle = nil Dir.chdir(File.dirname(File.expand_path(input))) do handle = RSVG::Handle.new_from_file(input) end dim = handle.dimensions width = dim.width * ratio height = dim.height * ratio surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height) cr = Cairo::Context.new(surface) cr.scale(ratio, ratio) cr.render_rsvg_handle(handle) temp = Tempfile.new("svg2") cr.target.write_to_png(temp.path) cr.target.finish Gdk::Pixbuf.new(temp.path) end def to_pixbuf(input, ratio) RSVG.pixbuf_from_file_at_zoom(input, ratio, ratio) end if RSVG.cairo_available? puts "using cairo..." pixbuf = to_pixbuf_with_cairo(input, ratio) else pixbuf = to_pixbuf(input, ratio) end if pixbuf.nil? puts "Is it a SVG file?: #{input}" exit(-1) end puts "saving to #{output}(#{pixbuf.width}x#{pixbuf.height})..." pixbuf.save(output, output_type) ruby-gnome2-all-2.2.5/gdk3/0000755000175000017500000000000012516441042013441 5ustar koukouruby-gnome2-all-2.2.5/gdk3/test/0000755000175000017500000000000012516434313014423 5ustar koukouruby-gnome2-all-2.2.5/gdk3/test/test-gdk-window-attr.rb0000644000175000017500000000232512446160551020753 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013-2014 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 class TestGdkWindowAttr < Test::Unit::TestCase include GdkTestUtils def test_initialize attrs = Gdk::WindowAttr.new(100, 100, :input_only, :temp) assert_equal([ 100, 100, Gdk::WindowWindowClass::INPUT_ONLY, Gdk::WindowType::TEMP, ], [attrs.width, attrs.height, attrs.wclass, attrs.window_type]) end end ruby-gnome2-all-2.2.5/gdk3/test/run-test.rb0000755000175000017500000000401412416346617016543 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2013-2014 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") gdk3_base = File.join(ruby_gnome2_base, "gdk3") [ [glib_base, "glib2"], [atk_base, "atk"], [cairo_gobject_base, "cairo-gobject"], [pango_base, "pango"], [gdk_pixbuf_base, "gdk_pixbuf2"], [gobject_introspection_base, "gobject-introspection"] ].each do |target, module_name| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(gdk3_base, "lib")) $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(gdk3_base, "test")) require "gdk-test-utils" require "gdk3" Gdk.init Gdk.init_check([$0]) exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-cairo.rb0000644000175000017500000000427712446160551017601 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2014 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 require "stringio" class TestGdkCairo < Test::Unit::TestCase def setup output = StringIO.new surface = Cairo::PDFSurface.new(output, 10, 10) @context = Cairo::Context.new(surface) end def test_set_source_color color = Gdk::Color.new(0xffff, 0x0000, 0xffff) @context.source_color = color assert_equal(Cairo::Color::RGB.new(1.0, 0.0, 1.0), @context.source.color) end sub_test_case "#set_source_rgba" do sub_test_case "RGBA" do def test_rgba rgba = Gdk::RGBA.new(0.1, 0.2, 0.3, 0.4) @context.source_rgba = rgba assert_equal(Cairo::Color::RGB.new(0.1, 0.2, 0.3, 0.4), @context.source.color) end def test_values @context.set_source_rgba(0.1, 0.2, 0.3, 0.4) assert_equal([0.1, 0.2, 0.3, 0.4], @context.source.rgba) end def test_array @context.set_source_rgba([0.1, 0.2, 0.3, 0.4]) assert_equal([0.1, 0.2, 0.3, 0.4], @context.source.rgba) end end sub_test_case "RGB" do def test_values @context.set_source_rgb(0.1, 0.2, 0.3) assert_equal([0.1, 0.2, 0.3, 1.0], @context.source.rgba) end def test_array @context.set_source_rgb([0.1, 0.2, 0.3]) assert_equal([0.1, 0.2, 0.3, 1.0], @context.source.rgba) end end end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-color.rb0000644000175000017500000000323212446160551017610 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGdkColor < Test::Unit::TestCase sub_test_case ".parse" do def test_invalid_spec spec = "fff" message = "Invalid color spec: <#{spec.inspect}>: " message << "Color spec must be one of them: " message << "\"\#rgb\", " message << "\"\#rrggbb\", " message << "\"\#rrggbb\", " message << "\"\#rrrgggbbb\", " message << "\"\#rrrrggggbbbb\", " message << "\"\#fff\", " message << "\"\#ffffff\", " message << "\"\#fffffffff\", " message << "\"\#fffffffffffff\"" assert_raise(ArgumentError.new(message)) do Gdk::Color.parse(spec) end end def test_valid color = Gdk::Color.parse("#abc") assert_equal("#aaaabbbbcccc", color.to_s) end end def test_to_s color = Gdk::Color.new(0xffff, 0x1234, 0xabcd) assert_equal("#ffff1234abcd", color.to_s) end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-event-type.rb0000644000175000017500000000200712416346617020577 0ustar koukou# Copyright (C) 2014 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 class TestGdkEventType < Test::Unit::TestCase def test_2button_press assert_equal("2button-press", Gdk::EventType::BUTTON2_PRESS.nick) end def test_3button_press assert_equal("3button-press", Gdk::EventType::BUTTON3_PRESS.nick) end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-event.rb0000644000175000017500000003237512416346617017633 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013-2014 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 class TestGdkEvent < Test::Unit::TestCase class TestConstant < self def test_propagate assert_false(Gdk::Event::PROPAGATE) end def test_stop assert_true(Gdk::Event::STOP) end end module TestAnyMethods def test_window assert_nil(event.window) attributes = Gdk::WindowAttr.new(100, 100, :input_only, :temp) window = Gdk::Window.new(nil, attributes, 0) event.window = window assert_equal(window, event.window) end def test_send_event? assert_false(event.send_event?) end end class TestAny < self include TestAnyMethods def setup @event = Gdk::EventAny.new(:delete) end def event @event end def test_delete assert_equal("GDK_DELETE", Gdk::EventAny.new(:delete).type.name) end def test_destroy assert_equal("GDK_DESTROY", Gdk::EventAny.new(:destroy).type.name) end end class TestKey < self include TestAnyMethods def setup @key = Gdk::EventKey.new(:key_press) end def event @key end def test_key_press assert_equal("GDK_KEY_PRESS", Gdk::EventKey.new(:key_press).type.name) end def test_key_release assert_equal("GDK_KEY_RELEASE", Gdk::EventKey.new(:key_release).type.name) end def test_time assert_kind_of(Integer, @key.time) end def test_state assert_not_nil(@key.state) end def test_keyval assert_kind_of(Integer, @key.keyval) end end class TestButton < self include TestAnyMethods def setup @button = Gdk::EventButton.new(:button_press) end def event @button end def test_button_press assert_equal("GDK_BUTTON_PRESS", Gdk::EventButton.new(:button_press).type.name) end def test_button2_press assert_equal("GDK_2BUTTON_PRESS", Gdk::EventButton.new(:button2_press).type.name) end def test_button3_press assert_equal("GDK_3BUTTON_PRESS", Gdk::EventButton.new(:button3_press).type.name) end def test_button_release assert_equal("GDK_BUTTON_RELEASE", Gdk::EventButton.new(:button_release).type.name) end def test_time assert_kind_of(Integer, @button.time) end def test_x assert_kind_of(Float, @button.x) end def test_y assert_kind_of(Float, @button.y) end def test_state assert_not_nil(@button.state) end def test_button assert_kind_of(Integer, @button.button) end def test_x_root assert_kind_of(Float, @button.x_root) end def test_y_root assert_kind_of(Float, @button.y_root) end end class TestTouch < self include TestAnyMethods def setup @touch = Gdk::EventTouch.new(:touch_begin) end def event @touch end def test_time assert_kind_of(Integer, @touch.time) end def test_x assert_kind_of(Float, @touch.x) end def test_y assert_kind_of(Float, @touch.y) end def test_axes assert_nothing_raised do @touch.axes end end def test_state assert_not_nil(@touch.state) end def test_touch_begin assert_equal("GDK_TOUCH_BEGIN", Gdk::EventTouch.new(:touch_begin).type.name) end def test_touch_update assert_equal("GDK_TOUCH_UPDATE", Gdk::EventTouch.new(:touch_update).type.name) end def test_touch_cancel assert_equal("GDK_TOUCH_CANCEL", Gdk::EventTouch.new(:touch_cancel).type.name) end def test_touch_end assert_equal("GDK_TOUCH_END", Gdk::EventTouch.new(:touch_end).type.name) end def test_emulating_pointer assert_boolean(@touch.emulating_pointer?) end def test_device assert_nothing_raised do @touch.device end end def test_x_root assert_kind_of(Float, @touch.x_root) end def test_y_root assert_kind_of(Float, @touch.y_root) end end class TestScroll < self include TestAnyMethods def setup @scroll = Gdk::EventScroll.new(:scroll) end def event @scroll end def test_time assert_kind_of(Integer, @scroll.time) end def test_x assert_kind_of(Float, @scroll.x) end def test_y assert_kind_of(Float, @scroll.y) end def test_state assert_not_nil(@scroll.state) end def test_direction assert_kind_of(Gdk::ScrollDirection, @scroll.direction) end def test_x_root assert_kind_of(Float, @scroll.x_root) end def test_y_root assert_kind_of(Float, @scroll.y_root) end end class TestMotion < self include TestAnyMethods def setup @motion = Gdk::EventMotion.new(:motion_notify) end def event @motion end def test_time assert_kind_of(Integer, @motion.time) end def test_x assert_kind_of(Float, @motion.x) end def test_y assert_kind_of(Float, @motion.y) end def test_state assert_not_nil(@motion.state) end def test_x_root assert_kind_of(Float, @motion.x_root) end def test_y_root assert_kind_of(Float, @motion.y_root) end def test_request assert_nothing_raised do @motion.request end end end class TestVisibility < self include TestAnyMethods def setup @visibility = Gdk::EventVisibility.new(:visibility_notify) end def event @visibility end def test_state assert_kind_of(Gdk::VisibilityState, @visibility.state) end end class TestCrossing < self include TestAnyMethods def setup @crossing = Gdk::EventCrossing.new(:enter_notify) end def event @crossing end def test_enter_notify assert_equal("GDK_ENTER_NOTIFY", Gdk::EventCrossing.new(:enter_notify).type.name) end def test_leave_notify assert_equal("GDK_LEAVE_NOTIFY", Gdk::EventCrossing.new(:leave_notify).type.name) end def test_time assert_kind_of(Integer, @crossing.time) end def test_x assert_kind_of(Float, @crossing.x) end def test_y assert_kind_of(Float, @crossing.y) end def test_x_root assert_kind_of(Float, @crossing.x_root) end def test_y_root assert_kind_of(Float, @crossing.y_root) end def test_mode assert_kind_of(Gdk::CrossingMode, @crossing.mode) end def test_detail assert_not_nil(@crossing.detail) end def test_state assert_not_nil(@crossing.state) end end class TestFocus < self include TestAnyMethods def setup @focus = Gdk::EventFocus.new(:focus_change) end def event @focus end def test_in assert_false(@focus.in?) end end class TestConfigure < self include TestAnyMethods def setup @configure = Gdk::EventConfigure.new(:configure) end def event @configure end def test_x assert_kind_of(Integer, @configure.x) end def test_y assert_kind_of(Integer, @configure.y) end def test_width assert_kind_of(Integer, @configure.width) end def test_height assert_kind_of(Integer, @configure.height) end end class TestProperty < self include TestAnyMethods def setup @property = Gdk::EventProperty.new(:property_notify) end def event @property end def test_atom assert_nothing_raised do @property.atom end end def test_time assert_kind_of(Integer, @property.time) end def test_state assert_equal(Gdk::PropertyState::NEW_VALUE, @property.state) end end class TestSelection < self include TestAnyMethods def setup @selection = Gdk::EventSelection.new(:selection_clear) end def event @selection end def test_selection_clear assert_equal("GDK_SELECTION_CLEAR", Gdk::EventSelection.new(:selection_clear).type.name) end def test_selection_notify assert_equal("GDK_SELECTION_NOTIFY", Gdk::EventSelection.new(:selection_notify).type.name) end def test_selection_request assert_equal("GDK_SELECTION_REQUEST", Gdk::EventSelection.new(:selection_request).type.name) end def test_selection assert_nothing_raised do @selection.selection end end def test_target assert_nothing_raised do @selection.target end end def test_property assert_nothing_raised do @selection.property end end def test_time assert_kind_of(Integer, @selection.time) end end class TestDND < self include TestAnyMethods def setup @dnd = Gdk::EventDND.new(:drag_enter) end def event @dnd end def test_drag_enter assert_equal("GDK_DRAG_ENTER", Gdk::EventDND.new(:drag_enter).type.name) end def test_drag_leave assert_equal("GDK_DRAG_LEAVE", Gdk::EventDND.new(:drag_leave).type.name) end def test_drag_motion assert_equal("GDK_DRAG_MOTION", Gdk::EventDND.new(:drag_motion).type.name) end def test_drag_status assert_equal("GDK_DRAG_STATUS", Gdk::EventDND.new(:drag_status).type.name) end def test_drop_start assert_equal("GDK_DROP_START", Gdk::EventDND.new(:drop_start).type.name) end def test_drop_finished assert_equal("GDK_DROP_FINISHED", Gdk::EventDND.new(:drop_finished).type.name) end def test_context assert_nothing_raised do @dnd.context end end def test_time assert_kind_of(Integer, @dnd.time) end def test_x_root assert_kind_of(Integer, @dnd.x_root) end def test_y_root assert_kind_of(Integer, @dnd.y_root) end end class TestProximity < self include TestAnyMethods def setup @proximity = Gdk::EventProximity.new(:proximity_in) end def event @proximity end def test_proximity_in assert_equal("GDK_PROXIMITY_IN", Gdk::EventProximity.new(:proximity_in).type.name) end def test_proximity_out assert_equal("GDK_PROXIMITY_OUT", Gdk::EventProximity.new(:proximity_out).type.name) end def test_time assert_kind_of(Integer, @proximity.time) end def test_device assert_nothing_raised do @proximity.device end end end class TestWindowState < self include TestAnyMethods def setup @window_state = Gdk::EventWindowState.new(:window_state) end def event @window_state end def test_changed_mask assert_nothing_raised do @window_state.changed_mask end end def test_new_window_state assert_nothing_raised do @window_state.new_window_state end end end class TestSetting < self include TestAnyMethods def setup @setting = Gdk::EventSetting.new(:setting) end def event @setting end def test_action assert_nothing_raised do @setting.action end end def test_name assert_nothing_raised do @setting.name end end end class TestOwnerChange < self def setup @owner_change = Gdk::EventOwnerChange.new(:owner_change) end def event @owner_change end def test_owner assert_nothing_raised do @owner_change.owner end end def test_reason assert_nothing_raised do @owner_change.reason end end def test_selection assert_nothing_raised do @owner_change.selection end end def test_time assert_kind_of(Integer, @owner_change.time) end def test_selection_time assert_kind_of(Integer, @owner_change.selection_time) end end class TestGrabBroken < self include TestAnyMethods def setup @grab_broken = Gdk::EventGrabBroken.new(:grab_broken) end def event @grab_broken end def test_keyboard assert_boolean(@grab_broken.keyboard?) end def test_implicit assert_boolean(@grab_broken.implicit?) end def test_grab_window assert_nil(@grab_broken.grab_window) end end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-rgba.rb0000644000175000017500000000210312516434313017377 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013-2014 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 class TestGdkRGBA < Test::Unit::TestCase def test_to_s rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5) assert_equal("rgba(51,102,153,0.5)", rgba.to_s) end def test_to_a rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5) assert_equal([0.2, 0.4, 0.6, 0.5], rgba.to_a) end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-rectangle.rb0000644000175000017500000000351612416346617020451 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013-2014 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 class TestGdkRectangle < Test::Unit::TestCase def test_intersect rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30) rectangle2 = Gdk::Rectangle.new(5, 15, 10, 20) intersected = rectangle1.intersect(rectangle2) assert_equal([ 5, 15, 10, 20, ], [ intersected.x, intersected.y, intersected.width, intersected.height, ]) end def test_union rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30) rectangle2 = Gdk::Rectangle.new(5, 15, 40, 20) unioned_rectangle = rectangle1.union(rectangle2) assert_equal([ 0, 10, 45, 30, ], [ unioned_rectangle.x, unioned_rectangle.y, unioned_rectangle.width, unioned_rectangle.height, ]) end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-geometry.rb0000644000175000017500000000167112124610262020322 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGdkGeometry < Test::Unit::TestCase def test_min_width geometry = Gdk::Geometry.new assert_equal(0, geometry.min_width) end end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-keyval.rb0000644000175000017500000000421312516434313017763 0ustar koukou# Copyright (C) 2014 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 class TestGdkKeyval < Test::Unit::TestCase def test_consntant_name assert_equal("a".unpack("c")[0], Gdk::Keyval::KEY_a) end sub_test_case "#lower?" do def test_lower assert_true(Gdk::Keyval.lower?(Gdk::Keyval::KEY_a)) end def test_upper assert_false(Gdk::Keyval.lower?(Gdk::Keyval::KEY_A)) end end sub_test_case "#upper?" do def test_lower assert_false(Gdk::Keyval.upper?(Gdk::Keyval::KEY_a)) end def test_upper assert_true(Gdk::Keyval.upper?(Gdk::Keyval::KEY_A)) end end def test_name assert_equal("A", Gdk::Keyval.name(Gdk::Keyval::KEY_A)) end sub_test_case "#to_lower" do def test_lower assert_equal(Gdk::Keyval::KEY_a, Gdk::Keyval.to_lower(Gdk::Keyval::KEY_a)) end def test_upper assert_equal(Gdk::Keyval::KEY_a, Gdk::Keyval.to_lower(Gdk::Keyval::KEY_A)) end end sub_test_case "#to_upper" do def test_lower assert_equal(Gdk::Keyval::KEY_A, Gdk::Keyval.to_upper(Gdk::Keyval::KEY_a)) end def test_upper assert_equal(Gdk::Keyval::KEY_A, Gdk::Keyval.to_upper(Gdk::Keyval::KEY_A)) end end sub_test_case "#to_unicode" do def test_to_unicode assert_equal("\u02D8", # BREVE [Gdk::Keyval.to_unicode(Gdk::Keyval::KEY_breve)].pack("U")) end end end ruby-gnome2-all-2.2.5/gdk3/test/gdk-test-utils.rb0000644000175000017500000000152212124610262017622 0ustar koukou# Copyright (C) 2013 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 require "test-unit" require "test/unit/notify" module GdkTestUtils end ruby-gnome2-all-2.2.5/gdk3/test/test-gdk-pixbuf.rb0000644000175000017500000000310512416346617017774 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2014 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 class TestGdkPixbuf < Test::Unit::TestCase def test_window gdk_window = Gdk.default_root_window src_x = 0 src_y = 0 width = 290 height = 200 pixbuf = gdk_window.to_pixbuf(src_x, src_y, width, height) assert_equal([width, height], [pixbuf.width, pixbuf.height]) end def test_surface surface = Cairo::ImageSurface.new(:argb32, 290, 200) src_x = 0 src_y = 0 width = 290 height = 200 pixbuf = surface.to_pixbuf(src_x, src_y, width, height) assert_equal([width, height], [pixbuf.width, pixbuf.height]) end end ruby-gnome2-all-2.2.5/gdk3/Rakefile0000644000175000017500000000437212446226147015125 0ustar koukou# -*- ruby -*- # # Copyright (C) 2011-2013 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GDK3 is a Ruby binding of GDK-3.x." package.description = "Ruby/GDK3 is a Ruby binding of GDK-3.x." package.dependency.gem.runtime = [ "pango", "gdk_pixbuf2", "cairo-gobject", "gobject-introspection", ] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", "gobject-introspection", ] package.windows.gobject_introspection_dependencies = [ "atk", "pango", "gdk_pixbuf2", ] package.external_packages = [ { :name => "gtk+", :download_site => :gnome, :label => "GTK+", :version => "3.14.6", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", "--with-included-immodules", ], :need_autoreconf => true, :build_concurrently => false, :built_file => "bin/libgdk-3-0.dll", }, }, { :name => "adwaita-icon-theme", :download_site => :gnome, :label => "adwaita-icon-theme", :version => "3.14.1", :compression_method => "xz", :windows => { :configure_args => [], :build_concurrently => false, :built_file => "share/icons/Adwaita/index.theme", } }, ] end package_task.define ruby-gnome2-all-2.2.5/gdk3/README.md0000644000175000017500000000107012077252561014726 0ustar koukou# Ruby/GDK3 Ruby/GDK3 is a Ruby binding of GDK 3. ## Requirements * Ruby/GLib2, Ruby/ATK, Ruby/Pango and Ruby/GdkPixbuf2 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [rcairo](https://github.com/rcairo/rcairo) * [GTK+](http://cairographics.org/) 3.4.2 or later ## Install gem install gdk3 ## License Copyright (c) 2002-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/gdk3/COPYING.LIB0000644000175000017500000006364212257552167015131 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/gdk3/lib/0000755000175000017500000000000012416346617014222 5ustar koukouruby-gnome2-all-2.2.5/gdk3/lib/gdk3/0000755000175000017500000000000012516434313015042 5ustar koukouruby-gnome2-all-2.2.5/gdk3/lib/gdk3/window.rb0000644000175000017500000000153512416346617016712 0ustar koukou# Copyright (C) 2014 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 module Gdk class Window alias_method :invalidate, :invalidate_rect end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/window-attr.rb0000644000175000017500000000206412416346617017660 0ustar koukou# Copyright (C) 2014 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 module Gdk class WindowAttr alias_method :initialize_raw, :initialize def initialize(width, height, window_class, window_type) initialize_raw self.width = width self.height = height self.wclass = window_class self.window_type = window_type end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/deprecated.rb0000644000175000017500000001417312516434313017475 0ustar koukoumodule Gdk extend GLib::Deprecatable define_deprecated_enums :GrabStatus, 'GRAB' define_deprecated_enums :Status define_deprecated_const :Image, :raise => "Use 'Gdk::Pixbuf' or 'Cairo::Surface' instead." define_deprecated_const :Colormap, :raise => "Use 'Gdk::Visual' instead." define_deprecated_const :Input, :raise => "Use 'GLib::IOChannel' instead." define_deprecated_const :X11, 'GdkX11' class Cursor extend GLib::Deprecatable define_deprecated_enums :Type define_deprecated_method :pixmap?, :warn => "Don't use this method." do |_self| false end Gdk::CursorType.constants.each do |cursor_type| define_deprecated_const cursor_type, ['Gdk::CursorType', cursor_type].join('::') end end class Device extend GLib::Deprecatable define_deprecated_enums :AxisUse, 'AXIS' define_deprecated_enums :ExtensionMode, 'EXTENSION_EVENTS' define_deprecated_enums :InputMode, 'MODE' define_deprecated_enums :InputSource, 'SOURCE' end class Display extend GLib::Deprecatable define_deprecated_method :double_click_time, :raise => "Don't use this method." define_deprecated_method :double_click_distance, :raise => "Don't use this method." define_deprecated_method :button_click_time, :raise => "Don't use this method." define_deprecated_method :button_window, :raise => "Don't use this method." define_deprecated_method :button_number, :raise => "Don't use this method." define_deprecated_method :button_x, :raise => "Don't use this method." define_deprecated_method :button_y, :raise => "Don't use this method." end class DragContext extend GLib::Deprecatable define_deprecated_flags :Action, 'ACTION' define_deprecated_enums :Protocol, 'PROTO' define_deprecated_singleton_method :drag_begin, :warn => "Use 'Gdk::Window#drag_begin'." do |_self, window, targets| window.drag_begin(targets) end define_deprecated_singleton_method :get_protocol, :raise => "Use 'Gdk::Window#drag_protocol'." define_deprecated_method :initialize, :raise => "Use 'Gdk::Window#drag_begin'." define_deprecated_method :action, :selected_action define_deprecated_method :source?, :warn => "Don't use this method." define_deprecated_method :start_time, :raise => "Don't use this method." end class Event extend GLib::Deprecatable define_deprecated_const :Mask, "Gdk::EventMask" define_deprecated_const :Type, "Gdk::EventType" end class EventCrossing extend GLib::Deprecatable define_deprecated_enums :Mode define_deprecated_enums :NotifyType, 'NOTIFY' end class EventOwnerChange extend GLib::Deprecatable define_deprecated_enums :OwnerChange end class EventProperty extend GLib::Deprecatable define_deprecated_enums :State, 'PROPERTY' end class EventScroll extend GLib::Deprecatable define_deprecated_enums :Direction end class EventSetting extend GLib::Deprecatable define_deprecated_enums :Action, 'ACTION' end class EventVisibility extend GLib::Deprecatable define_deprecated_enums :State end class EventWindowState extend GLib::Deprecatable define_deprecated_flags :WindowState end module Keyval extend GLib::Deprecatable constants.each do |key| old_names = [] old_names << key.to_s.sub(/^KEY_/, 'GDK_KEY_') old_names << key.to_s.sub(/^KEY_/, 'GDK_') old_names.each do |old_name| define_deprecated_const old_name, [self, key].join('::') end end end class Pixmap extend GLib::Deprecatable define_deprecated_method :initialize, :raise => "Use 'Gdk::Window#create_similar_surface'." define_deprecated_singleton_method :create_from_data, :raise => "Use 'Cairo::ImageSurface.new'." define_deprecated_singleton_method :create_from_xbm, :raise => "Use 'Cairo::ImageSurface.new'." define_deprecated_singleton_method :create_from_xpm, :raise => "Use 'Gdk::Pixbuf.new'." define_deprecated_singleton_method :create_from_xpm_d, :raise => "Use 'Gdk::Pixbuf.new'." define_deprecated_singleton_method :colormap_create_from_xpm, :raise => "Use 'Gdk::Pixbuf.new'." define_deprecated_singleton_method :colormap_create_from_xpm_d, :raise => "Use 'Gdk::Pixbuf.new'." define_deprecated_singleton_method :foreign_new, :raise => "Don't use this method." define_deprecated_singleton_method :lookup, :raise => "Don't use this method." end module Property extend GLib::Deprecatable define_deprecated_enums :PropMode, 'MODE' end class Visual extend GLib::Deprecatable define_deprecated_enums :ByteOrder define_deprecated_enums :Type end class Window extend GLib::Deprecatable define_deprecated_const :Gravity, "Gdk::Gravity" define_deprecated_const :AttributesType, "Gdk::WindowAttributesType" define_deprecated_const :Edge, "Gdk::WindowEdge" define_deprecated_const :FilterReturn, "Gdk::FilterReturn" define_deprecated_const :Hints, "Gdk::WindowHints" define_deprecated_const :ModifierType, "Gdk::ModifierType" define_deprecated_const :Type, "Gdk::WindowType" define_deprecated_const :TypeHint, "Gdk::WindowTypeHint" define_deprecated_const :WindowClass, "Gdk::WindowWindowClass" define_deprecated_const :Class, "Gdk::WindowWindowClass" define_deprecated_const :WMDecoration, "Gdk::WMDecoration" define_deprecated_const :WMFunction, "Gdk::WMFunction" define_deprecated_const :PARENT_RELATIVE, "Gdk::PARENT_RELATIVE" define_deprecated_method :clear, :warn => "Don't use this method." define_deprecated_method :clear_area, :warn => "Don't use this method." define_deprecated_method :internal_paint_info, :raise => "Don't use this method." define_deprecated_method :shape_combine_mask, :warn => "Don't use this method." define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method." define_deprecated_method :set_back_pixmap, :warn => "Don't use this method." end class WindowAttr extend GLib::Deprecatable define_deprecated_method :colormap, :raise => "Don't use this method." define_deprecated_method :set_colormap, :warn => "Don't use this method." alias :colormap= :set_colormap end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/color.rb0000644000175000017500000000323712446160551016514 0ustar koukou# Copyright (C) 2014 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 module Gdk class Color class << self alias_method :parse_raw, :parse def parse(spec) succeeded, color = parse_raw(spec) unless succeeded message = "Invalid color spec: <#{spec.inspect}>: " message << "Color spec must be one of them: " message << "\"\#rgb\", " message << "\"\#rrggbb\", " message << "\"\#rrggbb\", " message << "\"\#rrrgggbbb\", " message << "\"\#rrrrggggbbbb\", " message << "\"\#fff\", " message << "\"\#ffffff\", " message << "\"\#fffffffff\", " message << "\"\#fffffffffffff\"" raise ArgumentError, message end color end end alias_method :initialize_raw, :initialize def initialize(red, green, blue) initialize_raw self.red = red self.green = green self.blue = blue end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/event.rb0000644000175000017500000000213712416346617016523 0ustar koukou# Copyright (C) 2014 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 module Gdk class Event unless const_defined?(:PROPAGATE) PROPAGATE = false end unless const_defined?(:STOP) STOP = true end def send_event? not send_event.zero? end end class EventFocus alias_method :in_raw, :in remove_method :in def in? not in_raw.zero? end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/cairo.rb0000644000175000017500000000371012446160551016467 0ustar koukou# Copyright (C) 2014 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 module Cairo class Context if method_defined?(:set_source_color) alias_method :set_source_not_gdk_color, :set_source_color def set_source_color(color) if color.is_a?(Gdk::Color) set_source_gdk_color(color) else set_source_not_gdk_color(color) end end else alias_method :set_source_color, :set_source_gdk_color end def source_color=(color) set_source_color(color) color end if method_defined?(:set_source_rgba) alias_method :set_source_not_gdk_rgba, :set_source_rgba def set_source_rgba(rgba, g=nil, b=nil, a=nil) case rgba when Gdk::RGBA set_source_gdk_rgba(rgba) when Array set_source_not_gdk_rgba(rgba) else r = rgba set_source_not_gdk_rgba([r, g, b, a]) end end else alias_method :set_source_rgba, :set_source_gdk_rgba end def source_rgba=(rgba) set_source_rgba(rgba) rgba end alias_method :set_source_pixbuf_raw, :set_source_pixbuf def set_source_pixbuf(pixbuf, pixbuf_x=0, pixbuf_y=0) set_source_pixbuf_raw(pixbuf, pixbuf_x, pixbuf_y) end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/rectangle.rb0000644000175000017500000000227212416346617017346 0ustar koukou# Copyright (C) 2014 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 module Gdk class Rectangle alias_method :initialize_raw, :initialize def initialize(x, y, width, height) initialize_raw self.x = x self.y = y self.width = width self.height = height end alias_method :intersect_raw, :intersect def intersect(other) intersected, dest = intersect_raw(other) if intersected dest else nil end end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/rgba.rb0000644000175000017500000000206712516434313016307 0ustar koukou# Copyright (C) 2014 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 module Gdk class RGBA alias_method :initialize_raw, :initialize def initialize(red, green, blue, alpha) initialize_raw self.red = red self.green = green self.blue = blue self.alpha = alpha end def to_a [red, green, blue, alpha] end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/loader.rb0000644000175000017500000002036212516434313016640 0ustar koukou# Copyright (C) 2013-2014 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 module Gdk class Loader < GObjectIntrospection::Loader private def window_class @window_class ||= @base_module.const_get(:Window) end def event_class @event_class ||= @base_module.const_get(:Event) end def event_motion_class @event_motion_class ||= @base_module.const_get(:EventMotion) end def rectangle_class @rectangle_class ||= @base_module.const_get(:Rectangle) end def pre_load(repository, namespace) setup_pending_constants define_keyval_module define_selection_module load_cairo_rectangle_int end def define_keyval_module @keyval_module = Module.new @base_module.const_set("Keyval", @keyval_module) end def define_selection_module @selection_module = Module.new @base_module.const_set("Selection", @selection_module) end def load_cairo_rectangle_int info = find_cairo_rectangle_int_info klass = self.class.define_class(info.gtype, "Rectangle", @base_module, :size => info.size) load_fields(info, klass) load_methods(info, klass) end def find_cairo_rectangle_int_info repository = GObjectIntrospection::Repository.default repository.each("cairo") do |info| if info.name == "RectangleInt" return info end end nil end def post_load(repository, namespace) apply_pending_constants require_libraries convert_event_classes define_selection_constants end def setup_pending_constants @pending_constants = [] end def apply_pending_constants @pending_constants.each do |info| case info.name when /\AEVENT_/ event_class.const_set($POSTMATCH, info.value) end end end def require_libraries require "gdk3/atom" require "gdk3/color" require "gdk3/event" require "gdk3/rectangle" require "gdk3/rgba" require "gdk3/window" require "gdk3/window-attr" require "gdk3/cairo" require "gdk3/deprecated" end def convert_event_classes event_map = { EventType::EXPOSE => EventExpose, EventType::MOTION_NOTIFY => EventMotion, EventType::BUTTON_PRESS => EventButton, EventType::BUTTON2_PRESS => EventButton, EventType::BUTTON3_PRESS => EventButton, EventType::BUTTON_RELEASE => EventButton, EventType::KEY_PRESS => EventKey, EventType::KEY_RELEASE => EventKey, EventType::ENTER_NOTIFY => EventCrossing, EventType::LEAVE_NOTIFY => EventCrossing, EventType::FOCUS_CHANGE => EventFocus, EventType::CONFIGURE => EventConfigure, EventType::PROPERTY_NOTIFY => EventProperty, EventType::SELECTION_CLEAR => EventSelection, EventType::SELECTION_REQUEST => EventSelection, EventType::SELECTION_NOTIFY => EventSelection, EventType::PROXIMITY_IN => EventProximity, EventType::PROXIMITY_OUT => EventProximity, EventType::DRAG_ENTER => EventDND, EventType::DRAG_LEAVE => EventDND, EventType::DRAG_MOTION => EventDND, EventType::DRAG_STATUS => EventDND, EventType::DROP_START => EventDND, EventType::DROP_FINISHED => EventDND, EventType::VISIBILITY_NOTIFY => EventVisibility, EventType::SCROLL => EventScroll, EventType::WINDOW_STATE => EventWindowState, EventType::SETTING => EventSetting, EventType::OWNER_CHANGE => EventOwnerChange, EventType::GRAB_BROKEN => EventGrabBroken, EventType::DAMAGE => EventExpose, EventType::TOUCH_BEGIN => EventTouch, EventType::TOUCH_UPDATE => EventTouch, EventType::TOUCH_END => EventTouch, EventType::TOUCH_CANCEL => EventTouch, } self.class.register_boxed_class_converter(Event.gtype) do |event| event_map[event.type] || Event end end def define_selection_constants selections = { "PRIMARY" => "PRIMARY", "SECONDARY" => "SECONDARY", "CLIPBOARD" => "CLIPBOARD", "TARGET_BITMAP" => "BITMAP", "TARGET_COLORMAP" => "COLORMAP", "TARGET_DRAWABLE" => "DRAWABLE", "TARGET_PIXMAP" => "PIXMAP", "TARGET_STRING" => "STRING", "TYPE_ATOM" => "ATOM", "TYPE_BITMAP" => "BITMAP", "TYPE_COLORMAP" => "COLORMAP", "TYPE_DRAWABLE" => "DRAWABLE", "TYPE_INTEGER" => "INTEGER", "TYPE_PIXMAP" => "PIXMAP", "TYPE_WINDOW" => "WINDOW", "TYPE_STRING" => "STRING", } selections.each do |key, value| # TODO: Gdk::Atom.intern is not working yet. #@selection_module.const_set(key, Gdk::Atom.intern(value)) end end def load_function_info(info) name = info.name case name when "init", /_get_type\z/ # ignore when /\Arectangle_/ define_method(info, rectangle_class, $POSTMATCH) when /\Apixbuf_/ target_class = nil case $POSTMATCH when "get_from_window" target_class = window_class when "get_from_surface" target_class = Cairo::Surface end if target_class define_method(info, target_class, "to_pixbuf") else super end when /\Aevent_/ name = $POSTMATCH case name when "request_motions" define_method(info, event_motion_class, "request") else super # TODO end when /\Acairo_/ name = $POSTMATCH case name when "create" define_method(info, window_class, "create_cairo_context") when "set_source_color" define_method(info, Cairo::Context, "set_source_gdk_color") when "set_source_rgba" define_method(info, Cairo::Context, "set_source_gdk_rgba") when "rectangle" define_method(info, Cairo::Context, "gdk_rectangle") when "region_create_from_surface" # TODO when "surface_create_from_pixbuf" # TODO else define_method(info, Cairo::Context, name) end when /\Akeyval_/ name = rubyish_method_name(info, :prefix => "keyval_") define_module_function(@keyval_module, name, info) else super end end def load_struct_info(info) return if info.gtype_struct? options = {} case info.name when /\AEvent/ options[:parent] = event_class end define_struct(info, options) end def define_enum(info) case info.name when "EventType" self.class.register_constant_rename_map("2BUTTON_PRESS", "BUTTON2_PRESS") self.class.register_constant_rename_map("3BUTTON_PRESS", "BUTTON3_PRESS") super else super end end def load_constant_info(info) case info.name when /\AEVENT_/ @pending_constants << info when /\AKEY_/ @keyval_module.const_set(info.name, info.value) else super end end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3/atom.rb0000644000175000017500000000167312416346617016346 0ustar koukou# Copyright (C) 2014 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 module Gdk class Atom class << self alias_method :intern_raw, :intern def intern(name, exist=true) intern_raw(name, exist) end end end end ruby-gnome2-all-2.2.5/gdk3/lib/gdk3.rb0000644000175000017500000000327012416346617015401 0ustar koukou# Copyright (C) 2013-2014 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 require "gobject-introspection" require "cairo-gobject" require "atk" require "pango" require "gdk_pixbuf2" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) require "gdk3/loader" module Gdk LOG_DOMAIN = "Gdk" GLib::Log.set_log_domain(LOG_DOMAIN) class Error < StandardError end class << self def const_missing(name) init if const_defined?(name) const_get(name) else super end end def init class << self remove_method(:init) remove_method(:const_missing) end loader = Loader.new(self) loader.load("Gdk") end def cairo_available? true end end end ruby-gnome2-all-2.2.5/gtk3/0000755000175000017500000000000012516441042013461 5ustar koukouruby-gnome2-all-2.2.5/gtk3/test/0000755000175000017500000000000012516434313014443 5ustar koukouruby-gnome2-all-2.2.5/gtk3/test/test_gtk_search_bar.rb0000644000175000017500000000350112516434313020764 0ustar koukou# Copyright (C) 2014 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 class TestGtkSearchBar < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 10, 0) @search_bar = Gtk::SearchBar.new end def test_connect_entry entry = Gtk::SearchEntry.new assert_equal(@search_bar, @search_bar.connect_entry(entry)) end def test_search_mode_enabled_accessors entry = Gtk::SearchEntry.new @search_bar.connect_entry(entry) @search_bar.search_mode_enabled = true assert_true(@search_bar.search_mode_enabled?) end def test_show_close_button_accessors @search_bar.show_close_button = true assert_true(@search_bar.show_close_button?) end def test_handle_event window = Gtk::Window.new key_press_event = Gdk::EventKey.new(:key_press) key_press_event.keyval = Gdk::Keyval::KEY_a entry = Gtk::SearchEntry.new @search_bar.add(entry) @search_bar.connect_entry(entry) window.add(@search_bar) window.show_all key_press_event.window = window.window assert_equal(Gdk::Event::STOP, @search_bar.handle_event?(key_press_event)) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gc.rb0000644000175000017500000000073412516434313016424 0ustar koukouclass TestGC < Test::Unit::TestCase priority :must def test_closure 10.times do invisible = Gtk::Invisible.new invisible.signal_connect("destroy") {} GC.start end end def test_inheritance_and_gc button = Class.new(Gtk::Button) box = Gtk::Box.new(:horizontal) n = 10 n.times do box.add(button.new) end GC.start assert_equal([button] * 10, box.children.collect {|item| item.class}) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_menu_item.rb0000644000175000017500000000043512516434313020660 0ustar koukouclass TestGtkMenuItem < Test::Unit::TestCase include GtkTestUtils def test_new_with_label item = Gtk::MenuItem.new("Label") assert_equal("Label", item.label) end def test_new_with_nil_label item = Gtk::MenuItem.new(nil) assert_equal("", item.label) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_about_dialog.rb0000644000175000017500000000046712516434313021334 0ustar koukouclass TestGtkAboutDialog < Test::Unit::TestCase include GtkTestUtils def setup @dialog = Gtk::AboutDialog.new end def test_program_name assert_equal(File.basename($0), @dialog.program_name) @dialog.program_name = "my-program" assert_equal("my-program", @dialog.program_name) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_icon_view.rb0000644000175000017500000000261012516434313020655 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2014 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 class TestGtkIconView < Test::Unit::TestCase include GtkTestUtils class TestGetCellRect < self def setup only_gtk_version(3, 6, 0) model = Gtk::ListStore.new(String, Gdk::Pixbuf) iter = model.append model.set_values(iter, ["label", nil]) @path = iter.path @icon_view = Gtk::IconView.new(model) end def test_found assert_kind_of(Gdk::Rectangle, @icon_view.get_cell_rect(@path)) end def test_not_found not_found_path = Gtk::TreePath.new(@path.indices.first + 1) assert_nil(@icon_view.get_cell_rect(not_found_path)) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_level_bar.rb0000644000175000017500000000442212516434313020631 0ustar koukou# Copyright (C) 2014 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 class TestGtkLevelBar < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 6, 0) end class TestConstructor < self def test_no_arguments level_bar = Gtk::LevelBar.new assert_equal([ 0.0, 1.0, ], [ level_bar.min_value, level_bar.max_value, ]) end def test_min_max_value min_value = 1.0 max_value = 20.0 level_bar = Gtk::LevelBar.new(min_value, max_value) assert_equal([ min_value, max_value, ], [ level_bar.min_value, level_bar.max_value, ]) end end class TestAccessor < self def setup super @level_bar = Gtk::LevelBar.new end def test_min_value @level_bar.min_value = 1.0 assert_equal(1.0, @level_bar.min_value) end def test_max_value @level_bar.max_value = 20.0 assert_equal(20.0, @level_bar.max_value) end def test_value @level_bar.value = 1.0 assert_equal(1.0, @level_bar.value) end def test_offset_value @level_bar.add_offset_value(Gtk::LevelBar::OFFSET_LOW, 0.10) assert_equal(0.10, @level_bar.get_offset_value(Gtk::LevelBar::OFFSET_LOW)) end def test_get_nonexistent_offset_value assert_nil(@level_bar.get_offset_value("nonexistent")) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_entry.rb0000644000175000017500000000325712516434313020044 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2014 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 class TestGtkEntry < Test::Unit::TestCase include GtkTestUtils def setup @entry = Gtk::Entry.new end def test_cursor_hadjustment assert_nil(@entry.cursor_hadjustment) adjustment = Gtk::Adjustment.new(0.0, 0.0, 100.0, 100.0, 1.0, 1.0) @entry.cursor_hadjustment = adjustment assert_equal(adjustment, @entry.cursor_hadjustment) end def test_completion_accsessors entry_completion = Gtk::EntryCompletion.new @entry.completion = entry_completion assert_equal(entry_completion, @entry.completion) end class TestEnum < self def test_input_purpose_enum only_gtk_version(3, 6, 0) assert_const_defined(Gtk::InputPurpose, :ALPHA) end def test_input_hints_enum only_gtk_version(3, 6, 0) assert_const_defined(Gtk::InputHints, :SPELLCHECK) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_css_provider.rb0000644000175000017500000000177512516434313021410 0ustar koukou# Copyright (C) 2013 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 class TestGtkCssProvider < Test::Unit::TestCase include GtkTestUtils def setup @provider = Gtk::CssProvider.new end def test_load_from_data assert_true(@provider.load(:data => "GtkWindow {background-color: red;}")) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_buildable.rb0000644000175000017500000000244512516434313020624 0ustar koukouclass TestGtkBuildable < Test::Unit::TestCase include GtkTestUtils def setup @buildable = Gtk::Box.new(:horizontal) end def test_name assert_equal("", @buildable.name) @buildable.name = "YYY" assert_equal("YYY", @buildable.name) @buildable.name = nil assert_equal("", @buildable.name) end def test_add_child assert_equal([], @buildable.children) builder = Gtk::Builder.new entry = Gtk::Entry.new @buildable.add_child(builder, entry) assert_equal([entry], @buildable.children) end def test_set_buildable_property assert_nil(@buildable.parent) builder = Gtk::Builder.new parent = Gtk::Box.new(:horizontal) @buildable.set_buildable_property(builder, "parent", parent) assert_equal(parent, @buildable.parent) end def test_construct_child assert_nil(@buildable.parent) @buildable = Gtk::UIManager.new @buildable.add_ui(<<-EOU) EOU builder = Gtk::Builder.new assert_kind_of(Gtk::Toolbar, @buildable.construct_child(builder, "Toolbar")) end def test_get_internal_child assert_nil(@buildable.parent) @buildable = Gtk::Dialog.new builder = Gtk::Builder.new assert_kind_of(Gtk::Box, @buildable.get_internal_child(builder, "vbox")) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_recent_data.rb0000644000175000017500000000166012516434313021150 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkRecentData < Test::Unit::TestCase def test_mime_type data = Gtk::RecentData.new assert_nil(data.mime_type) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_action_group.rb0000644000175000017500000000275312516434313021374 0ustar koukou# Copyright (C) 2014 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 class TestGtkActionBar < Test::Unit::TestCase include GtkTestUtils def setup @bar = Gtk::ActionBar.new end def test_pack_start widget1 = Gtk::Box.new(:horizontal) widget2 = Gtk::Box.new(:horizontal) @bar.pack_start(widget1) @bar.pack_start(widget2) assert_equal([widget1, widget2], @bar.children) end def test_pack_end widget1 = Gtk::Box.new(:horizontal) widget2 = Gtk::Box.new(:horizontal) @bar.pack_end(widget1) @bar.pack_end(widget2) assert_equal([widget2, widget1], @bar.children) end def test_center_widget widget = Gtk::Box.new(:horizontal) assert_nil(@bar.center_widget) @bar.center_widget = widget assert_equal(widget, @bar.center_widget) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_tree_selection.rb0000644000175000017500000000213012516434313021674 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2014 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 class TestGtkTreeSelection < Test::Unit::TestCase include GtkTestUtils def setup @tree = Gtk::TreeView.new @selection = @tree.selection end def test_mode_accessors @selection.mode = Gtk::SelectionMode::MULTIPLE assert_equal(Gtk::SelectionMode::MULTIPLE, @selection.mode) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_style_properties.rb0000644000175000017500000000247512516434313022320 0ustar koukou# Copyright (C) 2013 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 class TestGtkStyleProperties < Test::Unit::TestCase def setup @properties = Gtk::StyleProperties.new end class TestGet < self def test_eixstent key = "border-radius" state = :normal value = 29 g_value = GLib::Value.new(GLib::Type::INT, value) # TODO: support direct Ruby object use @properties.set_property(key, state, g_value) assert_equal(value, @properties.get_property(key, state)) end def test_noneixstent assert_nil(@properties.get_property("nonexistent", :normal)) end end end ruby-gnome2-all-2.2.5/gtk3/test/run-test.rb0000755000175000017500000000412412516434313016555 0ustar koukou#!/usr/bin/env ruby # # Copyright (C) 2013 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") gdk3_base = File.join(ruby_gnome2_base, "gdk3") gtk3_base = File.join(ruby_gnome2_base, "gtk3") [ [glib_base, "glib2"], [atk_base, "atk"], [cairo_gobject_base, "cairo-gobject"], [pango_base, "pango"], [gdk_pixbuf_base, "gdk_pixbuf2"], [gobject_introspection_base, "gobject-introspection"], [gdk3_base, "gdk3"], [gtk3_base, "gtk3"] ].each do |target, module_name| if File.exist?(File.join(target, "Makefile")) if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) end $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require 'glib-test-init' $LOAD_PATH.unshift(File.join(gtk3_base, "test")) require 'gtk-test-utils' require 'gtk3' exit Test::Unit::AutoRunner.run(true) ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_icon_theme.rb0000644000175000017500000000132312516434313021005 0ustar koukouclass TestGtkIconTheme < Test::Unit::TestCase include GtkTestUtils def setup @theme = Gtk::IconTheme.default end def test_choose_icon assert_nil(@theme.choose_icon("non-existent", 100)) icon = @theme.choose_icon("face-cool", 10) assert_not_nil(icon) assert_match(/face-cool/, icon.filename) assert_not_nil(@theme.choose_icon("face-cool", 29, [:use_builtin, :no_svg])) end def test_contexts assert_operator(@theme.contexts, :include?, "MimeTypes") end class TestIcons < self def test_no_argument assert_operator(@theme.icons, :include?, "face-cool") end def test_context assert_operator(@theme.icons("Actions"), :include?, "find") end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_header_bar.rb0000644000175000017500000000405412516434313020753 0ustar koukou# Copyright (C) 2014 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 class TestGtkHeaderBar < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 10, 0) @header_bar = Gtk::HeaderBar.new end def test_custom_title_accessros widget = Gtk::EventBox.new @header_bar.custom_title = widget assert_equal(widget, @header_bar.custom_title) end def test_title_accessors header_bar_title = "no title" @header_bar.title = header_bar_title assert_equal(header_bar_title, @header_bar.title) end def test_subtitle_accessors header_bar_subtitle = "sub title" @header_bar.subtitle = header_bar_subtitle assert_equal(header_bar_subtitle, @header_bar.subtitle) end def test_show_close_button_accessors @header_bar.show_close_button = true assert_equal(true, @header_bar.show_close_button?) end def test_spacing_accessors spacing_size = 10 @header_bar.spacing = spacing_size assert_equal(spacing_size, @header_bar.spacing) end def test_pack start1 = Gtk::EventBox.new start2 = Gtk::EventBox.new end1 = Gtk::EventBox.new end2 = Gtk::EventBox.new @header_bar.pack_start(start1) @header_bar.pack_start(start2) @header_bar.pack_end(end1) @header_bar.pack_end(end2) assert_equal([start1, start2, end1, end2], @header_bar.children) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_widget.rb0000644000175000017500000000105212516434313020155 0ustar koukouclass TestGtkWidget < Test::Unit::TestCase include GtkTestUtils def setup @widget = Gtk::Invisible.new end def test_set_window attrs = Gdk::WindowAttr.new(100, 100, :input_only, :temp) window = Gdk::Window.new(nil, attrs, 0) @widget.window = window assert_equal(window, @widget.window) end def test_modify_color_component_with_nil_color assert_nothing_raised do @widget.override_color(:normal, nil) end assert_nothing_raised do @widget.override_background_color(:normal, nil) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_stack.rb0000644000175000017500000000635612516434313020013 0ustar koukou# Copyright (C) 2014 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 class TestGtkStack < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 10, 0) @stack = Gtk::Stack.new end class TestAdd < self def setup super @child = Gtk::EventBox.new end def test_return_value assert_equal(@stack, @stack.add(@child)) end def test_added @stack.add(@child) assert_equal([@child], @stack.children) end def test_name widget_name = "set widget name" @stack.add(@child, widget_name) assert_equal(widget_name, @stack.child_get_property(@child, "name")) end def test_name_add_title widget_name = "set widget name" widget_title = "set widget title" @stack.add(@child, widget_name, widget_title) assert_equal([ widget_name, widget_title, ], [ @stack.child_get_property(@child, "name"), @stack.child_get_property(@child, "title"), ]) end end def test_homogeneous_accessors @stack.homogeneous = false assert_false(@stack.homogeneous?) end def test_transition_duration_accessors duration = 500 @stack.transition_duration = duration assert_equal(duration, @stack.transition_duration) end def test_transition_type_accessors stack_transition_type = Gtk::Stack::TransitionType::SLIDE_UP @stack.transition_type = stack_transition_type assert_equal(stack_transition_type, @stack.transition_type) end class TestVisibleChild < self def setup super @visible_widget = Gtk::EventBox.new @visible_widget.show @visible_widget_name = "visible widget" @stack.add(@visible_widget, @visible_widget_name) end def test_assign assert_not_respond_to(@stack, :visible_child=) end def test_widget @stack.set_visible_child(@visible_widget) assert_equal(@visible_widget, @stack.visible_child) end def test_name @stack.set_visible_child(@visible_widget_name) assert_equal(@visible_widget_name, @stack.visible_child_name) end def test_name_and_transition_type @stack.set_visible_child(@visible_widget_name, :crossfade) assert_equal(@visible_widget_name, @stack.visible_child_name) end end class TestEnum < self def test_transition_type assert_const_defined(Gtk::Stack::TransitionType, :CROSSFADE) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_list_store.rb0000644000175000017500000000527312516434313021072 0ustar koukou# Copyright (C) 2013-2014 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 class TestGtkListStore < Test::Unit::TestCase include GtkTestUtils ID = 0 NAME = 1 COLUMNS = { ID => Integer, NAME => String, } def setup columns = COLUMNS.keys.sort.collect do |key| COLUMNS[key] end @store = Gtk::ListStore.new(*columns) end def test_set_values iter = @store.append assert_nothing_raised do @store.set_values(iter, [0, '1']) end assert_equal([0, '1'], [iter[0], iter[1]]) iter = @store.append assert_nothing_raised do @store.set_values(iter, [2, '3']) end assert_equal([2, '3'], [iter[0], iter[1]]) assert_nothing_raised do @store.set_values(iter, []) end assert_equal([2, '3'], [iter[0], iter[1]]) end def test_set_values_with_hash iter = @store.append assert_nothing_raised do @store.set_values(iter, {ID => 0, NAME => 'me'}) end assert_equal([0, 'me'], [iter[ID], iter[NAME]]) iter = @store.append assert_nothing_raised do @store.set_values(iter, {NAME => 'you', ID => 2}) end assert_equal([2, 'you'], [iter[ID], iter[NAME]]) assert_nothing_raised do @store.set_values(iter, {NAME => "she"}) end assert_equal([2, 'she'], [iter[ID], iter[NAME]]) assert_nothing_raised do @store.set_values(iter, {}) end assert_equal([2, 'she'], [iter[ID], iter[NAME]]) end def test_iter_gc GC.start n_iterators = count_objects(Gtk::TreeIter) 50.times do |i| iter = @store.append iter[ID] = i iter[NAME] = i.to_s end 100.times do @store.iter_first end iter = @store.iter_first while @store.remove(iter); end iter = nil assert_equal(0, @store.to_enum(:each).to_a.size) GC.start assert_equal(n_iterators, count_objects(Gtk::TreeIter)) end private def count_objects(klass) n_objects = ObjectSpace.each_object(Gtk::TreeIter) do # do nothing end n_objects end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_builder.rb0000644000175000017500000001000012516434313020311 0ustar koukouclass TestGtkBuilder < Test::Unit::TestCase include GtkTestUtils def test_constants assert_kind_of(Gtk::BuilderError, Gtk::BuilderError::INVALID_TAG) end def test_new assert_nothing_raised do Gtk::Builder.new end end def test_add_from_file builder = Gtk::Builder.new assert_nothing_raised do builder.add_from_file(ui_definition_file.path) end assert_kind_of(Gtk::Dialog, builder["dialog1"]) end def test_add_from_string builder = Gtk::Builder.new assert_nothing_raised do builder.add_from_string(ui_definition) end assert_kind_of(Gtk::Box, builder["vbox1"]) end def test_add_with_file builder = Gtk::Builder.new assert_nothing_raised do builder.add(ui_definition_file.path) end assert_kind_of(Gtk::ButtonBox, builder["hbuttonbox1"]) end def test_add_with_string builder = Gtk::Builder.new assert_nothing_raised do builder.add(ui_definition) end assert_kind_of(Gtk::Button, builder["ok_button"]) end def test_add_chain builder = Gtk::Builder.new assert_nothing_raised do builder << ui_definition_file.path << ui_definition_simple end assert_kind_of(Gtk::Dialog, builder["dialog1"]) assert_kind_of(Gtk::Window, builder["main-window"]) end def test_objects builder = Gtk::Builder.new assert_nothing_raised do builder << ui_definition_file.path << ui_definition_simple end assert_equal(["dialog1", "vbox1", "hbuttonbox1", "ok_button", "main-window"].sort, builder.objects.collect {|object| object.builder_name}.sort) end def test_translation_domain builder = Gtk::Builder.new assert_nil(builder.translation_domain) builder.translation_domain = "ruby-gnome2" assert_equal("ruby-gnome2", builder.translation_domain) end def test_connect_signals handler_names = [] builder = Gtk::Builder.new builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal([].sort, handler_names.sort) builder << ui_definition ok_button = builder["ok_button"] builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal(["ok_button_clicked"].sort, handler_names.sort) end def test_connect_signals_with_no_signal_ui_definition handler_names = [] builder = Gtk::Builder.new builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal([].sort, handler_names.sort) builder << ui_definition_simple builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal([].sort, handler_names.sort) end def test_get_type_from_name builder = Gtk::Builder.new assert_nil(builder.get_type("XXX")) assert_equal(Gtk::Box, builder.get_type("GtkBox")) end private def ui_definition <<-EOX 10 20 gtk-ok TRUE EOX end def ui_definition_simple <<-EOX EOX end def ui_definition_with_signal <<-EOX EOX end def ui_definition_file xml = Tempfile.new("Gtk::Builder") xml.print(ui_definition) xml.close xml end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_recent_filter_info.rb0000644000175000017500000000176212516434313022542 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkRecentFilterInfo < Test::Unit::TestCase include GtkTestUtils def test_contains info = Gtk::RecentFilterInfo.new assert_equal(Gtk::RecentFilter::Flags.new, info.contains) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_revealer.rb0000644000175000017500000000332412516434313020503 0ustar koukou# Copyright (C) 2014 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 class TestGtkRevealer < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 10, 0) @revealer = Gtk::Revealer.new end class RevealChild < self def setup super @revealer.reveal_child = true end def test_reveal_child assert_true(@revealer.reveal_child?) end def test_child_revealed assert_true(@revealer.child_revealed?) end end def test_transition_duration_accessors duration = 500 @revealer.transition_duration = duration assert_equal(duration, @revealer.transition_duration) end def test_transition_type_accessors revealer_transition_type = Gtk::Revealer::TransitionType::SLIDE_UP @revealer.transition_type = revealer_transition_type assert_equal(revealer_transition_type, @revealer.transition_type) end class TestEnum < self def test_transition_type assert_const_defined(Gtk::Revealer::TransitionType, :CROSSFADE) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_style_context.rb0000644000175000017500000000206712516434313021605 0ustar koukou# Copyright (C) 2013 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 class TestGtkStyleContext < Test::Unit::TestCase include GtkTestUtils def setup @style_context = Gtk::StyleContext.new end def test_add_provider provider = Gtk::CssProvider.new assert_nothing_raised do @style_context.add_provider(provider, GLib::MAXUINT) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_allocation.rb0000644000175000017500000000171112516434313021021 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkAllocation < Test::Unit::TestCase def test_width allocation = Gtk::Allocation.new(0, 10, 20, 30) assert_equal(20, allocation.width) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_accessible.rb0000644000175000017500000000207612516434313020776 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2014 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 class TestGtkAccessible < Test::Unit::TestCase include GtkTestUtils def setup @accessible = Gtk::Accessible.new end def test_widget_accessors widget = Gtk::Box.new(:horizontal) @accessible.widget = widget assert_equal(widget, @accessible.widget) end end ruby-gnome2-all-2.2.5/gtk3/test/gtk-test-utils.rb0000644000175000017500000000050112516434313017664 0ustar koukourequire 'tempfile' module GtkTestUtils private def only_gtk_version(major, minor, micro=nil) micro ||= 0 unless Gtk.check_version?(major, minor, micro) omit("Require GTK+ >= #{major}.#{minor}.#{micro}") end end def only_x11 omit("Only for X11 backend") unless Gdk.windowing_x11? end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_border.rb0000644000175000017500000000167012516434313020155 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkBorder < Test::Unit::TestCase def test_left border = Gtk::Border.new(10, 15, 20, 25) assert_equal(10, border.left) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_image.rb0000644000175000017500000000034712516434313017762 0ustar koukouclass TestGtkImage < Test::Unit::TestCase include GtkTestUtils def test_stock image = Gtk::Image.new(:stock => Gtk::Stock::GO_FORWARD, :size => :dialog) assert_equal(Gtk::Stock::GO_FORWARD.to_s, image.stock) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk.rb0000644000175000017500000000162112516434313016614 0ustar koukou# Copyright (C) 2013 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 class TestGtk < Test::Unit::TestCase include GtkTestUtils def test_show_uri assert_true(Gtk.respond_to?(:show_uri)) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_unix_print.rb0000644000175000017500000000062312516434313021074 0ustar koukouclass TestGtkUnixPrint < Test::Unit::TestCase def test_classes if GLib.os_unix? assertion = :assert_const_defined else assertion = :assert_not_const_defined end send(assertion, Gtk, :PageSetupUnixDialog) send(assertion, Gtk, :Printer) send(assertion, Gtk, :PrintCapabilities) send(assertion, Gtk, :PrintJob) send(assertion, Gtk, :PrintUnixDialog) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_stack_switcher.rb0000644000175000017500000000211512516434313021710 0ustar koukou# Copyright (C) 2014 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 class TestGtkStackSwitcher < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 10, 0) @stack_switcher = Gtk::StackSwitcher.new end def test_stack_switcher_accessors stack = Gtk::Stack.new @stack_switcher.stack = stack assert_equal(stack, @stack_switcher.stack) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_tree_path.rb0000644000175000017500000000076312516434313020655 0ustar koukouclass TestGtkTreePath < Test::Unit::TestCase include GtkTestUtils def test_compare assert_equal(-1, tree_path("0") <=> tree_path("1")) assert_equal(0, tree_path("0") <=> tree_path("0")) assert_equal(1, tree_path("1") <=> tree_path("0")) end def test_equal assert_equal(tree_path("0"), tree_path("0")) assert_not_equal(tree_path("0"), tree_path("1")) assert_not_equal(tree_path("0"), "0") end private def tree_path(path) Gtk::TreePath.new(path) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_search_entry.rb0000644000175000017500000000223712516434313021366 0ustar koukou# Copyright (C) 2014 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 class TestGtkSearchEntry < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 6, 0) @search_entry = Gtk::SearchEntry.new end def test_search_changed_signal only_gtk_version(3, 10, 0) called = false @search_entry.signal_connect("search-changed") do called = true end @search_entry.signal_emit("search-changed") assert_true(called) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_container.rb0000644000175000017500000000214112516434313020654 0ustar koukou# Copyright (C) 2013 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 class TestGtkContainer < Test::Unit::TestCase class TestFocusChain < self def setup @container = Gtk::Layout.new end def test_set_explicitly @container.focus_chain = [] assert_equal([], @container.focus_chain) end def test_not_set_explicitly assert_nil(@container.focus_chain) end end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_menu_button.rb0000644000175000017500000000311212516434313021230 0ustar koukou# Copyright (C) 2014 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 class TestGtkMenuButton < Test::Unit::TestCase include GtkTestUtils def setup only_gtk_version(3, 6, 0) @menu_button = Gtk::MenuButton.new end def test_popup assert_nil(@menu_button.popup) popup = Gtk::Menu.new @menu_button.popup = popup assert_equal(popup, @menu_button.popup) end def test_menu_model assert_nil(@menu_button.menu_model) end def test_direction assert_equal(Gtk::Arrow::Type::DOWN, @menu_button.direction) @menu_button.direction = :up assert_equal(Gtk::Arrow::Type::UP, @menu_button.direction) end def test_align_widget assert_nil(@menu_button.align_widget) align_widget = Gtk::Box.new(:horizontal) align_widget.add(@menu_button) @menu_button.align_widget = align_widget assert_equal(align_widget, @menu_button.align_widget) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_accel_group_entry.rb0000644000175000017500000000167612516434313022412 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkAccelGroupEntry < Test::Unit::TestCase def test_accel_path entry = Gtk::AccelGroupEntry.new assert_nil(entry.accel_path) end end ruby-gnome2-all-2.2.5/gtk3/test/test_gtk_accel_key.rb0000644000175000017500000000164712516434313020623 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkAccelKey < Test::Unit::TestCase def test_flags key = Gtk::AccelKey.new assert_equal(0, key.flags) end end ruby-gnome2-all-2.2.5/gtk3/extconf.rb0000644000175000017500000000222312516434313015456 0ustar koukou#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "gtk3" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ruby-gnome2-all-2.2.5/gtk3/Rakefile0000644000175000017500000000075212516434313015135 0ustar koukou# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2/rake/package-task' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GTK3 is a Ruby binding of GTK+-3.x." package.description = "Ruby/GTK3 is a Ruby binding of GTK+-3.x." package.dependency.gem.runtime = [ "glib2", "gio2", "atk", "pango", "gdk_pixbuf2", "gdk3", ] package.windows.packages = [] package.windows.dependencies = [] end package_task.define ruby-gnome2-all-2.2.5/gtk3/README.md0000644000175000017500000000107512516434313014746 0ustar koukou# Ruby/GTK3 Ruby/GTK3 is a Ruby binding of GTK 3. ## Requirements * Ruby/GLib2, Ruby/ATK, Ruby/Pango, Ruby/GdkPixbuf2 and Ruby/GTK3 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [rcairo](https://github.com/rcairo/rcairo) * [GTK+](http://www.gtk.org/) 3.4.2 or later ## Install gem install gtk3 ## License Copyright (c) 2002-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ ruby-gnome2-all-2.2.5/gtk3/ext/0000755000175000017500000000000011701304107014254 5ustar koukouruby-gnome2-all-2.2.5/gtk3/ext/gtk3/0000755000175000017500000000000012516434313015134 5ustar koukouruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-progress.c0000644000175000017500000000243312516434313022776 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererProgress static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_progress_new()); return Qnil; } void Init_gtk_cellrendererprogress(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_PROGRESS, "CellRendererProgress", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-dragsource.c0000644000175000017500000000203712516434313021504 0ustar koukou/* -*- 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 "rbgtk3private.h" void Init_gtk_treedragsource(VALUE mGtk) { G_DEF_INTERFACE(GTK_TYPE_TREE_DRAG_SOURCE, "TreeDragSource", mGtk); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-tag-table.c0000644000175000017500000000503612516434313021235 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextTagTable #define _SELF(self) (RVAL2GTKTEXTTAGTABLE(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_text_tag_table_new()); return Qnil; } static VALUE rg_add(VALUE self, VALUE tag) { G_CHILD_ADD(self, tag); gtk_text_tag_table_add(_SELF(self), RVAL2GTKTEXTTAG(tag)); return self; } static VALUE rg_remove(VALUE self, VALUE tag) { G_CHILD_REMOVE(self, tag); gtk_text_tag_table_remove(_SELF(self), RVAL2GTKTEXTTAG(tag)); return self; } static VALUE rg_lookup(VALUE self, VALUE name) { VALUE ret = Qnil; GtkTextTag* tag = gtk_text_tag_table_lookup(_SELF(self), RVAL2CSTR(name)); if (tag){ ret = GOBJ2RVAL(tag); G_CHILD_ADD(self, ret); } return ret; } static gboolean txt_tt_foreach_func(GtkTextTag *tag, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 1, GOBJ2RVAL(tag))); } static VALUE rg_each(VALUE self) { volatile VALUE func = rb_block_proc(); gtk_text_tag_table_foreach(_SELF(self), (GtkTextTagTableForeach)txt_tt_foreach_func, (gpointer)func); return self; } static VALUE rg_size(VALUE self) { return INT2NUM(gtk_text_tag_table_get_size(_SELF(self))); } void Init_gtk_text_tag_table(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_TAG_TABLE, "TextTagTable", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, 1); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(lookup, 1); RG_DEF_ALIAS("[]", "lookup"); RG_DEF_METHOD(each, 0); RG_DEF_METHOD(size, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-container.c0000644000175000017500000005414312516434313020400 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cContainer #define _SELF(self) (RVAL2GTKCONTAINER(self)) #define RubyGtkContainerHookModule "RubyGtkContainerHook__" /* 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), RVAL2GTKWIDGET(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 GOBJGLIST2RVAL_FREE(gtk_container_get_children(_SELF(self)), g_list_free, NULL); } 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), RVAL2GTKWIDGET(child)); return self; } static VALUE rg_set_focus_vadjustment(VALUE self, VALUE adjustment) { gtk_container_set_focus_vadjustment(_SELF(self), NIL_P(adjustment) ? NULL : RVAL2GTKADJUSTMENT(adjustment)); return self; } static VALUE rg_set_focus_hadjustment(VALUE self, VALUE adjustment) { gtk_container_set_focus_hadjustment(_SELF(self), NIL_P(adjustment) ? NULL : RVAL2GTKADJUSTMENT(adjustment)); return self; } static VALUE rg_focus_vadjustment(VALUE self) { return GOBJ2RVAL(gtk_container_get_focus_vadjustment(_SELF(self))); } static VALUE rg_focus_hadjustment(VALUE self) { return GOBJ2RVAL(gtk_container_get_focus_hadjustment(_SELF(self))); } 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, ...); */ static 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); } static 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(RVAL2GTKCONTAINER(self), RVAL2GTKWIDGET(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(RVAL2GTKCONTAINER(self), RVAL2GTKWIDGET(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 = RVAL2GTKWIDGET(other); gtk_widget_freeze_child_notify(child); gtk_container_add(_SELF(self), child); G_CHILD_ADD(self, other); if (gtk_widget_get_parent(child) && (! NIL_P(properties))){ int i; VALUE ary; Check_Type(properties, T_HASH); ary = rb_funcall(properties, rb_intern("to_a"), 0); 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); */ /* deprecated static VALUE rg_propagate_expose(VALUE self, VALUE child, VALUE event) { gtk_container_propagate_expose(_SELF(self), RVAL2GTKWIDGET(child), (GdkEventExpose *)RVAL2GEV(event)); return self; } */ static VALUE rg_focus_chain(VALUE self) { gboolean set_explicitly; GList *glist = NULL; set_explicitly = gtk_container_get_focus_chain(_SELF(self), &glist); if (!set_explicitly) { return Qnil; } return GOBJGLIST2RVAL_FREE(glist, g_list_free, NULL); } 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, RVAL2GTKWIDGET(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 = RVAL2GPARAMSPEC(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)) { rbg_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); /* deprecated 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)}"); 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(); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-css-provider.c0000644000175000017500000000661212516434313021034 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCssProvider #define _SELF(self) (RVAL2GTKCSSPROVIDER(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_css_provider_new()); return Qnil; } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_css_provider_get_default()); } static VALUE rg_s_get_named(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE name, variant; GtkCssProvider *provider; rb_scan_args(argc, argv, "11", &name, &variant); provider = gtk_css_provider_get_named(RVAL2CSTR(name), RVAL2CSTR_ACCEPT_NIL(variant)); return GOBJ2RVAL(provider); } static VALUE rg_load(VALUE self, VALUE arg) { gboolean result; GError *error = NULL; if (TYPE(arg) == T_HASH) { VALUE data, file, path; rbg_scan_options(arg, "data", &data, "file", &file, "path", &path, NULL); if (!NIL_P(data)) { StringValue(data); result = gtk_css_provider_load_from_data(_SELF(self), RSTRING_PTR(data), RSTRING_LEN(data), &error); } else if (!NIL_P(file)) { result = gtk_css_provider_load_from_file(_SELF(self), RVAL2GFILE(file), &error); } else if (!NIL_P(path)) { result = gtk_css_provider_load_from_path(_SELF(self), RVAL2CSTR(path), &error); } else { rb_raise(rb_eArgError, "Invalid arguments."); } } else { result = gtk_css_provider_load_from_file(_SELF(self), RVAL2GFILE(arg), &error); } if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } static VALUE rg_to_s(VALUE self) { return CSTR2RVAL(gtk_css_provider_to_string(_SELF(self))); } void Init_gtk_cssprovider(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CSS_PROVIDER, "CssProvider", mGtk); RG_DEF_SMETHOD(default, 0); RG_DEF_SMETHOD(get_named, -1); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(load, 1); RG_DEF_METHOD(to_s, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk.c0000644000175000017500000005650012516434313016417 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #ifdef HAVE_SYS_TIME_H # include #endif #include /* TODO: REMOVE ME */ /* * They are temporary. They will be needless after Ruby/GTK3 * is based on Ruby/GObjectIntrospection. */ /* From Ruby/GDK3 - start */ 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; } 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; } 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, RVAL2GDKPIXBUF(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; } GdkAtom rbgdk_rval2gdkatom(VALUE atom) { if (TYPE(atom) == T_STRING) return gdk_atom_intern(RVAL2CSTR(atom), FALSE); return (RVAL2GDKATOM(atom))->atom; } /* From Ruby/GDK3 - end */ #define RG_TARGET_NAMESPACE mGtk static 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, GObject *gtkobj) { gtkobj = g_object_ref(gtkobj); g_object_ref_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_s_events_pending_p(G_GNUC_UNUSED VALUE self) { return CBOOL2RVAL(gtk_events_pending()); } /* deprecated static VALUE rg_s_set_locale(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gtk_set_locale()); } */ static VALUE rg_s_disable_setlocale(G_GNUC_UNUSED VALUE self) { gtk_disable_setlocale(); return Qnil; } static VALUE rg_s_default_language(G_GNUC_UNUSED VALUE self) { return PANGOLANGUAGE2RVAL(gtk_get_default_language()); } typedef void (*SignalFunc) (int); static gboolean _initialized = FALSE; static VALUE rg_s_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() */ static gboolean quit_loop(G_GNUC_UNUSED gpointer user_data) { gtk_main_quit(); return G_SOURCE_REMOVE; } static VALUE rg_s_main(G_GNUC_UNUSED VALUE self) { GSource *interrupt_source; interrupt_source = rbg_interrupt_source_new(); g_source_set_callback(interrupt_source, quit_loop, NULL, NULL); g_source_attach(interrupt_source, NULL); gtk_main(); g_source_destroy(interrupt_source); g_source_unref(interrupt_source); rb_thread_check_ints(); return Qnil; } static VALUE rg_s_main_level(G_GNUC_UNUSED VALUE self) { return INT2FIX(gtk_main_level()); } static VALUE rg_s_main_quit(G_GNUC_UNUSED VALUE self) { gtk_main_quit(); return Qnil; } static VALUE rg_s_main_iteration(G_GNUC_UNUSED VALUE self) { return CBOOL2RVAL(gtk_main_iteration()); } static VALUE rg_s_main_iteration_do(G_GNUC_UNUSED VALUE self, VALUE blocking) { return CBOOL2RVAL(gtk_main_iteration_do(RVAL2CBOOL(blocking))); } static VALUE rg_s_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_s_grab_add(G_GNUC_UNUSED VALUE self, VALUE widget) { gtk_grab_add(RVAL2GTKWIDGET(widget)); return Qnil; } static VALUE rg_s_current(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_grab_get_current()); } static VALUE rg_s_grab_remove(G_GNUC_UNUSED VALUE self, VALUE widget) { gtk_grab_remove(RVAL2GTKWIDGET(widget)); return Qnil; } 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_s_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_s_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_s_current_event(G_GNUC_UNUSED VALUE self) { return GEV2RVAL(gtk_get_current_event()); } static VALUE rg_s_current_event_time(G_GNUC_UNUSED VALUE self) { return INT2NUM(gtk_get_current_event_time()); } static VALUE rg_s_current_event_state(G_GNUC_UNUSED VALUE self) { GdkModifierType state; gboolean ret = gtk_get_current_event_state(&state); return ret ? GDKMODIFIERTYPE2RVAL(state) : Qnil; } static VALUE rg_s_propagate_event(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE event) { gtk_propagate_event(RVAL2GTKWIDGET(widget), RVAL2GEV(event)); return Qnil; } static VALUE rg_s_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_s_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); } static VALUE rg_s_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; } void Init_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_SMETHOD_P(events_pending, 0); /* deprecated RG_DEF_SMETHOD(set_locale, 0); */ RG_DEF_SMETHOD(disable_setlocale, 0); RG_DEF_SMETHOD(default_language, 0); RG_DEF_SMETHOD(init, -1); RG_DEF_SMETHOD(main, 0); RG_DEF_SMETHOD(main_level, 0); RG_DEF_SMETHOD(main_quit, 0); RG_DEF_SMETHOD(main_iteration, 0); RG_DEF_SMETHOD(main_iteration_do, 1); RG_DEF_SMETHOD(main_do_event, 1); RG_DEF_SMETHOD(grab_add, 1); RG_DEF_SMETHOD(current, 0); RG_DEF_SMETHOD(grab_remove, 1); RG_DEF_SMETHOD(key_snooper_install, 0); RG_DEF_SMETHOD(key_snooper_remove, 1); RG_DEF_SMETHOD(current_event, 0); RG_DEF_SMETHOD(current_event_time, 0); RG_DEF_SMETHOD(current_event_state, 0); RG_DEF_SMETHOD(propagate_event, 2); RG_DEF_SMETHOD(check_version, 3); RG_DEF_SMETHOD_P(check_version, 3); RG_DEF_SMETHOD(show_uri, 1); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_RESIZE", INT2FIX(GTK_PRIORITY_RESIZE)); Init_gtk_gdk_event(); Init_gtk_drag_gdk_drag_context(); Init_gtk_style_context_gdk_screen(); Init_gtk_tooltip_gdk_display(); Init_gtk_aboutdialog(RG_TARGET_NAMESPACE); Init_gtk_accelerator(RG_TARGET_NAMESPACE); Init_gtk_accel_group(RG_TARGET_NAMESPACE); Init_gtk_accel_group_entry(RG_TARGET_NAMESPACE); Init_gtk_accel_key(RG_TARGET_NAMESPACE); Init_gtk_accel_label(RG_TARGET_NAMESPACE); Init_gtk_accel_map(RG_TARGET_NAMESPACE); Init_gtk_accessible(RG_TARGET_NAMESPACE); Init_gtk_action(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 12, 0) Init_gtk_action_bar(RG_TARGET_NAMESPACE); #endif Init_gtk_actiongroup(RG_TARGET_NAMESPACE); Init_gtk_activatable(RG_TARGET_NAMESPACE); Init_gtk_adjustment(RG_TARGET_NAMESPACE); Init_gtk_alignment(RG_TARGET_NAMESPACE); Init_gtk_allocation(RG_TARGET_NAMESPACE); Init_gtk_appchooser(RG_TARGET_NAMESPACE); Init_gtk_appchooserbutton(RG_TARGET_NAMESPACE); Init_gtk_appchooserdialog(RG_TARGET_NAMESPACE); Init_gtk_appchooserwidget(RG_TARGET_NAMESPACE); Init_gtk_application(RG_TARGET_NAMESPACE); Init_gtk_arrow(RG_TARGET_NAMESPACE); Init_gtk_aspect_frame(RG_TARGET_NAMESPACE); Init_gtk_assistant(RG_TARGET_NAMESPACE); Init_gtk_button_box(RG_TARGET_NAMESPACE); Init_gtk_bin(RG_TARGET_NAMESPACE); Init_gtk_bindings(RG_TARGET_NAMESPACE); Init_gtk_border(RG_TARGET_NAMESPACE); Init_gtk_box(RG_TARGET_NAMESPACE); Init_gtk_buildable(RG_TARGET_NAMESPACE); Init_gtk_builder(RG_TARGET_NAMESPACE); Init_gtk_button(RG_TARGET_NAMESPACE); Init_gtk_calendar(RG_TARGET_NAMESPACE); Init_gtk_celleditable(RG_TARGET_NAMESPACE); Init_gtk_celllayout(RG_TARGET_NAMESPACE); Init_gtk_cellrenderer(RG_TARGET_NAMESPACE); Init_gtk_cellrendereraccel(RG_TARGET_NAMESPACE); Init_gtk_cellrenderercombo(RG_TARGET_NAMESPACE); Init_gtk_cellrendererpixbuf(RG_TARGET_NAMESPACE); Init_gtk_cellrendererprogress(RG_TARGET_NAMESPACE); Init_gtk_cellrendererspin(RG_TARGET_NAMESPACE); Init_gtk_cellrendererspinner(RG_TARGET_NAMESPACE); Init_gtk_cellrenderertext(RG_TARGET_NAMESPACE); Init_gtk_cellrenderertoggle(RG_TARGET_NAMESPACE); Init_gtk_cellview(RG_TARGET_NAMESPACE); Init_gtk_check_button(RG_TARGET_NAMESPACE); Init_gtk_check_menu_item(RG_TARGET_NAMESPACE); Init_gtk_clipboard(RG_TARGET_NAMESPACE); Init_gtk_colorbutton(RG_TARGET_NAMESPACE); Init_gtk_color_selection(RG_TARGET_NAMESPACE); Init_gtk_color_selection_dialog(RG_TARGET_NAMESPACE); Init_gtk_combobox(RG_TARGET_NAMESPACE); Init_gtk_comboboxtext(RG_TARGET_NAMESPACE); Init_gtk_const(RG_TARGET_NAMESPACE); Init_gtk_container(RG_TARGET_NAMESPACE); Init_gtk_cssprovider(RG_TARGET_NAMESPACE); Init_gtk_dialog(RG_TARGET_NAMESPACE); Init_gtk_drag(RG_TARGET_NAMESPACE); Init_gtk_drawing_area(RG_TARGET_NAMESPACE); Init_gtk_editable(RG_TARGET_NAMESPACE); Init_gtk_entry(RG_TARGET_NAMESPACE); Init_gtk_entrybuffer(RG_TARGET_NAMESPACE); Init_gtk_entry_completion(RG_TARGET_NAMESPACE); Init_gtk_eventbox(RG_TARGET_NAMESPACE); Init_gtk_expander(RG_TARGET_NAMESPACE); Init_gtk_file_chooser(RG_TARGET_NAMESPACE); Init_gtk_filesystemerror(RG_TARGET_NAMESPACE); Init_gtk_filechooserbutton(RG_TARGET_NAMESPACE); Init_gtk_file_chooser_dialog(RG_TARGET_NAMESPACE); Init_gtk_file_chooser_widget(RG_TARGET_NAMESPACE); Init_gtk_file_filter(RG_TARGET_NAMESPACE); Init_gtk_fixed(RG_TARGET_NAMESPACE); Init_gtk_fontbutton(RG_TARGET_NAMESPACE); Init_gtk_fontchooser(RG_TARGET_NAMESPACE); Init_gtk_fontchooserdialog(RG_TARGET_NAMESPACE); Init_gtk_fontchooserwidget(RG_TARGET_NAMESPACE); Init_gtk_frame(RG_TARGET_NAMESPACE); Init_gtk_grid(RG_TARGET_NAMESPACE); Init_gtk_handle_box(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 10, 0) Init_gtk_header_bar(RG_TARGET_NAMESPACE); #endif Init_gtk_hsv(RG_TARGET_NAMESPACE); Init_gtk_icon_factory(RG_TARGET_NAMESPACE); Init_gtk_icon_info(RG_TARGET_NAMESPACE); Init_gtk_icon_set(RG_TARGET_NAMESPACE); Init_gtk_icon_size(RG_TARGET_NAMESPACE); Init_gtk_icon_source(RG_TARGET_NAMESPACE); Init_gtk_icon_theme(RG_TARGET_NAMESPACE); Init_gtk_iconview(RG_TARGET_NAMESPACE); Init_gtk_image(RG_TARGET_NAMESPACE); Init_gtk_image_menu_item(RG_TARGET_NAMESPACE); Init_gtk_imcontext(RG_TARGET_NAMESPACE); Init_gtk_imcontext_simple(RG_TARGET_NAMESPACE); Init_gtk_im_multicontext(RG_TARGET_NAMESPACE); Init_gtk_infobar(RG_TARGET_NAMESPACE); Init_gtk_invisible(RG_TARGET_NAMESPACE); Init_gtk_label(RG_TARGET_NAMESPACE); Init_gtk_layout(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 6, 0) Init_gtk_level_bar(RG_TARGET_NAMESPACE); #endif Init_gtk_link_button(RG_TARGET_NAMESPACE); Init_gtk_list_store(RG_TARGET_NAMESPACE); Init_gtk_lockbutton(RG_TARGET_NAMESPACE); Init_gtk_menu(RG_TARGET_NAMESPACE); Init_gtk_menu_bar(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 6, 0) Init_gtk_menu_button(RG_TARGET_NAMESPACE); #endif Init_gtk_menu_item(RG_TARGET_NAMESPACE); Init_gtk_menu_shell(RG_TARGET_NAMESPACE); Init_gtk_menutoolbutton(RG_TARGET_NAMESPACE); Init_gtk_message_dialog(RG_TARGET_NAMESPACE); Init_gtk_misc(RG_TARGET_NAMESPACE); Init_gtk_notebook(RG_TARGET_NAMESPACE); Init_gtk_numerableicon(RG_TARGET_NAMESPACE); Init_gtk_orientable(RG_TARGET_NAMESPACE); Init_gtk_overlay(RG_TARGET_NAMESPACE); Init_gtk_page_setup(RG_TARGET_NAMESPACE); Init_gtk_page_setup_unix_dialog(RG_TARGET_NAMESPACE); Init_gtk_paned(RG_TARGET_NAMESPACE); Init_gtk_paper_size(RG_TARGET_NAMESPACE); Init_gtk_plug(RG_TARGET_NAMESPACE); Init_gtk_print_context(RG_TARGET_NAMESPACE); Init_gtk_printer(RG_TARGET_NAMESPACE); Init_gtk_print_job(RG_TARGET_NAMESPACE); Init_gtk_print_operation(RG_TARGET_NAMESPACE); Init_gtk_print_operation_preview(RG_TARGET_NAMESPACE); Init_gtk_print_settings(RG_TARGET_NAMESPACE); Init_gtk_print_unix_dialog(RG_TARGET_NAMESPACE); Init_gtk_progress_bar(RG_TARGET_NAMESPACE); Init_gtk_radio_action(RG_TARGET_NAMESPACE); Init_gtk_radio_button(RG_TARGET_NAMESPACE); Init_gtk_radio_menu_item(RG_TARGET_NAMESPACE); Init_gtk_radiotoolbutton(RG_TARGET_NAMESPACE); Init_gtk_range(RG_TARGET_NAMESPACE); Init_gtk_recentaction(RG_TARGET_NAMESPACE); Init_gtk_recent_chooser(RG_TARGET_NAMESPACE); Init_gtk_recent_chooser_dialog(RG_TARGET_NAMESPACE); Init_gtk_recent_chooser_menu(RG_TARGET_NAMESPACE); Init_gtk_recent_chooser_widget(RG_TARGET_NAMESPACE); Init_gtk_recent_data(RG_TARGET_NAMESPACE); Init_gtk_recent_filter(RG_TARGET_NAMESPACE); Init_gtk_recent_filter_info(RG_TARGET_NAMESPACE); Init_gtk_recent_info(RG_TARGET_NAMESPACE); Init_gtk_recent_manager(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 10, 0) Init_gtk_revealer(RG_TARGET_NAMESPACE); #endif Init_gtk_scale(RG_TARGET_NAMESPACE); Init_gtk_scalebutton(RG_TARGET_NAMESPACE); Init_gtk_scrollable(RG_TARGET_NAMESPACE); Init_gtk_scrollbar(RG_TARGET_NAMESPACE); Init_gtk_scrolled_window(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 10, 0) Init_gtk_search_bar(RG_TARGET_NAMESPACE); #endif #if GTK_CHECK_VERSION(3, 6, 0) Init_gtk_search_entry(RG_TARGET_NAMESPACE); #endif Init_gtk_selection(RG_TARGET_NAMESPACE); Init_gtk_selectiondata(RG_TARGET_NAMESPACE); Init_gtk_separator(RG_TARGET_NAMESPACE); Init_gtk_separator_menu_item(RG_TARGET_NAMESPACE); Init_gtk_separatortoolitem(RG_TARGET_NAMESPACE); Init_gtk_settings(RG_TARGET_NAMESPACE); Init_gtk_size_group(RG_TARGET_NAMESPACE); Init_gtk_socket(RG_TARGET_NAMESPACE); Init_gtk_spin_button(RG_TARGET_NAMESPACE); Init_gtk_spinner(RG_TARGET_NAMESPACE); #if GTK_CHECK_VERSION(3, 10, 0) Init_gtk_stack(RG_TARGET_NAMESPACE); Init_gtk_stack_switcher(RG_TARGET_NAMESPACE); #endif Init_gtk_statusbar(RG_TARGET_NAMESPACE); Init_gtk_status_icon(RG_TARGET_NAMESPACE); Init_gtk_stock(RG_TARGET_NAMESPACE); Init_gtk_stylecontext(RG_TARGET_NAMESPACE); Init_gtk_styleproperties(RG_TARGET_NAMESPACE); Init_gtk_styleprovider(RG_TARGET_NAMESPACE); Init_gtk_switch(RG_TARGET_NAMESPACE); Init_gtk_table(RG_TARGET_NAMESPACE); Init_gtk_target_list(RG_TARGET_NAMESPACE); Init_gtk_tearoff_menu_item(RG_TARGET_NAMESPACE); Init_gtk_text_appearance(RG_TARGET_NAMESPACE); Init_gtk_text_attributes(RG_TARGET_NAMESPACE); Init_gtk_textbuffer(RG_TARGET_NAMESPACE); Init_gtk_textchild(RG_TARGET_NAMESPACE); Init_gtk_textiter(RG_TARGET_NAMESPACE); Init_gtk_textmark(RG_TARGET_NAMESPACE); Init_gtk_texttag(RG_TARGET_NAMESPACE); Init_gtk_text_tag_table(RG_TARGET_NAMESPACE); Init_gtk_textview(RG_TARGET_NAMESPACE); Init_gtk_themingengine(RG_TARGET_NAMESPACE); Init_gtk_toggle_action(RG_TARGET_NAMESPACE); Init_gtk_toggle_button(RG_TARGET_NAMESPACE); Init_gtk_toggletoolbutton(RG_TARGET_NAMESPACE); Init_gtk_toolbar(RG_TARGET_NAMESPACE); Init_gtk_toolbutton(RG_TARGET_NAMESPACE); Init_gtk_toolitem(RG_TARGET_NAMESPACE); Init_gtk_toolitemgroup(RG_TARGET_NAMESPACE); Init_gtk_toolshell(RG_TARGET_NAMESPACE); Init_gtk_tooltip(RG_TARGET_NAMESPACE); Init_gtk_treedragdest(RG_TARGET_NAMESPACE); Init_gtk_treedragsource(RG_TARGET_NAMESPACE); Init_gtk_treeiter(RG_TARGET_NAMESPACE); Init_gtk_treemodel(RG_TARGET_NAMESPACE); Init_gtk_treemodelfilter(RG_TARGET_NAMESPACE); Init_gtk_tmodelsort(RG_TARGET_NAMESPACE); Init_gtk_treepath(RG_TARGET_NAMESPACE); Init_gtk_treerowreference(RG_TARGET_NAMESPACE); Init_gtk_treeselection(RG_TARGET_NAMESPACE); Init_gtk_treesortable(RG_TARGET_NAMESPACE); Init_gtk_tree_store(RG_TARGET_NAMESPACE); Init_gtk_treeview(RG_TARGET_NAMESPACE); Init_gtk_treeviewcolumn(RG_TARGET_NAMESPACE); Init_gtk_uimanager(RG_TARGET_NAMESPACE); Init_gtk_viewport(RG_TARGET_NAMESPACE); Init_gtk_volumebutton(RG_TARGET_NAMESPACE); Init_gtk_widget(RG_TARGET_NAMESPACE); Init_gtk_widgetpath(RG_TARGET_NAMESPACE); Init_gtk_window(RG_TARGET_NAMESPACE); Init_gtk_windowgroup(RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-store.c0000644000175000017500000002275312516434313020511 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2012 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeStore #define _SELF(s) (RVAL2GTKTREESTORE(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { gint cnt; GtkTreeStore* store; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } store = gtk_tree_store_newv(argc, buf); G_INITIALIZE(self, store); return Qnil; } static VALUE rg_set_column_types(int argc, VALUE *argv, VALUE self) { gint cnt; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } gtk_tree_store_set_column_types(_SELF(self), argc, buf); return self; } static VALUE rg_set_value(VALUE self, VALUE iter, VALUE column, VALUE value) { GType gtype = gtk_tree_model_get_column_type(RVAL2GTKTREEMODEL(self), NUM2INT(column)); GValue gval = G_VALUE_INIT; g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(value, &gval); G_CHILD_ADD(self, iter); G_CHILD_ADD(iter, value); gtk_tree_store_set_value(_SELF(self), RVAL2GTKTREEITER(iter), NUM2INT(column), &gval); g_value_unset(&gval); return self; } static VALUE rg_remove(VALUE self, VALUE iter) { G_CHILD_REMOVE(self, iter); return CBOOL2RVAL(gtk_tree_store_remove(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { VALUE parent, position, values, ret; GtkTreeIter iter; GtkTreeStore* model = _SELF(self); rb_scan_args(argc, argv, "21", &parent, &position, &values); if (NIL_P(values)){ gtk_tree_store_insert(model, &iter, NIL_P(parent) ? NULL : RVAL2GTKTREEITER(parent), NUM2INT(position)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); } else { gint *c_columns; GValue *c_values; long size, i; size = NUM2INT(rb_funcall(values, rb_intern("size"), 0)); c_columns = ALLOCA_N(gint, size); c_values = ALLOCA_N(GValue, size); if(TYPE(values)==T_ARRAY) { for(i=0; i 0) { if (TYPE(label) == T_STRING){ if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){ widget = gtk_toggle_button_new_with_mnemonic(RVAL2CSTR(label)); } else { widget = gtk_toggle_button_new_with_label(RVAL2CSTR(label)); } } else if (TYPE(label) == T_SYMBOL){ widget = gtk_toggle_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_toggle_button_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_set_mode(VALUE self, VALUE mode) { gtk_toggle_button_set_mode(RVAL2GTKTOGGLEBUTTON(self), RVAL2CBOOL(mode)); return self; } static VALUE rg_mode_p(VALUE self) { return CBOOL2RVAL(gtk_toggle_button_get_mode(RVAL2GTKTOGGLEBUTTON(self))); } static VALUE rg_toggled(VALUE self) { gtk_toggle_button_toggled(RVAL2GTKTOGGLEBUTTON(self)); return self; } void Init_gtk_toggle_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOGGLE_BUTTON, "ToggleButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_mode, 1); RG_DEF_METHOD_P(mode, 0); RG_DEF_METHOD(toggled, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-style-provider.c0000644000175000017500000000435012516434313021401 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mStyleProvider #define _SELF(self) (RVAL2GTKSTYLEPROVIDER(self)) static VALUE rg_get_icon_factory(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_style_provider_get_icon_factory(_SELF(self), RVAL2GTKWIDGETPATH(path))); } static VALUE rg_get_style(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_style_provider_get_style(_SELF(self), RVAL2GTKWIDGETPATH(path))); } static VALUE rg_get_style_property(VALUE self, VALUE path, VALUE state, VALUE pspec) { GValue value = G_VALUE_INIT; gboolean exist; VALUE property = Qnil; exist = gtk_style_provider_get_style_property(_SELF(self), RVAL2GTKWIDGETPATH(path), RVAL2GTKSTATEFLAGS(state), RVAL2GPARAMSPEC(pspec), &value); if (exist) { property = GVAL2RVAL_UNSET(&value); } return property; } void Init_gtk_styleprovider(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_STYLE_PROVIDER, "StyleProvider", mGtk); RG_DEF_METHOD(get_icon_factory, 1); RG_DEF_METHOD(get_style, 1); RG_DEF_METHOD(get_style_property, 3); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-radio-action.c0000644000175000017500000000743512516434313020771 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRadioAction #define _SELF(self) (RVAL2GTKRADIOACTION(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name, value, options, label, tooltip, stock_id, buffer; rb_scan_args(argc, argv, "21", &name, &value, &options); rbg_scan_options(options, "label", &label, "tooltip", &tooltip, "stock_id", &stock_id, NULL); G_INITIALIZE(self, gtk_radio_action_new(RVAL2CSTR(name), RVAL2CSTR_ACCEPT_NIL(label), RVAL2CSTR_ACCEPT_NIL(tooltip), RVAL2GLIBID_ACCEPT_NIL(stock_id, buffer), NUM2INT(value))); return Qnil; } static VALUE raction_get_group(VALUE self) { return GOBJGSLIST2RVAL(gtk_radio_action_get_group(_SELF(self))); } struct rbgtk_rval2gtkradioactiongslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbgtk_rval2gtkradioactiongslist_body(VALUE value) { long i; struct rbgtk_rval2gtkradioactiongslist_args *args = (struct rbgtk_rval2gtkradioactiongslist_args *)value; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, RVAL2GTKRADIOACTION(RARRAY_PTR(args->ary)[i])); return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkradioactiongslist_rescue(VALUE value) { g_slist_free(((struct rbgtk_rval2gtkradioactiongslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbgtk_rval2gtkradioactiongslist(VALUE value) { struct rbgtk_rval2gtkradioactiongslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbgtk_rval2gtkradioactiongslist_body, (VALUE)&args, rbgtk_rval2gtkradioactiongslist_rescue, (VALUE)&args); return args.result; } #define RVAL2GTKRADIOACTIONGSLIST(value) rbgtk_rval2gtkradioactiongslist(value) static VALUE raction_set_group(VALUE self, VALUE rbgroup) { GtkRadioAction *action = _SELF(self); /* TODO: This might leak. Use gtk_radio_action_join_group() in 3.0. */ if (TYPE(rbgroup) == T_ARRAY) gtk_radio_action_set_group(action, RVAL2GTKRADIOACTIONGSLIST(rbgroup)); else if (NIL_P(rbgroup)) gtk_radio_action_set_group(action, NULL); else gtk_radio_action_set_group(action, gtk_radio_action_get_group(RVAL2GTKRADIOACTION(rbgroup))); return self; } void Init_gtk_radio_action(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_ACTION, "RadioAction", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "group", raction_get_group, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "group", raction_set_group, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-font-button.c0000644000175000017500000000274512516434313020676 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFontButton static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE fontname; GtkWidget* widget; rb_scan_args(argc, argv, "01", &fontname); if (NIL_P(fontname)){ widget = gtk_font_button_new(); } else { widget = gtk_font_button_new_with_font(RVAL2CSTR(fontname)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_fontbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FONT_BUTTON, "FontButton", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-print-job.c0000644000175000017500000000722512516434313020321 0ustar koukou/* -*- 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 "rbgtk3private.h" #ifdef HAVE_GTK_UNIX_PRINT #include #ifndef GTK_TYPE_PRINT_CAPABILITIES # define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type()) #endif #ifdef HAVE_RB_CAIRO_H # include #endif #define RG_TARGET_NAMESPACE cPrintJob #define _SELF(s) (RVAL2GTKPRINTJOB(s)) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_initialize(VALUE self, VALUE title, VALUE printer, VALUE settings, VALUE page_setup) { GtkPrintJob *job; job = gtk_print_job_new(RVAL2CSTR(title), RVAL2GTKPRINTER(printer), RVAL2GTKPRINTSETTINGS(settings), RVAL2GTKPAGESETUP(page_setup)); G_INITIALIZE(self, job); return Qnil; } static VALUE rg_status(VALUE self) { return GTKPRINTSTATUS2RVAL(gtk_print_job_get_status(_SELF(self))); } static VALUE rg_set_source_file(VALUE self, VALUE filename) { GError *error = NULL; gboolean result; result = gtk_print_job_set_source_file(_SELF(self), RVAL2CSTR(filename), &error); if (!result) RAISE_GERROR(error); return Qnil; } #ifdef HAVE_RB_CAIRO_H static VALUE rg_surface(VALUE self) { cairo_surface_t *surface; GError *error = NULL; surface = gtk_print_job_get_surface(_SELF(self), &error); if (error) RAISE_GERROR(error); return CRSURFACE2RVAL(surface); } #endif struct callback_arg { VALUE callback; VALUE job; GError* error; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; if (arg->error) RAISE_GERROR(arg->error); rb_funcall(arg->callback, id_call, 1, arg->job); return Qnil; } static void complete_func(GtkPrintJob *job, gpointer data, const GError *error) { struct callback_arg arg; arg.callback = (VALUE)data; arg.job = GOBJ2RVAL(job); arg.error = error; G_PROTECT_CALLBACK(invoke_callback, &arg); } static void remove_callback_reference(gpointer data) { G_CHILD_REMOVE(RG_TARGET_NAMESPACE, (VALUE)data); } static VALUE rg_send(VALUE self) { VALUE block = rb_block_proc(); G_CHILD_ADD(RG_TARGET_NAMESPACE, block); gtk_print_job_send(_SELF(self), complete_func, (gpointer)block, remove_callback_reference); return self; } #endif void Init_gtk_print_job(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_JOB, "PrintJob", mGtk); G_DEF_CLASS(GTK_TYPE_PRINT_CAPABILITIES, "PrintCapabilities", mGtk); RG_DEF_METHOD(initialize, 4); RG_DEF_METHOD(status, 0); RG_DEF_METHOD(set_source_file, 1); #ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(surface, 0); #endif RG_DEF_METHOD(send, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-widget-path.c0000644000175000017500000001337212516434313020632 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cWidgetPath #define _SELF(self) (RVAL2GTKWIDGETPATH(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_widget_path_new()); return Qnil; } static VALUE rg_append_type(VALUE self, VALUE type) { gint pos; pos = gtk_widget_path_append_type(_SELF(self), CLASS2GTYPE(type)); return INT2NUM(pos); } static VALUE rg_object_type(VALUE self) { return GTYPE2CLASS(gtk_widget_path_get_object_type(_SELF(self))); } static VALUE rg_has_parent_p(VALUE self, VALUE type) { return CBOOL2RVAL(gtk_widget_path_has_parent(_SELF(self), CLASS2GTYPE(type))); } static VALUE rg_type_p(VALUE self, VALUE type) { return CBOOL2RVAL(gtk_widget_path_is_type(_SELF(self), CLASS2GTYPE(type))); } static VALUE rg_iter_add_class(VALUE self, VALUE pos, VALUE name) { gtk_widget_path_iter_add_class(_SELF(self), NUM2INT(pos), RVAL2CSTR(name)); return self; } static VALUE rg_iter_add_region(VALUE self, VALUE pos, VALUE name, VALUE flags) { gtk_widget_path_iter_add_region(_SELF(self), NUM2INT(pos), RVAL2CSTR(name), RVAL2GTKREGIONFLAGS(flags)); return self; } static VALUE rg_iter_clear_classes(VALUE self, VALUE pos) { gtk_widget_path_iter_clear_classes(_SELF(self), NUM2INT(pos)); return self; } static VALUE rg_iter_clear_regions(VALUE self, VALUE pos) { gtk_widget_path_iter_clear_regions(_SELF(self), NUM2INT(pos)); return self; } static VALUE rg_iter_get_name(VALUE self, VALUE pos) { return CSTR2RVAL(gtk_widget_path_iter_get_name(_SELF(self), NUM2INT(pos))); } static VALUE rg_iter_get_object_type(VALUE self, VALUE pos) { return GTYPE2CLASS(gtk_widget_path_iter_get_object_type(_SELF(self), NUM2INT(pos))); } static VALUE rg_iter_has_class_p(VALUE self, VALUE pos, VALUE name) { return CBOOL2RVAL(gtk_widget_path_iter_has_class(_SELF(self), NUM2INT(pos), RVAL2CSTR(name))); } static VALUE rg_iter_has_name_p(VALUE self, VALUE pos, VALUE name) { return CBOOL2RVAL(gtk_widget_path_iter_has_name(_SELF(self), NUM2INT(pos), RVAL2CSTR(name))); } static VALUE rg_iter_has_region(VALUE self, VALUE pos, VALUE name) { GtkRegionFlags flags; gboolean result; result = gtk_widget_path_iter_has_region(_SELF(self), NUM2INT(pos), RVAL2CSTR(name), &flags); return result ? GTKREGIONFLAGS2RVAL(flags) : Qnil; } static VALUE rg_iter_list_classes(VALUE self, VALUE pos) { return CSTRGSLIST2RVAL_FREE(gtk_widget_path_iter_list_classes(_SELF(self), NUM2INT(pos)), g_slist_free, NULL); } static VALUE rg_iter_list_regions(VALUE self, VALUE pos) { return CSTRGSLIST2RVAL_FREE(gtk_widget_path_iter_list_regions(_SELF(self), NUM2INT(pos)), g_slist_free, NULL); } static VALUE rg_iter_remove_class(VALUE self, VALUE pos, VALUE name) { gtk_widget_path_iter_remove_class(_SELF(self), NUM2INT(pos), RVAL2CSTR(name)); return self; } static VALUE rg_iter_remove_region(VALUE self, VALUE pos, VALUE name) { gtk_widget_path_iter_remove_region(_SELF(self), NUM2INT(pos), RVAL2CSTR(name)); return self; } static VALUE rg_iter_set_name(VALUE self, VALUE pos, VALUE name) { gtk_widget_path_iter_set_name(_SELF(self), NUM2INT(pos), RVAL2CSTR(name)); return self; } static VALUE rg_iter_set_object_type(VALUE self, VALUE pos, VALUE type) { gtk_widget_path_iter_set_object_type(_SELF(self), NUM2INT(pos), CLASS2GTYPE(type)); return self; } static VALUE rg_length(VALUE self) { return INT2NUM(gtk_widget_path_length(_SELF(self))); } static VALUE rg_prepend_type(VALUE self, VALUE type) { gtk_widget_path_prepend_type(_SELF(self), CLASS2GTYPE(type)); return self; } #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_to_s(VALUE self) { return CSTR2RVAL(gtk_widget_path_to_string(_SELF(self))); } #endif void Init_gtk_widgetpath(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WIDGET_PATH, "WidgetPath", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_type, 1); RG_DEF_METHOD_P(has_parent, 1); RG_DEF_METHOD(iter_add_class, 2); RG_DEF_METHOD(iter_add_region, 3); RG_DEF_METHOD(iter_clear_classes, 1); RG_DEF_METHOD(iter_clear_regions, 1); RG_DEF_METHOD(iter_get_name, 1); RG_DEF_METHOD(iter_get_object_type, 1); RG_DEF_METHOD_P(iter_has_class, 2); RG_DEF_METHOD_P(iter_has_name, 2); RG_DEF_METHOD(iter_has_region, 2); RG_DEF_METHOD(iter_list_classes, 1); RG_DEF_METHOD(iter_list_regions, 1); RG_DEF_METHOD(iter_remove_class, 2); RG_DEF_METHOD(iter_remove_region, 2); RG_DEF_METHOD(iter_set_name, 2); RG_DEF_METHOD(iter_set_object_type, 2); RG_DEF_METHOD(length, 0); RG_DEF_METHOD(object_type, 0); RG_DEF_METHOD(prepend_type, 1); #if GTK_CHECK_VERSION(3, 2, 0) RG_DEF_METHOD(to_s, 0); #endif RG_DEF_METHOD_P(type, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-view.c0000644000175000017500000000567212516434313020310 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellView #define _SELF(self) (RVAL2GTKCELLVIEW(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(RVAL2GDKPIXBUF(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))); } /* Use Gtk::CellView#background_gdk(Gdk::Color) instead. void gtk_cell_view_set_background_color (GtkCellView *cell_view, const GdkColor *color); */ void Init_gtk_cellview(VALUE mGtk) { 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); RG_DEF_METHOD(displayed_row, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-color-selection.c0000644000175000017500000001276212516434313021520 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cColorSelection #define _SELF(self) (RVAL2GTKCOLORSELECTION(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); } 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; } static VALUE rg_previous_rgba(VALUE self) { GdkRGBA rgba; gtk_color_selection_get_previous_rgba(_SELF(self), &rgba); return GDKRGBA2RVAL(&rgba); } static VALUE rg_set_previous_rgba(VALUE self, VALUE rgba) { gtk_color_selection_set_previous_rgba(_SELF(self), RVAL2GDKRGBA(rgba)); return self; } 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); RG_DEF_SMETHOD(set_change_palette_hook, 0); RG_DEF_METHOD(previous_rgba, 0); RG_DEF_METHOD(set_previous_rgba, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-image-menu-item.c0000644000175000017500000000453212516434313021373 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cImageMenuItem static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE image; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &image); if (NIL_P(image)) { widget = gtk_image_menu_item_new(); } else if (TYPE(image) == T_HASH) { VALUE label, mnemonic, stock_id, accel_group, buffer; rbg_scan_options(image, "label", &label, "mnemonic", &mnemonic, "stock_id", &stock_id, "accel_group", &accel_group, NULL); if (!NIL_P(label)) widget = gtk_image_menu_item_new_with_label(RVAL2CSTR(label)); else if (!NIL_P(mnemonic)) widget = gtk_image_menu_item_new_with_mnemonic(RVAL2CSTR(mnemonic)); else if (!NIL_P(stock_id)) widget = gtk_image_menu_item_new_from_stock(RVAL2GLIBID(stock_id, buffer), NIL_P(accel_group) ? NULL : RVAL2GTKACCELGROUP(accel_group)); } if (!widget) rb_raise(rb_eArgError, "Invalid arguments."); RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_image_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IMAGE_MENU_ITEM, "ImageMenuItem", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-binding-set.c0000644000175000017500000001123112516434313020610 0ustar koukou/* -*- 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 "rbgtk3private.h" /*****************************************/ 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) (RVAL2GTKBINDINGSET(s)) 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 GTKBINDINGSET2RVAL(gtk_binding_set_find(RVAL2CSTR(set_name))); } static VALUE rg_activate(VALUE self, VALUE keyval, VALUE modifiers, VALUE object) { return CBOOL2RVAL(gtk_binding_set_activate(_SELF(self), NUM2UINT(keyval), RVAL2GDKMODIFIERTYPE(modifiers), RVAL2GOBJ(object))); } 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), RVAL2GDKMODIFIERTYPE(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_entry_remove(VALUE self, VALUE keyval, VALUE modifiers) { gtk_binding_entry_remove(_SELF(self), NUM2UINT(keyval), RVAL2GDKMODIFIERTYPE(modifiers)); return self; } static VALUE rg_entry_skip(VALUE self, VALUE keyval, VALUE modifiers) { gtk_binding_entry_skip(_SELF(self), NUM2UINT(keyval), RVAL2GDKMODIFIERTYPE(modifiers)); return self; } 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(add_signal, -1); RG_DEF_ALIAS("entry_add_signal", "add_signal"); RG_DEF_METHOD(entry_remove, 2); RG_DEF_METHOD(entry_skip, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-stock.c0000644000175000017500000003035012516434313017533 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 KUBO Takehiro * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mStock /* check whether sym is a Symbol or not in advance. */ #define CSTR2SYM(str) ID2SYM(rb_intern(str)) static VALUE rg_s_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE stock_id, label, modifier, keyval, translation_domain, buffer; GtkStockItem item; rb_scan_args(argc, argv, "23", &stock_id, &label, &modifier, &keyval, &translation_domain); item.stock_id = (gchar *)RVAL2GLIBID(stock_id, buffer); item.label = (gchar *)RVAL2CSTR(label); item.modifier = NIL_P(modifier) ? 0 : NUM2UINT(modifier); item.keyval = NIL_P(keyval) ? 0 : NUM2UINT(keyval); item.translation_domain = (gchar *)RVAL2CSTR_ACCEPT_NIL(translation_domain); gtk_stock_add(&item, 1); return Qnil; } static VALUE rg_s_lookup(G_GNUC_UNUSED VALUE self, VALUE stock_id) { VALUE buffer; const gchar *id = RVAL2GLIBID(stock_id, buffer); GtkStockItem item; if (gtk_stock_lookup(id, &item)) { return rb_ary_new3(5, CSTR2SYM(item.stock_id), CSTR2RVAL(item.label), UINT2NUM(item.modifier), UINT2NUM(item.keyval), CSTR2RVAL(item.translation_domain)); } rb_raise(rb_eArgError, "no such stock-id: %s", id); } static VALUE rg_s_ids(G_GNUC_UNUSED VALUE self) { GSList *ids = gtk_stock_list_ids(); GSList *l; VALUE ary = rb_ary_new(); for (l = ids; l != NULL; l = g_slist_next(l)) { rb_ary_push(ary, CSTR2SYM(l->data)); g_free(l->data); } g_slist_free(ids); return ary; } 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_s_set_translate_func(VALUE klass, VALUE domain) { VALUE func = rb_block_proc(); G_RELATIVE(klass, func); gtk_stock_set_translate_func(RVAL2CSTR(domain), (GtkTranslateFunc)translate_func, (gpointer)func, NULL); return Qnil; } void Init_gtk_stock(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Stock"); rb_undef_method(RG_TARGET_NAMESPACE, "new"); RG_DEF_SMETHOD(add, -1); RG_DEF_SMETHOD(lookup, 1); RG_DEF_SMETHOD(ids, 0); RG_DEF_SMETHOD(set_translate_func, 1); /* Stock IDs (not all are stock items; some are images only) */ rb_define_const(RG_TARGET_NAMESPACE, "ABOUT", CSTR2SYM(GTK_STOCK_ABOUT)); rb_define_const(RG_TARGET_NAMESPACE, "ADD", CSTR2SYM(GTK_STOCK_ADD)); rb_define_const(RG_TARGET_NAMESPACE, "APPLY", CSTR2SYM(GTK_STOCK_APPLY)); rb_define_const(RG_TARGET_NAMESPACE, "BOLD", CSTR2SYM(GTK_STOCK_BOLD)); rb_define_const(RG_TARGET_NAMESPACE, "CANCEL", CSTR2SYM(GTK_STOCK_CANCEL)); rb_define_const(RG_TARGET_NAMESPACE, "CAPS_LOCK_WARNING", CSTR2SYM(GTK_STOCK_CAPS_LOCK_WARNING)); rb_define_const(RG_TARGET_NAMESPACE, "CDROM", CSTR2SYM(GTK_STOCK_CDROM)); rb_define_const(RG_TARGET_NAMESPACE, "CLEAR", CSTR2SYM(GTK_STOCK_CLEAR)); rb_define_const(RG_TARGET_NAMESPACE, "CLOSE", CSTR2SYM(GTK_STOCK_CLOSE)); rb_define_const(RG_TARGET_NAMESPACE, "COLOR_PICKER", CSTR2SYM(GTK_STOCK_COLOR_PICKER)); rb_define_const(RG_TARGET_NAMESPACE, "CONVERT", CSTR2SYM(GTK_STOCK_CONVERT)); rb_define_const(RG_TARGET_NAMESPACE, "CONNECT", CSTR2SYM(GTK_STOCK_CONNECT)); rb_define_const(RG_TARGET_NAMESPACE, "COPY", CSTR2SYM(GTK_STOCK_COPY)); rb_define_const(RG_TARGET_NAMESPACE, "CUT", CSTR2SYM(GTK_STOCK_CUT)); rb_define_const(RG_TARGET_NAMESPACE, "DELETE", CSTR2SYM(GTK_STOCK_DELETE)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_AUTHENTICATION", CSTR2SYM(GTK_STOCK_DIALOG_AUTHENTICATION)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_ERROR", CSTR2SYM(GTK_STOCK_DIALOG_ERROR)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_INFO", CSTR2SYM(GTK_STOCK_DIALOG_INFO)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_QUESTION", CSTR2SYM(GTK_STOCK_DIALOG_QUESTION)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_WARNING", CSTR2SYM(GTK_STOCK_DIALOG_WARNING)); rb_define_const(RG_TARGET_NAMESPACE, "DIRECTORY", CSTR2SYM(GTK_STOCK_DIRECTORY)); rb_define_const(RG_TARGET_NAMESPACE, "DISCARD", CSTR2SYM(GTK_STOCK_DISCARD)); rb_define_const(RG_TARGET_NAMESPACE, "DISCONNECT", CSTR2SYM(GTK_STOCK_DISCONNECT)); rb_define_const(RG_TARGET_NAMESPACE, "DND", CSTR2SYM(GTK_STOCK_DND)); rb_define_const(RG_TARGET_NAMESPACE, "DND_MULTIPLE", CSTR2SYM(GTK_STOCK_DND_MULTIPLE)); rb_define_const(RG_TARGET_NAMESPACE, "EDIT", CSTR2SYM(GTK_STOCK_EDIT)); rb_define_const(RG_TARGET_NAMESPACE, "FILE", CSTR2SYM(GTK_STOCK_FILE)); rb_define_const(RG_TARGET_NAMESPACE, "EXECUTE", CSTR2SYM(GTK_STOCK_EXECUTE)); rb_define_const(RG_TARGET_NAMESPACE, "FIND", CSTR2SYM(GTK_STOCK_FIND)); rb_define_const(RG_TARGET_NAMESPACE, "FIND_AND_REPLACE", CSTR2SYM(GTK_STOCK_FIND_AND_REPLACE)); rb_define_const(RG_TARGET_NAMESPACE, "FLOPPY", CSTR2SYM(GTK_STOCK_FLOPPY)); rb_define_const(RG_TARGET_NAMESPACE, "FULLSCREEN", CSTR2SYM(GTK_STOCK_FULLSCREEN)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_BOTTOM", CSTR2SYM(GTK_STOCK_GOTO_BOTTOM)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_FIRST", CSTR2SYM(GTK_STOCK_GOTO_FIRST)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_LAST", CSTR2SYM(GTK_STOCK_GOTO_LAST)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_TOP", CSTR2SYM(GTK_STOCK_GOTO_TOP)); rb_define_const(RG_TARGET_NAMESPACE, "GO_BACK", CSTR2SYM(GTK_STOCK_GO_BACK)); rb_define_const(RG_TARGET_NAMESPACE, "GO_DOWN", CSTR2SYM(GTK_STOCK_GO_DOWN)); rb_define_const(RG_TARGET_NAMESPACE, "GO_FORWARD", CSTR2SYM(GTK_STOCK_GO_FORWARD)); rb_define_const(RG_TARGET_NAMESPACE, "GO_UP", CSTR2SYM(GTK_STOCK_GO_UP)); rb_define_const(RG_TARGET_NAMESPACE, "HARDDISK", CSTR2SYM(GTK_STOCK_HARDDISK)); rb_define_const(RG_TARGET_NAMESPACE, "HELP", CSTR2SYM(GTK_STOCK_HELP)); rb_define_const(RG_TARGET_NAMESPACE, "HOME", CSTR2SYM(GTK_STOCK_HOME)); rb_define_const(RG_TARGET_NAMESPACE, "INDENT", CSTR2SYM(GTK_STOCK_INDENT)); rb_define_const(RG_TARGET_NAMESPACE, "INFO", CSTR2SYM(GTK_STOCK_INFO)); rb_define_const(RG_TARGET_NAMESPACE, "INDEX", CSTR2SYM(GTK_STOCK_INDEX)); rb_define_const(RG_TARGET_NAMESPACE, "ITALIC", CSTR2SYM(GTK_STOCK_ITALIC)); rb_define_const(RG_TARGET_NAMESPACE, "JUMP_TO", CSTR2SYM(GTK_STOCK_JUMP_TO)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_CENTER", CSTR2SYM(GTK_STOCK_JUSTIFY_CENTER)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_FILL", CSTR2SYM(GTK_STOCK_JUSTIFY_FILL)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_LEFT", CSTR2SYM(GTK_STOCK_JUSTIFY_LEFT)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_RIGHT", CSTR2SYM(GTK_STOCK_JUSTIFY_RIGHT)); rb_define_const(RG_TARGET_NAMESPACE, "LEAVE_FULLSCREEN", CSTR2SYM(GTK_STOCK_LEAVE_FULLSCREEN)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_FORWARD", CSTR2SYM(GTK_STOCK_MEDIA_FORWARD)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_NEXT", CSTR2SYM(GTK_STOCK_MEDIA_NEXT)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_PAUSE", CSTR2SYM(GTK_STOCK_MEDIA_PAUSE)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_PLAY", CSTR2SYM(GTK_STOCK_MEDIA_PLAY)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_PREVIOUS", CSTR2SYM(GTK_STOCK_MEDIA_PREVIOUS)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_RECORD", CSTR2SYM(GTK_STOCK_MEDIA_RECORD)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_REWIND", CSTR2SYM(GTK_STOCK_MEDIA_REWIND)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_STOP", CSTR2SYM(GTK_STOCK_MEDIA_STOP)); rb_define_const(RG_TARGET_NAMESPACE, "MISSING_IMAGE", CSTR2SYM(GTK_STOCK_MISSING_IMAGE)); rb_define_const(RG_TARGET_NAMESPACE, "NETWORK", CSTR2SYM(GTK_STOCK_NETWORK)); rb_define_const(RG_TARGET_NAMESPACE, "NEW", CSTR2SYM(GTK_STOCK_NEW)); rb_define_const(RG_TARGET_NAMESPACE, "NO", CSTR2SYM(GTK_STOCK_NO)); rb_define_const(RG_TARGET_NAMESPACE, "OK", CSTR2SYM(GTK_STOCK_OK)); rb_define_const(RG_TARGET_NAMESPACE, "OPEN", CSTR2SYM(GTK_STOCK_OPEN)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_LANDSCAPE", CSTR2SYM(GTK_STOCK_ORIENTATION_LANDSCAPE)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_PORTRAIT", CSTR2SYM(GTK_STOCK_ORIENTATION_PORTRAIT)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_REVERSE_LANDSCAPE", CSTR2SYM(GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_REVERSE_PORTRAIT", CSTR2SYM(GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT)); rb_define_const(RG_TARGET_NAMESPACE, "PAGE_SETUP", CSTR2SYM(GTK_STOCK_PAGE_SETUP)); rb_define_const(RG_TARGET_NAMESPACE, "PASTE", CSTR2SYM(GTK_STOCK_PASTE)); rb_define_const(RG_TARGET_NAMESPACE, "PREFERENCES", CSTR2SYM(GTK_STOCK_PREFERENCES)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT", CSTR2SYM(GTK_STOCK_PRINT)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_ERROR", CSTR2SYM(GTK_STOCK_PRINT_ERROR)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_PAUSED", CSTR2SYM(GTK_STOCK_PRINT_PAUSED)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_PREVIEW", CSTR2SYM(GTK_STOCK_PRINT_PREVIEW)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_REPORT", CSTR2SYM(GTK_STOCK_PRINT_REPORT)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_WARNING", CSTR2SYM(GTK_STOCK_PRINT_WARNING)); rb_define_const(RG_TARGET_NAMESPACE, "PROPERTIES", CSTR2SYM(GTK_STOCK_PROPERTIES)); rb_define_const(RG_TARGET_NAMESPACE, "QUIT", CSTR2SYM(GTK_STOCK_QUIT)); rb_define_const(RG_TARGET_NAMESPACE, "REDO", CSTR2SYM(GTK_STOCK_REDO)); rb_define_const(RG_TARGET_NAMESPACE, "REFRESH", CSTR2SYM(GTK_STOCK_REFRESH)); rb_define_const(RG_TARGET_NAMESPACE, "REMOVE", CSTR2SYM(GTK_STOCK_REMOVE)); rb_define_const(RG_TARGET_NAMESPACE, "REVERT_TO_SAVED", CSTR2SYM(GTK_STOCK_REVERT_TO_SAVED)); rb_define_const(RG_TARGET_NAMESPACE, "SAVE", CSTR2SYM(GTK_STOCK_SAVE)); rb_define_const(RG_TARGET_NAMESPACE, "SAVE_AS", CSTR2SYM(GTK_STOCK_SAVE_AS)); rb_define_const(RG_TARGET_NAMESPACE, "SELECT_ALL", CSTR2SYM(GTK_STOCK_SELECT_ALL)); rb_define_const(RG_TARGET_NAMESPACE, "SELECT_COLOR", CSTR2SYM(GTK_STOCK_SELECT_COLOR)); rb_define_const(RG_TARGET_NAMESPACE, "SELECT_FONT", CSTR2SYM(GTK_STOCK_SELECT_FONT)); rb_define_const(RG_TARGET_NAMESPACE, "SORT_ASCENDING", CSTR2SYM(GTK_STOCK_SORT_ASCENDING)); rb_define_const(RG_TARGET_NAMESPACE, "SORT_DESCENDING", CSTR2SYM(GTK_STOCK_SORT_DESCENDING)); rb_define_const(RG_TARGET_NAMESPACE, "SPELL_CHECK", CSTR2SYM(GTK_STOCK_SPELL_CHECK)); rb_define_const(RG_TARGET_NAMESPACE, "STOP", CSTR2SYM(GTK_STOCK_STOP)); rb_define_const(RG_TARGET_NAMESPACE, "STRIKETHROUGH", CSTR2SYM(GTK_STOCK_STRIKETHROUGH)); rb_define_const(RG_TARGET_NAMESPACE, "UNDELETE", CSTR2SYM(GTK_STOCK_UNDELETE)); rb_define_const(RG_TARGET_NAMESPACE, "UNDERLINE", CSTR2SYM(GTK_STOCK_UNDERLINE)); rb_define_const(RG_TARGET_NAMESPACE, "UNDO", CSTR2SYM(GTK_STOCK_UNDO)); rb_define_const(RG_TARGET_NAMESPACE, "UNINDENT", CSTR2SYM(GTK_STOCK_UNINDENT)); rb_define_const(RG_TARGET_NAMESPACE, "YES", CSTR2SYM(GTK_STOCK_YES)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_100", CSTR2SYM(GTK_STOCK_ZOOM_100)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_FIT", CSTR2SYM(GTK_STOCK_ZOOM_FIT)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_IN", CSTR2SYM(GTK_STOCK_ZOOM_IN)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_OUT", CSTR2SYM(GTK_STOCK_ZOOM_OUT)); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-plug.c0000644000175000017500000000423412516434313017361 0ustar koukou/* -*- 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) 2002 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 "rbgtk3private.h" #ifdef HAVE_GTK_PLUG_GET_TYPE #include #define RG_TARGET_NAMESPACE cPlug static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE socket_id; Window id; if (rb_scan_args(argc, argv, "01", &socket_id) == 0) id = 0; else { #ifdef GDK_NATIVE_WINDOW_POINTER id = GUINT_TO_POINTER(NUM2ULONG(socket_id)); #else id = NUM2UINT(socket_id); #endif } RBGTK_INITIALIZE(self, gtk_plug_new(id)); return Qnil; } static VALUE rg_construct(VALUE self, VALUE socket_id) { #ifdef GDK_NATIVE_WINDOW_POINTER gtk_plug_construct(RVAL2GTKPLUG(self), GUINT_TO_POINTER(NUM2ULONG(socket_id))); #else gtk_plug_construct(RVAL2GTKPLUG(self), (guint32)NUM2UINT(socket_id)); #endif return self; } static VALUE rg_id(VALUE self) { Window id = gtk_plug_get_id(RVAL2GTKPLUG(self)); #ifdef GDK_NATIVE_WINDOW_POINTER return UINT2NUM(GPOINTER_TO_UINT(id)); #else return UINT2NUM(id); #endif } #endif void Init_gtk_plug(VALUE mGtk) { #ifdef HAVE_GTK_PLUG_GET_TYPE VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PLUG, "Plug", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(construct, 1); RG_DEF_METHOD(id, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-page-setup.c0000644000175000017500000001314312516434313020463 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPageSetup #define _SELF(s) (RVAL2GTKPAGESETUP(s)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_page_setup_new()); return Qnil; } static VALUE rg_dup(VALUE self) { return GOBJ2RVALU(gtk_page_setup_copy(_SELF(self))); } static VALUE rg_orientation(VALUE self) { return GTKPAGEORIENTATION2RVAL(gtk_page_setup_get_orientation(_SELF(self))); } static VALUE rg_set_orientation(VALUE self, VALUE orientation) { gtk_page_setup_set_orientation(_SELF(self), RVAL2GTKPAGEORIENTATION(orientation)); return self; } static VALUE rg_paper_size(VALUE self) { return GTKPAPERSIZE2RVAL(gtk_page_setup_get_paper_size(_SELF(self))); } static VALUE rg_set_paper_size(VALUE self, VALUE paper_size) { gtk_page_setup_set_paper_size(_SELF(self), RVAL2GTKPAPERSIZE(paper_size)); return self; } static VALUE rg_get_top_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_top_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_set_top_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_top_margin(_SELF(self), NUM2DBL(margin), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_get_bottom_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_bottom_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_set_bottom_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_bottom_margin(_SELF(self), NUM2DBL(margin), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_get_left_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_left_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_set_left_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_left_margin(_SELF(self), NUM2DBL(margin), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_get_right_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_right_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_set_right_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_right_margin(_SELF(self), NUM2DBL(margin), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_set_paper_size_and_default_margins(VALUE self, VALUE size) { gtk_page_setup_set_paper_size_and_default_margins(_SELF(self), RVAL2GTKPAPERSIZE(size)); return self; } /* These take orientation, but not margins into consideration */ static VALUE rg_get_paper_width(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_paper_width(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_get_paper_height(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_paper_height(_SELF(self), RVAL2GTKUNIT(unit))); } /* These take orientation, and margins into consideration */ static VALUE rg_get_page_width(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_page_width(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_get_page_height(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_page_height(_SELF(self), RVAL2GTKUNIT(unit))); } void Init_gtk_page_setup(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP, "PageSetup", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(dup, 0); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(set_orientation, 1); RG_DEF_METHOD(paper_size, 0); RG_DEF_METHOD(set_paper_size, 1); RG_DEF_METHOD(get_top_margin, 1); RG_DEF_METHOD(set_top_margin, 2); RG_DEF_METHOD(get_bottom_margin, 1); RG_DEF_METHOD(set_bottom_margin, 2); RG_DEF_METHOD(get_left_margin, 1); RG_DEF_METHOD(set_left_margin, 2); RG_DEF_METHOD(get_right_margin, 1); RG_DEF_METHOD(set_right_margin, 2); RG_DEF_METHOD(set_paper_size_and_default_margins, 1); /* These take orientation, but not margins into consideration */ RG_DEF_METHOD(get_paper_width, 1); RG_DEF_METHOD(get_paper_height, 1); /* These take orientation, and margins into consideration */ RG_DEF_METHOD(get_page_width, 1); RG_DEF_METHOD(get_page_height, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-spinner.c0000644000175000017500000000244212516434313022610 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererSpinner #define _SELF(s) (RVAL2GTKCELLRENDERERSPINNER(s)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_spinner_new()); return Qnil; } void Init_gtk_cellrendererspinner(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_SPINNER, "CellRendererSpinner", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-print-operation-preview.c0000644000175000017500000000357512516434313023232 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPrintOperationPreview #define _SELF(s) (RVAL2GTKPRINTOPERATIONPREVIEW(s)) static VALUE rg_render_page(VALUE self, VALUE page_number) { gtk_print_operation_preview_render_page(_SELF(self), NUM2INT(page_number)); return self; } static VALUE rg_end_preview(VALUE self) { gtk_print_operation_preview_end_preview(_SELF(self)); return self; } static VALUE rg_selected_p(VALUE self, VALUE page_number) { gboolean selected; selected = gtk_print_operation_preview_is_selected(_SELF(self), NUM2INT(page_number)); return CBOOL2RVAL(selected); } void Init_gtk_print_operation_preview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_PREVIEW, "PrintOperationPreview", mGtk); RG_DEF_METHOD(render_page, 1); RG_DEF_METHOD(end_preview, 0); RG_DEF_METHOD_P(selected, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-file-system-error.c0000644000175000017500000000376412516434313022011 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005,2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFileSystemError void Init_gtk_filesystemerror(VALUE mGtk) { #ifdef GTK_FILE_SYSTEM_ERROR VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_ERROR2(GTK_FILE_SYSTEM_ERROR, "FileSystemError", mGtk, rb_eRuntimeError); rb_define_const(RG_TARGET_NAMESPACE, "NONEXISTENT", INT2NUM(GTK_FILE_SYSTEM_ERROR_NONEXISTENT)); rb_define_const(RG_TARGET_NAMESPACE, "NOT_FOLDER", INT2NUM(GTK_FILE_SYSTEM_ERROR_NOT_FOLDER)); rb_define_const(RG_TARGET_NAMESPACE, "INVALID_URI", INT2NUM(GTK_FILE_SYSTEM_ERROR_INVALID_URI)); rb_define_const(RG_TARGET_NAMESPACE, "BAD_FILENAME", INT2NUM(GTK_FILE_SYSTEM_ERROR_BAD_FILENAME)); rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(GTK_FILE_SYSTEM_ERROR_FAILED)); rb_define_const(RG_TARGET_NAMESPACE, "ALREADY_EXSITS", INT2NUM(GTK_FILE_SYSTEM_ERROR_ALREADY_EXISTS)); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk3util.h0000644000175000017500000000222312516434313017376 0ustar koukou/* -*- 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 */ #ifndef __RBGTK3UTIL_H__ #define __RBGTK3UTIL_H__ G_BEGIN_DECLS typedef VALUE (*RBGTKAddButtonFunc)(VALUE self, VALUE button_text, VALUE response_id); G_GNUC_INTERNAL VALUE rbgtk_add_buttons(VALUE self, VALUE buttons, RBGTKAddButtonFunc add_button); G_END_DECLS #endif /* __RBGTK3UTIL_H__ */ ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-drag-gdk-drag-context.c0000644000175000017500000000722612516434313022473 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cDragContext #define _SELF(self) (RVAL2GDKDRAGCONTEXT(self)) static VALUE rg_finish(VALUE self, VALUE success, VALUE del, VALUE time) { gtk_drag_finish(_SELF(self), RVAL2CBOOL(success), RVAL2CBOOL(del), NUM2UINT(time)); return self; } static VALUE rg_source_widget(VALUE self) { return GOBJ2RVAL(gtk_drag_get_source_widget(_SELF(self))); } static VALUE rg_set_icon(VALUE self, VALUE icon) { if (TYPE(icon) == T_HASH) { VALUE stock_id, icon_name, gicon, pixbuf, surface, widget, hot_x, hot_y, buffer; rbg_scan_options(icon, "stock_id", &stock_id, "icon_name", &icon_name, "gicon", &gicon, "pixbuf", &pixbuf, "surface", &surface, "widget", &widget, "hot_x", &hot_x, "hot_y", &hot_y, NULL); if (!NIL_P(stock_id)) gtk_drag_set_icon_stock(_SELF(self), RVAL2GLIBID(stock_id, buffer), NUM2INT(hot_x), NUM2INT(hot_y)); else if (!NIL_P(icon_name)) gtk_drag_set_icon_name(_SELF(self), RVAL2CSTR(icon_name), NUM2INT(hot_x), NUM2INT(hot_y)); #if GTK_CHECK_VERSION(3, 2, 0) else if (!NIL_P(gicon)) gtk_drag_set_icon_gicon(_SELF(self), RVAL2GICON(gicon), NUM2INT(hot_x), NUM2INT(hot_y)); #endif else if (!NIL_P(pixbuf)) gtk_drag_set_icon_pixbuf(_SELF(self), RVAL2GDKPIXBUF(pixbuf), NUM2INT(hot_x), NUM2INT(hot_y)); else if (!NIL_P(surface)) gtk_drag_set_icon_surface(_SELF(self), RVAL2CRSURFACE(surface)); else if (!NIL_P(widget)) gtk_drag_set_icon_widget(_SELF(self), RVAL2GTKWIDGET(widget), NUM2INT(hot_x), NUM2INT(hot_y)); else rb_raise(rb_eArgError, "Invalid arguments."); } else { gtk_drag_set_icon_surface(_SELF(self), RVAL2CRSURFACE(icon)); } return self; } static VALUE rg_set_icon_default(VALUE self) { gtk_drag_set_icon_default(_SELF(self)); return self; } void Init_gtk_drag_gdk_drag_context(void) { VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_DRAG_CONTEXT); RG_DEF_METHOD(finish, 3); RG_DEF_METHOD(source_widget, 0); RG_DEF_METHOD(set_icon, 1); RG_DEF_METHOD(set_icon_default, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-chooser.c0000644000175000017500000001215412516434313021332 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mRecentChooser #define _SELF(self) (RVAL2GTKRECENTCHOOSER(self)) static VALUE rb_mGtk; struct callback_arg { VALUE callback; VALUE a, b; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; return rb_funcall(arg->callback, id_call, 1, arg->a, arg->b); } static void remove_callback_reference(gpointer callback) { G_CHILD_REMOVE(rb_mGtk, (VALUE)callback); } static gint sort_func(GtkRecentInfo *a, GtkRecentInfo *b, gpointer func) { struct callback_arg arg; arg.callback = (VALUE)func; arg.a = GTKRECENTINFO2RVAL(a); arg.b = GTKRECENTINFO2RVAL(b); return NUM2INT(G_PROTECT_CALLBACK(invoke_callback, &arg)); } static VALUE rg_set_sort_func(VALUE self) { VALUE func = rb_block_proc(); G_CHILD_ADD(rb_mGtk, func); gtk_recent_chooser_set_sort_func(_SELF(self), (GtkRecentSortFunc)sort_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; } static VALUE rg_set_current_uri(VALUE self, VALUE uri) { GError *error = NULL; gboolean ret = gtk_recent_chooser_set_current_uri(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_current_uri(VALUE self) { return CSTR2RVAL(gtk_recent_chooser_get_current_uri(_SELF(self))); } static VALUE rg_current_item(VALUE self) { return GTKRECENTINFO2RVAL(gtk_recent_chooser_get_current_item(_SELF(self))); } static VALUE rg_select_uri(VALUE self, VALUE uri) { GError *error = NULL; gboolean ret = gtk_recent_chooser_select_uri(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_unselect_uri(VALUE self, VALUE uri) { gtk_recent_chooser_unselect_uri(_SELF(self), RVAL2CSTR(uri)); return self; } static VALUE rg_select_all(VALUE self) { gtk_recent_chooser_select_all(_SELF(self)); return self; } static VALUE rg_unselect_all(VALUE self) { gtk_recent_chooser_unselect_all(_SELF(self)); return self; } static VALUE rg_items(VALUE self) { GList* list = gtk_recent_chooser_get_items(_SELF(self)); VALUE ary = rb_ary_new(); while (list) { rb_ary_push(ary, GTKRECENTINFO2RVAL(list->data)); gtk_recent_info_unref(list->data); list = list->next; } g_list_free(list); return ary; } static VALUE rg_uris(VALUE self) { gsize i; gsize size; gchar** uris = gtk_recent_chooser_get_uris(_SELF(self), &size); VALUE ary = rb_ary_new(); for (i = 0; i < size; i++){ rb_ary_push(ary, CSTR2RVAL(uris[i])); } g_strfreev(uris); return ary; } static VALUE rg_add_filter(VALUE self, VALUE filter) { gtk_recent_chooser_add_filter(_SELF(self), RVAL2GTKRECENTFILTER(filter)); return self; } static VALUE rg_remove_filter(VALUE self, VALUE filter) { gtk_recent_chooser_remove_filter(_SELF(self), RVAL2GTKRECENTFILTER(filter)); return self; } static VALUE rg_filters(VALUE self) { return GOBJGSLIST2RVAL_FREE(gtk_recent_chooser_list_filters(_SELF(self)), g_slist_free, NULL); } void Init_gtk_recent_chooser(VALUE mGtk) { rb_mGtk = mGtk; VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_RECENT_CHOOSER, "RecentChooser", mGtk); RG_DEF_METHOD(set_sort_func, 0); RG_DEF_METHOD(set_current_uri, 1); RG_DEF_METHOD(current_uri, 0); RG_DEF_METHOD(current_item, 0); RG_DEF_METHOD(select_uri, 1); RG_DEF_METHOD(unselect_uri, 1); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(items, 0); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(add_filter, 1); RG_DEF_METHOD(remove_filter, 1); RG_DEF_METHOD(filters, 0); G_DEF_ERROR(GTK_RECENT_CHOOSER_ERROR, "RecentChooserError", mGtk, rb_eRuntimeError, GTK_TYPE_RECENT_CHOOSER_ERROR); G_DEF_CLASS(GTK_TYPE_RECENT_SORT_TYPE, "SortType", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-style-context-gdk-screen.c0000644000175000017500000000347712516434313023264 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cScreen #define _SELF(self) (RVAL2GDKSCREEN(self)) static VALUE rg_add_provider(VALUE self, VALUE provider, VALUE priority) { gtk_style_context_add_provider_for_screen(_SELF(self), RVAL2GTKSTYLEPROVIDER(provider), NUM2UINT(priority)); return self; } static VALUE rg_remove_provider(VALUE self, VALUE provider) { gtk_style_context_remove_provider_for_screen(_SELF(self), RVAL2GTKSTYLEPROVIDER(provider)); return self; } static VALUE rg_reset_widgets(VALUE self) { gtk_style_context_reset_widgets(_SELF(self)); return self; } void Init_gtk_style_context_gdk_screen(void) { VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_SCREEN); RG_DEF_METHOD(add_provider, 2); RG_DEF_METHOD(remove_provider, 1); RG_DEF_METHOD(reset_widgets, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-imcon-text.c0000644000175000017500000000722712516434313020506 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIMContext #define _SELF(self) (RVAL2GTKIMCONTEXT(self)) static VALUE rg_set_client_window(VALUE self, VALUE gdkwindow) { gtk_im_context_set_client_window(_SELF(self), RVAL2GDKWINDOW(gdkwindow)); return self; } static VALUE rg_preedit_string(VALUE self) { gchar* str; PangoAttrList* attrs; gint cursor_pos; gtk_im_context_get_preedit_string(_SELF(self), &str, &attrs, &cursor_pos); return rb_ary_new3(3, CSTR2RVAL(str), PANGOATTRLIST2RVAL(attrs), INT2NUM(cursor_pos)); } static VALUE rg_filter_keypress(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_im_context_filter_keypress(_SELF(self), (GdkEventKey*)RVAL2GEV(event))); } static VALUE rg_focus_in(VALUE self) { gtk_im_context_focus_in(_SELF(self)); return self; } static VALUE rg_focus_out(VALUE self) { gtk_im_context_focus_out(_SELF(self)); return self; } static VALUE rg_reset(VALUE self) { gtk_im_context_reset(_SELF(self)); return self; } static VALUE rg_set_cursor_location(VALUE self, VALUE area) { gtk_im_context_set_cursor_location( _SELF(self), RVAL2GDKRECTANGLE(area)); return self; } static VALUE rg_set_use_preedit(VALUE self, VALUE use_preedit) { gtk_im_context_set_use_preedit(_SELF(self), RVAL2CBOOL(use_preedit)); return self; } static VALUE rg_set_surrounding(VALUE self, VALUE text, VALUE cursor_index) { StringValue(text); gtk_im_context_set_surrounding(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text), NUM2INT(cursor_index)); return self; } static VALUE rg_surrounding(VALUE self) { gchar* text; gint cursor_index; gboolean result = gtk_im_context_get_surrounding(_SELF(self), &text, &cursor_index); return result ? rb_ary_new3(2, CSTR2RVAL(text), INT2NUM(cursor_index)) : Qnil; } static VALUE rg_delete_surrounding(VALUE self, VALUE offset, VALUE n_chars) { return CBOOL2RVAL(gtk_im_context_delete_surrounding(_SELF(self), NUM2INT(offset), NUM2INT(n_chars))); } void Init_gtk_imcontext(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IM_CONTEXT, "IMContext", mGtk); RG_DEF_METHOD(set_client_window, 1); RG_DEF_METHOD(preedit_string, 0); /* Is it better to name as "filter_keypress?" ?*/ RG_DEF_METHOD(filter_keypress, 1); RG_DEF_METHOD(focus_in, 0); RG_DEF_METHOD(focus_out, 0); RG_DEF_METHOD(reset, 0); RG_DEF_METHOD(set_cursor_location, 1); RG_DEF_METHOD(set_use_preedit, 1); RG_DEF_METHOD(set_surrounding, 2); RG_DEF_METHOD(surrounding, 0); RG_DEF_METHOD(delete_surrounding, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-orientable.c0000644000175000017500000000175512516434313020543 0ustar koukou/* -*- 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 "rbgtk3private.h" void Init_gtk_orientable(VALUE mGtk) { G_DEF_INTERFACE(GTK_TYPE_ORIENTABLE, "Orientable", mGtk); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tool-item.c0000644000175000017500000001223712516434313020325 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cToolItem #define _SELF(self) (RVAL2GTKTOOLITEM(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_tool_item_new()); return Qnil; } static VALUE rg_set_homogeneous(VALUE self, VALUE homogeneous) { gtk_tool_item_set_homogeneous(_SELF(self), RVAL2CBOOL(homogeneous)); return self; } static VALUE rg_homogeneous_p(VALUE self) { return CBOOL2RVAL(gtk_tool_item_get_homogeneous(_SELF(self))); } static VALUE rg_set_expand(VALUE self, VALUE expand) { gtk_tool_item_set_expand(_SELF(self), RVAL2CBOOL(expand)); return self; } static VALUE rg_expand_p(VALUE self) { return CBOOL2RVAL(gtk_tool_item_get_expand(_SELF(self))); } static VALUE rg_set_use_drag_window(VALUE self, VALUE use_drag_window) { gtk_tool_item_set_use_drag_window(_SELF(self), RVAL2CBOOL(use_drag_window)); return self; } static VALUE rg_use_drag_window_p(VALUE self) { return CBOOL2RVAL(gtk_tool_item_get_use_drag_window(_SELF(self))); } static VALUE rg_icon_size(VALUE self) { return GTKICONSIZE2RVAL(gtk_tool_item_get_icon_size(_SELF(self))); } static VALUE rg_orientation(VALUE self) { return GTKORIENTATION2RVAL(gtk_tool_item_get_orientation(_SELF(self))); } static VALUE rg_toolbar_style(VALUE self) { return GTKTOOLBARSTYLE2RVAL(gtk_tool_item_get_toolbar_style(_SELF(self))); } static VALUE rg_relief_style(VALUE self) { return GTKRELIEFSTYLE2RVAL(gtk_tool_item_get_relief_style(_SELF(self))); } static VALUE rg_retrieve_proxy_menu_item(VALUE self) { return GOBJ2RVAL(gtk_tool_item_retrieve_proxy_menu_item(_SELF(self))); } static VALUE rg_get_proxy_menu_item(VALUE self, VALUE menu_item_id) { return GOBJ2RVAL(gtk_tool_item_get_proxy_menu_item(_SELF(self), RVAL2CSTR(menu_item_id))); } static VALUE rg_set_proxy_menu_item(VALUE self, VALUE menu_item_id, VALUE menu_item) { gtk_tool_item_set_proxy_menu_item(_SELF(self), RVAL2CSTR(menu_item_id), RVAL2GTKWIDGET(menu_item)); return self; } static VALUE rg_rebuild_menu(VALUE self) { gtk_tool_item_rebuild_menu(_SELF(self)); return self; } static VALUE rg_ellipsize_mode(VALUE self) { return PANGOELLIPSIZEMODE2RVAL(gtk_tool_item_get_ellipsize_mode(_SELF(self))); } static VALUE rg_text_alignment(VALUE self) { return DBL2NUM(gtk_tool_item_get_text_alignment(_SELF(self))); } static VALUE rg_text_orientation(VALUE self) { return GTKORIENTATION2RVAL(gtk_tool_item_get_text_orientation(_SELF(self))); } static VALUE rg_text_size_group(VALUE self) { return GOBJ2RVAL(gtk_tool_item_get_text_size_group(_SELF(self))); } static VALUE rg_set_tooltip(VALUE self, VALUE tooltip) { if (TYPE(tooltip) == T_HASH) { VALUE text, markup; rbg_scan_options(tooltip, "text", &text, "markup", &markup, NULL); if (!NIL_P(text)) gtk_tool_item_set_tooltip_text(_SELF(self), RVAL2CSTR(text)); else if (!NIL_P(markup)) gtk_tool_item_set_tooltip_markup(_SELF(self), RVAL2CSTR(markup)); else rb_raise(rb_eArgError, "Invalid arguments."); } else { rb_raise(rb_eArgError, "Invalid arguments."); } return self; } static VALUE rg_toolbar_reconfigured(VALUE self) { gtk_tool_item_toolbar_reconfigured(_SELF(self)); return self; } void Init_gtk_toolitem(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOL_ITEM, "ToolItem", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_homogeneous, 1); RG_DEF_METHOD_P(homogeneous, 0); RG_DEF_METHOD(set_expand, 1); RG_DEF_METHOD_P(expand, 0); RG_DEF_METHOD(set_use_drag_window, 1); RG_DEF_METHOD_P(use_drag_window, 0); RG_DEF_METHOD(icon_size, 0); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(toolbar_style, 0); RG_DEF_METHOD(relief_style, 0); RG_DEF_METHOD(retrieve_proxy_menu_item, 0); RG_DEF_METHOD(get_proxy_menu_item, 1); RG_DEF_METHOD(set_proxy_menu_item, 2); RG_DEF_METHOD(rebuild_menu, 0); RG_DEF_METHOD(ellipsize_mode, 0); RG_DEF_METHOD(text_alignment, 0); RG_DEF_METHOD(text_orientation, 0); RG_DEF_METHOD(text_size_group, 0); RG_DEF_METHOD(set_tooltip, 1); RG_DEF_METHOD(toolbar_reconfigured, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-check-menu-item.c0000644000175000017500000000375312516434313021372 0ustar koukou/* -*- 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 "rbgtk3private.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(RVAL2GTKCHECKMENUITEM(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-buildable.c0000644000175000017500000000571612516434313020343 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cBuildable #define _SELF(self) (RVAL2GTKBUILDABLE(self)) 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), RVAL2GTKBUILDER(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 = RVAL2GTKBUILDER(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), RVAL2GTKBUILDER(builder), RVAL2CSTR(name))); } static VALUE rg_get_internal_child(VALUE self, VALUE builder, VALUE child_name) { return GOBJ2RVAL(gtk_buildable_get_internal_child(_SELF(self), RVAL2GTKBUILDER(builder), RVAL2CSTR(child_name))); } void Init_gtk_buildable(VALUE mGtk) { 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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer.c0000644000175000017500000001014312516434313021131 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRenderer #define _SELF(s) (RVAL2GTKCELLRENDERER(s)) static VALUE rg_get_preferred_size(VALUE self, VALUE widget) { GtkRequisition minimum_size, natural_size; gtk_cell_renderer_get_preferred_size(_SELF(self), RVAL2GTKWIDGET(widget), &minimum_size, &natural_size); return rb_ary_new3(2, GTKREQUISITION2RVAL(&minimum_size), GTKREQUISITION2RVAL(&natural_size)); } /* TODO 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), RVAL2GDKWINDOW(window), RVAL2GTKWIDGET(widget), RVAL2GDKRECTANGLE(background_area), RVAL2GDKRECTANGLE(cell_area), RVAL2GDKRECTANGLE(expose_area), RVAL2GTKCELLRENDERERSTATE(flags)); 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), RVAL2GTKWIDGET(widget), RVAL2CSTR(path), RVAL2GDKRECTANGLE(background_area), RVAL2GDKRECTANGLE(cell_area), RVAL2GTKCELLRENDERERSTATE(flags)); 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), RVAL2GTKWIDGET(widget), RVAL2CSTR(path), RVAL2GDKRECTANGLE(background_area), RVAL2GDKRECTANGLE(cell_area), RVAL2GTKCELLRENDERERSTATE(flags)); return edit ? GOBJ2RVAL(edit) : Qnil; } static VALUE rg_stop_editing(VALUE self, VALUE canceled) { gtk_cell_renderer_stop_editing(_SELF(self), RVAL2CBOOL(canceled)); return self; } 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_preferred_size, 1); /* TODO RG_DEF_METHOD(render, 6); */ RG_DEF_METHOD(activate, 6); RG_DEF_METHOD(start_editing, 6); RG_DEF_METHOD(stop_editing, 1); RG_DEF_METHOD(fixed_size, 0); RG_DEF_METHOD(set_fixed_size, 2); G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_STATE, "State", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_MODE, "Mode", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-spinner.c0000644000175000017500000000270612516434313020072 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSpinner #define _SELF(s) (RVAL2GTKSPINNER(s)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_spinner_new()); return Qnil; } static VALUE rg_start(VALUE self) { gtk_spinner_start(_SELF(self)); return self; } static VALUE rg_stop(VALUE self) { gtk_spinner_stop(_SELF(self)); return self; } void Init_gtk_spinner(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SPINNER, "Spinner", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(start, 0); RG_DEF_METHOD(stop, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-handle-box.c0000644000175000017500000000303412516434313020430 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cHandleBox static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_handle_box_new()); return Qnil; } void Init_gtk_handle_box(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HANDLE_BOX, "HandleBox", mGtk); RG_DEF_METHOD(initialize, 0); rb_undef_method(RG_TARGET_NAMESPACE, "shadow"); rb_undef_method(RG_TARGET_NAMESPACE, "shadow="); rb_undef_method(RG_TARGET_NAMESPACE, "set_shadow"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/extconf.rb0000644000175000017500000000532412516434313017133 0ustar koukou=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 = "gtk3" package_id = "gtk+-3.0" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end have_func("rb_errinfo") ["glib2", "cairo-gobject", "atk", "pango", "gdk_pixbuf2", "gdk3"].each do |package| depended_module_name = package.gsub(/-/, "_") directory = "#{package}#{version_suffix}" build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{depended_module_name}/#{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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libgtk-3-dev", :fedora => "gtk3-devel", :homebrew => "gtk+3", :macports => "gtk3") exit(false) end have_header("st.h") have_header("ruby/st.h") STDOUT.print("checking for targets... ") STDOUT.flush targets = PKGConfig.variable(package_id, "targets").split(/\s+/) STDOUT.print(targets.join(" "), "\n") 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 targets.include?("x11") and have_header('X11/Xlib.h') and have_library("X11") have_func("XReadBitmapFileData", xlib_header) have_func("XGetErrorText", xlib_header) end if !targets.include?("win32") and PKGConfig.have_package('gtk+-unix-print-3.0') $defs.push("-DHAVE_GTK_UNIX_PRINT") end create_pkg_config_file("Ruby/GTK3", package_id, ruby_gnome2_version) ensure_objs $defs << "-DRUBY_GTK3_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 ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-image.c0000644000175000017500000001210612516434313017471 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cImage #define _SELF(s) (RVAL2GTKIMAGE(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE image; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &image); if (NIL_P(image)) { widget = gtk_image_new(); } else if (TYPE(image) == T_HASH) { VALUE stock, icon_name, icon_set, gicon, file, pixbuf, animation, size, buffer; rbg_scan_options(image, "stock", &stock, "icon_name", &icon_name, "icon_set", &icon_set, "gicon", &gicon, "file", &file, "pixbuf", &pixbuf, "animation", &animation, "size", &size, NULL); if (!NIL_P(stock)) widget = gtk_image_new_from_stock(RVAL2GLIBID(stock, buffer), RVAL2GTKICONSIZE(size)); else if (!NIL_P(icon_name)) widget = gtk_image_new_from_icon_name(RVAL2CSTR(icon_name), RVAL2GTKICONSIZE(size)); else if (!NIL_P(icon_set)) widget = gtk_image_new_from_icon_set(RVAL2GTKICONSET(icon_set), RVAL2GTKICONSIZE(size)); else if (!NIL_P(gicon)) widget = gtk_image_new_from_gicon(RVAL2GICON(gicon), RVAL2GTKICONSIZE(size)); else if (!NIL_P(file)) widget = gtk_image_new_from_file(RVAL2CSTR(file)); else if (!NIL_P(pixbuf)) widget = gtk_image_new_from_pixbuf(RVAL2GDKPIXBUF(pixbuf)); else if (!NIL_P(animation)) widget = gtk_image_new_from_animation(RVAL2GDKPIXBUFANIMATION(animation)); } else { GType gtype = RVAL2GTYPE(image); if (gtype == GDK_TYPE_PIXBUF) widget = gtk_image_new_from_pixbuf(RVAL2GDKPIXBUF(image)); else if (g_type_is_a(gtype, GDK_TYPE_PIXBUF_ANIMATION)) widget = gtk_image_new_from_animation(RVAL2GDKPIXBUFANIMATION(image)); } if (!widget) rb_raise(rb_eArgError, "Invalid arguments."); RBGTK_INITIALIZE(self, widget); g_object_unref(widget); return Qnil; } static VALUE rg_clear(VALUE self) { gtk_image_clear(_SELF(self)); return self; } static GtkIconSize icon_size_from_ruby(GtkImage *image, VALUE rb_size) { GtkIconSize size; if (NIL_P(rb_size)) { g_object_get(image, "icon-size", &size, NULL); if (size == GTK_ICON_SIZE_INVALID) { size = GTK_ICON_SIZE_BUTTON; } } else { size = RVAL2GTKICONSIZE(rb_size); } return size; } static VALUE rg_set_from_icon_set(int argc, VALUE *argv, VALUE self) { GtkImage *image; VALUE rb_icon_set, rb_size; image = RVAL2GTKIMAGE(self); rb_scan_args(argc, argv, "11", &rb_icon_set, &rb_size); gtk_image_set_from_icon_set(image, RVAL2GTKICONSET(rb_icon_set), icon_size_from_ruby(image, rb_size)); return self; } static VALUE rg_set_from_stock(int argc, VALUE *argv, VALUE self) { GtkImage *image; VALUE rb_stock, rb_size; VALUE rb_buffer; image = RVAL2GTKIMAGE(self); rb_scan_args(argc, argv, "11", &rb_stock, &rb_size); gtk_image_set_from_stock(image, RVAL2GLIBID(rb_stock, rb_buffer), icon_size_from_ruby(image, rb_size)); return self; } static VALUE rg_set_from_gicon(int argc, VALUE *argv, VALUE self) { GtkImage *image; VALUE rb_gicon, rb_size; image = RVAL2GTKIMAGE(self); rb_scan_args(argc, argv, "11", &rb_gicon, &rb_size); gtk_image_set_from_gicon(image, RVAL2GICON(rb_gicon), icon_size_from_ruby(image, rb_size)); return self; } void Init_gtk_image(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IMAGE, "Image", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD(set_from_icon_set, -1); RG_DEF_METHOD(set_from_stock, -1); RG_DEF_METHOD(set_from_gicon, -1); G_DEF_CLASS(GTK_TYPE_IMAGE_TYPE, "Type", RG_TARGET_NAMESPACE); RG_REG_GLIBID_SETTER("stock"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tooltip-gdk-display.c0000644000175000017500000000237012516434313022311 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cDisplay #define _SELF(self) (RVAL2GDKDISPLAYOBJECT(self)) static VALUE rg_trigger_tooltip_query(VALUE self) { gtk_tooltip_trigger_tooltip_query(_SELF(self)); return self; } void Init_gtk_tooltip_gdk_display(void) { VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_DISPLAY); RG_DEF_METHOD(trigger_tooltip_query, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-drag.c0000644000175000017500000000530112516434313017323 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mDrag 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 : RVAL2GTKTARGETFLAGS(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; } void Init_gtk_drag(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Drag"); G_DEF_CLASS(GTK_TYPE_DEST_DEFAULTS, "DestDefaults", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_TARGET_FLAGS, "TargetFlags", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-clip-board.c0000644000175000017500000002550412516434313020431 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cClipboard #define _SELF(s) RVAL2GTKCLIPBOARD(s) 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 { VALUE display, selection; rb_scan_args(argc, argv, "20", &display, &selection); clipboard = gtk_clipboard_get_for_display(RVAL2GDKDISPLAYOBJECT(display), RVAL2ATOM(selection)); } return GOBJ2RVAL(clipboard); } static VALUE rg_display(VALUE self) { return GOBJ2RVAL(gtk_clipboard_get_display(_SELF(self))); } static void clipboard_get_func(GtkClipboard *clipboard, GtkSelectionData *selection_data, G_GNUC_UNUSED guint info, gpointer func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(clipboard), GTKSELECTIONDATA2RVAL(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; } static VALUE rg_set_image(VALUE self, VALUE pixbuf) { gtk_clipboard_set_image(_SELF(self), RVAL2GDKPIXBUF(pixbuf)); return self; } static void clipboard_received_func(GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(clipboard), GTKSELECTIONDATA2RVAL(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, GOBJ2RVAL(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; } static void clipboard_image_received_func(GtkClipboard *clipboard, GdkPixbuf *pixbuf, gpointer func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(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; } 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, GDKATOM2RVAL(atoms[i])); } rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(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; } 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, GOBJ2RVAL(clipboard), GDKATOM2RVAL(format), 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), RVAL2GTKTEXTBUFFER(buffer), (GtkClipboardRichTextReceivedFunc)clipboard_rich_text_received_func, (gpointer)func); return self; } static VALUE rg_wait_for_contents(VALUE self, VALUE target) { return GTKSELECTIONDATA2RVAL(gtk_clipboard_wait_for_contents(_SELF(self), RVAL2ATOM(target))); } static VALUE rg_wait_for_text(VALUE self) { gchar *str; str = gtk_clipboard_wait_for_text(_SELF(self)); return str ? CSTR2RVAL(str) : Qnil; } static VALUE rg_wait_for_image(VALUE self) { GdkPixbuf* pixbuf = gtk_clipboard_wait_for_image(_SELF(self)); return GOBJ2RVAL(pixbuf); } 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), RVAL2GTKTEXTBUFFER(buffer), &format, &length); if (data){ VALUE str = rb_str_new((char*)data, length); g_free(data); return rb_assoc_new(str, GDKATOM2RVAL(format)); } else { return rb_assoc_new(Qnil, GDKATOM2RVAL(format)); } } static VALUE rg_wait_is_text_available_p(VALUE self) { return CBOOL2RVAL(gtk_clipboard_wait_is_text_available(_SELF(self))); } static VALUE rg_wait_is_image_available_p(VALUE self) { return CBOOL2RVAL(gtk_clipboard_wait_is_image_available(_SELF(self))); } static VALUE rg_wait_is_rich_text_available_p(VALUE self, VALUE buffer) { return CBOOL2RVAL(gtk_clipboard_wait_is_rich_text_available(_SELF(self), RVAL2GTKTEXTBUFFER(buffer))); } 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, GDKATOM2RVAL(targets)); targets++; } /* How can I this ? g_free(&o_targets); */ } return ary; } 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; } 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); RG_DEF_METHOD(set_image, 1); RG_DEF_METHOD(request_contents, 1); RG_DEF_METHOD(request_text, 0); RG_DEF_METHOD(request_image, 0); RG_DEF_METHOD(request_targets, 0); RG_DEF_METHOD(request_rich_text, 1); RG_DEF_METHOD(wait_for_contents, 1); RG_DEF_METHOD(wait_for_text, 0); RG_DEF_METHOD(wait_for_image, 0); RG_DEF_METHOD(wait_for_rich_text, 1); RG_DEF_METHOD_P(wait_is_text_available, 0); RG_DEF_METHOD_P(wait_is_image_available, 0); RG_DEF_METHOD_P(wait_is_rich_text_available, 1); RG_DEF_METHOD(wait_for_targets, 0); RG_DEF_METHOD_P(wait_is_target_available, 1); RG_DEF_METHOD(set_can_store, 1); RG_DEF_METHOD(store, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-editable.c0000644000175000017500000000776012516434313020172 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mEditable static VALUE rg_select_region(VALUE self, VALUE start, VALUE end) { gtk_editable_select_region(RVAL2GTKEDITABLE(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(RVAL2GTKEDITABLE(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(RVAL2GTKEDITABLE(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(RVAL2GTKEDITABLE(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(RVAL2GTKEDITABLE(self), /* check s */ NUM2INT(start), NUM2INT(end))); /* check start,end */ } static VALUE rg_delete_selection(VALUE self) { gtk_editable_delete_selection(RVAL2GTKEDITABLE(self)); return self; } static VALUE rg_position(VALUE self) { return INT2NUM(gtk_editable_get_position(RVAL2GTKEDITABLE(self))); } static VALUE rg_set_position(VALUE self, VALUE position) { gtk_editable_set_position(RVAL2GTKEDITABLE(self), NUM2INT(position)); return self; } static VALUE rg_set_editable(VALUE self, VALUE editable) { gtk_editable_set_editable(RVAL2GTKEDITABLE(self), RVAL2CBOOL(editable)); return self; } static VALUE rg_editable_p(VALUE self) { return CBOOL2RVAL(gtk_editable_get_editable(RVAL2GTKEDITABLE(self))); } static VALUE rg_cut_clipboard(VALUE self) { gtk_editable_cut_clipboard(RVAL2GTKEDITABLE(self)); return self; } static VALUE rg_copy_clipboard(VALUE self) { gtk_editable_copy_clipboard(RVAL2GTKEDITABLE(self)); return self; } static VALUE rg_paste_clipboard(VALUE self) { gtk_editable_paste_clipboard(RVAL2GTKEDITABLE(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-entry-buffer.c0000644000175000017500000000477012516434313021027 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cEntryBuffer #define _SELF(self) (RVAL2GTKENTRYBUFFER(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE initial_chars; GtkEntryBuffer *buffer = NULL; rb_scan_args(argc, argv, "01", &initial_chars); if (NIL_P(initial_chars)) { buffer = gtk_entry_buffer_new(NULL, -1); } else { StringValue(initial_chars); buffer = gtk_entry_buffer_new(RSTRING_PTR(initial_chars), RSTRING_LEN(initial_chars)); } G_INITIALIZE(self, buffer); return Qnil; } static VALUE rg_delete_text(VALUE self, VALUE position, VALUE n_chars) { guint result; result = gtk_entry_buffer_delete_text(_SELF(self), NUM2UINT(position), NUM2INT(n_chars)); return UINT2NUM(result); } static VALUE rg_bytes(VALUE self) { return ULONG2NUM(gtk_entry_buffer_get_bytes(_SELF(self))); } static VALUE rg_insert_text(VALUE self, VALUE position, VALUE chars) { guint result; StringValue(chars); result = gtk_entry_buffer_insert_text(_SELF(self), NUM2UINT(position), RSTRING_PTR(chars), RSTRING_LEN(chars)); return UINT2NUM(result); } void Init_gtk_entrybuffer(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ENTRY_BUFFER, "EntryBuffer", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(delete_text, 2); RG_DEF_METHOD(bytes, 0); RG_DEF_METHOD(insert_text, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/depend0000644000175000017500000000050412516434313016315 0ustar koukouinstall-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rbgtk3.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgtk3conversions.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gtk3.pc $(pkgconfigdir); \ fi ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk3private.h0000644000175000017500000003443612516434313020106 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 __RBGTK3PRIVATE_H__ #define __RBGTK3PRIVATE_H__ #ifdef HAVE_RUBY_ST_H # include #else # include #endif #include #include #include #include #include "rbgtk3.h" #include "rbgtk3util.h" #ifndef HAVE_RB_ERRINFO # define rb_errinfo() (ruby_errinfo) #endif #ifndef G_VALUE_INIT # define G_VALUE_INIT { 0, { { 0 } } } #endif extern ID id_relative_callbacks; extern ID id_call; G_GNUC_INTERNAL void exec_callback(GtkWidget *widget, gpointer proc); typedef void (*rbgtkiter_set_value_func)(void *model, GtkTreeIter *iter, gint column, GValue *value); G_GNUC_INTERNAL void rbgtk_register_treeiter_set_value_func(GType, rbgtkiter_set_value_func); G_GNUC_INTERNAL void rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom* gtype, void** data, gint* format, gint* length); G_GNUC_INTERNAL void rbgtk_atom2selectiondata_free(GdkAtom gtype, void* data); #define RVAL2GTKTARGETENTRIES(value, n) rbgtk_rval2gtktargetentries(value, n) G_GNUC_INTERNAL GtkTargetEntry *rbgtk_rval2gtktargetentries(VALUE value, long *n); #define RVAL2GTKTARGETENTRIES_ACCEPT_NIL(value, n) rbgtk_rval2gtktargetentries_accept_nil(value, n) G_GNUC_INTERNAL GtkTargetEntry *rbgtk_rval2gtktargetentries_accept_nil(VALUE value, long *n); G_GNUC_INTERNAL void Init_gtk_gdk_event(void); G_GNUC_INTERNAL void Init_gtk_drag_gdk_drag_context(void); G_GNUC_INTERNAL void Init_gtk_style_context_gdk_screen(void); G_GNUC_INTERNAL void Init_gtk_tooltip_gdk_display(void); G_GNUC_INTERNAL void Init_gtk(void); 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); #if GTK_CHECK_VERSION(3, 12, 0) G_GNUC_INTERNAL void Init_gtk_action_bar(VALUE mGtk); #endif G_GNUC_INTERNAL void Init_gtk_actiongroup(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_activatable(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_appchooser(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_appchooserbutton(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_appchooserdialog(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_appchooserwidget(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_application(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_combobox(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_comboboxtext(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_cssprovider(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_entrybuffer(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_fixed(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_fontbutton(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_fontchooser(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_fontchooserdialog(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_fontchooserwidget(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_frame(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_grid(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_handle_box(VALUE mGtk); #if GTK_CHECK_VERSION(3, 10, 0) G_GNUC_INTERNAL void Init_gtk_header_bar(VALUE mGtk); #endif G_GNUC_INTERNAL void Init_gtk_hsv(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_icon_factory(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_icon_info(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_invisible(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_label(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_layout(VALUE mGtk); #if GTK_CHECK_VERSION(3, 6, 0) G_GNUC_INTERNAL void Init_gtk_level_bar(VALUE mGtk); #endif 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_lockbutton(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_menu(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_menu_bar(VALUE mGtk); #if GTK_CHECK_VERSION(3, 6, 0) G_GNUC_INTERNAL void Init_gtk_menu_button(VALUE mGtk); #endif 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_numerableicon(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_orientable(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_overlay(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_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_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); #if GTK_CHECK_VERSION(3, 10, 0) G_GNUC_INTERNAL void Init_gtk_revealer(VALUE mGtk); #endif G_GNUC_INTERNAL void Init_gtk_scale(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_scalebutton(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_scrollable(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_scrollbar(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_scrolled_window(VALUE mGtk); #if GTK_CHECK_VERSION(3, 10, 0) G_GNUC_INTERNAL void Init_gtk_search_bar(VALUE mGtk); #endif #if GTK_CHECK_VERSION(3, 6, 0) G_GNUC_INTERNAL void Init_gtk_search_entry(VALUE mGtk); #endif 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); #if GTK_CHECK_VERSION(3, 10, 0) G_GNUC_INTERNAL void Init_gtk_stack(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_stack_switcher(VALUE mGtk); #endif 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_stylecontext(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_styleproperties(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_styleprovider(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_switch(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_themingengine(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_toolitemgroup(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_toolshell(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_tooltip(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_viewport(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_volumebutton(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_widget(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_widgetpath(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_window(VALUE mGtk); G_GNUC_INTERNAL void Init_gtk_windowgroup(VALUE mGtk); G_GNUC_INTERNAL void Init_conversions(void); #endif /* __RBGTK3PRIVATE_H__ */ ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-entry.c0000644000175000017500000001146412516434313017556 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cEntry #define _SELF(self) (RVAL2GTKENTRY(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)); } 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))); } 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), RVAL2GTKADJUSTMENT(adjustment)); return self; } static VALUE rg_current_icon_drag_source(VALUE self) { return INT2NUM(gtk_entry_get_current_icon_drag_source(_SELF(self))); } static VALUE rg_get_icon_area(VALUE self, VALUE icon_pos) { GdkRectangle icon_area; gtk_entry_get_icon_area(_SELF(self), RVAL2GTKENTRYICONPOSITION(icon_pos), &icon_area); return GOBJ2RVAL(&icon_area); } static VALUE rg_get_icon_at_pos(VALUE self, VALUE x, VALUE y) { return INT2NUM(gtk_entry_get_icon_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y))); } static VALUE rg_text_area(VALUE self) { GdkRectangle text_area; gtk_entry_get_text_area(_SELF(self), &text_area); return GOBJ2RVAL(&text_area); } static VALUE rg_im_context_filter_keypress(VALUE self, VALUE event) { gboolean result; result = gtk_entry_im_context_filter_keypress(_SELF(self), RVAL2GDKEVENTKEY(event)); return CBOOL2RVAL(result); } static VALUE rg_progress_pulse(VALUE self) { gtk_entry_progress_pulse(_SELF(self)); return self; } static VALUE rg_reset_im_context(VALUE self) { gtk_entry_reset_im_context(_SELF(self)); return self; } static VALUE rg_set_icon_drag_source(VALUE self, VALUE icon_pos, VALUE target_list, VALUE actions) { gtk_entry_set_icon_drag_source(_SELF(self), RVAL2GTKENTRYICONPOSITION(icon_pos), RVAL2GTKTARGETLIST(target_list), RVAL2GDKDRAGACTION(actions)); return self; } static VALUE rg_unset_invisible_char(VALUE self) { gtk_entry_unset_invisible_char(_SELF(self)); return self; } void Init_gtk_entry(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ENTRY, "Entry", mGtk); #if GTK_CHECK_VERSION(3, 6, 0) G_DEF_CLASS(GTK_TYPE_INPUT_PURPOSE, "InputPurpose", mGtk); G_DEF_CLASS(GTK_TYPE_INPUT_HINTS, "InputHints", mGtk); #endif RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(layout, 0); RG_DEF_METHOD(layout_offsets, 0); RG_DEF_METHOD(layout_index_to_text_index, 1); RG_DEF_METHOD(text_index_to_layout_index, 1); RG_DEF_METHOD(cursor_hadjustment, 0); RG_DEF_METHOD(set_cursor_hadjustment, 1); RG_DEF_METHOD(current_icon_drag_source, 0); RG_DEF_METHOD(get_icon_area, 1); RG_DEF_METHOD(get_icon_at_pos, 2); RG_DEF_METHOD(text_area, 0); RG_DEF_METHOD(im_context_filter_keypress, 1); RG_DEF_METHOD(progress_pulse, 0); RG_DEF_METHOD(reset_im_context, 0); RG_DEF_METHOD(set_icon_drag_source, 3); RG_DEF_METHOD(unset_invisible_char, 0); RG_REG_GLIBID_SETTER("primary-icon-stock"); RG_REG_GLIBID_SETTER("secondary-icon-stock"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-border.c0000644000175000017500000000552412516434313017672 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cBorder #define _SELF(self) (RVAL2GTKBORDER(self)) 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_left(VALUE self) { return INT2NUM(_SELF(self)->left); } static VALUE rg_set_left(VALUE self, VALUE val) { _SELF(self)->left = NUM2INT(val); return self; } static VALUE rg_right(VALUE self) { return INT2NUM(_SELF(self)->right); } static VALUE rg_set_right(VALUE self, VALUE val) { _SELF(self)->right = NUM2INT(val); return self; } static VALUE rg_top(VALUE self) { return INT2NUM(_SELF(self)->top); } static VALUE rg_set_top(VALUE self, VALUE val) { _SELF(self)->top = NUM2INT(val); return self; } static VALUE rg_bottom(VALUE self) { return INT2NUM(_SELF(self)->bottom); } static VALUE rg_set_bottom(VALUE self, VALUE val) { _SELF(self)->bottom = NUM2INT(val); return self; } 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); RG_DEF_METHOD(left, 0); RG_DEF_METHOD(set_left, 1); RG_DEF_METHOD(right, 0); RG_DEF_METHOD(set_right, 1); RG_DEF_METHOD(top, 0); RG_DEF_METHOD(set_top, 1); RG_DEF_METHOD(bottom, 0); RG_DEF_METHOD(set_bottom, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tooltip.c0000644000175000017500000000647112516434313020111 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTooltip /* GTK_TOOLTIP type-cast is private because it should be useless */ #define _SELF(self) (RVAL2GOBJ(self)) static VALUE rg_set_markup(VALUE self, VALUE markup) { gtk_tooltip_set_markup(_SELF(self), RVAL2CSTR(markup)); return self; } static VALUE rg_set_text(VALUE self, VALUE text) { gtk_tooltip_set_text(_SELF(self), RVAL2CSTR(text)); return self; } static VALUE rg_set_icon(VALUE self, VALUE icon) { if (NIL_P(icon)) { gtk_tooltip_set_icon(_SELF(self), NULL); } else if (TYPE(icon) == T_HASH) { VALUE stock_id, icon_name, gicon, size, buffer; rbg_scan_options(icon, "stock_id", &stock_id, "icon_name", &icon_name, "gicon", &gicon, "size", &size, NULL); if (!NIL_P(stock_id)) gtk_tooltip_set_icon_from_stock(_SELF(self), RVAL2GLIBID(stock_id, buffer), RVAL2GTKICONSIZE(size)); else if (!NIL_P(icon_name)) gtk_tooltip_set_icon_from_icon_name(_SELF(self), RVAL2CSTR(icon_name), RVAL2GTKICONSIZE(size)); else if (!NIL_P(gicon)) gtk_tooltip_set_icon_from_gicon(_SELF(self), RVAL2GICON(gicon), RVAL2GTKICONSIZE(size)); else rb_raise(rb_eArgError, "Invalid arguments."); } else { GType gtype = RVAL2GTYPE(icon); if (gtype == GDK_TYPE_PIXBUF) gtk_tooltip_set_icon(_SELF(self), RVAL2GDKPIXBUF(icon)); else rb_raise(rb_eArgError, "Invalid arguments."); } return self; } static VALUE rg_set_custom(VALUE self, VALUE custom_widget) { gtk_tooltip_set_custom(_SELF(self), RVAL2GTKWIDGET(custom_widget)); return self; } void Init_gtk_tooltip(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOLTIP, "Tooltip", mGtk); RG_DEF_METHOD(set_markup, 1); RG_DEF_METHOD(set_text, 1); RG_DEF_METHOD(set_icon, 1); RG_DEF_METHOD(set_custom, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-chooser-widget.c0000644000175000017500000000313012516434313022605 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentChooserWidget #define _SELF(self) (RVAL2GTKRECENTCHOOSERWIDGET(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE manager; GtkWidget* widget; rb_scan_args(argc, argv, "01", &manager); if (NIL_P(manager)){ widget = gtk_recent_chooser_widget_new_for_manager(RVAL2GTKRECENTMANAGER(manager)); } else { widget = gtk_recent_chooser_widget_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_recent_chooser_widget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER_WIDGET, "RecentChooserWidget", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-modelsort.c0000644000175000017500000000674712516434313021372 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeModelSort #define _SELF(s) (RVAL2GTKTREEMODELSORT(s)) static ID id_model; static VALUE rg_initialize(VALUE self, VALUE model) { G_CHILD_SET(self, id_model, model); G_INITIALIZE(self, gtk_tree_model_sort_new_with_model(RVAL2GTKTREEMODEL(model))); return Qnil; } static VALUE rg_convert_child_path_to_path(VALUE self, VALUE child_path) { return GTKTREEPATH2RVAL(gtk_tree_model_sort_convert_child_path_to_path( _SELF(self), RVAL2GTKTREEPATH(child_path))); } static VALUE rg_convert_child_iter_to_iter(VALUE self, VALUE child_iter) { GtkTreeIter sort_iter; GtkTreeModelSort* modelsort = _SELF(self); gtk_tree_model_sort_convert_child_iter_to_iter(modelsort, &sort_iter, RVAL2GTKTREEITER(child_iter)); sort_iter.user_data3 = gtk_tree_model_sort_get_model(modelsort); return GTKTREEITER2RVAL(&sort_iter); } static VALUE rg_convert_path_to_child_path(VALUE self, VALUE sorted_path) { return GTKTREEPATH2RVAL(gtk_tree_model_sort_convert_path_to_child_path( _SELF(self), RVAL2GTKTREEPATH(sorted_path))); } static VALUE rg_convert_iter_to_child_iter(VALUE self, VALUE sorted_iter) { GtkTreeIter child_iter; GtkTreeModelSort* modelsort = _SELF(self); gtk_tree_model_sort_convert_iter_to_child_iter(modelsort, &child_iter, RVAL2GTKTREEITER(sorted_iter)); child_iter.user_data3 = gtk_tree_model_sort_get_model(modelsort); return GTKTREEITER2RVAL(&child_iter); } static VALUE rg_reset_default_sort_func(VALUE self) { gtk_tree_model_sort_reset_default_sort_func(_SELF(self)); return self; } static VALUE rg_clear_cache(VALUE self) { gtk_tree_model_sort_clear_cache(_SELF(self)); return self; } static VALUE rg_iter_is_valid_p(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_tree_model_sort_iter_is_valid(_SELF(self), RVAL2GTKTREEITER(iter))); } void Init_gtk_tmodelsort(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_MODEL_SORT, "TreeModelSort", mGtk); id_model = rb_intern("model"); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(convert_child_path_to_path, 1); RG_DEF_METHOD(convert_child_iter_to_iter, 1); RG_DEF_METHOD(convert_path_to_child_path, 1); RG_DEF_METHOD(convert_iter_to_child_iter, 1); RG_DEF_METHOD(reset_default_sort_func, 0); RG_DEF_METHOD(clear_cache, 0); RG_DEF_METHOD_P(iter_is_valid, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-print-operation.c0000644000175000017500000001071412516434313021544 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPrintOperation #define _SELF(s) (RVAL2GTKPRINTOPERATION(s)) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_print_operation_new()); return Qnil; } static VALUE rg_run(int argc, VALUE *argv, VALUE self) { VALUE action, parent, rb_result; GtkPrintOperationResult result; GError *error = NULL; rb_scan_args(argc, argv, "11", &action, &parent); result = gtk_print_operation_run(_SELF(self), RVAL2GTKPRINTOPERATIONACTION(action), RVAL2GTKWINDOW(parent), &error); rb_result = GTKPRINTOPERATIONRESULT2RVAL(result); if (rb_block_given_p()) { return rb_yield(rb_result); } else { if (result == GTK_PRINT_OPERATION_RESULT_ERROR) RAISE_GERROR(error); return rb_result; } } static VALUE rg_error(VALUE self) { GError *error = NULL; gtk_print_operation_get_error(_SELF(self), &error); return error ? rbgerr_gerror2exception(error) : Qnil; } static VALUE rg_finished_p(VALUE self) { return CBOOL2RVAL(gtk_print_operation_is_finished(_SELF(self))); } static VALUE rg_cancel(VALUE self) { gtk_print_operation_cancel(_SELF(self)); return self; } struct callback_arg { VALUE callback; VALUE page_setup; }; static VALUE invoke_callback(VALUE arg_) { struct callback_arg *arg = (struct callback_arg *)arg_; return rb_funcall(arg->callback, id_call, 1, arg->page_setup); } static void page_setup_done_cb(GtkPageSetup *page_setup, gpointer data) { VALUE callback = (VALUE)data; struct callback_arg arg; G_CHILD_UNSET(RG_TARGET_NAMESPACE, rb_intern("setup_done_cb")); arg.callback = callback; arg.page_setup = GOBJ2RVAL(page_setup); G_PROTECT_CALLBACK(invoke_callback, &arg); } static VALUE rg_s_run_page_setup_dialog(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE parent, page_setup, settings; rb_scan_args(argc, argv, "03", &parent, &page_setup, &settings); if (rb_block_given_p()) { volatile VALUE func = rb_block_proc(); G_CHILD_SET(RG_TARGET_NAMESPACE, rb_intern("setup_done_cb"), func); gtk_print_run_page_setup_dialog_async(RVAL2GTKWINDOW(parent), RVAL2GTKPAGESETUP(page_setup), RVAL2GTKPRINTSETTINGS(settings), page_setup_done_cb, (gpointer)func); return Qnil; } else { return GOBJ2RVALU(gtk_print_run_page_setup_dialog(RVAL2GTKWINDOW(parent), RVAL2GTKPAGESETUP(page_setup), RVAL2GTKPRINTSETTINGS(settings))); } } void Init_gtk_print_operation(VALUE mGtk) { RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION, "PrintOperation", mGtk); G_DEF_ERROR(GTK_PRINT_ERROR, "PrintError", mGtk, rb_eRuntimeError, GTK_TYPE_PRINT_ERROR); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(run, -1); RG_DEF_METHOD(error, 0); RG_DEF_METHOD_P(finished, 0); RG_DEF_METHOD(cancel, 0); RG_DEF_SMETHOD(run_page_setup_dialog, -1); G_DEF_CLASS(GTK_TYPE_PRINT_STATUS, "Status", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_ACTION,"Action", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_RESULT, "Result", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-data.c0000644000175000017500000001025212516434313020576 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" /*****************************************/ static GtkRecentData* rd_copy(const GtkRecentData* data) { GtkRecentData* new_data; g_return_val_if_fail (data != NULL, NULL); new_data = g_new(GtkRecentData, 1); *new_data = *data; return new_data; } static void rd_free(GtkRecentData* boxed) { if (boxed){ g_free(boxed->groups); g_free(boxed); } } GType gtk_recent_data_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkRecentData", (GBoxedCopyFunc)rd_copy, (GBoxedFreeFunc)rd_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cRecentData #define _SELF(w) (RVAL2GTKRECENTDATA(w)) static VALUE rg_initialize(VALUE self) { GtkRecentData data; memset(&data, 0, sizeof(GtkRecentData)); G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_RECENT_DATA, &data)); return Qnil; } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(_SELF(self)->display_name); } static VALUE rg_set_display_name(VALUE self, VALUE val) { _SELF(self)->display_name = (gchar *) RVAL2CSTR(val); return self; } static VALUE rg_description(VALUE self) { return CSTR2RVAL(_SELF(self)->description); } static VALUE rg_set_description(VALUE self, VALUE val) { _SELF(self)->description = (gchar *) RVAL2CSTR(val); return self; } static VALUE rg_mime_type(VALUE self) { return CSTR2RVAL(_SELF(self)->mime_type); } static VALUE rg_set_mime_type(VALUE self, VALUE val) { _SELF(self)->mime_type = (gchar *) RVAL2CSTR(val); return self; } static VALUE rg_app_name(VALUE self) { return CSTR2RVAL(_SELF(self)->app_name); } static VALUE rg_set_app_name(VALUE self, VALUE val) { _SELF(self)->app_name = (gchar *) RVAL2CSTR(val); return self; } static VALUE rg_app_exec(VALUE self) { return CSTR2RVAL(_SELF(self)->app_exec); } static VALUE rg_set_app_exec(VALUE self, VALUE val) { _SELF(self)->app_exec = (gchar *) RVAL2CSTR(val); return self; } static VALUE rg_groups(VALUE self) { gchar** grps = _SELF(self)->groups; VALUE ary = rb_ary_new(); gint i = 0; while (grps[i]) { rb_ary_push(ary, CSTR2RVAL((gchar*)grps[i])); i++; } return ary; } static VALUE rg_set_groups(VALUE self, VALUE groups) { _SELF(self)->groups = RVAL2STRV_DUP(groups); return self; } static VALUE rg_private_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->is_private); } static VALUE rg_set_private(VALUE self, VALUE is_private) { _SELF(self)->is_private = RVAL2CBOOL(is_private); return self; } void Init_gtk_recent_data(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_DATA, "RecentData", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(display_name, 0); RG_DEF_METHOD(set_display_name, 1); RG_DEF_METHOD(description, 0); RG_DEF_METHOD(set_description, 1); RG_DEF_METHOD(mime_type, 0); RG_DEF_METHOD(set_mime_type, 1); RG_DEF_METHOD(app_name, 0); RG_DEF_METHOD(set_app_name, 1); RG_DEF_METHOD(app_exec, 0); RG_DEF_METHOD(set_app_exec, 1); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD(set_groups, 1); RG_DEF_METHOD_P(private, 0); RG_DEF_METHOD(set_private, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-combo-box-text.c0000644000175000017500000000664512516434313021271 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cComboBoxText #define _SELF(self) (RVAL2GTKCOMBOBOXTEXT(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, entry; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "entry", &entry, NULL); if (RVAL2CBOOL(entry)) widget = gtk_combo_box_text_new_with_entry(); else widget = gtk_combo_box_text_new(); RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_append(VALUE self, VALUE id, VALUE text) { gtk_combo_box_text_append(_SELF(self), RVAL2CSTR_ACCEPT_NIL(id), RVAL2CSTR(text)); return self; } static VALUE rg_append_text(VALUE self, VALUE text) { gtk_combo_box_text_append_text(_SELF(self), RVAL2CSTR(text)); return self; } static VALUE rg_active_text(VALUE self) { return CSTR2RVAL_FREE(gtk_combo_box_text_get_active_text(_SELF(self))); } static VALUE rg_insert(VALUE self, VALUE position, VALUE id, VALUE text) { gtk_combo_box_text_insert(_SELF(self), NUM2INT(position), RVAL2CSTR_ACCEPT_NIL(id), RVAL2CSTR(text)); return self; } static VALUE rg_insert_text(VALUE self, VALUE position, VALUE text) { gtk_combo_box_text_insert_text(_SELF(self), NUM2INT(position), RVAL2CSTR(text)); return self; } static VALUE rg_prepend(VALUE self, VALUE id, VALUE text) { gtk_combo_box_text_prepend(_SELF(self), RVAL2CSTR_ACCEPT_NIL(id), RVAL2CSTR(text)); return self; } static VALUE rg_prepend_text(VALUE self, VALUE text) { gtk_combo_box_text_prepend_text(_SELF(self), RVAL2CSTR(text)); return self; } static VALUE rg_remove(VALUE self, VALUE position) { gtk_combo_box_text_remove(_SELF(self), NUM2INT(position)); return self; } static VALUE rg_remove_all(VALUE self) { gtk_combo_box_text_remove_all(_SELF(self)); return self; } void Init_gtk_comboboxtext(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COMBO_BOX_TEXT, "ComboBoxText", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(append, 2); RG_DEF_METHOD(append_text, 1); RG_DEF_METHOD(active_text, 0); RG_DEF_METHOD(insert, 3); RG_DEF_METHOD(insert_text, 2); RG_DEF_METHOD(prepend, 2); RG_DEF_METHOD(prepend_text, 1); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(remove_all, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-switch.c0000644000175000017500000000233012516434313017706 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSwitch #define _SELF(self) (RVAL2GTKSWITCH(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_switch_new()); return Qnil; } void Init_gtk_switch(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SWITCH, "Switch", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-tag.c0000644000175000017500000000413512516434313020147 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextTag static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name; rb_scan_args(argc, argv, "01", &name); G_INITIALIZE(self, gtk_text_tag_new(RVAL2CSTR_ACCEPT_NIL(name))); return Qnil; } static VALUE rg_priority(VALUE self) { return INT2NUM(gtk_text_tag_get_priority(RVAL2GTKTEXTTAG(self))); } static VALUE rg_set_priority(VALUE self, VALUE priority) { gtk_text_tag_set_priority(RVAL2GTKTEXTTAG(self), NUM2INT(priority)); return priority; } static VALUE rg_event(VALUE self, VALUE event_object, VALUE event, VALUE iter) { gboolean ret = gtk_text_tag_event(RVAL2GTKTEXTTAG(self), RVAL2GOBJ(event_object), RVAL2GEV(event), RVAL2GTKTEXTITER(iter)); return CBOOL2RVAL(ret); } void Init_gtk_texttag(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_TAG, "TextTag", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(priority, 0); RG_DEF_METHOD(set_priority, 1); RG_DEF_METHOD(event, 3); G_DEF_CLASS(GTK_TYPE_WRAP_MODE, "WrapMode", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-status-bar.c0000644000175000017500000000423112516434313020474 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cStatusbar #define _SELF(self) (RVAL2GTKSTATUSBAR(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_statusbar_new()); return Qnil; } static VALUE rg_get_context_id(VALUE self, VALUE text) { return INT2FIX(gtk_statusbar_get_context_id(_SELF(self), RVAL2CSTR(text))); } static VALUE rg_push(VALUE self, VALUE id, VALUE text) { return INT2FIX(gtk_statusbar_push(_SELF(self), NUM2INT(id), RVAL2CSTR(text))); } static VALUE rg_pop(VALUE self, VALUE id) { gtk_statusbar_pop(_SELF(self), NUM2INT(id)); return self; } static VALUE rg_remove(VALUE self, VALUE cid, VALUE mid) { gtk_statusbar_remove(_SELF(self), NUM2INT(cid), NUM2INT(mid)); return self; } void Init_gtk_statusbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STATUSBAR, "Statusbar", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_context_id, 1); RG_DEF_METHOD(push, 2); RG_DEF_METHOD(pop, 1); RG_DEF_METHOD(remove, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-selection-data.c0000644000175000017500000001613712516434313021313 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSelectionData #define _SELF(d) (RVAL2GTKSELECTIONDATA(d)) static GdkAtom compound_text; /************************************************************************/ void rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom *gtype, void **data, gint *format, gint *length) { void* dat = NULL; gint fmt, len; GdkAtom ntype = RVAL2ATOM(type); if(ntype == GDK_SELECTION_TYPE_INTEGER){ glong *i; i = ALLOC(glong); *i = NUM2INT(src); dat = i; fmt = 32; len = 1; } else if(ntype == GDK_SELECTION_TYPE_STRING) { dat = (void *)RVAL2CSTR(src); fmt = 8; if (NIL_P(size)) { len = RSTRING_LEN(src); } else { len = NUM2UINT(size); } /* TODO } else if(ntype == compound_text){ guchar* str = (guchar*)dat; gdk_string_to_compound_text(RVAL2CSTR(src), &ntype, &fmt, &str, &len); */ } else if(type != Qnil && size != Qnil && src != Qnil) { dat = (void *)RVAL2CSTR(src); fmt = NUM2INT(size); len = (RSTRING_LEN(src) * sizeof(char) / fmt); } else { rb_raise(rb_eArgError, "no supported type."); } *gtype = ntype; *data = dat; *format = fmt; *length = len; } void rbgtk_atom2selectiondata_free(GdkAtom type, void *dat) { if (type == GDK_SELECTION_TYPE_INTEGER || type == GDK_SELECTION_TYPE_ATOM) { xfree(dat); /* TODO } else if(type == compound_text) { gdk_free_compound_text(dat); */ } } /************************************************************************/ static VALUE rg_selection(VALUE self) { return GDKATOM2RVAL(gtk_selection_data_get_selection(_SELF(self))); } static VALUE rg_target(VALUE self) { return GDKATOM2RVAL(gtk_selection_data_get_target(_SELF(self))); } static VALUE rg_data_type(VALUE self) { return GDKATOM2RVAL(gtk_selection_data_get_data_type(_SELF(self))); } static VALUE rg_format(VALUE self) { return INT2NUM(gtk_selection_data_get_format(_SELF(self))); } static VALUE rg_data(VALUE self) { return RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const gchar *)gtk_selection_data_get_data(_SELF(self)), gtk_selection_data_get_length(_SELF(self)))); } static VALUE rg_display(VALUE self) { return GOBJ2RVAL(gtk_selection_data_get_display(_SELF(self))); } static VALUE rg_set(int argc, VALUE *argv, VALUE self) { void* dat; VALUE type, src; gint fmt, len; GdkAtom ntype; VALUE size = Qnil; if(3 == argc) rb_scan_args(argc, argv, "30", &type, &size, &src); else rb_scan_args(argc, argv, "20", &type, &src); rbgtk_atom2selectiondata(type, size, src, &ntype, &dat, &fmt, &len); gtk_selection_data_set(_SELF(self), ntype, fmt, dat, len); rbgtk_atom2selectiondata_free(ntype, dat); return self; } static VALUE rg_set_text(VALUE self, VALUE str) { StringValue(str); if (!gtk_selection_data_set_text(_SELF(self), RSTRING_PTR(str), RSTRING_LEN(str))) rb_raise(rb_eRuntimeError, "the selection wasn't successfully set"); return self; } static VALUE rg_text(VALUE self) { return CSTR2RVAL_FREE((gchar *)gtk_selection_data_get_text(_SELF(self))); } static VALUE rg_set_pixbuf(VALUE self, VALUE pixbuf) { if (!gtk_selection_data_set_pixbuf(_SELF(self), RVAL2GDKPIXBUF(pixbuf))) rb_raise(rb_eRuntimeError, "the selection wasn't successfully set"); return self; } static VALUE rg_pixbuf(VALUE self) { return GOBJ2RVAL(gtk_selection_data_get_pixbuf(_SELF(self))); } static VALUE rg_set_uris(VALUE self, VALUE uris) { gboolean ret; gchar **guris; guris = (gchar **)RVAL2STRV(uris); ret = gtk_selection_data_set_uris(_SELF(self), guris); g_free(guris); if (!ret) rb_raise(rb_eRuntimeError, "the selection wasn't successfully."); return self; } static VALUE rg_uris(VALUE self) { VALUE ary = rb_ary_new(); gchar** uris = gtk_selection_data_get_uris(_SELF(self)); if (uris) { gchar **uri = uris; while (*uri) { rb_ary_push(ary, CSTR2RVAL(*uri)); uri++; } g_strfreev(uris); } return ary; } static VALUE rg_targets(VALUE self) { GdkAtom* targets; gint n_atoms; VALUE result = Qnil; gboolean ret = gtk_selection_data_get_targets(_SELF(self), &targets, &n_atoms); if (ret) { int i; result = rb_ary_new2(n_atoms); for (i = 0; i < n_atoms; i++){ rb_ary_push(result, GDKATOM2RVAL(targets[i])); } } g_free(targets); return result; } static VALUE rg_targets_include_image(VALUE self, VALUE writable) { return CBOOL2RVAL(gtk_selection_data_targets_include_image(_SELF(self), RVAL2CBOOL(writable))); } static VALUE rg_targets_include_text(VALUE self) { return CBOOL2RVAL(gtk_selection_data_targets_include_text(_SELF(self))); } static VALUE rg_targets_include_uri(VALUE self) { return CBOOL2RVAL(gtk_selection_data_targets_include_uri(_SELF(self))); } static VALUE rg_targets_include_rich_text(VALUE self, VALUE buffer) { return CBOOL2RVAL(gtk_selection_data_targets_include_rich_text(_SELF(self), RVAL2GTKTEXTBUFFER(buffer))); } void Init_gtk_selectiondata(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SELECTION_DATA, "SelectionData", mGtk); rbgobj_boxed_not_copy_obj(GTK_TYPE_SELECTION_DATA); compound_text = gdk_atom_intern("COMPOUND_TEXT", FALSE); RG_DEF_METHOD(selection, 0); RG_DEF_METHOD(target, 0); RG_DEF_METHOD(data_type, 0); RG_DEF_METHOD(format, 0); RG_DEF_METHOD(data, 0); RG_DEF_METHOD(display, 0); RG_DEF_METHOD(set, -1); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_text, 1); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(set_pixbuf, 1); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(set_uris, 1); RG_DEF_METHOD(targets_include_image, 1); RG_DEF_METHOD(targets, 0); RG_DEF_METHOD(targets_include_text, 0); RG_DEF_METHOD(targets_include_uri, 0); RG_DEF_METHOD(targets_include_rich_text, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-invisible.c0000644000175000017500000000301012516434313020365 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cInvisible #define _SELF(s) RVAL2GTKINVISIBLE(s) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE screen; rb_scan_args(argc, argv, "01", &screen); if (argc == 0){ RBGTK_INITIALIZE(self, gtk_invisible_new()); } else { RBGTK_INITIALIZE(self, gtk_invisible_new_for_screen( RVAL2GDKSCREEN(screen))); } return Qnil; } void Init_gtk_invisible(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_INVISIBLE, "Invisible", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-size-group.c0000644000175000017500000000366412516434313020524 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003-2005 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSizeGroup #define _SELF(self) (RVAL2GTKSIZEGROUP(self)) static VALUE rg_initialize(VALUE self, VALUE mode) { G_INITIALIZE(self, gtk_size_group_new(RVAL2GTKSIZEGROUPMODE(mode))); return Qnil; } static VALUE rg_add_widget(VALUE self, VALUE widget) { gtk_size_group_add_widget(_SELF(self), RVAL2GTKWIDGET(widget)); return self; } static VALUE rg_remove_widget(VALUE self, VALUE widget) { gtk_size_group_remove_widget(_SELF(self), RVAL2GTKWIDGET(widget)); return self; } static VALUE rg_widgets(VALUE self) { return GOBJGSLIST2RVAL(gtk_size_group_get_widgets(_SELF(self))); } void Init_gtk_size_group(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SIZE_GROUP, "SizeGroup", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(add_widget, 1); RG_DEF_METHOD(remove_widget, 1); RG_DEF_METHOD(widgets, 0); G_DEF_CLASS(GTK_TYPE_SIZE_GROUP_MODE, "Mode", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-radio-tool-button.c0000644000175000017500000000774312516434313022004 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRadioToolButton #define _SELF(self) (RVAL2GTKRADIOTOOLBUTTON(self)) static VALUE RG_TARGET_NAMESPACE; struct rbgtk_rval2gtkradiotoolbuttongslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbgtk_rval2gtkradiotoolbuttongslist_body(VALUE value) { long i; struct rbgtk_rval2gtkradiotoolbuttongslist_args *args = (struct rbgtk_rval2gtkradiotoolbuttongslist_args *)value; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, RVAL2GTKRADIOMENUITEM(RARRAY_PTR(args->ary)[i])); return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkradiotoolbuttongslist_rescue(VALUE value) { g_slist_free(((struct rbgtk_rval2gtkradiotoolbuttongslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbgtk_rval2gtkradiotoolbuttongslist(VALUE value) { struct rbgtk_rval2gtkradiotoolbuttongslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbgtk_rval2gtkradiotoolbuttongslist_body, (VALUE)&args, rbgtk_rval2gtkradiotoolbuttongslist_rescue, (VALUE)&args); return args.result; } #define RVAL2GTKRADIOTOOLBUTTONGSLIST(value) rbgtk_rval2gtkradiotoolbuttongslist(value) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE group_or_stock_id, rbstock_id; GtkToolItem *widget; if (rb_scan_args(argc, argv, "02", &group_or_stock_id, &rbstock_id) > 0) { GSList *group = NULL; const gchar *stock_id = TYPE(rbstock_id) == T_SYMBOL ? rb_id2name(SYM2ID(rbstock_id)) : RVAL2CSTR_ACCEPT_NIL(rbstock_id); if (TYPE(group_or_stock_id) == T_ARRAY) /* TODO: This has a potential for leaking. */ group = RVAL2GTKRADIOTOOLBUTTONGSLIST(group_or_stock_id); else if (rb_obj_is_kind_of(group_or_stock_id, RG_TARGET_NAMESPACE)) group = gtk_radio_tool_button_get_group(_SELF(group_or_stock_id)); if (stock_id == NULL) widget = gtk_radio_tool_button_new(group); else widget = gtk_radio_tool_button_new_from_stock(group, stock_id); } else { widget = gtk_radio_tool_button_new(NULL); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rbtn_get_group(VALUE self) { return GOBJGSLIST2RVAL(gtk_radio_tool_button_get_group(_SELF(self))); } static VALUE rbtn_set_group(VALUE self, VALUE rbgroup) { GtkRadioToolButton *button = _SELF(self); GSList *group = TYPE(rbgroup) == T_ARRAY ? /* TODO: This might leak. */ RVAL2GTKRADIOTOOLBUTTONGSLIST(rbgroup) : gtk_radio_tool_button_get_group(_SELF(rbgroup)); gtk_radio_tool_button_set_group(button, group); return self; } void Init_gtk_radiotoolbutton(VALUE mGtk) { RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_TOOL_BUTTON, "RadioToolButton", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "group", rbtn_get_group, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "group", rbtn_set_group, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-window.c0000644000175000017500000003413312516434313017722 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2011 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cWindow #define _SELF(s) (RVAL2GTKWINDOW(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg; GtkWindowType tp = GTK_WINDOW_TOPLEVEL; const gchar *title = NULL; GtkWidget* window = NULL; if (rb_scan_args(argc, argv, "01", &arg) == 1) { if (TYPE(arg) == T_STRING) { StringValue(arg); title = RVAL2CSTR(arg); } else { tp = RVAL2GTKWINDOWTYPE(arg); } } window = gtk_window_new(tp); if (title != NULL) gtk_window_set_title(GTK_WINDOW(window), title); RBGTK_INITIALIZE(self, window); return Qnil; } static VALUE rg_set_wmclass(VALUE self, VALUE wmclass_name, VALUE wmclass_class) { gtk_window_set_wmclass(_SELF(self), RVAL2CSTR_ACCEPT_NIL(wmclass_name), RVAL2CSTR_ACCEPT_NIL(wmclass_class)); return self; } static VALUE rg_add_accel_group(VALUE self, VALUE accel) { gtk_window_add_accel_group(_SELF(self), RVAL2GTKACCELGROUP(accel)); G_CHILD_ADD(self, accel); return self; } static VALUE rg_remove_accel_group(VALUE self, VALUE accel) { gtk_window_remove_accel_group(_SELF(self), RVAL2GTKACCELGROUP(accel)); G_CHILD_REMOVE(self, accel); return self; } static VALUE gwin_activate_focus(VALUE self) { return CBOOL2RVAL(gtk_window_activate_focus(_SELF(self))); } static VALUE gwin_activate_default(VALUE self) { return CBOOL2RVAL(gtk_window_activate_default(_SELF(self))); } static VALUE rg_set_default_size(VALUE self, VALUE w, VALUE h) { gtk_window_set_default_size(_SELF(self), NUM2INT(w), NUM2INT(h)); return self; } static VALUE rg_set_geometry_hints(VALUE self, VALUE geometry_widget, VALUE geometry, VALUE geom_mask) { gtk_window_set_geometry_hints(_SELF(self), RVAL2GTKWIDGET(geometry_widget), RVAL2GDKGEOMETRY(geometry), RVAL2GDKWINDOWHINTS(geom_mask)); return self; } static VALUE rg_s_toplevels(G_GNUC_UNUSED VALUE self) { GList* list = gtk_window_list_toplevels(); VALUE ret = GOBJGLIST2RVAL(list); g_list_foreach(list, (GFunc)g_object_ref, NULL); g_list_free(list); return ret; } static VALUE rg_add_mnemonic(VALUE self, VALUE keyval, VALUE target) { gtk_window_add_mnemonic(_SELF(self), NUM2INT(keyval), RVAL2GTKWIDGET(target)); return self; } static VALUE rg_remove_mnemonic(VALUE self, VALUE keyval, VALUE target) { gtk_window_remove_mnemonic(_SELF(self), NUM2INT(keyval), RVAL2GTKWIDGET(target)); return self; } static VALUE rg_mnemonic_activate(VALUE self, VALUE keyval, VALUE modifier) { return CBOOL2RVAL(gtk_window_mnemonic_activate(_SELF(self), NUM2INT(keyval), RVAL2GDKMODIFIERTYPE(modifier))); } static VALUE rg_focus(VALUE self) { return GOBJ2RVAL(gtk_window_get_focus(_SELF(self))); } static VALUE rg_set_focus(VALUE self, VALUE win) { gtk_window_set_focus(_SELF(self), NIL_P(win) ? NULL : RVAL2GTKWIDGET(win)); return self; } static VALUE rg_set_default(VALUE self, VALUE win) { gtk_window_set_default(_SELF(self), NIL_P(win) ? NULL : RVAL2GTKWIDGET(win)); return self; } static VALUE rg_present(int argc, VALUE *argv, VALUE self) { VALUE timestamp; if (rb_scan_args(argc, argv, "01", ×tamp) == 1) { gtk_window_present_with_time(_SELF(self), NUM2UINT(timestamp)); } else { gtk_window_present(_SELF(self)); } return self; } static VALUE rg_iconify(VALUE self) { gtk_window_iconify(_SELF(self)); return self; } static VALUE rg_deiconify(VALUE self) { gtk_window_deiconify(_SELF(self)); return self; } static VALUE rg_stick(VALUE self) { gtk_window_stick(_SELF(self)); return self; } static VALUE rg_unstick(VALUE self) { gtk_window_unstick(_SELF(self)); return self; } static VALUE rg_maximize(VALUE self) { gtk_window_maximize(_SELF(self)); return self; } static VALUE rg_unmaximize(VALUE self) { gtk_window_unmaximize(_SELF(self)); return self; } static VALUE rg_fullscreen(VALUE self) { gtk_window_fullscreen(_SELF(self)); return self; } static VALUE rg_unfullscreen(VALUE self) { gtk_window_unfullscreen(_SELF(self)); return self; } static VALUE rg_set_keep_above(VALUE self, VALUE setting) { gtk_window_set_keep_above(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_keep_below(VALUE self, VALUE setting) { gtk_window_set_keep_below(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_begin_resize_drag(VALUE self, VALUE edge, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp) { gtk_window_begin_resize_drag(_SELF(self), RVAL2GDKWINDOWEDGE(edge), NUM2INT(button), NUM2INT(root_x), NUM2INT(root_y), NUM2UINT(timestamp)); return self; } static VALUE rg_begin_move_drag(VALUE self, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp) { gtk_window_begin_move_drag(_SELF(self), NUM2INT(button), NUM2INT(root_x), NUM2INT(root_y), NUM2UINT(timestamp)); return self; } static VALUE rg_set_mnemonic_modifier(VALUE self, VALUE modifier) { gtk_window_set_mnemonic_modifier(_SELF(self), RVAL2GDKMODIFIERTYPE(modifier)); return self; } static VALUE rg_s_default_icon_list(G_GNUC_UNUSED VALUE self) { return GOBJGLIST2RVAL_FREE(gtk_window_get_default_icon_list(), g_list_free, NULL); } static VALUE rg_default_size(VALUE self) { int width, height; gtk_window_get_default_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_icon_list(VALUE self) { return GOBJGLIST2RVAL_FREE(gtk_window_get_icon_list(_SELF(self)), g_list_free, NULL); } static VALUE rg_mnemonic_modifier(VALUE self) { return GDKMODIFIERTYPE2RVAL(gtk_window_get_mnemonic_modifier(_SELF(self))); } static VALUE rg_position(VALUE self) { int root_x, root_y; gtk_window_get_position(_SELF(self), &root_x, &root_y); return rb_ary_new3(2, INT2NUM(root_x), INT2NUM(root_y)); } static VALUE rg_size(VALUE self) { int width, height; gtk_window_get_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_group(VALUE self) { return GOBJ2RVAL(gtk_window_get_group(_SELF(self))); } static VALUE rg_move(VALUE self, VALUE x, VALUE y) { gtk_window_move(_SELF(self), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_parse_geometry(VALUE self, VALUE geometry) { return CBOOL2RVAL(gtk_window_parse_geometry(_SELF(self), RVAL2CSTR(geometry))); } static VALUE rg_reshow_with_initial_size(VALUE self) { gtk_window_reshow_with_initial_size(_SELF(self)); return self; } static VALUE rg_resize(VALUE self, VALUE width, VALUE height) { gtk_window_resize(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_s_set_default_icon_list(G_GNUC_UNUSED VALUE self, VALUE rblist) { GList *list = RVAL2GDKPIXBUFGLIST(rblist); gtk_window_set_default_icon_list(list); g_list_free(list); return rblist; } static VALUE rg_s_set_default_icon(VALUE self, VALUE icon_or_filename) { if (TYPE(icon_or_filename) == T_STRING){ GError* err; gboolean ret = gtk_window_set_default_icon_from_file(RVAL2CSTR(icon_or_filename), &err); if (! ret) RAISE_GERROR(err); } else { gtk_window_set_default_icon(RVAL2GDKPIXBUF(icon_or_filename)); } return self; } static VALUE rg_s_set_default_icon_name(VALUE self, VALUE name) { gtk_window_set_default_icon_name(RVAL2CSTR(name)); return self; } static VALUE gwin_set_icon(VALUE self, VALUE icon_or_filename) { if (TYPE(icon_or_filename) == T_STRING){ GError* err; gboolean ret = gtk_window_set_icon_from_file(_SELF(self), RVAL2CSTR(icon_or_filename), &err); if (! ret) RAISE_GERROR(err); } else { gtk_window_set_icon(_SELF(self), RVAL2GDKPIXBUF(icon_or_filename)); } return self; } static VALUE rg_set_icon_list(VALUE self, VALUE rblist) { GtkWindow *window = _SELF(self); GList *list = RVAL2GDKPIXBUFGLIST(rblist); gtk_window_set_icon_list(window, list); g_list_free(list); /* TODO: Shouldn't we return self? */ return rblist; } static VALUE rg_s_set_auto_startup_notification(VALUE self, VALUE setting) { gtk_window_set_auto_startup_notification(RVAL2CBOOL(setting)); return self; } static void mark_toplevels(G_GNUC_UNUSED void *_) { GList* list = gtk_window_list_toplevels(); GList* p; for (p = list; p; p = g_list_next(p)) rbgobj_gc_mark_instance(p->data); g_list_free(list); } static VALUE rg_s_default_icon_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gtk_window_get_default_icon_name()); } static VALUE rg_activate_key(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_window_activate_key(_SELF(self), RVAL2GDKEVENTKEY(event))); } static VALUE rg_default_widget(VALUE self) { return GOBJ2RVAL(gtk_window_get_default_widget(_SELF(self))); } static VALUE rg_resize_grip_area(VALUE self) { GdkRectangle rect; gboolean result; result = gtk_window_get_resize_grip_area(_SELF(self), &rect); return result ? GDKRECTANGLE2RVAL(&rect) : Qnil; } static VALUE rg_has_group_p(VALUE self) { return CBOOL2RVAL(gtk_window_has_group(_SELF(self))); } static VALUE rg_propagate_key_event(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_window_propagate_key_event(_SELF(self), RVAL2GDKEVENTKEY(event))); } static VALUE rg_resize_to_geometry(VALUE self, VALUE width, VALUE height) { gtk_window_resize_to_geometry(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_set_default_geometry(VALUE self, VALUE width, VALUE height) { gtk_window_set_default_geometry(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_set_titlebar(VALUE self, VALUE titlebar) { gtk_window_set_titlebar(_SELF(self), RVAL2GTKWIDGET(titlebar)); return self; } void Init_gtk_window(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WINDOW, "Window", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_wmclass, 2); RG_DEF_METHOD(add_accel_group, 1); RG_DEF_METHOD(remove_accel_group, 1); G_REPLACE_ACTION(RG_TARGET_NAMESPACE, "activate_focus", gwin_activate_focus, 0); G_REPLACE_ACTION(RG_TARGET_NAMESPACE, "activate_default", gwin_activate_default, 0); RG_DEF_METHOD(set_default_size, 2); RG_DEF_METHOD(set_geometry_hints, 3); RG_DEF_SMETHOD(toplevels, 0); RG_DEF_METHOD(add_mnemonic, 2); RG_DEF_METHOD(remove_mnemonic, 2); RG_DEF_METHOD(mnemonic_activate, 2); RG_DEF_METHOD(focus, 0); RG_DEF_METHOD(set_focus, 1); RG_DEF_METHOD(set_default, 1); RG_DEF_METHOD(present, -1); RG_DEF_METHOD(iconify, 0); RG_DEF_METHOD(deiconify, 0); RG_DEF_METHOD(stick, 0); RG_DEF_METHOD(unstick, 0); RG_DEF_METHOD(maximize, 0); RG_DEF_METHOD(unmaximize, 0); RG_DEF_METHOD(fullscreen, 0); RG_DEF_METHOD(unfullscreen, 0); RG_DEF_METHOD(set_keep_above, 1); RG_DEF_METHOD(set_keep_below, 1); RG_DEF_METHOD(begin_resize_drag, 5); RG_DEF_METHOD(begin_move_drag, 4); RG_DEF_METHOD(set_mnemonic_modifier, 1); RG_DEF_METHOD(default_size, 0); RG_DEF_SMETHOD(default_icon_list, 0); RG_DEF_METHOD(icon_list, 0); RG_DEF_METHOD(mnemonic_modifier, 0); RG_DEF_METHOD(position, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(group, 0); RG_DEF_METHOD(move, 2); RG_DEF_METHOD(parse_geometry, 1); RG_DEF_METHOD(reshow_with_initial_size, 0); RG_DEF_METHOD(resize, 2); RG_DEF_SMETHOD(set_default_icon_list, 1); RG_DEF_SMETHOD(set_default_icon, 1); RG_DEF_SMETHOD(set_default_icon_name, 1); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "icon", gwin_set_icon, 1); RG_DEF_METHOD(set_icon_list, 1); RG_DEF_SMETHOD(set_auto_startup_notification, 1); RG_DEF_SMETHOD(default_icon_name, 0); RG_DEF_METHOD(activate_key, 1); RG_DEF_METHOD(default_widget, 0); RG_DEF_METHOD(resize_grip_area, 0); RG_DEF_METHOD_P(has_group, 0); RG_DEF_METHOD(propagate_key_event, 1); RG_DEF_METHOD(resize_to_geometry, 2); RG_DEF_METHOD(set_default_geometry, 2); RG_DEF_METHOD(set_titlebar, 1); G_DEF_CLASS(GTK_TYPE_WINDOW_POSITION, "Position", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE); { static VALUE toplevels_marker; toplevels_marker = rb_data_object_alloc(rb_cData, NULL, mark_toplevels, NULL); rb_global_variable(&toplevels_marker); } } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-file-chooser-dialog.c0000644000175000017500000000432412516434313022226 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFileChooserDialog #define _SELF(self) RVAL2GTKFILECHOOSERDIALOG(self) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title, rb_parent, rb_action, rb_button_ary; const gchar *title; GtkWindow *parent; GtkFileChooserAction action; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, "parent", &rb_parent, "action", &rb_action, "buttons", &rb_button_ary, NULL); title = RVAL2CSTR_ACCEPT_NIL(rb_title); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); action = NIL_P(rb_action) ? GTK_FILE_CHOOSER_ACTION_OPEN : RVAL2GTKFILECHOOSERACTION(rb_action); dialog = gtk_file_chooser_dialog_new(title, parent, action, NULL, NULL); RBGTK_INITIALIZE(self, dialog); if (!NIL_P(rb_button_ary)) rb_funcall2(self, rb_intern("add_buttons"), RARRAY_LEN(rb_button_ary), RARRAY_PTR(rb_button_ary)); return Qnil; } void Init_gtk_file_chooser_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_DIALOG, "FileChooserDialog", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-info.c0000644000175000017500000001262112516434313020622 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentInfo #define _SELF(self) (RVAL2GTKRECENTINFO(self)) static VALUE rg_uri(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_uri(_SELF(self))); } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_display_name(_SELF(self))); } static VALUE rg_description(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_description(_SELF(self))); } static VALUE rg_mime_type(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_mime_type(_SELF(self))); } static VALUE rg_added(VALUE self) { time_t t = gtk_recent_info_get_added(_SELF(self)); return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t)); } static VALUE rg_modified(VALUE self) { time_t t = gtk_recent_info_get_modified(_SELF(self)); return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t)); } static VALUE rg_visited(VALUE self) { time_t t = gtk_recent_info_get_visited(_SELF(self)); return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t)); } static VALUE rg_private_hint_p(VALUE self) { return CBOOL2RVAL(gtk_recent_info_get_private_hint(_SELF(self))); } static VALUE rg_application_info(VALUE self, VALUE app_name) { const gchar *app_exec; guint count; time_t t; gboolean ret = gtk_recent_info_get_application_info(_SELF(self), RVAL2CSTR(app_name), &app_exec, &count, &t); VALUE ary = rb_ary_new(); if (ret){ rb_ary_push(ary, CSTR2RVAL(app_exec)); rb_ary_push(ary, UINT2NUM(count)); rb_ary_push(ary, rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t))); } return ary; } static VALUE rg_applications(VALUE self) { gsize i; gsize length; gchar** str = gtk_recent_info_get_applications(_SELF(self), &length); VALUE ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(str[i])); } g_strfreev(str); return ary; } static VALUE rg_last_application(VALUE self) { return CSTR2RVAL(gtk_recent_info_last_application(_SELF(self))); } static VALUE rg_groups(VALUE self) { gsize i; gsize length; gchar** str = gtk_recent_info_get_groups(_SELF(self), &length); VALUE ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(str[i])); } g_strfreev(str); return ary; } static VALUE rg_has_group_p(VALUE self, VALUE group_name) { return CBOOL2RVAL(gtk_recent_info_has_group(_SELF(self), RVAL2CSTR(group_name))); } static VALUE rg_has_application_p(VALUE self, VALUE app_name) { return CBOOL2RVAL(gtk_recent_info_has_application(_SELF(self), RVAL2CSTR(app_name))); } static VALUE rg_get_icon(VALUE self, VALUE size) { return GOBJ2RVAL(gtk_recent_info_get_icon(_SELF(self), NUM2INT(size))); } static VALUE rg_short_name(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_short_name(_SELF(self))); } static VALUE rg_uri_display(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_uri_display(_SELF(self))); } static VALUE rg_age(VALUE self) { return INT2NUM(gtk_recent_info_get_age(_SELF(self))); } static VALUE rg_local_p(VALUE self) { return CBOOL2RVAL(gtk_recent_info_is_local(_SELF(self))); } static VALUE rg_exist_p(VALUE self) { return CBOOL2RVAL(gtk_recent_info_exists(_SELF(self))); } static VALUE rg_operator_ri_match(VALUE self, VALUE other) { return CBOOL2RVAL(gtk_recent_info_match(_SELF(self), _SELF(other))); } void Init_gtk_recent_info(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_INFO, "RecentInfo", mGtk); RG_DEF_METHOD(uri, 0); RG_DEF_METHOD(display_name, 0); RG_DEF_METHOD(description, 0); RG_DEF_METHOD(mime_type, 0); RG_DEF_METHOD(added, 0); RG_DEF_METHOD(modified, 0); RG_DEF_METHOD(visited, 0); RG_DEF_METHOD_P(private_hint, 0); RG_DEF_METHOD(application_info, 1); RG_DEF_METHOD(applications, 0); RG_DEF_METHOD(last_application, 0); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD_P(has_group, 1); RG_DEF_METHOD_P(has_application, 1); RG_DEF_METHOD(get_icon, 1); RG_DEF_METHOD(short_name, 0); RG_DEF_METHOD(uri_display, 0); RG_DEF_METHOD(age, 0); RG_DEF_METHOD_P(local, 0); RG_DEF_METHOD_P(exist, 0); RG_DEF_METHOD_OPERATOR("==", ri_match, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-assistant.c0000644000175000017500000001270612516434313020426 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAssistant #define _SELF(s) (RVAL2GTKASSISTANT(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), RVAL2GTKWIDGET(page))); } static VALUE rg_append_page(VALUE self, VALUE page) { return INT2NUM(gtk_assistant_append_page(_SELF(self), RVAL2GTKWIDGET(page))); } static VALUE rg_insert_page(VALUE self, VALUE page, VALUE position) { return INT2NUM(gtk_assistant_insert_page(_SELF(self), RVAL2GTKWIDGET(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), RVAL2GTKWIDGET(page), RVAL2GTKASSISTANTPAGETYPE(type)); return self; } static VALUE rg_get_page_type(VALUE self, VALUE page) { return GTKASSISTANTPAGETYPE2RVAL(gtk_assistant_get_page_type(_SELF(self), RVAL2GTKWIDGET(page))); } static VALUE rg_set_page_title(VALUE self, VALUE page, VALUE title) { gtk_assistant_set_page_title(_SELF(self), RVAL2GTKWIDGET(page), RVAL2CSTR(title)); return self; } static VALUE rg_get_page_title(VALUE self, VALUE page) { return CSTR2RVAL(gtk_assistant_get_page_title(_SELF(self), RVAL2GTKWIDGET(page))); } static VALUE rg_set_page_complete(VALUE self, VALUE page, VALUE complete) { gtk_assistant_set_page_complete(_SELF(self), RVAL2GTKWIDGET(page), RVAL2CBOOL(complete)); return self; } static VALUE rg_get_page_complete(VALUE self, VALUE page) { return CBOOL2RVAL(gtk_assistant_get_page_complete(_SELF(self), RVAL2GTKWIDGET(page))); } static VALUE rg_add_action_widget(VALUE self, VALUE child) { gtk_assistant_add_action_widget(_SELF(self), RVAL2GTKWIDGET(child)); return self; } static VALUE rg_remove_action_widget(VALUE self, VALUE child) { gtk_assistant_remove_action_widget(_SELF(self), RVAL2GTKWIDGET(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; } static VALUE rg_next_page(VALUE self) { gtk_assistant_next_page(_SELF(self)); return self; } static VALUE rg_previous_page(VALUE self) { gtk_assistant_previous_page(_SELF(self)); return self; } #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_remove_page(VALUE self, VALUE page_num) { gtk_assistant_remove_page(_SELF(self), NUM2INT(page_num)); return self; } #endif void Init_gtk_assistant(VALUE mGtk) { 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_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); RG_DEF_METHOD(next_page, 0); RG_DEF_METHOD(previous_page, 0); #if GTK_CHECK_VERSION(3, 2, 0) RG_DEF_METHOD(remove_page, 1); #endif G_DEF_CLASS(GTK_TYPE_ASSISTANT_PAGE_TYPE, "PageType", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-layout.c0000644000175000017500000000521012516434313017722 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cLayout #define _SELF(self) (RVAL2GTKLAYOUT(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE hadjustment, vadjustment; GtkWidget* layout; rb_scan_args(argc, argv, "02", &hadjustment, &vadjustment); layout = gtk_layout_new( NIL_P(hadjustment) ? 0 : RVAL2GTKADJUSTMENT(hadjustment), NIL_P(vadjustment) ? 0 : RVAL2GTKADJUSTMENT(vadjustment)); RBGTK_INITIALIZE(self, layout); return Qnil; } static VALUE rg_put(VALUE self, VALUE widget, VALUE x, VALUE y) { gtk_layout_put(_SELF(self), RVAL2GTKWIDGET(widget), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_move(VALUE self, VALUE widget, VALUE x, VALUE y) { gtk_layout_move(_SELF(self), RVAL2GTKWIDGET(widget), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_set_size(VALUE self, VALUE width, VALUE height) { gtk_layout_set_size(_SELF(self), NUM2UINT(width), NUM2UINT(height)); return self; } static VALUE rg_size(VALUE self) { guint width, height; gtk_layout_get_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_bin_window(VALUE self) { return GOBJ2RVAL(gtk_layout_get_bin_window(_SELF(self))); } void Init_gtk_layout(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LAYOUT, "Layout", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(put, 3); RG_DEF_METHOD(move, 3); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(bin_window, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-button.c0000644000175000017500000000546612516434313017735 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cButton #define _SELF(self) (RVAL2GTKBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE button; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &button); if (NIL_P(button)) { widget = gtk_button_new(); } else if (TYPE(button) == T_HASH) { VALUE label, mnemonic, stock_id, buffer; rbg_scan_options(button, "label", &label, "mnemonic", &mnemonic, "stock_id", &stock_id, NULL); if (!NIL_P(label)) widget = gtk_button_new_with_label(RVAL2CSTR(label)); else if (!NIL_P(mnemonic)) widget = gtk_button_new_with_mnemonic(RVAL2CSTR(mnemonic)); else if (!NIL_P(stock_id)) widget = gtk_button_new_from_stock(RVAL2GLIBID(stock_id, buffer)); } if (!widget) rb_raise(rb_eArgError, "Invalid arguments."); RBGTK_INITIALIZE(self, widget); return Qnil; } 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)); } static VALUE rg_event_window(VALUE self) { return GOBJ2RVAL(gtk_button_get_event_window(_SELF(self))); } 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(set_alignment, 2); RG_DEF_METHOD(alignment, 0); RG_DEF_METHOD(event_window, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-expander.c0000644000175000017500000000312712516434313020220 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cExpander #define _SELF(self) (RVAL2GTKEXPANDER(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "11", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ widget = gtk_expander_new(RVAL2CSTR(label)); } else { widget = gtk_expander_new_with_mnemonic(RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_expander(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_EXPANDER, "Expander", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-view.c0000644000175000017500000002106612516434313020314 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIconView #define _SELF(s) (RVAL2GTKICONVIEW(s)) static ID id_model; static ID id_select_path; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE model; rb_scan_args(argc, argv, "01", &model); if (NIL_P(model)){ RBGTK_INITIALIZE(self, gtk_icon_view_new()); } else { G_CHILD_SET(self, id_model, model); RBGTK_INITIALIZE(self, gtk_icon_view_new_with_model(RVAL2GTKTREEMODEL(model))); } return Qnil; } static VALUE rg_get_path_at_pos(VALUE self, VALUE x, VALUE y) { return GTKTREEPATH2RVAL(gtk_icon_view_get_path_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y))); } static void iview_foreach_func(GtkIconView *iview, GtkTreePath *path, gpointer *func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(iview), GTKTREEPATH2RVAL(path)); } static VALUE rg_selected_each(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_icon_view_selected_foreach(_SELF(self), (GtkIconViewForeachFunc)iview_foreach_func, (gpointer)func); return self; } #if GTK_CHECK_VERSION(3, 6, 0) static VALUE rg_get_cell_rect(int argc, VALUE *argv, VALUE self) { VALUE path, cell; GdkRectangle rectangle; gboolean found; rb_scan_args(argc, argv, "11", &path, &cell); found = gtk_icon_view_get_cell_rect(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKCELLRENDERER(cell), &rectangle); if (!found) { return Qnil; } return GDKRECTANGLE2RVAL(&rectangle); } #endif static VALUE rg_select_path(VALUE self, VALUE path) { G_CHILD_SET(self, id_select_path, path); gtk_icon_view_select_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_unselect_path(VALUE self, VALUE path) { G_CHILD_UNSET(self, id_select_path); gtk_icon_view_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_path_is_selected_p(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_icon_view_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_selected_items(VALUE self) { GList* list = gtk_icon_view_get_selected_items(_SELF(self)); VALUE ret = BOXEDGLIST2RVAL(list, GTK_TYPE_TREE_PATH); g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL); g_list_free(list); return ret; } static VALUE rg_item_activated(VALUE self, VALUE path) { gtk_icon_view_item_activated(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_create_drag_icon(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_icon_view_create_drag_icon(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_enable_model_drag_dest(VALUE self, VALUE rbtargets, VALUE rbactions) { GtkIconView *icon_view = _SELF(self); GdkDragAction actions = RVAL2GDKDRAGACTION(rbactions); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_icon_view_enable_model_drag_dest(icon_view, targets, n, actions); g_free(targets); return self; } static VALUE rg_enable_model_drag_source(VALUE self, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions) { GtkIconView *icon_view = _SELF(self); GdkModifierType start_button_mask = RVAL2GDKMODIFIERTYPE(rbstart_button_mask); GdkDragAction actions = RVAL2GDKDRAGACTION(rbactions); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_icon_view_enable_model_drag_source(icon_view, start_button_mask, targets, n, actions); g_free(targets); return self; } static VALUE rg_cursor(VALUE self) { GtkTreePath* path; GtkCellRenderer* cell; gboolean cursor_set = gtk_icon_view_get_cursor(_SELF(self), &path, &cell); return cursor_set ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil; } static VALUE rg_get_dest_item(VALUE self, VALUE drag_x, VALUE drag_y) { GtkTreePath* path; GtkIconViewDropPosition pos; gboolean item_at_pos = gtk_icon_view_get_dest_item_at_pos(_SELF(self), NUM2INT(drag_x), NUM2INT(drag_y), &path, &pos); return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path), GTKICONVIEWDROPPOSITION2RVAL(pos)) : Qnil; } static VALUE rg_drag_dest_item(VALUE self) { GtkTreePath* path; GtkIconViewDropPosition pos; gtk_icon_view_get_drag_dest_item(_SELF(self), &path, &pos); return rb_assoc_new(GTKTREEPATH2RVAL(path), GTKICONVIEWDROPPOSITION2RVAL(pos)); } static VALUE rg_get_item(VALUE self, VALUE x, VALUE y) { GtkTreePath* path; GtkCellRenderer* cell; gboolean item_at_pos = gtk_icon_view_get_item_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y), &path, &cell); return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil; } static VALUE rg_visible_range(VALUE self) { GtkTreePath* start_path; GtkTreePath* end_path; gboolean valid_paths = gtk_icon_view_get_visible_range(_SELF(self), &start_path, &end_path); return valid_paths ? rb_assoc_new(GTKTREEPATH2RVAL(start_path), GTKTREEPATH2RVAL(end_path)) : Qnil; } static VALUE rg_scroll_to_path(VALUE self, VALUE path, VALUE use_align, VALUE row_align, VALUE col_align) { gtk_icon_view_scroll_to_path(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2CBOOL(use_align), NUM2DBL(row_align), NUM2DBL(col_align)); return self; } static VALUE rg_set_cursor(VALUE self, VALUE path, VALUE cell, VALUE start_editing) { gtk_icon_view_set_cursor(_SELF(self), RVAL2GTKTREEPATH(path), NIL_P(cell) ? NULL : RVAL2GTKCELLRENDERER(cell), RVAL2CBOOL(start_editing)); return self; } static VALUE rg_set_drag_dest_item(VALUE self, VALUE path, VALUE pos) { gtk_icon_view_set_drag_dest_item(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), RVAL2GTKICONVIEWDROPPOSITION(pos)); return self; } static VALUE rg_unset_model_drag_dest(VALUE self) { gtk_icon_view_unset_model_drag_dest(_SELF(self)); return self; } static VALUE rg_unset_model_drag_source(VALUE self) { gtk_icon_view_unset_model_drag_source(_SELF(self)); return self; } void Init_gtk_iconview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_VIEW, "IconView", mGtk); id_model = rb_intern("model"); id_select_path = rb_intern("select_path"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(get_path_at_pos, 2); RG_DEF_ALIAS("get_path", "get_path_at_pos"); RG_DEF_METHOD(selected_each, 0); #if GTK_CHECK_VERSION(3, 6, 0) RG_DEF_METHOD(get_cell_rect, -1); #endif RG_DEF_METHOD(select_path, 1); RG_DEF_METHOD(unselect_path, 1); RG_DEF_METHOD_P(path_is_selected, 1); RG_DEF_METHOD(selected_items, 0); RG_DEF_METHOD(item_activated, 1); RG_DEF_METHOD(create_drag_icon, 1); RG_DEF_METHOD(enable_model_drag_dest, 2); RG_DEF_METHOD(enable_model_drag_source, 3); RG_DEF_METHOD(cursor, 0); RG_DEF_METHOD(get_dest_item, 2); RG_DEF_METHOD(drag_dest_item, 0); RG_DEF_METHOD(get_item, 2); RG_DEF_METHOD(visible_range, 0); RG_DEF_METHOD(scroll_to_path, 4); RG_DEF_METHOD(set_cursor, 3); RG_DEF_METHOD(set_drag_dest_item, 2); RG_DEF_METHOD(unset_model_drag_dest, 0); RG_DEF_METHOD(unset_model_drag_source, 0); G_DEF_CLASS(GTK_TYPE_ICON_VIEW_DROP_POSITION, "Type", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-table.c0000644000175000017500000001261612516434313017504 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTable #define _SELF(self) (RVAL2GTKTABLE(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE row, col, homogeneous; rb_scan_args(argc, argv, "21", &row, &col, &homogeneous); RBGTK_INITIALIZE(self, gtk_table_new(NUM2INT(row), NUM2INT(col), RVAL2CBOOL(homogeneous))); return Qnil; } static VALUE rg_resize(VALUE self, VALUE rows, VALUE columns) { gtk_table_resize(_SELF(self), NUM2UINT(rows), NUM2UINT(columns)); return self; } static VALUE rg_attach(int argc, VALUE *argv, VALUE self) { VALUE child, left, right, top, bottom; VALUE arg0, arg1, arg2, arg3; gint xspc, yspc; GtkAttachOptions xopt, yopt; xopt = yopt = GTK_EXPAND | GTK_FILL; xspc = yspc = 0; rb_scan_args(argc, argv, "54", &child, &left, &right, &top, &bottom, &arg0, &arg1, &arg2, &arg3); if (!NIL_P(arg0)) xopt = RVAL2GTKATTACHOPTIONS(arg0); if (!NIL_P(arg1)) yopt = RVAL2GTKATTACHOPTIONS(arg1); if (!NIL_P(arg2)) xspc = NUM2INT(arg2); if (!NIL_P(arg3)) yspc = NUM2INT(arg3); gtk_table_attach(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(left),NUM2INT(right), NUM2INT(top),NUM2INT(bottom), xopt, yopt, xspc, yspc); G_CHILD_ADD(self, child); return self; } static VALUE rg_attach_defaults(VALUE self, VALUE widget, VALUE left_attach, VALUE right_attach, VALUE top_attach, VALUE bottom_attach) { gtk_table_attach_defaults(_SELF(self), RVAL2GTKWIDGET(widget), NUM2UINT(left_attach), NUM2UINT(right_attach), NUM2UINT(top_attach), NUM2UINT(bottom_attach)); G_CHILD_ADD(self, widget); return self; } static VALUE tbl_set_row_spacing(VALUE self, VALUE row, VALUE spc) { gtk_table_set_row_spacing(_SELF(self), NUM2UINT(row), NUM2UINT(spc)); return self; } static VALUE rg_get_row_spacing(VALUE self, VALUE row) { return UINT2NUM(gtk_table_get_row_spacing(_SELF(self), NUM2UINT(row))); } static VALUE tbl_set_col_spacing(VALUE self, VALUE col, VALUE spc) { gtk_table_set_col_spacing(_SELF(self), NUM2UINT(col), NUM2UINT(spc)); return self; } static VALUE rg_get_column_spacing(VALUE self, VALUE col) { return UINT2NUM(gtk_table_get_col_spacing(_SELF(self), NUM2UINT(col))); } static VALUE rg_set_row_spacings(VALUE self, VALUE spc) { gtk_table_set_row_spacings(_SELF(self), NUM2UINT(spc)); return self; } static VALUE rg_set_column_spacings(VALUE self, VALUE spc) { gtk_table_set_col_spacings(_SELF(self), NUM2UINT(spc)); return self; } /* deprecated static VALUE rg_row_spacings(VALUE self) { return UINT2NUM(_SELF(self)->row_spacing); } static VALUE rg_column_spacings(VALUE self) { return UINT2NUM(_SELF(self)->column_spacing); } */ static VALUE rg_default_row_spacing(VALUE self) { return UINT2NUM(gtk_table_get_default_row_spacing(_SELF(self))); } static VALUE rg_default_column_spacing(VALUE self) { return UINT2NUM(gtk_table_get_default_col_spacing(_SELF(self))); } static VALUE rg_size(VALUE self) { guint rows, columns; gtk_table_get_size(_SELF(self), &rows, &columns); return rb_ary_new3(2, UINT2NUM(rows), UINT2NUM(columns)); } void Init_gtk_table(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TABLE, "Table", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(resize, 2); RG_DEF_METHOD(attach, -1); RG_DEF_METHOD(attach_defaults, 5); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "row_spacing", tbl_set_row_spacing, 2); rb_undef_method(RG_TARGET_NAMESPACE, "row_spacing="); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "column_spacing", tbl_set_col_spacing, 2); rb_undef_method(RG_TARGET_NAMESPACE, "column_spacing="); RG_DEF_METHOD(get_row_spacing, 1); rb_undef_method(RG_TARGET_NAMESPACE, "row_spacing"); RG_DEF_METHOD(get_column_spacing, 1); rb_undef_method(RG_TARGET_NAMESPACE, "column_spacing"); RG_DEF_METHOD(set_row_spacings, 1); RG_DEF_METHOD(set_column_spacings, 1); /* deprecated RG_DEF_METHOD(row_spacings, 0); RG_DEF_METHOD(column_spacings, 0); */ RG_DEF_METHOD(default_row_spacing, 0); RG_DEF_METHOD(default_column_spacing, 0); RG_DEF_METHOD(size, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-scrolled-window.c0000644000175000017500000000666512516434313021540 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cScrolledWindow #define _SELF(self) (RVAL2GTKSCROLLEDWINDOW(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GtkAdjustment *h_adj = NULL; GtkAdjustment *v_adj = NULL; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (!NIL_P(arg1)) h_adj = RVAL2GTKADJUSTMENT(arg1); if (!NIL_P(arg2)) v_adj = RVAL2GTKADJUSTMENT(arg2); RBGTK_INITIALIZE(self, gtk_scrolled_window_new(h_adj, v_adj)); return Qnil; } static VALUE rg_set_policy(VALUE self, VALUE hpolicy, VALUE vpolicy) { gtk_scrolled_window_set_policy(_SELF(self), RVAL2GTKPOLICYTYPE(hpolicy), RVAL2GTKPOLICYTYPE(vpolicy)); return self; } static VALUE rg_policy(VALUE self) { GtkPolicyType hpolicy, vpolicy; gtk_scrolled_window_get_policy(_SELF(self), &hpolicy, &vpolicy); return rb_ary_new3(2, GTKPOLICYTYPE2RVAL(hpolicy), GTKPOLICYTYPE2RVAL(vpolicy)); } static VALUE rg_add_with_viewport(VALUE self, VALUE other) { gtk_scrolled_window_add_with_viewport(_SELF(self), RVAL2GTKWIDGET(other)); G_CHILD_ADD(self, other); return self; } static VALUE rg_hscrollbar(VALUE self) { return GOBJ2RVAL(gtk_scrolled_window_get_hscrollbar(_SELF(self))); } static VALUE rg_vscrollbar(VALUE self) { return GOBJ2RVAL(gtk_scrolled_window_get_vscrollbar(_SELF(self))); } static VALUE rg_set_placement(VALUE self, VALUE corner_type) { gtk_scrolled_window_set_placement(_SELF(self), RVAL2GTKCORNERTYPE(corner_type)); return self; } static VALUE rg_unset_placement(VALUE self) { gtk_scrolled_window_unset_placement(_SELF(self)); return self; } static VALUE rg_placement(VALUE self) { return GTKCORNERTYPE2RVAL(gtk_scrolled_window_get_placement(_SELF(self))); } void Init_gtk_scrolled_window(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCROLLED_WINDOW, "ScrolledWindow", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_policy, 2); RG_DEF_METHOD(policy, 0); RG_DEF_METHOD(add_with_viewport, 1); RG_DEF_METHOD(hscrollbar, 0); RG_DEF_METHOD(vscrollbar, 0); RG_DEF_METHOD(unset_placement, 0); RG_DEF_METHOD(placement, 0); RG_DEF_METHOD(set_placement, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-view-column.c0000644000175000017500000001656112516434313021622 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeViewColumn #define _SELF(s) (RVAL2GTKTREEVIEWCOLUMN(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { int i; int col; GtkTreeViewColumn *tvc; GtkCellRenderer *renderer; const gchar *name; VALUE ary, val; tvc = gtk_tree_view_column_new(); if (argc > 0){ gtk_tree_view_column_set_title(tvc, RVAL2CSTR(argv[0])); if (argc > 1) { gtk_tree_view_column_pack_start(tvc, RVAL2GTKCELLRENDERER(argv[1]), TRUE); G_CHILD_ADD(self, argv[1]); } } RBGTK_INITIALIZE(self, tvc); if (argc == 3){ ary = rb_funcall(argv[2], rb_intern("to_a"), 0); renderer = RVAL2GTKCELLRENDERER(argv[1]); for (i = 0; i < RARRAY_LEN(ary); i++) { val = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(val)) { name = rb_id2name(SYM2ID(val)); } else { name = RVAL2CSTR(val); } col = NUM2INT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); gtk_tree_view_column_add_attribute(_SELF(self), renderer, name, col); } } return Qnil; } static VALUE rg_pack_start(VALUE self, VALUE cell, VALUE expand) { G_CHILD_ADD(self, cell); gtk_tree_view_column_pack_start(_SELF(self), RVAL2GTKCELLRENDERER(cell), RVAL2CBOOL(expand)); return self; } static VALUE rg_pack_end(VALUE self, VALUE cell, VALUE expand) { G_CHILD_ADD(self, cell); gtk_tree_view_column_pack_end(_SELF(self), RVAL2GTKCELLRENDERER(cell), RVAL2CBOOL(expand)); return self; } static VALUE rg_clear(VALUE self) { G_CHILD_REMOVE_ALL(self); gtk_tree_view_column_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_tree_view_column_add_attribute(_SELF(self), RVAL2GTKCELLRENDERER(cell), name, NUM2INT(column)); return self; } static VALUE rg_set_attributes(VALUE self, VALUE renderer, VALUE attributes) { GtkTreeViewColumn *tvc; GtkCellRenderer *grenderer; const gchar *name; int i, col; VALUE ary, val; Check_Type(attributes, T_HASH); tvc = _SELF(self); grenderer = RVAL2GTKCELLRENDERER(renderer); gtk_tree_view_column_clear_attributes(tvc, grenderer); ary = rb_funcall(attributes, rb_intern("to_a"), 0); for (i = 0; i < RARRAY_LEN(ary); i++) { val = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(val)) { name = rb_id2name(SYM2ID(val)); } else { name = RVAL2CSTR(val); } col = NUM2INT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); gtk_tree_view_column_add_attribute(tvc, grenderer, name, col); } return self; } static void cell_data_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { iter->user_data3 = model; rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(tree_column), GOBJ2RVAL(cell), GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); } static VALUE rg_set_cell_data_func(VALUE self, VALUE renderer) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); G_RELATIVE(renderer, func); gtk_tree_view_column_set_cell_data_func(_SELF(self), RVAL2GTKCELLRENDERER(renderer), (GtkTreeCellDataFunc)cell_data_func, (gpointer)func, NULL); return self; } static VALUE rg_clear_attributes(VALUE self, VALUE cell) { gtk_tree_view_column_clear_attributes(_SELF(self), RVAL2GTKCELLRENDERER(cell)); return self; } static VALUE rg_clicked(VALUE self) { gtk_tree_view_column_clicked(_SELF(self)); return self; } static VALUE rg_cell_set_cell_data(VALUE self, VALUE model, VALUE iter, VALUE is_expander, VALUE is_expanded) { gtk_tree_view_column_cell_set_cell_data(_SELF(self), RVAL2GTKTREEMODEL(model), RVAL2GTKTREEITER(iter), RVAL2CBOOL(is_expander), RVAL2CBOOL(is_expanded)); return self; } static VALUE rg_cell_size(VALUE self) { GdkRectangle cell_area; gint x_offset, y_offset, width, height; VALUE cell; /* Is this collect implement for cell_area ? */ cell_area.x = -1; cell_area.y = -1; cell_area.width = -1; cell_area.height = -1; gtk_tree_view_column_cell_get_size(_SELF(self), &cell_area, &x_offset, &y_offset, &width, &height); if (cell_area.x == -1 || cell_area.y == -1 || cell_area.width == -1 || cell_area.height == -1){ cell = Qnil; } else { cell = GDKRECTANGLE2RVAL(&cell_area); } return rb_ary_new3(5, cell, x_offset ? INT2NUM(x_offset) : Qnil, y_offset ? INT2NUM(y_offset) : Qnil, width ? INT2NUM(width) : Qnil, height ? INT2NUM(height) : Qnil); } static VALUE rg_cell_is_visible_p(VALUE self) { return CBOOL2RVAL(gtk_tree_view_column_cell_is_visible(_SELF(self))); } static VALUE rg_focus_cell(VALUE self, VALUE renderer) { gtk_tree_view_column_focus_cell(_SELF(self), RVAL2GTKCELLRENDERER(renderer)); return self; } static VALUE rg_queue_resize(VALUE self) { gtk_tree_view_column_queue_resize(_SELF(self)); return self; } static VALUE rg_tree_view(VALUE self) { return GOBJ2RVAL(gtk_tree_view_column_get_tree_view(_SELF(self))); } void Init_gtk_treeviewcolumn(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_VIEW_COLUMN, "TreeViewColumn", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(pack_start, 2); RG_DEF_METHOD(pack_end, 2); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD(add_attribute, 3); RG_DEF_METHOD(set_attributes, 2); RG_DEF_METHOD(set_cell_data_func, 1); RG_DEF_METHOD(clear_attributes, 1); RG_DEF_METHOD(clicked, 0); RG_DEF_METHOD(cell_set_cell_data, 4); RG_DEF_METHOD(cell_size, 0); RG_DEF_METHOD_P(cell_is_visible, 0); RG_DEF_METHOD(focus_cell, 1); RG_DEF_METHOD(queue_resize, 0); RG_DEF_METHOD(tree_view, 0); G_DEF_CLASS(GTK_TYPE_TREE_VIEW_COLUMN_SIZING, "Sizing", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-accelerator.c0000644000175000017500000000461212516434313020676 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mAccelerator static VALUE rg_s_valid(G_GNUC_UNUSED VALUE self, VALUE keyval, VALUE modifiers) { return CBOOL2RVAL(gtk_accelerator_valid(NUM2UINT(keyval), RVAL2GDKMODIFIERTYPE(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), GDKMODIFIERTYPE2RVAL(mods)); } static VALUE rg_s_to_name(G_GNUC_UNUSED VALUE self, VALUE key, VALUE mods) { return CSTR2RVAL(gtk_accelerator_name(NUM2UINT(key), RVAL2GDKMODIFIERTYPE(mods))); } static VALUE rg_s_get_label(G_GNUC_UNUSED VALUE self, VALUE key, VALUE mods) { return CSTR2RVAL(gtk_accelerator_get_label(NUM2UINT(key), RVAL2GDKMODIFIERTYPE(mods))); } static VALUE rg_s_set_default_mod_mask(VALUE self, VALUE default_mod_mask) { gtk_accelerator_set_default_mod_mask(RVAL2GDKMODIFIERTYPE(default_mod_mask)); return self; } static VALUE rg_s_default_mod_mask(G_GNUC_UNUSED VALUE self) { return GDKMODIFIERTYPE2RVAL(gtk_accelerator_get_default_mod_mask()); } 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); RG_DEF_SMETHOD(get_label, 2); RG_DEF_SMETHOD(set_default_mod_mask, 1); RG_DEF_SMETHOD(default_mod_mask, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-filter-info.c0000644000175000017500000001110412516434313022100 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" /*****************************************/ static GtkRecentFilterInfo* rf_copy(const GtkRecentFilterInfo* info) { GtkRecentFilterInfo* new_info; g_return_val_if_fail (info != NULL, NULL); new_info = g_new(GtkRecentFilterInfo, 1); *new_info = *info; return new_info; } static void rf_free(GtkRecentFilterInfo* boxed) { if (boxed) { g_free(boxed->applications); g_free(boxed->groups); g_free(boxed); } } GType gtk_recent_filter_info_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkRecentFilterInfo", (GBoxedCopyFunc)rf_copy, (GBoxedFreeFunc)rf_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cRecentFilterInfo #define _SELF(w) (RVAL2GTKRECENTFILTERINFO(w)) static VALUE rg_initialize(VALUE self) { GtkRecentFilterInfo finfo; memset(&finfo, 0, sizeof(GtkRecentFilterInfo)); G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_RECENT_FILTER_INFO, &finfo)); return Qnil; } static VALUE rg_contains(VALUE self) { return GTKRECENTFILTERFLAGS2RVAL(_SELF(self)->contains); } static VALUE rg_set_contains(VALUE self, VALUE contains) { _SELF(self)->contains = RVAL2GTKRECENTFILTERFLAGS(contains); return self; } static VALUE rg_uri(VALUE self) { return CSTR2RVAL(_SELF(self)->uri); } static VALUE rg_set_uri(VALUE self, VALUE val) { _SELF(self)->uri = RVAL2CSTR(val); return self; } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(_SELF(self)->display_name); } static VALUE rg_set_display_name(VALUE self, VALUE val) { _SELF(self)->display_name = RVAL2CSTR(val); return self; } static VALUE rg_mime_type(VALUE self) { return CSTR2RVAL(_SELF(self)->mime_type); } static VALUE rg_set_mime_type(VALUE self, VALUE val) { _SELF(self)->mime_type = RVAL2CSTR(val); return self; } static VALUE rg_applications(VALUE self) { const gchar** apps = _SELF(self)->applications; VALUE ary = rb_ary_new(); gint i = 0; while (apps[i]) { rb_ary_push(ary, CSTR2RVAL((gchar*)apps[i])); i++; } return ary; } static VALUE rg_set_applications(VALUE self, VALUE applications) { /* NOTE: This can't be right. What guarantees that the entries in * applications will be around? It should be RVAL2STRV_DUP and use * g_strfreev in free above. */ _SELF(self)->applications = RVAL2STRV(applications); return self; } static VALUE rg_groups(VALUE self) { const gchar** grps = _SELF(self)->groups; VALUE ary = rb_ary_new(); gint i = 0; while (grps[i]) { rb_ary_push(ary, CSTR2RVAL((gchar*)grps[i])); i++; } return ary; } static VALUE rg_set_groups(VALUE self, VALUE groups) { _SELF(self)->groups = RVAL2STRV(groups); return self; } static VALUE rg_age(VALUE self) { return INT2NUM(_SELF(self)->age); } static VALUE rg_set_age(VALUE self, VALUE age) { _SELF(self)->age = NUM2INT(age); return self; } void Init_gtk_recent_filter_info(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_FILTER_INFO, "RecentFilterInfo", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(contains, 0); RG_DEF_METHOD(set_contains, 1); RG_DEF_METHOD(uri, 0); RG_DEF_METHOD(set_uri, 1); RG_DEF_METHOD(display_name, 0); RG_DEF_METHOD(set_display_name, 1); RG_DEF_METHOD(mime_type, 0); RG_DEF_METHOD(set_mime_type, 1); RG_DEF_METHOD(applications, 0); RG_DEF_METHOD(set_applications, 1); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD(set_groups, 1); RG_DEF_METHOD(age, 0); RG_DEF_METHOD(set_age, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-spin.c0000644000175000017500000000247112516434313022105 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererSpin #define _SELF(s) (RVAL2GTKCELLRENDERERSPIN(s)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_spin_new()); return Qnil; } void Init_gtk_cellrendererspin(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_SPIN, "CellRendererSpin", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/init.c0000644000175000017500000000224212516434313016243 0ustar koukou/* -*- 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 "rbgtk3private.h" extern void Init_gtk3(void); void Init_gtk3(void) { Init_gtk(); Init_conversions(); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-accel.c0000644000175000017500000000262112516434313022200 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererAccel #define _SELF(s) (RVAL2GTKCELLRENDERERACCEL(s)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_accel_new()); return Qnil; } void Init_gtk_cellrendereraccel(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_ACCEL, "CellRendererAccel", mGtk); RG_DEF_METHOD(initialize, 0); G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_ACCEL_MODE, "Mode", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-radio-menu-item.c0000644000175000017500000001101612516434313021402 0ustar koukou/* -*- 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, * dellin * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRadioMenuItem struct rbgtk_rval2gtkradiomenuitemgslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbgtk_rval2gtkradiomenuitemgslist_body(VALUE value) { long i; struct rbgtk_rval2gtkradiomenuitemgslist_args *args = (struct rbgtk_rval2gtkradiomenuitemgslist_args *)value; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, RVAL2GTKRADIOMENUITEM(RARRAY_PTR(args->ary)[i])); return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkradiomenuitemgslist_rescue(VALUE value) { g_slist_free(((struct rbgtk_rval2gtkradiomenuitemgslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbgtk_rval2gtkradiomenuitemgslist(VALUE value) { struct rbgtk_rval2gtkradiomenuitemgslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbgtk_rval2gtkradiomenuitemgslist_body, (VALUE)&args, rbgtk_rval2gtkradiomenuitemgslist_rescue, (VALUE)&args); return args.result; } #define RVAL2GTKRADIOMENUITEMGSLIST(value) rbgtk_rval2gtkradiomenuitemgslist(value) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; GtkWidget *widget; GSList *list = NULL; const gchar *label = NULL; const gchar *mnemonic = NULL; if (rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3) > 0 && TYPE(arg1) == T_STRING) { if (NIL_P(arg2) || RVAL2CBOOL(arg2)) mnemonic = RVAL2CSTR(arg1); else label = RVAL2CSTR(arg1); } else { if (!NIL_P(arg2)) { if (NIL_P(arg3) || RVAL2CBOOL(arg3)) mnemonic = RVAL2CSTR(arg2); else label = RVAL2CSTR(arg2); } if (rb_obj_is_kind_of(arg1, GTYPE2CLASS(GTK_TYPE_RADIO_MENU_ITEM))) list = gtk_radio_menu_item_get_group(RVAL2GTKRADIOMENUITEM(arg1)); else if (TYPE(arg1) == T_ARRAY) /* TODO: This might leak. */ list = RVAL2GTKRADIOMENUITEMGSLIST(arg1); else if (!NIL_P(arg1)) rb_raise(rb_eArgError, "invalid argument %s (expect Array or Gtk::RadioMenuItem)", rb_class2name(CLASS_OF(arg1))); } if (label != NULL) widget = gtk_radio_menu_item_new_with_label(list, label); else if (mnemonic != NULL) widget = gtk_radio_menu_item_new_with_mnemonic(list, mnemonic); else widget = gtk_radio_menu_item_new(list); RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rmitem_get_group(VALUE self) { return GOBJGSLIST2RVAL(gtk_radio_menu_item_get_group(RVAL2GTKRADIOMENUITEM(self))); } static VALUE rmitem_set_group(VALUE self, VALUE grp_ary) { GtkRadioMenuItem *rmitem2add, *rmitem_orig; GSList *group; rmitem2add = RVAL2GTKRADIOMENUITEM(self); rmitem_orig = RVAL2GTKRADIOMENUITEM(rb_ary_entry(grp_ary, 0)); group = gtk_radio_menu_item_get_group(rmitem_orig); gtk_radio_menu_item_set_group(rmitem2add, group); return GOBJGSLIST2RVAL(gtk_radio_menu_item_get_group(rmitem2add)); } void Init_gtk_radio_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_MENU_ITEM, "RadioMenuItem", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "group", rmitem_get_group, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "group", rmitem_set_group, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-imcon-text-simple.c0000644000175000017500000000420612516434313021767 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIMContextSimple #define _SELF(self) (RVAL2GTKIMCONTEXTSIMPLE(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_im_context_simple_new()); return Qnil; } /* TODO: Why are we taking a third argument? Shouldn't it be determined by the * length of rbdata? */ static VALUE rg_add_table(VALUE self, VALUE rbdata, VALUE rbmax_seq_len, VALUE rbn_seqs) { GtkIMContextSimple *context_simple = _SELF(self); gint max_seq_len = NUM2INT(rbmax_seq_len); gint n_seqs = NUM2INT(rbn_seqs); long n; guint16 *data; if (max_seq_len > GTK_MAX_COMPOSE_LEN) rb_raise(rb_eArgError, "max_seq_len cannot be greater than GTK_MAX_COMPOSE_LEN: %d > %d", max_seq_len, GTK_MAX_COMPOSE_LEN); data = RVAL2GUINT16S(rbdata, n); gtk_im_context_simple_add_table(context_simple, data, max_seq_len, n_seqs); g_free(data); return self; } void Init_gtk_imcontext_simple(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IM_CONTEXT_SIMPLE, "IMContextSimple", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add_table, 3); rb_define_const(RG_TARGET_NAMESPACE, "MAX_COMPOSE_LEN", GTK_MAX_COMPOSE_LEN); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tool-shell.c0000644000175000017500000000473412516434313020501 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mToolShell #define _SELF(self) (RVAL2GTKTOOLSHELL(self)) static VALUE rg_ellipsize_mode(VALUE self) { return PANGOELLIPSIZEMODE2RVAL(gtk_tool_shell_get_ellipsize_mode(_SELF(self))); } static VALUE rg_icon_size(VALUE self) { return GTKICONSIZE2RVAL(gtk_tool_shell_get_icon_size(_SELF(self))); } static VALUE rg_orientation(VALUE self) { return GTKORIENTATION2RVAL(gtk_tool_shell_get_orientation(_SELF(self))); } static VALUE rg_relief_style(VALUE self) { return GTKRELIEFSTYLE2RVAL(gtk_tool_shell_get_relief_style(_SELF(self))); } static VALUE rg_style(VALUE self) { return GTKTOOLBARSTYLE2RVAL(gtk_tool_shell_get_style(_SELF(self))); } static VALUE rg_text_alignment(VALUE self) { return DBL2NUM(gtk_tool_shell_get_text_alignment(_SELF(self))); } static VALUE rg_text_orientation(VALUE self) { return GTKORIENTATION2RVAL(gtk_tool_shell_get_text_orientation(_SELF(self))); } static VALUE rg_text_size_group(VALUE self) { return GOBJ2RVAL(gtk_tool_shell_get_text_size_group(_SELF(self))); } static VALUE rg_rebuild_menu(VALUE self) { gtk_tool_shell_rebuild_menu(_SELF(self)); return self; } void Init_gtk_toolshell(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TOOL_SHELL, "ToolShell", mGtk); RG_DEF_METHOD(ellipsize_mode, 0); RG_DEF_METHOD(icon_size, 0); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(relief_style, 0); RG_DEF_METHOD(style, 0); RG_DEF_METHOD(text_alignment, 0); RG_DEF_METHOD(text_orientation, 0); RG_DEF_METHOD(text_size_group, 0); RG_DEF_METHOD(rebuild_menu, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tearoff-menu-item.c0000644000175000017500000000263312516434313021737 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTearoffMenuItem static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_tearoff_menu_item_new()); return Qnil; } void Init_gtk_tearoff_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEAROFF_MENU_ITEM, "TearoffMenuItem", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-infobar.c0000644000175000017500000000657612516434313020045 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cInfoBar #define _SELF(self) (RVAL2GTKINFOBAR(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE button_ary; rb_scan_args(argc, argv, "*", &button_ary); RBGTK_INITIALIZE(self, gtk_info_bar_new()); if (!NIL_P(button_ary)) rb_funcall2(self, rb_intern("add_buttons"), RARRAY_LEN(button_ary), RARRAY_PTR(button_ary)); return Qnil; } static VALUE rg_add_action_widget(VALUE self, VALUE child, VALUE response_id) { gtk_info_bar_add_action_widget(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(response_id)); return self; } static VALUE rg_add_button(VALUE self, VALUE button_text, VALUE response_id) { VALUE buffer; return GOBJ2RVAL(gtk_info_bar_add_button(_SELF(self), SYMBOL_P(button_text) ? RVAL2GLIBID(button_text, buffer) : RVAL2CSTR(button_text), RVAL2GTKRESPONSETYPE(response_id))); } static VALUE rg_add_buttons(int argc, VALUE *argv, VALUE self) { VALUE button_ary; rb_scan_args(argc, argv, "*", &button_ary); rbgtk_add_buttons(self, button_ary, rg_add_button); return self; } static VALUE rg_action_area(VALUE self) { return GOBJ2RVAL(gtk_info_bar_get_action_area(_SELF(self))); } static VALUE rg_content_area(VALUE self) { return GOBJ2RVAL(gtk_info_bar_get_content_area(_SELF(self))); } static VALUE rg_response(VALUE self, VALUE response_id) { gtk_info_bar_response(_SELF(self), NUM2INT(response_id)); return self; } static VALUE rg_set_default_response(VALUE self, VALUE response_id) { gtk_info_bar_set_default_response(_SELF(self), NUM2INT(response_id)); return self; } static VALUE rg_set_response_sensitive(VALUE self, VALUE response_id, VALUE setting) { gtk_info_bar_set_response_sensitive(_SELF(self), NUM2INT(response_id), RVAL2CBOOL(setting)); return self; } void Init_gtk_infobar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_INFO_BAR, "InfoBar", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(add_action_widget, 2); RG_DEF_METHOD(add_button, 2); RG_DEF_METHOD(add_buttons, -1); RG_DEF_METHOD(action_area, 0); RG_DEF_METHOD(content_area, 0); RG_DEF_METHOD(response, 1); RG_DEF_METHOD(set_default_response, 1); RG_DEF_METHOD(set_response_sensitive, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-menubar.c0000644000175000017500000000270112516434313020040 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMenuBar static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_menu_bar_new()); return Qnil; } void Init_gtk_menu_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_BAR, "MenuBar", mGtk); RG_DEF_METHOD(initialize, 0); G_DEF_CLASS(GTK_TYPE_PACK_DIRECTION, "PackDirection", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-scale-button.c0000644000175000017500000000447312516434313021017 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cScaleButton #define _SELF(s) (RVAL2GTKSCALEBUTTON(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3, arg4, arg5; GtkWidget *widget; gdouble min = 0; gdouble max = 100; gdouble step = 2; rb_scan_args(argc, argv, "14", &arg1, &arg2, &arg3, &arg4, &arg5); if (!NIL_P(arg2)) min = NUM2DBL(arg2); if (!NIL_P(arg3)) max = NUM2DBL(arg3); if (!NIL_P(arg4)) step = NUM2DBL(arg4); widget = gtk_scale_button_new(RVAL2GTKICONSIZE(arg1), min, max, step, NULL); RBGTK_INITIALIZE(self, widget); if (!NIL_P(arg5)) { const gchar **icons = RVAL2STRV(arg5); gtk_scale_button_set_icons(_SELF(self), icons); g_free(icons); } return Qnil; } static VALUE rg_minus_button(VALUE self) { return GOBJ2RVAL(gtk_scale_button_get_minus_button(_SELF(self))); } static VALUE rg_plus_button(VALUE self) { return GOBJ2RVAL(gtk_scale_button_get_plus_button(_SELF(self))); } void Init_gtk_scalebutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCALE_BUTTON, "ScaleButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(minus_button, 0); RG_DEF_METHOD(plus_button, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-accel-group.c0000644000175000017500000001347612516434313020623 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAccelGroup #define _SELF(w) RVAL2GTKACCELGROUP(w) #define RVAL2MOD(mods) (NIL_P(mods) ? 0 : RVAL2GDKMODIFIERTYPE(mods)) 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 = RVAL2GCLOSURE(closure); } g_rclosure_attach(rclosure, self); gtk_accel_group_connect(_SELF(self), NUM2UINT(key), RVAL2MOD(mods), RVAL2GTKACCELFLAGS(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 = RVAL2GCLOSURE(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; cntaccel_key); } static VALUE rg_mods(VALUE self) { return GDKMODIFIERTYPE2RVAL(_SELF(self)->accel_mods); } 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 = RVAL2GDKMODIFIERTYPE(mods); 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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-progress-bar.c0000644000175000017500000000511312516434313021015 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cProgressBar static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_progress_bar_new()); return Qnil; } static VALUE rg_pulse(VALUE self) { gtk_progress_bar_pulse(RVAL2GTKPROGRESSBAR(self)); return self; } void Init_gtk_progress_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PROGRESS_BAR, "ProgressBar", mGtk); /* GtkProgressBarOrientation */ /* deprecated G_DEF_CLASS(GTK_TYPE_PROGRESS_BAR_ORIENTATION, "Orientation", RG_TARGET_NAMESPACE); */ RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(pulse, 0); /* undef deprecated properties */ rb_undef_method(RG_TARGET_NAMESPACE, "adjustment"); rb_undef_method(RG_TARGET_NAMESPACE, "adjustment="); rb_undef_method(RG_TARGET_NAMESPACE, "set_adjustment"); rb_undef_method(RG_TARGET_NAMESPACE, "bar_style"); rb_undef_method(RG_TARGET_NAMESPACE, "bar_style="); rb_undef_method(RG_TARGET_NAMESPACE, "set_bar_style"); rb_undef_method(RG_TARGET_NAMESPACE, "discrete_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "discrete_blocks="); rb_undef_method(RG_TARGET_NAMESPACE, "set_discrete_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_blocks="); rb_undef_method(RG_TARGET_NAMESPACE, "set_activity_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_step"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_step="); rb_undef_method(RG_TARGET_NAMESPACE, "set_activity_step"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-layout.c0000644000175000017500000001024012516434313020636 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mCellLayout #define _SELF(s) (RVAL2GTKCELLLAYOUT(s)) static VALUE rg_pack_start(VALUE self, VALUE cell, VALUE expand) { gtk_cell_layout_pack_start(_SELF(self), RVAL2GTKCELLRENDERER(cell), RVAL2CBOOL(expand)); return self; } static VALUE rg_pack_end(VALUE self, VALUE cell, VALUE expand) { gtk_cell_layout_pack_end(_SELF(self), RVAL2GTKCELLRENDERER(cell), RVAL2CBOOL(expand)); return self; } static VALUE rg_reorder(VALUE self, VALUE cell, VALUE position) { gtk_cell_layout_reorder(_SELF(self), RVAL2GTKCELLRENDERER(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), RVAL2GTKCELLRENDERER(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), RVAL2GTKCELLRENDERER(cell), (GtkCellLayoutDataFunc)layout_data_func, (gpointer)func, NULL); } else { gtk_cell_layout_set_cell_data_func(_SELF(self), RVAL2GTKCELLRENDERER(cell), NULL, (gpointer)NULL, NULL); } return self; } static VALUE rg_clear_attributes(VALUE self, VALUE cell) { gtk_cell_layout_clear_attributes(_SELF(self), RVAL2GTKCELLRENDERER(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; } static VALUE rg_cells(VALUE self) { return GOBJGLIST2RVAL_FREE(gtk_cell_layout_get_cells(_SELF(self)), g_list_free, NULL); } void Init_gtk_celllayout(VALUE mGtk) { 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); RG_DEF_METHOD(cells, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-mark.c0000644000175000017500000000401412516434313020322 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextMark #define _SELF(s) (RVAL2GTKTEXTMARK(s)) static VALUE rg_initialize(VALUE self, VALUE name, VALUE left_gravity) { if (NIL_P(name)) G_INITIALIZE(self, gtk_text_mark_new(NULL, RVAL2CBOOL(left_gravity))); else G_INITIALIZE(self, gtk_text_mark_new(RVAL2CSTR(name), RVAL2CBOOL(left_gravity))); return Qnil; } static VALUE rg_set_visible(VALUE self, VALUE setting) { gtk_text_mark_set_visible(_SELF(self), RVAL2CBOOL(setting)); return setting; } static VALUE rg_visible_p(VALUE self) { return CBOOL2RVAL(gtk_text_mark_get_visible(_SELF(self))); } static VALUE rg_deleted_p(VALUE self) { return CBOOL2RVAL(gtk_text_mark_get_deleted(_SELF(self))); } static VALUE rg_buffer(VALUE self) { return GOBJ2RVAL(gtk_text_mark_get_buffer(_SELF(self))); } void Init_gtk_textmark(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_MARK, "TextMark", mGtk); RG_DEF_METHOD(initialize, 2); RG_DEF_METHOD(set_visible, 1); RG_DEF_METHOD_P(visible, 0); RG_DEF_METHOD_P(deleted, 0); RG_DEF_METHOD(buffer, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-action.c0000644000175000017500000000472112516434313021146 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentAction static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name, options, label, tooltip, stock_id, buffer, manager; GtkAction *action = NULL; rb_scan_args(argc, argv, "11", &name, &options); rbg_scan_options(options, "label", &label, "tooltip", &tooltip, "stock_id", &stock_id, "manager", &manager, NULL); if (NIL_P(manager)) action = gtk_recent_action_new(RVAL2CSTR(name), RVAL2CSTR_ACCEPT_NIL(label), RVAL2CSTR_ACCEPT_NIL(tooltip), RVAL2GLIBID_ACCEPT_NIL(stock_id, buffer)); else action = gtk_recent_action_new_for_manager(RVAL2CSTR(name), RVAL2CSTR_ACCEPT_NIL(label), RVAL2CSTR_ACCEPT_NIL(tooltip), RVAL2GLIBID_ACCEPT_NIL(stock_id, buffer), RVAL2GTKRECENTMANAGER(manager)); G_INITIALIZE(self, action); return Qnil; } void Init_gtk_recentaction(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_ACTION, "RecentAction", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk3conversions.h0000644000175000017500000007411212516434313020777 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2008-2014 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 __RBGTK3CONVERSIONS_H__ #define __RBGTK3CONVERSIONS_H__ #define RVAL2GTKABOUTDIALOG(o) (GTK_ABOUT_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKACCELGROUP(o) (GTK_ACCEL_GROUP(RVAL2GOBJ(o))) #define RVAL2GTKACCELLABEL(o) (GTK_ACCEL_LABEL(RVAL2GOBJ(o))) #define RVAL2GTKACCESSIBLE(o) (GTK_ACCESSIBLE(RVAL2GOBJ(o))) #define RVAL2GTKACTION(o) (GTK_ACTION(RVAL2GOBJ(o))) #define RVAL2GTKACTIONBAR(o) (GTK_ACTION_BAR(RVAL2GOBJ(o))) #define RVAL2GTKACTIONGROUP(o) (GTK_ACTION_GROUP(RVAL2GOBJ(o))) #define RVAL2GTKADJUSTMENT(o) (GTK_ADJUSTMENT(RVAL2GOBJ(o))) #define RVAL2GTKALIGNMENT(o) (GTK_ALIGNMENT(RVAL2GOBJ(o))) #define RVAL2GTKAPPCHOOSER(o) (GTK_APP_CHOOSER(RVAL2GOBJ(o))) #define RVAL2GTKAPPCHOOSERBUTTON(o) (GTK_APP_CHOOSER_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKAPPCHOOSERDIALOG(o) (GTK_APP_CHOOSER_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKAPPCHOOSERWIDGET(o) (GTK_APP_CHOOSER_WIDGET(RVAL2GOBJ(o))) #define RVAL2GTKAPPLICATION(o) (GTK_APPLICATION(RVAL2GOBJ(o))) #define RVAL2GTKARROW(o) (GTK_ARROW(RVAL2GOBJ(o))) #define RVAL2GTKASPECTFRAME(o) (GTK_ASPECT_FRAME(RVAL2GOBJ(o))) #define RVAL2GTKASSISTANT(o) (GTK_ASSISTANT(RVAL2GOBJ(o))) #define RVAL2GTKBIN(o) (GTK_BIN(RVAL2GOBJ(o))) #define RVAL2GTKBOX(o) (GTK_BOX(RVAL2GOBJ(o))) #define RVAL2GTKBUILDABLE(o) (GTK_BUILDABLE(RVAL2GOBJ(o))) #define RVAL2GTKBUILDER(o) (GTK_BUILDER(RVAL2GOBJ(o))) #define RVAL2GTKBUTTON(o) (GTK_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKBUTTONBOX(o) (GTK_BUTTON_BOX(RVAL2GOBJ(o))) #define RVAL2GTKCALENDAR(o) (GTK_CALENDAR(RVAL2GOBJ(o))) #define RVAL2GTKCELLAREA(o) (GTK_CELL_AREA(RVAL2GOBJ(o))) #define RVAL2GTKCELLEDITABLE(o) (GTK_CELL_EDITABLE(RVAL2GOBJ(o))) #define RVAL2GTKCELLLAYOUT(o) (GTK_CELL_LAYOUT(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERER(o) (GTK_CELL_RENDERER(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERERACCEL(o) (GTK_CELL_RENDERER_ACCEL(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERERPIXBUF(o) (GTK_CELL_RENDERER_PIXBUF(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERERSPIN(o) (GTK_CELL_RENDERER_SPIN(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERERSPINNER(o) (GTK_CELL_RENDERER_SPINNER(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERERTEXT(o) (GTK_CELL_RENDERER_TEXT(RVAL2GOBJ(o))) #define RVAL2GTKCELLRENDERERTOGGLE(o) (GTK_CELL_RENDERER_TOGGLE(RVAL2GOBJ(o))) #define RVAL2GTKCELLVIEW(o) (GTK_CELL_VIEW(RVAL2GOBJ(o))) #define RVAL2GTKCHECKMENUITEM(o) (GTK_CHECK_MENU_ITEM(RVAL2GOBJ(o))) #define RVAL2GTKCLIPBOARD(o) (GTK_CLIPBOARD(RVAL2GOBJ(o))) #define RVAL2GTKCOLORSELECTION(o) (GTK_COLOR_SELECTION(RVAL2GOBJ(o))) #define RVAL2GTKCOLORSELECTIONDIALOG(o) (GTK_COLOR_SELECTION_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKCOMBOBOX(o) (GTK_COMBO_BOX(RVAL2GOBJ(o))) #define RVAL2GTKCOMBOBOXTEXT(o) (GTK_COMBO_BOX_TEXT(RVAL2GOBJ(o))) #define RVAL2GTKCONTAINER(o) (GTK_CONTAINER(RVAL2GOBJ(o))) #define RVAL2GTKCSSPROVIDER(o) (GTK_CSS_PROVIDER(RVAL2GOBJ(o))) #define RVAL2GTKDIALOG(o) (GTK_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKEDITABLE(o) (GTK_EDITABLE(RVAL2GOBJ(o))) #define RVAL2GTKENTRY(o) (GTK_ENTRY(RVAL2GOBJ(o))) #define RVAL2GTKENTRYBUFFER(o) (GTK_ENTRY_BUFFER(RVAL2GOBJ(o))) #define RVAL2GTKENTRYCOMPLETION(o) (GTK_ENTRY_COMPLETION(RVAL2GOBJ(o))) #define RVAL2GTKEXPANDER(o) (GTK_EXPANDER(RVAL2GOBJ(o))) #define RVAL2GTKFILECHOOSER(o) (GTK_FILE_CHOOSER(RVAL2GOBJ(o))) #define RVAL2GTKFILECHOOSERDIALOG(o) (GTK_FILE_CHOOSER_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKFILEFILTER(o) (GTK_FILE_FILTER(RVAL2GOBJ(o))) #define RVAL2GTKFIXED(o) (GTK_FIXED(RVAL2GOBJ(o))) #define RVAL2GTKFONTCHOOSER(o) (GTK_FONT_CHOOSER(RVAL2GOBJ(o))) #define RVAL2GTKFONTCHOOSERDIALOG(o) (GTK_FONT_CHOOSER_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKFONTCHOOSERWIDGET(o) (GTK_FONT_CHOOSER_WIDGET(RVAL2GOBJ(o))) #define RVAL2GTKFRAME(o) (GTK_FRAME(RVAL2GOBJ(o))) #define RVAL2GTKGRID(o) (GTK_GRID(RVAL2GOBJ(o))) #if GTK_CHECK_VERSION(3, 10, 0) # define RVAL2GTKHEADERBAR(o) (GTK_HEADER_BAR(RVAL2GOBJ(o))) #endif #define RVAL2GTKHSV(o) (GTK_HSV(RVAL2GOBJ(o))) #define RVAL2GTKICONFACTORY(o) (GTK_ICON_FACTORY(RVAL2GOBJ(o))) #define RVAL2GTKICONTHEME(o) (GTK_ICON_THEME(RVAL2GOBJ(o))) #define RVAL2GTKICONVIEW(o) (GTK_ICON_VIEW(RVAL2GOBJ(o))) #define RVAL2GTKIMAGE(o) (GTK_IMAGE(RVAL2GOBJ(o))) #define RVAL2GTKIMCONTEXT(o) (GTK_IM_CONTEXT(RVAL2GOBJ(o))) #define RVAL2GTKIMCONTEXTSIMPLE(o) (GTK_IM_CONTEXT_SIMPLE(RVAL2GOBJ(o))) #define RVAL2GTKIMMULTICONTEXT(o) (GTK_IM_MULTICONTEXT(RVAL2GOBJ(o))) #define RVAL2GTKINFOBAR(o) (GTK_INFO_BAR(RVAL2GOBJ(o))) #define RVAL2GTKINVISIBLE(o) (GTK_INVISIBLE(RVAL2GOBJ(o))) #define RVAL2GTKLABEL(o) (GTK_LABEL(RVAL2GOBJ(o))) #define RVAL2GTKLAYOUT(o) (GTK_LAYOUT(RVAL2GOBJ(o))) #if GTK_CHECK_VERSION(3, 6, 0) # define RVAL2GTKLEVELBAR(o) (GTK_LEVEL_BAR(RVAL2GOBJ(o))) #endif #define RVAL2GTKLINKBUTTON(o) (GTK_LINK_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKLISTSTORE(o) (GTK_LIST_STORE(RVAL2GOBJ(o))) #define RVAL2GTKMENU(o) (GTK_MENU(RVAL2GOBJ(o))) #define RVAL2GTKMENUITEM(o) (GTK_MENU_ITEM(RVAL2GOBJ(o))) #define RVAL2GTKMENUSHELL(o) (GTK_MENU_SHELL(RVAL2GOBJ(o))) #define RVAL2GTKMENUTOOLBUTTON(o) (GTK_MENU_TOOL_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKMESSAGEDIALOG(o) (GTK_MESSAGE_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKMISC(o) (GTK_MISC(RVAL2GOBJ(o))) #define RVAL2GTKMOUNTOPERATION(o) (GTK_MOUNT_OPERATION(RVAL2GOBJ(o))) #define RVAL2GTKNOTEBOOK(o) (GTK_NOTEBOOK(RVAL2GOBJ(o))) #define RVAL2GTKOVERLAY(o) (GTK_OVERLAY(RVAL2GOBJ(o))) #define RVAL2GTKPAGESETUP(o) (GTK_PAGE_SETUP(RVAL2GOBJ(o))) #define RVAL2GTKPAGESETUPUNIXDIALOG(o) (GTK_PAGE_SETUP_UNIX_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKPANED(o) (GTK_PANED(RVAL2GOBJ(o))) #define RVAL2GTKPLUG(o) (GTK_PLUG(RVAL2GOBJ(o))) #define RVAL2GTKPRINTBACKEND(o) (GTK_PRINT_BACKEND(RVAL2GOBJ(o))) #define RVAL2GTKPRINTCONTEXT(o) (GTK_PRINT_CONTEXT(RVAL2GOBJ(o))) #define RVAL2GTKPRINTER(o) (GTK_PRINTER(RVAL2GOBJ(o))) #define RVAL2GTKPRINTJOB(o) (GTK_PRINT_JOB(RVAL2GOBJ(o))) #define RVAL2GTKPRINTOPERATION(o) (GTK_PRINT_OPERATION(RVAL2GOBJ(o))) #define RVAL2GTKPRINTOPERATIONPREVIEW(o) (GTK_PRINT_OPERATION_PREVIEW(RVAL2GOBJ(o))) #define RVAL2GTKPRINTSETTINGS(o) (GTK_PRINT_SETTINGS(RVAL2GOBJ(o))) #define RVAL2GTKPRINTUNIXDIALOG(o) (GTK_PRINT_UNIX_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKPROGRESSBAR(o) (GTK_PROGRESS_BAR(RVAL2GOBJ(o))) #define RVAL2GTKRADIOACTION(o) (GTK_RADIO_ACTION(RVAL2GOBJ(o))) #define RVAL2GTKRADIOBUTTON(o) (GTK_RADIO_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKRADIOMENUITEM(o) (GTK_RADIO_MENU_ITEM(RVAL2GOBJ(o))) #define RVAL2GTKRADIOTOOLBUTTON(o) (GTK_RADIO_TOOL_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKRANGE(o) (GTK_RANGE(RVAL2GOBJ(o))) #define RVAL2GTKRECENTCHOOSER(o) (GTK_RECENT_CHOOSER(RVAL2GOBJ(o))) #define RVAL2GTKRECENTCHOOSERDIALOG(o) (GTK_RECENT_CHOOSER_DIALOG(RVAL2GOBJ(o))) #define RVAL2GTKRECENTCHOOSERMENU(o) (GTK_RECENT_CHOOSER_MENU(RVAL2GOBJ(o))) #define RVAL2GTKRECENTCHOOSERWIDGET(o) (GTK_RECENT_CHOOSER_WIDGET(RVAL2GOBJ(o))) #define RVAL2GTKRECENTFILTER(o) (GTK_RECENT_FILTER(RVAL2GOBJ(o))) #define RVAL2GTKRECENTMANAGER(o) (GTK_RECENT_MANAGER(RVAL2GOBJ(o))) #define RVAL2GTKSCALE(o) (GTK_SCALE(RVAL2GOBJ(o))) #define RVAL2GTKSCALEBUTTON(o) (GTK_SCALE_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKSCROLLABLE(o) (GTK_SCROLLABLE(RVAL2GOBJ(o))) #define RVAL2GTKSCROLLBAR(o) (GTK_SCROLLBAR(RVAL2GOBJ(o))) #define RVAL2GTKSCROLLEDWINDOW(o) (GTK_SCROLLED_WINDOW(RVAL2GOBJ(o))) #if GTK_CHECK_VERSION(3, 10, 0) # define RVAL2GTKSEARCHBAR(o) (GTK_SEARCH_BAR(RVAL2GOBJ(o))) #endif #define RVAL2GTKSEPARATOR(o) (GTK_SEPARATOR(RVAL2GOBJ(o))) #define RVAL2GTKSETTINGS(o) (GTK_SETTINGS(RVAL2GOBJ(o))) #define RVAL2GTKSIZEGROUP(o) (GTK_SIZE_GROUP(RVAL2GOBJ(o))) #define RVAL2GTKSOCKET(o) (GTK_SOCKET(RVAL2GOBJ(o))) #define RVAL2GTKSPINBUTTON(o) (GTK_SPIN_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKSPINNER(o) (GTK_SPINNER(RVAL2GOBJ(o))) #if GTK_CHECK_VERSION(3, 10, 0) # define RVAL2GTKSTACK(o) (GTK_STACK(RVAL2GOBJ(o))) #endif #define RVAL2GTKSTATUSBAR(o) (GTK_STATUSBAR(RVAL2GOBJ(o))) #define RVAL2GTKSTATUSICON(o) (GTK_STATUS_ICON(RVAL2GOBJ(o))) #define RVAL2GTKSTYLECONTEXT(o) (GTK_STYLE_CONTEXT(RVAL2GOBJ(o))) #define RVAL2GTKSTYLEPROPERTIES(o) (GTK_STYLE_PROPERTIES(RVAL2GOBJ(o))) #define RVAL2GTKSTYLEPROVIDER(o) (GTK_STYLE_PROVIDER(RVAL2GOBJ(o))) #define RVAL2GTKSWITCH(o) (GTK_SWITCH(RVAL2GOBJ(o))) #define RVAL2GTKTABLE(o) (GTK_TABLE(RVAL2GOBJ(o))) #define RVAL2GTKTEXTBUFFER(o) (GTK_TEXT_BUFFER(RVAL2GOBJ(o))) #define RVAL2GTKTEXTCHILDANCHOR(o) (GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(o))) #define RVAL2GTKTEXTMARK(o) (GTK_TEXT_MARK(RVAL2GOBJ(o))) #define RVAL2GTKTEXTTAG(o) (GTK_TEXT_TAG(RVAL2GOBJ(o))) #define RVAL2GTKTEXTTAGTABLE(o) (GTK_TEXT_TAG_TABLE(RVAL2GOBJ(o))) #define RVAL2GTKTEXTVIEW(o) (GTK_TEXT_VIEW(RVAL2GOBJ(o))) #define RVAL2GTKTHEMINGENGINE(o) (GTK_THEMING_ENGINE(RVAL2GOBJ(o))) #define RVAL2GTKTOGGLEACTION(o) (GTK_TOGGLE_ACTION(RVAL2GOBJ(o))) #define RVAL2GTKTOGGLEBUTTON(o) (GTK_TOGGLE_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKTOGGLETOOLBUTTON(o) (GTK_TOGGLE_TOOL_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKTOOLBAR(o) (GTK_TOOLBAR(RVAL2GOBJ(o))) #define RVAL2GTKTOOLBUTTON(o) (GTK_TOOL_BUTTON(RVAL2GOBJ(o))) #define RVAL2GTKTOOLITEM(o) (GTK_TOOL_ITEM(RVAL2GOBJ(o))) #define RVAL2GTKTOOLITEMGROUP(o) (GTK_TOOL_ITEM_GROUP(RVAL2GOBJ(o))) #define RVAL2GTKTOOLPALETTE(o) (GTK_TOOL_PALETTE(RVAL2GOBJ(o))) #define RVAL2GTKTOOLSHELL(o) (GTK_TOOL_SHELL(RVAL2GOBJ(o))) #define RVAL2GTKTREEMODEL(o) (GTK_TREE_MODEL(RVAL2GOBJ(o))) #define RVAL2GTKTREEMODELFILTER(o) (GTK_TREE_MODEL_FILTER(RVAL2GOBJ(o))) #define RVAL2GTKTREEMODELSORT(o) (GTK_TREE_MODEL_SORT(RVAL2GOBJ(o))) #define RVAL2GTKTREESELECTION(o) (GTK_TREE_SELECTION(RVAL2GOBJ(o))) #define RVAL2GTKTREESORTABLE(o) (GTK_TREE_SORTABLE(RVAL2GOBJ(o))) #define RVAL2GTKTREESTORE(o) (GTK_TREE_STORE(RVAL2GOBJ(o))) #define RVAL2GTKTREEVIEW(o) (GTK_TREE_VIEW(RVAL2GOBJ(o))) #define RVAL2GTKTREEVIEWCOLUMN(o) (GTK_TREE_VIEW_COLUMN(RVAL2GOBJ(o))) #define RVAL2GTKUIMANAGER(o) (GTK_UI_MANAGER(RVAL2GOBJ(o))) #define RVAL2GTKWIDGET(o) (GTK_WIDGET(RVAL2GOBJ(o))) #define RVAL2GTKWINDOW(o) (GTK_WINDOW(RVAL2GOBJ(o))) #define RVAL2GTKWINDOWGROUP(o) (GTK_WINDOW_GROUP(RVAL2GOBJ(o))) #define RVAL2GTKACCELGROUPENTRY(o) ((GtkAccelGroupEntry*)RVAL2BOXED(o, GTK_TYPE_ACCEL_GROUP_ENTRY)) #define GTKACCELGROUPENTRY2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ACCEL_GROUP_ENTRY)) #define RVAL2GTKACCELKEY(o) ((GtkAccelKey*)RVAL2BOXED(o, GTK_TYPE_ACCEL_KEY)) #define GTKACCELKEY2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ACCEL_KEY)) #define RVAL2GTKALLOCATION(o) ((GtkAllocation*)RVAL2BOXED(o, GTK_TYPE_ALLOCATION)) #define GTKALLOCATION2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ALLOCATION)) #define RVAL2GTKBINDINGSET(o) ((GtkBindingSet*)RVAL2BOXED(o, GTK_TYPE_BINDING_SET)) #define GTKBINDINGSET2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_BINDING_SET)) #define RVAL2GTKBORDER(o) ((GtkBorder*)RVAL2BOXED(o, GTK_TYPE_BORDER)) #define GTKBORDER2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_BORDER)) #define RVAL2GTKCSSSECTION(o) ((GtkCssSection*)RVAL2BOXED(o, GTK_TYPE_CSS_SECTION)) #define GTKCSSSECTION2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_CSS_SECTION)) #if GTK_CHECK_VERSION(3, 8, 0) # define RVAL2GTKICONINFO(o) (GTK_ICON_INFO(RVAL2GOBJ(o))) # define GTKICONINFO2RVAL(o) (GOBJ2RVAL(o)) #else # define RVAL2GTKICONINFO(o) ((GtkIconInfo *)RVAL2BOXED(o, GTK_TYPE_ICON_INFO)) # define GTKICONINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ICON_INFO)) #endif #define RVAL2GTKICONSET(o) ((GtkIconSet*)RVAL2BOXED(o, GTK_TYPE_ICON_SET)) #define GTKICONSET2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ICON_SET)) #define RVAL2GTKICONSOURCE(o) ((GtkIconSource*)RVAL2BOXED(o, GTK_TYPE_ICON_SOURCE)) #define GTKICONSOURCE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ICON_SOURCE)) #define RVAL2GTKPAPERSIZE(o) ((GtkPaperSize*)RVAL2BOXED(o, GTK_TYPE_PAPER_SIZE)) #define GTKPAPERSIZE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_PAPER_SIZE)) #define RVAL2GTKRECENTDATA(o) ((GtkRecentData*)RVAL2BOXED(o, GTK_TYPE_RECENT_DATA)) #define GTKRECENTDATA2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_RECENT_DATA)) #define RVAL2GTKRECENTFILTERINFO(o) ((GtkRecentFilterInfo*)RVAL2BOXED(o, GTK_TYPE_RECENT_FILTER_INFO)) #define GTKRECENTFILTERINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_RECENT_FILTER_INFO)) #define RVAL2GTKRECENTINFO(o) ((GtkRecentInfo*)RVAL2BOXED(o, GTK_TYPE_RECENT_INFO)) #define GTKRECENTINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_RECENT_INFO)) #define RVAL2GTKREQUISITION(o) ((GtkRequisition *)RVAL2BOXED(o, GTK_TYPE_REQUISITION)) #define GTKREQUISITION2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_REQUISITION)) #define RVAL2GTKSELECTIONDATA(o) ((GtkSelectionData*)RVAL2BOXED(o, GTK_TYPE_SELECTION_DATA)) #define GTKSELECTIONDATA2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_SELECTION_DATA)) #define RVAL2GTKSYMBOLICCOLOR(o) ((GtkSymbolicColor*)RVAL2BOXED(o, GTK_TYPE_SYMBOLIC_COLOR)) #define GTKSYMBOLICCOLOR2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_SYMBOLIC_COLOR)) #define RVAL2GTKTARGETLIST(o) ((GtkTargetList*)RVAL2BOXED(o, GTK_TYPE_TARGET_LIST)) #define GTKTARGETLIST2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TARGET_LIST)) #define RVAL2GTKTEXTAPPEARANCE(o) ((GtkTextAppearance*)RVAL2BOXED(o, GTK_TYPE_TEXT_APPEARANCE)) #define GTKTEXTAPPEARANCE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TEXT_APPEARANCE)) #define RVAL2GTKTEXTATTRIBUTES(o) ((GtkTextAttributes*)RVAL2BOXED(o, GTK_TYPE_TEXT_ATTRIBUTES)) #define GTKTEXTATTRIBUTES2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TEXT_ATTRIBUTES)) #define RVAL2GTKTEXTITER(o) ((GtkTextIter*)RVAL2BOXED(o, GTK_TYPE_TEXT_ITER)) #define GTKTEXTITER2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TEXT_ITER)) #define RVAL2GTKTREEITER(o) ((GtkTreeIter*)RVAL2BOXED(o, GTK_TYPE_TREE_ITER)) #define GTKTREEITER2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TREE_ITER)) #define RVAL2GTKTREEPATH(o) ((GtkTreePath*)RVAL2BOXED(o, GTK_TYPE_TREE_PATH)) #define GTKTREEPATH2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TREE_PATH)) #define RVAL2GTKTREEROWREFERENCE(o) ((GtkTreeRowReference*)RVAL2BOXED(o, GTK_TYPE_TREE_ROW_REFERENCE)) #define GTKTREEROWREFERENCE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_TREE_ROW_REFERENCE)) #define RVAL2GTKWIDGETPATH(o) ((GtkWidgetPath*)RVAL2BOXED(o, GTK_TYPE_WIDGET_PATH)) #define GTKWIDGETPATH2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_WIDGET_PATH)) #define RVAL2GTKARROWTYPE(o) (RVAL2GENUM(o, GTK_TYPE_ARROW_TYPE)) #define GTKARROWTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_ARROW_TYPE)) #define RVAL2GTKASSISTANTPAGETYPE(o) (RVAL2GENUM(o, GTK_TYPE_ASSISTANT_PAGE_TYPE)) #define GTKASSISTANTPAGETYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_ASSISTANT_PAGE_TYPE)) #define RVAL2GTKBUTTONSTYPE(o) (RVAL2GENUM(o, GTK_TYPE_BUTTONS_TYPE)) #define GTKBUTTONSTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_BUTTONS_TYPE)) #define RVAL2GTKCORNERTYPE(o) (RVAL2GENUM(o, GTK_TYPE_CORNER_TYPE)) #define GTKCORNERTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_CORNER_TYPE)) #define RVAL2GTKCSSSECTIONTYPE(o) (RVAL2GENUM(o, GTK_TYPE_CSS_SECTION_TYPE)) #define GTKCSSSECTIONTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_CSS_SECTION_TYPE)) #define RVAL2GTKDIRECTIONTYPE(o) (RVAL2GENUM(o, GTK_TYPE_DIRECTION_TYPE)) #define GTKDIRECTIONTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_DIRECTION_TYPE)) #define RVAL2GTKENTRYICONPOSITION(o) (RVAL2GENUM(o, GTK_TYPE_ENTRY_ICON_POSITION)) #define GTKENTRYICONPOSITION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_ENTRY_ICON_POSITION)) #define RVAL2GTKFILECHOOSERACTION(o) (RVAL2GENUM(o, GTK_TYPE_FILE_CHOOSER_ACTION)) #define GTKFILECHOOSERACTION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_FILE_CHOOSER_ACTION)) #define RVAL2GTKICONSIZE(o) (RVAL2GENUM(o, GTK_TYPE_ICON_SIZE)) #define GTKICONSIZE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_ICON_SIZE)) #define RVAL2GTKICONVIEWDROPPOSITION(o) (RVAL2GENUM(o, GTK_TYPE_ICON_VIEW_DROP_POSITION)) #define GTKICONVIEWDROPPOSITION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_ICON_VIEW_DROP_POSITION)) #define RVAL2GTKJUNCTIONSIDES(o) (RVAL2GENUM(o, GTK_TYPE_JUNCTION_SIDES)) #define GTKJUNCTIONSIDES2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_JUNCTION_SIDES)) #define RVAL2GTKJUSTIFICATION(o) (RVAL2GENUM(o, GTK_TYPE_JUSTIFICATION)) #define GTKJUSTIFICATION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_JUSTIFICATION)) #define RVAL2GTKMESSAGETYPE(o) (RVAL2GENUM(o, GTK_TYPE_MESSAGE_TYPE)) #define GTKMESSAGETYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_MESSAGE_TYPE)) #define RVAL2GTKORIENTATION(o) (RVAL2GENUM(o, GTK_TYPE_ORIENTATION)) #define GTKORIENTATION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_ORIENTATION)) #define RVAL2GTKPACKTYPE(o) (RVAL2GENUM(o, GTK_TYPE_PACK_TYPE)) #define GTKPACKTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PACK_TYPE)) #define RVAL2GTKPAGEORIENTATION(o) (RVAL2GENUM(o, GTK_TYPE_PAGE_ORIENTATION)) #define GTKPAGEORIENTATION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PAGE_ORIENTATION)) #define RVAL2GTKPAGESET(o) (RVAL2GENUM(o, GTK_TYPE_PAGE_SET)) #define GTKPAGESET2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PAGE_SET)) #define RVAL2GTKPATHPRIORITYTYPE(o) (RVAL2GENUM(o, GTK_TYPE_PATH_PRIORITY_TYPE)) #define GTKPATHPRIORITYTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PATH_PRIORITY_TYPE)) #define RVAL2GTKPATHTYPE(o) (RVAL2GENUM(o, GTK_TYPE_PATH_TYPE)) #define GTKPATHTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PATH_TYPE)) #define RVAL2GTKPOLICYTYPE(o) (RVAL2GENUM(o, GTK_TYPE_POLICY_TYPE)) #define GTKPOLICYTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_POLICY_TYPE)) #define RVAL2GTKPOSITIONTYPE(o) (RVAL2GENUM(o, GTK_TYPE_POSITION_TYPE)) #define GTKPOSITIONTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_POSITION_TYPE)) #define RVAL2GTKPRINTDUPLEX(o) (RVAL2GENUM(o, GTK_TYPE_PRINT_DUPLEX)) #define GTKPRINTDUPLEX2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PRINT_DUPLEX)) #define RVAL2GTKPRINTOPERATIONACTION(o) (RVAL2GENUM(o, GTK_TYPE_PRINT_OPERATION_ACTION)) #define GTKPRINTOPERATIONACTION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PRINT_OPERATION_ACTION)) #define RVAL2GTKPRINTOPERATIONRESULT(o) (RVAL2GENUM(o, GTK_TYPE_PRINT_OPERATION_RESULT)) #define GTKPRINTOPERATIONRESULT2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PRINT_OPERATION_RESULT)) #define RVAL2GTKPRINTPAGES(o) (RVAL2GENUM(o, GTK_TYPE_PRINT_PAGES)) #define GTKPRINTPAGES2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PRINT_PAGES)) #define RVAL2GTKPRINTQUALITY(o) (RVAL2GENUM(o, GTK_TYPE_PRINT_QUALITY)) #define GTKPRINTQUALITY2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PRINT_QUALITY)) #define RVAL2GTKPRINTSTATUS(o) (RVAL2GENUM(o, GTK_TYPE_PRINT_STATUS)) #define GTKPRINTSTATUS2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_PRINT_STATUS)) #define RVAL2GTKRELIEFSTYLE(o) (RVAL2GENUM(o, GTK_TYPE_RELIEF_STYLE)) #define GTKRELIEFSTYLE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_RELIEF_STYLE)) #define RVAL2GTKRESPONSETYPE(o) (RVAL2GENUM(o, GTK_TYPE_RESPONSE_TYPE)) #define GTKRESPONSETYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_RESPONSE_TYPE)) #define RVAL2GTKSELECTIONMODE(o) (RVAL2GENUM(o, GTK_TYPE_SELECTION_MODE)) #define GTKSELECTIONMODE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_SELECTION_MODE)) #define RVAL2GTKSHADOWTYPE(o) (RVAL2GENUM(o, GTK_TYPE_SHADOW_TYPE)) #define GTKSHADOWTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_SHADOW_TYPE)) #define RVAL2GTKSIZEGROUPMODE(o) (RVAL2GENUM(o, GTK_TYPE_SIZE_GROUP_MODE)) #define GTKSIZEGROUPMODE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_SIZE_GROUP_MODE)) #define RVAL2GTKSIZEREQUESTMODE(o) (RVAL2GENUM(o, GTK_TYPE_SIZE_REQUEST_MODE)) #define GTKSIZEREQUESTMODE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_SIZE_REQUEST_MODE)) #define RVAL2GTKSORTTYPE(o) (RVAL2GENUM(o, GTK_TYPE_SORT_TYPE)) #define GTKSORTTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_SORT_TYPE)) #define RVAL2GTKSPINTYPE(o) (RVAL2GENUM(o, GTK_TYPE_SPIN_TYPE)) #define GTKSPINTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_SPIN_TYPE)) #if GTK_CHECK_VERSION(3, 10, 0) # define RVAL2GTKSTACKTRANSITIONTYPE(o) (RVAL2GENUM(o, GTK_TYPE_STACK_TRANSITION_TYPE)) # define GTKSTACKTRANSITIONTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_STACK_TRANSITION_TYPE)) #endif #define RVAL2GTKSTATETYPE(o) (RVAL2GENUM(o, GTK_TYPE_STATE_TYPE)) #define GTKSTATETYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_STATE_TYPE)) #define RVAL2GTKTEXTDIRECTION(o) (RVAL2GENUM(o, GTK_TYPE_TEXT_DIRECTION)) #define GTKTEXTDIRECTION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_TEXT_DIRECTION)) #define RVAL2GTKTEXTWINDOWTYPE(o) (RVAL2GENUM(o, GTK_TYPE_TEXT_WINDOW_TYPE)) #define GTKTEXTWINDOWTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_TEXT_WINDOW_TYPE)) #define RVAL2GTKTOOLBARCHILDTYPE(o) (RVAL2GENUM(o, GTK_TYPE_TOOLBAR_CHILD_TYPE)) #define GTKTOOLBARCHILDTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_TOOLBAR_CHILD_TYPE)) #define RVAL2GTKTOOLBARSTYLE(o) (RVAL2GENUM(o, GTK_TYPE_TOOLBAR_STYLE)) #define GTKTOOLBARSTYLE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_TOOLBAR_STYLE)) #define RVAL2GTKTREEVIEWDROPPOSITION(o) (RVAL2GENUM(o, GTK_TYPE_TREE_VIEW_DROP_POSITION)) #define GTKTREEVIEWDROPPOSITION2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_TREE_VIEW_DROP_POSITION)) #define RVAL2GTKUNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT)) #define GTKUNIT2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_UNIT)) #define RVAL2GTKWINDOWTYPE(o) (RVAL2GENUM(o, GTK_TYPE_WINDOW_TYPE)) #define GTKWINDOWTYPE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_WINDOW_TYPE)) #define RVAL2GTKWRAPMODE(o) (RVAL2GENUM(o, GTK_TYPE_WRAP_MODE)) #define GTKWRAPMODE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_WRAP_MODE)) #define RVAL2GTKLICENSE(o) (RVAL2GENUM(o, GTK_TYPE_LICENSE)) #define GTKLICENSE2RVAL(o) (GENUM2RVAL(o, GTK_TYPE_LICENSE)) #define RVAL2GTKACCELFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_ACCEL_FLAGS)) #define GTKACCELFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_ACCEL_FLAGS)) #define RVAL2GTKATTACHOPTIONS(o) (RVAL2GFLAGS(o, GTK_TYPE_ATTACH_OPTIONS)) #define GTKATTACHOPTIONS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_ATTACH_OPTIONS)) #define RVAL2GTKCALENDARDISPLAYOPTIONS(o) (RVAL2GFLAGS(o, GTK_TYPE_CALENDAR_DISPLAY_OPTIONS)) #define GTKCALENDARDISPLAYOPTIONS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_CALENDAR_DISPLAY_OPTIONS)) #define RVAL2GTKCELLRENDERERSTATE(o) (RVAL2GFLAGS(o, GTK_TYPE_CELL_RENDERER_STATE)) #define GTKCELLRENDERERSTATE2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_CELL_RENDERER_STATE)) #define RVAL2GTKDESTDEFAULTS(o) (RVAL2GFLAGS(o, GTK_TYPE_DEST_DEFAULTS)) #define GTKDESTDEFAULTS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_DEST_DEFAULTS)) #define RVAL2GTKDIALOGFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_DIALOG_FLAGS)) #define GTKDIALOGFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_DIALOG_FLAGS)) #define RVAL2GTKFILEFILTERFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_FILE_FILTER_FLAGS)) #define GTKFILEFILTERFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_FILE_FILTER_FLAGS)) #define RVAL2GTKICONLOOKUPFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_ICON_LOOKUP_FLAGS)) #define GTKICONLOOKUPFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_ICON_LOOKUP_FLAGS)) #define RVAL2GTKPRINTCAPABILITIES(o) (RVAL2GFLAGS(o, GTK_TYPE_PRINT_CAPABILITIES)) #define GTKPRINTCAPABILITIES2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_PRINT_CAPABILITIES)) #define RVAL2GTKRECENTFILTERFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_RECENT_FILTER_FLAGS)) #define GTKRECENTFILTERFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_RECENT_FILTER_FLAGS)) #define RVAL2GTKREGIONFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_REGION_FLAGS)) #define GTKREGIONFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_REGION_FLAGS)) #define RVAL2GTKSTATEFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_STATE_FLAGS)) #define GTKSTATEFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_STATE_FLAGS)) #define RVAL2GTKTARGETFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_TARGET_FLAGS)) #define GTKTARGETFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_TARGET_FLAGS)) #define RVAL2GTKTEXTSEARCHFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_TEXT_SEARCH_FLAGS)) #define GTKTEXTSEARCHFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_TEXT_SEARCH_FLAGS)) #define RVAL2GTKTOOLPALETTEDRAGTARGETS(o) (RVAL2GFLAGS(o, GTK_TYPE_TOOL_PALETTE_DRAG_TARGETS)) #define GTKTOOLPALETTEDRAGTARGETS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_TOOL_PALETTE_DRAG_TARGETS)) #define RVAL2GTKTREEMODELFLAGS(o) (RVAL2GFLAGS(o, GTK_TYPE_TREE_MODEL_FLAGS)) #define GTKTREEMODELFLAGS2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_TREE_MODEL_FLAGS)) #define RVAL2GTKUIMANAGERITEMTYPE(o) (RVAL2GFLAGS(o, GTK_TYPE_UI_MANAGER_ITEM_TYPE)) #define GTKUIMANAGERITEMTYPE2RVAL(o) (GFLAGS2RVAL(o, GTK_TYPE_UI_MANAGER_ITEM_TYPE)) /* For GIO. They are temporary. They will be needless after Ruby/GTK3 * is based on Ruby/GObjectIntrospection. */ #define RVAL2GFILE(o) (G_FILE(RVAL2GOBJ(o))) #define RVAL2GICON(o) (G_ICON(RVAL2GOBJ(o))) #define RVAL2GPERMISSION(o) (G_PERMISSION(RVAL2GOBJ(o))) #define RVAL2GAPPLICATIONFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_APPLICATION_FLAGS)) /* For GDK. They are temporary. They will be needless after Ruby/GTK3 * is based on Ruby/GObjectIntrospection. */ #define RVAL2GDKCOLOR(o) ((GdkColor*)RVAL2BOXED(o, GDK_TYPE_COLOR)) #define GDKCOLOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_COLOR)) #define RVAL2GDKRGBA(o) ((GdkRGBA*)RVAL2BOXED(o, GDK_TYPE_RGBA)) #define GDKRGBA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RGBA)) #define RVAL2GDKMODIFIERTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_MODIFIER_TYPE)) #define RVAL2GDKDRAGCONTEXT(o) (GDK_DRAG_CONTEXT(RVAL2GOBJ(o))) #define RVAL2GDKSCREEN(o) (GDK_SCREEN(RVAL2GOBJ(o))) #define RVAL2GDKWINDOW(o) (GDK_WINDOW(RVAL2GOBJ(o))) #define GDKEVENT2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_EVENT)) #define RVAL2GDKEVENT(o) ((GdkEvent *)RVAL2BOXED(o, GDK_TYPE_EVENT)) #define GEV2RVAL(ev) GDKEVENT2RVAL(ev) #define RVAL2GEV(ev) RVAL2GDKEVENT(ev) #define GDKMODIFIERTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_MODIFIER_TYPE)) #define GDKRECTANGLE2RVAL(o) (BOXED2RVAL(o, CAIRO_GOBJECT_TYPE_RECTANGLE_INT)) #define RVAL2GDKRECTANGLE(o) ((GdkRectangle*)RVAL2BOXED(o, CAIRO_GOBJECT_TYPE_RECTANGLE_INT)) #define RVAL2GDKDISPLAYOBJECT(o) (GDK_DISPLAY_OBJECT(RVAL2GOBJ(o))) #define GDKATOM2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_ATOM)) #define RVAL2GDKATOM(o) ((GdkAtomData*)RVAL2BOXED(o, GDK_TYPE_ATOM)) #define RVAL2GDKEVENTKEY(o) ((GdkEventKey*)RVAL2GDKEVENT(o)) #define RVAL2GDKDRAGACTION(o) (RVAL2GFLAGS(o, GDK_TYPE_DRAG_ACTION)) #define RVAL2GDKGEOMETRY(o) ((GdkGeometry*)RVAL2BOXED(o, GDK_TYPE_GEOMETRY)) #define RVAL2GDKWINDOWHINTS(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_HINTS)) #define RVAL2GDKWINDOWEDGE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_EDGE)) #define RVAL2GDKDEVICE(o) (GDK_DEVICE(RVAL2GOBJ(o))) #define RVAL2GDKEVENTMASK(o) (RVAL2GFLAGS(o, GDK_TYPE_EVENT_MASK)) #define GDKEVENTMASK2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_EVENT_MASK)) #define RVAL2GDKVISUAL(o) (GDK_VISUAL(RVAL2GOBJ(o))) #define RVAL2GDKDRAGPROTOCOL(o) (RVAL2GENUM(o, GDK_TYPE_DRAG_PROTOCOL)) #endif /* __RBGTK3CONVERSIONS_H__ */ ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-buffer.c0000644000175000017500000007001612516434313020646 0ustar koukou/* -*- 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) 2002,2003 Masahiro Sakai * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextBuffer #define _SELF(s) (RVAL2GTKTEXTBUFFER(s)) static VALUE rb_mGtk; #define RVAL2ITER(self, position) RVAL2GTKTEXTITER(rg_get_iter_at(self, position)) #define RVAL2STARTITER(self, iter, out) \ rval2iter_with_default(&(self), &(iter), &(out), gtk_text_buffer_get_start_iter) #define RVAL2ENDITER(self, iter, out) \ rval2iter_with_default(&(self), &(iter), &(out), gtk_text_buffer_get_end_iter) static VALUE rg_get_iter_at(VALUE self, VALUE position) { GtkTextIter iter; switch (TYPE(position)) { case T_HASH: { VALUE line, offset, index, mark, anchor; rbg_scan_options(position, "line", &line, "offset", &offset, "index", &index, "mark", &mark, "anchor", &anchor, NULL); if (!NIL_P(line)) if (!NIL_P(offset)) gtk_text_buffer_get_iter_at_line_offset(_SELF(self), &iter, NUM2INT(line), NUM2INT(offset)); else if (!NIL_P(index)) gtk_text_buffer_get_iter_at_line_index(_SELF(self), &iter, NUM2INT(line), NUM2INT(index)); else gtk_text_buffer_get_iter_at_line(_SELF(self), &iter, NUM2INT(line)); else if (!NIL_P(offset)) gtk_text_buffer_get_iter_at_offset(_SELF(self), &iter, NUM2INT(offset)); else if (!NIL_P(mark)) gtk_text_buffer_get_iter_at_mark(_SELF(self), &iter, RVAL2GTKTEXTMARK(mark)); else if (!NIL_P(anchor)) gtk_text_buffer_get_iter_at_child_anchor(_SELF(self), &iter, RVAL2GTKTEXTCHILDANCHOR(anchor)); else rb_raise(rb_eArgError, "Invalid arguments."); break; } case T_FIXNUM: { gtk_text_buffer_get_iter_at_offset(_SELF(self), &iter, NUM2INT(position)); break; } default: { GType gtype = RVAL2GTYPE(position); if (g_type_is_a(gtype, GTK_TYPE_TEXT_ITER)) return position; else if (g_type_is_a(gtype, GTK_TYPE_TEXT_MARK)) gtk_text_buffer_get_iter_at_mark(_SELF(self), &iter, RVAL2GTKTEXTMARK(position)); else if (g_type_is_a(gtype, GTK_TYPE_TEXT_CHILD_ANCHOR)) gtk_text_buffer_get_iter_at_child_anchor(_SELF(self), &iter, RVAL2GTKTEXTCHILDANCHOR(position)); else rb_raise(rb_eArgError, "Invalid arguments."); break; } } return GTKTEXTITER2RVAL(&iter); } static GtkTextIter * rval2iter_with_default(VALUE *self, VALUE *iter, GtkTextIter *out, void (*default_func)(GtkTextBuffer *, GtkTextIter *)) { if (NIL_P(*iter)) { default_func(_SELF(*self), out); return out; } else { return RVAL2ITER(*self, *iter); } } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE table; rb_scan_args(argc, argv, "01", &table); if (NIL_P(table)) G_INITIALIZE(self, gtk_text_buffer_new(NULL)); else { G_CHILD_SET(self, rb_intern("tagtable"), table); G_INITIALIZE(self, gtk_text_buffer_new(RVAL2GTKTEXTTAGTABLE(table))); } return Qnil; } static VALUE rg_line_count(VALUE self) { return INT2NUM(gtk_text_buffer_get_line_count(_SELF(self))); } static VALUE rg_char_count(VALUE self) { return INT2NUM(gtk_text_buffer_get_char_count(_SELF(self))); } static VALUE txt_set_text(VALUE self, VALUE text) { StringValue(text); gtk_text_buffer_set_text(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text)); return self; } static VALUE rg_backspace(VALUE self, VALUE iter, VALUE interactive, VALUE default_editable) { return CBOOL2RVAL(gtk_text_buffer_backspace(_SELF(self), RVAL2ITER(self, iter), RVAL2CBOOL(interactive), RVAL2CBOOL(default_editable))); } static VALUE rg_insert_at_cursor(VALUE self, VALUE text) { StringValue(text); gtk_text_buffer_insert_at_cursor(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text)); return self; } static VALUE rg_insert_interactive(VALUE self, VALUE iter, VALUE text, VALUE editable) { StringValue(text); return CBOOL2RVAL(gtk_text_buffer_insert_interactive(_SELF(self), RVAL2ITER(self, iter), RSTRING_PTR(text), RSTRING_LEN(text), RVAL2CBOOL(editable))); } static VALUE rg_insert_interactive_at_cursor(VALUE self, VALUE text, VALUE editable) { StringValue(text); return CBOOL2RVAL(gtk_text_buffer_insert_interactive_at_cursor(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text), RVAL2CBOOL(editable))); } static VALUE rg_insert_range(VALUE self, VALUE iter, VALUE start, VALUE end) { gtk_text_buffer_insert_range(_SELF(self), RVAL2ITER(self, iter), RVAL2ITER(self, start), RVAL2ITER(self, end)); return self; } static VALUE rg_insert_range_interactive(VALUE self, VALUE iter, VALUE start, VALUE end, VALUE editable) { return CBOOL2RVAL(gtk_text_buffer_insert_range_interactive(_SELF(self), RVAL2ITER(self, iter), RVAL2ITER(self, start), RVAL2ITER(self, end), RVAL2CBOOL(editable))); } static VALUE rg_delete(int argc, VALUE *argv, VALUE self) { VALUE start, end; GtkTextIter start_iter, end_iter; rb_scan_args(argc, argv, "02", &start, &end); gtk_text_buffer_delete(_SELF(self), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter)); return self; } static VALUE rg_delete_interactive(int argc, VALUE *argv, VALUE self) { VALUE start, end, editable; GtkTextIter start_iter, end_iter; rb_scan_args(argc, argv, "03", &start, &end, &editable); return CBOOL2RVAL(gtk_text_buffer_delete_interactive(_SELF(self), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter), RVAL2CBOOL(editable))); } static VALUE rg_get_text(int argc, VALUE *argv, VALUE self) { VALUE start, end, include_hidden_chars; GtkTextIter start_iter, end_iter; gchar* ret; rb_scan_args(argc, argv, "03", &start, &end, &include_hidden_chars); ret = gtk_text_buffer_get_text(_SELF(self), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter), RVAL2CBOOL(include_hidden_chars)); return CSTR2RVAL_FREE(ret); } static VALUE txt_get_text_all(VALUE self) { return rg_get_text(0, NULL, self); } static VALUE rg_get_slice(int argc, VALUE *argv, VALUE self) { VALUE start, end, include_hidden_chars; GtkTextIter start_iter, end_iter; gchar* ret; rb_scan_args(argc, argv, "03", &start, &end, &include_hidden_chars); ret = gtk_text_buffer_get_slice(_SELF(self), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter), RVAL2CBOOL(include_hidden_chars)); return CSTR2RVAL_FREE(ret); } static VALUE rg_slice(VALUE self) { return rg_get_slice(0, NULL, self); } static VALUE rg_create_child_anchor(VALUE self, VALUE iter) { VALUE ret = GOBJ2RVAL(gtk_text_buffer_create_child_anchor(_SELF(self), RVAL2ITER(self, iter))); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_create_mark(VALUE self, VALUE name, VALUE where, VALUE left_gravity) { VALUE ret = GOBJ2RVAL(gtk_text_buffer_create_mark(_SELF(self), RVAL2CSTR_ACCEPT_NIL(name), RVAL2ITER(self, where), RVAL2CBOOL(left_gravity))); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_add_mark(VALUE self, VALUE mark, VALUE where) { gtk_text_buffer_add_mark(_SELF(self), RVAL2GTKTEXTMARK(mark), RVAL2ITER(self, where)); return self; } static VALUE rg_delete_mark(VALUE self, VALUE mark) { if (rb_obj_is_kind_of(mark, GTYPE2CLASS(GTK_TYPE_TEXT_MARK))){ G_CHILD_REMOVE(self, mark); gtk_text_buffer_delete_mark(_SELF(self), RVAL2GTKTEXTMARK(mark)); } else { G_CHILD_REMOVE(self, GOBJ2RVAL(gtk_text_buffer_get_mark(_SELF(self), RVAL2CSTR(mark)))); gtk_text_buffer_delete_mark_by_name(_SELF(self), RVAL2CSTR(mark)); } return self; } static VALUE rg_get_mark(VALUE self, VALUE name) { return GOBJ2RVAL(gtk_text_buffer_get_mark(_SELF(self), RVAL2CSTR(name))); } /* static VALUE rg_get_insert(VALUE self) { return GOBJ2RVAL(gtk_text_buffer_get_insert(_SELF(self))); } */ static VALUE rg_selection_bound(VALUE self) { return GOBJ2RVAL(gtk_text_buffer_get_selection_bound(_SELF(self))); } static VALUE rg_place_cursor(VALUE self, VALUE where) { gtk_text_buffer_place_cursor(_SELF(self), RVAL2ITER(self, where)); return self; } static VALUE rg_select_range(VALUE self, VALUE ins, VALUE bound) { gtk_text_buffer_select_range(_SELF(self), RVAL2ITER(self, ins), RVAL2ITER(self, bound)); return self; } static VALUE rg_modified_p(VALUE self) { return CBOOL2RVAL(gtk_text_buffer_get_modified(_SELF(self))); } static VALUE rg_set_modified(VALUE self, VALUE setting) { gtk_text_buffer_set_modified(_SELF(self), RVAL2CBOOL(setting)); return setting; } static VALUE rg_add_selection_clipboard(VALUE self, VALUE clipboard) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_add_selection_clipboard(_SELF(self), RVAL2GTKCLIPBOARD(clipboard)); return self; } static VALUE rg_remove_selection_clipboard(VALUE self, VALUE clipboard) { G_CHILD_REMOVE(self, clipboard); gtk_text_buffer_remove_selection_clipboard(_SELF(self), RVAL2GTKCLIPBOARD(clipboard)); return self; } static VALUE rg_deserialize(VALUE self, VALUE content_buffer, VALUE format, VALUE iter, VALUE data) { GError* error = NULL; gboolean ret; StringValue(data); ret = gtk_text_buffer_deserialize(_SELF(self), _SELF(content_buffer), RVAL2ATOM(format), RVAL2ITER(self, iter), (const guint8*)RSTRING_PTR(data), (gsize)RSTRING_LEN(data), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_deserialize_can_create_tags_p(VALUE self, VALUE format) { return CBOOL2RVAL(gtk_text_buffer_deserialize_get_can_create_tags(_SELF(self), RVAL2ATOM(format))); } static VALUE rg_deserialize_set_can_create_tags(VALUE self, VALUE format, VALUE can_create_tags) { gtk_text_buffer_deserialize_set_can_create_tags(_SELF(self), RVAL2ATOM(format), RVAL2CBOOL(can_create_tags)); return self; } static VALUE rg_deserialize_formats(VALUE self) { gint i; gint n_formats; GdkAtom* atoms = gtk_text_buffer_get_deserialize_formats(_SELF(self), &n_formats); VALUE ary = rb_ary_new(); for (i = 0; i < n_formats; i++){ rb_ary_push(ary, GDKATOM2RVAL(atoms[i])); } return ary; } static VALUE rg_serialize_formats(VALUE self) { gint i; gint n_formats; GdkAtom* atoms = gtk_text_buffer_get_serialize_formats(_SELF(self), &n_formats); VALUE ary = rb_ary_new(); for (i = 0; i < n_formats; i++){ rb_ary_push(ary, GDKATOM2RVAL(atoms[i])); } return ary; } struct callback_arg { VALUE callback; int argc; VALUE *argv; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; return rb_funcall2(arg->callback, id_call, arg->argc, arg->argv); } static gboolean deserialize_func(GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GtkTextIter *iter, const guint8 *data, gsize length, gboolean create_tags, gpointer func, G_GNUC_UNUSED GError **error) { VALUE result; VALUE argv[5]; struct callback_arg arg; argv[0] = GOBJ2RVAL(register_buffer); argv[1] = GOBJ2RVAL(content_buffer); argv[2] = GTKTEXTITER2RVAL(iter); argv[3] = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((char*)data, length)); argv[4] = CBOOL2RVAL(create_tags); arg.callback = (VALUE)func; arg.argc = 5; arg.argv = argv; result = G_PROTECT_CALLBACK(invoke_callback, &arg); return NIL_P(rb_errinfo()) ? RVAL2CBOOL(result) : FALSE; } static void remove_callback_reference(gpointer callback) { G_CHILD_REMOVE(rb_mGtk, (VALUE)callback); } static VALUE rg_register_deserialize_format(VALUE self, VALUE mime_type) { VALUE block = rb_block_proc(); GdkAtom atom; G_CHILD_ADD(rb_mGtk, block); atom = gtk_text_buffer_register_deserialize_format(_SELF(self), (const gchar*)RVAL2CSTR(mime_type), (GtkTextBufferDeserializeFunc)deserialize_func, (gpointer)block, (GDestroyNotify)remove_callback_reference); return GDKATOM2RVAL(atom); } static VALUE rg_register_deserialize_target(VALUE self, VALUE tagset_name) { return GDKATOM2RVAL(gtk_text_buffer_register_deserialize_tagset(_SELF(self), RVAL2CSTR_ACCEPT_NIL(tagset_name))); } static guint8* serialize_func(GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GtkTextIter *start, GtkTextIter *end, gsize *length, gpointer func) { VALUE result; VALUE argv[4]; struct callback_arg arg; argv[0] = GOBJ2RVAL(register_buffer); argv[1] = GOBJ2RVAL(content_buffer); argv[2] = GTKTEXTITER2RVAL(start); argv[3] = GTKTEXTITER2RVAL(end); arg.callback = (VALUE)func; arg.argc = 4; arg.argv = argv; /* This should return data as String */ result = G_PROTECT_CALLBACK(invoke_callback, &arg); StringValue(result); *length = RSTRING_LEN(result); return (guint8*)(NIL_P(rb_errinfo()) ? RSTRING_PTR(result) : NULL); } static VALUE rg_register_serialize_format(VALUE self, VALUE mime_type) { VALUE block = rb_block_proc(); GdkAtom atom; G_CHILD_ADD(rb_mGtk, block); atom = gtk_text_buffer_register_serialize_format(_SELF(self), (const gchar*)RVAL2CSTR(mime_type), (GtkTextBufferSerializeFunc)serialize_func, (gpointer)block, (GDestroyNotify)remove_callback_reference); return GDKATOM2RVAL(atom); } static VALUE rg_register_serialize_target(VALUE self, VALUE tagset_name) { return GDKATOM2RVAL(gtk_text_buffer_register_serialize_tagset(_SELF(self), RVAL2CSTR_ACCEPT_NIL(tagset_name))); } static VALUE rg_serialize(VALUE self, VALUE content_buffer, VALUE format, VALUE start, VALUE end) { gsize length; guint8* ret = gtk_text_buffer_serialize(_SELF(self), _SELF(content_buffer), RVAL2ATOM(format), RVAL2ITER(self, start), RVAL2ITER(self, end), &length); return RBG_STRING_SET_UTF8_ENCODING(rb_str_new((char*)ret, length)); } static VALUE rg_unregister_deserialize_format(VALUE self, VALUE format) { gtk_text_buffer_unregister_deserialize_format(_SELF(self), RVAL2ATOM(format)); return self; } static VALUE rg_unregister_serialize_format(VALUE self, VALUE format) { gtk_text_buffer_unregister_serialize_format(_SELF(self), RVAL2ATOM(format)); return self; } static VALUE rg_cut_clipboard(VALUE self, VALUE clipboard, VALUE default_editable) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_cut_clipboard(_SELF(self), RVAL2GTKCLIPBOARD(clipboard), RVAL2CBOOL(default_editable)); return self; } static VALUE rg_copy_clipboard(VALUE self, VALUE clipboard) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_copy_clipboard(_SELF(self), RVAL2GTKCLIPBOARD(clipboard)); return self; } static VALUE rg_paste_clipboard(VALUE self, VALUE clipboard, VALUE location, VALUE default_editable) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_paste_clipboard(_SELF(self), RVAL2GTKCLIPBOARD(clipboard), NIL_P(location) ? NULL : RVAL2ITER(self, location), RVAL2CBOOL(default_editable)); return self; } static VALUE rg_selection_bounds(VALUE self) { GtkTextIter start, end; gboolean ret = gtk_text_buffer_get_selection_bounds(_SELF(self), &start, &end); return rb_ary_new3(3, GTKTEXTITER2RVAL(&start), GTKTEXTITER2RVAL(&end), CBOOL2RVAL(ret)); } static VALUE rg_delete_selection(int argc, VALUE *argv, VALUE self) { VALUE interactive, default_editable; rb_scan_args(argc, argv, "20", &interactive, &default_editable); return CBOOL2RVAL(gtk_text_buffer_delete_selection(_SELF(self), RVAL2CBOOL(interactive), RVAL2CBOOL(default_editable))); } static VALUE rg_end_user_action(VALUE self) { gtk_text_buffer_end_user_action(_SELF(self)); return self; } static VALUE rg_begin_user_action(VALUE self) { gtk_text_buffer_begin_user_action(_SELF(self)); if (rb_block_given_p()) rb_ensure(rb_yield, self, rg_end_user_action, self); return self; } static VALUE rg_start_iter(VALUE self) { GtkTextIter iter; gtk_text_buffer_get_start_iter(_SELF(self), &iter); return GTKTEXTITER2RVAL(&iter); } static VALUE rg_end_iter(VALUE self) { GtkTextIter iter; gtk_text_buffer_get_end_iter(_SELF(self), &iter); return GTKTEXTITER2RVAL(&iter); } static VALUE rg_move_mark(VALUE self, VALUE mark, VALUE where) { if (rb_obj_is_kind_of(mark, GTYPE2CLASS(GTK_TYPE_TEXT_MARK))) gtk_text_buffer_move_mark(_SELF(self), RVAL2GTKTEXTMARK(mark), RVAL2ITER(self, where)); else gtk_text_buffer_move_mark_by_name(_SELF(self), RVAL2CSTR(mark), RVAL2ITER(self, where)); return self; } static VALUE rg_create_tag(VALUE self, VALUE tag_name, VALUE properties) { GtkTextTag *tag; VALUE ret; tag = gtk_text_tag_new(RVAL2CSTR_ACCEPT_NIL(tag_name)); gtk_text_tag_table_add (gtk_text_buffer_get_tag_table(_SELF(self)), tag); G_SET_PROPERTIES(GOBJ2RVAL(tag), properties); ret = GOBJ2RVAL(tag); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { VALUE where, value, tags; gint start_offset; GtkTextIter start; int i; rb_scan_args(argc, argv, "2*", &where, &value, &tags); G_CHILD_ADD(self, where); G_CHILD_ADD(self, value); if (rb_obj_is_kind_of(value, GTYPE2CLASS(GDK_TYPE_PIXBUF))){ gtk_text_buffer_insert_pixbuf(_SELF(self), RVAL2ITER(self, where), RVAL2GDKPIXBUF(value)); } else if (rb_obj_is_kind_of(value, GTYPE2CLASS(GTK_TYPE_TEXT_CHILD_ANCHOR))){ gtk_text_buffer_insert_child_anchor(_SELF(self), RVAL2ITER(self, where), RVAL2GTKTEXTCHILDANCHOR(value)); } else { start_offset = gtk_text_iter_get_offset(RVAL2ITER(self, where)); StringValue(value); gtk_text_buffer_insert(_SELF(self), RVAL2ITER(self, where), RSTRING_PTR(value), RSTRING_LEN(value)); if (RARRAY_LEN(tags) == 0) return self; /* TODO: Do we really want to do this before we know that everything * below passed without any errors? */ G_CHILD_ADD(self, tags); gtk_text_buffer_get_iter_at_offset(_SELF(self), &start, start_offset); for(i = 0; i < RARRAY_LEN(tags); i++) { GtkTextTag *tag; if (rb_obj_is_kind_of(RARRAY_PTR(tags)[i], GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) { tag = RVAL2GOBJ(RARRAY_PTR(tags)[i]); } else { tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(_SELF(self)), RVAL2CSTR(RARRAY_PTR(tags)[i])); if (tag == NULL) { g_warning ("%s: no tag with name '%s'!", G_STRLOC, RVAL2CSTR(RARRAY_PTR(tags)[i])); return self; } } gtk_text_buffer_apply_tag(_SELF(self), tag, &start, RVAL2ITER(self, where)); } } return self; } static VALUE rg_apply_tag(int argc, VALUE *argv, VALUE self) { VALUE tag, start, end; GtkTextIter start_iter, end_iter; rb_scan_args(argc, argv, "12", &tag, &start, &end); if (rb_obj_is_kind_of(tag, GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) gtk_text_buffer_apply_tag(_SELF(self), RVAL2GTKTEXTTAG(tag), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter)); else gtk_text_buffer_apply_tag_by_name(_SELF(self), RVAL2CSTR(tag), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter)); return self; } static VALUE rg_remove_tag(int argc, VALUE *argv, VALUE self) { VALUE tag, start, end; GtkTextIter start_iter, end_iter; rb_scan_args(argc, argv, "12", &tag, &start, &end); if (rb_obj_is_kind_of(tag, GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) gtk_text_buffer_remove_tag(_SELF(self), RVAL2GTKTEXTTAG(tag), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter)); else gtk_text_buffer_remove_tag_by_name(_SELF(self), RVAL2CSTR(tag), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter)); return self; } static VALUE rg_remove_all_tags(int argc, VALUE *argv, VALUE self) { VALUE start, end; GtkTextIter start_iter, end_iter; rb_scan_args(argc, argv, "02", &start, &end); gtk_text_buffer_remove_all_tags(_SELF(self), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter)); return self; } static VALUE rg_bounds(VALUE self) { GtkTextIter start, end; gtk_text_buffer_get_bounds(_SELF(self), &start, &end); return rb_ary_new3(2, GTKTEXTITER2RVAL(&start), GTKTEXTITER2RVAL(&end)); } void Init_gtk_textbuffer(VALUE mGtk) { rb_mGtk = mGtk; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_BUFFER, "TextBuffer", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(line_count, 0); RG_DEF_METHOD(char_count, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "text", txt_set_text, 1); RG_DEF_METHOD(insert, -1); RG_DEF_METHOD(backspace, 3); RG_DEF_METHOD(insert_at_cursor, 1); RG_DEF_METHOD(insert_interactive, 3); RG_DEF_METHOD(insert_interactive_at_cursor, 2); RG_DEF_METHOD(insert_range, 3); RG_DEF_METHOD(insert_range_interactive, 4); RG_DEF_METHOD(delete, -1); RG_DEF_METHOD(delete_interactive, -1); RG_DEF_METHOD(get_text, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "text", txt_get_text_all, 0); RG_DEF_METHOD(get_slice, -1); RG_DEF_METHOD(slice, 0); RG_DEF_METHOD(create_child_anchor, 1); RG_DEF_METHOD(create_mark, 3); RG_DEF_METHOD(add_mark, 2); RG_DEF_METHOD(delete_mark, 1); RG_DEF_METHOD(get_mark, 1); /* Comment out because this method's name is very bad. Use Gtk::TextBuffer#get_mark("insert") instead. RG_DEF_METHOD(get_insert, 0); */ RG_DEF_METHOD(selection_bound, 0); RG_DEF_METHOD(place_cursor, 1); RG_DEF_METHOD(select_range, 2); RG_DEF_METHOD_P(modified, 0); RG_DEF_METHOD(set_modified, 1); RG_DEF_METHOD(add_selection_clipboard, 1); RG_DEF_METHOD(remove_selection_clipboard, 1); RG_DEF_METHOD(deserialize, 4); RG_DEF_METHOD_P(deserialize_can_create_tags, 1); RG_DEF_METHOD(deserialize_set_can_create_tags, 2); RG_DEF_METHOD(deserialize_formats, 0); RG_DEF_METHOD(serialize_formats, 0); RG_DEF_METHOD(register_deserialize_format, 1); RG_DEF_METHOD(register_deserialize_target, 1); RG_DEF_METHOD(register_serialize_format, 1); RG_DEF_METHOD(register_serialize_target, 1); RG_DEF_METHOD(serialize, 4); RG_DEF_METHOD(unregister_deserialize_format, 1); RG_DEF_METHOD(unregister_serialize_format, 1); RG_DEF_METHOD(cut_clipboard, 2); RG_DEF_METHOD(copy_clipboard, 1); RG_DEF_METHOD(paste_clipboard, 3); RG_DEF_METHOD(selection_bounds, 0); RG_DEF_METHOD(delete_selection, -1); RG_DEF_METHOD(begin_user_action, 0); RG_DEF_METHOD(end_user_action, 0); RG_DEF_METHOD(start_iter, 0); RG_DEF_METHOD(end_iter, 0); RG_DEF_METHOD(get_iter_at, 1); RG_DEF_METHOD(bounds, 0); RG_DEF_METHOD(move_mark, 2); RG_DEF_METHOD(create_tag, 2); RG_DEF_METHOD(apply_tag, -1); RG_DEF_METHOD(remove_tag, -1); RG_DEF_METHOD(remove_all_tags, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-dialog.c0000644000175000017500000001373412516434313017656 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cDialog #define _SELF(self) (RVAL2GTKDIALOG(self)) static VALUE rg_add_button(VALUE self, VALUE button_text, VALUE response_id) { VALUE buffer; return GOBJ2RVAL(gtk_dialog_add_button(_SELF(self), SYMBOL_P(button_text) ? RVAL2GLIBID(button_text, buffer) : RVAL2CSTR(button_text), RVAL2GTKRESPONSETYPE(response_id))); } static VALUE rg_add_buttons(int argc, VALUE *argv, VALUE self) { VALUE button_ary; rb_scan_args(argc, argv, "*", &button_ary); rbgtk_add_buttons(self, button_ary, rg_add_button); return self; } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title, rb_parent, rb_flags, rb_button_ary; const gchar *title; GtkWindow *parent; GtkDialogFlags flags; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, "parent", &rb_parent, "flags", &rb_flags, "buttons", &rb_button_ary, NULL); title = RVAL2CSTR_ACCEPT_NIL(rb_title); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); flags = NIL_P(rb_flags) ? 0 : RVAL2GTKDIALOGFLAGS(rb_flags); dialog = gtk_dialog_new_with_buttons(title, parent, flags, NULL, NULL); RBGTK_INITIALIZE(self, dialog); if (!NIL_P(rb_button_ary)) rb_funcall2(self, rb_intern("add_buttons"), RARRAY_LEN(rb_button_ary), RARRAY_PTR(rb_button_ary)); return Qnil; } static gboolean destroy_dialog(gpointer user_data) { GtkWidget *dialog = user_data; gtk_widget_destroy(dialog); return G_SOURCE_REMOVE; } static VALUE rg_run(VALUE self) { GtkDialog *dialog; GSource *interrupt_source; VALUE response; dialog = _SELF(self); interrupt_source = rbg_interrupt_source_new(); g_source_set_callback(interrupt_source, destroy_dialog, dialog, NULL); g_source_attach(interrupt_source, NULL); response = INT2NUM(gtk_dialog_run(dialog)); g_source_destroy(interrupt_source); g_source_unref(interrupt_source); rb_thread_check_ints(); if (rb_block_given_p()) { return rb_yield(response); } else { return response; } } 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), RVAL2GTKWIDGET(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; } 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 : RVAL2GDKSCREEN(screen)); return CBOOL2RVAL(ret); } 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; } static VALUE rg_action_area(VALUE self) { return GOBJ2RVAL(gtk_dialog_get_action_area(_SELF(self))); } static VALUE rg_get_response(VALUE self, VALUE widget) { return INT2NUM(gtk_dialog_get_response_for_widget(_SELF(self), RVAL2GTKWIDGET(widget))); } static VALUE rg_content_area(VALUE self) { return GOBJ2RVAL(gtk_dialog_get_content_area(_SELF(self))); } static VALUE rg_get_widget_for_response(VALUE self, VALUE response_id) { return GOBJ2RVAL(gtk_dialog_get_widget_for_response(_SELF(self), NUM2INT(response_id))); } void Init_gtk_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_DIALOG, "Dialog", mGtk); 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); RG_DEF_SMETHOD_P(alternative_dialog_button_order, 1); RG_DEF_METHOD(set_alternative_button_order, 1); RG_DEF_METHOD(set_response_sensitive, 2); RG_DEF_METHOD(action_area, 0); RG_DEF_METHOD(get_response, 1); RG_DEF_ALIAS("get_response_for_widget", "get_response"); RG_DEF_METHOD(content_area, 0); RG_DEF_METHOD(get_widget_for_response, 1); G_DEF_CLASS(GTK_TYPE_DIALOG_FLAGS, "Flags", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-aspect-frame.c0000644000175000017500000000405712516434313020764 0ustar koukou/* -*- 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 "rbgtk3private.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(RVAL2CSTR_ACCEPT_NIL(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(RVAL2GTKASPECTFRAME(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-filter.c0000644000175000017500000001025712516434313021157 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentFilter #define _SELF(self) (RVAL2GTKRECENTFILTER(self)) static VALUE rb_mGtk; static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_recent_filter_new()); return Qnil; } static VALUE rg_name(VALUE self) { return CSTR2RVAL(gtk_recent_filter_get_name(_SELF(self))); } static VALUE rg_set_name(VALUE self, VALUE name) { gtk_recent_filter_set_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_add_mime_type(VALUE self, VALUE mime_type) { gtk_recent_filter_add_mime_type(_SELF(self), RVAL2CSTR(mime_type)); return self; } static VALUE rg_add_pattern(VALUE self, VALUE pattern) { gtk_recent_filter_add_pattern(_SELF(self), RVAL2CSTR(pattern)); return self; } static VALUE rg_add_pixbuf_formats(VALUE self) { gtk_recent_filter_add_pixbuf_formats(_SELF(self)); return self; } static VALUE rg_add_application(VALUE self, VALUE application) { gtk_recent_filter_add_application(_SELF(self), RVAL2CSTR(application)); return self; } static VALUE rg_add_group(VALUE self, VALUE group) { gtk_recent_filter_add_group(_SELF(self), RVAL2CSTR(group)); return self; } static VALUE rg_add_age(VALUE self, VALUE days) { gtk_recent_filter_add_age(_SELF(self), NUM2INT(days)); return self; } struct callback_arg { VALUE callback; VALUE info; }; static VALUE invoke_callback(VALUE arg_) { struct callback_arg *arg = (struct callback_arg *)arg_; return rb_funcall(arg->callback, id_call, 1, arg->info); } static gboolean filter_func(const GtkRecentFilterInfo *info, gpointer func) { VALUE result; struct callback_arg arg; arg.callback = (VALUE)func; arg.info = GTKRECENTFILTERINFO2RVAL((gpointer)info); result = G_PROTECT_CALLBACK(invoke_callback, &arg); return NIL_P(rb_errinfo()) ? TRUE : RVAL2CBOOL(result); } static void remove_callback_reference(gpointer data) { G_CHILD_REMOVE(rb_mGtk, (VALUE)data); } static VALUE rg_add_custom(VALUE self, VALUE needed) { VALUE func = rb_block_proc(); G_CHILD_ADD(rb_mGtk, func); gtk_recent_filter_add_custom(_SELF(self), RVAL2GTKRECENTFILTERFLAGS(needed), (GtkRecentFilterFunc)filter_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; } static VALUE rg_needed(VALUE self) { return GTKRECENTFILTERFLAGS2RVAL(gtk_recent_filter_get_needed(_SELF(self))); } static VALUE rg_filter(VALUE self, VALUE filter_info) { return CBOOL2RVAL(gtk_recent_filter_filter(_SELF(self), RVAL2GTKRECENTFILTERINFO(filter_info))); } void Init_gtk_recent_filter(VALUE mGtk) { rb_mGtk = mGtk; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_FILTER, "RecentFilter", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(set_name, 1); RG_DEF_METHOD(add_mime_type, 1); RG_DEF_METHOD(add_pattern, 1); RG_DEF_METHOD(add_pixbuf_formats, 0); RG_DEF_METHOD(add_application, 1); RG_DEF_METHOD(add_group, 1); RG_DEF_METHOD(add_age, 1); RG_DEF_METHOD(add_custom, 1); RG_DEF_METHOD(needed, 0); RG_DEF_METHOD(filter, 1); G_DEF_CLASS(GTK_TYPE_RECENT_FILTER_FLAGS, "Flags", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-chooser-dialog.c0000644000175000017500000000446712516434313022577 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentChooserDialog #define _SELF(self) (RVAL2GTKRECENTCHOOSERDIALOG(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title, rb_parent, rb_manager, rb_button_ary; const gchar *title; GtkWindow *parent; GtkRecentManager *manager; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, "parent", &rb_parent, "manager", &rb_manager, "buttons", &rb_button_ary, NULL); title = RVAL2CSTR_ACCEPT_NIL(rb_title); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); manager = NIL_P(rb_manager) ? NULL : RVAL2GTKRECENTMANAGER(rb_manager); if (manager) { dialog = gtk_recent_chooser_dialog_new_for_manager(title, parent, manager, NULL, NULL); } else { dialog = gtk_recent_chooser_dialog_new(title, parent, NULL, NULL); } RBGTK_INITIALIZE(self, dialog); if (!NIL_P(rb_button_ary)) rb_funcall2(self, rb_intern("add_buttons"), RARRAY_LEN(rb_button_ary), RARRAY_PTR(rb_button_ary)); return Qnil; } void Init_gtk_recent_chooser_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER_DIALOG, "RecentChooserDialog", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-arrow.c0000644000175000017500000000355312516434313017547 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cArrow static VALUE rg_initialize(VALUE self, VALUE arrow_t, VALUE shadow_t) { RBGTK_INITIALIZE(self, gtk_arrow_new(RVAL2GTKARROWTYPE(arrow_t), RVAL2GTKSHADOWTYPE(shadow_t))); return Qnil; } static VALUE rg_set(VALUE self, VALUE arrow_t, VALUE shadow_t) { gtk_arrow_set(RVAL2GTKARROW(self), RVAL2GTKARROWTYPE(arrow_t), RVAL2GTKSHADOWTYPE(shadow_t)); 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); G_DEF_CLASS(GTK_TYPE_ARROW_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_ARROW_PLACEMENT, "Placement", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-menu-button.c0000644000175000017500000000234712516434313020672 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3,6,0) #define RG_TARGET_NAMESPACE cMenuButton static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_menu_button_new()); return Qnil; } void Init_gtk_menu_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_BUTTON, "MenuButton", mGtk); RG_DEF_METHOD(initialize, 0); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-file-filter.c0000644000175000017500000000722712516434313020621 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFileFilter #define _SELF(self) RVAL2GTKFILEFILTER(self) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_file_filter_new()); return Qnil; } static VALUE rg_set_name(VALUE self, VALUE name) { gtk_file_filter_set_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_name(VALUE self) { return CSTR2RVAL(gtk_file_filter_get_name(_SELF(self))); } static VALUE rg_add_mime_type(VALUE self, VALUE mime) { gtk_file_filter_add_mime_type(_SELF(self), RVAL2CSTR(mime)); return self; } static VALUE rg_add_pattern(VALUE self, VALUE pattern) { gtk_file_filter_add_pattern(_SELF(self), RVAL2CSTR(pattern)); return self; } /* Should return true/false */ static gboolean filter_func(const GtkFileFilterInfo *info, gpointer func) { return CBOOL2RVAL(rb_funcall((VALUE)func, id_call, 5, GTKFILEFILTERFLAGS2RVAL(info->contains), CSTR2RVAL(info->filename), CSTR2RVAL(info->uri), CSTR2RVAL(info->display_name), CSTR2RVAL(info->mime_type))); } static VALUE rg_add_pixbuf_formats(VALUE self) { gtk_file_filter_add_pixbuf_formats(_SELF(self)); return self; } static VALUE rg_add_custom(VALUE self, VALUE needed) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_file_filter_add_custom(_SELF(self), RVAL2GTKFILEFILTERFLAGS(needed), (GtkFileFilterFunc)filter_func, (gpointer)func, NULL); return self; } static VALUE rg_needed(VALUE self) { return GTKFILEFILTERFLAGS2RVAL(gtk_file_filter_get_needed(_SELF(self))); } static VALUE rg_filter_p(VALUE self, VALUE contains, VALUE filename, VALUE uri, VALUE display_name, VALUE mime_type) { GtkFileFilterInfo info; info.contains = RVAL2GTKFILEFILTERFLAGS(contains); info.filename = RVAL2CSTR(filename); info.uri = RVAL2CSTR(uri); info.display_name = RVAL2CSTR(display_name); info.mime_type = RVAL2CSTR(mime_type); return CBOOL2RVAL(gtk_file_filter_filter(_SELF(self), &info)); } void Init_gtk_file_filter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_FILTER, "FileFilter", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_name, 1); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(add_mime_type, 1); RG_DEF_METHOD(add_pattern, 1); RG_DEF_METHOD(add_pixbuf_formats, 0); RG_DEF_METHOD(add_custom, 1); RG_DEF_METHOD(needed, 0); RG_DEF_METHOD_P(filter, 5); G_DEF_CLASS(GTK_TYPE_FILE_FILTER_FLAGS, "Flags", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-label.c0000644000175000017500000000761612516434313017500 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cLabel #define _SELF(s) (RVAL2GTKLABEL(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "02", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ widget = gtk_label_new(RVAL2CSTR_ACCEPT_NIL(label)); } else { widget = gtk_label_new_with_mnemonic(RVAL2CSTR_ACCEPT_NIL(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_operator_label_set_text_only(VALUE self, VALUE text) { gtk_label_set_text(_SELF(self), RVAL2CSTR(text)); return text; } static VALUE rg_set_text(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; rb_scan_args(argc, argv, "02", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ gtk_label_set_text(_SELF(self), RVAL2CSTR(label)); } else { gtk_label_set_text_with_mnemonic(_SELF(self), RVAL2CSTR(label)); } return self; } static VALUE rg_operator_label_set_markup_only(VALUE self, VALUE text) { gtk_label_set_markup(_SELF(self), RVAL2CSTR(text)); return text; } static VALUE rg_set_markup(int argc, VALUE *argv, VALUE self) { VALUE str, with_mnemonic; rb_scan_args(argc, argv, "02", &str, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ gtk_label_set_markup(_SELF(self), RVAL2CSTR(str)); } else { gtk_label_set_markup_with_mnemonic(_SELF(self), RVAL2CSTR(str)); } return self; } static VALUE rg_layout_offsets(VALUE self) { gint x, y; gtk_label_get_layout_offsets(_SELF(self), &x, &y); return rb_ary_new3(2, INT2NUM(x), INT2NUM(y)); } static VALUE rg_text(VALUE self) { return CSTR2RVAL(gtk_label_get_text(_SELF(self))); } static VALUE rg_select_region(VALUE self, VALUE start_offset, VALUE end_offset) { gtk_label_select_region(_SELF(self), NUM2INT(start_offset), NUM2INT(end_offset)); return self; } static VALUE rg_layout(VALUE self) { return GOBJ2RVAL(gtk_label_get_layout(_SELF(self))); } static VALUE rg_selection_bounds(VALUE self) { gint start, end; gboolean ret = gtk_label_get_selection_bounds(_SELF(self), &start, &end); return ret ? rb_ary_new3(2, INT2NUM(start), INT2NUM(end)) : Qnil; } void Init_gtk_label(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LABEL, "Label", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_text, -1); RG_DEF_METHOD_OPERATOR("text=", label_set_text_only, 1); RG_DEF_METHOD(set_markup, -1); RG_DEF_METHOD_OPERATOR("markup=", label_set_markup_only, 1); RG_DEF_METHOD(layout_offsets, 0); RG_DEF_METHOD(select_region, 2); RG_DEF_METHOD(layout, 0); RG_DEF_METHOD(selection_bounds, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-selection.c0000644000175000017500000001144012516434313020374 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mSelection static VALUE rg_s_owner_set(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { gboolean ret; if (argc == 3){ VALUE widget, selection, time; rb_scan_args(argc, argv, "30", &widget, &selection, &time); ret = gtk_selection_owner_set(RVAL2GTKWIDGET(widget), RVAL2ATOM(selection), NUM2INT(time)); } else { VALUE display, widget, selection, time; rb_scan_args(argc, argv, "40", &display, &widget, &selection, &time); ret = gtk_selection_owner_set_for_display(RVAL2GDKDISPLAYOBJECT(display), RVAL2GTKWIDGET(widget), RVAL2ATOM(selection), NUM2INT(time)); } return CBOOL2RVAL(ret); } static VALUE rg_s_add_target(VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE info) { gtk_selection_add_target(RVAL2GTKWIDGET(widget), RVAL2ATOM(selection), RVAL2ATOM(target), NUM2INT(info)); return self; } static VALUE rg_s_add_targets(VALUE self, VALUE rbwidget, VALUE rbselection, VALUE rbtargets) { GtkWidget *widget = RVAL2GTKWIDGET(rbwidget); GdkAtom selection = RVAL2ATOM(rbselection); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_selection_add_targets(widget, selection, targets, n); g_free(targets); return self; } static VALUE rg_s_clear_targets(VALUE self, VALUE widget, VALUE selection) { gtk_selection_clear_targets(RVAL2GTKWIDGET(widget), RVAL2ATOM(selection)); return self; } static VALUE rg_s_convert(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE time) { gboolean ret = gtk_selection_convert(RVAL2GTKWIDGET(widget), RVAL2ATOM(selection), RVAL2ATOM(target), NUM2INT(time)); return CBOOL2RVAL(ret); } static VALUE rg_s_remove_all(VALUE self, VALUE widget) { gtk_selection_remove_all(RVAL2GTKWIDGET(widget)); return self; } static VALUE rg_s_include_image_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets, VALUE rbwritable) { gboolean writable = RVAL2CBOOL(rbwritable); long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_image(targets, n, writable); g_free(targets); return result; } static VALUE rg_s_include_text_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets) { long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_text(targets, n); g_free(targets); return result; } static VALUE rg_s_include_uri_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets) { long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_uri(targets, n); g_free(targets); return result; } static VALUE rg_s_include_rich_text_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets, VALUE rbbuffer) { GtkTextBuffer *buffer = RVAL2GTKTEXTBUFFER(rbbuffer); long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_rich_text(targets, n, buffer); g_free(targets); return result; } void Init_gtk_selection(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Selection"); RG_DEF_SMETHOD(owner_set, 3); RG_DEF_SMETHOD(add_target, 4); RG_DEF_SMETHOD(add_targets, 3); RG_DEF_SMETHOD(clear_targets, 2); RG_DEF_SMETHOD(convert, 4); RG_DEF_SMETHOD(remove_all, 1); RG_DEF_SMETHOD_P(include_image, 2); RG_DEF_SMETHOD_P(include_text, 1); RG_DEF_SMETHOD_P(include_uri, 1); RG_DEF_SMETHOD_P(include_rich_text, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-box.c0000644000175000017500000001111312516434313017174 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cBox #define _SELF(self) (RVAL2GTKBOX(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE orientation, spacing; rb_scan_args(argc, argv, "11", &orientation, &spacing); RBGTK_INITIALIZE(self, gtk_box_new(RVAL2GTKORIENTATION(orientation), NIL_P(spacing) ? 0 : NUM2INT(spacing))); return Qnil; } static void box_pack_start_or_end(int argc, VALUE *argv, VALUE self, void (*func)(GtkBox *, GtkWidget *, gboolean, gboolean, guint)) { VALUE options, child, expand, fill, padding; rb_scan_args(argc, argv, "11", &child, &options); rbg_scan_options(options, "expand", &expand, "fill", &fill, "padding", &padding, NULL); func(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(expand) ? TRUE : RVAL2CBOOL(expand), NIL_P(fill) ? TRUE : RVAL2CBOOL(fill), NIL_P(padding) ? 0 : NUM2UINT(padding)); G_CHILD_ADD(self, child); } static VALUE rg_pack_start(int argc, VALUE *argv, VALUE self) { box_pack_start_or_end(argc, argv, self, gtk_box_pack_start); return self; } static VALUE rg_pack_end(int argc, VALUE *argv, VALUE self) { box_pack_start_or_end(argc, argv, self, gtk_box_pack_end); return self; } static VALUE rg_reorder_child(VALUE self, VALUE child, VALUE pos) { gtk_box_reorder_child(_SELF(self), RVAL2GTKWIDGET(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), RVAL2GTKWIDGET(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, GTKPACKTYPE2RVAL(pack_type)); return ary; } static VALUE rg_set_child_packing(int argc, VALUE *argv, VALUE self) { VALUE options, child, expand, fill, padding, pack_type; gboolean old_expand, old_fill; guint old_padding; GtkPackType old_pack_type; rb_scan_args(argc, argv, "11", &child, &options); rbg_scan_options(options, "expand", &expand, "fill", &fill, "padding", &padding, "pack_type", &pack_type, NULL); gtk_box_query_child_packing(_SELF(self), RVAL2GTKWIDGET(child), &old_expand, &old_fill, &old_padding, &old_pack_type); gtk_box_set_child_packing(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(expand) ? old_expand : RVAL2CBOOL(expand), NIL_P(fill) ? old_fill : RVAL2CBOOL(fill), NIL_P(padding) ? old_padding : NUM2UINT(padding), NIL_P(pack_type) ? old_pack_type : (GtkPackType)RVAL2GTKPACKTYPE(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(initialize, -1); RG_DEF_METHOD(pack_start, -1); RG_DEF_METHOD(pack_end, -1); RG_DEF_METHOD(reorder_child, 2); RG_DEF_METHOD(query_child_packing, 1); RG_DEF_METHOD(set_child_packing, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-font-chooser-dialog.c0000644000175000017500000000334712516434313022261 0ustar koukou/* -*- 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 2, 0) #define RG_TARGET_NAMESPACE cFontChooserDialog #define _SELF(self) (RVAL2GTKFONTCHOOSERDIALOG(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title, rb_parent; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, "parent", &rb_parent, NULL); /* TODO: accept NULL? */ widget = gtk_font_chooser_dialog_new(RVAL2CSTR(rb_title), RVAL2GTKWINDOW(rb_parent)); RBGTK_INITIALIZE(self, widget); return Qnil; } #endif void Init_gtk_fontchooserdialog(VALUE mGtk) { #if GTK_CHECK_VERSION(3, 2, 0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FONT_CHOOSER_DIALOG, "FontChooserDialog", mGtk); RG_DEF_METHOD(initialize, -1); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-page-setup-unix-dialog.c0000644000175000017500000000544212516434313022704 0ustar koukou/* -*- 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 "rbgtk3private.h" #ifdef HAVE_GTK_UNIX_PRINT #include #define RG_TARGET_NAMESPACE cPageSetupUnixDialog #define _SELF(s) (RVAL2GTKPAGESETUPUNIXDIALOG(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title, rb_parent; const gchar *title; GtkWindow *parent; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, "parent", &rb_parent, NULL); title = RVAL2CSTR_ACCEPT_NIL(rb_title); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); dialog = gtk_page_setup_unix_dialog_new(title, parent); RBGTK_INITIALIZE(self, dialog); return Qnil; } static VALUE rg_set_page_setup(VALUE self, VALUE page_setup) { gtk_page_setup_unix_dialog_set_page_setup(_SELF(self), RVAL2GTKPAGESETUP(page_setup)); return self; } static VALUE rg_page_setup(VALUE self) { return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_page_setup(_SELF(self))); } static VALUE rg_set_print_settings(VALUE self, VALUE print_settings) { gtk_page_setup_unix_dialog_set_print_settings(_SELF(self), RVAL2GTKPRINTSETTINGS(print_settings)); return Qnil; } static VALUE rg_print_settings(VALUE self) { return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_print_settings(_SELF(self))); } #endif void Init_gtk_page_setup_unix_dialog(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP_UNIX_DIALOG, "PageSetupUnixDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_page_setup, 1); RG_DEF_METHOD(page_setup, 0); RG_DEF_METHOD(set_print_settings, 1); RG_DEF_METHOD(print_settings, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-selection.c0000644000175000017500000001260312516434313021333 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeSelection #define _SELF(s) (RVAL2GTKTREESELECTION(s)) static gboolean selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(selection), GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), CBOOL2RVAL(path_currently_selected))); } static VALUE rg_set_select_function(VALUE self) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_selection_set_select_function(_SELF(self), (GtkTreeSelectionFunc)selection_func, (gpointer)func, NULL); return self; } static VALUE rg_tree_view(VALUE self) { return GOBJ2RVAL(gtk_tree_selection_get_tree_view(_SELF(self))); } static VALUE rg_selected(VALUE self) { GtkTreeIter iter; GtkTreeModel* model; gboolean ret = gtk_tree_selection_get_selected(_SELF(self), &model, &iter); iter.user_data3 = model; return ret ? GTKTREEITER2RVAL(&iter) : Qnil; } static void foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { iter->user_data3 = model; rb_funcall((VALUE)data, id_call, 3, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter)); } static VALUE rg_selected_each(VALUE self) { volatile VALUE func = rb_block_proc(); gtk_tree_selection_selected_foreach(_SELF(self), (GtkTreeSelectionForeachFunc)foreach_func, (gpointer)func); return self; } static VALUE rg_select_path(VALUE self, VALUE path) { gtk_tree_selection_select_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_unselect_path(VALUE self, VALUE path) { gtk_tree_selection_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_path_is_selected_p(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_tree_selection_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_select_iter(VALUE self, VALUE iter) { gtk_tree_selection_select_iter(_SELF(self), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_unselect_iter(VALUE self, VALUE iter) { gtk_tree_selection_unselect_iter(_SELF(self), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_iter_is_selected_p(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_tree_selection_iter_is_selected(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_select_all(VALUE self) { gtk_tree_selection_select_all(_SELF(self)); return self; } static VALUE rg_unselect_all(VALUE self) { gtk_tree_selection_unselect_all(_SELF(self)); return self; } static VALUE rg_select_range(VALUE self, VALUE start_path, VALUE end_path) { gtk_tree_selection_select_range(_SELF(self), RVAL2GTKTREEPATH(start_path), RVAL2GTKTREEPATH(end_path)); return self; } static VALUE rg_selected_rows(VALUE self) { GtkTreeModel* model; GList* list = gtk_tree_selection_get_selected_rows(_SELF(self), &model); VALUE ret = BOXEDGLIST2RVAL(list, GTK_TYPE_TREE_PATH); g_list_foreach(list, (GFunc)gtk_tree_path_free, (gpointer)NULL); g_list_free(list); return ret; } static VALUE rg_count_selected_rows(VALUE self) { return INT2NUM(gtk_tree_selection_count_selected_rows(_SELF(self))); } static VALUE rg_unselect_range(VALUE self, VALUE start_path, VALUE end_path) { gtk_tree_selection_unselect_range(_SELF(self), RVAL2GTKTREEPATH(start_path), RVAL2GTKTREEPATH(end_path)); return self; } void Init_gtk_treeselection(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_SELECTION, "TreeSelection", mGtk); RG_DEF_METHOD(set_select_function, 0); RG_DEF_METHOD(tree_view, 0); RG_DEF_METHOD(selected, 0); RG_DEF_METHOD(selected_each, 0); RG_DEF_METHOD(select_path, 1); RG_DEF_METHOD(unselect_path, 1); RG_DEF_METHOD_P(path_is_selected, 1); RG_DEF_METHOD(select_iter, 1); RG_DEF_METHOD(unselect_iter, 1); RG_DEF_METHOD_P(iter_is_selected, 1); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(select_range, 2); RG_DEF_METHOD(selected_rows, 0); RG_DEF_METHOD(count_selected_rows, 0); RG_DEF_METHOD(unselect_range, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-allocation.c0000644000175000017500000000737212516434313020545 0ustar koukou/* -*- 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 "rbgtk3private.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) (RVAL2GTKALLOCATION(r)) 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 ? GTKALLOCATION2RVAL(&dest) : Qnil; } static VALUE rg_union(VALUE self, VALUE other) { GtkAllocation dest; gdk_rectangle_union(_SELF(self), _SELF(other), &dest); return GTKALLOCATION2RVAL(&dest); } /* 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 GDKRECTANGLE2RVAL(_SELF(self)); } 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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-menu-item.c0000644000175000017500000000540312516434313020311 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMenuItem #define _SELF(s) (RVAL2GTKMENUITEM(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { const gchar *label = NULL; VALUE rb_label, use_underline; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "02", &rb_label, &use_underline); if (!NIL_P(rb_label)) label = RVAL2CSTR(rb_label); if (label) { if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)) { widget = gtk_menu_item_new_with_mnemonic(label); } else { widget = gtk_menu_item_new_with_label(label); } } else { widget = gtk_menu_item_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE mitem_set_submenu(VALUE self, VALUE child) { GtkMenuItem *item; GtkWidget *submenu; item = _SELF(self); submenu = gtk_menu_item_get_submenu(item); if (submenu) G_CHILD_REMOVE(self, GOBJ2RVAL(submenu)); gtk_menu_item_set_submenu(item, RVAL2GTKWIDGET(child)); G_CHILD_ADD(self, child); return self; } static VALUE rg_toggle_size_request(VALUE self) { gint requisition; gtk_menu_item_toggle_size_request(_SELF(self), &requisition); return INT2NUM(requisition); } static VALUE rg_toggle_size_allocate(VALUE self, VALUE allocation) { gtk_menu_item_toggle_size_allocate(_SELF(self), NUM2INT(allocation)); return self; } void Init_gtk_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_ITEM, "MenuItem", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "submenu", mitem_set_submenu, 1); RG_DEF_METHOD(toggle_size_request, 0); RG_DEF_METHOD(toggle_size_allocate, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-lock-button.c0000644000175000017500000000301112516434313020643 0ustar koukou/* -*- 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 2, 0) #define RG_TARGET_NAMESPACE cLockButton #define _SELF(self) (RVAL2GTKLOCKBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE permission; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &permission); widget = gtk_lock_button_new(NIL_P(permission) ? NULL : RVAL2GPERMISSION(permission)); RBGTK_INITIALIZE(self, widget); return Qnil; } #endif void Init_gtk_lockbutton(VALUE mGtk) { #if GTK_CHECK_VERSION(3, 2, 0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LOCK_BUTTON, "LockButton", mGtk); RG_DEF_METHOD(initialize, -1); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-theme.c0000644000175000017500000001650012516434313020441 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIconTheme #define _SELF(i) RVAL2GTKICONTHEME(i) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_icon_theme_new()); return Qnil; } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_icon_theme_get_default()); } static VALUE rg_s_get_for_screen(G_GNUC_UNUSED VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_icon_theme_get_for_screen(RVAL2GDKSCREEN(screen))); } static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_icon_theme_set_screen(_SELF(self), RVAL2GDKSCREEN(screen)); return self; } static VALUE rg_set_search_path(VALUE self, VALUE rbpath) { GtkIconTheme *theme = _SELF(self); long n; const gchar **path = RVAL2STRS(rbpath, n); gtk_icon_theme_set_search_path(theme, path, n); g_free(path); return self; } static VALUE rg_search_path(VALUE self) { gchar **path; gtk_icon_theme_get_search_path(_SELF(self), &path, NULL); return STRV2RVAL_FREE(path); } static VALUE rg_append_search_path(VALUE self, VALUE path) { gtk_icon_theme_append_search_path(_SELF(self), RVAL2CSTR(path)); return self; } static VALUE rg_prepend_search_path(VALUE self, VALUE path) { gtk_icon_theme_prepend_search_path(_SELF(self), RVAL2CSTR(path)); return self; } static VALUE rg_set_custom_theme(VALUE self, VALUE theme_name) { gtk_icon_theme_set_custom_theme(_SELF(self), RVAL2CSTR_ACCEPT_NIL(theme_name)); return self; } static VALUE rg_has_icon_p(VALUE self, VALUE icon_name) { return CBOOL2RVAL(gtk_icon_theme_has_icon(_SELF(self), RVAL2CSTR(icon_name))); } static VALUE rg_lookup_icon(VALUE self, VALUE icon, VALUE size, VALUE flags) { GtkIconInfo* info; if (TYPE(icon) == T_STRING) { info = gtk_icon_theme_lookup_icon(_SELF(self), RVAL2CSTR(icon), NUM2INT(size), RVAL2GTKICONLOOKUPFLAGS(flags)); } else { info = gtk_icon_theme_lookup_by_gicon(_SELF(self), RVAL2GICON(icon), NUM2INT(size), RVAL2GTKICONLOOKUPFLAGS(flags)); } /* TODO: need gtk_icon_info_free? */ return GTKICONINFO2RVAL(info); } static VALUE rg_load_icon(VALUE self, VALUE icon_name, VALUE size, VALUE flags) { GError *error = NULL; GdkPixbuf *pixbuf; pixbuf = gtk_icon_theme_load_icon(_SELF(self), RVAL2CSTR(icon_name), NUM2INT(size), RVAL2GTKICONLOOKUPFLAGS(flags), &error); if (!pixbuf) RAISE_GERROR(error); return GOBJ2RVAL(pixbuf); } static VALUE rg_icons(int argc, VALUE *argv, VALUE self) { VALUE context; GList *icons; rb_scan_args(argc, argv, "01", &context); icons = gtk_icon_theme_list_icons(_SELF(self), RVAL2CSTR_ACCEPT_NIL(context)); return CSTRGLIST2RVAL_FREE(icons, g_list_free, g_free); } static VALUE rg_get_icon_sizes(VALUE self, VALUE icon_name) { VALUE ary = rb_ary_new(); gint* sizes = gtk_icon_theme_get_icon_sizes(_SELF(self), RVAL2CSTR(icon_name)); gint* tmp_sizes = sizes; while (*tmp_sizes) { rb_ary_push(ary, INT2NUM(*tmp_sizes)); tmp_sizes++; } g_free(sizes); return ary; } static VALUE rg_example_icon_name(VALUE self) { return CSTR2RVAL_FREE(gtk_icon_theme_get_example_icon_name(_SELF(self))); } static VALUE rg_rescan_if_needed(VALUE self) { return CBOOL2RVAL(gtk_icon_theme_rescan_if_needed(_SELF(self))); } static VALUE rg_s_add_builtin_icon(VALUE self, VALUE icon_name, VALUE size, VALUE pixbuf) { gtk_icon_theme_add_builtin_icon(RVAL2CSTR(icon_name), NUM2INT(size), RVAL2GDKPIXBUF(pixbuf)); return self; } static VALUE rg_choose_icon(int argc, VALUE *argv, VALUE self) { VALUE rb_icon_names, rb_size, rb_flags; gint size; const gchar **icon_names; GtkIconLookupFlags flags; GtkIconInfo *info; rb_scan_args(argc, argv, "21", &rb_icon_names, &rb_size, &rb_flags); if (RVAL2CBOOL(rb_obj_is_kind_of(rb_icon_names, rb_cString))) { icon_names = ALLOCA_N(const gchar *, 2); icon_names[0] = RVAL2CSTR(rb_icon_names); icon_names[1] = NULL; } else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_icon_names, rb_cArray))) { icon_names = RVAL2STRV(rb_icon_names); } else { rb_raise(rb_eArgError, "expected (name, size), (name, size, flags), " "([name1, name2, ...], size) or " "([name1, name2, ...], size, flags): %s", RBG_INSPECT(rb_ary_new4(argc, argv))); } size = NUM2INT(rb_size); if (NIL_P(rb_flags)) { flags = GTK_ICON_LOOKUP_GENERIC_FALLBACK; } else { flags = RVAL2GTKICONLOOKUPFLAGS(rb_flags); } info = gtk_icon_theme_choose_icon(_SELF(self), icon_names, size, flags); return GTKICONINFO2RVAL(info); } static VALUE rg_contexts(VALUE self) { return CSTRGLIST2RVAL_FREE(gtk_icon_theme_list_contexts(_SELF(self)), g_list_free, g_free); } void Init_gtk_icon_theme(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_THEME, "IconTheme", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_SMETHOD(default, 0); RG_DEF_SMETHOD(get_for_screen, 1); RG_DEF_METHOD(set_screen, 1); RG_DEF_METHOD(set_search_path, 1); RG_DEF_METHOD(search_path, 0); RG_DEF_METHOD(append_search_path, 1); RG_DEF_METHOD(prepend_search_path, 1); RG_DEF_METHOD(set_custom_theme, 1); RG_DEF_METHOD_P(has_icon, 1); RG_DEF_METHOD(lookup_icon, 3); RG_DEF_METHOD(load_icon, 3); RG_DEF_METHOD(icons, -1); RG_DEF_METHOD(get_icon_sizes, 1); RG_DEF_METHOD(example_icon_name, 0); RG_DEF_METHOD(rescan_if_needed, 0); RG_DEF_SMETHOD(add_builtin_icon, 3); RG_DEF_METHOD(choose_icon, -1); RG_DEF_METHOD(contexts, 0); G_DEF_ERROR(GTK_ICON_THEME_ERROR, "IconThemeError", mGtk, rb_eRuntimeError, GTK_TYPE_ICON_THEME_ERROR); G_DEF_CLASS(GTK_TYPE_ICON_LOOKUP_FLAGS, "LookupFlags", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-spin-button.c0000644000175000017500000000745312516434313020702 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSpinButton #define _SELF(self) (RVAL2GTKSPINBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; GtkAdjustment *adj = NULL; gfloat climb_rate; gint digits; GtkWidget *widget; rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3); if (NIL_P(arg1) || RVAL2GTYPE(arg1) == GTK_TYPE_ADJUSTMENT){ if (!NIL_P(arg1)) adj = RVAL2GTKADJUSTMENT(arg1); climb_rate = (NIL_P(arg2))? 0.0: NUM2DBL(arg2); digits = (NIL_P(arg3))? 0: NUM2UINT(arg3); widget = gtk_spin_button_new(adj, climb_rate, digits); } else { widget = gtk_spin_button_new_with_range(NUM2DBL(arg1), NUM2DBL(arg2), NUM2DBL(arg3)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_configure(VALUE self, VALUE adj, VALUE climb_rate, VALUE digits) { gtk_spin_button_configure(_SELF(self), RVAL2GTKADJUSTMENT(adj), NUM2DBL(climb_rate), NUM2UINT(digits)); return self; } static VALUE rg_set_increments(VALUE self, VALUE step, VALUE page) { gtk_spin_button_set_increments(_SELF(self), NUM2DBL(step), NUM2DBL(page)); return self; } static VALUE rg_set_range(VALUE self, VALUE min, VALUE max) { gtk_spin_button_set_range(_SELF(self), NUM2DBL(min), NUM2DBL(max)); return self; } static VALUE rg_value_as_int(VALUE self) { return INT2NUM(gtk_spin_button_get_value_as_int(_SELF(self))); } static VALUE rg_spin(VALUE self, VALUE direction, VALUE increment) { gtk_spin_button_spin(_SELF(self), RVAL2GTKSPINTYPE(direction), NUM2DBL(increment)); return self; } static VALUE rg_update(VALUE self) { gtk_spin_button_update(_SELF(self)); return self; } static VALUE rg_increments(VALUE self) { gdouble step, page; gtk_spin_button_get_increments(_SELF(self), &step, &page); return rb_ary_new3(2, rb_float_new(step), rb_float_new(page)); } static VALUE rg_range(VALUE self) { gdouble min, max; gtk_spin_button_get_range(_SELF(self), &min, &max); return rb_ary_new3(2, rb_float_new(min), rb_float_new(max)); } void Init_gtk_spin_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SPIN_BUTTON, "SpinButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(configure, 3); RG_DEF_METHOD(set_increments, 2); RG_DEF_METHOD(set_range, 2); RG_DEF_METHOD(value_as_int, 0); RG_DEF_METHOD(spin, 2); RG_DEF_METHOD(update, 0); RG_DEF_METHOD(increments, 0); RG_DEF_METHOD(range, 0); G_DEF_CLASS(GTK_TYPE_SPIN_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY, "UpdatePolicy", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-file-chooser-widget.c0000644000175000017500000000251612516434313022253 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFileChooserWidget static VALUE rg_initialize(VALUE self, VALUE action) { RBGTK_INITIALIZE(self, gtk_file_chooser_widget_new(RVAL2GTKFILECHOOSERACTION(action))); return Qnil; } void Init_gtk_file_chooser_widget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_WIDGET, "FileChooserWidget", mGtk); RG_DEF_METHOD(initialize, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-app-chooser-widget.c0000644000175000017500000000250312516434313022110 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAppChooserWidget #define _SELF(self) (RVAL2GTKAPPCHOOSERWIDGET(self)) static VALUE rg_initialize(VALUE self, VALUE content_type) { RBGTK_INITIALIZE(self, gtk_app_chooser_widget_new(RVAL2CSTR(content_type))); return Qnil; } void Init_gtk_appchooserwidget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_APP_CHOOSER_WIDGET, "AppChooserWidget", mGtk); RG_DEF_METHOD(initialize, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-style-context.c0000644000175000017500000002336212516434313021237 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cStyleContext #define _SELF(self) (RVAL2GTKSTYLECONTEXT(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_style_context_new()); return Qnil; } static VALUE rg_add_class(VALUE self, VALUE class_name) { gtk_style_context_add_class(_SELF(self), RVAL2CSTR(class_name)); return self; } static VALUE rg_add_provider(VALUE self, VALUE provider, VALUE priority) { gtk_style_context_add_provider(_SELF(self), RVAL2GTKSTYLEPROVIDER(provider), NUM2UINT(priority)); return self; } static VALUE rg_add_region(VALUE self, VALUE region_name, VALUE flags) { gtk_style_context_add_region(_SELF(self), RVAL2CSTR(region_name), RVAL2GTKREGIONFLAGS(flags)); return self; } static VALUE rg_get_background_color(VALUE self, VALUE state) { GdkRGBA color; gtk_style_context_get_background_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), &color); return GDKRGBA2RVAL(&color); } static VALUE rg_get_border(VALUE self, VALUE state) { GtkBorder border; gtk_style_context_get_border(_SELF(self), RVAL2GTKSTATEFLAGS(state), &border); return GTKBORDER2RVAL(&border); } static VALUE rg_get_border_color(VALUE self, VALUE state) { GdkRGBA color; gtk_style_context_get_border_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), &color); return GDKRGBA2RVAL(&color); } static VALUE rg_get_color(VALUE self, VALUE state) { GdkRGBA color; gtk_style_context_get_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), &color); return GDKRGBA2RVAL(&color); } static VALUE rg_get_font(VALUE self, VALUE state) { PangoFontDescription *desc; desc = gtk_style_context_get_font(_SELF(self), RVAL2GTKSTATEFLAGS(state)); return PANGOFONTDESCRIPTION2RVAL(desc); } static VALUE rg_junction_sides(VALUE self) { GtkJunctionSides sides; sides = gtk_style_context_get_junction_sides(_SELF(self)); return GTKJUNCTIONSIDES2RVAL(sides); } static VALUE rg_get_margin(VALUE self, VALUE state) { GtkBorder margin; gtk_style_context_get_margin(_SELF(self), RVAL2GTKSTATEFLAGS(state), &margin); return GTKBORDER2RVAL(&margin); } static VALUE rg_get_padding(VALUE self, VALUE state) { GtkBorder padding; gtk_style_context_get_padding(_SELF(self), RVAL2GTKSTATEFLAGS(state), &padding); return GTKBORDER2RVAL(&padding); } static VALUE rg_path(VALUE self) { return GTKWIDGETPATH2RVAL(gtk_style_context_get_path(_SELF(self))); } static VALUE rg_get_property(VALUE self, VALUE property, VALUE state) { GValue value = G_VALUE_INIT; VALUE ret = Qnil; gtk_style_context_get_property(_SELF(self), RVAL2CSTR(property), RVAL2GTKSTATEFLAGS(state), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static VALUE rg_state(VALUE self) { GtkStateFlags state; state = gtk_style_context_get_state(_SELF(self)); return GTKSTATEFLAGS2RVAL(state); } static VALUE rg_get_style_property(VALUE self, VALUE property_name) { GValue value = G_VALUE_INIT; VALUE ret = Qnil; gtk_style_context_get_style_property(_SELF(self), RVAL2CSTR(property_name), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static VALUE rg_has_class_p(VALUE self, VALUE class_name) { return CBOOL2RVAL(gtk_style_context_has_class(_SELF(self), RVAL2CSTR(class_name))); } static VALUE rg_has_region(VALUE self, VALUE region_name) { GtkRegionFlags flags; gboolean result; result = gtk_style_context_has_region(_SELF(self), RVAL2CSTR(region_name), &flags); return result ? GTKREGIONFLAGS2RVAL(flags) : Qnil; } static VALUE rg_invalidate(VALUE self) { gtk_style_context_invalidate(_SELF(self)); return self; } static VALUE rg_classes(VALUE self) { return CSTRGLIST2RVAL_FREE(gtk_style_context_list_classes(_SELF(self)), g_list_free, NULL); } static VALUE rg_regions(VALUE self) { return CSTRGLIST2RVAL_FREE(gtk_style_context_list_regions(_SELF(self)), g_list_free, NULL); } static VALUE rg_lookup_color(VALUE self, VALUE color_name) { GdkRGBA color; gboolean result; result = gtk_style_context_lookup_color(_SELF(self), RVAL2CSTR(color_name), &color); return result ? GDKRGBA2RVAL(&color) : Qnil; } static VALUE rg_lookup_icon_set(VALUE self, VALUE stock_id) { VALUE buffer; return GTKICONSET2RVAL(gtk_style_context_lookup_icon_set(_SELF(self), RVAL2GLIBID(stock_id, buffer))); } static VALUE rg_pop_animatable_region(VALUE self) { gtk_style_context_pop_animatable_region(_SELF(self)); return self; } static VALUE rg_push_animatable_region(VALUE self, VALUE region_id) { gtk_style_context_push_animatable_region(_SELF(self), (gpointer)region_id); if (rb_block_given_p()) rb_ensure(rb_yield, self, rg_pop_animatable_region, self); return self; } static VALUE rg_remove_class(VALUE self, VALUE class_name) { gtk_style_context_remove_class(_SELF(self), RVAL2CSTR(class_name)); return self; } static VALUE rg_remove_provider(VALUE self, VALUE provider) { gtk_style_context_remove_provider(_SELF(self), RVAL2GTKSTYLEPROVIDER(provider)); return self; } static VALUE rg_remove_region(VALUE self, VALUE region_name) { gtk_style_context_remove_region(_SELF(self), RVAL2CSTR(region_name)); return self; } static VALUE rg_restore(VALUE self) { gtk_style_context_restore(_SELF(self)); return self; } static VALUE rg_save(VALUE self) { gtk_style_context_save(_SELF(self)); return self; } static VALUE rg_set_background(VALUE self, VALUE window) { gtk_style_context_set_background(_SELF(self), RVAL2GDKWINDOW(window)); return self; } static VALUE rg_set_junction_sides(VALUE self, VALUE sides) { gtk_style_context_set_junction_sides(_SELF(self), RVAL2GTKJUNCTIONSIDES(sides)); return self; } static VALUE rg_set_path(VALUE self, VALUE path) { gtk_style_context_set_path(_SELF(self), RVAL2GTKWIDGETPATH(path)); return self; } static VALUE rg_set_state(VALUE self, VALUE state) { gtk_style_context_set_state(_SELF(self), RVAL2GTKSTATEFLAGS(state)); return self; } static VALUE rg_state_is_running(VALUE self, VALUE state) { gdouble progress; gboolean result; result = gtk_style_context_state_is_running(_SELF(self), RVAL2GTKSTATEFLAGS(state), &progress); return result ? DBL2NUM(progress) : Qnil; } void Init_gtk_stylecontext(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STYLE_CONTEXT, "StyleContext", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add_class, 1); RG_DEF_METHOD(add_provider, 2); RG_DEF_METHOD(add_region, 2); RG_DEF_METHOD(classes, 0); RG_DEF_METHOD(get_background_color, 1); RG_DEF_METHOD(get_border, 1); RG_DEF_METHOD(get_border_color, 1); RG_DEF_METHOD(get_color, 1); RG_DEF_METHOD(get_font, 1); RG_DEF_METHOD(get_margin, 1); RG_DEF_METHOD(get_padding, 1); RG_DEF_METHOD(get_property, 2); RG_DEF_METHOD(get_style_property, 1); RG_DEF_METHOD_P(has_class, 1); RG_DEF_METHOD(has_region, 1); RG_DEF_METHOD(invalidate, 0); RG_DEF_METHOD(junction_sides, 0); RG_DEF_METHOD(lookup_color, 1); RG_DEF_METHOD(lookup_icon_set, 1); RG_DEF_METHOD(path, 0); RG_DEF_METHOD(pop_animatable_region, 0); RG_DEF_METHOD(push_animatable_region, 1); RG_DEF_METHOD(regions, 0); RG_DEF_METHOD(remove_class, 1); RG_DEF_METHOD(remove_provider, 1); RG_DEF_METHOD(remove_region, 1); RG_DEF_METHOD(restore, 0); RG_DEF_METHOD(save, 0); RG_DEF_METHOD(set_background, 1); RG_DEF_METHOD(set_junction_sides, 1); RG_DEF_METHOD(set_path, 1); RG_DEF_METHOD(set_state, 1); RG_DEF_METHOD(state, 0); RG_DEF_METHOD(state_is_running, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-separator.c0000644000175000017500000000273212516434313020413 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSeparator #define _SELF(self) (RVAL2GTKSEPARATOR(self)) static VALUE rg_initialize(VALUE self, VALUE orientation) { RBGTK_INITIALIZE(self, gtk_separator_new(RVAL2GTKORIENTATION(orientation))); return Qnil; } void Init_gtk_separator(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEPARATOR, "Separator", mGtk); RG_DEF_METHOD(initialize, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-paned.c0000644000175000017500000000577112516434313017510 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPaned #define _SELF(self) (RVAL2GTKPANED(self)) static VALUE rg_initialize(VALUE self, VALUE orientation) { RBGTK_INITIALIZE(self, gtk_paned_new(RVAL2GTKORIENTATION(orientation))); return Qnil; } static VALUE rg_add1(VALUE self, VALUE child) { gtk_paned_add1(_SELF(self), RVAL2GTKWIDGET(child)); return self; } static VALUE rg_add2(VALUE self, VALUE child) { gtk_paned_add2(_SELF(self), RVAL2GTKWIDGET(child)); return self; } static void paned_pack(int argc, VALUE *argv, VALUE self, void (*func)(GtkPaned *, GtkWidget *, gboolean, gboolean), gboolean resize_default) { VALUE options, child, resize, shrink; rb_scan_args(argc, argv, "11", &child, &options); rbg_scan_options(options, "resize", &resize, "shrink", &shrink, NULL); func(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(resize) ? resize_default : RVAL2CBOOL(resize), NIL_P(shrink) ? TRUE : RVAL2CBOOL(shrink)); } static VALUE rg_pack1(int argc, VALUE *argv, VALUE self) { paned_pack(argc, argv, self, gtk_paned_pack1, FALSE); return self; } static VALUE rg_pack2(int argc, VALUE *argv, VALUE self) { paned_pack(argc, argv, self, gtk_paned_pack2, TRUE); return self; } static VALUE rg_child1(VALUE self) { return GOBJ2RVAL(gtk_paned_get_child1(_SELF(self))); } static VALUE rg_child2(VALUE self) { return GOBJ2RVAL(gtk_paned_get_child2(_SELF(self))); } static VALUE rg_handle_window(VALUE self) { return GOBJ2RVAL(gtk_paned_get_handle_window(_SELF(self))); } void Init_gtk_paned(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PANED, "Paned", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(add1, 1); RG_DEF_METHOD(add2, 1); RG_DEF_METHOD(pack1, -1); RG_DEF_METHOD(pack2, -1); RG_DEF_METHOD(child1, 0); RG_DEF_METHOD(child2, 0); RG_DEF_METHOD(handle_window, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-scale.c0000644000175000017500000000543512516434313017505 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cScale #define _SELF(self) (RVAL2GTKSCALE(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE orientation, arg1, arg2, arg3; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "13", &orientation, &arg1, &arg2, &arg3); if (NIL_P(arg1) || RVAL2GTYPE(arg1) == GTK_TYPE_ADJUSTMENT) { widget = gtk_scale_new(RVAL2GTKORIENTATION(orientation), NIL_P(arg1) ? NULL : RVAL2GTKADJUSTMENT(arg1)); } else { widget = gtk_scale_new_with_range(RVAL2GTKORIENTATION(orientation), NUM2DBL(arg1), NUM2DBL(arg2), NUM2DBL(arg3)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_layout(VALUE self) { return GOBJ2RVAL(gtk_scale_get_layout(_SELF(self))); } static VALUE rg_layout_offsets(VALUE self) { gint x, y; gtk_scale_get_layout_offsets(_SELF(self), &x, &y); return rb_assoc_new(INT2NUM(x), INT2NUM(y)); } static VALUE rg_add_mark(int argc, VALUE *argv, VALUE self) { VALUE value, position, markup; rb_scan_args(argc, argv, "21", &value, &position, &markup); gtk_scale_add_mark(_SELF(self), NUM2DBL(value), RVAL2GTKPOSITIONTYPE(position), RVAL2CSTR_ACCEPT_NIL(markup)); return self; } static VALUE rg_clear_marks(VALUE self) { gtk_scale_clear_marks(_SELF(self)); return self; } void Init_gtk_scale(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCALE, "Scale", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(layout, 0); RG_DEF_METHOD(layout_offsets, 0); RG_DEF_METHOD(add_mark, -1); RG_DEF_METHOD(clear_marks, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-event-box.c0000644000175000017500000000256512516434313020326 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cEventBox static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_event_box_new()); return Qnil; } void Init_gtk_eventbox(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_EVENT_BOX, "EventBox", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-source.c0000644000175000017500000001070612516434313020641 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIconSource #define _SELF(s) (RVAL2GTKICONSOURCE(s)) static VALUE rg_initialize(VALUE self) { GtkIconSource *icon_source; icon_source = gtk_icon_source_new(); G_INITIALIZE(self, icon_source); return Qnil; } static VALUE rg_direction(VALUE self) { return GTKTEXTDIRECTION2RVAL(gtk_icon_source_get_direction(_SELF(self))); } static VALUE rg_direction_wildcarded_p(VALUE self) { return CBOOL2RVAL(gtk_icon_source_get_direction_wildcarded(_SELF(self))); } static VALUE rg_filename(VALUE self) { return CSTR2RVAL(gtk_icon_source_get_filename(_SELF(self))); } static VALUE rg_pixbuf(VALUE self) { GdkPixbuf *pixbuf; pixbuf = gtk_icon_source_get_pixbuf(_SELF(self)); return pixbuf ? GOBJ2RVAL(pixbuf) : Qnil; } static VALUE rg_size(VALUE self) { return GTKICONSIZE2RVAL(gtk_icon_source_get_size(_SELF(self))); } static VALUE rg_size_wildcarded_p(VALUE self) { return CBOOL2RVAL(gtk_icon_source_get_size_wildcarded(_SELF(self))); } static VALUE rg_state(VALUE self) { return GTKSTATETYPE2RVAL(gtk_icon_source_get_state(_SELF(self))); } static VALUE rg_state_wildcarded_p(VALUE self) { return CBOOL2RVAL(gtk_icon_source_get_state_wildcarded(_SELF(self))); } static VALUE rg_set_direction(VALUE self, VALUE direction) { gtk_icon_source_set_direction(_SELF(self), RVAL2GTKTEXTDIRECTION(direction)); return self; } static VALUE rg_set_direction_wildcarded(VALUE self, VALUE setting) { gtk_icon_source_set_direction_wildcarded(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_filename(VALUE self, VALUE filename) { gtk_icon_source_set_filename(_SELF(self), RVAL2CSTR(filename)); return self; } static VALUE rg_set_pixbuf(VALUE self, VALUE pixbuf) { gtk_icon_source_set_pixbuf(_SELF(self), RVAL2GDKPIXBUF(pixbuf)); return self; } static VALUE rg_set_size(VALUE self, VALUE size) { gtk_icon_source_set_size(_SELF(self), RVAL2GTKICONSIZE(size)); return self; } static VALUE rg_set_size_wildcarded(VALUE self, VALUE setting) { gtk_icon_source_set_size_wildcarded(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_state(VALUE self, VALUE state) { gtk_icon_source_set_state(_SELF(self), RVAL2GTKSTATETYPE(state)); return self; } static VALUE rg_set_state_wildcarded(VALUE self, VALUE setting) { gtk_icon_source_set_state_wildcarded(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_icon_name(VALUE self) { return CSTR2RVAL(gtk_icon_source_get_icon_name(_SELF(self))); } static VALUE rg_set_icon_name(VALUE self, VALUE icon_name) { gtk_icon_source_set_icon_name(_SELF(self), RVAL2CSTR_ACCEPT_NIL(icon_name)); return self; } void Init_gtk_icon_source(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_SOURCE, "IconSource", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD_P(direction_wildcarded, 0); RG_DEF_METHOD(filename, 0); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD_P(size_wildcarded, 0); RG_DEF_METHOD(state, 0); RG_DEF_METHOD_P(state_wildcarded, 0); RG_DEF_METHOD(set_direction, 1); RG_DEF_METHOD(set_direction_wildcarded, 1); RG_DEF_METHOD(set_filename, 1); RG_DEF_METHOD(set_pixbuf, 1); RG_DEF_METHOD(set_size, 1); RG_DEF_METHOD(set_size_wildcarded, 1); RG_DEF_METHOD(set_state, 1); RG_DEF_METHOD(set_state_wildcarded, 1); RG_DEF_METHOD(icon_name, 0); RG_DEF_METHOD(set_icon_name, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/conversions.c0000644000175000017500000000216612516434313017655 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rbgtk3private.h" static VALUE cairo_context_gvalue2rvalue(const GValue *value) { return CRCONTEXT2RVAL(g_value_get_boxed(value)); } void Init_conversions(void) { rbgobj_register_g2r_func(CAIRO_GOBJECT_TYPE_CONTEXT, cairo_context_gvalue2rvalue); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-scrollable.c0000644000175000017500000000225512516434313020535 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mScrollable #define _SELF(self) (RVAL2GTKSCROLLABLE(self)) void Init_gtk_scrollable(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_SCROLLABLE, "Scrollable", mGtk); G_DEF_CLASS(GTK_TYPE_SCROLLABLE_POLICY, "Policy", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-app-chooser-button.c0000644000175000017500000000411612516434313022142 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAppChooserButton #define _SELF(self) (RVAL2GTKAPPCHOOSERBUTTON(self)) static VALUE rg_initialize(VALUE self, VALUE content_type) { RBGTK_INITIALIZE(self, gtk_app_chooser_button_new(RVAL2CSTR(content_type))); return Qnil; } static VALUE rg_append_custom_item(VALUE self, VALUE name, VALUE label, VALUE icon) { gtk_app_chooser_button_append_custom_item(_SELF(self), RVAL2CSTR(name), RVAL2CSTR(label), RVAL2GICON(icon)); return self; } static VALUE rg_append_separator(VALUE self) { gtk_app_chooser_button_append_separator(_SELF(self)); return self; } static VALUE rg_set_active_custom_item(VALUE self, VALUE name) { gtk_app_chooser_button_set_active_custom_item(_SELF(self), RVAL2CSTR(name)); return self; } void Init_gtk_appchooserbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_APP_CHOOSER_BUTTON, "AppChooserButton", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(append_custom_item, 3); RG_DEF_METHOD(append_separator, 0); RG_DEF_METHOD(set_active_custom_item, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-radio-button.c0000644000175000017500000000607312516434313021024 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRadioButton static VALUE RG_TARGET_NAMESPACE; #define _GROUP(s) (NIL_P(s) ? NULL : RVAL2GTKRADIOBUTTON(s)) static GtkWidget* create_button(VALUE group, VALUE label, VALUE use_underline) { GtkWidget* widget = NULL; if (TYPE(label) == T_STRING){ if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){ widget = gtk_radio_button_new_with_mnemonic_from_widget(_GROUP(group), RVAL2CSTR(label)); } else { widget = gtk_radio_button_new_with_label_from_widget(_GROUP(group), RVAL2CSTR(label)); } } else if (TYPE(label) == T_SYMBOL){ widget = gtk_radio_button_new_with_label_from_widget(_GROUP(group), rb_id2name(SYM2ID(label))); gtk_button_set_use_stock(GTK_BUTTON(widget), TRUE); } else if (NIL_P(label)){ widget = gtk_radio_button_new_from_widget(_GROUP(group)); } else { rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)", rb_class2name(CLASS_OF(label))); } return widget; } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE group_or_label, label_or_use_underline, use_underline; GtkWidget *widget; if (rb_scan_args(argc, argv, "03", &group_or_label, &label_or_use_underline, &use_underline) > 0) { if (rb_obj_is_kind_of(group_or_label, RG_TARGET_NAMESPACE)){ widget = create_button(group_or_label, label_or_use_underline, use_underline); } else { widget = create_button(Qnil, group_or_label, label_or_use_underline); } } else { widget = gtk_radio_button_new(NULL); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_group(VALUE self) { return GOBJGSLIST2RVAL(gtk_radio_button_get_group(RVAL2GTKRADIOBUTTON(self))); } void Init_gtk_radio_button(VALUE mGtk) { RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_BUTTON, "RadioButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(group, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-view.c0000644000175000017500000005503512516434313020326 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeView #define _SELF(s) (RVAL2GTKTREEVIEW(s)) static VALUE rb_mGtk; static ID id_model; static ID id_selection; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE model; GtkWidget *widget; if (rb_scan_args(argc, argv, "01", &model) == 1) { G_CHILD_SET(self, id_model, model); widget = gtk_tree_view_new_with_model(RVAL2GTKTREEMODEL(model)); } else { widget = gtk_tree_view_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_selection(VALUE self) { VALUE ret = GOBJ2RVAL(gtk_tree_view_get_selection(_SELF(self))); G_CHILD_SET(self, id_selection, ret); return ret; } static VALUE rg_columns_autosize(VALUE self) { gtk_tree_view_columns_autosize(_SELF(self)); return self; } static VALUE rg_append_column(VALUE self, VALUE column) { G_CHILD_ADD(self, column); return INT2NUM(gtk_tree_view_append_column(_SELF(self), RVAL2GTKTREEVIEWCOLUMN(column))); } static VALUE rg_remove_column(VALUE self, VALUE column) { G_CHILD_REMOVE(self, column); return INT2NUM(gtk_tree_view_remove_column(_SELF(self), RVAL2GTKTREEVIEWCOLUMN(column))); } static void cell_data_func(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { iter->user_data3 = model; rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(column), GOBJ2RVAL(cell), GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); } static VALUE rg_insert_column(int argc, VALUE *argv, VALUE self) { VALUE args[4]; rb_scan_args(argc, argv, "22", /* NORMAL ATTRIBUTES DATA_FUNC */ &args[0], /* column position position */ &args[1], /* position title title */ &args[2], /* renderer renderer */ &args[3]); /* attributes */ if (argc == 2) { G_CHILD_ADD(self, args[0]); return INT2NUM(gtk_tree_view_insert_column(_SELF(self), RVAL2GTKTREEVIEWCOLUMN(args[0]), NUM2INT(args[1]))); } else if (argc == 3) { int ret; VALUE func = rb_block_proc(); G_RELATIVE(self, argv[2]); G_RELATIVE(self, func); ret = gtk_tree_view_insert_column_with_data_func(_SELF(self), NUM2INT(args[0]), RVAL2CSTR(args[1]), RVAL2GTKCELLRENDERER(args[2]), (GtkTreeCellDataFunc)cell_data_func, (gpointer)func, NULL); return INT2NUM(ret); } else if (argc == 4) { int i; int col; int ret; const gchar *name; VALUE ary; GtkCellRenderer* renderer = RVAL2GTKCELLRENDERER(args[2]); GtkTreeViewColumn* column = gtk_tree_view_column_new(); Check_Type(args[3], T_HASH); /* TODO: Should this really be done before we know that everything * below worked without error? */ G_CHILD_ADD(self, args[2]); G_CHILD_ADD(self, args[3]); gtk_tree_view_column_set_title(column, RVAL2CSTR(args[1])); gtk_tree_view_column_pack_start(column, renderer, TRUE); ret = gtk_tree_view_insert_column(_SELF(self), column, NUM2INT(args[0])); ary = rb_funcall(args[3], rb_intern("to_a"), 0); for (i = 0; i < RARRAY_LEN(ary); i++) { VALUE val = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(val)) { name = rb_id2name(SYM2ID(val)); } else { name = RVAL2CSTR(val); } col = NUM2INT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); gtk_tree_view_column_add_attribute(column, renderer, name, col); } return INT2NUM(ret); } else { rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc); } return Qnil; } static VALUE rg_get_column(VALUE self, VALUE num) { return GOBJ2RVAL(gtk_tree_view_get_column(_SELF(self), NUM2INT(num))); } static VALUE rg_columns(VALUE self) { return GOBJGLIST2RVAL_FREE(gtk_tree_view_get_columns(_SELF(self)), g_list_free, NULL); } static VALUE rg_move_column_after(VALUE self, VALUE column, VALUE base_column) { gtk_tree_view_move_column_after(_SELF(self), RVAL2GTKTREEVIEWCOLUMN(column), NIL_P(base_column) ? NULL : RVAL2GTKTREEVIEWCOLUMN(base_column)); return self; } static gboolean column_drop_func(GtkTreeView *treeview, GtkTreeViewColumn *column, GtkTreeViewColumn *prev_column, GtkTreeViewColumn *next_column, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(treeview), GOBJ2RVAL(column), GOBJ2RVAL(prev_column), GOBJ2RVAL(next_column))); } static VALUE rg_set_column_drag_function(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_set_column_drag_function(_SELF(self), (GtkTreeViewColumnDropFunc)column_drop_func, (gpointer)func, NULL); return self; } static VALUE rg_scroll_to_point(VALUE self, VALUE x, VALUE y) { gtk_tree_view_scroll_to_point(_SELF(self), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_scroll_to_cell(VALUE self, VALUE path, VALUE column, VALUE use_align, VALUE row_align, VALUE col_align) { gtk_tree_view_scroll_to_cell(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), NIL_P(column) ? NULL : RVAL2GTKTREEVIEWCOLUMN(column), RVAL2CBOOL(use_align), NUM2DBL(row_align), NUM2DBL(col_align)); return self; } static VALUE rg_set_cursor(VALUE self, VALUE path, VALUE focus_column, VALUE start_editing) { gtk_tree_view_set_cursor(_SELF(self), RVAL2GTKTREEPATH(path), NIL_P(focus_column) ? NULL : RVAL2GTKTREEVIEWCOLUMN(focus_column), RVAL2CBOOL(start_editing)); return self; } static VALUE rg_cursor(VALUE self) { GtkTreePath* path; GtkTreeViewColumn* focus_column; gtk_tree_view_get_cursor(_SELF(self), &path, &focus_column); return rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, GOBJ2RVAL(focus_column)); } static VALUE rg_expand_all(VALUE self) { gtk_tree_view_expand_all(_SELF(self)); return self; } static VALUE rg_collapse_all(VALUE self) { gtk_tree_view_collapse_all(_SELF(self)); return self; } static VALUE rg_expand_row(VALUE self, VALUE path, VALUE open_all) { return CBOOL2RVAL(gtk_tree_view_expand_row(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2CBOOL(open_all))); } static VALUE rg_expand_to_path(VALUE self, VALUE path) { gtk_tree_view_expand_to_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_collapse_row(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_tree_view_collapse_row(_SELF(self), RVAL2GTKTREEPATH(path))); } static void mapping_func(GtkTreeView *treeview, GtkTreePath *path, gpointer func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(treeview), GTKTREEPATH2RVAL(path)); } static VALUE rg_map_expanded_rows(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_map_expanded_rows(_SELF(self), (GtkTreeViewMappingFunc)mapping_func, (gpointer)func); return self; } static VALUE rg_row_expanded_p(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_tree_view_row_expanded(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_get_path_at_pos(VALUE self, VALUE x, VALUE y) { GtkTreePath* path; GtkTreeViewColumn* column; gint cell_x, cell_y; gboolean ret; ret = gtk_tree_view_get_path_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y), &path, &column, &cell_x, &cell_y); return ret ? rb_ary_new3(4, path ? GTKTREEPATH2RVAL(path) : Qnil, column ? GOBJ2RVAL(column) : Qnil, INT2NUM(cell_x), INT2NUM(cell_y)) : Qnil; } static VALUE rg_get_cell_area(VALUE self, VALUE path, VALUE column) { GdkRectangle rect; gtk_tree_view_get_cell_area(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), NIL_P(column) ? NULL : RVAL2GTKTREEVIEWCOLUMN(column), &rect); return GDKRECTANGLE2RVAL(&rect); } static VALUE rg_get_background_area(VALUE self, VALUE path, VALUE column) { GdkRectangle rect; gtk_tree_view_get_background_area(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), NIL_P(column) ? NULL : RVAL2GTKTREEVIEWCOLUMN(column), &rect); return GDKRECTANGLE2RVAL(&rect); } static VALUE rg_visible_rect(VALUE self) { GdkRectangle rect; gtk_tree_view_get_visible_rect(_SELF(self), &rect); return GDKRECTANGLE2RVAL(&rect); } static VALUE rg_visible_range(VALUE self) { GtkTreePath* start_path; GtkTreePath* end_path; gboolean valid_paths = gtk_tree_view_get_visible_range(_SELF(self), &start_path, &end_path); return valid_paths ? rb_assoc_new(GTKTREEPATH2RVAL(start_path), GTKTREEPATH2RVAL(end_path)) : Qnil; } static VALUE rg_bin_window(VALUE self) { return GOBJ2RVAL(gtk_tree_view_get_bin_window(_SELF(self))); } static VALUE rg_convert_bin_window_to_tree_coords(VALUE self, VALUE bx, VALUE by) { gint tx, ty; gtk_tree_view_convert_bin_window_to_tree_coords(_SELF(self), NUM2INT(bx), NUM2INT(by), &tx, &ty); return rb_ary_new3(2, INT2NUM(tx), INT2NUM(ty)); } static VALUE rg_convert_bin_window_to_widget_coords(VALUE self, VALUE bx, VALUE by) { gint wx, wy; gtk_tree_view_convert_bin_window_to_widget_coords(_SELF(self), NUM2INT(bx), NUM2INT(by), &wx, &wy); return rb_ary_new3(2, INT2NUM(wx), INT2NUM(wy)); } static VALUE rg_convert_tree_to_bin_window_coords(VALUE self, VALUE tx, VALUE ty) { gint bx, by; gtk_tree_view_convert_tree_to_bin_window_coords(_SELF(self), NUM2INT(tx), NUM2INT(ty), &bx, &by); return rb_ary_new3(2, INT2NUM(bx), INT2NUM(by)); } static VALUE rg_convert_tree_to_widget_coords(VALUE self, VALUE tx, VALUE ty) { gint wx, wy; gtk_tree_view_convert_tree_to_widget_coords(_SELF(self), NUM2INT(tx), NUM2INT(ty), &wx, &wy); return rb_ary_new3(2, INT2NUM(wx), INT2NUM(wy)); } static VALUE rg_convert_widget_to_bin_window_coords(VALUE self, VALUE wx, VALUE wy) { gint bx, by; gtk_tree_view_convert_widget_to_bin_window_coords(_SELF(self), NUM2INT(wx), NUM2INT(wy), &bx, &by); return rb_ary_new3(2, INT2NUM(bx), INT2NUM(by)); } static VALUE rg_convert_widget_to_tree_coords(VALUE self, VALUE wx, VALUE wy) { gint tx, ty; gtk_tree_view_convert_widget_to_tree_coords(_SELF(self), NUM2INT(wx), NUM2INT(wy), &tx, &ty); return rb_ary_new3(2, INT2NUM(tx), INT2NUM(ty)); } static VALUE rg_enable_model_drag_dest(VALUE self, VALUE rbtargets, VALUE rbactions) { GtkTreeView *view = _SELF(self); GdkDragAction actions = RVAL2GDKDRAGACTION(rbactions); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_tree_view_enable_model_drag_dest(view, targets, n, actions); g_free(targets); return self; } static VALUE rg_enable_model_drag_source(VALUE self, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions) { GtkTreeView *view = _SELF(self); GdkModifierType start_button_mask = RVAL2GDKMODIFIERTYPE(rbstart_button_mask); GdkDragAction actions = RVAL2GDKDRAGACTION(rbactions); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES_ACCEPT_NIL(rbtargets, &n); if (targets == NULL) return self; gtk_tree_view_enable_model_drag_source(view, start_button_mask, targets, n, actions); g_free(targets); return self; } static VALUE rg_unset_rows_drag_source(VALUE self) { gtk_tree_view_unset_rows_drag_source(_SELF(self)); return self; } static VALUE rg_unset_rows_drag_dest(VALUE self) { gtk_tree_view_unset_rows_drag_dest(_SELF(self)); return self; } static VALUE rg_set_drag_dest_row(VALUE self, VALUE path, VALUE pos) { gtk_tree_view_set_drag_dest_row(_SELF(self), NIL_P(path)?NULL:RVAL2GTKTREEPATH(path), RVAL2GTKTREEVIEWDROPPOSITION(pos)); return self; } static VALUE rg_drag_dest_row(VALUE self) { GtkTreePath* path = NULL; GtkTreeViewDropPosition pos; gtk_tree_view_get_drag_dest_row(_SELF(self), &path, &pos); return rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, GTKTREEVIEWDROPPOSITION2RVAL(pos)); } static VALUE rg_get_dest_row_at_pos(VALUE self, VALUE drag_x, VALUE drag_y) { GtkTreePath* path; GtkTreeViewDropPosition pos; gboolean ret; ret = gtk_tree_view_get_dest_row_at_pos(_SELF(self), NUM2INT(drag_x), NUM2INT(drag_y), &path, &pos); return ret ? rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, GTKTREEVIEWDROPPOSITION2RVAL(pos)) : Qnil; } static VALUE rg_create_row_drag_icon(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_tree_view_create_row_drag_icon(_SELF(self), RVAL2GTKTREEPATH(path))); } /* We don't need this. GtkTreeViewSearchEqualFunc gtk_tree_view_get_search_equal_func (GtkTreeView *tree_view); */ static gboolean search_equal_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer func) { iter->user_data3 = model; return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(model), INT2NUM(column), CSTR2RVAL(key), GTKTREEITER2RVAL(iter))); } static VALUE rg_set_search_equal_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_set_search_equal_func(_SELF(self), (GtkTreeViewSearchEqualFunc)search_equal_func, (gpointer)func, NULL); return self; } /* * Optional Signals */ static VALUE treeview_signal_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkTreeView* view = g_value_get_object(&values[0]); GtkTreeIter* iter = g_value_get_boxed(&values[1]); iter->user_data3 = gtk_tree_view_get_model(view); return rb_ary_new3(3, GOBJ2RVAL(view), GTKTREEITER2RVAL(iter), GVAL2RVAL(&values[2])); } static VALUE rg_set_cursor_on_cell(VALUE self, VALUE path, VALUE focus_column, VALUE focus_cell, VALUE start_editing) { gtk_tree_view_set_cursor_on_cell(_SELF(self), RVAL2GTKTREEPATH(path), NIL_P(focus_column) ? NULL : RVAL2GTKTREEVIEWCOLUMN(focus_column), NIL_P(focus_cell) ? NULL : RVAL2GTKCELLRENDERER(focus_cell), RVAL2CBOOL(start_editing)); return self; } /* How can I implement this? GtkTreeViewRowSeparatorFunc gtk_tree_view_get_row_separator_func (GtkTreeView *tree_view); */ static gboolean row_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { VALUE ret; iter->user_data3 = model; ret = rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); return CBOOL2RVAL(ret); } static VALUE rg_set_row_separator_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_set_row_separator_func(_SELF(self), row_separator_func, (gpointer)func, (GDestroyNotify)NULL); return self; } static VALUE rg_search_entry(VALUE self) { return GOBJ2RVAL(gtk_tree_view_get_search_entry(_SELF(self))); } static VALUE rg_set_search_entry(VALUE self, VALUE entry) { gtk_tree_view_set_search_entry(_SELF(self), RVAL2GTKENTRY(entry)); return self; } /* Can't define this. GtkTreeViewSearchPositionFunc gtk_tree_view_get_search_position_func (GtkTreeView *tree_view); */ struct callback_arg { VALUE callback; VALUE tree_view; VALUE search_dialog; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; rb_funcall(arg->callback, id_call, 2, arg->tree_view, arg->search_dialog); return Qnil; } static void search_position_func(GtkTreeView *tree_view, GtkWidget *search_dialog, gpointer func) { struct callback_arg arg; arg.callback = (VALUE)func; arg.tree_view = GOBJ2RVAL(tree_view); arg.search_dialog = GOBJ2RVAL(search_dialog); G_PROTECT_CALLBACK(invoke_callback, &arg); } static void remove_callback_reference(gpointer data) { G_CHILD_REMOVE(rb_mGtk, (VALUE)data); } static VALUE rg_set_search_position_func(VALUE self) { VALUE func = rb_block_proc(); G_CHILD_ADD(rb_mGtk, func); gtk_tree_view_set_search_position_func(_SELF(self), (GtkTreeViewSearchPositionFunc)search_position_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; } void Init_gtk_treeview(VALUE mGtk) { rb_mGtk = mGtk; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_VIEW, "TreeView", mGtk); id_selection = rb_intern("selection"); id_model = rb_intern("model"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(selection, 0); RG_DEF_METHOD(columns_autosize, 0); RG_DEF_METHOD(append_column, 1); RG_DEF_METHOD(remove_column, 1); RG_DEF_METHOD(insert_column, -1); RG_DEF_METHOD(get_column, 1); RG_DEF_METHOD(columns, 0); RG_DEF_METHOD(move_column_after, 2); RG_DEF_METHOD(set_column_drag_function, 0); RG_DEF_METHOD(scroll_to_point, 2); RG_DEF_METHOD(scroll_to_cell, 5); RG_DEF_METHOD(set_cursor, 3); RG_DEF_METHOD(cursor, 0); RG_DEF_METHOD(expand_all, 0); RG_DEF_METHOD(collapse_all, 0); RG_DEF_METHOD(expand_row, 2); RG_DEF_METHOD(collapse_row, 1); RG_DEF_METHOD(expand_to_path, 1); RG_DEF_METHOD(map_expanded_rows, 0); RG_DEF_METHOD_P(row_expanded, 1); RG_DEF_METHOD(get_path_at_pos, 2); RG_DEF_ALIAS("get_path", "get_path_at_pos"); RG_DEF_METHOD(get_cell_area, 2); RG_DEF_METHOD(get_background_area, 2); RG_DEF_METHOD(visible_rect, 0); RG_DEF_METHOD(visible_range, 0); RG_DEF_METHOD(bin_window, 0); RG_DEF_METHOD(convert_bin_window_to_tree_coords, 2); RG_DEF_METHOD(convert_bin_window_to_widget_coords, 2); RG_DEF_METHOD(convert_tree_to_bin_window_coords, 2); RG_DEF_METHOD(convert_tree_to_widget_coords, 2); RG_DEF_METHOD(convert_widget_to_bin_window_coords, 2); RG_DEF_METHOD(convert_widget_to_tree_coords, 2); RG_DEF_METHOD(enable_model_drag_dest, 2); RG_DEF_METHOD(enable_model_drag_source, 3); RG_DEF_METHOD(unset_rows_drag_source, 0); RG_DEF_METHOD(unset_rows_drag_dest, 0); RG_DEF_METHOD(set_drag_dest_row, 2); RG_DEF_METHOD(drag_dest_row, 0); RG_DEF_METHOD(get_dest_row_at_pos, 2); RG_DEF_ALIAS("get_dest_row", "get_dest_row_at_pos"); RG_DEF_METHOD(create_row_drag_icon, 1); RG_DEF_METHOD(set_search_equal_func, 0); RG_DEF_METHOD(set_cursor_on_cell, 4); RG_DEF_METHOD(set_row_separator_func, 0); RG_DEF_METHOD(search_entry, 0); RG_DEF_METHOD(set_search_entry, 1); RG_DEF_METHOD(set_search_position_func, 0); G_DEF_CLASS(GTK_TYPE_TREE_VIEW_DROP_POSITION, "DropPosition", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_TREE_VIEW_GRID_LINES, "GridLines", RG_TARGET_NAMESPACE); /* Option Signals */ G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row-collapsed", (GValToRValSignalFunc)treeview_signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row-expanded", (GValToRValSignalFunc)treeview_signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "test-collapse-row", (GValToRValSignalFunc)treeview_signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "test-expand-row", (GValToRValSignalFunc)treeview_signal_func); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-iter.c0000644000175000017500000001636512516434313020322 0ustar koukou/* -*- 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 * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeIter #define _SELF(i) (RVAL2GTKTREEITER(i)) static VALUE treeiter_set_value_table = Qnil; void rbgtk_register_treeiter_set_value_func(GType gtype, rbgtkiter_set_value_func func) { if (NIL_P(treeiter_set_value_table)) { treeiter_set_value_table = rb_hash_new(); rb_global_variable(&treeiter_set_value_table); } rb_hash_aset(treeiter_set_value_table, INT2NUM(gtype), Data_Wrap_Struct(rb_cData, NULL, NULL, func)); } static VALUE rg_first_bang(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; VALUE ret = CBOOL2RVAL(gtk_tree_model_get_iter_first(model, iter)); iter->user_data3 = model; return ret; } static VALUE rg_next_bang(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_next(model, iter); if (! ret){ gtk_tree_model_get_iter_first(model, iter); } iter->user_data3 = model; return CBOOL2RVAL(ret); } static VALUE rg_get_value(VALUE self, VALUE column) { GValue value = G_VALUE_INIT; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; VALUE ret = Qnil; gtk_tree_model_get_value(model, iter, NUM2INT(column), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static VALUE rg_first_child(VALUE self) { GtkTreeIter child; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_children(model, &child, iter); child.user_data3 = model; return ret ? GTKTREEITER2RVAL(&child) : Qnil; } static VALUE rg_path(VALUE self) { VALUE retval = Qnil; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; GtkTreePath* path = gtk_tree_model_get_path(model, iter); retval= GTKTREEPATH2RVAL(path); gtk_tree_path_free(path); return retval; } static VALUE rg_has_child_p(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; return CBOOL2RVAL(gtk_tree_model_iter_has_child(model, iter)); } static VALUE rg_n_children(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; return INT2NUM(gtk_tree_model_iter_n_children(model, iter)); } static VALUE rg_nth_child(VALUE self, VALUE n) { GtkTreeIter child; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_nth_child(model, &child, iter, NUM2INT(n)); child.user_data3 = model; return ret ? GTKTREEITER2RVAL(&child) : Qnil; } static VALUE rg_parent(VALUE self) { GtkTreeIter parent; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_parent(model, &parent, iter); parent.user_data3 = model; return ret ? GTKTREEITER2RVAL(&parent) : Qnil; } static VALUE rg_set_value(VALUE self, VALUE column, VALUE value) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; VALUE obj = rb_hash_aref(treeiter_set_value_table, INT2NUM(G_TYPE_FROM_INSTANCE(model))); rbgtkiter_set_value_func func; GType gtype = gtk_tree_model_get_column_type(model, NUM2INT(column)); GValue gval = G_VALUE_INIT; if (NIL_P(obj)) rb_raise(rb_eTypeError, "Gtk::TreeModel is invalid."); Data_Get_Struct(obj, void, func); g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(value, &gval); func(model, iter, NUM2INT(column), &gval); g_value_unset(&gval); return self; } static VALUE rg_operator_treeiter_set_value_eql(VALUE self, VALUE column, VALUE value) { rg_set_value(self, column, value); return value; } static VALUE rg_operator_treeiter_eql(VALUE self, VALUE other) { gint i, num1, num2; GtkTreeIter* iter1 = _SELF(self); GtkTreeIter* iter2; GtkTreeModel* model1; GtkTreeModel* model2; GtkTreePath* path1; GtkTreePath* path2; if (!rb_obj_is_kind_of(other, GTYPE2CLASS(GTK_TYPE_TREE_ITER))) return Qfalse; iter2 = _SELF(other); model1 = (GtkTreeModel*)iter1->user_data3; model2 = (GtkTreeModel*)iter2->user_data3; if (model1 != model2) return Qfalse; num1 = gtk_tree_model_get_n_columns(model1); num2 = gtk_tree_model_get_n_columns(model2); if (num1 != num2) return Qfalse; path1 = gtk_tree_model_get_path(model1, iter1); path2 = gtk_tree_model_get_path(model2, iter2); if (gtk_tree_path_compare(path1, path2) != 0) { gtk_tree_path_free(path1); gtk_tree_path_free(path2); return Qfalse; } else { gtk_tree_path_free(path1); gtk_tree_path_free(path2); } for (i = 0; i < num1; i++){ GValue gval1 = G_VALUE_INIT; GValue gval2 = G_VALUE_INIT; VALUE ret1, ret2; gtk_tree_model_get_value(model1, iter1, i, &gval1); gtk_tree_model_get_value(model2, iter2, i, &gval2); ret1 = GVAL2RVAL(&gval1); ret2 = GVAL2RVAL(&gval2); g_value_unset(&gval1); g_value_unset(&gval2); if (rb_equal(ret1, ret2) == Qfalse) return Qfalse; } return Qtrue; } static VALUE rg_to_str(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gchar* s = gtk_tree_model_get_string_from_iter (model, iter); VALUE result = CSTR2RVAL(s); g_free(s); return result; } void Init_gtk_treeiter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_ITER, "TreeIter", mGtk); RG_DEF_METHOD_BANG(first, 0); RG_DEF_METHOD_BANG(next, 0); RG_DEF_METHOD(get_value, 1); RG_DEF_ALIAS("[]", "get_value"); RG_DEF_METHOD(first_child, 0); RG_DEF_METHOD(path, 0); RG_DEF_METHOD_P(has_child, 0); RG_DEF_METHOD(n_children, 0); RG_DEF_METHOD(nth_child, 1); RG_DEF_METHOD(parent, 0); RG_DEF_METHOD(set_value, 2); RG_DEF_METHOD_OPERATOR("[]=", treeiter_set_value_eql, 2); RG_DEF_METHOD_OPERATOR("==", treeiter_eql, 1); RG_DEF_METHOD(to_str, 0); RG_DEF_ALIAS("to_s", "to_str"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-info.c0000644000175000017500000000564412516434313020301 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIconInfo #define _SELF(i) (RVAL2GTKICONINFO(i)) static VALUE rg_base_size(VALUE self) { return INT2NUM(gtk_icon_info_get_base_size(_SELF(self))); } static VALUE rg_filename(VALUE self) { return CSTR2RVAL(gtk_icon_info_get_filename(_SELF(self))); } static VALUE rg_builtin_pixbuf(VALUE self) { return GOBJ2RVAL(gtk_icon_info_get_builtin_pixbuf(_SELF(self))); } static VALUE rg_load_icon(VALUE self) { GError* error = NULL; GdkPixbuf* pixbuf = gtk_icon_info_load_icon(_SELF(self), &error); VALUE ret; if (error) RAISE_GERROR(error); ret = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return ret; } static VALUE rg_set_raw_coordinates(VALUE self, VALUE raw_coordinates) { gtk_icon_info_set_raw_coordinates(_SELF(self), RVAL2CBOOL(raw_coordinates)); return self; } static VALUE rg_embedded_rect(VALUE self) { GdkRectangle rectangle; gboolean ret = gtk_icon_info_get_embedded_rect(_SELF(self), &rectangle); if (ret) return GDKRECTANGLE2RVAL(&rectangle); else return Qnil; } static VALUE rg_attach_points(VALUE self) { GdkPoint* points; gint n_points, i; gboolean ret = gtk_icon_info_get_attach_points(_SELF(self), &points, &n_points); VALUE ary = Qnil; if (ret){ ary = rb_ary_new(); for (i = 0; i < n_points; i++){ rb_ary_push(ary, rb_assoc_new(INT2NUM(points[i].x), INT2NUM(points[i].y))); } g_free(points); } return ary; } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(gtk_icon_info_get_display_name(_SELF(self))); } void Init_gtk_icon_info(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_INFO, "IconInfo", mGtk); RG_DEF_METHOD(base_size, 0); RG_DEF_METHOD(filename, 0); RG_DEF_METHOD(builtin_pixbuf, 0); RG_DEF_METHOD(load_icon, 0); RG_DEF_METHOD(set_raw_coordinates, 1); RG_DEF_METHOD(embedded_rect, 0); RG_DEF_METHOD(attach_points, 0); RG_DEF_METHOD(display_name, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-action-group.c0000644000175000017500000003264312516434313021026 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" static ID id_action_procs; static ID id_toggle_action_procs; #define RG_TARGET_NAMESPACE cActionGroup #define _SELF(self) (RVAL2GTKACTIONGROUP(self)) 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) { /* TODO: need free? */ return GOBJGLIST2RVAL_FREE(gtk_action_group_list_actions(_SELF(self)), g_list_free, NULL); } 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), RVAL2GTKACTION(action), RVAL2CSTR_ACCEPT_NIL(accelerator)); G_CHILD_ADD(self, action); return self; } static VALUE rg_remove_action(VALUE self, VALUE action) { gtk_action_group_remove_action(_SELF(self), RVAL2GTKACTION(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); } } 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), RVAL2CSTR_ACCEPT_NIL(domain)); return self; } static VALUE rg_translate_string(VALUE self, VALUE str) { return CSTR2RVAL(gtk_action_group_translate_string(_SELF(self), RVAL2CSTR(str))); } 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); } void Init_gtk_actiongroup(VALUE mGtk) { 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); RG_DEF_METHOD(translate_string, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-dragdest.c0000644000175000017500000000203112516434313021135 0ustar koukou/* -*- 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 "rbgtk3private.h" void Init_gtk_treedragdest(VALUE mGtk) { G_DEF_INTERFACE(GTK_TYPE_TREE_DRAG_DEST, "TreeDragDest", mGtk); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-app-chooser-dialog.c0000644000175000017500000000445412516434313022073 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAppChooserDialog #define _SELF(self) (RVAL2GTKAPPCHOOSERDIALOG(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_parent, rb_file, rb_flags, rb_content_type; GtkWindow *parent; GtkDialogFlags flags; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "parent", &rb_parent, "flags", &rb_flags, "file", &rb_file, "content_type", &rb_content_type, NULL); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); flags = NIL_P(rb_flags) ? 0 : RVAL2GTKDIALOGFLAGS(rb_flags); if (!NIL_P(rb_file)) widget = gtk_app_chooser_dialog_new(parent, flags, RVAL2GFILE(rb_file)); else widget = gtk_app_chooser_dialog_new_for_content_type(parent, flags, RVAL2CSTR(rb_content_type)); RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_widget(VALUE self) { return GOBJ2RVAL(gtk_app_chooser_dialog_get_widget(_SELF(self))); } void Init_gtk_appchooserdialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_APP_CHOOSER_DIALOG, "AppChooserDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(widget, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-toolbar.c0000644000175000017500000000613212516434313020053 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cToolbar #define _SELF(self) (RVAL2GTKTOOLBAR(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_toolbar_new()); return Qnil; } static VALUE rg_get_drop_index(VALUE self, VALUE x, VALUE y) { return INT2NUM(gtk_toolbar_get_drop_index(_SELF(self), NUM2INT(x), NUM2INT(y))); } static VALUE rg_get_item_index(VALUE self, VALUE item) { return INT2NUM(gtk_toolbar_get_item_index(_SELF(self), RVAL2GTKTOOLITEM(item))); } static VALUE rg_n_items(VALUE self) { return INT2NUM(gtk_toolbar_get_n_items(_SELF(self))); } static VALUE rg_get_nth_item(VALUE self, VALUE n) { return GOBJ2RVAL(gtk_toolbar_get_nth_item(_SELF(self), NUM2INT(n))); } static VALUE rg_relief_style(VALUE self) { return GTKRELIEFSTYLE2RVAL(gtk_toolbar_get_relief_style(_SELF(self))); } static VALUE rg_insert(VALUE self, VALUE item, VALUE pos) { gtk_toolbar_insert(_SELF(self), RVAL2GTKTOOLITEM(item), NUM2INT(pos)); return self; } static VALUE rg_set_drop_highlight_item(int argc, VALUE *argv, VALUE self) { VALUE tool_item, index_; rb_scan_args(argc, argv, "11", &tool_item, &index_); gtk_toolbar_set_drop_highlight_item(_SELF(self), NIL_P(tool_item) ? NULL : RVAL2GTKTOOLITEM(tool_item), NIL_P(tool_item) ? 0 : NUM2INT(index_)); return self; } static VALUE rg_unset_icon_size(VALUE self) { gtk_toolbar_unset_icon_size(_SELF(self)); return self; } static VALUE rg_unset_style(VALUE self) { gtk_toolbar_unset_style(_SELF(self)); return self; } void Init_gtk_toolbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOLBAR, "Toolbar", mGtk); G_DEF_CLASS(GTK_TYPE_TOOLBAR_SPACE_STYLE, "SpaceStyle", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_TOOLBAR_STYLE, "Style", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_drop_index, 2); RG_DEF_METHOD(get_item_index, 1); RG_DEF_METHOD(get_nth_item, 1); RG_DEF_METHOD(insert, 2); RG_DEF_METHOD(n_items, 0); RG_DEF_METHOD(relief_style, 0); RG_DEF_METHOD(set_drop_highlight_item, -1); RG_DEF_METHOD(unset_icon_size, 0); RG_DEF_METHOD(unset_style, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-alignment.c0000644000175000017500000000507712516434313020376 0ustar koukou/* -*- 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 "rbgtk3private.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(RVAL2GTKALIGNMENT(self), NUM2DBL(xalign), NUM2DBL(yalign), NUM2DBL(xscale), NUM2DBL(yscale)); return self; } static VALUE rg_padding(VALUE self) { guint top, bottom, left, right; gtk_alignment_get_padding(RVAL2GTKALIGNMENT(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(RVAL2GTKALIGNMENT(self), NUM2UINT(top), NUM2UINT(bottom), NUM2UINT(left), NUM2UINT(right)); return self; } 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); RG_DEF_METHOD(padding, 0); RG_DEF_METHOD(set_padding, 4); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-separator-tool-item.c0000644000175000017500000000241212516434313022315 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSeparatorToolItem static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_separator_tool_item_new()); return Qnil; } void Init_gtk_separatortoolitem(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEPARATOR_TOOL_ITEM, "SeparatorToolItem", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-factory.c0000644000175000017500000000447612516434313021017 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIconFactory #define _SELF(s) (RVAL2GTKICONFACTORY(s)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_icon_factory_new()); return Qnil; } static VALUE rg_add(VALUE self, VALUE stock_id, VALUE icon_set) { VALUE buffer; gtk_icon_factory_add(_SELF(self), RVAL2GLIBID(stock_id, buffer), RVAL2GTKICONSET(icon_set)); return self; } static VALUE rg_add_default(VALUE self) { gtk_icon_factory_add_default(_SELF(self)); return self; } static VALUE rg_lookup(VALUE self, VALUE stock_id) { VALUE buffer; return GTKICONSET2RVAL(gtk_icon_factory_lookup(_SELF(self), RVAL2GLIBID(stock_id, buffer))); } static VALUE rg_s_lookup_default(G_GNUC_UNUSED VALUE self, VALUE stock_id) { VALUE buffer; return GTKICONSET2RVAL(gtk_icon_factory_lookup_default(RVAL2GLIBID(stock_id, buffer))); } static VALUE rg_remove_default(VALUE self) { gtk_icon_factory_remove_default(_SELF(self)); return self; } void Init_gtk_icon_factory(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_FACTORY, "IconFactory", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, 2); RG_DEF_METHOD(add_default, 0); RG_DEF_METHOD(remove_default, 0); RG_DEF_METHOD(lookup, 1); RG_DEF_SMETHOD(lookup_default, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-file-chooser-button.c0000644000175000017500000000321212516434313022275 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFileChooserButton static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE title, action; GtkWidget* widget; rb_scan_args(argc, argv, "11", &title, &action); if (TYPE(title) == T_STRING) { widget = gtk_file_chooser_button_new(RVAL2CSTR(title), RVAL2GTKFILECHOOSERACTION(action)); } else { widget = gtk_file_chooser_button_new_with_dialog(RVAL2GTKWIDGET(title)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_filechooserbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_BUTTON, "FileChooserButton", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-volume-button.c0000644000175000017500000000261012516434313021226 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cVolumeButton static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_volume_button_new()); return Qnil; } void Init_gtk_volumebutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VOLUME_BUTTON, "VolumeButton", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-message-dialog.c0000644000175000017500000000503712516434313021275 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMessageDialog #define _SELF(s) (RVAL2GTKMESSAGEDIALOG(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_parent, rb_flags, rb_type, rb_buttons_type, rb_message; GtkWindow *parent; GtkDialogFlags flags; GtkMessageType type; GtkButtonsType buttons_type; const gchar *message; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "parent", &rb_parent, "flags", &rb_flags, "type", &rb_type, "buttons_type", &rb_buttons_type, "message", &rb_message, NULL); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); flags = NIL_P(rb_flags) ? 0 : RVAL2GTKDIALOGFLAGS(rb_flags); type = NIL_P(rb_type) ? GTK_MESSAGE_INFO : RVAL2GTKMESSAGETYPE(rb_type); buttons_type = NIL_P(rb_buttons_type) ? GTK_BUTTONS_OK : RVAL2GTKBUTTONSTYPE(rb_buttons_type); message = NIL_P(rb_message) ? "" : RVAL2CSTR(rb_message); dialog = gtk_message_dialog_new(parent, flags, type, buttons_type, "%s", message); RBGTK_INITIALIZE(self, dialog); return Qnil; } static VALUE rg_set_markup(VALUE self, VALUE str) { gtk_message_dialog_set_markup(_SELF(self), RVAL2CSTR(str)); return self; } void Init_gtk_message_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MESSAGE_DIALOG, "MessageDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_markup, 1); G_DEF_CLASS(GTK_TYPE_BUTTONS_TYPE, "ButtonsType", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-color-selection-dialog.c0000644000175000017500000000350212516434313022745 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cColorSelectionDialog #define _SELF(s) (RVAL2GTKCOLORSELECTIONDIALOG(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title; const gchar *title; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, NULL); title = RVAL2CSTR_ACCEPT_NIL(rb_title); dialog = gtk_color_selection_dialog_new(title); RBGTK_INITIALIZE(self, dialog); 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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-header-bar.c0000644000175000017500000000320712516434313020403 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 10, 0) #define RG_TARGET_NAMESPACE cHeaderBar #define _SELF(self) (RVAL2GTKHEADERBAR(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_header_bar_new()); return Qnil; } static VALUE rg_pack_start(VALUE self, VALUE child_widget) { gtk_header_bar_pack_start(_SELF(self), RVAL2GTKWIDGET(child_widget)); return Qnil; } static VALUE rg_pack_end(VALUE self, VALUE child_widget) { gtk_header_bar_pack_end(_SELF(self), RVAL2GTKWIDGET(child_widget)); return Qnil; } void Init_gtk_header_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HEADER_BAR, "HeaderBar", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(pack_start, 1); RG_DEF_METHOD(pack_end, 1); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-range.c0000644000175000017500000000376312516434313017514 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRange #define _SELF(self) (RVAL2GTKRANGE(self)) static VALUE rg_value(VALUE self) { return rb_float_new(gtk_range_get_value(_SELF(self))); } static VALUE rg_set_increments(VALUE self, VALUE step, VALUE page) { gtk_range_set_increments(_SELF(self), NUM2DBL(step), NUM2DBL(page)); return self; } static VALUE rg_set_range(VALUE self, VALUE min, VALUE max) { gtk_range_set_range(_SELF(self), NUM2DBL(min), NUM2DBL(max)); return self; } static VALUE rg_set_value(VALUE self, VALUE value) { gtk_range_set_value(_SELF(self), NUM2DBL(value)); return self; } void Init_gtk_range(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RANGE, "Range", mGtk); RG_DEF_METHOD(value, 0); RG_DEF_METHOD(set_increments, 2); RG_DEF_METHOD(set_range, 2); RG_DEF_METHOD(set_value, 1); G_DEF_CLASS(GTK_TYPE_SENSITIVITY_TYPE, "SensitivityType", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tool-itemgroup.c0000644000175000017500000000376312516434313021406 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cToolItemGroup #define _SELF(self) (RVAL2GTKTOOLITEMGROUP(self)) static VALUE rg_initialize(VALUE self, VALUE label) { RBGTK_INITIALIZE(self, gtk_tool_item_group_new(RVAL2CSTR(label))); return Qnil; } static VALUE rg_get_drop_item(VALUE self, VALUE x, VALUE y) { return GOBJ2RVAL(gtk_tool_item_group_get_drop_item(_SELF(self), NUM2INT(x), NUM2INT(y))); } static VALUE rg_n_items(VALUE self) { return UINT2NUM(gtk_tool_item_group_get_n_items(_SELF(self))); } static VALUE rg_get_nth_item(VALUE self, VALUE index) { return GOBJ2RVAL(gtk_tool_item_group_get_nth_item(_SELF(self), NUM2UINT(index))); } static VALUE rg_insert(VALUE self, VALUE item, VALUE position) { gtk_tool_item_group_insert(_SELF(self), RVAL2GTKTOOLITEM(item), NUM2INT(position)); return self; } void Init_gtk_toolitemgroup(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOL_ITEM_GROUP, "ToolItemGroup", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(get_drop_item, 2); RG_DEF_METHOD(get_nth_item, 1); RG_DEF_METHOD(insert, 2); RG_DEF_METHOD(n_items, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-accessible.c0000644000175000017500000000250412516434313020505 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAccessible #define _SELF(self) (RVAL2GTKACCESSIBLE(self)) static VALUE rg_connect_widget_destroyed(VALUE self) { gtk_accessible_connect_widget_destroyed(RVAL2GTKACCESSIBLE(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk3.h0000644000175000017500000000615112516434313016504 0ustar koukou/* -*- 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 __RBGTK3_H__ #define __RBGTK3_H__ #include #include #include "rbgtk3conversions.h" /* TODO: REMOVE ME */ /* * They are temporary. They will be needless after Ruby/GTK3 * is based on Ruby/GObjectIntrospection. */ /* From rbgdk3.h - start */ #include #ifdef GDK_WINDOWING_X11 # include #endif #ifdef GDK_WINDOWING_WIN32 # include #endif #define RVAL2GDKPIXBUFGLIST(value) rbgdk_rval2gdkpixbufglist(value) #define RVAL2ATOM(atom) rbgdk_rval2gdkatom(atom) #define RVAL2GDKATOMS(value, n) rbgdk_rval2gdkatoms(value, n) #define GDK_TYPE_GEOMETRY (gdk_geometry_get_type()) #define GDK_TYPE_ATOM (gdk_atom_get_type()) typedef struct { GdkAtom atom; } GdkAtomData; GType gdk_atom_get_type(void); GType gdk_geometry_get_type(void); GList *rbgdk_rval2gdkpixbufglist(VALUE value); GdkAtom rbgdk_rval2gdkatom(VALUE atom); GdkAtom *rbgdk_rval2gdkatoms(VALUE value, long *n); /* From rbgdk3.h - end */ #define RBGTK_MAJOR_VERSION RBGLIB_MAJOR_VERSION #define RBGTK_MINOR_VERSION RBGLIB_MINOR_VERSION #define RBGTK_MICRO_VERSION RBGLIB_MICRO_VERSION #define RBGTK_INITIALIZE(obj,gtkobj)\ (rbgtk_initialize_gtkobject(obj, G_OBJECT(gtkobj))) #define GTK_TYPE_ACCEL_GROUP_ENTRY (gtk_accel_group_entry_get_type()) #define GTK_TYPE_ACCEL_KEY (gtk_accel_key_get_type()) #define GTK_TYPE_ALLOCATION (gtk_allocation_get_type()) #define GTK_TYPE_BINDING_SET (gtk_bindingset_get_type()) #define GTK_TYPE_RECENT_DATA (gtk_recent_data_get_type()) #define GTK_TYPE_RECENT_FILTER_INFO (gtk_recent_filter_info_get_type()) #define GTK_TYPE_TEXT_APPEARANCE (gtk_text_appearance_get_type()) extern void rbgtk_initialize_gtkobject(VALUE obj, GObject *gtkobj); extern GType gtk_accel_group_entry_get_type(void); extern GType gtk_accel_key_get_type(void); extern GType gtk_allocation_get_type(void); extern GType gtk_bindingset_get_type(void); extern GType gtk_recent_data_get_type(void); extern GType gtk_recent_filter_info_get_type(void); extern GType gtk_text_appearance_get_type(void); #endif /* __RBGTK3_H__ */ ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-gdk-event.c0000644000175000017500000000227712516434313020303 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cEvent #define _SELF(self) (RVAL2GEV(self)) static VALUE rg_event_widget(VALUE self) { return GOBJ2RVAL(gtk_get_event_widget(_SELF(self))); } void Init_gtk_gdk_event(void) { VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_EVENT); RG_DEF_METHOD(event_widget, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-frame.c0000644000175000017500000000424412516434313017505 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cFrame static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label; rb_scan_args(argc, argv, "01", &label); RBGTK_INITIALIZE(self, gtk_frame_new(RVAL2CSTR_ACCEPT_NIL(label))); return Qnil; } static VALUE rg_set_label_align(VALUE self, VALUE xalign, VALUE yalign) { gtk_frame_set_label_align(RVAL2GTKFRAME(self), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_label_align(VALUE self) { gfloat xalign, yalign; gtk_frame_get_label_align(RVAL2GTKFRAME(self), &xalign, &yalign); return rb_ary_new3(2, rb_float_new(xalign), rb_float_new(yalign)); } void Init_gtk_frame(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FRAME, "Frame", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_label_align, 2); RG_DEF_METHOD(label_align, 0); rb_undef_method(RG_TARGET_NAMESPACE, "shadow"); rb_undef_method(RG_TARGET_NAMESPACE, "shadow="); rb_undef_method(RG_TARGET_NAMESPACE, "set_shadow"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-misc.c0000644000175000017500000000406612516434313017350 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMisc #define _SELF(s) (RVAL2GTKMISC(s)) static VALUE rg_set_alignment(VALUE self, VALUE xalign, VALUE yalign) { gtk_misc_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_set_padding(VALUE self, VALUE xpad, VALUE ypad) { gtk_misc_set_padding(_SELF(self), NUM2DBL(xpad), NUM2DBL(ypad)); return self; } static VALUE rg_alignment(VALUE self) { gfloat xalign, yalign; gtk_misc_get_alignment(_SELF(self), &xalign, &yalign); return rb_ary_new3(2, rb_float_new(xalign), rb_float_new(yalign)); } static VALUE rg_padding(VALUE self) { gint xpad, ypad; gtk_misc_get_padding(_SELF(self), &xpad, &ypad); return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad)); } void Init_gtk_misc(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MISC, "Misc", mGtk); RG_DEF_METHOD(set_alignment, 2); RG_DEF_METHOD(set_padding, 2); RG_DEF_METHOD(alignment, 0); RG_DEF_METHOD(padding, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-overlay.c0000644000175000017500000000273412516434313020076 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cOverlay #define _SELF(self) (RVAL2GTKOVERLAY(self)) #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_overlay_new()); return Qnil; } static VALUE rg_add_overlay(VALUE self, VALUE widget) { gtk_overlay_add_overlay(_SELF(self), RVAL2GTKWIDGET(widget)); return self; } #endif void Init_gtk_overlay(VALUE mGtk) { #if GTK_CHECK_VERSION(3, 2, 0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_OVERLAY, "Overlay", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add_overlay, 1); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-chooser-menu.c0000644000175000017500000000311012516434313022264 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentChooserMenu #define _SELF(self) (RVAL2GTKRECENTCHOOSERMENU(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE manager; GtkWidget* menu; rb_scan_args(argc, argv, "01", &manager); if (NIL_P(manager)){ menu = gtk_recent_chooser_menu_new_for_manager(RVAL2GTKRECENTMANAGER(manager)); } else { menu = gtk_recent_chooser_menu_new(); } RBGTK_INITIALIZE(self, menu); return Qnil; } void Init_gtk_recent_chooser_menu(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER_MENU, "RecentChooserMenu", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-const.c0000644000175000017500000000706712516434313017547 0ustar koukou/* -*- 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 "rbgtk3private.h" void Init_gtk_const(VALUE mGtk) { 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)); G_DEF_CLASS(GTK_TYPE_ACCEL_FLAGS, "AccelFlags", mGtk); G_DEF_CLASS(GTK_TYPE_ATTACH_OPTIONS, "AttachOptions", mGtk); G_DEF_CLASS(GTK_TYPE_CORNER_TYPE, "CornerType", mGtk); G_DEF_CLASS(GTK_TYPE_DELETE_TYPE, "DeleteType", mGtk); G_DEF_CLASS(GTK_TYPE_DIRECTION_TYPE, "DirectionType", mGtk); G_DEF_CLASS(GTK_TYPE_EXPANDER_STYLE, "ExpanderStyle", mGtk); G_DEF_CLASS(GTK_TYPE_JUSTIFICATION, "Justification", mGtk); G_DEF_CLASS(GTK_TYPE_MESSAGE_TYPE, "MessageType", mGtk); G_DEF_CLASS(GTK_TYPE_MOVEMENT_STEP, "MovementStep", mGtk); G_DEF_CLASS(GTK_TYPE_ORIENTATION, "Orientation", mGtk); G_DEF_CLASS(GTK_TYPE_PACK_TYPE, "PackType", mGtk); G_DEF_CLASS(GTK_TYPE_PATH_PRIORITY_TYPE, "PathPriorityType", mGtk); G_DEF_CLASS(GTK_TYPE_PATH_TYPE, "PathType", mGtk); G_DEF_CLASS(GTK_TYPE_POLICY_TYPE, "PolicyType", mGtk); G_DEF_CLASS(GTK_TYPE_POSITION_TYPE, "PositionType", mGtk); G_DEF_CLASS(GTK_TYPE_RELIEF_STYLE, "ReliefStyle", mGtk); G_DEF_CLASS(GTK_TYPE_RESIZE_MODE, "ResizeMode", mGtk); G_DEF_CLASS(GTK_TYPE_RESPONSE_TYPE, "ResponseType", mGtk); G_DEF_CLASS(GTK_TYPE_SCROLL_STEP, "ScrollStep", mGtk); G_DEF_CLASS(GTK_TYPE_SCROLL_TYPE, "ScrollType", mGtk); G_DEF_CLASS(GTK_TYPE_SELECTION_MODE, "SelectionMode", mGtk); G_DEF_CLASS(GTK_TYPE_SHADOW_TYPE, "ShadowType", mGtk); G_DEF_CLASS(GTK_TYPE_STATE_FLAGS, "StateFlags", mGtk); G_DEF_CLASS(GTK_TYPE_STATE_TYPE, "StateType", mGtk); /* deprecated G_DEF_CLASS(GTK_TYPE_SUBMENU_DIRECTION, "SubmenuDirection", mGtk); G_DEF_CLASS(GTK_TYPE_SUBMENU_PLACEMENT, "SubmenuPlacement", mGtk); */ G_DEF_CLASS(GTK_TYPE_SORT_TYPE, "SortType", mGtk); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-child-anchor.c0000644000175000017500000000330612516434313021726 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextChildAnchor #define _SELF(self) RVAL2GTKTEXTCHILDANCHOR(self) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_text_child_anchor_new()); return Qnil; } static VALUE rg_widgets(VALUE self) { return GOBJGLIST2RVAL_FREE(gtk_text_child_anchor_get_widgets(_SELF(self)), g_list_free, NULL); } static VALUE rg_deleted_p(VALUE self) { return CBOOL2RVAL(gtk_text_child_anchor_get_deleted(_SELF(self))); } void Init_gtk_textchild(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_CHILD_ANCHOR, "TextChildAnchor", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(widgets, 0); RG_DEF_METHOD_P(deleted, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-model.c0000644000175000017500000001574712516434313020462 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mTreeModel #define _SELF(s) (RVAL2GTKTREEMODEL(s)) static VALUE rg_flags(VALUE self) { return GTKTREEMODELFLAGS2RVAL(gtk_tree_model_get_flags(_SELF(self))); } static VALUE rg_n_columns(VALUE self) { return INT2NUM(gtk_tree_model_get_n_columns(_SELF(self))); } static VALUE rg_get_column_type(VALUE self, VALUE index) { return GTYPE2CLASS(gtk_tree_model_get_column_type(_SELF(self), NUM2INT(index))); } static VALUE rg_iter_first(VALUE self) { VALUE val = Qnil; GtkTreeIter iter; GtkTreeModel* model = _SELF(self); gboolean ret = (gtk_tree_model_get_iter_first(model, &iter)); iter.user_data3 = model; if (ret) { val = GTKTREEITER2RVAL(&iter); } return val; } static VALUE rg_get_iter(VALUE self, VALUE path) { VALUE val = Qnil; GtkTreeIter iter; gboolean ret; GtkTreeModel* model = _SELF(self); if (TYPE(path) == T_STRING){ ret = gtk_tree_model_get_iter_from_string(model, &iter, RVAL2CSTR(path)); } else { ret = gtk_tree_model_get_iter(model, &iter, RVAL2GTKTREEPATH(path)); } iter.user_data3 = model; if (ret) { val = GTKTREEITER2RVAL(&iter); } return val; } static VALUE rg_get_path(VALUE self, VALUE iter) { GtkTreePath *path; VALUE rb_path; path = gtk_tree_model_get_path(_SELF(self), RVAL2GTKTREEITER(iter)); rb_path = GTKTREEPATH2RVAL(path); gtk_tree_path_free(path); return rb_path; } static VALUE rg_get_value(VALUE self, VALUE iter, VALUE column) { GValue value = G_VALUE_INIT; VALUE ret = Qnil; gtk_tree_model_get_value(_SELF(self), RVAL2GTKTREEITER(iter), NUM2INT(column), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static gboolean treemodel_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, G_GNUC_UNUSED gpointer func) { iter->user_data3 = model; rb_yield(rb_ary_new3(3, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter))); return FALSE; } static VALUE rg_each(VALUE self) { gtk_tree_model_foreach(_SELF(self), (GtkTreeModelForeachFunc)treemodel_foreach_func, (gpointer)NULL); return self; } static VALUE rg_row_changed(VALUE self, VALUE path, VALUE iter) { gtk_tree_model_row_changed(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_row_inserted(VALUE self, VALUE path, VALUE iter) { gtk_tree_model_row_inserted(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_row_has_child_toggled(VALUE self, VALUE path, VALUE iter) { gtk_tree_model_row_has_child_toggled(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_row_deleted(VALUE self, VALUE path) { gtk_tree_model_row_deleted(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_rows_reordered(VALUE self, VALUE rbpath, VALUE rbiter, VALUE rbnew_order) { GtkTreeModel *proxy = _SELF(self); GtkTreePath *path = RVAL2GTKTREEPATH(rbpath); GtkTreeIter *iter = RVAL2GTKTREEITER(rbiter); gint columns = gtk_tree_model_get_n_columns(proxy); long n; gint *new_order = RVAL2GINTS(rbnew_order, n); if (n != columns) { g_free(new_order); rb_raise(rb_eArgError, "new order array must contain same number of elements as the number of columns in the store: %ld != %d", n, columns); } gtk_tree_model_rows_reordered(proxy, path, iter, new_order); g_free(new_order); return self; } static VALUE rg_iter_is_valid_p(G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE iter) { return Qtrue; } static VALUE signal_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkTreeModel* model = g_value_get_object(&values[0]); GtkTreePath* path = g_value_get_boxed(&values[1]); GtkTreeIter* iter = g_value_get_boxed(&values[2]); iter->user_data3 = model; return rb_ary_new3(3, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter)); } static VALUE signal_rows_reordered_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkTreeModel* model = g_value_get_object(&values[0]); GtkTreePath* path = g_value_get_boxed(&values[1]); GtkTreeIter* iter = g_value_get_boxed(&values[2]); gint* new_orders = (gint*)g_value_get_pointer(&values[3]); gint len = gtk_tree_model_iter_n_children(model, iter); VALUE orders = Qnil; int i; iter->user_data3 = model; orders = rb_ary_new2(len); for (i = 0; i < len; i++, new_orders++) { rb_ary_push(orders, INT2NUM(*new_orders)); } return rb_ary_new3(4, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter), orders); } void Init_gtk_treemodel(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TREE_MODEL, "TreeModel", mGtk); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(n_columns, 0); RG_DEF_METHOD(get_column_type, 1); RG_DEF_METHOD(iter_first, 0); RG_DEF_METHOD(get_iter, 1); RG_DEF_METHOD(get_path, 1); RG_DEF_METHOD(get_value, 2); RG_DEF_METHOD(each, 0); RG_DEF_METHOD(row_changed, 2); RG_DEF_METHOD(row_inserted, 2); RG_DEF_METHOD(row_has_child_toggled, 2); RG_DEF_METHOD(row_deleted, 1); RG_DEF_METHOD(rows_reordered, 3); RG_DEF_METHOD_P(iter_is_valid, 1); G_DEF_CLASS(GTK_TYPE_TREE_MODEL_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row_changed", (GValToRValSignalFunc)signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row_inserted", (GValToRValSignalFunc)signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row_has_child_toggled", (GValToRValSignalFunc)signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "rows_reordered", (GValToRValSignalFunc)signal_rows_reordered_func); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-numerable-icon.c0000644000175000017500000000316712516434313021316 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cNumerableIcon #define _SELF(self) (RVAL2GTKNUMERABLEICON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE base_icon, context; GIcon *icon; rb_scan_args(argc, argv, "11", &base_icon, &context); if (NIL_P(context)) icon = gtk_numerable_icon_new(RVAL2GICON(base_icon)); else icon = gtk_numerable_icon_new_with_style_context(RVAL2GICON(base_icon), RVAL2GTKSTYLECONTEXT(context)); G_INITIALIZE(self, icon); return Qnil; } void Init_gtk_numerableicon(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_NUMERABLE_ICON, "NumerableIcon", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-separator-menu-item.c0000644000175000017500000000242112516434313022304 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSeparatorMenuItem static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_separator_menu_item_new()); return Qnil; } void Init_gtk_separator_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEPARATOR_MENU_ITEM, "SeparatorMenuItem", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-recent-manager.c0000644000175000017500000000763412516434313021311 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cRecentManager #define _SELF(self) (RVAL2GTKRECENTMANAGER(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_recent_manager_new()); return Qnil; } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_recent_manager_get_default()); } static VALUE rg_add_item(int argc, VALUE *argv, VALUE self) { VALUE uri, data; gboolean ret; rb_scan_args(argc, argv, "11", &uri, &data); if (NIL_P(data)){ ret = gtk_recent_manager_add_item(_SELF(self), RVAL2CSTR(uri)); if (! ret) rb_raise(rb_eRuntimeError, "Can't add the uri"); } else { ret = gtk_recent_manager_add_full(_SELF(self), RVAL2CSTR(uri), RVAL2GTKRECENTDATA(data)); if (! ret) rb_raise(rb_eRuntimeError, "Can't add the uri or data"); } return self; } static VALUE rg_remove_item(VALUE self, VALUE uri) { GError* error = NULL; gboolean ret = gtk_recent_manager_remove_item(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_lookup_item(VALUE self, VALUE uri) { GError* error = NULL; GtkRecentInfo* info = gtk_recent_manager_lookup_item(_SELF(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return GTKRECENTINFO2RVAL(info); } static VALUE rg_has_item_p(VALUE self, VALUE uri) { return CBOOL2RVAL(gtk_recent_manager_has_item(_SELF(self), RVAL2CSTR(uri))); } static VALUE rg_move_item(VALUE self, VALUE uri, VALUE new_uri) { GError* error = NULL; gboolean ret = gtk_recent_manager_move_item(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(new_uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_items(VALUE self) { return BOXEDGLIST2RVAL_FREE(gtk_recent_manager_get_items(_SELF(self)), GTK_TYPE_RECENT_INFO, g_list_free, gtk_recent_info_unref); } static VALUE rg_purge_items(VALUE self) { GError* error = NULL; gint ret = gtk_recent_manager_purge_items(_SELF(self), &error); if (error) RAISE_GERROR(error); return INT2NUM(ret); } void Init_gtk_recent_manager(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_MANAGER, "RecentManager", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_SMETHOD(default, 0); RG_DEF_METHOD(add_item, -1); RG_DEF_METHOD(remove_item, 1); RG_DEF_METHOD(lookup_item, 1); RG_DEF_METHOD_P(has_item, 1); RG_DEF_METHOD(move_item, 2); RG_DEF_METHOD(items, 0); RG_DEF_METHOD(purge_items, 0); G_DEF_ERROR(GTK_RECENT_MANAGER_ERROR, "RecentManagerError", mGtk, rb_eRuntimeError, GTK_TYPE_RECENT_MANAGER_ERROR); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-menu-tool-button.c0000644000175000017500000000517712516434313021651 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMenuToolButton #define _SELF(self) (RVAL2GTKMENUTOOLBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg; GtkToolItem *item = NULL; rb_scan_args(argc, argv, "01", &arg); if (NIL_P(arg)) { item = gtk_menu_tool_button_new(NULL, NULL); } else if (TYPE(arg) == T_HASH) { VALUE icon_widget, label, stock_id, buffer; rbg_scan_options(arg, "icon_widget", &icon_widget, "label", &label, "stock_id", &stock_id, NULL); if (!NIL_P(icon_widget)) item = gtk_menu_tool_button_new(RVAL2GTKWIDGET(icon_widget), RVAL2CSTR_ACCEPT_NIL(label)); else if (!NIL_P(stock_id)) item = gtk_menu_tool_button_new_from_stock(RVAL2GLIBID(stock_id, buffer)); } if (!item) rb_raise(rb_eArgError, "Invalid arguments."); RBGTK_INITIALIZE(self, item); return Qnil; } /* deprecated static VALUE rg_set_arrow_tooltip(int argc, VALUE *argv, VALUE self) { VALUE tooltips, tip_text, tip_private; rb_scan_args(argc, argv, "12", &tooltips, &tip_text, &tip_private); gtk_menu_tool_button_set_arrow_tooltip(_SELF(self), RVAL2GTKTOOLTIPS(self), RVAL2CSTR_ACCEPT_NIL(tip_text), RVAL2CSTR_ACCEPT_NIL(tip_private)); return self; } */ void Init_gtk_menutoolbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_TOOL_BUTTON, "MenuToolButton", mGtk); RG_DEF_METHOD(initialize, -1); /* deprecated RG_DEF_METHOD(set_arrow_tooltip, -1); */ } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-accel-map.c0000644000175000017500000000713412516434313020236 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAccelMap #define RVAL2MOD(mods) (NIL_P(mods) ? 0 : RVAL2GDKMODIFIERTYPE(mods)) 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 GTKACCELKEY2RVAL(&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), GDKMODIFIERTYPE2RVAL(mods), 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; } 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; } void Init_gtk_accel_map(VALUE mGtk) { 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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-file-chooser.c0000644000175000017500000002306512516434313020774 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2005-2013 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mFileChooser #define _SELF(self) RVAL2GTKFILECHOOSER(self) #ifdef HAVE_GTK_GTKFILESYSTEM_H /* For error handling */ # define GTK_FILE_SYSTEM_ENABLE_UNSUPPORTED # include #endif static VALUE gslist2ary_free(GSList* list) { GSList* l; VALUE ary = rb_ary_new(); for (l = list; l != NULL; l = g_slist_next(l)) { rb_ary_push(ary, CSTR2RVAL_FREE(l->data)); } g_slist_free(list); return ary; } static VALUE rg_set_current_name(VALUE self, VALUE name) { /* doc says the awaited string is UTF-8, so use RVAL2CSTR */ gtk_file_chooser_set_current_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_filename(VALUE self) { return CSTRFILENAME2RVAL_FREE(gtk_file_chooser_get_filename(_SELF(self))); } static VALUE rg_set_filename(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); gboolean ret = gtk_file_chooser_set_filename(_SELF(self), filename); g_free(filename); if (!ret) rb_raise(rb_eRuntimeError, "Can't set filename"); return self; } static VALUE rg_select_filename(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); gboolean ret = gtk_file_chooser_select_filename(_SELF(self), filename); g_free(filename); return CBOOL2RVAL(ret); } static VALUE rg_unselect_filename(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); gtk_file_chooser_unselect_filename(_SELF(self), filename); g_free(filename); return self; } static VALUE rg_select_all(VALUE self) { gtk_file_chooser_select_all(_SELF(self)); return self; } static VALUE rg_unselect_all(VALUE self) { gtk_file_chooser_unselect_all(_SELF(self)); return self; } static VALUE rg_filenames(VALUE self) { return FILENAMEGSLIST2RVAL_FREE(gtk_file_chooser_get_filenames(_SELF(self)), g_slist_free, g_free); } static VALUE rg_set_current_folder(VALUE self, VALUE filename) { gboolean ret = gtk_file_chooser_set_current_folder(_SELF(self), RVAL2CSTR(filename)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set current folder"); return self; } static VALUE rg_current_folder(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_current_folder(_SELF(self))); } static VALUE rg_uri(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_uri(_SELF(self))); } static VALUE rg_set_uri(VALUE self, VALUE uri) { gboolean ret = gtk_file_chooser_set_uri(_SELF(self), RVAL2CSTR(uri)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set uri"); return self; } static VALUE rg_select_uri(VALUE self, VALUE uri) { return CBOOL2RVAL(gtk_file_chooser_select_uri(_SELF(self), RVAL2CSTR(uri))); } static VALUE rg_unselect_uri(VALUE self, VALUE uri) { gtk_file_chooser_unselect_uri(_SELF(self), RVAL2CSTR(uri)); return self; } static VALUE rg_uris(VALUE self) { return gslist2ary_free(gtk_file_chooser_get_uris(_SELF(self))); } static VALUE rg_set_current_folder_uri(VALUE self, VALUE uri) { gboolean ret = gtk_file_chooser_set_current_folder_uri(_SELF(self), RVAL2CSTR(uri)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set current folder uri"); return self; } static VALUE rg_current_folder_uri(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_current_folder_uri(_SELF(self))); } static VALUE rg_preview_filename(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_preview_filename(_SELF(self))); } static VALUE rg_preview_uri(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_preview_uri(_SELF(self))); } static VALUE rg_add_filter(VALUE self, VALUE filter) { gtk_file_chooser_add_filter(_SELF(self), RVAL2GTKFILEFILTER(filter)); return self; } static VALUE rg_remove_filter(VALUE self, VALUE filter) { gtk_file_chooser_remove_filter(_SELF(self), RVAL2GTKFILEFILTER(filter)); return self; } static VALUE rg_filters(VALUE self) { return GOBJGSLIST2RVAL_FREE(gtk_file_chooser_list_filters(_SELF(self)), g_slist_free, NULL); } static VALUE rg_add_shortcut_folder(VALUE self, VALUE rbfolder) { gchar *folder = RVAL2CSTRFILENAME(rbfolder); GError *error = NULL; gboolean ret = gtk_file_chooser_add_shortcut_folder(_SELF(self), folder, &error); g_free(folder); if (!ret) RAISE_GERROR(error); return self; } static VALUE rg_remove_shortcut_folder(VALUE self, VALUE rbfolder) { gchar *folder = RVAL2CSTRFILENAME(rbfolder); GError *error = NULL; gboolean ret = gtk_file_chooser_remove_shortcut_folder(_SELF(self), folder, &error); g_free(folder); if (!ret) RAISE_GERROR(error); return self; } static VALUE rg_shortcut_folders(VALUE self) { return FILENAMEGSLIST2RVAL_FREE(gtk_file_chooser_list_shortcut_folders(_SELF(self)), g_slist_free, g_free); } static VALUE rg_add_shortcut_folder_uri(VALUE self, VALUE uri) { GError *error = NULL; if (! gtk_file_chooser_add_shortcut_folder_uri(_SELF(self), RVAL2CSTR(uri), &error)) RAISE_GERROR(error); return self; } static VALUE rg_remove_shortcut_folder_uri(VALUE self, VALUE uri) { GError *error = NULL; if (! gtk_file_chooser_remove_shortcut_folder_uri(_SELF(self), RVAL2CSTR(uri), &error)) RAISE_GERROR(error); return self; } static VALUE rg_shortcut_folder_uris(VALUE self) { return gslist2ary_free(gtk_file_chooser_list_shortcut_folder_uris(_SELF(self))); } static VALUE rg_current_folder_file(VALUE self) { return GOBJ2RVAL(gtk_file_chooser_get_current_folder_file(_SELF(self))); } static VALUE rg_file(VALUE self) { return GOBJ2RVAL_UNREF(gtk_file_chooser_get_file(_SELF(self))); } static VALUE rg_files(VALUE self) { return GOBJGSLIST2RVAL_FREE(gtk_file_chooser_get_files(_SELF(self)), g_slist_free, g_object_unref); } static VALUE rg_preview_file(VALUE self) { return GOBJ2RVAL_UNREF(gtk_file_chooser_get_preview_file(_SELF(self))); } static VALUE rg_select_file(VALUE self, VALUE file) { GError *error = NULL; gtk_file_chooser_select_file(_SELF(self), RVAL2GFILE(file), &error); if (error) RAISE_GERROR(error); return self; } static VALUE rg_set_current_folder_file(VALUE self, VALUE file) { gboolean result; GError *error = NULL; result = gtk_file_chooser_set_current_folder_file(_SELF(self), RVAL2GFILE(file), &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } static VALUE rg_set_file(VALUE self, VALUE file) { GError *error = NULL; gtk_file_chooser_set_file(_SELF(self), RVAL2GFILE(file), &error); if (error) RAISE_GERROR(error); return self; } static VALUE rg_unselect_file(VALUE self, VALUE file) { gtk_file_chooser_unselect_file(_SELF(self), RVAL2GFILE(file)); return self; } void Init_gtk_file_chooser(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_FILE_CHOOSER, "FileChooser", mGtk); RG_DEF_METHOD(set_current_name, 1); RG_DEF_METHOD(set_filename, 1); RG_DEF_METHOD(filename, 0); RG_DEF_METHOD(select_filename, 1); RG_DEF_METHOD(unselect_filename, 1); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(filenames, 0); RG_DEF_METHOD(set_current_folder, 1); RG_DEF_METHOD(current_folder, 0); RG_DEF_METHOD(set_uri, 1); RG_DEF_METHOD(uri, 0); RG_DEF_METHOD(select_uri, 1); RG_DEF_METHOD(unselect_uri, 1); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(set_current_folder_uri, 1); RG_DEF_METHOD(current_folder_uri, 0); RG_DEF_METHOD(preview_filename, 0); RG_DEF_METHOD(preview_uri, 0); RG_DEF_METHOD(add_filter, 1); RG_DEF_METHOD(remove_filter, 1); RG_DEF_METHOD(filters, 0); RG_DEF_METHOD(add_shortcut_folder, 1); RG_DEF_METHOD(remove_shortcut_folder, 1); RG_DEF_METHOD(shortcut_folders, 0); RG_DEF_METHOD(add_shortcut_folder_uri, 1); RG_DEF_METHOD(remove_shortcut_folder_uri, 1); RG_DEF_METHOD(shortcut_folder_uris, 0); RG_DEF_METHOD(current_folder_file, 0); RG_DEF_METHOD(file, 0); RG_DEF_METHOD(files, 0); RG_DEF_METHOD(preview_file, 0); RG_DEF_METHOD(select_file, 1); RG_DEF_METHOD(set_current_folder_file, 1); RG_DEF_METHOD(set_file, 1); RG_DEF_METHOD(unselect_file, 1); G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_ACTION, "Action", RG_TARGET_NAMESPACE); G_DEF_ERROR(GTK_FILE_CHOOSER_ERROR, "FileChooserError", mGtk, rb_eRuntimeError, GTK_TYPE_FILE_CHOOSER_ERROR); G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_CONFIRMATION, "Confirmation", RG_TARGET_NAMESPACE); G_DEF_CLASS3("GtkFileChooserEmbed", "FileChooserEmbed", mGtk); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-appearance.c0000644000175000017500000001256112516434313021475 0ustar koukou/* -*- 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 "rbgtk3private.h" /*****************************************/ static GtkTextAppearance* app_copy(const GtkTextAppearance* app) { GtkTextAppearance* new_app; g_return_val_if_fail (app != NULL, NULL); new_app = g_new(GtkTextAppearance, 1); *new_app = *app; return new_app; } GType gtk_text_appearance_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkTextAppearance", (GBoxedCopyFunc)app_copy, (GBoxedFreeFunc)g_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cTextAppearance #define _SELF(t) (RVAL2GTKTEXTAPPEARANCE(t)) static VALUE rg_initialize(VALUE self) { GtkTextAppearance* app = ALLOC(GtkTextAppearance); memset(app, 0, sizeof(GtkTextAppearance)); G_INITIALIZE(self, app); return Qnil; } static VALUE rg_bg_color(VALUE self) { VALUE val = GDKCOLOR2RVAL(&_SELF(self)->bg_color); G_CHILD_SET(self, rb_intern("bg_color"), val); return val; } static VALUE rg_set_bg_color(VALUE self, VALUE val) { G_CHILD_SET(self, rb_intern("bg_color"), val); _SELF(self)->bg_color = *RVAL2GDKCOLOR(val); return self; } static VALUE rg_fg_color(VALUE self) { VALUE val = GDKCOLOR2RVAL(&_SELF(self)->fg_color); G_CHILD_SET(self, rb_intern("fg_color"), val); return val; } static VALUE rg_set_fg_color(VALUE self, VALUE val) { G_CHILD_SET(self, rb_intern("fg_color"), val); _SELF(self)->fg_color = *RVAL2GDKCOLOR(val); return self; } /* deprecated static VALUE rg_bg_stipple(VALUE self) { VALUE val; if (_SELF(self)->bg_stipple == NULL) return Qnil; val = GOBJ2RVAL(_SELF(self)->bg_stipple); G_CHILD_SET(self, rb_intern("bg_stipple"), val); return val; } static VALUE rg_set_bg_stipple(VALUE self, VALUE val) { _SELF(self)->bg_stipple = RVAL2GOBJ(val); G_CHILD_SET(self, rb_intern("bg_stipple"), val); return self; } static VALUE rg_fg_stipple(VALUE self) { VALUE val; if (_SELF(self)->fg_stipple == NULL) return Qnil; val = GOBJ2RVAL(_SELF(self)->fg_stipple); G_CHILD_SET(self, rb_intern("fg_stipple"), val); return val; } static VALUE rg_set_fg_stipple(VALUE self, VALUE val) { _SELF(self)->fg_stipple = RVAL2GOBJ(val); G_CHILD_SET(self, rb_intern("fg_stipple"), val); return self; } */ static VALUE rg_rise(VALUE self) { return INT2NUM(_SELF(self)->rise); } static VALUE rg_set_rise(VALUE self, VALUE val) { _SELF(self)->rise = NUM2INT(val); return self; } static VALUE rg_underline(VALUE self) { return PANGOUNDERLINE2RVAL(_SELF(self)->underline); } static VALUE rg_set_underline(VALUE self, VALUE val) { _SELF(self)->underline = RVAL2PANGOUNDERLINE(val); return self; } static VALUE rg_strikethrough_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->strikethrough); } static VALUE rg_set_strikethrough(VALUE self, VALUE val) { _SELF(self)->strikethrough = RVAL2CBOOL(val); return self; } static VALUE rg_draw_bg_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->draw_bg); } static VALUE rg_set_draw_bg(VALUE self, VALUE val) { _SELF(self)->draw_bg = RVAL2CBOOL(val); return self; } static VALUE rg_inside_selection_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->inside_selection); } static VALUE rg_set_inside_selection(VALUE self, VALUE val) { _SELF(self)->inside_selection = RVAL2CBOOL(val); return self; } static VALUE rg_text_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->is_text); } static VALUE rg_set_text(VALUE self, VALUE val) { _SELF(self)->is_text = RVAL2CBOOL(val); return self; } void Init_gtk_text_appearance(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_APPEARANCE, "TextAppearance", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(bg_color, 0); RG_DEF_METHOD(set_bg_color, 1); RG_DEF_METHOD(fg_color, 0); RG_DEF_METHOD(set_fg_color, 1); /* deprecated RG_DEF_METHOD(bg_stipple, 0); RG_DEF_METHOD(set_bg_stipple, 1); RG_DEF_METHOD(fg_stipple, 0); RG_DEF_METHOD(set_fg_stipple, 1); */ RG_DEF_METHOD(rise, 0); RG_DEF_METHOD(set_rise, 1); RG_DEF_METHOD(underline, 0); RG_DEF_METHOD(set_underline, 1); RG_DEF_METHOD_P(strikethrough, 0); RG_DEF_METHOD(set_strikethrough, 1); RG_DEF_METHOD_P(draw_bg, 0); RG_DEF_METHOD(set_draw_bg, 1); RG_DEF_METHOD_P(inside_selection, 0); RG_DEF_METHOD(set_inside_selection, 1); RG_DEF_METHOD_P(text, 0); RG_DEF_METHOD(set_text, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-application.c0000644000175000017500000000373312516434313020720 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cApplication #define _SELF(self) (RVAL2GTKAPPLICATION(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE application_id, flags; rb_scan_args(argc, argv, "11", &application_id, &flags); G_INITIALIZE(self, gtk_application_new(RVAL2CSTR(application_id), NIL_P(flags) ? 0 : RVAL2GAPPLICATIONFLAGS(flags))); return Qnil; } static VALUE rg_add_window(VALUE self, VALUE window) { gtk_application_add_window(_SELF(self), RVAL2GTKWINDOW(window)); return self; } static VALUE rg_windows(VALUE self) { return GOBJGLIST2RVAL(gtk_application_get_windows(_SELF(self))); } static VALUE rg_remove_window(VALUE self, VALUE window) { gtk_application_remove_window(_SELF(self), RVAL2GTKWINDOW(window)); return self; } void Init_gtk_application(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_APPLICATION, "Application", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(add_window, 1); RG_DEF_METHOD(windows, 0); RG_DEF_METHOD(remove_window, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-about-dialog.c0000644000175000017500000001022712516434313020760 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAboutDialog #define _SELF(self) (RVAL2GTKABOUTDIALOG(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_about_dialog_new()); return Qnil; } 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(RARRAY_PTR(ary)[i])[1])); } else if (strncmp(pd[i].name, "license_type", strlen("license_type")) == 0){ pd[i].value = GINT_TO_POINTER(RVAL2GTKLICENSE(RARRAY_PTR(RARRAY_PTR(ary)[i])[1])); } else { pd[i].value = g_strdup(RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[1])); } } gtk_show_about_dialog(RVAL2GTKWINDOW(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; } void Init_gtk_aboutdialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ABOUT_DIALOG, "AboutDialog", mGtk); G_DEF_CLASS(GTK_TYPE_LICENSE, "License", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 0); RG_DEF_SMETHOD(show, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-stack-switcher.c0000644000175000017500000000237112516434313021345 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 10, 0) #define RG_TARGET_NAMESPACE cStackSwitcher static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_stack_switcher_new()); return Qnil; } void Init_gtk_stack_switcher(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STACK_SWITCHER, "StackSwitcher", mGtk); RG_DEF_METHOD(initialize, 0); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-target-list.c0000644000175000017500000000656012516434313020655 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTargetList #define _SELF(r) (RVAL2GTKTARGETLIST(r)) static VALUE rg_initialize(VALUE self, VALUE rbtargets) { long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); GtkTargetList *list = gtk_target_list_new(targets, n); g_free(targets); G_INITIALIZE(self, list); return Qnil; } static VALUE rg_add(VALUE self, VALUE target, VALUE flags, VALUE info) { gtk_target_list_add(_SELF(self), RVAL2ATOM(target), FIX2UINT(flags), FIX2UINT(info)); return self; } static VALUE rg_add_table(VALUE self, VALUE rbtargets) { GtkTargetList *list = _SELF(self); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_target_list_add_table(list, targets, n); g_free(targets); return self; } static VALUE rg_add_text_targets(VALUE self, VALUE info) { gtk_target_list_add_text_targets(_SELF(self), NUM2UINT(info)); return self; } static VALUE rg_add_image_targets(VALUE self, VALUE info, VALUE writable) { gtk_target_list_add_image_targets(_SELF(self), NUM2UINT(info), RVAL2CBOOL(writable)); return self; } static VALUE rg_add_uri_targets(VALUE self, VALUE info) { gtk_target_list_add_uri_targets(_SELF(self), NUM2UINT(info)); return self; } static VALUE rg_add_rich_text_targets(VALUE self, VALUE info, VALUE deserializable, VALUE buffer) { gtk_target_list_add_rich_text_targets(_SELF(self), NUM2UINT(info), RVAL2CBOOL(deserializable), RVAL2GTKTEXTBUFFER(buffer)); return self; } static VALUE rg_remove(VALUE self, VALUE target) { gtk_target_list_remove(_SELF(self), RVAL2ATOM(target)); return self; } static VALUE rg_find(VALUE self, VALUE target) { guint info; gboolean ret = gtk_target_list_find(_SELF(self), RVAL2ATOM(target), &info); return ret ? INT2NUM(info) : Qnil; } void Init_gtk_target_list(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TARGET_LIST, "TargetList", mGtk); rbgobj_boxed_not_copy_obj(GTK_TYPE_TARGET_LIST); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(add, 3); RG_DEF_METHOD(add_table, 1); RG_DEF_METHOD(add_text_targets, 1); RG_DEF_METHOD(add_image_targets, 2); RG_DEF_METHOD(add_uri_targets, 1); RG_DEF_METHOD(add_rich_text_targets, 3); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(find, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-font-chooser.c0000644000175000017500000000431512516434313021020 0ustar koukou/* -*- 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 2, 0) #define RG_TARGET_NAMESPACE mFontChooser #define _SELF(self) (RVAL2GTKFONTCHOOSER(self)) static VALUE rg_font_face(VALUE self) { return GOBJ2RVAL(gtk_font_chooser_get_font_face(_SELF(self))); } static VALUE rg_font_family(VALUE self) { return GOBJ2RVAL(gtk_font_chooser_get_font_family(_SELF(self))); } static VALUE rg_font_size(VALUE self) { return INT2NUM(gtk_font_chooser_get_font_size(_SELF(self))); } static gboolean filter_func(const PangoFontFamily *family, const PangoFontFace *face, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(family), GOBJ2RVAL(face))); } static VALUE rg_set_filter_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_font_chooser_set_filter_func(_SELF(self), (GtkFontFilterFunc)filter_func, (gpointer)func, NULL); return self; } #endif void Init_gtk_fontchooser(VALUE mGtk) { #if GTK_CHECK_VERSION(3, 2, 0) VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_FONT_CHOOSER, "FontChooser", mGtk); RG_DEF_METHOD(font_face, 0); RG_DEF_METHOD(font_family, 0); RG_DEF_METHOD(font_size, 0); RG_DEF_METHOD(set_filter_func, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-scrollbar.c0000644000175000017500000000332112516434313020371 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cScrollbar #define _SELF(self) (RVAL2GTKSCROLLBAR(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE orientation, adjustment; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "11", &orientation, &adjustment); widget = gtk_scrollbar_new(RVAL2GTKORIENTATION(orientation), NIL_P(adjustment) ? NULL : RVAL2GTKADJUSTMENT(adjustment)); RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_scrollbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCROLLBAR, "Scrollbar", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/gtk3.def0000644000175000017500000000041512516434313016464 0ustar koukouEXPORTS Init_gtk3 rbgtk_initialize_gtkobject gtk_accel_group_entry_get_type gtk_accel_key_get_type gtk_allocation_get_type gtk_bindingset_get_type gtk_recent_data_get_type gtk_recent_filter_info_get_type gtk_text_appearance_get_type ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-activatable.c0000644000175000017500000000214612516434313020671 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mActivatable #define _SELF(self) (RVAL2GTKACTIVATABLE(self)) void Init_gtk_activatable(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_ACTIVATABLE, "Activatable", mGtk); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-combo-box.c0000644000175000017500000001011312516434313020270 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cComboBox #define _SELF(self) (RVAL2GTKCOMBOBOX(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_entry, rb_model, rb_area; gboolean entry; GtkTreeModel *model; GtkCellArea *area; GtkWidget *widget; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "entry", &rb_entry, "model", &rb_model, "area", &rb_area, NULL); entry = RVAL2CBOOL(rb_entry); model = NIL_P(rb_model) ? NULL : RVAL2GTKTREEMODEL(rb_model); area = NIL_P(rb_area) ? NULL : RVAL2GTKCELLAREA(rb_area); if (entry) { if (model) widget = gtk_combo_box_new_with_model_and_entry(model); else if (area) widget = gtk_combo_box_new_with_area_and_entry(area); else widget = gtk_combo_box_new_with_entry(); } else { if (model) widget = gtk_combo_box_new_with_model(model); else if (area) widget = gtk_combo_box_new_with_area(area); else widget = gtk_combo_box_new(); } 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 = GTKTREEITER2RVAL(&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_popup_accessible(VALUE self) { return GOBJ2RVAL(gtk_combo_box_get_popup_accessible(_SELF(self))); } 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; } static VALUE rg_title(VALUE self) { return CSTR2RVAL(gtk_combo_box_get_title(_SELF(self))); } /* TODO: merge to popup? */ static VALUE rg_popup_for_device(VALUE self, VALUE device) { gtk_combo_box_popup_for_device(_SELF(self), RVAL2GDKDEVICE(device)); return self; } static VALUE rg_set_title(VALUE self, VALUE title) { gtk_combo_box_set_title(_SELF(self), RVAL2CSTR(title)); return self; } void Init_gtk_combobox(VALUE mGtk) { 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); RG_DEF_METHOD(popup_accessible, 0); RG_DEF_METHOD(set_row_separator_func, 0); RG_DEF_METHOD(title, 0); RG_DEF_METHOD(popup_for_device, 1); RG_DEF_METHOD(set_title, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-text.c0000644000175000017500000000305312516434313022115 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererText #define _SELF(s) (RVAL2GTKCELLRENDERERTEXT(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-style-properties.c0000644000175000017500000000635512516434313021752 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cStyleProperties #define _SELF(self) (RVAL2GTKSTYLEPROPERTIES(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_style_properties_new()); return Qnil; } static VALUE rg_clear(VALUE self) { gtk_style_properties_clear(_SELF(self)); return self; } static VALUE rg_get_property(VALUE self, VALUE property, VALUE state) { GValue value = G_VALUE_INIT; gboolean exist; VALUE rb_value = Qnil; exist = gtk_style_properties_get_property(_SELF(self), RVAL2CSTR(property), RVAL2GTKSTATEFLAGS(state), &value); if (exist) { rb_value = GVAL2RVAL_UNSET(&value); } return rb_value; } static VALUE rg_lookup_color(VALUE self, VALUE name) { return GOBJ2RVAL(gtk_style_properties_lookup_color(_SELF(self), RVAL2CSTR(name))); } static VALUE rg_map_color(VALUE self, VALUE name, VALUE color) { gtk_style_properties_map_color(_SELF(self), RVAL2CSTR(name), RVAL2GTKSYMBOLICCOLOR(color)); return self; } static VALUE rg_merge(VALUE self, VALUE other, VALUE replace) { gtk_style_properties_merge(_SELF(self), _SELF(other), RVAL2CBOOL(replace)); return self; } static VALUE rg_set_property(VALUE self, VALUE property, VALUE state, VALUE value) { gtk_style_properties_set_property(_SELF(self), RVAL2CSTR(property), RVAL2GTKSTATEFLAGS(state), RVAL2GVALUE(value)); return self; } static VALUE rg_unset_property(VALUE self, VALUE property, VALUE state) { gtk_style_properties_unset_property(_SELF(self), RVAL2CSTR(property), RVAL2GTKSTATEFLAGS(state)); return self; } void Init_gtk_styleproperties(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STYLE_PROPERTIES, "StyleProperties", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD(get_property, 2); RG_DEF_METHOD(lookup_color, 1); RG_DEF_METHOD(map_color, 2); RG_DEF_METHOD(merge, 2); RG_DEF_METHOD(set_property, 3); RG_DEF_METHOD(unset_property, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-print-unix-dialog.c0000644000175000017500000000552112516434313021764 0ustar koukou/* -*- 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 "rbgtk3private.h" #ifdef HAVE_GTK_UNIX_PRINT #include #define RG_TARGET_NAMESPACE cPrintUnixDialog #define _SELF(s) (RVAL2GTKPRINTUNIXDIALOG(s)) #ifndef GTK_TYPE_PRINT_CAPABILITIES # define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type()) #endif static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE options, rb_title, rb_parent; const gchar *title; GtkWindow *parent; GtkWidget *dialog; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "title", &rb_title, "parent", &rb_parent, NULL); title = RVAL2CSTR_ACCEPT_NIL(rb_title); parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent); dialog = gtk_print_unix_dialog_new(title, parent); RBGTK_INITIALIZE(self, dialog); return Qnil; } static VALUE rg_add_custom_tab(VALUE self, VALUE child, VALUE tab_label) { gtk_print_unix_dialog_add_custom_tab(_SELF(self), RVAL2GTKWIDGET(child), RVAL2GTKWIDGET(tab_label)); return self; } static VALUE rg_set_manual_capability(VALUE self, VALUE rb_capabilities) { GtkPrintCapabilities capabilities; capabilities = RVAL2GTKPRINTCAPABILITIES(rb_capabilities); gtk_print_unix_dialog_set_manual_capabilities(_SELF(self), capabilities); return self; } #endif void Init_gtk_print_unix_dialog(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_UNIX_DIALOG, "PrintUnixDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(add_custom_tab, 2); RG_DEF_METHOD(set_manual_capability, 1); RG_DEF_ALIAS("settings", "print_settings"); RG_DEF_ALIAS("set_settings", "set_print_settings"); G_DEF_CLASS(GTK_TYPE_PRINT_CAPABILITIES, "Capabilities", RG_TARGET_NAMESPACE); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-view.c0000644000175000017500000002474012516434313020352 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextView #define _SELF(self) (RVAL2GTKTEXTVIEW(self)) #define RVAL2ITER(self, position) rval2iter(self, position) static GtkTextIter * rval2iter(VALUE self, VALUE position) { if (!g_type_is_a(RVAL2GTYPE(position), GTK_TYPE_TEXT_ITER)) position = rb_funcall(rb_funcall(self, rb_intern("buffer"), 0), rb_intern("get_iter_at"), 1, position); return RVAL2GTKTEXTITER(position); } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE buffer; GtkWidget* widget; rb_scan_args(argc, argv, "01", &buffer); if (NIL_P(buffer)) widget = gtk_text_view_new(); else { G_CHILD_SET(self, rb_intern("buffer"), buffer); widget = gtk_text_view_new_with_buffer(RVAL2GTKTEXTBUFFER(buffer)); } RBGTK_INITIALIZE(self, widget); return self; } static VALUE rg_scroll_to_mark(VALUE self, VALUE mark, VALUE within_margin, VALUE use_align, VALUE xalign, VALUE yalign) { gtk_text_view_scroll_to_mark(_SELF(self), RVAL2GTKTEXTMARK(mark), NUM2DBL(within_margin), RVAL2CBOOL(use_align), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_scroll_to_iter(VALUE self, VALUE iter, VALUE within_margin, VALUE use_align, VALUE xalign, VALUE yalign) { return CBOOL2RVAL(gtk_text_view_scroll_to_iter(_SELF(self), RVAL2ITER(self, iter), NUM2DBL(within_margin), RVAL2CBOOL(use_align), NUM2DBL(xalign), NUM2DBL(yalign))); } static VALUE rg_scroll_mark_onscreen(VALUE self, VALUE mark) { gtk_text_view_scroll_mark_onscreen(_SELF(self), RVAL2GTKTEXTMARK(mark)); return self; } static VALUE rg_move_mark_onscreen(VALUE self, VALUE mark) { return CBOOL2RVAL(gtk_text_view_move_mark_onscreen(_SELF(self), RVAL2GTKTEXTMARK(mark))); } static VALUE rg_place_cursor_onscreen(VALUE self) { return CBOOL2RVAL(gtk_text_view_place_cursor_onscreen(_SELF(self))); } static VALUE rg_visible_rect(VALUE self) { GdkRectangle rect; gtk_text_view_get_visible_rect(_SELF(self), &rect); return GDKRECTANGLE2RVAL(&rect); } static VALUE rg_get_iter_location(VALUE self, VALUE iter) { GdkRectangle rect; gtk_text_view_get_iter_location(_SELF(self), RVAL2ITER(self, iter), &rect); return GDKRECTANGLE2RVAL(&rect); } static VALUE rg_get_line_at_y(VALUE self, VALUE y) { GtkTextIter target_iter; gint line_top; gtk_text_view_get_line_at_y(_SELF(self), &target_iter, NUM2INT(y), &line_top); return rb_ary_new3(2, GTKTEXTITER2RVAL(&target_iter), INT2NUM(line_top)); } static VALUE rg_get_line_yrange(VALUE self, VALUE iter) { int y, height; gtk_text_view_get_line_yrange(_SELF(self), RVAL2ITER(self, iter), &y, &height); return rb_ary_new3(2, INT2NUM(y), INT2NUM(height)); } static VALUE rg_get_iter_at_location(VALUE self, VALUE x, VALUE y) { GtkTextIter iter; gtk_text_view_get_iter_at_location(_SELF(self), &iter, NUM2INT(x), NUM2INT(y)); return GTKTEXTITER2RVAL(&iter); } static VALUE rg_get_iter_at_position(VALUE self, VALUE x, VALUE y) { GtkTextIter iter; gint trailing; gtk_text_view_get_iter_at_position(_SELF(self), &iter, &trailing, NUM2INT(x), NUM2INT(y)); return rb_assoc_new(GTKTEXTITER2RVAL(&iter), INT2NUM(trailing)); } static VALUE rg_buffer_to_window_coords(VALUE self, VALUE wintype, VALUE buffer_x, VALUE buffer_y) { int window_x, window_y; gtk_text_view_buffer_to_window_coords(_SELF(self), RVAL2GTKTEXTWINDOWTYPE(wintype), NUM2INT(buffer_x), NUM2INT(buffer_y), &window_x, &window_y); return rb_ary_new3(2, INT2NUM(window_x), INT2NUM(window_y)); } static VALUE rg_window_to_buffer_coords(VALUE self, VALUE wintype, VALUE window_x, VALUE window_y) { int buffer_x, buffer_y; gtk_text_view_window_to_buffer_coords(_SELF(self), RVAL2GTKTEXTWINDOWTYPE(wintype), NUM2INT(window_x), NUM2INT(window_y), &buffer_x, &buffer_y); return rb_ary_new3(2, INT2NUM(buffer_x), INT2NUM(buffer_y)); } static VALUE rg_get_window(VALUE self, VALUE wintype) { GdkWindow* win = NULL; win = gtk_text_view_get_window(_SELF(self), RVAL2GTKTEXTWINDOWTYPE(wintype)); return win ? GOBJ2RVAL(win): Qnil; } static VALUE rg_get_window_type(VALUE self, VALUE gdkwin) { return GTKTEXTWINDOWTYPE2RVAL(gtk_text_view_get_window_type(_SELF(self), RVAL2GDKWINDOW(gdkwin))); } static VALUE rg_set_border_window_size(VALUE self, VALUE wintype, VALUE size) { gtk_text_view_set_border_window_size(_SELF(self), RVAL2GTKTEXTWINDOWTYPE(wintype), NUM2INT(size)); return self; } static VALUE rg_get_border_window_size(VALUE self, VALUE wintype) { return INT2NUM(gtk_text_view_get_border_window_size( _SELF(self), RVAL2GTKTEXTWINDOWTYPE(wintype))); } static VALUE rg_forward_display_line(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_forward_display_line(_SELF(self), RVAL2ITER(self, iter))); } static VALUE rg_backward_display_line(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_backward_display_line(_SELF(self), RVAL2ITER(self, iter))); } static VALUE rg_forward_display_line_end(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_forward_display_line_end(_SELF(self), RVAL2ITER(self, iter))); } static VALUE rg_backward_display_line_start(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_backward_display_line_start(_SELF(self), RVAL2ITER(self, iter))); } static VALUE rg_starts_display_line(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_starts_display_line(_SELF(self), RVAL2ITER(self, iter))); } static VALUE rg_move_visually(VALUE self, VALUE iter, VALUE count) { return CBOOL2RVAL(gtk_text_view_move_visually(_SELF(self), RVAL2ITER(self, iter), NUM2INT(count))); } static VALUE rg_add_child_at_anchor(VALUE self, VALUE child, VALUE anchor) { G_CHILD_ADD(self, child); gtk_text_view_add_child_at_anchor(_SELF(self), RVAL2GTKWIDGET(child), RVAL2GTKTEXTCHILDANCHOR(anchor)); return self; } static VALUE rg_add_child_in_window(VALUE self, VALUE child, VALUE which_window, VALUE xpos, VALUE ypos) { G_CHILD_ADD(self, child); gtk_text_view_add_child_in_window(_SELF(self), RVAL2GTKWIDGET(child), RVAL2GTKTEXTWINDOWTYPE(which_window), NUM2INT(xpos), NUM2INT(ypos)); return self; } static VALUE rg_move_child(VALUE self, VALUE child, VALUE xpos, VALUE ypos) { G_CHILD_ADD(self, child); gtk_text_view_move_child(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(xpos), NUM2INT(ypos)); return self; } static VALUE rg_default_attributes(VALUE self) { return GTKTEXTATTRIBUTES2RVAL(gtk_text_view_get_default_attributes(_SELF(self))); } static VALUE rg_get_cursor_locations(int argc, VALUE *argv, VALUE self) { VALUE iter; GdkRectangle strong, weak; rb_scan_args(argc, argv, "01", &iter); gtk_text_view_get_cursor_locations(_SELF(self), NIL_P(iter) ? NULL : RVAL2ITER(self, iter), &strong, &weak); return rb_ary_new3(2, GDKRECTANGLE2RVAL(&strong), GDKRECTANGLE2RVAL(&weak)); } static VALUE rg_im_context_filter_keypress(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_text_view_im_context_filter_keypress(_SELF(self), RVAL2GDKEVENTKEY(event))); } static VALUE rg_reset_im_context(VALUE self) { gtk_text_view_reset_im_context(_SELF(self)); return self; } void Init_gtk_textview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_VIEW, "TextView", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(scroll_to_mark, 5); RG_DEF_METHOD(scroll_to_iter, 5); RG_DEF_METHOD(scroll_mark_onscreen, 1); RG_DEF_METHOD(move_mark_onscreen, 1); RG_DEF_METHOD(place_cursor_onscreen, 0); RG_DEF_METHOD(visible_rect, 0); RG_DEF_METHOD(get_iter_location, 1); RG_DEF_METHOD(get_line_at_y, 1); RG_DEF_METHOD(get_line_yrange, 1); RG_DEF_METHOD(get_iter_at_location, 2); RG_DEF_METHOD(get_iter_at_position, 2); RG_DEF_METHOD(buffer_to_window_coords, 3); RG_DEF_METHOD(window_to_buffer_coords, 3); RG_DEF_METHOD(get_window, 1); RG_DEF_METHOD(get_window_type, 1); RG_DEF_METHOD(set_border_window_size, 2); RG_DEF_METHOD(get_border_window_size, 1); RG_DEF_METHOD(forward_display_line, 1); RG_DEF_METHOD(backward_display_line, 1); RG_DEF_METHOD(forward_display_line_end, 1); RG_DEF_METHOD(backward_display_line_start, 1); RG_DEF_METHOD(starts_display_line, 1); RG_DEF_METHOD(move_visually, 2); RG_DEF_METHOD(add_child_at_anchor, 2); RG_DEF_METHOD(add_child_in_window, 4); RG_DEF_METHOD(move_child, 3); RG_DEF_METHOD(default_attributes, 0); RG_DEF_METHOD(get_cursor_locations, -1); RG_DEF_METHOD(im_context_filter_keypress, 1); RG_DEF_METHOD(reset_im_context, 0); G_DEF_CLASS(GTK_TYPE_TEXT_WINDOW_TYPE, "WindowType", RG_TARGET_NAMESPACE); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_VALIDATE", INT2FIX(GTK_TEXT_VIEW_PRIORITY_VALIDATE)); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-rowreference.c0000644000175000017500000000756612516434313022050 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeRowReference #define _SELF(s) RVAL2GTKTREEROWREFERENCE(s) static ID id_proxy; static ID id_model; static ID id_path; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE proxy, model, path; GtkTreeRowReference* ref; if (argc == 3){ rb_scan_args(argc, argv, "3", &proxy, &model, &path); G_CHILD_SET(self, id_proxy, proxy); ref = gtk_tree_row_reference_new_proxy(RVAL2GOBJ(proxy), RVAL2GTKTREEMODEL(model), RVAL2GTKTREEPATH(path)); } else { rb_scan_args(argc, argv, "2", &model, &path); ref = gtk_tree_row_reference_new(RVAL2GTKTREEMODEL(model), RVAL2GTKTREEPATH(path)); } if (ref == NULL) rb_raise(rb_eArgError, "Invalid arguments were passed."); G_CHILD_SET(self, id_model, model); G_CHILD_SET(self, id_path, path); G_INITIALIZE(self, ref); return Qnil; } static VALUE rg_path(VALUE self) { VALUE ret = GTKTREEPATH2RVAL(gtk_tree_row_reference_get_path(_SELF(self))); G_CHILD_SET(self, id_path, ret); return ret; } static VALUE rg_model(VALUE self) { VALUE ret = GOBJ2RVAL(gtk_tree_row_reference_get_model(_SELF(self))); G_CHILD_SET(self, id_model, ret); return ret; } static VALUE rg_valid_p(VALUE self) { return CBOOL2RVAL(gtk_tree_row_reference_valid(_SELF(self))); } static VALUE rg_s_inserted(VALUE self, VALUE proxy, VALUE path) { gtk_tree_row_reference_inserted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_s_deleted(VALUE self, VALUE proxy, VALUE path) { gtk_tree_row_reference_deleted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_s_reordered(VALUE self, VALUE rbproxy, VALUE rbpath, VALUE rbiter, VALUE rbnew_order) { GObject *proxy = RVAL2GOBJ(rbproxy); GtkTreePath *path = RVAL2GTKTREEPATH(rbpath); GtkTreeIter *iter = RVAL2GTKTREEITER(rbiter); /* TODO: How do we implement this check? gint columns = gtk_tree_model_get_n_columns(proxy); */ long n; gint *new_order = RVAL2GINTS(rbnew_order, n); /* if (n != columns) { g_free(new_order); rb_raise(rb_eArgError, "new order array must contain same number of elements as the number of columns in the store: %ld != %d", n, columns); } */ gtk_tree_row_reference_reordered(proxy, path, iter, new_order); g_free(new_order); return self; } void Init_gtk_treerowreference(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_ROW_REFERENCE, "TreeRowReference", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(path, 0); RG_DEF_METHOD(model, 0); RG_DEF_METHOD_P(valid, 0); RG_DEF_SMETHOD(inserted, 2); RG_DEF_SMETHOD(deleted, 2); RG_DEF_SMETHOD(reordered, 4); id_proxy = rb_intern("proxy"); id_model = rb_intern("model"); id_path = rb_intern("path"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-check-button.c0000644000175000017500000000435612516434313021005 0ustar koukou/* -*- 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 "rbgtk3private.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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-adjustment.c0000644000175000017500000000604012516434313020565 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAdjustment #define _SELF(self) (RVAL2GTKADJUSTMENT(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; } static VALUE rg_configure(VALUE self, VALUE value, VALUE lower, VALUE upper, VALUE step_increment, VALUE page_increment, VALUE page_size) { gtk_adjustment_configure(_SELF(self), NUM2DBL(value), NUM2DBL(lower), NUM2DBL(upper), NUM2DBL(step_increment), NUM2DBL(page_increment), NUM2DBL(page_size)); return self; } #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_minimum_increment(VALUE self) { return DBL2NUM(gtk_adjustment_get_minimum_increment(_SELF(self))); } #endif 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); RG_DEF_METHOD(configure, 6); #if GTK_CHECK_VERSION(3, 2, 0) RG_DEF_METHOD(minimum_increment, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-search-bar.c0000644000175000017500000000332412516434313020420 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 10, 0) #define RG_TARGET_NAMESPACE cSearchBar #define _SELF(self) (RVAL2GTKSEARCHBAR(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_search_bar_new()); return Qnil; } static VALUE rg_connect_entry(VALUE self, VALUE entry) { gtk_search_bar_connect_entry(_SELF(self), RVAL2GTKENTRY(entry)); return self; } static VALUE rg_handle_event_p(VALUE self, VALUE event) { gboolean handle = gtk_search_bar_handle_event(_SELF(self), RVAL2GDKEVENT(event)); return CBOOL2RVAL(handle); } void Init_gtk_search_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEARCH_BAR, "SearchBar", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(connect_entry, 1); RG_DEF_METHOD_P(handle_event, 1); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-size.c0000644000175000017500000000542412516434313020314 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mIconSize static VALUE rg_s_lookup(G_GNUC_UNUSED VALUE self, VALUE size) { gint width, height; if(gtk_icon_size_lookup(RVAL2GTKICONSIZE(size), &width, &height)) return rb_ary_new3(2, INT2FIX(width), INT2FIX(height)); else return Qnil; } static VALUE rg_s_lookup_for_settings(G_GNUC_UNUSED VALUE self, VALUE settings, VALUE size) { gint width, height; if(gtk_icon_size_lookup_for_settings(RVAL2GTKSETTINGS(settings), RVAL2GTKICONSIZE(size), &width, &height)) return rb_ary_new3(2, INT2FIX(width), INT2FIX(height)); else return Qnil; } static VALUE rg_s_register(G_GNUC_UNUSED VALUE self, VALUE name, VALUE width, VALUE height) { /* XXXX FIXME This should be GENUM2RVAL */ return INT2FIX(gtk_icon_size_register(RVAL2CSTR(name), NUM2INT(width), NUM2INT(height))); } static VALUE rg_s_register_alias(G_GNUC_UNUSED VALUE self, VALUE alias, VALUE target) { gtk_icon_size_register_alias(RVAL2CSTR(alias), RVAL2GTKICONSIZE(target)); return Qnil; } static VALUE rg_s_from_name(G_GNUC_UNUSED VALUE self, VALUE name) { return INT2FIX(gtk_icon_size_from_name(RVAL2CSTR(name))); } static VALUE rg_s_get_name(G_GNUC_UNUSED VALUE self, VALUE size) { return CSTR2RVAL(gtk_icon_size_get_name(RVAL2GTKICONSIZE(size))); } void Init_gtk_icon_size(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "IconSize"); RG_DEF_SMETHOD(lookup, 1); RG_DEF_SMETHOD(lookup_for_settings, 2); RG_DEF_SMETHOD(register, 3); RG_DEF_SMETHOD(register_alias, 2); RG_DEF_SMETHOD(from_name, 1); RG_DEF_SMETHOD(get_name, 1); G_DEF_CLASS(GTK_TYPE_ICON_SIZE, "IconSize", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-calendar.c0000644000175000017500000000613712516434313020167 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCalendar #define _SELF(self) (RVAL2GTKCALENDAR(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) { gtk_calendar_select_month(_SELF(self), NUM2INT(month)-1, NUM2INT(year)); return self; } 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_display_options(VALUE self) { return GTKCALENDARDISPLAYOPTIONS2RVAL(gtk_calendar_get_display_options(_SELF(self))); } static VALUE rg_set_display_options(VALUE self, VALUE flags) { gtk_calendar_set_display_options(_SELF(self), RVAL2GTKCALENDARDISPLAYOPTIONS(flags)); return self; } 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(display_options, 0); RG_DEF_METHOD(set_display_options, 1); G_DEF_CLASS(GTK_TYPE_CALENDAR_DISPLAY_OPTIONS, "DisplayOptions", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-search-entry.c0000644000175000017500000000235712516434313021022 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 6, 0) #define RG_TARGET_NAMESPACE cSearchEntry static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_search_entry_new()); return Qnil; } void Init_gtk_search_entry(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEARCH_ENTRY, "SearchEntry", mGtk); RG_DEF_METHOD(initialize, 0); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-link-button.c0000644000175000017500000000307212516434313020657 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cLinkButton #define _SELF(self) (RVAL2GTKLINKBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE uri, label; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "11", &uri, &label); if (NIL_P(label)){ widget = gtk_link_button_new(RVAL2CSTR(uri)); } else { widget = gtk_link_button_new_with_label(RVAL2CSTR(uri), RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_link_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LINK_BUTTON, "LinkButton", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-toggle-action.c0000644000175000017500000000374412516434313021153 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cToggleAction #define _SELF(self) (RVAL2GTKTOGGLEACTION(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name, options, label, tooltip, stock_id, buffer; rb_scan_args(argc, argv, "11", &name, &options); rbg_scan_options(options, "label", &label, "tooltip", &tooltip, "stock_id", &stock_id, NULL); G_INITIALIZE(self, gtk_toggle_action_new(RVAL2CSTR(name), RVAL2CSTR_ACCEPT_NIL(label), RVAL2CSTR_ACCEPT_NIL(tooltip), RVAL2GLIBID_ACCEPT_NIL(stock_id, buffer))); return Qnil; } static VALUE rg_toggled(VALUE self) { gtk_toggle_action_toggled(_SELF(self)); return self; } void Init_gtk_toggle_action(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOGGLE_ACTION, "ToggleAction", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(toggled, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-widget.c0000644000175000017500000011632712516434313017704 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cWidget #define _SELF(self) (RVAL2GTKWIDGET(self)) static VALUE style_prop_func_table; static VALUE rg_unparent(VALUE self) { gtk_widget_unparent(_SELF(self)); return self; } static VALUE rg_show(VALUE self) { gtk_widget_show(_SELF(self)); return self; } static VALUE rg_show_now(VALUE self) { gtk_widget_show_now(_SELF(self)); return self; } static VALUE rg_hide(VALUE self) { gtk_widget_hide(_SELF(self)); return self; } static VALUE rg_show_all(VALUE self) { gtk_widget_show_all(_SELF(self)); return self; } static VALUE rg_map(VALUE self) { gtk_widget_map(_SELF(self)); return self; } static VALUE rg_unmap(VALUE self) { gtk_widget_unmap(_SELF(self)); return self; } static VALUE rg_realize(VALUE self) { gtk_widget_realize(_SELF(self)); return self; } static VALUE rg_unrealize(VALUE self) { gtk_widget_unrealize(_SELF(self)); return self; } static VALUE rg_queue_draw(VALUE self) { gtk_widget_queue_draw(_SELF(self)); return self; } static VALUE rg_queue_resize(VALUE self) { gtk_widget_queue_resize(_SELF(self)); return self; } static VALUE rg_queue_resize_no_redraw(VALUE self) { gtk_widget_queue_resize_no_redraw(_SELF(self)); return self; } static VALUE rg_size_allocate(VALUE self, VALUE alloc) { gtk_widget_size_allocate(_SELF(self), RVAL2GTKALLOCATION(alloc)); return self; } static VALUE rg_add_accelerator(VALUE self, VALUE sig, VALUE accel, VALUE key, VALUE mod, VALUE flag) { gtk_widget_add_accelerator(_SELF(self), RVAL2CSTR(sig), RVAL2GTKACCELGROUP(accel), NUM2INT(key), RVAL2GDKMODIFIERTYPE(mod), RVAL2GTKACCELFLAGS(flag)); return self; } static VALUE rg_remove_accelerator(VALUE self, VALUE accel, VALUE key, VALUE mod) { return CBOOL2RVAL(gtk_widget_remove_accelerator(_SELF(self), RVAL2GTKACCELGROUP(accel), NUM2INT(key), RVAL2GDKMODIFIERTYPE(mod))); } static VALUE rg_set_accel_path(VALUE self, VALUE accel_path, VALUE accel_group) { gtk_widget_set_accel_path(_SELF(self), RVAL2CSTR(accel_path), RVAL2GTKACCELGROUP(accel_group)); return self; } static VALUE rg_accel_closures(VALUE self) { return BOXEDGLIST2RVAL_FREE(gtk_widget_list_accel_closures(_SELF(self)), G_TYPE_CLOSURE, g_list_free, NULL); } static VALUE rg_can_activate_accel_p(VALUE self, VALUE signal_id) { return CBOOL2RVAL(gtk_widget_can_activate_accel(_SELF(self), NUM2UINT(signal_id))); } static VALUE rg_event(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_widget_event(_SELF(self), RVAL2GEV(event))); } static VALUE rg_activate(VALUE self) { return CBOOL2RVAL(gtk_widget_activate(_SELF(self))); } static VALUE rg_reparent(VALUE self, VALUE parent) { gtk_widget_reparent(_SELF(self), _SELF(parent)); return self; } static VALUE rg_intersect(VALUE self, VALUE area) { GdkRectangle intersection; gboolean ret = gtk_widget_intersect(_SELF(self), RVAL2GDKRECTANGLE(area), &intersection); return ret ? GDKRECTANGLE2RVAL(&intersection) : Qnil; } static VALUE rg_grab_default(VALUE self) { gtk_widget_grab_default(_SELF(self)); return self; } static VALUE rg_set_parent_window(VALUE self, VALUE parent_window) { gtk_widget_set_parent_window(_SELF(self), RVAL2GDKWINDOW(parent_window)); return self; } static VALUE rg_parent_window(VALUE self) { return GOBJ2RVAL(gtk_widget_get_parent_window(_SELF(self))); } static VALUE rg_add_events(VALUE self, VALUE events) { gtk_widget_add_events(_SELF(self), NUM2INT(events)); return self; } static VALUE rg_toplevel(VALUE self) { return GOBJ2RVAL(gtk_widget_get_toplevel(_SELF(self))); } static VALUE rg_get_ancestor(VALUE self, VALUE klass) { return GOBJ2RVAL(gtk_widget_get_ancestor(_SELF(self), CLASS2GTYPE(klass))); } static VALUE rg_visual(VALUE self) { return GOBJ2RVAL(gtk_widget_get_visual(_SELF(self))); } static VALUE rg_ancestor_p(VALUE self, VALUE ancestor) { return CBOOL2RVAL(gtk_widget_is_ancestor(_SELF(self), _SELF(ancestor))); } static VALUE rg_translate_coordinates(VALUE self, VALUE dest_widget, VALUE src_x, VALUE src_y) { gint dest_x, dest_y; gboolean ret; VALUE result = Qnil; ret = gtk_widget_translate_coordinates(_SELF(self), _SELF(dest_widget), NUM2INT(src_x), NUM2INT(src_y), &dest_x, &dest_y); if (ret) result = rb_ary_new3(2, INT2FIX(dest_x), INT2FIX(dest_y)); return result; } static VALUE rg_hide_on_delete(VALUE self) { return CBOOL2RVAL(gtk_widget_hide_on_delete(_SELF(self))); } static VALUE rg_set_direction(VALUE self, VALUE dir) { gtk_widget_set_direction(_SELF(self), RVAL2GTKTEXTDIRECTION(dir)); return self; } static VALUE rg_direction(VALUE self) { return GTKTEXTDIRECTION2RVAL(gtk_widget_get_direction(_SELF(self))); } static VALUE rg_s_set_default_direction(VALUE self, VALUE dir) { gtk_widget_set_default_direction(RVAL2GTKTEXTDIRECTION(dir)); return self; } static VALUE rg_s_default_direction(G_GNUC_UNUSED VALUE self) { return GTKTEXTDIRECTION2RVAL(gtk_widget_get_default_direction()); } static VALUE rg_composite_name(VALUE self) { return CSTR2RVAL(gtk_widget_get_composite_name(_SELF(self))); } static VALUE rg_create_pango_context(VALUE self) { return GOBJ2RVALU(gtk_widget_create_pango_context(_SELF(self))); } static VALUE rg_pango_context(VALUE self) { return GOBJ2RVAL(gtk_widget_get_pango_context(_SELF(self))); } static VALUE rg_create_pango_layout(int argc, VALUE *argv, VALUE self) { VALUE text; rb_scan_args(argc, argv, "01", &text); return GOBJ2RVALU(gtk_widget_create_pango_layout(_SELF(self), RVAL2CSTR_ACCEPT_NIL(text))); } static VALUE rg_s_pop_composite_child(VALUE self) { gtk_widget_pop_composite_child(); return self; } static VALUE rg_s_push_composite_child(VALUE self) { gtk_widget_push_composite_child(); return self; } static VALUE rg_queue_draw_area(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_widget_queue_draw_area(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_set_redraw_on_allocate(VALUE self, VALUE redraw_on_allocate) { gtk_widget_set_redraw_on_allocate(_SELF(self), RVAL2CBOOL(redraw_on_allocate)); return self; } static VALUE rg_set_composite_name(VALUE self, VALUE name) { gtk_widget_set_composite_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_mnemonic_activate(VALUE self, VALUE group_cycling) { return CBOOL2RVAL(gtk_widget_mnemonic_activate(_SELF(self), RVAL2CBOOL(group_cycling))); } /* * Gtk::Widget.install_style_property(...) do |spec, str| * #parse str * new_val = .... # parse value from string. * new_val # return new_val or nil if you can't convert the value. * end */ static gboolean rc_property_parser(const GParamSpec *pspec, const GString *rc_string, GValue *property_value) { VALUE spec = GOBJ2RVAL((gpointer)pspec); VALUE func = rb_hash_aref(style_prop_func_table, spec); VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str)); if (NIL_P(ret)) { return FALSE; } else if (RVAL2CBOOL(ret)){ rbgobj_rvalue_to_gvalue(ret, property_value); return TRUE; } else { rb_raise(rb_eArgError, "Gtk::Widget#install_style_property() block should return new value or nil"); } } static VALUE rg_s_install_style_property(VALUE self, VALUE spec) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(self); GtkWidgetClass* gclass; GParamSpec* pspec = RVAL2GPARAMSPEC(spec); if (cinfo->klass != self) rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self)); gclass = (GtkWidgetClass *)g_type_class_ref(cinfo->gtype); if (rb_block_given_p()){ VALUE func = rb_block_proc(); rb_hash_aset(style_prop_func_table, spec, func); gtk_widget_class_install_style_property_parser(gclass, pspec, (GtkRcPropertyParser)rc_property_parser); } else { gtk_widget_class_install_style_property(gclass, pspec); } return self; } static VALUE rg_s_style_property(VALUE self, VALUE property_name) { GtkWidgetClass* 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 = (GtkWidgetClass*)g_type_class_ref(CLASS2GTYPE(self)); prop = gtk_widget_class_find_style_property(oclass, name); if (!prop){ g_type_class_unref(oclass); rb_raise(rb_eval_string("GLib::NoPropertyError"), "no such property: %s", name); } result = GOBJ2RVAL(prop); g_type_class_unref(oclass); return result; } static VALUE rg_s_style_properties(int argc, VALUE *argv, VALUE self) { GtkWidgetClass* 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_widget_class_list_style_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 rg_region_intersect(VALUE self, VALUE region) { return CRREGION2RVAL(gtk_widget_region_intersect(_SELF(self), RVAL2CRREGION(region))); } static VALUE rg_send_expose(VALUE self, VALUE event) { return INT2NUM(gtk_widget_send_expose(_SELF(self), RVAL2GEV(event))); } static VALUE rg_style_get_property(VALUE self, VALUE prop_name) { GParamSpec* pspec = NULL; const char* name; if (SYMBOL_P(prop_name)) { name = rb_id2name(SYM2ID(prop_name)); } else { name = RVAL2CSTR(prop_name); } pspec = gtk_widget_class_find_style_property((GtkWidgetClass*)g_type_class_ref(RVAL2GTYPE(self)), name); if (!pspec) rb_raise(rb_eval_string("GLib::NoPropertyError"), "No such property: %s", name); else { // FIXME: use rb_ensure to call g_value_unset() GValue gval = G_VALUE_INIT; VALUE ret; g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec)); gtk_widget_style_get_property(RVAL2GTKWIDGET(self), name, &gval); ret = GVAL2RVAL(&gval); g_value_unset(&gval); return ret; } } static VALUE rg_accessible(VALUE self) { return GOBJ2RVAL(gtk_widget_get_accessible(_SELF(self))); } static VALUE rg_child_focus(VALUE self, VALUE direction) { return CBOOL2RVAL(gtk_widget_child_focus(_SELF(self), RVAL2GTKDIRECTIONTYPE(direction))); } static VALUE rg_error_bell(VALUE self) { gtk_widget_error_bell(_SELF(self)); return self; } static VALUE rg_keynav_failed(VALUE self, VALUE direction) { return CBOOL2RVAL(gtk_widget_keynav_failed(_SELF(self), RVAL2GTKDIRECTIONTYPE(direction))); } static VALUE rg_child_notify(VALUE self, VALUE child_property) { gtk_widget_child_notify(_SELF(self), RVAL2CSTR(child_property)); return self; } static VALUE rg_freeze_child_notify(VALUE self) { gtk_widget_freeze_child_notify(_SELF(self)); return self; } static VALUE rg_child_visible_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_child_visible(_SELF(self))); } static VALUE rg_settings(VALUE self) { return GOBJ2RVAL(gtk_widget_get_settings(_SELF(self))); } static VALUE rg_get_clipboard(VALUE self, VALUE selection) { return GOBJ2RVAL(gtk_widget_get_clipboard(_SELF(self), RVAL2ATOM(selection))); } static VALUE rg_display(VALUE self) { return GOBJ2RVAL(gtk_widget_get_display(_SELF(self))); } static VALUE rg_root_window(VALUE self) { return GOBJ2RVAL(gtk_widget_get_root_window(_SELF(self))); } static VALUE rg_screen(VALUE self) { return GOBJ2RVAL(gtk_widget_get_screen(_SELF(self))); } static VALUE rg_has_screen_p(VALUE self) { return CBOOL2RVAL(gtk_widget_has_screen(_SELF(self))); } static VALUE rg_get_size_request(VALUE self) { gint width, height; gtk_widget_get_size_request(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_set_child_visible(VALUE self, VALUE is_visible) { gtk_widget_set_child_visible(_SELF(self), RVAL2CBOOL(is_visible)); return self; } static VALUE rg_set_size_request(VALUE self, VALUE width, VALUE height) { gtk_widget_set_size_request(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_thaw_child_notify(VALUE self) { gtk_widget_thaw_child_notify(_SELF(self)); return self; } static VALUE rg_mnemonic_labels(VALUE self) { return GOBJGLIST2RVAL_FREE(gtk_widget_list_mnemonic_labels(_SELF(self)), g_list_free, NULL); } static VALUE rg_add_mnemonic_label(VALUE self, VALUE label) { gtk_widget_add_mnemonic_label(_SELF(self), RVAL2GTKWIDGET(label)); return self; } static VALUE rg_remove_mnemonic_label(VALUE self, VALUE label) { gtk_widget_remove_mnemonic_label(_SELF(self), RVAL2GTKWIDGET(label)); return self; } static VALUE rg_set_tooltip_window(VALUE self, VALUE custom_window) { gtk_widget_set_tooltip_window(_SELF(self), RVAL2GTKWINDOW(custom_window)); return self; } static VALUE rg_tooltip_window(VALUE self) { return GOBJ2RVAL(gtk_widget_get_tooltip_window(_SELF(self))); } static VALUE rg_trigger_tooltip_query(VALUE self) { gtk_widget_trigger_tooltip_query(_SELF(self)); return self; } static VALUE rg_composited_p(VALUE self) { return CBOOL2RVAL(gtk_widget_is_composited(_SELF(self))); } static VALUE rg_set_window(VALUE self, VALUE window) { gtk_widget_set_window(_SELF(self), RVAL2GDKWINDOW(window)); return self; } static VALUE rg_toplevel_p(VALUE self) { return CBOOL2RVAL(gtk_widget_is_toplevel(_SELF(self))); } static VALUE rg_realized_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_realized(_SELF(self))); } static VALUE rg_mapped_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_mapped(_SELF(self))); } static VALUE rg_drawable_p(VALUE self) { return CBOOL2RVAL(gtk_widget_is_drawable(_SELF(self))); } static VALUE rg_sensitive_with_parent_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_sensitive(_SELF(self))); } static VALUE rg_has_grab_p(VALUE self) { return CBOOL2RVAL(gtk_widget_has_grab(_SELF(self))); } static VALUE rg_allocation(VALUE self) { GtkAllocation alloc; gtk_widget_get_allocation(_SELF(self), &alloc); return GTKALLOCATION2RVAL(&alloc); } static VALUE rg_set_allocation(VALUE self, VALUE alloc) { gtk_widget_set_allocation(_SELF(self), RVAL2GTKALLOCATION(alloc)); return self; } static VALUE rg_destroy(VALUE self) { gtk_widget_destroy(_SELF(self)); return Qnil; } static VALUE rg_bindings_activate(VALUE self, VALUE keyval, VALUE modifiers) { return CBOOL2RVAL(gtk_bindings_activate(RVAL2GOBJ(self), NUM2UINT(keyval), NUM2UINT(modifiers))); } static VALUE rg_has_window_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_has_window(_SELF(self))); } static VALUE rg_set_has_window(VALUE self, VALUE has_window) { gtk_widget_set_has_window(_SELF(self), RVAL2CBOOL(has_window)); return self; } static VALUE rg_s_binding_set(VALUE self) { GType gtype; gpointer gclass; GtkBindingSet* binding_set; Check_Type(self, T_CLASS); gtype = CLASS2GTYPE(self); if (!G_TYPE_IS_CLASSED(gtype)) { rb_raise(rb_eTypeError, "%s is not a classed GType", rb_class2name(self)); } gclass = g_type_class_ref(gtype); if (!gclass) { rb_raise(rb_eRuntimeError, "couldn't get class reference"); } if (!G_IS_OBJECT_CLASS(gclass)) { g_type_class_unref(gclass); rb_raise(rb_eTypeError, "%s is not a GObject class", rb_class2name(self)); } binding_set = gtk_binding_set_by_class(gclass); if (!binding_set) { g_type_class_unref(gclass); rb_raise(rb_eRuntimeError, "couldn't get BindingSet from %s", rb_class2name(self)); } g_type_class_unref(gclass); return GTKBINDINGSET2RVAL(binding_set); } static VALUE rg_path(VALUE self) { return GTKWIDGETPATH2RVAL(gtk_widget_get_path(_SELF(self))); } static VALUE widget_signal_size_request(G_GNUC_UNUSED guint num, const GValue *values) { GtkRequisition* req = (GtkRequisition*)g_value_get_boxed(&values[1]); return rb_ary_new3(2, GVAL2RVAL(&values[0]), rb_ary_new3(2, INT2NUM(req->width), INT2NUM(req->height))); } static VALUE widget_signal_size_allocate(G_GNUC_UNUSED guint num, const GValue *values) { GtkAllocation* alloc = (GtkAllocation*)g_value_get_boxed(&values[1]); return rb_ary_new3(2, GVAL2RVAL(&values[0]), GTKALLOCATION2RVAL(alloc)); } static VALUE rg_add_device_events(VALUE self, VALUE device, VALUE events) { gtk_widget_add_device_events(_SELF(self), RVAL2GDKDEVICE(device), RVAL2GDKEVENTMASK(events)); return self; } static VALUE rg_compute_expand(VALUE self, VALUE orientation) { gboolean result; result = gtk_widget_compute_expand(_SELF(self), RVAL2GTKORIENTATION(orientation)); return CBOOL2RVAL(result); } static VALUE rg_device_is_shadowed_p(VALUE self, VALUE device) { return CBOOL2RVAL(gtk_widget_device_is_shadowed(_SELF(self), RVAL2GDKDEVICE(device))); } static VALUE rg_draw(VALUE self, VALUE cr) { gtk_widget_draw(_SELF(self), RVAL2CRCONTEXT(cr)); return self; } static VALUE rg_allocated_height(VALUE self) { return INT2NUM(gtk_widget_get_allocated_height(_SELF(self))); } static VALUE rg_allocated_width(VALUE self) { return INT2NUM(gtk_widget_get_allocated_width(_SELF(self))); } /* TODO: device_enabled_p? */ static VALUE rg_get_device_enabled_p(VALUE self, VALUE device) { return CBOOL2RVAL(gtk_widget_get_device_enabled(_SELF(self), RVAL2GDKDEVICE(device))); } static VALUE rg_get_device_events(VALUE self, VALUE device) { GdkEventMask mask; mask = gtk_widget_get_device_events(_SELF(self), RVAL2GDKDEVICE(device)); return GDKEVENTMASK2RVAL(mask); } static VALUE rg_preferred_height(VALUE self) { gint minimum_height, natural_height; gtk_widget_get_preferred_height(_SELF(self), &minimum_height, &natural_height); return rb_ary_new3(2, INT2NUM(minimum_height), INT2NUM(natural_height)); } static VALUE rg_get_preferred_height_for_width(VALUE self, VALUE width) { gint minimum_height, natural_height; gtk_widget_get_preferred_height_for_width(_SELF(self), NUM2INT(width), &minimum_height, &natural_height); return rb_ary_new3(2, INT2NUM(minimum_height), INT2NUM(natural_height)); } static VALUE rg_preferred_size(VALUE self) { GtkRequisition minimum_size, natural_size; gtk_widget_get_preferred_size(_SELF(self), &minimum_size, &natural_size); return rb_ary_new3(2, rb_ary_new3(2, minimum_size.width, minimum_size.height), rb_ary_new3(2, natural_size.width, natural_size.height)); } static VALUE rg_preferred_width(VALUE self) { gint minimum_width, natural_width; gtk_widget_get_preferred_width(_SELF(self), &minimum_width, &natural_width); return rb_ary_new3(2, INT2NUM(minimum_width), INT2NUM(natural_width)); } static VALUE rg_get_preferred_width_for_height(VALUE self, VALUE height) { gint minimum_width, natural_width; gtk_widget_get_preferred_width_for_height(_SELF(self), NUM2INT(height), &minimum_width, &natural_width); return rb_ary_new3(2, INT2NUM(minimum_width), INT2NUM(natural_width)); } static VALUE rg_request_mode(VALUE self) { return GTKSIZEREQUESTMODE2RVAL(gtk_widget_get_request_mode(_SELF(self))); } static VALUE rg_state_flags(VALUE self) { return GTKSTATEFLAGS2RVAL(gtk_widget_get_state_flags(_SELF(self))); } static VALUE rg_style_context(VALUE self) { return GOBJ2RVAL(gtk_widget_get_style_context(_SELF(self))); } static VALUE rg_support_multidevice_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_support_multidevice(_SELF(self))); } #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_has_visible_focus_p(VALUE self) { return CBOOL2RVAL(gtk_widget_has_visible_focus(_SELF(self))); } #endif static VALUE rg_in_destruction_p(VALUE self) { return CBOOL2RVAL(gtk_widget_in_destruction(_SELF(self))); } static VALUE rg_input_shape_combine_region(VALUE self, VALUE region) { gtk_widget_input_shape_combine_region(_SELF(self), NIL_P(region) ? NULL : RVAL2CRREGION(region)); return self; } static VALUE rg_override_background_color(VALUE self, VALUE state, VALUE color) { gtk_widget_override_background_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), NIL_P(color) ? NULL : RVAL2GDKRGBA(color)); return self; } static VALUE rg_override_color(VALUE self, VALUE state, VALUE color) { gtk_widget_override_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), NIL_P(color) ? NULL : RVAL2GDKRGBA(color)); return self; } static VALUE rg_override_cursor(VALUE self, VALUE cursor, VALUE secondary_cursor) { gtk_widget_override_cursor(_SELF(self), NIL_P(cursor) ? NULL : RVAL2GDKRGBA(cursor), NIL_P(secondary_cursor) ? NULL : RVAL2GDKRGBA(secondary_cursor)); return self; } static VALUE rg_override_font(VALUE self, VALUE font_desc) { gtk_widget_override_font(_SELF(self), NIL_P(font_desc) ? NULL : RVAL2PANGOFONTDESCRIPTION(font_desc)); return self; } static VALUE rg_override_symbolic_color(VALUE self, VALUE name, VALUE color) { gtk_widget_override_symbolic_color(_SELF(self), RVAL2CSTR(name), NIL_P(color) ? NULL : RVAL2GDKRGBA(color)); return self; } static VALUE rg_queue_compute_expand(VALUE self) { gtk_widget_queue_compute_expand(_SELF(self)); return self; } static VALUE rg_queue_draw_region(VALUE self, VALUE region) { gtk_widget_queue_draw_region(_SELF(self), RVAL2CRREGION(region)); return self; } static VALUE rg_render_icon_pixbuf(VALUE self, VALUE stock_id, VALUE size) { VALUE buffer; GdkPixbuf *pixbuf; pixbuf = gtk_widget_render_icon_pixbuf(_SELF(self), RVAL2GLIBID(stock_id, buffer), RVAL2GTKICONSIZE(size)); return GOBJ2RVAL_UNREF(pixbuf); } static VALUE rg_reset_style(VALUE self) { gtk_widget_reset_style(_SELF(self)); return self; } static VALUE rg_send_focus_change(VALUE self, VALUE event) { gboolean result; result = gtk_widget_send_focus_change(_SELF(self), RVAL2GDKEVENT(event)); return CBOOL2RVAL(result); } static VALUE rg_set_device_enabled(VALUE self, VALUE device, VALUE enabled) { gtk_widget_set_device_enabled(_SELF(self), RVAL2GDKDEVICE(device), RVAL2CBOOL(enabled)); return self; } static VALUE rg_set_device_events(VALUE self, VALUE device, VALUE events) { gtk_widget_set_device_events(_SELF(self), RVAL2GDKDEVICE(device), RVAL2GDKEVENTMASK(events)); return self; } static VALUE rg_set_mapped(VALUE self, VALUE mapped) { gtk_widget_set_mapped(_SELF(self), RVAL2CBOOL(mapped)); return self; } static VALUE rg_set_realized(VALUE self, VALUE realized) { gtk_widget_set_realized(_SELF(self), RVAL2CBOOL(realized)); return self; } static VALUE rg_set_state_flags(VALUE self, VALUE flags, VALUE clear) { gtk_widget_set_state_flags(_SELF(self), RVAL2GTKSTATEFLAGS(flags), RVAL2CBOOL(clear)); return self; } static VALUE rg_set_support_multidevice(VALUE self, VALUE support_multidevice) { gtk_widget_set_support_multidevice(_SELF(self), RVAL2CBOOL(support_multidevice)); return self; } static VALUE rg_set_visual(VALUE self, VALUE visual) { gtk_widget_set_visual(_SELF(self), RVAL2GDKVISUAL(visual)); return self; } static VALUE rg_shape_combine_region(VALUE self, VALUE region) { gtk_widget_shape_combine_region(_SELF(self), NIL_P(region) ? NULL : RVAL2CRREGION(region)); return self; } static VALUE rg_unset_state_flags(VALUE self, VALUE flags) { gtk_widget_unset_state_flags(_SELF(self), RVAL2GTKSTATEFLAGS(flags)); return self; } static VALUE rg_drag_dest_set(VALUE self, VALUE flags, VALUE targets, VALUE actions) { GtkDestDefaults flg = RVAL2GTKDESTDEFAULTS(flags); GdkDragAction acts = RVAL2GDKDRAGACTION(actions); long n; GtkTargetEntry *entries = RVAL2GTKTARGETENTRIES_ACCEPT_NIL(targets, &n); gtk_drag_dest_set(_SELF(self), flg, entries, n, acts); g_free(entries); return self; } static VALUE rg_drag_dest_set_proxy(VALUE self, VALUE proxy_window, VALUE protocol, VALUE use_coordinates) { gtk_drag_dest_set_proxy(_SELF(self), RVAL2GDKWINDOW(proxy_window), RVAL2GDKDRAGPROTOCOL(protocol), RVAL2CBOOL(use_coordinates)); return self; } static VALUE rg_drag_dest_unset(VALUE self) { gtk_drag_dest_unset(_SELF(self)); return self; } static VALUE rg_drag_dest_find_target(int argc, VALUE *argv, VALUE self) { VALUE context, target_list; GdkAtom ret; rb_scan_args(argc, argv, "11", &context, &target_list); ret = gtk_drag_dest_find_target(_SELF(self), RVAL2GDKDRAGCONTEXT(context), NIL_P(target_list) ? NULL : RVAL2GTKTARGETLIST(target_list)); return GDKATOM2RVAL(ret); } static VALUE rg_drag_dest_get_target_list(VALUE self) { GtkTargetList* list = gtk_drag_dest_get_target_list(_SELF(self)); return GTKTARGETLIST2RVAL(list); } static VALUE rg_drag_dest_set_target_list(VALUE self, VALUE target_list) { gtk_drag_dest_set_target_list(_SELF(self), NIL_P(target_list) ? NULL : RVAL2GTKTARGETLIST(target_list)); return self; } static VALUE rg_drag_dest_add_text_targets(VALUE self) { gtk_drag_dest_add_text_targets(_SELF(self)); return self; } static VALUE rg_drag_dest_add_image_targets(VALUE self) { gtk_drag_dest_add_image_targets(_SELF(self)); return self; } static VALUE rg_drag_dest_add_uri_targets(VALUE self) { gtk_drag_dest_add_uri_targets(_SELF(self)); return self; } static VALUE rg_drag_dest_set_track_motion(VALUE self, VALUE track_motion) { gtk_drag_dest_set_track_motion(_SELF(self), RVAL2CBOOL(track_motion)); return self; } static VALUE rg_drag_dest_get_track_motion(VALUE self) { return CBOOL2RVAL(gtk_drag_dest_get_track_motion(_SELF(self))); } static VALUE rg_drag_get_data(VALUE self, VALUE context, VALUE target, VALUE time) { gtk_drag_get_data(_SELF(self), RVAL2GDKDRAGCONTEXT(context), RVAL2ATOM(target), NUM2UINT(time)); return self; } static VALUE rg_drag_highlight(VALUE self) { gtk_drag_highlight(_SELF(self)); return self; } static VALUE rg_drag_unhighlight(VALUE self) { gtk_drag_unhighlight(_SELF(self)); return self; } static VALUE rg_drag_begin(VALUE self, VALUE target_list, VALUE actions, VALUE button, VALUE event) { return GOBJ2RVAL(gtk_drag_begin(_SELF(self), RVAL2GTKTARGETLIST(target_list), RVAL2GDKDRAGACTION(actions), NUM2INT(button), RVAL2GEV(event))); } static VALUE rg_drag_threshold_p(VALUE self, VALUE start_x, VALUE start_y, VALUE current_x, VALUE current_y) { return CBOOL2RVAL(gtk_drag_check_threshold(_SELF(self), NUM2INT(start_x), NUM2INT(start_y), NUM2INT(current_x), NUM2INT(current_y))); } static VALUE rg_drag_source_set(VALUE self, VALUE start_button_mask, VALUE targets, VALUE actions) { GdkModifierType mask = RVAL2GDKMODIFIERTYPE(start_button_mask); GdkDragAction acts = RVAL2GDKDRAGACTION(actions); long n; GtkTargetEntry *entries = RVAL2GTKTARGETENTRIES(targets, &n); gtk_drag_source_set(_SELF(self), mask, entries, n, acts); g_free(entries); return self; } static VALUE rg_drag_source_set_icon(VALUE self, VALUE icon) { if (TYPE(icon) == T_HASH) { VALUE stock_id, icon_name, gicon, pixbuf, buffer; rbg_scan_options(icon, "stock_id", &stock_id, "icon_name", &icon_name, "gicon", &gicon, "pixbuf", &pixbuf, NULL); if (!NIL_P(stock_id)) gtk_drag_source_set_icon_stock(_SELF(self), RVAL2GLIBID(stock_id, buffer)); else if (!NIL_P(icon_name)) gtk_drag_source_set_icon_name(_SELF(self), RVAL2CSTR(icon_name)); #if GTK_CHECK_VERSION(3, 2, 0) else if (!NIL_P(gicon)) gtk_drag_source_set_icon_gicon(_SELF(self), RVAL2GICON(gicon)); #endif else if (!NIL_P(pixbuf)) gtk_drag_source_set_icon_pixbuf(_SELF(self), RVAL2GDKPIXBUF(pixbuf)); else rb_raise(rb_eArgError, "Invalid arguments."); } else { GType gtype = RVAL2GTYPE(icon); if (gtype == GDK_TYPE_PIXBUF) gtk_drag_source_set_icon_pixbuf(_SELF(self), RVAL2GDKPIXBUF(icon)); #if GTK_CHECK_VERSION(3, 2, 0) else if (g_type_is_a(gtype, G_TYPE_ICON)) gtk_drag_source_set_icon_gicon(_SELF(self), RVAL2GICON(icon)); #endif else rb_raise(rb_eArgError, "Invalid arguments."); } return self; } static VALUE rg_drag_source_unset(VALUE self) { gtk_drag_source_unset(_SELF(self)); return self; } static VALUE rg_drag_source_set_target_list(VALUE self, VALUE target_list) { gtk_drag_source_set_target_list(_SELF(self), NIL_P(target_list) ? NULL : RVAL2GTKTARGETLIST(target_list)); return self; } static VALUE rg_drag_source_get_target_list(VALUE self) { return GTKTARGETLIST2RVAL(gtk_drag_source_get_target_list(_SELF(self))); } static VALUE rg_drag_source_add_text_targets(VALUE self) { gtk_drag_source_add_text_targets(_SELF(self)); return self; } static VALUE rg_drag_source_add_image_targets(VALUE self) { gtk_drag_source_add_image_targets(_SELF(self)); return self; } static VALUE rg_drag_source_add_uri_targets(VALUE self) { gtk_drag_source_add_uri_targets(_SELF(self)); return self; } void Init_gtk_widget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WIDGET, "Widget", mGtk); rb_global_variable(&style_prop_func_table); style_prop_func_table = rb_hash_new(); RG_DEF_METHOD(unparent, 0); RG_DEF_METHOD(show, 0); RG_DEF_METHOD(show_now, 0); RG_DEF_METHOD(hide, 0); RG_DEF_METHOD(show_all, 0); RG_DEF_METHOD(map, 0); RG_DEF_METHOD(unmap, 0); RG_DEF_METHOD(realize, 0); RG_DEF_METHOD(unrealize, 0); RG_DEF_METHOD(queue_draw, 0); RG_DEF_METHOD(queue_resize, 0); RG_DEF_METHOD(queue_resize_no_redraw, 0); RG_DEF_METHOD(size_allocate, 1); RG_DEF_METHOD(add_accelerator, 5); RG_DEF_METHOD(remove_accelerator, 3); RG_DEF_METHOD(set_accel_path, 2); RG_DEF_METHOD(accel_closures, 0); RG_DEF_METHOD_P(can_activate_accel, 1); RG_DEF_METHOD(event, 1); RG_DEF_METHOD(activate, 0); RG_DEF_METHOD(reparent, 1); RG_DEF_SMETHOD(install_style_property, 1); RG_DEF_SMETHOD(style_property, 1); RG_DEF_SMETHOD(style_properties, -1); RG_DEF_METHOD(intersect, 1); RG_DEF_METHOD(grab_default, 0); RG_DEF_METHOD(set_parent_window, 1); RG_DEF_METHOD(parent_window, 0); RG_DEF_METHOD(add_events, 1); RG_DEF_METHOD(toplevel, 0); RG_DEF_METHOD(get_ancestor, 1); RG_DEF_METHOD(visual, 0); RG_DEF_METHOD_P(ancestor, 1); RG_DEF_METHOD(translate_coordinates, 3); RG_DEF_METHOD(hide_on_delete, 0); RG_DEF_METHOD(set_direction, 1); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD(composite_name, 0); RG_DEF_METHOD(create_pango_context, 0); RG_DEF_METHOD(pango_context, 0); RG_DEF_METHOD(create_pango_layout, -1); RG_DEF_METHOD(queue_draw_area, 4); RG_DEF_METHOD(set_redraw_on_allocate, 1); RG_DEF_METHOD(set_composite_name, 1); RG_DEF_METHOD(mnemonic_activate, 1); RG_DEF_METHOD(region_intersect, 1); RG_DEF_METHOD(send_expose, 1); RG_DEF_METHOD(style_get_property, 1); RG_DEF_METHOD(accessible, 0); RG_DEF_METHOD(child_focus, 1); RG_DEF_METHOD(error_bell, 0); RG_DEF_METHOD(keynav_failed, 0); RG_DEF_METHOD(child_notify, 1); RG_DEF_METHOD(freeze_child_notify, 0); RG_DEF_METHOD_P(child_visible, 0); RG_DEF_METHOD(settings, 0); RG_DEF_METHOD(get_clipboard, 1); RG_DEF_METHOD(display, 0); RG_DEF_METHOD(root_window, 0); RG_DEF_METHOD(screen, 0); RG_DEF_METHOD_P(has_screen, 0); RG_DEF_METHOD(set_child_visible, 1); RG_DEF_METHOD(get_size_request, 0); RG_DEF_METHOD(set_size_request, 2); RG_DEF_METHOD(thaw_child_notify, 0); RG_DEF_METHOD(mnemonic_labels, 0); RG_DEF_METHOD(add_mnemonic_label, 1); RG_DEF_METHOD(remove_mnemonic_label, 1); RG_DEF_METHOD(set_tooltip_window, 1); RG_DEF_METHOD(tooltip_window, 0); RG_DEF_METHOD(trigger_tooltip_query, 0); RG_DEF_METHOD_P(composited, 0); RG_DEF_METHOD(set_window, 1); RG_DEF_METHOD(allocation, 0); RG_DEF_METHOD(set_allocation, 1); RG_DEF_METHOD(destroy, 0); RG_DEF_METHOD(bindings_activate, 2); RG_DEF_METHOD_P(toplevel, 0); RG_DEF_METHOD_P(realized, 0); RG_DEF_METHOD_P(mapped, 0); RG_DEF_METHOD_P(drawable, 0); RG_DEF_METHOD_P(sensitive_with_parent, 0); RG_DEF_METHOD_P(has_grab, 0); RG_DEF_SMETHOD(set_default_direction, 1); RG_DEF_SMETHOD(default_direction, 0); RG_DEF_SMETHOD(pop_composite_child, 0); RG_DEF_SMETHOD(push_composite_child, 0); RG_DEF_SMETHOD(binding_set, 0); RG_DEF_METHOD_P(has_window, 0); RG_DEF_METHOD(set_has_window, 1); RG_DEF_METHOD(path, 0); RG_DEF_METHOD(add_device_events, 2); RG_DEF_METHOD(compute_expand, 1); RG_DEF_METHOD_P(device_is_shadowed, 1); RG_DEF_METHOD(draw, 1); RG_DEF_METHOD(allocated_height, 0); RG_DEF_METHOD(allocated_width, 0); RG_DEF_METHOD_P(get_device_enabled, 1); RG_DEF_METHOD(get_device_events, 1); RG_DEF_METHOD(preferred_height, 0); RG_DEF_METHOD(get_preferred_height_for_width, 1); RG_DEF_METHOD(preferred_size, 0); RG_DEF_METHOD(preferred_width, 0); RG_DEF_METHOD(get_preferred_width_for_height, 1); RG_DEF_METHOD(request_mode, 0); RG_DEF_METHOD(state_flags, 0); RG_DEF_METHOD(style_context, 0); RG_DEF_METHOD_P(support_multidevice, 0); #if GTK_CHECK_VERSION(3, 2, 0) RG_DEF_METHOD_P(has_visible_focus, 0); #endif RG_DEF_METHOD_P(in_destruction, 0); RG_DEF_METHOD(input_shape_combine_region, 1); RG_DEF_METHOD(override_background_color, 2); RG_DEF_METHOD(override_color, 2); RG_DEF_METHOD(override_cursor, 2); RG_DEF_METHOD(override_font, 1); RG_DEF_METHOD(override_symbolic_color, -1); RG_DEF_METHOD(queue_compute_expand, 0); RG_DEF_METHOD(queue_draw_region, 1); RG_DEF_METHOD(render_icon_pixbuf, 2); RG_DEF_METHOD(reset_style, 0); RG_DEF_METHOD(send_focus_change, 1); RG_DEF_METHOD(set_device_enabled, 2); RG_DEF_METHOD(set_device_events, 2); RG_DEF_METHOD(set_mapped, 1); RG_DEF_METHOD(set_realized, 1); RG_DEF_METHOD(set_state_flags, 2); RG_DEF_METHOD(set_support_multidevice, 1); RG_DEF_METHOD(set_visual, 1); RG_DEF_METHOD(shape_combine_region, 1); RG_DEF_METHOD(unset_state_flags, 1); RG_DEF_METHOD(drag_dest_set, 3); RG_DEF_METHOD(drag_dest_set_proxy, 3); RG_DEF_METHOD(drag_dest_unset, 0); RG_DEF_METHOD(drag_dest_find_target, -1); RG_DEF_METHOD(drag_dest_get_target_list, 0); RG_DEF_METHOD(drag_dest_set_target_list, 1); RG_DEF_METHOD(drag_dest_add_text_targets, 0); RG_DEF_METHOD(drag_dest_add_image_targets, 0); RG_DEF_METHOD(drag_dest_add_uri_targets, 0); RG_DEF_METHOD(drag_dest_set_track_motion, 1); RG_DEF_METHOD(drag_dest_get_track_motion, 0); RG_DEF_METHOD(drag_get_data, 3); RG_DEF_METHOD(drag_highlight, 0); RG_DEF_METHOD(drag_unhighlight, 0); RG_DEF_METHOD(drag_begin, 4); RG_DEF_METHOD_P(drag_threshold, 4); RG_DEF_METHOD(drag_source_set, 3); RG_DEF_METHOD(drag_source_set_icon, 1); RG_DEF_METHOD(drag_source_unset, 0); RG_DEF_METHOD(drag_source_set_target_list, 1); RG_DEF_METHOD(drag_source_get_target_list, 0); RG_DEF_METHOD(drag_source_add_text_targets, 0); RG_DEF_METHOD(drag_source_add_image_targets, 0); RG_DEF_METHOD(drag_source_add_uri_targets, 0); G_DEF_CLASS(GTK_TYPE_WIDGET_HELP_TYPE, "HelpType", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_TEXT_DIRECTION, "TextDirection", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_ALIGN, "Align", RG_TARGET_NAMESPACE); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "size-request", (GValToRValSignalFunc)widget_signal_size_request); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "size-allocate", (GValToRValSignalFunc)widget_signal_size_allocate); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-entry-completion.c0000644000175000017500000000672012516434313021724 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cEntryCompletion #define _SELF(self) (RVAL2GTKENTRYCOMPLETION(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; } static VALUE rg_insert_prefix(VALUE self) { gtk_entry_completion_insert_prefix(_SELF(self)); return self; } 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; } static VALUE rg_completion_prefix(VALUE self) { return CSTR2RVAL(gtk_entry_completion_get_completion_prefix(_SELF(self))); } void Init_gtk_entry_completion(VALUE mGtk) { 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); RG_DEF_METHOD(insert_prefix, 0); 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); RG_DEF_METHOD(completion_prefix, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-stack.c0000644000175000017500000000604512516434313017521 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 10, 0) #define RG_TARGET_NAMESPACE cStack #define _SELF(self) (RVAL2GTKSTACK(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_stack_new()); return Qnil; } static VALUE rg_add(int argc, VALUE *argv, VALUE self) { VALUE rb_widget, rb_name, rb_title; GtkWidget *child_widget; const gchar *name = NULL, *title = NULL; rb_scan_args(argc, argv, "12", &rb_widget, &rb_name, &rb_title); child_widget = RVAL2GTKWIDGET(rb_widget); if (!NIL_P(rb_name)) name = RVAL2CSTR(rb_name); if (!NIL_P(rb_title)) title = RVAL2CSTR(rb_title); if (argc == 1) { return rb_call_super(argc, argv); } else if (argc == 2) { gtk_stack_add_named(_SELF(self), child_widget, name); } else if (argc == 3) { gtk_stack_add_titled(_SELF(self), child_widget, name, title); } return self; } static VALUE rg_set_visible_child(int argc, VALUE *argv, VALUE self) { VALUE rb_widget_or_name, rb_transition_type; GtkStackTransitionType transition_type; GtkWidget *widget = NULL; const gchar *name = NULL; rb_scan_args(argc, argv, "11", &rb_widget_or_name, &rb_transition_type); if (RVAL2CBOOL(rb_obj_is_kind_of(rb_widget_or_name, rb_cString))) { name = RVAL2CSTR(rb_widget_or_name); } else { widget = RVAL2GOBJ(rb_widget_or_name); } if (widget) { gtk_stack_set_visible_child(_SELF(self), widget); } else { if (!NIL_P(rb_transition_type)) transition_type = RVAL2GTKSTACKTRANSITIONTYPE(rb_transition_type); if (!NIL_P(rb_transition_type)) { gtk_stack_set_visible_child_full(_SELF(self), name, transition_type); } else { gtk_stack_set_visible_child_name(_SELF(self), name); } } return self; } void Init_gtk_stack(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STACK, "Stack", mGtk); G_DEF_CLASS(GTK_TYPE_STACK_TRANSITION_TYPE, "TransitionType", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, -1); RG_REPLACE_SET_PROPERTY(visible_child, -1); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-combo.c0000644000175000017500000000241212516434313022226 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererCombo static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_combo_new()); return Qnil; } void Init_gtk_cellrenderercombo(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_COMBO, "CellRendererCombo", mGtk); RG_DEF_METHOD(initialize, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk3util.c0000644000175000017500000000357312516434313017402 0ustar koukou/* -*- 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 "rbgtk3private.h" struct add_buttons_args { VALUE self; VALUE buttons; RBGTKAddButtonFunc add_button; }; static VALUE add_buttons_body(VALUE value) { struct add_buttons_args *args = (struct add_buttons_args *)value; VALUE button; long i; long n = RARRAY_LEN(args->buttons); for (i = 0; i < n; i++) { button = rb_ary_to_ary(RARRAY_PTR(args->buttons)[i]); args->add_button(args->self, RARRAY_PTR(button)[0], RARRAY_PTR(button)[1]); } return args->self; } static VALUE add_buttons_ensure(VALUE value) { g_object_thaw_notify(RVAL2GOBJ(((struct add_buttons_args *)value)->self)); return Qnil; } VALUE rbgtk_add_buttons(VALUE self, VALUE buttons, RBGTKAddButtonFunc add_button) { struct add_buttons_args args = { self, buttons, add_button }; if (NIL_P(RARRAY_PTR(buttons)[0])) return self; g_object_freeze_notify(RVAL2GOBJ(self)); return rb_ensure(add_buttons_body, (VALUE)&args, add_buttons_ensure, (VALUE)&args); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-iter.c0000644000175000017500000004511312516434313020340 0ustar koukou/* -*- 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) 2002,2003 Masahiro Sakai * * 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextIter #define _SELF(s) (RVAL2GTKTEXTITER(s)) #define RVAL2ITER(self, position) rval2iter(self, position) static GtkTextIter * rval2iter(VALUE self, VALUE position) { if (!g_type_is_a(RVAL2GTYPE(position), GTK_TYPE_TEXT_ITER)) position = rb_funcall(rb_funcall(self, rb_intern("buffer"), 0), rb_intern("get_iter_at"), 1, position); return RVAL2GTKTEXTITER(position); } static VALUE rg_buffer(VALUE self) { return GOBJ2RVAL(gtk_text_iter_get_buffer(_SELF(self))); } static VALUE rg_offset(VALUE self) { return INT2NUM(gtk_text_iter_get_offset(_SELF(self))); } static VALUE rg_line(VALUE self) { return INT2NUM(gtk_text_iter_get_line(_SELF(self))); } static VALUE rg_line_offset(VALUE self) { return INT2NUM(gtk_text_iter_get_line_offset(_SELF(self))); } static VALUE rg_line_index(VALUE self) { return INT2NUM(gtk_text_iter_get_line_index(_SELF(self))); } static VALUE rg_visible_line_offset(VALUE self) { return INT2NUM(gtk_text_iter_get_visible_line_offset(_SELF(self))); } static VALUE rg_visible_line_index(VALUE self) { return INT2NUM(gtk_text_iter_get_visible_line_index(_SELF(self))); } static VALUE rg_char(VALUE self) { gchar buf[10]; gint len = g_unichar_to_utf8(gtk_text_iter_get_char(_SELF(self)), buf); buf[len] = '\0'; return CSTR2RVAL(buf); } static VALUE rg_get_slice(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_slice(_SELF(self), RVAL2ITER(self, rhs))); } static VALUE rg_get_text(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_text(_SELF(self), RVAL2ITER(self, rhs))); } static VALUE rg_get_visible_slice(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_visible_slice(_SELF(self), RVAL2ITER(self, rhs))); } static VALUE rg_get_visible_text(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_visible_text(_SELF(self), RVAL2ITER(self, rhs))); } static VALUE rg_pixbuf(VALUE self) { VALUE pixbuf = GOBJ2RVAL(gtk_text_iter_get_pixbuf(_SELF(self))); G_CHILD_SET(self, rb_intern("pixbuf"), pixbuf); return pixbuf; } static VALUE rg_marks(VALUE self) { /* need free? */ return GOBJGSLIST2RVAL_FREE(gtk_text_iter_get_marks(_SELF(self)), g_slist_free, NULL); } static VALUE rg_toggled_tags(VALUE self, VALUE toggled_on) { /* need free? */ return GOBJGSLIST2RVAL_FREE(gtk_text_iter_get_toggled_tags(_SELF(self), RVAL2CBOOL(toggled_on)), g_slist_free, NULL); } static VALUE rg_child_anchor(VALUE self) { return GOBJ2RVAL(gtk_text_iter_get_child_anchor(_SELF(self))); } static VALUE rg_begins_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_begins_tag(_SELF(self), RVAL2GTKTEXTTAG(tag))); } static VALUE rg_ends_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_ends_tag(_SELF(self), RVAL2GTKTEXTTAG(tag))); } static VALUE rg_toggles_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_toggles_tag(_SELF(self), RVAL2GTKTEXTTAG(tag))); } static VALUE rg_has_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_has_tag(_SELF(self), RVAL2GTKTEXTTAG(tag))); } static VALUE rg_tags(VALUE self) { return GOBJGSLIST2RVAL_FREE(gtk_text_iter_get_tags(_SELF(self)), g_slist_free, NULL); } static VALUE rg_editable_p(VALUE self, VALUE default_setting) { return CBOOL2RVAL(gtk_text_iter_editable(_SELF(self), RVAL2CBOOL(default_setting))); } static VALUE rg_can_insert_p(VALUE self, VALUE default_setting) { return CBOOL2RVAL(gtk_text_iter_can_insert(_SELF(self), RVAL2CBOOL(default_setting))); } static VALUE rg_starts_word_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_starts_word(_SELF(self))); } static VALUE rg_ends_word_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_ends_word(_SELF(self))); } static VALUE rg_inside_word_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_inside_word(_SELF(self))); } static VALUE rg_starts_sentence_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_starts_sentence(_SELF(self))); } static VALUE rg_ends_sentence_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_ends_sentence(_SELF(self))); } static VALUE rg_starts_line_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_starts_line(_SELF(self))); } static VALUE rg_ends_line_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_ends_line(_SELF(self))); } static VALUE rg_cursor_position_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_is_cursor_position(_SELF(self))); } static VALUE rg_chars_in_line(VALUE self) { return INT2NUM(gtk_text_iter_get_chars_in_line(_SELF(self))); } static VALUE rg_bytes_in_line(VALUE self) { return INT2NUM(gtk_text_iter_get_bytes_in_line(_SELF(self))); } static VALUE rg_attributes(VALUE self) { GtkTextAttributes attr; if(gtk_text_iter_get_attributes(_SELF(self), &attr) == TRUE){ return GTKTEXTATTRIBUTES2RVAL(&attr); } else { return Qnil; } } static VALUE rg_language(VALUE self) { return CSTR2RVAL(pango_language_to_string(gtk_text_iter_get_language(_SELF(self)))); } static VALUE rg_end_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_is_end(_SELF(self))); } static VALUE rg_start_p(VALUE self) { return CBOOL2RVAL(gtk_text_iter_is_start(_SELF(self))); } static VALUE rg_forward_char(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_char(_SELF(self))); } static VALUE rg_backward_char(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_char(_SELF(self))); } static VALUE rg_forward_chars(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_chars(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_chars(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_chars(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_line(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_line(_SELF(self))); } static VALUE rg_backward_line(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_line(_SELF(self))); } static VALUE rg_forward_lines(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_lines(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_lines(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_lines(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_word_end(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_word_end(_SELF(self))); } static VALUE rg_backward_word_start(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_word_start(_SELF(self))); } static VALUE rg_forward_word_ends(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_word_ends(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_word_starts(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_word_starts(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_sentence_end(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_sentence_end(_SELF(self))); } static VALUE rg_backward_sentence_start(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_sentence_start(_SELF(self))); } static VALUE rg_forward_sentence_ends(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_sentence_ends(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_sentence_starts(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_sentence_starts(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_visible_word_ends(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_visible_word_ends(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_visible_word_starts(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_visible_word_starts(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_visible_word_end(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_visible_word_end(_SELF(self))); } static VALUE rg_backward_visible_word_start(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_visible_word_start(_SELF(self))); } static VALUE rg_forward_visible_cursor_position(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_visible_cursor_position(_SELF(self))); } static VALUE rg_backward_visible_cursor_position(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_visible_cursor_position(_SELF(self))); } static VALUE rg_forward_visible_cursor_positions(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_visible_cursor_positions(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_visible_cursor_positions(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_visible_cursor_positions(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_visible_line(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_visible_line(_SELF(self))); } static VALUE rg_backward_visible_line(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_visible_line(_SELF(self))); } static VALUE rg_forward_visible_lines(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_visible_lines(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_visible_lines(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_visible_lines(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_cursor_position(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_cursor_position(_SELF(self))); } static VALUE rg_backward_cursor_position(VALUE self) { return CBOOL2RVAL(gtk_text_iter_backward_cursor_position(_SELF(self))); } static VALUE rg_forward_cursor_positions(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_forward_cursor_positions(_SELF(self), NUM2INT(i))); } static VALUE rg_backward_cursor_positions(VALUE self, VALUE i) { return CBOOL2RVAL(gtk_text_iter_backward_cursor_positions(_SELF(self), NUM2INT(i))); } static VALUE rg_forward_to_line_end(VALUE self) { return CBOOL2RVAL(gtk_text_iter_forward_to_line_end(_SELF(self))); } static VALUE rg_forward_to_end(VALUE self) { gtk_text_iter_forward_to_end(_SELF(self)); return self; } static VALUE rg_set_offset(VALUE self, VALUE val) { gtk_text_iter_set_offset(_SELF(self), NUM2INT(val)); return self; } static VALUE rg_set_line(VALUE self, VALUE val) { gtk_text_iter_set_line(_SELF(self), NUM2INT(val)); return self; } static VALUE rg_set_line_offset(VALUE self, VALUE val) { gtk_text_iter_set_line_offset(_SELF(self), NUM2INT(val)); return self; } static VALUE rg_set_line_index(VALUE self, VALUE val) { gtk_text_iter_set_line_index(_SELF(self), NUM2INT(val)); return self; } static VALUE rg_set_visible_line_offset(VALUE self, VALUE val) { gtk_text_iter_set_visible_line_offset(_SELF(self), NUM2INT(val)); return self; } static VALUE rg_set_visible_line_index(VALUE self, VALUE val) { gtk_text_iter_set_visible_line_index(_SELF(self), NUM2INT(val)); return self; } static VALUE rg_forward_to_tag_toggle(int argc, VALUE *argv, VALUE self) { VALUE tag; rb_scan_args(argc, argv, "01", &tag); return CBOOL2RVAL(gtk_text_iter_forward_to_tag_toggle(_SELF(self), NIL_P(tag) ? NULL : RVAL2GTKTEXTTAG(tag))); } static VALUE rg_backward_to_tag_toggle(int argc, VALUE *argv, VALUE self) { VALUE tag; rb_scan_args(argc, argv, "01", &tag); return CBOOL2RVAL(gtk_text_iter_backward_to_tag_toggle(_SELF(self), NIL_P(tag) ? NULL : RVAL2GTKTEXTTAG(tag))); } static gboolean char_predicate_func(guint32 ch, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 1, UINT2NUM(ch))); } static VALUE rg_forward_find_char(int argc, VALUE *argv, VALUE self) { VALUE limit; volatile VALUE func = rb_block_proc(); rb_scan_args(argc, argv, "01", &limit); return CBOOL2RVAL(gtk_text_iter_forward_find_char(_SELF(self), (GtkTextCharPredicate)char_predicate_func, (gpointer)func, NIL_P(limit) ? NULL : RVAL2ITER(self, limit))); } static VALUE rg_backward_find_char(int argc, VALUE *argv, VALUE self) { VALUE limit; volatile VALUE func = rb_block_proc(); rb_scan_args(argc, argv, "01", &limit); return CBOOL2RVAL(gtk_text_iter_backward_find_char(_SELF(self), (GtkTextCharPredicate)char_predicate_func, (gpointer)func, NIL_P(limit) ? NULL : RVAL2ITER(self, limit))); } static VALUE rg_forward_search(int argc, VALUE *argv, VALUE self) { GtkTextIter m_start, m_end; VALUE str, flags, limit; gboolean ret; rb_scan_args(argc, argv, "21", &str, &flags, &limit); ret = gtk_text_iter_forward_search(_SELF(self), RVAL2CSTR(str), RVAL2GTKTEXTSEARCHFLAGS(flags), &m_start, &m_end, NIL_P(limit) ? NULL : RVAL2ITER(self, limit)); return ret ? rb_ary_new3(2, GTKTEXTITER2RVAL(&m_start), GTKTEXTITER2RVAL(&m_end)) : Qnil; } static VALUE rg_backward_search(int argc, VALUE *argv, VALUE self) { GtkTextIter m_start, m_end; VALUE str, flags, limit; gboolean ret; rb_scan_args(argc, argv, "21", &str, &flags, &limit); ret = gtk_text_iter_backward_search(_SELF(self), RVAL2CSTR(str), RVAL2GTKTEXTSEARCHFLAGS(flags), &m_start, &m_end, NIL_P(limit) ? NULL : RVAL2ITER(self, limit)); return ret ? rb_ary_new3(2, GTKTEXTITER2RVAL(&m_start), GTKTEXTITER2RVAL(&m_end)) : Qnil; } static VALUE rg_operator_equal(VALUE self, VALUE other) { return CBOOL2RVAL(gtk_text_iter_equal(_SELF(self), RVAL2ITER(self, other))); } static VALUE rg_operator_compare(VALUE self, VALUE rhs) { return INT2NUM(gtk_text_iter_compare(_SELF(self), RVAL2ITER(self, rhs))); } static VALUE rg_inside_sentence(VALUE self) { return CBOOL2RVAL(gtk_text_iter_inside_sentence(_SELF(self))); } void Init_gtk_textiter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_ITER, "TextIter", mGtk); rb_include_module(RG_TARGET_NAMESPACE, rb_mComparable); RG_DEF_METHOD(buffer, 0); RG_DEF_METHOD(offset, 0); RG_DEF_METHOD(line, 0); RG_DEF_METHOD(line_offset, 0); RG_DEF_METHOD(line_index, 0); RG_DEF_METHOD(visible_line_offset, 0); RG_DEF_METHOD(visible_line_index, 0); RG_DEF_METHOD(char, 0); RG_DEF_METHOD(get_slice, 1); RG_DEF_METHOD(get_text, 1); RG_DEF_METHOD(get_visible_slice, 1); RG_DEF_METHOD(get_visible_text, 1); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(marks, 0); RG_DEF_METHOD(child_anchor, 0); RG_DEF_METHOD(toggled_tags, 1); RG_DEF_METHOD_P(begins_tag, 1); RG_DEF_METHOD_P(ends_tag, 1); RG_DEF_METHOD_P(toggles_tag, 1); RG_DEF_METHOD_P(has_tag, 1); RG_DEF_METHOD(tags, 0); RG_DEF_METHOD_P(editable, 1); RG_DEF_METHOD_P(can_insert, 1); RG_DEF_METHOD_P(starts_word, 0); RG_DEF_METHOD_P(ends_word, 0); RG_DEF_METHOD_P(inside_word, 0); RG_DEF_METHOD_P(starts_sentence, 0); RG_DEF_METHOD_P(ends_sentence, 0); RG_DEF_METHOD_P(starts_line, 0); RG_DEF_METHOD_P(ends_line, 0); RG_DEF_METHOD_P(cursor_position, 0); RG_DEF_METHOD(chars_in_line, 0); RG_DEF_METHOD(bytes_in_line, 0); RG_DEF_METHOD(attributes, 0); RG_DEF_METHOD(language, 0); RG_DEF_METHOD_P(end, 0); RG_DEF_METHOD_P(start, 0); RG_DEF_METHOD(forward_char, 0); RG_DEF_METHOD(backward_char, 0); RG_DEF_METHOD(forward_chars, 1); RG_DEF_METHOD(backward_chars, 1); RG_DEF_METHOD(forward_line, 0); RG_DEF_METHOD(backward_line, 0); RG_DEF_METHOD(forward_lines, 1); RG_DEF_METHOD(backward_lines, 1); RG_DEF_METHOD(forward_word_end, 0); RG_DEF_METHOD(backward_word_start, 0); RG_DEF_METHOD(forward_word_ends, 1); RG_DEF_METHOD(backward_word_starts, 1); RG_DEF_METHOD(forward_sentence_end, 0); RG_DEF_METHOD(backward_sentence_start, 0); RG_DEF_METHOD(forward_sentence_ends, 1); RG_DEF_METHOD(backward_sentence_starts, 1); RG_DEF_METHOD(forward_visible_word_ends, 1); RG_DEF_METHOD(backward_visible_word_starts, 1); RG_DEF_METHOD(forward_visible_word_end, 0); RG_DEF_METHOD(backward_visible_word_start, 0); RG_DEF_METHOD(forward_visible_cursor_position, 0); RG_DEF_METHOD(backward_visible_cursor_position, 0); RG_DEF_METHOD(forward_visible_cursor_positions, 1); RG_DEF_METHOD(backward_visible_cursor_positions, 1); RG_DEF_METHOD(forward_visible_line, 0); RG_DEF_METHOD(backward_visible_line, 0); RG_DEF_METHOD(forward_visible_lines, 1); RG_DEF_METHOD(backward_visible_lines, 1); RG_DEF_METHOD(forward_cursor_position, 0); RG_DEF_METHOD(backward_cursor_position, 0); RG_DEF_METHOD(forward_cursor_positions, 1); RG_DEF_METHOD(backward_cursor_positions, 1); RG_DEF_METHOD(forward_to_end, 0); RG_DEF_METHOD(forward_to_line_end, 0); RG_DEF_METHOD(set_offset, 1); RG_DEF_METHOD(set_line, 1); RG_DEF_METHOD(set_line_offset, 1); RG_DEF_METHOD(set_line_index, 1); RG_DEF_METHOD(set_visible_line_offset, 1); RG_DEF_METHOD(set_visible_line_index, 1); RG_DEF_METHOD(forward_to_tag_toggle, -1); RG_DEF_METHOD(backward_to_tag_toggle, -1); RG_DEF_METHOD(forward_find_char, -1); RG_DEF_METHOD(backward_find_char, -1); RG_DEF_METHOD(forward_search, -1); RG_DEF_METHOD(backward_search, -1); RG_DEF_METHOD_OPERATOR("==", equal, 1); RG_DEF_METHOD_OPERATOR("<=>", compare, 1); RG_DEF_METHOD(inside_sentence, 0); G_DEF_CLASS(GTK_TYPE_TEXT_SEARCH_FLAGS, "SearchFlags", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-list-store.c0000644000175000017500000002413212516434313020516 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cListStore #define _SELF(s) (RVAL2GTKLISTSTORE(s)) static ID id_to_a, id_size; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { gint cnt; GtkListStore* store; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } store = gtk_list_store_newv(argc, buf); G_INITIALIZE(self, store); return Qnil; } static VALUE rg_set_column_types(int argc, VALUE *argv, VALUE self) { gint cnt; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } gtk_list_store_set_column_types(_SELF(self), argc, buf); return self; } static VALUE rg_set_value(VALUE self, VALUE iter, VALUE column, VALUE value) { GType gtype = gtk_tree_model_get_column_type(RVAL2GTKTREEMODEL(self), NUM2INT(column)); GValue gval = G_VALUE_INIT; g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(value, &gval); G_CHILD_ADD(iter, value); gtk_list_store_set_value(_SELF(self), RVAL2GTKTREEITER(iter), NUM2INT(column), &gval); g_value_unset(&gval); return self; } typedef struct _ValuesInfo { gint i; VALUE iter; GtkTreeModel *model; gint *g_columns; GValue *g_values; } ValuesInfo; static int collect_value(VALUE key, VALUE value, ValuesInfo *info) { GType g_type; gint column; column = NUM2INT(key); info->g_columns[info->i] = column; g_type = gtk_tree_model_get_column_type(info->model, column); g_value_init(&(info->g_values[info->i]), g_type); rbgobj_rvalue_to_gvalue(value, &(info->g_values[info->i])); G_CHILD_ADD(info->iter, value); info->i++; return ST_CONTINUE; } static void hash_to_values(VALUE hash, VALUE iter, GtkTreeModel *model, gint *g_columns, GValue *g_values, G_GNUC_UNUSED gint length) { ValuesInfo info; info.i = 0; info.iter = iter; info.model = model; info.g_columns = g_columns; info.g_values = g_values; rb_hash_foreach(hash, collect_value, (VALUE)(&info)); } static void array_to_values(VALUE array, VALUE iter, GtkTreeModel *model, gint *g_columns, GValue *g_values, gint length) { gint i; for (i = 0; i < length; i++) { GType g_type; g_columns[i] = i; g_type = gtk_tree_model_get_column_type(model, i); g_value_init(&g_values[i], g_type); rbgobj_rvalue_to_gvalue(RARRAY_PTR(array)[i], &g_values[i]); G_CHILD_ADD(iter, RARRAY_PTR(array)[i]); } } static VALUE rg_set_values(VALUE self, VALUE iter, VALUE values) { GValue *g_values; GtkListStore *store; GtkTreeModel *model; gint *g_columns; gint i, length; length = NUM2INT(rb_funcall(values, id_size, 0)); if (length == 0) return self; g_columns = ALLOCA_N(gint, length); g_values = ALLOCA_N(GValue, length); MEMZERO(g_values, GValue, length); store = _SELF(self); model = GTK_TREE_MODEL(store); if (RVAL2CBOOL(rb_obj_is_kind_of(values, rb_cHash))) { hash_to_values(values, iter, model, g_columns, g_values, length); } else if (RVAL2CBOOL(rb_obj_is_kind_of(values, rb_cArray))) { array_to_values(values, iter, model, g_columns, g_values, length); } else { rb_raise(rb_eArgError, "must be array or hash of values"); } gtk_list_store_set_valuesv(store, RVAL2GTKTREEITER(iter), g_columns, g_values, length); for (i = 0; i < length; i++) g_value_unset(&g_values[i]); return self; } static VALUE rg_remove(VALUE self, VALUE iter) { G_CHILD_REMOVE(self, iter); return CBOOL2RVAL(gtk_list_store_remove(_SELF(self), RVAL2GTKTREEITER(iter))); } struct lstore_insert_args { GtkListStore *store; GtkTreeIter iter; gint position; VALUE ary; long i; long n; gint *columns; GValue *values; }; static VALUE lstore_insert_body(VALUE value) { struct lstore_insert_args *args = (struct lstore_insert_args *)value; GtkTreeModel *model = GTK_TREE_MODEL(args->store); for (args->i = 0; args->i < args->n; args->i++) { VALUE ary = rb_ary_to_ary(RARRAY_PTR(args->ary)[args->i]); args->columns[args->i] = NUM2INT(RARRAY_PTR(ary)[1]); g_value_init(&args->values[args->i], gtk_tree_model_get_column_type(model, args->columns[args->i])); rbgobj_rvalue_to_gvalue(RARRAY_PTR(ary)[0], &args->values[args->i]); } gtk_list_store_insert_with_valuesv(args->store, &args->iter, args->position, args->columns, args->values, args->n); return Qnil; } static VALUE lstore_insert_ensure(VALUE value) { long i; struct lstore_insert_args *args = (struct lstore_insert_args *)value; for (i = 0; i < args->i; i++) g_value_unset(&args->values[i]); g_free(args->values); g_free(args->columns); return Qnil; } /* Gtk::ListStore#insert(pos, val1 => 0, val2 => 2, ... ) */ static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { VALUE position, values, result; struct lstore_insert_args args; args.store = _SELF(self); rb_scan_args(argc, argv, "11", &position, &values); args.position = NUM2INT(position); if (NIL_P(values)){ gtk_list_store_insert(args.store, &args.iter, args.position); } else { args.ary = rb_funcall(values, id_to_a, 0); args.n = RARRAY_LEN(args.ary); args.columns = g_new(gint, args.n); args.values = g_new0(GValue, args.n); rb_ensure(lstore_insert_body, (VALUE)&args, lstore_insert_ensure, (VALUE)&args); } args.iter.user_data3 = args.store; result = GTKTREEITER2RVAL(&args.iter); return result; } static VALUE rg_insert_before(VALUE self, VALUE sibling) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_insert_before(model, &iter, NIL_P(sibling) ? NULL : RVAL2GTKTREEITER(sibling)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_insert_after(VALUE self, VALUE sibling) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_insert_after(model, &iter, NIL_P(sibling) ? NULL : RVAL2GTKTREEITER(sibling)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_prepend(VALUE self) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_prepend(model, &iter); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_append(VALUE self) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_append(model, &iter); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_clear(VALUE self) { G_CHILD_REMOVE_ALL(self); gtk_list_store_clear(_SELF(self)); return self; } static VALUE rg_iter_is_valid_p(VALUE self, VALUE iter) { return (NIL_P(iter)) ? Qfalse : CBOOL2RVAL(gtk_list_store_iter_is_valid(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_reorder(VALUE self, VALUE rbnew_order) { GtkListStore *store = _SELF(self); long n; gint *new_order = RVAL2GINTS(rbnew_order, n); gtk_list_store_reorder(store, new_order); g_free(new_order); return self; } static VALUE rg_swap(VALUE self, VALUE iter1, VALUE iter2) { gtk_list_store_swap(_SELF(self), RVAL2GTKTREEITER(iter1), RVAL2GTKTREEITER(iter2)); return self; } static VALUE rg_move_before(VALUE self, VALUE iter, VALUE position) { gtk_list_store_move_before(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; } static VALUE rg_move_after(VALUE self, VALUE iter, VALUE position) { gtk_list_store_move_after(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; } void Init_gtk_list_store(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LIST_STORE, "ListStore", mGtk); id_to_a = rb_intern("to_a"); id_size = rb_intern("size"); rbgtk_register_treeiter_set_value_func(GTK_TYPE_LIST_STORE, (rbgtkiter_set_value_func)>k_list_store_set_value); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_column_types, -1); RG_DEF_METHOD(set_value, 3); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(insert, -1); RG_DEF_METHOD(insert_before, 1); RG_DEF_METHOD(insert_after, 1); RG_DEF_METHOD(prepend, 0); RG_DEF_METHOD(append, 0); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD_P(iter_is_valid, 1); RG_DEF_METHOD(reorder, 1); RG_DEF_METHOD(swap, 2); RG_DEF_METHOD(move_before, 2); RG_DEF_METHOD(move_after, 2); RG_DEF_METHOD(set_values, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-app-chooser.c0000644000175000017500000000257012516434313020633 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mAppChooser #define _SELF(self) (RVAL2GTKAPPCHOOSER(self)) static VALUE rg_app_info(VALUE self) { return GOBJ2RVAL_UNREF(gtk_app_chooser_get_app_info(_SELF(self))); } static VALUE rg_refresh(VALUE self) { gtk_app_chooser_refresh(_SELF(self)); return self; } void Init_gtk_appchooser(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_APP_CHOOSER, "AppChooser", mGtk); RG_DEF_METHOD(app_info, 0); RG_DEF_METHOD(refresh, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-ui-manager.c0000644000175000017500000001266512516434313020446 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cUIManager #define _SELF(self) (RVAL2GTKUIMANAGER(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_ui_manager_new()); return Qnil; } static VALUE rg_insert_action_group(VALUE self, VALUE action_group, VALUE pos) { gtk_ui_manager_insert_action_group(_SELF(self), RVAL2GTKACTIONGROUP(action_group), NUM2INT(pos)); G_CHILD_ADD(self, action_group); return self; } static VALUE rg_remove_action_group(VALUE self, VALUE action_group) { gtk_ui_manager_remove_action_group(_SELF(self), RVAL2GTKACTIONGROUP(action_group)); G_CHILD_REMOVE(self, action_group); return self; } static VALUE rg_action_groups(VALUE self) { return GOBJGLIST2RVAL(gtk_ui_manager_get_action_groups(_SELF(self))); } static VALUE rg_accel_group(VALUE self) { return GOBJ2RVAL(gtk_ui_manager_get_accel_group(_SELF(self))); } static VALUE rg_get_widget(VALUE self, VALUE path) { GtkWidget* widget = gtk_ui_manager_get_widget(_SELF(self), RVAL2CSTR(path)); if (! widget) rb_raise(rb_eArgError, "no widget was found."); return GOBJ2RVAL(widget); } static VALUE rg_get_toplevels(VALUE self, VALUE types) { return GOBJGSLIST2RVAL_FREE(gtk_ui_manager_get_toplevels(_SELF(self), RVAL2GTKUIMANAGERITEMTYPE(types)), g_slist_free, NULL); } static VALUE rg_get_action(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_ui_manager_get_action(_SELF(self), RVAL2CSTR(path))); } static VALUE rg_add_ui(int argc, VALUE *argv, VALUE self) { GError* error = NULL; guint ret; VALUE buffer; if (argc == 1) { VALUE buffer_or_filename; rb_scan_args(argc, argv, "10", &buffer_or_filename); StringValue(buffer_or_filename); buffer = rb_funcall(buffer_or_filename, rb_intern("include?"), 1, CSTR2RVAL("")); if (RVAL2CBOOL(buffer)){ StringValue(buffer_or_filename); ret = gtk_ui_manager_add_ui_from_string(_SELF(self), RSTRING_PTR(buffer_or_filename), RSTRING_LEN(buffer_or_filename), &error); } else { ret = gtk_ui_manager_add_ui_from_file(_SELF(self), RVAL2CSTR(buffer_or_filename), &error); } } else { VALUE merge_id, path, name, action, type, top; rb_scan_args(argc, argv, "60", &merge_id, &path, &name, &action, &type, &top); ret = NUM2UINT(merge_id); gtk_ui_manager_add_ui(_SELF(self), ret, RVAL2CSTR(path), RVAL2CSTR(name), RVAL2CSTR(action), RVAL2GTKUIMANAGERITEMTYPE(type), RVAL2CBOOL(top)); } if (ret == 0) RAISE_GERROR(error); return UINT2NUM(ret); } static VALUE rg_new_merge_id(VALUE self) { return UINT2NUM(gtk_ui_manager_new_merge_id(_SELF(self))); } static VALUE rg_remove_ui(VALUE self, VALUE merge_id) { gtk_ui_manager_remove_ui(_SELF(self), NUM2UINT(merge_id)); return self; } static VALUE rg_ensure_update(VALUE self) { gtk_ui_manager_ensure_update(_SELF(self)); return self; } static void rbuimanager_mark(void *p) { GtkUIManager *manager; GList *node; manager = GTK_UI_MANAGER(p); for (node = gtk_ui_manager_get_action_groups(manager); node; node = g_list_next(node)) { GtkWidget *action_group = node->data; rbgobj_gc_mark_instance(action_group); } rbgobj_gc_mark_instance(gtk_ui_manager_get_accel_group(manager)); } void Init_gtk_uimanager(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(GTK_TYPE_UI_MANAGER, "UIManager", mGtk, rbuimanager_mark, NULL); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(insert_action_group, 2); RG_DEF_METHOD(remove_action_group, 1); RG_DEF_METHOD(action_groups, 0); RG_DEF_METHOD(accel_group, 0); RG_DEF_METHOD(get_widget, 1); RG_DEF_ALIAS("[]", "get_widget"); RG_DEF_METHOD(get_toplevels, 1); RG_DEF_METHOD(get_action, 1); RG_DEF_METHOD(add_ui, -1); RG_DEF_METHOD(new_merge_id, 0); RG_DEF_METHOD(remove_ui, 1); RG_DEF_METHOD(ensure_update, 0); G_DEF_CLASS(GTK_TYPE_UI_MANAGER_ITEM_TYPE, "ItemType", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-modelfilter.c0000644000175000017500000001354312516434313021660 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTreeModelFilter #define _SELF(s) (RVAL2GTKTREEMODELFILTER(s)) static ID id_child_model; static ID id_root; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE child_model, root; GtkTreeModel* widget; rb_scan_args(argc, argv, "11", &child_model, &root); G_CHILD_SET(self, id_child_model, child_model); if (NIL_P(root)){ widget = gtk_tree_model_filter_new(RVAL2GTKTREEMODEL(child_model), (GtkTreePath*)NULL); } else { G_CHILD_SET(self, id_root, root); widget = gtk_tree_model_filter_new(RVAL2GTKTREEMODEL(child_model), (GtkTreePath*)RVAL2GTKTREEPATH(root)); } G_INITIALIZE(self, widget); return Qnil; } static gboolean visible_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { VALUE ret; iter->user_data3 = model; ret = rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); return RVAL2CBOOL(ret); } static VALUE rg_set_visible_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_model_filter_set_visible_func(_SELF(self), (GtkTreeModelFilterVisibleFunc)visible_func, (gpointer)func, NULL); return self; } static void modify_func(GtkTreeModel *model, GtkTreeIter *iter, GValue *value, gint column, gpointer func) { VALUE ret; iter->user_data3 = model; ret = rb_funcall((VALUE)func, id_call, 3, GOBJ2RVAL(model), GTKTREEITER2RVAL(iter), INT2NUM(column)); rbgobj_rvalue_to_gvalue(ret, value); } /* * Should return value * * e.g. * filter.set_modify_func(String) do |model, iter, column| * "foo" * end */ static VALUE rg_set_modify_func(int argc, VALUE *argv, VALUE self) { VALUE func = rb_block_proc(); gint i; GType* types; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); types = ALLOCA_N(GType, argc); G_RELATIVE(self, func); for (i = 0; i < argc; i++){ types[i] = CLASS2GTYPE(argv[i]); } gtk_tree_model_filter_set_modify_func(_SELF(self), argc, types, (GtkTreeModelFilterModifyFunc)modify_func, (gpointer)func, NULL); return self; } static VALUE rg_set_visible_column(VALUE self, VALUE column) { gtk_tree_model_filter_set_visible_column(_SELF(self), NUM2INT(column)); return self; } static VALUE rg_model(VALUE self) { return GOBJ2RVAL(gtk_tree_model_filter_get_model(_SELF(self))); } static VALUE rg_convert_child_iter_to_iter(VALUE self, VALUE child_iter) { GtkTreeIter filter_iter; GtkTreeModelFilter* modelfilter = _SELF(self); gtk_tree_model_filter_convert_child_iter_to_iter(modelfilter, &filter_iter, RVAL2GTKTREEITER(child_iter)); filter_iter.user_data3 = gtk_tree_model_filter_get_model(modelfilter); return GTKTREEITER2RVAL(&filter_iter); } static VALUE rg_convert_iter_to_child_iter(VALUE self, VALUE filtered_iter) { GtkTreeIter child_iter; GtkTreeModelFilter* modelfilter = _SELF(self); gtk_tree_model_filter_convert_iter_to_child_iter(modelfilter, &child_iter, RVAL2GTKTREEITER(filtered_iter)); child_iter.user_data3 = gtk_tree_model_filter_get_model(modelfilter); return GTKTREEITER2RVAL(&child_iter); } static VALUE rg_convert_child_path_to_path(VALUE self, VALUE child_path) { return GTKTREEPATH2RVAL(gtk_tree_model_filter_convert_child_path_to_path( _SELF(self), RVAL2GTKTREEPATH(child_path))); } static VALUE rg_convert_path_to_child_path(VALUE self, VALUE filter_path) { return GTKTREEPATH2RVAL(gtk_tree_model_filter_convert_path_to_child_path( _SELF(self), RVAL2GTKTREEPATH(filter_path))); } static VALUE rg_refilter(VALUE self) { gtk_tree_model_filter_refilter(_SELF(self)); return self; } static VALUE rg_clear_cache(VALUE self) { gtk_tree_model_filter_clear_cache(_SELF(self)); return self; } void Init_gtk_treemodelfilter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_MODEL_FILTER, "TreeModelFilter", mGtk); id_child_model = rb_intern("child_model"); id_root = rb_intern("root"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_visible_func, 0); RG_DEF_METHOD(set_modify_func, -1); RG_DEF_METHOD(set_visible_column, 1); RG_DEF_METHOD(model, 0); RG_DEF_METHOD(convert_child_iter_to_iter, 1); RG_DEF_METHOD(convert_iter_to_child_iter, 1); RG_DEF_METHOD(convert_child_path_to_path, 1); RG_DEF_METHOD(convert_path_to_child_path, 1); RG_DEF_METHOD(refilter, 0); RG_DEF_METHOD(clear_cache, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tool-button.c0000644000175000017500000000416612516434313020704 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cToolButton #define _SELF(self) (RVAL2GTKTOOLBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg; GtkToolItem *item = NULL; rb_scan_args(argc, argv, "01", &arg); if (NIL_P(arg)) { item = gtk_tool_button_new(NULL, NULL); } else if (TYPE(arg) == T_HASH) { VALUE icon_widget, label, stock_id, buffer; rbg_scan_options(arg, "icon_widget", &icon_widget, "label", &label, "stock_id", &stock_id, NULL); if (!NIL_P(icon_widget)) item = gtk_tool_button_new(RVAL2GTKWIDGET(icon_widget), RVAL2CSTR_ACCEPT_NIL(label)); else if (!NIL_P(stock_id)) item = gtk_tool_button_new_from_stock(RVAL2GLIBID(stock_id, buffer)); } if (!item) rb_raise(rb_eArgError, "Invalid arguments."); RBGTK_INITIALIZE(self, item); return Qnil; } void Init_gtk_toolbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOL_BUTTON, "ToolButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_REG_GLIBID_SETTER("stock-id"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-theming-engine.c0000644000175000017500000001456212516434313021315 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cThemingEngine #define _SELF(self) (RVAL2GTKTHEMINGENGINE(self)) static VALUE rg_s_load(G_GNUC_UNUSED VALUE self, VALUE name) { return GOBJ2RVAL(gtk_theming_engine_load(RVAL2CSTR(name))); } static VALUE rg_get_background_color(VALUE self, VALUE state) { GdkRGBA color; gtk_theming_engine_get_background_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), &color); return GDKRGBA2RVAL(&color); } static VALUE rg_get_border(VALUE self, VALUE state) { GtkBorder border; gtk_theming_engine_get_border(_SELF(self), RVAL2GTKSTATEFLAGS(state), &border); return GTKBORDER2RVAL(&border); } static VALUE rg_get_border_color(VALUE self, VALUE state) { GdkRGBA color; gtk_theming_engine_get_border_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), &color); return GDKRGBA2RVAL(&color); } static VALUE rg_get_color(VALUE self, VALUE state) { GdkRGBA color; gtk_theming_engine_get_color(_SELF(self), RVAL2GTKSTATEFLAGS(state), &color); return GDKRGBA2RVAL(&color); } static VALUE rg_direction(VALUE self) { GtkTextDirection direction; direction = gtk_theming_engine_get_direction(_SELF(self)); return GTKTEXTDIRECTION2RVAL(direction); } static VALUE rg_get_font(VALUE self, VALUE state) { PangoFontDescription *desc; desc = gtk_theming_engine_get_font(_SELF(self), RVAL2GTKSTATEFLAGS(state)); return PANGOFONTDESCRIPTION2RVAL(desc); } static VALUE rg_junction_sides(VALUE self) { GtkJunctionSides sides; sides = gtk_theming_engine_get_junction_sides(_SELF(self)); return GTKJUNCTIONSIDES2RVAL(sides); } static VALUE rg_get_margin(VALUE self, VALUE state) { GtkBorder margin; gtk_theming_engine_get_margin(_SELF(self), RVAL2GTKSTATEFLAGS(state), &margin); return GTKBORDER2RVAL(&margin); } static VALUE rg_get_padding(VALUE self, VALUE state) { GtkBorder padding; gtk_theming_engine_get_padding(_SELF(self), RVAL2GTKSTATEFLAGS(state), &padding); return GTKBORDER2RVAL(&padding); } static VALUE rg_path(VALUE self) { return GTKWIDGETPATH2RVAL(gtk_theming_engine_get_path(_SELF(self))); } static VALUE rg_get_property(VALUE self, VALUE property, VALUE state) { GValue value = G_VALUE_INIT; VALUE ret = Qnil; gtk_theming_engine_get_property(_SELF(self), RVAL2CSTR(property), RVAL2GTKSTATEFLAGS(state), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static VALUE rg_screen(VALUE self) { return GOBJ2RVAL(gtk_theming_engine_get_screen(_SELF(self))); } static VALUE rg_state(VALUE self) { GtkStateFlags state; state = gtk_theming_engine_get_state(_SELF(self)); return GTKSTATEFLAGS2RVAL(state); } static VALUE rg_get_style_property(VALUE self, VALUE property_name) { GValue value = G_VALUE_INIT; VALUE ret = Qnil; gtk_theming_engine_get_style_property(_SELF(self), RVAL2CSTR(property_name), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static VALUE rg_has_class_p(VALUE self, VALUE style_class) { return CBOOL2RVAL(gtk_theming_engine_has_class(_SELF(self), RVAL2CSTR(style_class))); } static VALUE rg_has_region(VALUE self, VALUE style_region) { GtkRegionFlags flags; gboolean result; result = gtk_theming_engine_has_region(_SELF(self), RVAL2CSTR(style_region), &flags); return result ? GTKREGIONFLAGS2RVAL(flags) : Qnil; } static VALUE rg_lookup_color(VALUE self, VALUE color_name) { GdkRGBA color; gboolean result; result = gtk_theming_engine_lookup_color(_SELF(self), RVAL2CSTR(color_name), &color); return result ? GDKRGBA2RVAL(&color) : Qnil; } static VALUE rg_state_is_running(VALUE self, VALUE state) { gdouble progress; gboolean result; result = gtk_theming_engine_state_is_running(_SELF(self), RVAL2GTKSTATEFLAGS(state), &progress); return result ? DBL2NUM(progress) : Qnil; } void Init_gtk_themingengine(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_THEMING_ENGINE, "ThemingEngine", mGtk); RG_DEF_SMETHOD(load, 1); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD(get_background_color, 1); RG_DEF_METHOD(get_border, 1); RG_DEF_METHOD(get_border_color, 1); RG_DEF_METHOD(get_color, 1); RG_DEF_METHOD(get_font, 1); RG_DEF_METHOD(get_margin, 1); RG_DEF_METHOD(get_padding, 1); RG_DEF_METHOD(get_property, 2); RG_DEF_METHOD(get_style_property, 1); RG_DEF_METHOD_P(has_class, 1); RG_DEF_METHOD(has_region, 1); RG_DEF_METHOD(junction_sides, 0); RG_DEF_METHOD(lookup_color, 1); RG_DEF_METHOD(path, 0); RG_DEF_METHOD(screen, 0); RG_DEF_METHOD(state, 0); RG_DEF_METHOD(state_is_running, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-print-settings.c0000644000175000017500000005427412516434313021415 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPrintSettings #define _SELF(s) (RVAL2GTKPRINTSETTINGS(s)) static VALUE s_string, s_bool, s_double, s_length, s_int; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GtkPrintSettings* settings = NULL; GError *error = NULL; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (NIL_P(arg1)){ settings = gtk_print_settings_new(); } else if (NIL_P(arg2)){ settings = gtk_print_settings_new_from_file(RVAL2CSTR(arg1), &error); if (!settings) { RAISE_GERROR(error); } } else { settings = gtk_print_settings_new_from_key_file(RVAL2GKEYFILE(arg1), RVAL2CSTR(arg2), &error); if (!settings) { RAISE_GERROR(error); } } G_INITIALIZE(self, settings); return Qnil; } static VALUE rg_dup(VALUE self) { return GOBJ2RVALU(gtk_print_settings_copy(_SELF(self))); } static VALUE rg_has_key_p(VALUE self, VALUE key) { return CBOOL2RVAL(gtk_print_settings_has_key(_SELF(self), RVAL2CSTR(key))); } static VALUE ps_get(VALUE self, VALUE key) { return CSTR2RVAL(gtk_print_settings_get(_SELF(self), RVAL2CSTR(key))); } static VALUE ps_set(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set(_SELF(self), RVAL2CSTR(key), RVAL2CSTR_ACCEPT_NIL(value)); return self; } static VALUE rg_unset(VALUE self, VALUE key) { gtk_print_settings_unset(_SELF(self), RVAL2CSTR(key)); return self; } static void ps_foreach_cb(const gchar *key, const gchar *value, gpointer data) { rb_funcall((VALUE)data, id_call, 2, CSTR2RVAL(key), CSTR2RVAL(value)); } static VALUE rg_each(VALUE self) { gtk_print_settings_foreach(_SELF(self), ps_foreach_cb, (gpointer)rb_block_proc()); return self; } static VALUE rg_get_bool(VALUE self, VALUE key) { return CBOOL2RVAL(gtk_print_settings_get_bool(_SELF(self), RVAL2CSTR(key))); } static VALUE ps_set_bool(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set_bool(_SELF(self), RVAL2CSTR(key), RVAL2CBOOL(value)); return self; } static VALUE rg_get_double(int argc, VALUE *argv, VALUE self) { VALUE key, default_value; gdouble value; rb_scan_args(argc, argv, "11", &key, &default_value); if (NIL_P(default_value)) value = gtk_print_settings_get_double(_SELF(self), RVAL2CSTR(key)); else value = gtk_print_settings_get_double_with_default(_SELF(self), RVAL2CSTR(key), NUM2DBL(default_value)); return rb_float_new(value); } static VALUE ps_set_double(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set_double(_SELF(self), RVAL2CSTR(key), NUM2DBL(value)); return self; } static VALUE rg_get_length(VALUE self, VALUE key, VALUE unit) { return rb_float_new(gtk_print_settings_get_length(_SELF(self), RVAL2CSTR(key), RVAL2GTKUNIT(unit))); } static VALUE ps_set_length(VALUE self, VALUE key, VALUE value, VALUE unit) { gtk_print_settings_set_length(_SELF(self), RVAL2CSTR(key), NUM2DBL(value), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_get_int(int argc, VALUE *argv, VALUE self) { VALUE key, default_value; gint value; rb_scan_args(argc, argv, "11", &key, &default_value); if (NIL_P(default_value)) value = gtk_print_settings_get_int(_SELF(self), RVAL2CSTR(key)); else value = gtk_print_settings_get_int_with_default(_SELF(self), RVAL2CSTR(key), NUM2INT(default_value)); return INT2NUM(value); } static VALUE ps_set_int(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set_int(_SELF(self), RVAL2CSTR(key), NUM2INT(value)); return self; } static VALUE rg_get(int argc, VALUE *argv, VALUE self) { VALUE key, type, unit_or_default, result; rb_scan_args(argc, argv, "12", &key, &type, &unit_or_default); if (NIL_P(type) || (RVAL2CBOOL(rb_equal(type, s_string)))) { result = ps_get(self, key); } else if (RVAL2CBOOL(rb_equal(type, s_bool))) { result = rg_get_bool(self, key); } else if (RVAL2CBOOL(rb_equal(type, s_double))) { VALUE double_argv[2]; double_argv[0] = key; double_argv[1] = unit_or_default; result = rg_get_double(2, double_argv, self); } else if (RVAL2CBOOL(rb_equal(type, s_length))) { result = rg_get_length(self, key, unit_or_default); } else if (RVAL2CBOOL(rb_equal(type, s_int))) { VALUE int_argv[2]; int_argv[0] = key; int_argv[1] = unit_or_default; result = rg_get_int(2, int_argv, self); } else { VALUE inspected_type; inspected_type = rb_inspect(type); rb_raise(rb_eArgError, "%s must be nil, :string, :bool, :double, :length or :int", RVAL2CSTR(inspected_type)); } return result; } static VALUE rg_set(int argc, VALUE *argv, VALUE self) { VALUE key, value, unit; rb_scan_args(argc, argv, "21", &key, &value, &unit); switch (TYPE(value)) { case T_STRING: ps_set(self, key, value); break; case T_TRUE: case T_FALSE: ps_set_bool(self, key, value); break; case T_FIXNUM: ps_set_int(self, key, value); break; case T_FLOAT: if (NIL_P(unit)) { ps_set_double(self, key, value); } else { ps_set_length(self, key, value, unit); } break; case T_NIL: rg_unset(self, key); break; default: { VALUE inspected_value; inspected_value = rb_inspect(value); rb_raise(rb_eArgError, "%s is invalid value", RVAL2CSTR(inspected_value)); break; } } return self; } static VALUE rg_operator_ps_set_generic_indexer(int argc, VALUE *argv, VALUE self) { if (argc == 3) { VALUE swapped_argv[3]; swapped_argv[0] = argv[0]; swapped_argv[1] = argv[2]; swapped_argv[2] = argv[1]; rg_set(argc, swapped_argv, self); } else if (argc == 2) { rg_set(argc, argv, self); } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc); } return argv[2]; } /* Helpers: */ static VALUE rg_printer(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_printer(_SELF(self))); } static VALUE rg_set_printer(VALUE self, VALUE printer) { gtk_print_settings_set_printer(_SELF(self), RVAL2CSTR_ACCEPT_NIL(printer)); return self; } static VALUE rg_orientation(VALUE self) { return GTKPAGEORIENTATION2RVAL(gtk_print_settings_get_orientation(_SELF(self))); } static VALUE rg_set_orientation(VALUE self, VALUE orientation) { gtk_print_settings_set_orientation(_SELF(self), RVAL2GTKPAGEORIENTATION(orientation)); return self; } static VALUE rg_paper_size(VALUE self) { return GOBJ2RVAL(gtk_print_settings_get_paper_size(_SELF(self))); } static VALUE rg_set_paper_size(VALUE self, VALUE paper_size) { gtk_print_settings_set_paper_size(_SELF(self), RVAL2GTKPAPERSIZE(paper_size)); return self; } static VALUE rg_paper_width(VALUE self, VALUE unit) { return rb_float_new(gtk_print_settings_get_paper_width(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_set_paper_width(VALUE self, VALUE paper_width, VALUE unit) { gtk_print_settings_set_paper_width(_SELF(self), NUM2DBL(paper_width), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_paper_height(VALUE self, VALUE unit) { return rb_float_new(gtk_print_settings_get_paper_height(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_set_paper_height(VALUE self, VALUE paper_height, VALUE unit) { gtk_print_settings_set_paper_height(_SELF(self), NUM2DBL(paper_height), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_use_color_p(VALUE self) { return CBOOL2RVAL(gtk_print_settings_get_use_color(_SELF(self))); } static VALUE rg_set_use_color(VALUE self, VALUE use_color) { gtk_print_settings_set_use_color(_SELF(self), RVAL2CBOOL(use_color)); return self; } static VALUE rg_collate_p(VALUE self) { return CBOOL2RVAL(gtk_print_settings_get_collate(_SELF(self))); } static VALUE rg_set_collate(VALUE self, VALUE collate) { gtk_print_settings_set_collate(_SELF(self), RVAL2CBOOL(collate)); return self; } static VALUE rg_reverse_p(VALUE self) { return CBOOL2RVAL(gtk_print_settings_get_reverse(_SELF(self))); } static VALUE rg_set_reverse(VALUE self, VALUE reverse) { gtk_print_settings_set_reverse(_SELF(self), RVAL2CBOOL(reverse)); return self; } static VALUE rg_duplex(VALUE self) { return GTKPRINTDUPLEX2RVAL(gtk_print_settings_get_duplex(_SELF(self))); } static VALUE rg_set_duplex(VALUE self, VALUE duplex) { gtk_print_settings_set_duplex(_SELF(self), RVAL2GTKPRINTDUPLEX(duplex)); return self; } static VALUE rg_quality(VALUE self) { return GTKPRINTQUALITY2RVAL(gtk_print_settings_get_quality(_SELF(self))); } static VALUE rg_set_quality(VALUE self, VALUE quality) { gtk_print_settings_set_quality(_SELF(self), RVAL2GTKPRINTQUALITY(quality)); return self; } static VALUE rg_n_copies(VALUE self) { return INT2NUM(gtk_print_settings_get_n_copies(_SELF(self))); } static VALUE rg_set_n_copies(VALUE self, VALUE n_copies) { gtk_print_settings_set_n_copies(_SELF(self), NUM2INT(n_copies)); return self; } static VALUE rg_number_up(VALUE self) { return INT2NUM(gtk_print_settings_get_number_up(_SELF(self))); } static VALUE rg_set_number_up(VALUE self, VALUE number_up) { gtk_print_settings_set_number_up(_SELF(self), NUM2INT(number_up)); return self; } static VALUE rg_resolution(VALUE self) { return INT2NUM(gtk_print_settings_get_resolution(_SELF(self))); } static VALUE rg_set_resolution(VALUE self, VALUE resolution) { gtk_print_settings_set_resolution(_SELF(self), NUM2INT(resolution)); return self; } static VALUE rg_scale(VALUE self) { return rb_float_new(gtk_print_settings_get_scale(_SELF(self))); } static VALUE rg_set_scale(VALUE self, VALUE scale) { gtk_print_settings_set_scale(_SELF(self), NUM2DBL(scale)); return self; } static VALUE rg_print_pages(VALUE self) { return GTKPRINTPAGES2RVAL(gtk_print_settings_get_print_pages(_SELF(self))); } static VALUE rg_set_print_pages(VALUE self, VALUE print_pages) { gtk_print_settings_set_print_pages(_SELF(self), RVAL2GTKPRINTPAGES(print_pages)); return self; } static VALUE rg_page_ranges(VALUE self) { VALUE rb_ranges; GtkPageRange *ranges; int i, num_ranges; ranges = gtk_print_settings_get_page_ranges(_SELF(self), &num_ranges); rb_ranges = rb_ary_new2(num_ranges); for (i = 0; i < num_ranges; i++) { rb_ary_push(rb_ranges, rb_ary_new3(2, INT2NUM(ranges[i].start), INT2NUM(ranges[i].end))); } g_free(ranges); return rb_ranges; } struct rbgtk_rval2gtkpageranges_args { VALUE ary; long n; GtkPageRange *result; }; static VALUE rbgtk_rval2gtkpageranges_body(VALUE value) { long i; struct rbgtk_rval2gtkpageranges_args *args = (struct rbgtk_rval2gtkpageranges_args *)value; for (i = 0; i < args->n; i++) { VALUE ary = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]); if (RARRAY_LEN(ary) != 2) rb_raise(rb_eArgError, "range %ld should be array of size 2", i); args->result[i].start = NUM2INT(RARRAY_PTR(ary)[0]); args->result[i].end = NUM2INT(RARRAY_PTR(ary)[1]); } return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkpageranges_rescue(VALUE value) { g_free(((struct rbgtk_rval2gtkpageranges_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GtkPageRange * rbgtk_rval2gtkpageranges(VALUE value, long *n) { struct rbgtk_rval2gtkpageranges_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = g_new(GtkPageRange, args.n + 1); rb_rescue(rbgtk_rval2gtkpageranges_body, (VALUE)&args, rbgtk_rval2gtkpageranges_rescue, (VALUE)&args); if (n != NULL) *n = args.n; return args.result; } #define RVAL2GTKPAGERANGES(value, n) rbgtk_rval2gtkpageranges(value, n) static VALUE rg_set_page_ranges(VALUE self, VALUE rbpage_ranges) { GtkPrintSettings *settings = _SELF(self); long n; GtkPageRange *page_ranges = RVAL2GTKPAGERANGES(rbpage_ranges, &n); gtk_print_settings_set_page_ranges(settings, page_ranges, n); g_free(page_ranges); return self; } static VALUE rg_page_set(VALUE self) { return GTKPAGESET2RVAL(gtk_print_settings_get_page_set(_SELF(self))); } static VALUE rg_set_page_set(VALUE self, VALUE page_set) { gtk_print_settings_set_page_set(_SELF(self), RVAL2GTKPAGESET(page_set)); return self; } static VALUE rg_default_source(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_default_source(_SELF(self))); } static VALUE rg_set_default_source(VALUE self, VALUE default_source) { gtk_print_settings_set_default_source(_SELF(self), RVAL2CSTR_ACCEPT_NIL(default_source)); return self; } static VALUE rg_media_type(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_media_type(_SELF(self))); } static VALUE rg_set_media_type(VALUE self, VALUE media_type) { gtk_print_settings_set_media_type(_SELF(self), RVAL2CSTR_ACCEPT_NIL(media_type)); return self; } static VALUE rg_dither(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_dither(_SELF(self))); } static VALUE rg_set_dither(VALUE self, VALUE dither) { gtk_print_settings_set_dither(_SELF(self), RVAL2CSTR_ACCEPT_NIL(dither)); return self; } static VALUE rg_finishings(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_finishings(_SELF(self))); } static VALUE rg_set_finishings(VALUE self, VALUE finishings) { gtk_print_settings_set_finishings(_SELF(self), RVAL2CSTR_ACCEPT_NIL(finishings)); return self; } static VALUE rg_output_bin(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_output_bin(_SELF(self))); } static VALUE rg_set_output_bin(VALUE self, VALUE output_bin) { gtk_print_settings_set_output_bin(_SELF(self), RVAL2CSTR_ACCEPT_NIL(output_bin)); return self; } static VALUE rg_to_file(VALUE self, VALUE file_name) { GError *error = NULL; if (!gtk_print_settings_to_file(_SELF(self), RVAL2CSTR(file_name), &error)) { RAISE_GERROR(error); } return self; } static VALUE rg_to_key_file(int argc, VALUE *argv, VALUE self) { VALUE key_file, group_name; rb_scan_args(argc, argv, "11", &key_file, &group_name); gtk_print_settings_to_key_file(_SELF(self), RVAL2GKEYFILE(key_file), RVAL2CSTR_ACCEPT_NIL(group_name)); return self; } void Init_gtk_print_settings(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE; s_string = ID2SYM(rb_intern("string")); s_bool = ID2SYM(rb_intern("bool")); s_double = ID2SYM(rb_intern("double")); s_length = ID2SYM(rb_intern("length")); s_int = ID2SYM(rb_intern("int")); RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_SETTINGS, "PrintSettings", mGtk); rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(dup, 0); RG_DEF_METHOD_P(has_key, 1); RG_DEF_METHOD(get, -1); RG_DEF_ALIAS("[]", "get"); RG_DEF_METHOD(get_bool, 1); RG_DEF_METHOD(get_double, -1); RG_DEF_METHOD(get_length, 2); RG_DEF_METHOD(get_int, -1); RG_DEF_METHOD(set, -1); RG_DEF_METHOD_OPERATOR("[]=", ps_set_generic_indexer, -1); RG_DEF_METHOD(unset, -1); RG_DEF_ALIAS("delete", "unset"); RG_DEF_METHOD(each, 0); rb_define_const(RG_TARGET_NAMESPACE, "PRINTER", CSTR2RVAL(GTK_PRINT_SETTINGS_PRINTER)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION", CSTR2RVAL(GTK_PRINT_SETTINGS_ORIENTATION)); rb_define_const(RG_TARGET_NAMESPACE, "PAPER_FORMAT", CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_FORMAT)); rb_define_const(RG_TARGET_NAMESPACE, "PAPER_WIDTH", CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_WIDTH)); rb_define_const(RG_TARGET_NAMESPACE, "PAPER_HEIGHT", CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_HEIGHT)); rb_define_const(RG_TARGET_NAMESPACE, "N_COPIES", CSTR2RVAL(GTK_PRINT_SETTINGS_N_COPIES)); rb_define_const(RG_TARGET_NAMESPACE, "DEFAULT_SOURCE", CSTR2RVAL(GTK_PRINT_SETTINGS_DEFAULT_SOURCE)); rb_define_const(RG_TARGET_NAMESPACE, "QUALITY", CSTR2RVAL(GTK_PRINT_SETTINGS_QUALITY)); rb_define_const(RG_TARGET_NAMESPACE, "RESOLUTION", CSTR2RVAL(GTK_PRINT_SETTINGS_RESOLUTION)); rb_define_const(RG_TARGET_NAMESPACE, "USE_COLOR", CSTR2RVAL(GTK_PRINT_SETTINGS_USE_COLOR)); rb_define_const(RG_TARGET_NAMESPACE, "DUPLEX", CSTR2RVAL(GTK_PRINT_SETTINGS_DUPLEX)); rb_define_const(RG_TARGET_NAMESPACE, "COLLATE", CSTR2RVAL(GTK_PRINT_SETTINGS_COLLATE)); rb_define_const(RG_TARGET_NAMESPACE, "REVERSE", CSTR2RVAL(GTK_PRINT_SETTINGS_REVERSE)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_TYPE", CSTR2RVAL(GTK_PRINT_SETTINGS_MEDIA_TYPE)); rb_define_const(RG_TARGET_NAMESPACE, "DITHER", CSTR2RVAL(GTK_PRINT_SETTINGS_DITHER)); rb_define_const(RG_TARGET_NAMESPACE, "SCALE", CSTR2RVAL(GTK_PRINT_SETTINGS_SCALE)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_PAGES", CSTR2RVAL(GTK_PRINT_SETTINGS_PRINT_PAGES)); rb_define_const(RG_TARGET_NAMESPACE, "PAGE_RANGES", CSTR2RVAL(GTK_PRINT_SETTINGS_PAGE_RANGES)); rb_define_const(RG_TARGET_NAMESPACE, "PAGE_SET", CSTR2RVAL(GTK_PRINT_SETTINGS_PAGE_SET)); rb_define_const(RG_TARGET_NAMESPACE, "FINISHINGS", CSTR2RVAL(GTK_PRINT_SETTINGS_FINISHINGS)); rb_define_const(RG_TARGET_NAMESPACE, "NUMBER_UP", CSTR2RVAL(GTK_PRINT_SETTINGS_NUMBER_UP)); rb_define_const(RG_TARGET_NAMESPACE, "OUTPUT_BIN", CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_BIN)); rb_define_const(RG_TARGET_NAMESPACE, "OUTPUT_FILE_FORMAT", CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT)); rb_define_const(RG_TARGET_NAMESPACE, "OUTPUT_URI", CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_URI)); rb_define_const(RG_TARGET_NAMESPACE, "WIN32_DRIVER_VERSION", CSTR2RVAL(GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION)); rb_define_const(RG_TARGET_NAMESPACE, "WIN32_DRIVER_EXTRA", CSTR2RVAL(GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA)); /* Helpers: */ RG_DEF_METHOD(printer, 0); RG_DEF_METHOD(set_printer, 1); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(set_orientation, 1); RG_DEF_METHOD(paper_size, 0); RG_DEF_METHOD(set_paper_size, 1); RG_DEF_METHOD(paper_width, 1); RG_DEF_METHOD(set_paper_width, 2); RG_DEF_METHOD(paper_height, 1); RG_DEF_METHOD(set_paper_height, 2); RG_DEF_METHOD_P(use_color, 0); RG_DEF_METHOD(set_use_color, 1); RG_DEF_METHOD_P(collate, 0); RG_DEF_METHOD(set_collate, 1); RG_DEF_METHOD_P(reverse, 0); RG_DEF_METHOD(set_reverse, 1); RG_DEF_METHOD(duplex, 0); RG_DEF_METHOD(set_duplex, 1); RG_DEF_METHOD(quality, 0); RG_DEF_METHOD(set_quality, 1); RG_DEF_METHOD(n_copies, 0); RG_DEF_METHOD(set_n_copies, 1); RG_DEF_METHOD(number_up, 0); RG_DEF_METHOD(set_number_up, 1); RG_DEF_METHOD(resolution, 0); RG_DEF_METHOD(set_resolution, 1); RG_DEF_METHOD(scale, 0); RG_DEF_METHOD(set_scale, 1); RG_DEF_METHOD(print_pages, 0); RG_DEF_METHOD(set_print_pages, 1); RG_DEF_METHOD(page_ranges, 0); RG_DEF_METHOD(set_page_ranges, 1); RG_DEF_METHOD(page_set, 0); RG_DEF_METHOD(set_page_set, 1); RG_DEF_METHOD(default_source, 0); RG_DEF_METHOD(set_default_source, 1); RG_DEF_METHOD(media_type, 0); RG_DEF_METHOD(set_media_type, 1); RG_DEF_METHOD(dither, 0); RG_DEF_METHOD(set_dither, 1); RG_DEF_METHOD(finishings, 0); RG_DEF_METHOD(set_finishings, 1); RG_DEF_METHOD(output_bin, 0); RG_DEF_METHOD(set_output_bin, 1); RG_DEF_METHOD(to_file, 1); RG_DEF_METHOD(to_key_file, -1); G_DEF_CLASS(GTK_TYPE_PAGE_ORIENTATION, "PageOrientation", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_PRINT_DUPLEX, "PrintDuplex", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_PRINT_QUALITY, "PrintQuality", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_PRINT_PAGES, "PrintPages", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_PAGE_SET, "PageSet", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-action.c0000644000175000017500000001227212516434313017670 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAction #define _SELF(self) (RVAL2GTKACTION(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name, options, label, tooltip, stock_id, buffer; rb_scan_args(argc, argv, "11", &name, &options); rbg_scan_options(options, "label", &label, "tooltip", &tooltip, "stock_id", &stock_id, NULL); G_INITIALIZE(self, gtk_action_new(RVAL2CSTR(name), RVAL2CSTR_ACCEPT_NIL(label), RVAL2CSTR_ACCEPT_NIL(tooltip), RVAL2GLIBID_ACCEPT_NIL(stock_id, buffer))); 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), RVAL2GTKICONSIZE(icon_size))); } static VALUE rg_create_menu_item(VALUE self) { return GOBJ2RVAL(gtk_action_create_menu_item(_SELF(self))); } static VALUE rg_create_menu(VALUE self) { return GOBJ2RVAL(gtk_action_create_menu(_SELF(self))); } static VALUE rg_create_tool_item(VALUE self) { return GOBJ2RVAL(gtk_action_create_tool_item(_SELF(self))); } static VALUE rg_proxies(VALUE self) { return GOBJGSLIST2RVAL(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_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), NIL_P(accel_group) ? NULL : RVAL2GTKACCELGROUP(accel_group)); return self; } static VALUE rg_accel_path(VALUE self) { return CSTR2RVAL(gtk_action_get_accel_path(_SELF(self))); } static VALUE rg_accel_closure(VALUE self) { return GCLOSURE2RVAL(gtk_action_get_accel_closure(_SELF(self))); } 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); } } static VALUE rg_unblock_activate(VALUE self) { gtk_action_unblock_activate(_SELF(self)); return self; } static VALUE rg_block_activate(VALUE self) { gtk_action_block_activate(_SELF(self)); if (rb_block_given_p()) rb_ensure(rb_yield, self, rg_unblock_activate, self); return self; } void Init_gtk_action(VALUE mGtk) { 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); RG_DEF_METHOD(create_menu, 0); RG_DEF_METHOD(create_tool_item, 0); RG_DEF_METHOD(proxies, 0); RG_DEF_METHOD(connect_accelerator, 0); RG_DEF_METHOD(disconnect_accelerator, 0); RG_DEF_METHOD(set_accel_path, 1); RG_DEF_METHOD(set_accel_group, 1); RG_DEF_METHOD(accel_path, 0); RG_DEF_METHOD(accel_closure, 0); RG_DEF_METHOD(block_activate, 0); RG_DEF_METHOD(unblock_activate, 0); RG_REG_GLIBID_SETTER("stock-id"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-drawing-area.c0000644000175000017500000000260512516434313020753 0ustar koukou/* -*- 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 "rbgtk3private.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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-grid.c0000644000175000017500000000554112516434313017341 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cGrid #define _SELF(self) (RVAL2GTKGRID(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_grid_new()); return Qnil; } static VALUE rg_attach(VALUE self, VALUE child, VALUE left, VALUE top, VALUE width, VALUE height) { gtk_grid_attach(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(left), NUM2INT(top), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_attach_next_to(VALUE self, VALUE child, VALUE sibling, VALUE side, VALUE width, VALUE height) { gtk_grid_attach_next_to(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(sibling) ? NULL : RVAL2GTKWIDGET(sibling), RVAL2GTKPOSITIONTYPE(side), NUM2INT(width), NUM2INT(height)); return self; } #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_get_child_at(VALUE self, VALUE left, VALUE top) { return GOBJ2RVAL(gtk_grid_get_child_at(_SELF(self), NUM2INT(left), NUM2INT(top))); } static VALUE rg_insert_column(VALUE self, VALUE position) { gtk_grid_insert_column(_SELF(self), NUM2INT(position)); return self; } static VALUE rg_insert_next_to(VALUE self, VALUE sibling, VALUE side) { gtk_grid_insert_next_to(_SELF(self), RVAL2GTKWIDGET(sibling), RVAL2GTKPOSITIONTYPE(side)); return self; } static VALUE rg_insert_row(VALUE self, VALUE position) { gtk_grid_insert_row(_SELF(self), NUM2INT(position)); return self; } #endif void Init_gtk_grid(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_GRID, "Grid", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(attach, 5); RG_DEF_METHOD(attach_next_to, 5); #if GTK_CHECK_VERSION(3, 2, 0) RG_DEF_METHOD(get_child_at, 2); RG_DEF_METHOD(insert_column, 1); RG_DEF_METHOD(insert_next_to, 2); RG_DEF_METHOD(insert_row, 1); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-toggle-tool-button.c0000644000175000017500000000365412516434313022164 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cToggleToolButton #define _SELF(self) (RVAL2GTKTOGGLETOOLBUTTON(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg, buffer; GtkToolItem *item = NULL; rb_scan_args(argc, argv, "01", &arg); if (NIL_P(arg)) { item = gtk_toggle_tool_button_new(); } else if (TYPE(arg) == T_HASH) { VALUE stock_id; rbg_scan_options(arg, "stock_id", &stock_id, NULL); if (!NIL_P(stock_id)) item = gtk_toggle_tool_button_new_from_stock(RVAL2GLIBID(stock_id, buffer)); } else { item = gtk_toggle_tool_button_new_from_stock(RVAL2GLIBID(arg, buffer)); } if (!item) rb_raise(rb_eArgError, "Invalid arguments."); RBGTK_INITIALIZE(self, item); return Qnil; } void Init_gtk_toggletoolbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOGGLE_TOOL_BUTTON, "ToggleToolButton", mGtk); RG_DEF_METHOD(initialize, -1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-text-attributes.c0000644000175000017500000001613412516434313021564 0ustar koukou/* -*- 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 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cTextAttributes #define _SELF(s) (RVAL2GTKTEXTATTRIBUTES(s)) static VALUE rg_initialize(VALUE self) { GtkTextAttributes *attr; attr = gtk_text_attributes_new(); G_INITIALIZE(self, attr); return Qnil; } static VALUE rg_appearance(VALUE self) { GtkTextAppearance app = _SELF(self)->appearance; return GTKTEXTAPPEARANCE2RVAL(&app); } static VALUE rg_set_appearance(VALUE self, VALUE val) { GtkTextAppearance* app = RVAL2GTKTEXTAPPEARANCE(val); _SELF(self)->appearance = *app; return self; } static VALUE rg_justification(VALUE self) { return GTKJUSTIFICATION2RVAL(_SELF(self)->justification); } static VALUE rg_set_justification(VALUE self, VALUE val) { _SELF(self)->justification = RVAL2GTKJUSTIFICATION(val); return self; } static VALUE rg_direction(VALUE self) { return GTKDIRECTIONTYPE2RVAL(_SELF(self)->direction); } static VALUE rg_set_direction(VALUE self, VALUE val) { _SELF(self)->direction = RVAL2GTKDIRECTIONTYPE(val); return self; } static VALUE rg_font(VALUE self) { VALUE val; if (_SELF(self)->font == NULL) return Qnil; val = PANGOFONTDESCRIPTION2RVAL(_SELF(self)->font); G_CHILD_SET(self, rb_intern("font"), val); return val; } static VALUE rg_set_font(VALUE self, VALUE val) { G_CHILD_SET(self, rb_intern("font"), val); _SELF(self)->font = RVAL2PANGOFONTDESCRIPTION(val); return self; } static VALUE rg_font_scale(VALUE self) { return rb_float_new(_SELF(self)->font_scale); } static VALUE rg_set_font_scale(VALUE self, VALUE val) { _SELF(self)->font_scale = NUM2DBL(val); return self; } static VALUE rg_left_margin(VALUE self) { return INT2NUM(_SELF(self)->left_margin); } static VALUE rg_set_left_margin(VALUE self, VALUE val) { _SELF(self)->left_margin = NUM2INT(val); return self; } static VALUE rg_indent(VALUE self) { return INT2NUM(_SELF(self)->indent); } static VALUE rg_set_indent(VALUE self, VALUE val) { _SELF(self)->indent = NUM2INT(val); return self; } static VALUE rg_right_margin(VALUE self) { return INT2NUM(_SELF(self)->right_margin); } static VALUE rg_set_right_margin(VALUE self, VALUE val) { _SELF(self)->right_margin = NUM2INT(val); return self; } static VALUE rg_pixels_above_lines(VALUE self) { return INT2NUM(_SELF(self)->pixels_above_lines); } static VALUE rg_set_pixels_above_lines(VALUE self, VALUE val) { _SELF(self)->pixels_above_lines = NUM2INT(val); return self; } static VALUE rg_pixels_below_lines(VALUE self) { return INT2NUM(_SELF(self)->pixels_below_lines); } static VALUE rg_set_pixels_below_lines(VALUE self, VALUE val) { _SELF(self)->pixels_below_lines = NUM2INT(val); return self; } static VALUE rg_pixels_inside_wrap(VALUE self) { return INT2NUM(_SELF(self)->pixels_inside_wrap); } static VALUE rg_set_pixels_inside_wrap(VALUE self, VALUE val) { _SELF(self)->pixels_inside_wrap = NUM2INT(val); return self; } static VALUE rg_tabs(VALUE self) { VALUE val; if (_SELF(self)->tabs == NULL) return Qnil; val = PANGOTABARRAY2RVAL(_SELF(self)->tabs); G_CHILD_SET(self, rb_intern("tabs"), val); return val; } static VALUE rg_set_tabs(VALUE self, VALUE val) { G_CHILD_SET(self, rb_intern("tabs"), val); _SELF(self)->tabs = RVAL2PANGOTABARRAY(val); return self; } static VALUE rg_wrap_mode(VALUE self) { return GTKWRAPMODE2RVAL(_SELF(self)->wrap_mode); } static VALUE rg_set_wrap_mode(VALUE self, VALUE val) { _SELF(self)->wrap_mode = RVAL2GTKWRAPMODE(val); return self; } static VALUE rg_language(VALUE self) { VALUE val; if (_SELF(self)->language == NULL) return Qnil; val = PANGOLANGUAGE2RVAL(_SELF(self)->language); G_CHILD_SET(self, rb_intern("language"), val); return val; } static VALUE rg_set_language(VALUE self, VALUE val) { G_CHILD_SET(self, rb_intern("language"), val); _SELF(self)->language = RVAL2PANGOLANGUAGE(val); return self; } static VALUE rg_invisible_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->invisible); } static VALUE rg_set_invisible(VALUE self, VALUE val) { _SELF(self)->invisible = RVAL2CBOOL(val); return self; } static VALUE rg_bg_full_height_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->bg_full_height); } static VALUE rg_set_bg_full_height(VALUE self, VALUE val) { _SELF(self)->bg_full_height = RVAL2CBOOL(val); return self; } static VALUE rg_editable_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->editable); } static VALUE rg_set_editable(VALUE self, VALUE val) { _SELF(self)->editable = RVAL2CBOOL(val); return self; } static VALUE rg_copy_values(VALUE self, VALUE dest) { gtk_text_attributes_copy_values(_SELF(self), _SELF(dest)); return self; } void Init_gtk_text_attributes(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_ATTRIBUTES, "TextAttributes", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(copy_values, 1); RG_DEF_METHOD(appearance, 0); RG_DEF_METHOD(set_appearance, 1); RG_DEF_METHOD(justification, 0); RG_DEF_METHOD(set_justification, 1); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD(set_direction, 1); RG_DEF_METHOD(font, 0); RG_DEF_METHOD(set_font, 1); RG_DEF_METHOD(font_scale, 0); RG_DEF_METHOD(set_font_scale, 1); RG_DEF_METHOD(left_margin, 0); RG_DEF_METHOD(set_left_margin, 1); RG_DEF_METHOD(indent, 0); RG_DEF_METHOD(set_indent, 1); RG_DEF_METHOD(right_margin, 0); RG_DEF_METHOD(set_right_margin, 1); RG_DEF_METHOD(pixels_above_lines, 0); RG_DEF_METHOD(set_pixels_above_lines, 1); RG_DEF_METHOD(pixels_below_lines, 0); RG_DEF_METHOD(set_pixels_below_lines, 1); RG_DEF_METHOD(pixels_inside_wrap, 0); RG_DEF_METHOD(set_pixels_inside_wrap, 1); RG_DEF_METHOD(tabs, 0); RG_DEF_METHOD(set_tabs, 1); RG_DEF_METHOD(wrap_mode, 0); RG_DEF_METHOD(set_wrap_mode, 1); RG_DEF_METHOD(language, 0); RG_DEF_METHOD(set_language, 1); RG_DEF_METHOD_P(invisible, 0); RG_DEF_METHOD(set_invisible, 1); RG_DEF_METHOD_P(bg_full_height, 0); RG_DEF_METHOD(set_bg_full_height, 1); RG_DEF_METHOD_P(editable, 0); RG_DEF_METHOD(set_editable, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-accel-label.c0000644000175000017500000000317412516434313020540 0ustar koukou/* -*- 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 "rbgtk3private.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(RVAL2GTKACCELLABEL(self))); } static VALUE rg_refetch(VALUE self) { gtk_accel_label_refetch(RVAL2GTKACCELLABEL(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-window-group.c0000644000175000017500000000444412516434313021056 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cWindowGroup #define _SELF(self) (RVAL2GTKWINDOWGROUP(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_window_group_new()); return Qnil; } static VALUE rg_add(VALUE self, VALUE window) { gtk_window_group_add_window(_SELF(self), RVAL2GTKWINDOW(window)); return self; } static VALUE rg_remove(VALUE self, VALUE window) { gtk_window_group_remove_window(_SELF(self), RVAL2GTKWINDOW(window)); return self; } static VALUE rg_get_current_device_grab(VALUE self, VALUE device) { return GOBJ2RVAL(gtk_window_group_get_current_device_grab(_SELF(self), NIL_P(device) ? NULL : RVAL2GDKDEVICE(device))); } static VALUE rg_current_grab(VALUE self) { return GOBJ2RVAL(gtk_window_group_get_current_grab(_SELF(self))); } static VALUE rg_windows(VALUE self) { /* TODO: need free? */ return GOBJGLIST2RVAL(gtk_window_group_list_windows(_SELF(self))); } void Init_gtk_windowgroup(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WINDOW_GROUP, "WindowGroup", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, 1); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(get_current_device_grab, 1); RG_DEF_METHOD(current_grab, 0); RG_DEF_METHOD(windows, 0); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-settings.c0000644000175000017500000001600712516434313020253 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003,2004 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cSettings static VALUE prop_func_table; static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_settings_get_default()); } static VALUE rg_s_get_for_screen(G_GNUC_UNUSED VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_settings_get_for_screen(RVAL2GDKSCREEN(screen))); } /* * Gtk::Settings.install_property(...) do |spec, str| * #parse str * new_val = .... # parse value from string. * new_val # return new_val or nil if you can't convert the value. * end */ static gboolean rc_property_parser(const GParamSpec *pspec, const GString *rc_string, GValue *property_value) { VALUE spec = GOBJ2RVAL((gpointer)pspec); VALUE func = rb_hash_aref(prop_func_table, spec); VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str)); if (NIL_P(ret)) { return FALSE; } else if (RVAL2CBOOL(ret)){ rbgobj_rvalue_to_gvalue(ret, property_value); return TRUE; } else { rb_raise(rb_eArgError, "Gtk::Settings#install_property() block should return new value or nil"); } } static VALUE rg_s_install_property(VALUE self, VALUE spec) { GParamSpec* pspec = RVAL2GPARAMSPEC(spec); if (rb_block_given_p()){ VALUE func = rb_block_proc(); rb_hash_aset(prop_func_table, spec, func); gtk_settings_install_property_parser(pspec, (GtkRcPropertyParser)rc_property_parser); } else { gtk_settings_install_property(pspec); } return self; } static VALUE settings_rc_property_parse(G_GNUC_UNUSED VALUE self, VALUE rbspec, VALUE rbstring, GtkRcPropertyParser parser) { GParamSpec *spec = RVAL2GPARAMSPEC(rbspec); GString *string = g_string_new(RVAL2CSTR(rbstring)); GValue property = G_VALUE_INIT; gboolean parsed; g_value_init(&property, spec->value_type); parsed = parser(spec, string, &property); g_string_free(string, TRUE); return parsed ? GVAL2RVAL_UNSET(&property) : Qnil; } static VALUE rg_s_rc_property_parse_color(VALUE self, VALUE rbspec, VALUE rbstring) { return settings_rc_property_parse(self, rbspec, rbstring, gtk_rc_property_parse_color); } static VALUE rg_s_rc_property_parse_enum(VALUE self, VALUE rbspec, VALUE rbstring) { return settings_rc_property_parse(self, rbspec, rbstring, gtk_rc_property_parse_enum); } static VALUE rg_s_rc_property_parse_flags(VALUE self, VALUE rbspec, VALUE rbstring) { return settings_rc_property_parse(self, rbspec, rbstring, gtk_rc_property_parse_flags); } static VALUE rg_s_rc_property_parse_requisition(G_GNUC_UNUSED VALUE self, VALUE rbspec, VALUE rbstring) { GParamSpec *spec = RVAL2GPARAMSPEC(rbspec); GString *string = g_string_new(RVAL2CSTR(rbstring)); GValue property = G_VALUE_INIT; gboolean parsed; GtkRequisition *requisition; gint width; gint height; g_value_init(&property, GTK_TYPE_REQUISITION); parsed = gtk_rc_property_parse_requisition(spec, string, &property); g_string_free(string, TRUE); if (!parsed) return Qnil; requisition = g_value_get_boxed(&property); width = requisition->width; height = requisition->height; g_value_unset(&property); return rb_assoc_new(INT2NUM(width), INT2NUM(height)); } static VALUE settings_rc_property_parse_border_result(VALUE value) { return GTKBORDER2RVAL(g_value_get_boxed((GValue *)value)); } static VALUE settings_rc_property_parse_border_ensure(VALUE value) { g_value_unset((GValue *)value); return Qnil; } static VALUE rg_s_rc_property_parse_border(G_GNUC_UNUSED VALUE self, VALUE rbspec, VALUE rbstring) { GParamSpec *spec = RVAL2GPARAMSPEC(rbspec); GString *string = g_string_new(RVAL2CSTR(rbstring)); GValue property = G_VALUE_INIT; gboolean parsed; g_value_init(&property, GTK_TYPE_BORDER); parsed = gtk_rc_property_parse_border(spec, string, &property); g_string_free(string, TRUE); if (!parsed) return Qnil; return rb_ensure(settings_rc_property_parse_border_result, (VALUE)&property, settings_rc_property_parse_border_ensure, (VALUE)&property); } static VALUE rg_set_property_value(VALUE self, VALUE rbname, VALUE rbvalue, VALUE origin) { GtkSettings *settings = RVAL2GTKSETTINGS(self); GtkSettingsValue svalue = { (gchar *)RVAL2CSTR(origin), G_VALUE_INIT }; const gchar *name = RVAL2CSTR(rbname); g_value_init(&svalue.value, RVAL2GTYPE(rbvalue)); rbgobj_rvalue_to_gvalue(rbvalue, &svalue.value); gtk_settings_set_property_value(settings, name, &svalue); g_value_unset(&svalue.value); return self; } /* We don't need them, Use set_property_value() instead. void gtk_settings_set_string_property (GtkSettings *settings, const gchar *name, const gchar *v_string, const gchar *origin); void gtk_settings_set_long_property (GtkSettings *settings, const gchar *name, glong v_long, const gchar *origin); void gtk_settings_set_double_property (GtkSettings *settings, const gchar *name, gdouble v_double, const gchar *origin); */ void Init_gtk_settings(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SETTINGS, "Settings", mGtk); rb_global_variable(&prop_func_table); prop_func_table = rb_hash_new(); RG_DEF_SMETHOD(default, 0); RG_DEF_SMETHOD(get_for_screen, 1); RG_DEF_SMETHOD(install_property, 1); RG_DEF_SMETHOD(rc_property_parse_color, 2); RG_DEF_SMETHOD(rc_property_parse_enum, 2); RG_DEF_SMETHOD(rc_property_parse_flags, 2); RG_DEF_SMETHOD(rc_property_parse_requisition, 2); RG_DEF_SMETHOD(rc_property_parse_border, 2); RG_DEF_METHOD(set_property_value, 3); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-hsv.c0000644000175000017500000000467312516434313017221 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cHSV #define _SELF(self) (RVAL2GTKHSV(self)) static VALUE rg_s_to_rgb(G_GNUC_UNUSED VALUE self, VALUE h, VALUE s, VALUE v) { gdouble r, g, b; gtk_hsv_to_rgb(NUM2DBL(h), NUM2DBL(s), NUM2DBL(v), &r, &g, &b); return rb_ary_new3(3, DBL2NUM(r), DBL2NUM(g), DBL2NUM(b)); } static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_hsv_new()); return Qnil; } static VALUE rg_color(VALUE self) { gdouble h, s, v; gtk_hsv_get_color(_SELF(self), &h, &s, &v); return rb_ary_new3(3, DBL2NUM(h), DBL2NUM(s), DBL2NUM(v)); } static VALUE rg_metrics(VALUE self) { gint size, ring_width; gtk_hsv_get_metrics(_SELF(self), &size, &ring_width); return rb_ary_new3(2, INT2NUM(size), INT2NUM(ring_width)); } static VALUE rg_adjusting_p(VALUE self) { gboolean result; result = gtk_hsv_is_adjusting(_SELF(self)); return CBOOL2RVAL(result); } static VALUE rg_set_color(VALUE self, VALUE h, VALUE s, VALUE v) { gtk_hsv_set_color(_SELF(self), NUM2DBL(h), NUM2DBL(s), NUM2DBL(v)); return self; } static VALUE rg_set_metrics(VALUE self, VALUE size, VALUE ring_width) { gtk_hsv_set_metrics(_SELF(self), NUM2INT(size), NUM2INT(ring_width)); return self; } void Init_gtk_hsv(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HSV, "HSV", mGtk); RG_DEF_SMETHOD(to_rgb, 3); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(color, 0); RG_DEF_METHOD(metrics, 0); RG_DEF_METHOD_P(adjusting, 0); RG_DEF_METHOD(set_color, 3); RG_DEF_METHOD(set_metrics, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-level-bar.c0000644000175000017500000000527712516434313020273 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 6, 0) #define RG_TARGET_NAMESPACE cLevelBar #define _SELF(self) (RVAL2GTKLEVELBAR(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE min_value, max_value; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "02", &min_value, &max_value); if (argc == 0) { widget = gtk_level_bar_new(); } else { widget = gtk_level_bar_new_for_interval(NUM2DBL(min_value), NUM2DBL(max_value)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_add_offset_value(VALUE self, VALUE name, VALUE value) { gtk_level_bar_add_offset_value(_SELF(self), RVAL2CSTR(name), NUM2DBL(value)); return self; } static VALUE rg_remove_offset_value(VALUE self, VALUE name) { gtk_level_bar_remove_offset_value(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_get_offset_value(VALUE self, VALUE name) { gdouble value; gboolean found; found = gtk_level_bar_get_offset_value(_SELF(self), RVAL2CSTR_ACCEPT_NIL(name), &value); if (found) { return DBL2NUM(value); } else { return Qnil; } } void Init_gtk_level_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LEVEL_BAR, "LevelBar", mGtk); G_DEF_CLASS(GTK_TYPE_LEVEL_BAR_MODE, "Mode", RG_TARGET_NAMESPACE); rb_define_const(RG_TARGET_NAMESPACE, "OFFSET_LOW", CSTR2RVAL(GTK_LEVEL_BAR_OFFSET_LOW)); rb_define_const(RG_TARGET_NAMESPACE, "OFFSET_HIGH", CSTR2RVAL(GTK_LEVEL_BAR_OFFSET_HIGH)); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(add_offset_value, 2); RG_DEF_METHOD(remove_offset_value, 1); RG_DEF_METHOD(get_offset_value, 1); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-print-context.c0000644000175000017500000000623512516434313021233 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPrintContext #define _SELF(s) (RVAL2GTKPRINTCONTEXT(s)) #ifdef HAVE_RB_CAIRO_H #include /* Rendering */ static VALUE rg_cairo_context(VALUE self) { return CRCONTEXT2RVAL(gtk_print_context_get_cairo_context(_SELF(self))); } #endif static VALUE rg_page_setup(VALUE self) { return GOBJ2RVAL(gtk_print_context_get_page_setup(_SELF(self))); } static VALUE rg_width(VALUE self) { return rb_float_new(gtk_print_context_get_width(_SELF(self))); } static VALUE rg_height(VALUE self) { return rb_float_new(gtk_print_context_get_height(_SELF(self))); } static VALUE rg_dpi_x(VALUE self) { return rb_float_new(gtk_print_context_get_dpi_x(_SELF(self))); } static VALUE rg_dpi_y(VALUE self) { return rb_float_new(gtk_print_context_get_dpi_y(_SELF(self))); } /* Fonts */ static VALUE rg_pango_fontmap(VALUE self) { return GOBJ2RVAL(gtk_print_context_get_pango_fontmap(_SELF(self))); } static VALUE rg_create_pango_context(VALUE self) { return GOBJ2RVALU(gtk_print_context_create_pango_context(_SELF(self))); } static VALUE rg_create_pango_layout(VALUE self) { return GOBJ2RVALU(gtk_print_context_create_pango_layout(_SELF(self))); } /* Needed for preview implementations */ #ifdef HAVE_RB_CAIRO_H static VALUE rg_set_cairo_context(VALUE self, VALUE cr, VALUE dpi_x, VALUE dpi_y) { gtk_print_context_set_cairo_context(_SELF(self), RVAL2CRCONTEXT(cr), NUM2DBL(dpi_x), NUM2DBL(dpi_y)); return self; } #endif void Init_gtk_print_context(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_CONTEXT, "PrintContext", mGtk); /* Rendering */ #ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(cairo_context, 0); #endif RG_DEF_METHOD(page_setup, 0); RG_DEF_METHOD(width, 0); RG_DEF_METHOD(height, 0); RG_DEF_METHOD(dpi_x, 0); RG_DEF_METHOD(dpi_y, 0); /* Fonts */ RG_DEF_METHOD(pango_fontmap, 0); RG_DEF_METHOD(create_pango_context, 0); RG_DEF_METHOD(create_pango_layout, 0); /* Needed for preview implementations */ #ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(set_cairo_context, 3); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-printer.c0000644000175000017500000001004612516434313020073 0ustar koukou/* -*- 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 "rbgtk3private.h" #ifdef HAVE_GTK_UNIX_PRINT #include #ifndef GTK_TYPE_PRINT_BACKEND #define GTK_TYPE_PRINT_BACKEND (gtk_print_backend_get_type ()) #define GTK_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND, GtkPrintBackend)) GType gtk_print_backend_get_type (void) G_GNUC_CONST; #endif #define RG_TARGET_NAMESPACE cPrinter #define _SELF(s) (RVAL2GTKPRINTER(s)) static VALUE rb_mGtk; static VALUE rg_initialize(VALUE self, VALUE name, VALUE backend, VALUE rb_virtual) { GtkPrinter *printer; printer = gtk_printer_new(RVAL2CSTR(name), RVAL2GTKPRINTBACKEND(backend), RVAL2CBOOL(rb_virtual)); G_INITIALIZE(self, printer); return Qnil; } static VALUE rg_description(VALUE self) { return CSTR2RVAL(gtk_printer_get_description(_SELF(self))); } static VALUE rg_active_p(VALUE self) { return CBOOL2RVAL(gtk_printer_is_default(_SELF(self))); } static VALUE rg_default_p(VALUE self) { return CBOOL2RVAL(gtk_printer_is_default(_SELF(self))); } static VALUE rg_operator_p_compare(VALUE self, VALUE other) { if (rb_obj_is_kind_of(other, GTYPE2CLASS(GTK_TYPE_PRINTER))){ return INT2NUM(gtk_printer_compare(_SELF(self), _SELF(other))); } else { rb_raise(rb_eTypeError, "%s isn't a kind of Gtk::Printer", rb_class2name(other)); } } struct callback_arg { VALUE callback; int argc; VALUE *argv; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; return rb_funcall2(arg->callback, id_call, arg->argc, arg->argv); } static gboolean each_printer(GtkPrinter *printer, gpointer data) { VALUE result; VALUE argv[1]; struct callback_arg arg; argv[0] = GOBJ2RVAL(printer); arg.callback = (VALUE)data; arg.argc = 1; arg.argv = argv; result = G_PROTECT_CALLBACK(invoke_callback, &arg); return NIL_P(rb_errinfo()) ? TRUE : RVAL2CBOOL(result); } static void remove_callback_reference(gpointer data) { VALUE callback = (VALUE)data; G_CHILD_REMOVE(rb_mGtk, callback); } static VALUE rg_s_each(int argc, VALUE *argv, VALUE self) { VALUE wait, block; rb_scan_args(argc, argv, "01", &wait); block = rb_block_proc(); G_CHILD_ADD(rb_mGtk, block); gtk_enumerate_printers(each_printer, (gpointer)block, remove_callback_reference, RVAL2CBOOL(wait)); return self; } #endif void Init_gtk_printer(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT rb_mGtk = mGtk; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINTER, "Printer", mGtk); rb_include_module(RG_TARGET_NAMESPACE, rb_mComparable); G_DEF_CLASS(GTK_TYPE_PRINT_BACKEND, "PrintBackend", mGtk); RG_DEF_SMETHOD(each, -1); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(description, 0); RG_DEF_METHOD_P(active, 0); RG_DEF_METHOD_P(default, 0); RG_DEF_METHOD_OPERATOR("<=>", p_compare, 1); G_DEF_CLASS3("GtkPrintBackendCups", "PrintBackendCups", mGtk); G_DEF_CLASS3("GtkPrintBackendFile", "PrintBackendFile", mGtk); G_DEF_CLASS3("GtkPrintBackendLpr", "PrintBackendLpr", mGtk); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-revealer.c0000644000175000017500000000247012516434313020217 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 10, 0) #define RG_TARGET_NAMESPACE cRevealer static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_revealer_new()); return Qnil; } void Init_gtk_revealer(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_REVEALER, "Revealer", mGtk); G_DEF_CLASS(GTK_TYPE_REVEALER_TRANSITION_TYPE, "TransitionType", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 0); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-paper-size.c0000644000175000017500000001301412516434313020465 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cPaperSize #define _SELF(s) (RVAL2GTKPAPERSIZE(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkPaperSize *size; if (argc <= 1) { VALUE name; rb_scan_args(argc, argv, "01", &name); size = gtk_paper_size_new(RVAL2CSTR_ACCEPT_NIL(name)); } else if (argc == 4) { size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]), RVAL2CSTR(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3])); } else if (argc == 5) { size = gtk_paper_size_new_custom(RVAL2CSTR(argv[0]), RVAL2CSTR(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3]), RVAL2GTKUNIT(argv[4])); } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 0, 1, 4 or 5)", argc); } G_INITIALIZE(self, size); return Qnil; } static VALUE rg_operator_equal(VALUE self, VALUE other) { return CBOOL2RVAL(RVAL2CBOOL(rb_equal(rb_obj_class(self), rb_obj_class(other))) && gtk_paper_size_is_equal(_SELF(self), _SELF(other))); } /* The width is always the shortest side, measure in mm */ static VALUE rg_name(VALUE self) { return CSTR2RVAL(gtk_paper_size_get_name(_SELF(self))); } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(gtk_paper_size_get_display_name(_SELF(self))); } static VALUE rg_ppd_name(VALUE self) { return CSTR2RVAL(gtk_paper_size_get_ppd_name(_SELF(self))); } static VALUE rg_get_width(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_width(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_get_height(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_height(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_custom_p(VALUE self) { return CBOOL2RVAL(gtk_paper_size_is_custom(_SELF(self))); } /* Only for custom sizes: */ static VALUE rg_set_size(VALUE self, VALUE width, VALUE height, VALUE unit) { gtk_paper_size_set_size(_SELF(self), NUM2DBL(width), NUM2DBL(height), RVAL2GTKUNIT(unit)); return self; } static VALUE rg_get_default_top_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_top_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_get_default_bottom_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_bottom_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_get_default_left_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_left_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_get_default_right_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_right_margin(_SELF(self), RVAL2GTKUNIT(unit))); } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gtk_paper_size_get_default()); } void Init_gtk_paper_size(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PAPER_SIZE, "PaperSize", mGtk); RG_DEF_SMETHOD(default, 0); rb_define_const(RG_TARGET_NAMESPACE, "A3", CSTR2RVAL(GTK_PAPER_NAME_A3)); rb_define_const(RG_TARGET_NAMESPACE, "A4", CSTR2RVAL(GTK_PAPER_NAME_A4)); rb_define_const(RG_TARGET_NAMESPACE, "A5", CSTR2RVAL(GTK_PAPER_NAME_A5)); rb_define_const(RG_TARGET_NAMESPACE, "B5", CSTR2RVAL(GTK_PAPER_NAME_B5)); rb_define_const(RG_TARGET_NAMESPACE, "LETTER", CSTR2RVAL(GTK_PAPER_NAME_LETTER)); rb_define_const(RG_TARGET_NAMESPACE, "EXECUTIVE", CSTR2RVAL(GTK_PAPER_NAME_EXECUTIVE)); rb_define_const(RG_TARGET_NAMESPACE, "LEGAL", CSTR2RVAL(GTK_PAPER_NAME_LEGAL)); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD_OPERATOR("==", equal, 1); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(display_name, 0); RG_DEF_METHOD(ppd_name, 0); RG_DEF_METHOD(get_width, 1); RG_DEF_METHOD(get_height, 1); RG_DEF_METHOD_P(custom, 0); RG_DEF_METHOD(set_size, 3); RG_DEF_METHOD(get_default_top_margin, 1); RG_DEF_METHOD(get_default_bottom_margin, 1); RG_DEF_METHOD(get_default_left_margin, 1); RG_DEF_METHOD(get_default_right_margin, 1); G_DEF_CLASS(GTK_TYPE_UNIT, "Unit", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-editable.c0000644000175000017500000000325212516434313021077 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mCellEditable #define _SELF(s) (RVAL2GTKCELLEDITABLE(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-builder.c0000644000175000017500000001106012516434313020033 0ustar koukou/* -*- 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 "rbgtk3private.h" #include /* From Ruby/GLib2 */ #define RG_TARGET_NAMESPACE cBuilder #define _SELF(self) (RVAL2GTKBUILDER(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 GOBJGSLIST2RVAL_FREE(gtk_builder_get_objects(_SELF(self)), g_slist_free, NULL); } 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), GCONNECTFLAGS2RVAL(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))); } void Init_gtk_builder(VALUE mGtk) { 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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-im-multicontext.c0000644000175000017500000000277412516434313021563 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIMMulticontext #define _SELF(self) (RVAL2GTKIMMULTICONTEXT(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_im_multicontext_new()); return Qnil; } static VALUE rg_append_menuitems(VALUE self, VALUE menushell) { gtk_im_multicontext_append_menuitems(_SELF(self), RVAL2GTKMENUSHELL(menushell)); return self; } void Init_gtk_im_multicontext(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IM_MULTICONTEXT, "IMMulticontext", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_menuitems, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-viewport.c0000644000175000017500000000300112516434313020260 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cViewport static VALUE rg_initialize(VALUE self, VALUE hadj, VALUE vadj) { GtkAdjustment *h_adj = RVAL2GTKADJUSTMENT(hadj); GtkAdjustment *v_adj = RVAL2GTKADJUSTMENT(vadj); RBGTK_INITIALIZE(self, gtk_viewport_new(h_adj, v_adj)); return Qnil; } void Init_gtk_viewport(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VIEWPORT, "Viewport", mGtk); RG_DEF_METHOD(initialize, 2); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-action-bar.c0000644000175000017500000000370112516434313020427 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cActionBar #define _SELF(self) (RVAL2GTKACTIONBAR(self)) #if GTK_CHECK_VERSION(3, 12, 0) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_action_bar_new()); return Qnil; } static VALUE rg_pack_start(VALUE self, VALUE child) { gtk_action_bar_pack_start(_SELF(self), RVAL2GOBJ(child)); return self; } static VALUE rg_pack_end(VALUE self, VALUE child) { gtk_action_bar_pack_end(_SELF(self), RVAL2GOBJ(child)); return self; } static VALUE rg_center_widget(VALUE self) { return GOBJ2RVAL(gtk_action_bar_get_center_widget(_SELF(self))); } static VALUE rg_set_center_widget(VALUE self, VALUE child) { gtk_action_bar_set_center_widget(_SELF(self), RVAL2GOBJ(child)); return self; } void Init_gtk_action_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ACTION_BAR, "ActionBar", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(pack_start, 1); RG_DEF_METHOD(pack_end, 1); RG_DEF_METHOD(center_widget, 0); RG_DEF_METHOD(set_center_widget, 1); } #endif ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-menu.c0000644000175000017500000001130112516434313017347 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMenu #define _SELF(self) (RVAL2GTKMENU(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_menu_new()); return Qnil; } static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_menu_set_screen(_SELF(self), RVAL2GDKSCREEN(screen)); return self; } static VALUE rg_reorder_child(VALUE self, VALUE child, VALUE position) { gtk_menu_reorder_child(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(position)); return self; } static VALUE rg_attach(VALUE self, VALUE child, VALUE left_attach, VALUE right_attach, VALUE top_attach, VALUE bottom_attach) { gtk_menu_attach(_SELF(self), RVAL2GTKWIDGET(child), NUM2UINT(left_attach), NUM2UINT(right_attach), NUM2UINT(top_attach), NUM2UINT(bottom_attach)); return self; } static void menu_pos_func(GtkMenu *menu, gint *px, gint *py, gboolean *push_in, gpointer data) { VALUE arr = rb_funcall((VALUE)data, id_call, 4, GOBJ2RVAL(menu), INT2FIX(*px), INT2FIX(*py), CBOOL2RVAL(*push_in)); if (TYPE(arr) == T_ARRAY && (RARRAY_LEN(arr) == 2 || RARRAY_LEN(arr) == 3)){ *px = NUM2INT(RARRAY_PTR(arr)[0]); *py = NUM2INT(RARRAY_PTR(arr)[1]); if (RARRAY_LEN(arr) == 3) *push_in = RVAL2CBOOL(RARRAY_PTR(arr)[2]); } else { rb_raise(rb_eArgError, "block should return [x, y, push_in]"); } } /* the proc should return [x, y, push_in] */ static VALUE rg_popup(VALUE self, VALUE pshell, VALUE pitem, VALUE button, VALUE activate_time) { GtkWidget *gpshell = NULL; GtkWidget *gpitem = NULL; GtkMenuPositionFunc pfunc = NULL; gpointer data = NULL; VALUE func; if (rb_block_given_p()) { func = rb_block_proc(); pfunc = (GtkMenuPositionFunc)menu_pos_func; data = (gpointer)func; G_RELATIVE(self, func); } if (!NIL_P(pshell)){ gpshell = RVAL2GTKWIDGET(pshell); } if (!NIL_P(pitem)) { gpitem = RVAL2GTKWIDGET(pitem); } gtk_menu_popup(_SELF(self), gpshell, gpitem, pfunc, data, NUM2UINT(button), NUM2UINT(activate_time)); return self; } static VALUE rg_popdown(VALUE self) { gtk_menu_popdown(_SELF(self)); return self; } static VALUE rg_reposition(VALUE self) { gtk_menu_reposition(_SELF(self)); return self; } static VALUE menu_detacher; static void detach_func(GtkWidget *attach_widget, GtkMenu *menu) { rb_funcall((VALUE)menu_detacher, id_call, 2, GOBJ2RVAL(attach_widget), GOBJ2RVAL(menu)); } static VALUE rg_attach_to_widget(VALUE self, VALUE attach_widget) { menu_detacher = rb_block_proc(); G_RELATIVE(self, menu_detacher); gtk_menu_attach_to_widget(_SELF(self), RVAL2GTKWIDGET(attach_widget), (GtkMenuDetachFunc)detach_func); return self; } static VALUE rg_detach(VALUE self) { gtk_menu_detach(_SELF(self)); return self; } static VALUE rg_s_get_for_attach_widget(G_GNUC_UNUSED VALUE self, VALUE widget) { return GOBJGLIST2RVAL(gtk_menu_get_for_attach_widget(RVAL2GTKWIDGET(widget))); } void Init_gtk_menu(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU, "Menu", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_screen, 1); RG_DEF_METHOD(reorder_child, 2); RG_DEF_METHOD(attach, 5); RG_DEF_METHOD(popup, 4); RG_DEF_METHOD(popdown, 0); RG_DEF_METHOD(reposition, 0); RG_DEF_METHOD(detach, 0); RG_DEF_SMETHOD(get_for_attach_widget, 1); RG_DEF_METHOD(attach_to_widget, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-notebook.c0000644000175000017500000002611512516434313020234 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cNotebook #define _SELF(self) RVAL2GTKNOTEBOOK(self) #define GTK_TYPE_NOTEBOOK_PAGE (gtk_notebookpage_get_type()) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_notebook_new()); return Qnil; } static VALUE rg_append_page(int argc, VALUE *argv, VALUE self) { VALUE child, label; rb_scan_args(argc, argv, "11", &child, &label); gtk_notebook_append_page(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(label) ? NULL : RVAL2GTKWIDGET(label)); G_CHILD_ADD(self, child); return self; } static VALUE rg_append_page_menu(int argc, VALUE *argv, VALUE self) { VALUE child, tab_label, menu_label; rb_scan_args(argc, argv, "12", &child, &tab_label, &menu_label); gtk_notebook_append_page_menu(_SELF(self), RVAL2GTKWIDGET(child), RVAL2GTKWIDGET(tab_label), NIL_P(menu_label) ? NULL : RVAL2GTKWIDGET(menu_label)); return self; } static VALUE rg_prepend_page(int argc, VALUE *argv, VALUE self) { VALUE child, label; rb_scan_args(argc, argv, "11", &child, &label); gtk_notebook_prepend_page(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(label) ? NULL : RVAL2GTKWIDGET(label)); return self; } static VALUE rg_prepend_page_menu(int argc, VALUE *argv, VALUE self) { VALUE child, tab_label, menu_label; rb_scan_args(argc, argv, "12", &child, &tab_label, &menu_label); gtk_notebook_prepend_page_menu(_SELF(self), RVAL2GTKWIDGET(child), RVAL2GTKWIDGET(tab_label), NIL_P(menu_label) ? NULL : RVAL2GTKWIDGET(menu_label)); return self; } static VALUE rg_insert_page(int argc, VALUE *argv, VALUE self) { VALUE pos, child, label; rb_scan_args(argc, argv, "21", &pos, &child, &label); gtk_notebook_insert_page(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(label) ? NULL : RVAL2GTKWIDGET(label), NUM2INT(pos)); return self; } static VALUE rg_insert_page_menu(int argc, VALUE *argv, VALUE self) { VALUE pos, child, tab_label, menu_label; rb_scan_args(argc, argv, "22", &pos, &child, &tab_label, &menu_label); gtk_notebook_insert_page_menu(_SELF(self), RVAL2GTKWIDGET(child), RVAL2GTKWIDGET(tab_label), RVAL2GTKWIDGET(menu_label), NUM2INT(pos)); return self; } static VALUE rg_remove_page(VALUE self, VALUE pos) { gtk_notebook_remove_page(_SELF(self), NUM2INT(pos)); return self; } static VALUE rg_page_num(VALUE self, VALUE child) { return INT2FIX(gtk_notebook_page_num(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_next_page(VALUE self) { gtk_notebook_next_page(_SELF(self)); return self; } static VALUE rg_prev_page(VALUE self) { gtk_notebook_prev_page(_SELF(self)); return self; } static VALUE rg_reorder_child(VALUE self, VALUE child, VALUE pos) { gtk_notebook_reorder_child(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(pos)); return self; } static VALUE rg_get_menu_label(VALUE self, VALUE child) { return GOBJ2RVAL(gtk_notebook_get_menu_label(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_get_nth_page(VALUE self, VALUE page_num) { GtkWidget *page = gtk_notebook_get_nth_page(_SELF(self), NUM2INT(page_num)); return page ? GOBJ2RVAL(page) : Qnil; } static VALUE rg_n_pages(VALUE self) { return INT2NUM(gtk_notebook_get_n_pages(_SELF(self))); } static VALUE rg_get_tab_label(VALUE self, VALUE child) { return GOBJ2RVAL(gtk_notebook_get_tab_label(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_set_menu_label(VALUE self, VALUE child, VALUE label) { gtk_notebook_set_menu_label(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(label)?NULL:RVAL2GTKWIDGET(label)); return self; } static VALUE rg_set_menu_label_text(VALUE self, VALUE child, VALUE text) { gtk_notebook_set_menu_label_text(_SELF(self), RVAL2GTKWIDGET(child), RVAL2CSTR(text)); return self; } static VALUE rg_set_tab_label(VALUE self, VALUE child, VALUE label) { gtk_notebook_set_tab_label(_SELF(self), RVAL2GTKWIDGET(child), NIL_P(label)?NULL:RVAL2GTKWIDGET(label)); return self; } static VALUE rg_set_tab_label_text(VALUE self, VALUE child, VALUE text) { gtk_notebook_set_tab_label_text(_SELF(self), RVAL2GTKWIDGET(child), RVAL2CSTR(text)); return self; } static VALUE rg_get_menu_label_text(VALUE self, VALUE child) { return CSTR2RVAL(gtk_notebook_get_menu_label_text(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_get_tab_label_text(VALUE self, VALUE child) { return CSTR2RVAL(gtk_notebook_get_tab_label_text(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_get_tab_reorderable(VALUE self, VALUE child) { return CBOOL2RVAL(gtk_notebook_get_tab_reorderable(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_set_tab_reorderable(VALUE self, VALUE child, VALUE reorderable) { gtk_notebook_set_tab_reorderable(_SELF(self), RVAL2GTKWIDGET(child), RVAL2CBOOL(reorderable)); return self; } static VALUE rg_get_tab_detachable(VALUE self, VALUE child) { return CBOOL2RVAL(gtk_notebook_get_tab_detachable(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_set_tab_detachable(VALUE self, VALUE child, VALUE detachable) { gtk_notebook_set_tab_detachable(_SELF(self), RVAL2GTKWIDGET(child), RVAL2CBOOL(detachable)); return self; } static GtkNotebook* creation_func(GtkNotebook *source, GtkWidget *page, gint x, gint y, gpointer func) { VALUE ret; ret = rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(source), GOBJ2RVAL(page), INT2NUM(x), INT2NUM(y)); return NIL_P(ret) ? (GtkNotebook*)NULL : RVAL2GTKNOTEBOOK(ret); } static VALUE rg_set_action_widget(VALUE self, VALUE widget, VALUE pack_type) { gtk_notebook_set_action_widget(_SELF(self), RVAL2GTKWIDGET(widget), RVAL2GTKPACKTYPE(pack_type)); return self; } static VALUE rg_get_action_widget(VALUE self, VALUE pack_type) { return GOBJ2RVAL(gtk_notebook_get_action_widget(_SELF(self), RVAL2GTKPACKTYPE(pack_type))); } /* deprecated typedef struct { VALUE parent; GtkNotebookPage *page; } GtkNotebookPageData; static GtkNotebookPageData * notebookpage_copy(const GtkNotebookPage *page) { GtkNotebookPageData *data; g_return_val_if_fail (page != NULL, NULL); data = g_new(GtkNotebookPageData, 1); data->page = (GtkNotebookPage *)page; return data; } static GType gtk_notebookpage_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkNotebookPageData", (GBoxedCopyFunc)notebookpage_copy, (GBoxedFreeFunc)g_free); return our_type; } static VALUE signal_g2r_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkNotebookPageData npp; npp.parent = GVAL2RVAL(&values[0]); npp.page = (GtkNotebookPage*)g_value_get_pointer(&values[1]); return rb_ary_new3(3, GVAL2RVAL(&values[0]), GTKNOTEBOOKPAGE2RVAL(&npp), GVAL2RVAL(&values[2])); } */ static VALUE rg_tab_hborder(VALUE self) { return UINT2NUM(gtk_notebook_get_tab_hborder(_SELF(self))); } static VALUE rg_tab_vborder(VALUE self) { return UINT2NUM(gtk_notebook_get_tab_vborder(_SELF(self))); } void Init_gtk_notebook(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_NOTEBOOK, "Notebook", mGtk); /* deprecated G_DEF_CLASS(GTK_TYPE_NOTEBOOK_PAGE, "NotebookPage", mGtk); */ RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_page, -1); RG_DEF_METHOD(append_page_menu, -1); RG_DEF_METHOD(prepend_page, -1); RG_DEF_METHOD(prepend_page_menu, -1); RG_DEF_METHOD(insert_page, -1); RG_DEF_METHOD(insert_page_menu, -1); RG_DEF_METHOD(remove_page, 1); RG_DEF_METHOD(page_num, 1); RG_DEF_METHOD(next_page, 0); RG_DEF_METHOD(prev_page, 0); RG_DEF_METHOD(reorder_child, 2); RG_DEF_METHOD(get_menu_label, 1); RG_DEF_METHOD(get_nth_page, 1); RG_DEF_METHOD(n_pages, 0); RG_DEF_METHOD(get_tab_label, 1); RG_DEF_METHOD(set_menu_label, 2); RG_DEF_METHOD(set_menu_label_text, 2); RG_DEF_METHOD(set_tab_label, 2); RG_DEF_METHOD(set_tab_label_text, 2); RG_DEF_METHOD(get_menu_label_text, 1); RG_DEF_METHOD(get_tab_label_text, 1); RG_DEF_METHOD(get_tab_reorderable, 1); RG_DEF_METHOD(set_tab_reorderable, 2); RG_DEF_METHOD(get_tab_detachable, 1); RG_DEF_METHOD(set_tab_detachable, 2); RG_DEF_METHOD(set_action_widget, 2); RG_DEF_METHOD(get_action_widget, 1); RG_DEF_METHOD(tab_hborder, 0); RG_DEF_METHOD(tab_vborder, 0); /* GtkNotebookTab */ rb_define_const(RG_TARGET_NAMESPACE, "TAB_FIRST", GTK_NOTEBOOK_TAB_FIRST); rb_define_const(RG_TARGET_NAMESPACE, "TAB_LAST", GTK_NOTEBOOK_TAB_LAST); /* deprecated G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "switch_page", (GValToRValSignalFunc)signal_g2r_func); */ } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-button-box.c0000644000175000017500000000551112516434313020512 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cButtonBox #define _SELF(self) (RVAL2GTKBUTTONBOX(self)) static VALUE rg_initialize(VALUE self, VALUE orientation) { RBGTK_INITIALIZE(self, gtk_button_box_new(RVAL2GTKORIENTATION(orientation))); return Qnil; } static VALUE rg_set_child_secondary(VALUE self, VALUE child, VALUE is_secondary) { gtk_button_box_set_child_secondary(_SELF(self), RVAL2GTKWIDGET(child), RVAL2CBOOL(is_secondary)); return self; } static VALUE rg_get_child_secondary(VALUE self, VALUE child) { return CBOOL2RVAL(gtk_button_box_get_child_secondary(_SELF(self), RVAL2GTKWIDGET(child))); } #if GTK_CHECK_VERSION(3, 2, 0) static VALUE rg_get_child_non_homogeneous(VALUE self, VALUE child) { return CBOOL2RVAL(gtk_button_box_get_child_non_homogeneous(_SELF(self), RVAL2GTKWIDGET(child))); } static VALUE rg_set_child_non_homogeneous(VALUE self, VALUE child, VALUE non_homogeneous) { gtk_button_box_set_child_non_homogeneous(_SELF(self), RVAL2GTKWIDGET(child), RVAL2CBOOL(non_homogeneous)); return self; } #endif void Init_gtk_button_box(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_BUTTON_BOX, "ButtonBox", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(set_child_secondary, 2); RG_DEF_METHOD(get_child_secondary, 1); #if GTK_CHECK_VERSION(3, 2, 0) RG_DEF_METHOD(get_child_non_homogeneous, 1); RG_DEF_METHOD(set_child_non_homogeneous, 2); #endif G_DEF_CLASS(GTK_TYPE_BUTTON_BOX_STYLE, "Style", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-pixbuf.c0000644000175000017500000000255312516434313022432 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererPixbuf #define _SELF(s) (RVAL2GTKCELLRENDERERPIXBUF(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); RG_REG_GLIBID_SETTER("stock-id"); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-accel-group-entry.c0000644000175000017500000000507212516434313021753 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cAccelGroupEntry #define _SELF(s) (RVAL2GTKACCELGROUPENTRY(s)) 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 GTKACCELKEY2RVAL(&_SELF(self)->key); } static VALUE rg_closure(VALUE self) { return GCLOSURE2RVAL(_SELF(self)->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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-tree-sortable.c0000644000175000017500000000727112516434313021166 0ustar koukou/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE mTreeSortable #define _SELF(s) (RVAL2GTKTREESORTABLE(s)) static VALUE rg_sort_column_changed(VALUE self) { gtk_tree_sortable_sort_column_changed(_SELF(self)); return self; } static VALUE rg_sort_column_id(VALUE self) { gint sort_column_id; GtkSortType order; if (gtk_tree_sortable_get_sort_column_id(_SELF(self), &sort_column_id, &order)) { VALUE ary; ary = rb_ary_new2(2); rb_ary_push(ary, INT2NUM(sort_column_id)); rb_ary_push(ary, GTKSORTTYPE2RVAL(order)); return ary; } else { return Qnil; /* XXX: or something else? exception? */ } } static VALUE rg_set_sort_column_id(int argc, VALUE *argv, VALUE self) { gint sort_column_id; GtkSortType order; if (argc == 1 || argc == 2) { sort_column_id = NUM2INT(argv[0]); order = (argc == 2) ? RVAL2GTKSORTTYPE(argv[1]) : GTK_SORT_ASCENDING; } else { rb_raise(rb_eArgError, "need 1 or 2 arguments."); } gtk_tree_sortable_set_sort_column_id(_SELF(self), sort_column_id, order); return self; } static gint sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer func) { a->user_data3 = model; b->user_data3 = model; return NUM2INT(rb_funcall((VALUE)func, id_call, 2, GTKTREEITER2RVAL(a), GTKTREEITER2RVAL(b))); } static VALUE rg_set_sort_func(VALUE self, VALUE sort_column_id) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_sortable_set_sort_func(_SELF(self), NUM2INT(sort_column_id), (GtkTreeIterCompareFunc)sort_func, (gpointer)func, NULL); return self; } static VALUE rg_set_default_sort_func(VALUE self) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_sortable_set_default_sort_func(_SELF(self), (GtkTreeIterCompareFunc)sort_func, (gpointer)func, NULL); return self; } static VALUE rg_has_default_sort_func_p(VALUE self) { return RVAL2CBOOL(gtk_tree_sortable_has_default_sort_func(_SELF(self))); } void Init_gtk_treesortable(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TREE_SORTABLE, "TreeSortable", mGtk); RG_DEF_METHOD(sort_column_changed, 0); RG_DEF_METHOD(sort_column_id, 0); RG_DEF_METHOD(set_sort_column_id, -1); RG_DEF_METHOD(set_sort_func, 1); RG_DEF_METHOD(set_default_sort_func, 0); RG_DEF_METHOD_P(has_default_sort_func, 0); rb_define_const(RG_TARGET_NAMESPACE, "DEFAULT_SORT_COLUMN_ID", GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-cell-renderer-toggle.c0000644000175000017500000000250412516434313022412 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cCellRendererToggle #define _SELF(s) (RVAL2GTKCELLRENDERERTOGGLE(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); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-font-chooser-widget.c0000644000175000017500000000255312516434313022303 0ustar koukou/* -*- 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 "rbgtk3private.h" #if GTK_CHECK_VERSION(3, 2, 0) #define RG_TARGET_NAMESPACE cFontChooserWidget #define _SELF(self) (RVAL2GTKFONTCHOOSERWIDGET(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_font_chooser_widget_new()); return Qnil; } #endif void Init_gtk_fontchooserwidget(VALUE mGtk) { #if GTK_CHECK_VERSION(3, 2, 0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FONT_CHOOSER_WIDGET, "FontChooserWidget", mGtk); RG_DEF_METHOD(initialize, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-icon-set.c0000644000175000017500000000454212516434313020135 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cIconSet #define _SELF(s) (RVAL2GTKICONSET(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkIconSet *icon_set; VALUE pixbuf; rb_scan_args(argc, argv, "01", &pixbuf); if(NIL_P(pixbuf)) icon_set = gtk_icon_set_new(); else icon_set = gtk_icon_set_new_from_pixbuf(RVAL2GDKPIXBUF(pixbuf)); G_INITIALIZE(self, icon_set); return Qnil; } static VALUE rg_add_source(VALUE self, VALUE source) { gtk_icon_set_add_source(_SELF(self), RVAL2GTKICONSOURCE(source)); return self; } static VALUE rg_sizes(VALUE self) { GtkIconSize *sizes; gint n_sizes; VALUE result; int n; gtk_icon_set_get_sizes(_SELF(self), &sizes, &n_sizes); result = rb_ary_new(); for(n=0; n", treepath_compare, 1); RG_DEF_METHOD_OPERATOR("==", treepath_equal, 1); RG_DEF_METHOD_BANG(next, 0); RG_DEF_METHOD_BANG(prev, 0); RG_DEF_METHOD_BANG(up, 0); RG_DEF_METHOD_BANG(down, 0); RG_DEF_METHOD_P(ancestor, 1); RG_DEF_METHOD_P(descendant, 1); } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-socket.c0000644000175000017500000000407512516434313017705 0ustar koukou/* -*- 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) 2002 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 "rbgtk3private.h" #ifdef HAVE_GTK_SOCKET_GET_TYPE #include #define RG_TARGET_NAMESPACE cSocket #define _SELF(self) RVAL2GTKSOCKET(self) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_socket_new()); return Qnil; } static VALUE rg_add_id(VALUE self, VALUE wid) { gtk_socket_add_id(_SELF(self), #ifdef GDK_NATIVE_WINDOW_POINTER GUINT_TO_POINTER(NUM2ULONG(wid)) #else (guint32)NUM2UINT(wid) #endif ); return self; } static VALUE rg_plug_window(VALUE self) { return GOBJ2RVAL(gtk_socket_get_plug_window(_SELF(self))); } static VALUE rg_id(VALUE self) { Window id = gtk_socket_get_id(_SELF(self)); #ifdef GDK_NATIVE_WINDOW_POINTER return UINT2NUM(GPOINTER_TO_UINT(id)); #else return UINT2NUM(id); #endif } #endif void Init_gtk_socket(VALUE mGtk) { #ifdef HAVE_GTK_SOCKET_GET_TYPE VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SOCKET, "Socket", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(plug_window, 0); RG_DEF_METHOD(add_id, 1); RG_DEF_METHOD(id, 0); #endif } ruby-gnome2-all-2.2.5/gtk3/ext/gtk3/rbgtk-menu-shell.c0000644000175000017500000000561712516434313020471 0ustar koukou/* -*- 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 "rbgtk3private.h" #define RG_TARGET_NAMESPACE cMenuShell #define _SELF(self) (RVAL2GTKMENUSHELL(self)) static VALUE rg_append(VALUE self, VALUE child) { gtk_menu_shell_append(_SELF(self),RVAL2GTKWIDGET(child)); G_CHILD_ADD(self, child); return self; } static VALUE rg_prepend(VALUE self, VALUE child) { gtk_menu_shell_prepend(_SELF(self), RVAL2GTKWIDGET(child)); G_CHILD_ADD(self, child); return self; } static VALUE rg_insert(VALUE self, VALUE child, VALUE pos) { gtk_menu_shell_insert(_SELF(self), RVAL2GTKWIDGET(child), NUM2INT(pos)); G_CHILD_ADD(self, child); return self; } static VALUE rg_deactivate(VALUE self) { gtk_menu_shell_deactivate(_SELF(self)); return self; } static VALUE rg_select_item(VALUE self, VALUE menu_item) { gtk_menu_shell_select_item(_SELF(self), RVAL2GTKWIDGET(menu_item)); return self; } static VALUE rg_select_first(VALUE self, VALUE search_sensitive) { gtk_menu_shell_select_first(_SELF(self), RVAL2CBOOL(search_sensitive)); return self; } static VALUE rg_deselect(VALUE self) { gtk_menu_shell_deselect(_SELF(self)); return self; } static VALUE rg_activate_item(VALUE self, VALUE menu_item, VALUE force_deactivate) { gtk_menu_shell_activate_item(_SELF(self), RVAL2GTKWIDGET(menu_item), RVAL2CBOOL(force_deactivate)); return self; } void Init_gtk_menu_shell(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_SHELL, "MenuShell", mGtk); RG_DEF_METHOD(append, 1); RG_DEF_METHOD(prepend, 1); RG_DEF_METHOD(insert, 2); RG_DEF_METHOD(deactivate, 0); RG_DEF_METHOD(select_item, 1); RG_DEF_METHOD(select_first, 1); RG_DEF_METHOD(deselect, 0); RG_DEF_METHOD(activate_item, 2); G_DEF_CLASS(GTK_TYPE_MENU_DIRECTION_TYPE, "DirectionType", RG_TARGET_NAMESPACE); } ruby-gnome2-all-2.2.5/gtk3/COPYING.LIB0000644000175000017500000006364212257552167015151 0ustar koukou GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ruby-gnome2-all-2.2.5/gtk3/lib/0000755000175000017500000000000012516434313014232 5ustar koukouruby-gnome2-all-2.2.5/gtk3/lib/gtk3/0000755000175000017500000000000012516434313015102 5ustar koukouruby-gnome2-all-2.2.5/gtk3/lib/gtk3/base.rb0000644000175000017500000000310112516434313016334 0ustar koukou=begin Copyright (c) 2006-2011 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. =end require 'atk' require 'gdk3' base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gtk3.so" rescue LoadError require "gtk3.so" end module Gtk LOG_DOMAIN = "Gtk" class Printer def self.printers(wait = false) printers = [] self.each(wait) {|v| printers << v} printers end end class Builder private def canonical_handler_name(name) name.gsub(/[-\s]+/, "_") end def __connect_signals__(connector, object, signal_name, handler_name, connect_object, flags) handler_name = canonical_handler_name(handler_name) if connect_object handler = connect_object.method(handler_name) else handler = connector.call(handler_name) end unless handler $stderr.puts("Undefined handler: #{handler_name}") if $DEBUG return end if flags.after? signal_connect_method = :signal_connect_after else signal_connect_method = :signal_connect end if handler.arity.zero? object.send(signal_connect_method, signal_name) {handler.call} else object.send(signal_connect_method, signal_name, &handler) end end end end GLib::Log.set_log_domain(Gtk::LOG_DOMAIN) ruby-gnome2-all-2.2.5/gtk3/lib/gtk3/deprecated.rb0000644000175000017500000012016712516434313017536 0ustar koukoumodule Gtk extend GLib::Deprecatable define_deprecated_const :Combo, :raise => "Use 'Gtk::ComboBoxText' instead." define_deprecated_const :ComboBoxEntry, :raise => "Use 'Gtk::ComboBox' instead." define_deprecated_const :Curve, :raise => "Don't use this widget anymore." define_deprecated_const :FileSelection, :raise => "Use 'Gtk::FileChooserDialog' instead." define_deprecated_const :FontSelection, :raise => "Use 'Gtk::FontChooserWidget' instead." define_deprecated_const :FontSelectionDialog, :raise => "Use 'Gtk::FontChooserDialog' instead." define_deprecated_const :GammaCurve, :raise => "Don't use this widget anymore." define_deprecated_const :HRuler, :raise => "Don't use this widget anymore." define_deprecated_const :InputDialog, :raise => "Don't use this widget anymore." define_deprecated_const :ItemFactory, :raise => "Use 'Gtk::UIManager' instead." define_deprecated_const :OptionMenu, :raise => "Use 'Gtk::ComboBox' instead." define_deprecated_const :RC, :raise => "Use 'Gtk::StyleContext' instead." define_deprecated_const :RcStyle, :raise => "Use 'Gtk::CssProvider' instead." define_deprecated_const :Ruler, :raise => "Don't use this widget anymore." define_deprecated_const :Style, :raise => "Use 'Gtk::StyleContext' instead." define_deprecated_const :Tooltips, :raise => "Use 'Gtk::Tooltip' API." define_deprecated_const :VRuler, :raise => "Don't use this widget anymore." define_deprecated_flags :AccelFlags, 'ACCEL' define_deprecated_flags :AttachOptions define_deprecated_enums :CornerType, 'CORNER' define_deprecated_enums :DeleteType, 'DELETE' define_deprecated_enums :DirectionType, 'DIR' define_deprecated_enums :ExpanderStyle, 'EXPANDER' define_deprecated_enums :Justification, 'JUSTIFY' define_deprecated_enums :MovementStep, 'MOVEMENT' define_deprecated_enums :Orientation, 'ORIENTATION' define_deprecated_enums :PackType, 'PACK' define_deprecated_enums :PathPriorityType, 'PATH_PRIO' define_deprecated_enums :PathType, 'PATH' define_deprecated_enums :PolicyType, 'POLICY' define_deprecated_enums :PositionType, 'POS' define_deprecated_enums :ReliefStyle, 'RELIEF' define_deprecated_enums :ResizeMode, 'RESIZE' define_deprecated_enums :ScrollStep, 'SCROLL' define_deprecated_enums :ScrollType, 'SCROLL' define_deprecated_enums :SelectionMode, 'SELECTION' define_deprecated_enums :ShadowType, 'SHADOW' define_deprecated_enums :StateType, 'STATE' define_deprecated_enums :SortType, 'SORT' define_deprecated_const :AnchorType define_deprecated_const :ANCHOR_CENTER define_deprecated_const :ANCHOR_NORTH define_deprecated_const :ANCHOR_NORTH_WEST define_deprecated_const :ANCHOR_NORTH_EAST define_deprecated_const :ANCHOR_SOUTH define_deprecated_const :ANCHOR_SOUTH_WEST define_deprecated_const :ANCHOR_SOUTH_EAST define_deprecated_const :ANCHOR_WEST define_deprecated_const :ANCHOR_EAST define_deprecated_const :ANCHOR_N define_deprecated_const :ANCHOR_NW define_deprecated_const :ANCHOR_NE define_deprecated_const :ANCHOR_S define_deprecated_const :ANCHOR_SW define_deprecated_const :ANCHOR_SE define_deprecated_const :ANCHOR_W define_deprecated_const :ANCHOR_E define_deprecated_const :UpdateType define_deprecated_const :UPDATE_CONTINUOUS define_deprecated_const :UPDATE_DISCONTINUOUS define_deprecated_const :UPDATE_DELAYED define_deprecated_singleton_method :init_add, :warn => "Don't use this method." define_deprecated_singleton_method :quit_add, :warn => "Don't use this method." define_deprecated_singleton_method :quit_remove, :warn => "Don't use this method." define_deprecated_singleton_method :get_event_widget, :warn => "Use 'Gdk::Event#event_widget'." do |_self, event| event && event.event_widget end define_deprecated_singleton_method :timeout_add, :warn => "Use 'GLib::Timeout.add'." do |_self, interval, &block| GLib::Timeout.add(interval, &block) end define_deprecated_singleton_method :timeout_remove, :warn => "Use 'GLib::Source.remove'." do |_self, id| GLib::Source.remove(id) end define_deprecated_singleton_method :idle_add, :warn => "Use 'GLib::Idle.add'." do |_self, &block| GLib::Idle.add(&block) end define_deprecated_singleton_method :idle_add_priority, :warn => "Use 'GLib::Idle.add'." do |_self, priority, &block| GLib::Idle.add(priority, &block) end define_deprecated_singleton_method :idle_remove, :warn => "Use 'GLib::Source.remove'." do |_self, id| GLib::Source.remove(id) end class AboutDialog extend GLib::Deprecatable define_deprecated_singleton_method :set_email_hook, :warn => "Use 'activate-link' signal." define_deprecated_singleton_method :set_url_hook, :warn => "Use 'activate-link' signal." end class Action extend GLib::Deprecatable define_deprecated_method :connect_proxy, :warn => "Use 'Gtk::Activatable#set_related_action'." define_deprecated_method :disconnect_proxy, :warn => "Use 'Gtk::Activatable#set_related_action'." define_deprecated_method :block_activate_from, :warn => "Don't use this method." define_deprecated_method :unblock_activate_from, :warn => "Don't use this method." define_deprecated_method_by_hash_args :initialize, 'name, label, tooltip = nil, stock_id = nil', 'name, :label => nil, :tooltip => nil, :stock_id => nil', 1 do |_self, name, label, tooltip, stock_id| [name, {:label => label, :tooltip => tooltip, :stock_id => stock_id}] end end class Arrow extend GLib::Deprecatable define_deprecated_enums :Type end class Assistant extend GLib::Deprecatable define_deprecated_enums :PageType, 'PAGE' define_deprecated_method :set_page_header_image, :warn => "Don't use this method." define_deprecated_method :get_page_header_image, :warn => "Don't use this method." define_deprecated_method :set_page_side_image, :warn => "Don't use this method." define_deprecated_method :get_page_side_image, :warn => "Don't use this method." end class BindingSet extend GLib::Deprecatable define_deprecated_method :entry_clear, :entry_remove define_deprecated_method :add_path, :raise => "Don't use this method." end class Box extend GLib::Deprecatable define_deprecated_method :pack_start_defaults, :pack_start define_deprecated_method :pack_end_defaults, :pack_end define_deprecated_method_by_hash_args :pack_start, 'child, expand = true, fill = true, padding = 0', 'child, :expand => true, :fill => true, :padding => 0', 1 do |_self, child, expand, fill, padding| [child, {:expand => expand, :fill => fill, :padding => padding}] end define_deprecated_method_by_hash_args :pack_end, 'child, expand = true, fill = true, padding = 0', 'child, :expand => true, :fill => true, :padding => 0', 1 do |_self, child, expand, fill, padding| [child, {:expand => expand, :fill => fill, :padding => padding}] end define_deprecated_method_by_hash_args :set_child_packing, 'child, expand, fill, padding, pack_type', 'child, :expand => nil, :fill => nil, :padding => nil, :pack_type => nil', 1 do |_self, child, expand, fill, padding, pack_type| [child, {:expand => expand, :fill => fill, :padding => padding, :pack_type => pack_type}] end end class Button extend GLib::Deprecatable define_deprecated_method :enter, :warn => "Don't use this method." define_deprecated_method :leave, :warn => "Don't use this method." define_deprecated_method :pressed, :warn => "Don't use this method." define_deprecated_method :released, :warn => "Don't use this method." define_deprecated_signal :enter, :warn => "Use 'Gtk::Widget::enter-notify-event' signal." define_deprecated_signal :leave, :warn => "Use 'Gtk::Widget::leave-notify-event' signal." define_deprecated_signal :pressed, :warn => "Use 'Gtk::Widget::button-press-event' signal." define_deprecated_signal :released, :warn => "Use 'Gtk::Widget::button-release-event' signal." define_deprecated_method_by_hash_args :initialize, 'label_or_stock_id, use_underline = nil', ':label => nil, :mnemonic => nil, :stock_id => nil' do |_self, label_or_stock_id, use_underline| case label_or_stock_id when String if use_underline [{:mnemonic => label_or_stock_id}] else [{:label => label_or_stock_id}] end when Symbol [{:stock_id => label_or_stock_id}] else [label_or_stock_id] end end end class ButtonBox extend GLib::Deprecatable define_deprecated_enums :Style end class Calendar extend GLib::Deprecatable define_deprecated_flags :DisplayOptions define_deprecated_method :freeze, :warn => "Don't use this method." define_deprecated_method :thaw, :warn => "Don't use this method." end class CellRenderer extend GLib::Deprecatable define_deprecated_enums :Mode, 'MODE' define_deprecated_flags :State define_deprecated_method :editing_canceled, :warn => "Use '#{self}#stop_editing'." do |_self| _self.stop_editing(true) end define_deprecated_method :get_size, :raise => "Use Gtk::Renderer#get_preferred_size." end class CellRendererAccel extend GLib::Deprecatable define_deprecated_enums :Mode, 'MODE' end class CellView extend GLib::Deprecatable define_deprecated_method :cell_renderers, :warn => "Use 'Gtk::CellLayout#cells'." do |_self| _self.cells end define_deprecated_method :get_size_of_row, :raise => "Use Gtk::Renderer#get_preferred_size." end class ColorSelectionDialog extend GLib::Deprecatable define_deprecated_method :colorsel, :color_selection define_deprecated_method_by_hash_args :initialize, 'title', ':title => nil' do |_self, title| [{:title => title}] end end class ComboBox extend GLib::Deprecatable define_deprecated_method :append_text, :raise => "Use 'Gtk::ComboBoxText#append_text'." define_deprecated_method :insert_text, :raise => "Use 'Gtk::ComboBoxText#insert_text'." define_deprecated_method :prepend_text, :raise => "Use 'Gtk::ComboBoxText#prepend_text'." define_deprecated_method :remove_text, :raise => "Use 'Gtk::ComboBoxText#remove'." define_deprecated_method :active_text, :raise => "Use 'Gtk::ComboBoxText#active_text'." define_deprecated_method_by_hash_args :initialize, 'model', ':entry => false, :model => nil, :area => nil' do |_self, model| case model when TreeModel [{:model => model}] when true, false raise GLib::DeprecatedError.new("#{caller[0]}: '#{self}#initialize(is_text_only)' style has been deprecated. Use 'Gtk::ComboBoxText'.") end end end class Dialog extend GLib::Deprecatable define_deprecated_flags :Flags define_deprecated_const :ResponseType, 'Gtk::ResponseType' define_deprecated_enums 'Gtk::ResponseType', 'RESPONSE' define_deprecated_method :vbox, :child define_deprecated_method_by_hash_args :initialize, 'title, parent, flags, *buttons', ':title => nil, :parent => nil, :flags => 0, :buttons => nil' do |_self, title, parent, flags, *buttons| [{:title => title, :parent => parent, :flags => flags, :buttons => buttons}] end end module Drag extend GLib::Deprecatable define_deprecated_flags :DestDefaults, 'DEST_DEFAULT' define_deprecated_flags :TargetFlags, 'TARGET' define_deprecated_singleton_method :finish, :warn => "Use 'Gdk::DragContext#finish'." do |_self, context, success, del, time| context.finish(success, del, time) end define_deprecated_singleton_method :set_icon_default, :warn => "Use 'Gdk::DragContext#set_icon_default'." do |_self, context| context.set_icon_default end define_deprecated_singleton_method :set_icon_name, :warn => "Use 'Gdk::DragContext#set_icon'." do |_self, context, name, hot_x, hot_y| context.set_icon(:name => name, :hot_x => hot_x, :hot_y => hot_y) end define_deprecated_singleton_method :set_icon, :warn => "Use 'Gdk::DragContext#set_icon'." do |_self, context, icon, hot_x, hot_y| case icon when Symbol context.set_icon(:stock_id => icon, :hot_x => hot_x, :hot_y => hot_y) when Gdk::Pixbuf context.set_icon(:pixbuf => icon, :hot_x => hot_x, :hot_y => hot_y) when Gtk::Widget context.set_icon(:widget => icon, :hot_x => hot_x, :hot_y => hot_y) end end define_deprecated_singleton_method :dest_set, :warn => "Use 'Gtk::Widget#drag_dest_set'." do |_self, widget, flags, targets, actions| widget.drag_dest_set(flags, targets, actions) end define_deprecated_singleton_method :dest_set_proxy, :warn => "Use 'Gtk::Widget#drag_dest_set_proxy'." do |_self, widget, proxy_window, protocol, use_coordinates| widget.drag_dest_set_proxy(proxy_window, protocol, use_coordinates) end define_deprecated_singleton_method :dest_unset, :warn => "Use 'Gtk::Widget#drag_dest_unset'." do |_self, widget| widget.drag_dest_unset end define_deprecated_singleton_method :dest_find_target, :warn => "Use 'Gtk::Widget#drag_dest_find_target'." do |_self, widget, context, target_list| widget.drag_dest_find_target(context, target_list) end define_deprecated_singleton_method :dest_get_target_list, :warn => "Use 'Gtk::Widget#drag_dest_get_target_list'." do |_self, widget| widget.drag_dest_get_target_list end define_deprecated_singleton_method :dest_set_target_list, :warn => "Use 'Gtk::Widget#drag_dest_set_target_list'." do |_self, widget, target_list| widget.drag_dest_set_target_list(target_list) end define_deprecated_singleton_method :dest_add_text_targets, :warn => "Use 'Gtk::Widget#drag_dest_add_text_targets'." do |_self, widget| widget.drag_dest_add_text_targets end define_deprecated_singleton_method :dest_add_image_targets, :warn => "Use 'Gtk::Widget#drag_dest_add_image_targets'." do |_self, widget| widget.drag_dest_add_image_targets end define_deprecated_singleton_method :dest_add_uri_targets, :warn => "Use 'Gtk::Widget#drag_dest_add_uri_targets'." do |_self, widget| widget.drag_dest_add_uri_targets end define_deprecated_singleton_method :dest_set_track_motion, :warn => "Use 'Gtk::Widget#drag_dest_set_track_motion'." do |_self, widget, track_motion| widget.drag_dest_set_track_motion(track_motion) end define_deprecated_singleton_method :dest_get_track_motion, :warn => "Use 'Gtk::Widget#drag_dest_get_track_motion'." do |_self, widget| widget.drag_dest_get_track_motion end define_deprecated_singleton_method :get_data, :warn => "Use 'Gtk::Widget#drag_get_data'." do |_self, widget, context, target, time| widget.drag_get_data(context, target, time) end define_deprecated_singleton_method :highlight, :warn => "Use 'Gtk::Widget#drag_highlight'." do |_self, widget| widget.drag_highlight end define_deprecated_singleton_method :unhighlight, :warn => "Use 'Gtk::Widget#drag_unhighlight'." do |_self, widget| widget.drag_unhighlight end define_deprecated_singleton_method :begin, :warn => "Use 'Gtk::Widget#drag_begin'." do |_self, widget, target_list, actions, button, event| widget.drag_begin(target_list, actions, button, event) end define_deprecated_singleton_method :threshold?, :warn => "Use 'Gtk::Widget#drag_threshold?'." do |_self, widget, start_x, start_y, current_x, current_y| widget.drag_threshold?(start_x, start_y, current_x, current_y) end define_deprecated_singleton_method :source_set, :warn => "Use 'Gtk::Widget#drag_source_set'." do |_self, widget, start_button_mask, targets, actions| widget.drag_source_set(start_button_mask, targets, actions) end define_deprecated_singleton_method :source_set_icon, :warn => "Use 'Gtk::Widget#drag_source_set_icon(:stock_id => nil, :pixbuf => nil)'." do |_self, widget, icon| case icon when Symbol widget.drag_source_set_icon(:stock_id => icon) else widget.drag_source_set_icon(:pixbuf => icon) end end define_deprecated_singleton_method :source_set_icon_name, :warn => "Use 'Gtk::Widget#drag_source_set_icon(:icon_name => nil)'." do |_self, widget, icon| widget.drag_source_set_icon(:icon_name => icon) end define_deprecated_singleton_method :source_unset, :warn => "Use 'Gtk::Widget#drag_source_unset'." do |_self, widget| widget.drag_source_unset end define_deprecated_singleton_method :source_set_target_list, :warn => "Use 'Gtk::Widget#drag_source_set_target_list'." do |_self, widget, target_list| widget.drag_source_set_target_list(target_list) end define_deprecated_singleton_method :source_get_target_list, :warn => "Use 'Gtk::Widget#drag_source_get_target_list'." do |_self, widget| widget.drag_source_get_target_list end define_deprecated_singleton_method :source_add_text_targets, :warn => "Use 'Gtk::Widget#drag_source_add_text_targets'." do |_self, widget| widget.drag_source_add_text_targets end define_deprecated_singleton_method :source_add_image_targets, :warn => "Use 'Gtk::Widget#drag_source_add_image_targets'." do |_self, widget| widget.drag_source_add_image_targets end define_deprecated_singleton_method :source_add_uri_targets, :warn => "Use 'Gtk::Widget#drag_source_add_uri_targets'." do |_self, widget| widget.drag_source_add_uri_targets end end module FileChooser extend GLib::Deprecatable define_deprecated_enums :Action, 'ACTION' define_deprecated_enums :Confirmation, 'CONFIRMATION' end class FileChooserDialog extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'title, parent, action, back, *buttons', ':title => nil, :parent => nil, :action => :open, :buttons => nil' do |_self, title, parent, action, back, *buttons| [{:title => title, :parent => parent, :action => action, :buttons => buttons}] end end class FileFilter extend GLib::Deprecatable define_deprecated_flags :Flags end class HBox extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Box.new(:horizontal, spacing)'." do |_self, homogeneous, spacing| Gtk::Box.new(:horizontal, spacing).set_homogeneous(homogeneous) end end class HButtonBox extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::ButtonBox.new(:horizontal)'." do |_self| Gtk::ButtonBox.new(:horizontal) end end class HPaned extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Paned.new(:horizontal)'." do |_self| Gtk::Paned.new(:horizontal) end end class HScale extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Scale.new(:horizontal, *args)'." do |_self, *args| Gtk::Scale.new(:horizontal, *args) end end class HScrollbar extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Scrollbar.new(:horizontal, adjustment)'." do |_self, adjustment| Gtk::Scrollbar.new(:horizontal, adjustment) end end class HSeparator extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Separator.new(:horizontal)'." do |_self| Gtk::Separator.new(:horizontal) end end class IconSet extend GLib::Deprecatable define_deprecated_method :render_icon, :raise => "Use '#{self}#render_icon_pixbuf'." end module IconSize extend GLib::Deprecatable define_deprecated_enums :IconSize end class IconTheme extend GLib::Deprecatable define_deprecated_flags :LookupFlags, 'LOOKUP' end class IconView extend GLib::Deprecatable define_deprecated_enums :Type end class Image extend GLib::Deprecatable define_deprecated_enums :Type define_deprecated_method :set, :warn => "Use '#{self}#set_stock', '#{self}#set_icon_name', '#{self}#set_icon_set', '#{self}#set_file', '#{self}#set_pixbuf' or '#{self}#set_pixbuf_animation'." define_deprecated_method_by_hash_args :initialize, 'image, size = nil', ':label => nil, :mnemonic => nil, :stock => nil, :size => nil' do |_self, image, size| case image when String if size [{:icon_name => image, :size => size}] else [{:file => image}] end when Symbol [{:stock => image, :size => size}] when Gtk::IconSet [{:icon_set => image, :size => size}] else [image] end end end class ImageMenuItem extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'label_or_stock_id = nil, use_underline_or_accel_group = nil', ':label => nil, :mnemonic => nil, :stock_id => nil, :accel_group => nil' do |_self, label_or_stock_id, use_underline_or_accel_group| case label_or_stock_id when String if use_underline_or_accel_group [{:mnemonic => label_or_stock_id}] else [{:label => label_or_stock_id}] end when Symbol [{:stock_id => label_or_stock_id, :accel_group => use_underline_or_accel_group}] end end end class LinkButton extend GLib::Deprecatable define_deprecated_singleton_method :set_uri_hook, :warn => "Use 'clicked' signal." end class MenuBar extend GLib::Deprecatable define_deprecated_enums :PackDirection, 'PACK_DIRECTION' end class MenuItem extend GLib::Deprecatable define_deprecated_method :remove_submenu, :warn => "Use '#{self}#set_submenu'." do |_self| _self.set_submenu(nil) end end class MenuShell extend GLib::Deprecatable define_deprecated_enums :DirectionType, 'DIR' end class MenuToolButton extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'icon_widget_or_stock_id = nil, label = nil', ':icon_widget => nil, :label => nil, :stock_id => nil' do |_self, icon_widget_or_stock_id, label| case icon_widget_or_stock_id when String, Symbol [{:stock_id => icon_widget_or_stock_id}] when Gtk::Widget [{:icon_widget => icon_widget_or_stock_id, :label => label}] end end end class MessageDialog extend GLib::Deprecatable define_deprecated_enums :ButtonsType, 'BUTTONS' define_deprecated_const :Type, 'Gtk::MessageType' define_deprecated_enums 'Gtk::MessageType' define_deprecated_method_by_hash_args :initialize, 'parent, flags, type, buttons_type, message', ':parent => nil, :flags => 0, :type => :info, :buttons_type => :ok, :message => ""' do |_self, parent, flags, type, buttons_type, message| [{:parent => parent, :flags => flags, :type => type, :buttons_type => buttons_type, :message => message}] end end class Notebook extend GLib::Deprecatable define_deprecated_singleton_method :set_window_creation_hook, :warn => "Use 'create-window' signal." define_deprecated_method :query_tab_label_packing, :warn => "Use 'tab-expand' and 'tab-fill' child property." do |_self, child| [_self.child_get_property(child, 'tab-expand'), _self.child_get_property(child, 'tab-fill')] end define_deprecated_method :set_tab_label_packing, :warn => "Use 'tab-expand' and 'tab-fill' child property." do |_self, child, expand, fill, pack_type| _self.child_set_property(child, 'tab-expand', expand) _self.child_set_property(child, 'tab-fill', fill) end end class PageSetupUnixDialog extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'title, parent', ':title => nil, :parent => nil' do |_self, title, parent| [{:title => title, :parent => parent}] end end class PaperSize extend GLib::Deprecatable define_deprecated_enums :Unit, 'UNIT' end class PrintOperation extend GLib::Deprecatable define_deprecated_enums :Action, 'ACTION' define_deprecated_enums :Result, 'RESULT' define_deprecated_enums :Status, 'STATUS' end class PrintSettings extend GLib::Deprecatable define_deprecated_enums :PageOrientation, 'ORIENTATION' define_deprecated_enums :PageSet, 'PAGE_SET' define_deprecated_enums :PrintDuplex, 'DUPLEX' define_deprecated_enums :PrintPages, 'PAGES' define_deprecated_enums :PrintQuality, 'QUALITY' end class PrintUnixDialog extend GLib::Deprecatable define_deprecated_flags :Capabilities, 'CAPABILITY' define_deprecated_method_by_hash_args :initialize, 'title, parent', ':title => nil, :parent => nil' do |_self, title, parent| [{:title => title, :parent => parent}] end end class Paned extend GLib::Deprecatable %w(child1 child2).product(%w(resize shrink)).each do |child, prop| define_deprecated_method "#{child}_#{prop}?", :warn => "Use '#{prop}' child property." do |_self| _self.child_get_property(_self.send(child), prop) end end define_deprecated_method_by_hash_args :pack1, 'child, resize, shrink', 'child, :resize => false, :shrink => true', 1 do |_self, child, resize, shrink| [child, {:resize => resize, :shrink => shrink}] end define_deprecated_method_by_hash_args :pack2, 'child, resize, shrink', 'child, :resize => true, :shrink => true', 1 do |_self, child, resize, shrink| [child, {:resize => resize, :shrink => shrink}] end end class RadioAction extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'name, label, tooltip, stock_id, value', 'name, value, :label => nil, :tooltip => nil, :stock_id => nil', 2 do |_self, name, label, tooltip, stock_id, value| [name, value, {:label => label, :tooltip => tooltip, :stock_id => stock_id}] end end class Range extend GLib::Deprecatable define_deprecated_enums :SensitivityType, 'SENSITIVITY' define_deprecated_method :update_policy, :raise => "Don't use this method." define_deprecated_method :set_update_policy, :warn => "Don't use this method." alias :update_policy= :set_update_policy end module RC extend GLib::Deprecatable define_deprecated_flags :Flags define_deprecated_enums :TokenType, 'TOKEN' end class RecentAction extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'name, label, tooltip = nil, stock_id = nil, manager = nil', 'name, :label => nil, :tooltip => nil, :stock_id => nil, :manager => nil', 1 do |_self, name, label, tooltip, stock_id, manager| [name, {:label => label, :tooltip => tooltip, :stock_id => stock_id, :manager => manager}] end end module RecentChooser extend GLib::Deprecatable define_deprecated_enums :SortType, 'SORT' define_deprecated_method :show_numbers, :warn => "Use 'Gtk::RecentChooserMenu#show_numbers?'." do |_self| false end define_deprecated_method :set_show_numbers, :warn => "Use 'Gtk::RecentChooserMenu#set_show_numbers'." alias :show_numbers= :set_show_numbers end class RecentChooserDialog extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'title, parent, manager, *buttons', ':title => nil, :parent => nil, :manager => nil, :buttons => nil' do |_self, title, parent, *buttons| manager = buttons.first.is_a?(RecentManager) ? buttons.shift : nil [{:title => title, :parent => parent, :manager => manager, :buttons => buttons}] end end class RecentFilter extend GLib::Deprecatable define_deprecated_flags :Flags end class RecentManager extend GLib::Deprecatable define_deprecated_singleton_method :get_for_screen, :warn => "Use '#{self}.default'." do |_self, screen| _self.default end define_deprecated_method :set_screen, :warn => "Don't use this method." alias :screen= :set_screen end class ProgressBar extend GLib::Deprecatable define_deprecated_method :set_activity_mode, :warn => "Don't use this method." alias :activity_mode= :set_activity_mode define_deprecated_method :activity_mode?, :warn => "Don't use this method." do |_self| false end define_deprecated_method :set_text_xalign, :warn => "Don't use this method." alias :text_xalign= :set_text_xalign define_deprecated_method :text_xalign, :warn => "Don't use this method." do |_self| 0.0 end define_deprecated_method :set_text_yalign, :warn => "Don't use this method." alias :text_yalign= :set_text_yalign define_deprecated_method :text_yalign, :warn => "Don't use this method." do |_self| 0.0 end end class SelectionData extend GLib::Deprecatable define_deprecated_method :type, :data_type end class SizeGroup extend GLib::Deprecatable define_deprecated_enums :Mode end class SpinButton extend GLib::Deprecatable define_deprecated_enums :Type define_deprecated_enums :UpdatePolicy, 'UPDATE' end class TextAttributes extend GLib::Deprecatable define_deprecated_method :realized?, :warn => "Don't use this method." do |_self| false end define_deprecated_method :set_realized, :warn => "Don't use this method." alias :realized= :set_realized end class TextBuffer extend GLib::Deprecatable define_deprecated_method :get_iter_at_line, :warn => "Use '#{self}#get_iter_at(:line => nil)'." do |_self, line| _self.get_iter_at(:line => line) end define_deprecated_method :get_iter_at_line_offset, :warn => "Use '#{self}#get_iter_at(:line => nil, :offset => nil)'." do |_self, line, offset| _self.get_iter_at(:line => line, :offset => offset) end define_deprecated_method :get_iter_at_line_index, :warn => "Use '#{self}#get_iter_at(:line => nil, :index => nil)'." do |_self, line, index| _self.get_iter_at(:line => line, :index => index) end define_deprecated_method :get_iter_at_offset, :warn => "Use '#{self}#get_iter_at(:offset => nil)'." do |_self, offset| _self.get_iter_at(:offset => offset) end define_deprecated_method :get_iter_at_mark, :warn => "Use '#{self}#get_iter_at(:mark => nil)'." do |_self, mark| _self.get_iter_at(:mark => mark) end define_deprecated_method :get_iter_at_child_anchor, :warn => "Use '#{self}#get_iter_at(:anchor => nil)'." do |_self, anchor| _self.get_iter_at(:anchor => anchor) end define_deprecated_method :insert_pixbuf, :insert define_deprecated_method :insert_child_anchor, :insert define_deprecated_method :insert_with_tags, :insert end class TextIter extend GLib::Deprecatable define_deprecated_flags :SearchFlags, 'SEARCH' define_deprecated_method :backword_visible_word_start, :backward_visible_word_start end class TextTag extend GLib::Deprecatable define_deprecated_enums :WrapMode, 'WRAP' end class TextView extend GLib::Deprecatable define_deprecated_enums :WindowType, 'WINDOW' end class ToggleAction extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'name, label, tooltip = nil, stock_id = nil', 'name, :label => nil, :tooltip => nil, :stock_id => nil', 1 do |_self, name, label, tooltip, stock_id| [name, {:label => label, :tooltip => tooltip, :stock_id => stock_id}] end end class Toolbar extend GLib::Deprecatable define_deprecated_method :append, :warn => "Don't use this method." define_deprecated_method :prepend, :warn => "Don't use this method." define_deprecated_method :item_index, :get_item_index define_deprecated_method :nth_item, :get_nth_item define_deprecated_method :drop_index, :get_drop_index define_deprecated_method :append_space, :warn => "Don't use this method." define_deprecated_method :prepend_space, :warn => "Don't use this method." define_deprecated_method :insert_space, :warn => "Don't use this method." define_deprecated_method :remove_space, :warn => "Don't use this method." end class ToolButton extend GLib::Deprecatable define_deprecated_method_by_hash_args :initialize, 'icon_widget_or_stock_id = nil, label = nil', ':icon_widget => nil, :label => nil, :stock_id => nil' do |_self, icon_widget_or_stock_id, label| case icon_widget_or_stock_id when String, Symbol [{:stock_id => icon_widget_or_stock_id}] when Gtk::Widget [{:icon_widget => icon_widget_or_stock_id, :label => label}] end end end class Tooltip extend GLib::Deprecatable define_deprecated_method :set_icon_from_stock, :warn => "Use '#{self}#set_icon'." do |_self, stock_id, size| _self.set_icon(:stock_id => stock_id, :size => size) end end module TreeModel extend GLib::Deprecatable define_deprecated_flags :Flags end class TreeView extend GLib::Deprecatable define_deprecated_enums :DropPosition, 'DROP' define_deprecated_enums :GridLines, 'GRID_LINES' define_deprecated_method :widget_to_tree_coords, :convert_widget_to_bin_window_coords define_deprecated_method :tree_to_widget_coords, :convert_bin_window_to_widget_coords end class TreeViewColumn extend GLib::Deprecatable define_deprecated_enums :Sizing define_deprecated_method :cell_renderers, :warn => "Use 'Gtk::CellLayout#cells'." do |_self| _self.cells end end class UIManager extend GLib::Deprecatable define_deprecated_flags :ItemType end class VBox extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Box.new(:vertical, spacing)'." do |_self, homogeneous, spacing| Gtk::Box.new(:vertical, spacing).set_homogeneous(homogeneous) end end class VButtonBox extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::ButtonBox.new(:vertical)'." do |_self| Gtk::ButtonBox.new(:vertical) end end class VPaned extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Paned.new(:vertical)'." do |_self| Gtk::Paned.new(:vertical) end end class VScale extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Scale.new(:vertical, *args)'." do |_self, *args| Gtk::Scale.new(:vertical, *args) end end class VScrollbar extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Scrollbar.new(:vertical, adjustment)'." do |_self, adjustment| Gtk::Scrollbar.new(:vertical, adjustment) end end class VSeparator extend GLib::Deprecatable define_deprecated_singleton_method :new, :warn => "Use 'Gtk::Separator.new(:vertical)'." do |_self| Gtk::Separator.new(:vertical) end end class Widget extend GLib::Deprecatable define_deprecated_enums :HelpType, 'HELP' define_deprecated_enums :TextDirection, 'TEXT_DIR' define_deprecated_singleton_method :push_colormap, :warn => "Don't use this method." define_deprecated_singleton_method :pop_colormap, :warn => "Don't use this method." define_deprecated_singleton_method :set_default_colormap, :warn => "Don't use this method." class << self alias :default_colormap= :set_default_colormap end define_deprecated_singleton_method :default_colormap, :raise => "Don't use this method." define_deprecated_singleton_method :default_visual, :raise => "Don't use this method." define_deprecated_singleton_method :default_style, :raise => "Use 'Gtk::StyleContext' and 'Gtk::CssProvider'." define_deprecated_const :Flags, :raise => "Don't use this flags anymore." define_deprecated_method :flags, :raise => "Use the proper method." define_deprecated_method :set_flags, :warn => "Use the proper method." alias :flags= :set_flags define_deprecated_method :unset_flags, :warn => "Use the proper method." define_deprecated_method :no_window?, :warn => "Use '#{self}#has_window?'." do |_self| !_self.has_window? end define_deprecated_method :rc_style?, :has_rc_style? define_deprecated_method :parent_sensitive?, :warn => "Use '#{self}#sensitive?' on the parent widget." do |_self| _self.parent.sensitive? end define_deprecated_method :hide_all, :hide define_deprecated_method :colormap, :raise => "Use '#{self}#visual'." define_deprecated_method :set_colormap, :warn => "Use '#{self}#set_visual'." alias :colormap= :set_colormap define_deprecated_method :shape_combine_mask, :warn => "Don't use this method." define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method." define_deprecated_method :reset_shapes, :warn => "Don't use this method." define_deprecated_method :set_scroll_adjustments, :warn => "Use 'Gtk::Scrollable#set_hadjustment' and 'Gtk::Scrollable#set_vadjustment'." do |_self, hadj, vadj| _self.set_hadjustment(hadj) _self.set_vadjustment(vadj) true end alias :set_scroll_adjustment :set_scroll_adjustments define_deprecated_method :action, :warn => "Use 'Gtk::Activatable#related_action'." do |_self| _self.related_action end define_deprecated_method :size_request, :warn => "Use '#{self}#preferred_size'." do |_self| _self.preferred_size.last end define_deprecated_method :child_requisition, :warn => "Use '#{self}#preferred_size'." do |_self| _self.preferred_size.last end define_deprecated_method :set_state, :warn => "Use '#{self}#set_state_flags'." alias :state= :set_state define_deprecated_method :ensure_style, :warn => "Use 'Gtk::StyleContext'." define_deprecated_method :reset_rc_styles, :warn => "Use '#{self}#reset_style'." define_deprecated_method :class_path, :raise => "Use '#{self}#widget_path'." define_deprecated_method :modify_style, :warn => "Use 'Gtk::StyleContext'." define_deprecated_method :modifier_style, :raise => "Use 'Gtk::StyleContext'." define_deprecated_method :modify_fg, :warn => "Use '#{self}#override_color'." define_deprecated_method :modify_bg, :warn => "Use '#{self}#override_background_color'." define_deprecated_method :modify_text, :warn => "Use '#{self}#override_color'." define_deprecated_method :modify_base, :warn => "Use '#{self}#override_background_color'." define_deprecated_method :modify_font, :warn => "Use '#{self}#override_font'." define_deprecated_method :modify_cursor, :warn => "Use '#{self}#override_cursor'." define_deprecated_method :render_icon, :warn => "Use '#{self}#render_icon_pixbuf'." do |_self, stock_id, size, detail| _self.render_icon_pixbuf(stock_id, size) end define_deprecated_method :state, :raise => "Use '#{self}#state_flags'." define_deprecated_method :has_rc_style?, :warn => "Use 'Gtk::StyleContext'." do |_self| false end define_deprecated_method :requisition, :raise => "Don't use this method." define_deprecated_method :set_requisition, :warn => "Don't use this method." define_deprecated_method :saved_state, :raise => "Don't use this method." define_deprecated_method :pointer, :raise => "Use 'Gdk::Window#get_device_position'." alias :__set_allocation__ :set_allocation private :__set_allocation__ def set_allocation(*args) case args.size when 1 __set_allocation__(args.first) when 4 warn "#{caller[0]}: '#{self.class}#set_allocation(x, y, width, height)' style has been deprecated. Use '#{self.class}#set_allocation(alloc)' style." __set_allocation__(Gtk::Allocation.new(*args)) else raise ArgumentError.new("need 1 or 4 arguments.") end end define_deprecated_signal :expose_event, :warn => "Use '#{self}::draw' signal." define_deprecated_signal :state_changed, :warn => "Use '#{self}::state-flags-changed' signal." define_deprecated_signal :style_set, :warn => "Use '#{self}::style-updated' signal." end class Window extend GLib::Deprecatable define_deprecated_enums :Position, 'POS' define_deprecated_enums :Type define_deprecated_method :active_focus, :activate_focus define_deprecated_method :active_default, :activate_default end end ruby-gnome2-all-2.2.5/gtk3/lib/gtk3.rb0000755000175000017500000000036212516434313015433 0ustar koukou#! /usr/bin/env ruby =begin Copyright (c) 2006-2011 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. =end require 'gtk3/base' require 'gtk3/deprecated' Gdk.init if Gdk.respond_to?(:init) Gtk.init ruby-gnome2-all-2.2.5/gtk3/sample/0000755000175000017500000000000011701304107014735 5ustar koukouruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/0000755000175000017500000000000012516434313016454 5ustar koukouruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-dash.rb0000644000175000017500000000140712416346617021025 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-dash.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Dash This demo shows how to use GDK and cairo to show dash. From http://cairographics.org/samples/xxx_dash.html. =end require 'common' module Demo class CairoDash < CairoWindow def initialize super('cairo dash') end def draw(cr) dashes = [ 0.20, # in 0.05, # skip 0.05, # ink 0.05, # skip ] offset = -0.2 cr.set_dash(dashes, offset) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-line-join.rb0000644000175000017500000000173612416346617021777 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-line-join.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Line Join This demo shows how to use GDK and cairo to set line join. From http://cairographics.org/samples/set_line_join.html. =end require 'common' module Demo class CairoLineJoin < CairoWindow def initialize super('cairo line join') end def draw(cr) cr.set_line_width(0.16) cr.move_to(0.3, 0.33) cr.rel_line_to(0.2, -0.2) cr.rel_line_to(0.2, 0.2) cr.set_line_join(Cairo::LINE_JOIN_MITER) # default cr.stroke cr.move_to(0.3, 0.63) cr.rel_line_to(0.2, -0.2) cr.rel_line_to(0.2, 0.2) cr.set_line_join(Cairo::LINE_JOIN_BEVEL) cr.stroke cr.move_to(0.3, 0.93) cr.rel_line_to(0.2, -0.2) cr.rel_line_to(0.2, 0.2) cr.set_line_join(Cairo::LINE_JOIN_ROUND) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-fs-directory.png0000644000175000017500000000377411701304107022702 0ustar koukouPNG  IHDR00WbKGD{ḷIDATx۫W?{fNNB!4Q-^ ""D)O&PJmb4Z&95i697{-e֞ߜ) goΞ={w]k5s;U@?;)ӷϿ?,paM'P 7676Y_7=vx4~׸\9Qs_o?/S?|wߋ@34x˓8QPUTWh %ʎ"'q=  <,q yEWUкFP`;,ϩ/ro_~-7|^ET/YHcAQAxM7oN8~ wݽ/Pxd:kF6Y^]e2sq ]hyeuD4RUUp1.X ƠpWoPuEU9*WǕ%VM.Zv9^[O|7~GQTm[TCHW"I*x5 9`aaq6ti_L>y8~a\{-'Z +D*A~6W^S?чwoajB§?ukA0 ~,Sԇ5k<ǷE[ {`3w??H3g[_UUfg^rBNv!ڝ"jꂣZBqQGg?{sal,B vU2+FwQ3ǞDq,cTD&L`jpoEM+bA /Vxs5d D:NTgE]);1 GɊ4O#]0\=AZ+ƝW$T;m t}eg bU mJ(Q7+cb,)gJ]tfRDOxIa%m2A1Wxigt!2kfi: .4$< ]90Lh6A;@P\.ٕ6L#0q\Gs|fS Xˤ2;V )(VĂ-] -0A\!CfDp MgCV+ }fK2X{(iUUD﹬,LӪ+}f!Xvb$O X@N v%%V_t[ˮ;aJl-j`AԐ{~G|uU9pULI.^x  Vh5_|H֍em=5Eg9ǙӿF@nO~OL>p8sM M|1TҹMBYC"O=6jڟoMzy} Qs;[o&$J X*U7 tEIz|=uFM֖cWrޢ>kαs_MGCIENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-fill-and-stroke.rb0000644000175000017500000000140612416346617023100 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-fill-and-stroke.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Fill And Stroke This demo shows how to use GDK and cairo to fill and stroke. From http://cairographics.org/samples/fill_and_stroke.html. =end require 'common' module Demo class CairoFillAndStroke < CairoWindow def initialize super('cairo fill and stroke') end def draw(cr) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.close_path cr.set_source_rgba(0, 0, 1) cr.fill_preserve cr.set_source_rgba(0, 0, 0) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-path.rb0000644000175000017500000000113411701304107021017 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-path.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Path This demo shows how to use GDK and cairo to draw path. From http://cairographics.org/samples/path.html. =end require 'common' module Demo class CairoPath < CairoWindow def initialize super('cairo path') end def draw(cr) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/appwindow.rb0000644000175000017500000002055112516434313021014 0ustar koukou# Copyright (c) 2003-2014 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: appwindow.rb,v 1.7 2005/03/05 15:01:16 mutoh Exp $ =begin = Application main window Demonstrates a typical application window, with menubar, toolbar, statusbar. =end require 'common' module Demo class AppWindow < BasicWindow def initialize register_stock_icons ## Create toplevel window super('Application Window') table = Gtk::Table.new(1, 4, false) add(table) ## Create the menubar accel_group = Gtk::AccelGroup.new add_accel_group(accel_group) item_factory = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, '
', accel_group) # create menu items menuitem_cb = proc do |data, widget| # TODO: Show item-factory's path to menu item dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_CLOSE, "You selected or toggled the menu item \"#{Gtk::ItemFactory.path_from_widget(widget)}\"") # Close dialog on user response dialog.signal_connect('response') do |widget, data| widget.destroy end dialog.show end menu_items = [ ["/_File"], ["/_File/_New", "", "N", Gtk::Stock::NEW, menuitem_cb], ["/_File/_Open", "", "O", Gtk::Stock::OPEN, menuitem_cb], ["/File/_Save", "", "S", Gtk::Stock::SAVE, menuitem_cb], ["/File/Save _As...", "", nil, Gtk::Stock::SAVE, menuitem_cb], ["/File/sep1", "", nil, nil, menuitem_cb], ["/File/Quit", "", "Q", Gtk::Stock::QUIT, menuitem_cb], ["/_Preferences"], ["/_Preferences/_Color"], ["/_Preferences/Color/_Red", "", nil, nil, menuitem_cb], ["/_Preferences/Color/_Green", "/Preferences/Color/Red", nil, nil, menuitem_cb], ["/_Preferences/Color/_Blue", "/Preferences/Color/Red", nil, nil, menuitem_cb], ["/Preferences/_Shape"], ["/Preferences/Shape/_Square", "", nil, nil, menuitem_cb], ["/Preferences/Shape/_Rectangle", "/Preferences/Shape/Square", nil, nil, menuitem_cb], ["/Preferences/Shape/_Oval", "/Preferences/Shape/Square", nil, nil, menuitem_cb], # If you wanted this to be right justified you would use # "", not "". Right justified help menu # items are generally considered a bad idea now days. ["/_Help"], ["/Help/_About", "", nil, nil, Proc.new{about_cb}], ] item_factory.create_items(menu_items) table.attach(item_factory.get_widget('
'), # X direction # Y direction 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) ## Create the toolbar toolbar = Gtk::Toolbar.new # toolbar.set_toolbar_style(Gtk::Toolbar::BOTH) toolbar.append(Gtk::Stock::OPEN, "This is a demo button with an 'open' icon" ) do toolbar_cb end toolbar.append(Gtk::Stock::QUIT, "This is a demo button with an 'quit' icon" ) do toolbar_cb end toolbar.append_space toolbar.append(:demo_gtk_logo, "This is a demo button with an 'gtk' icon" ) do toolbar_cb end table.attach(toolbar, # X direction # Y direction 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) ## Create document sw = Gtk::ScrolledWindow.new sw.set_policy(:automatic, :automatic) sw.shadow_type = :in table.attach(sw, # X direction # Y direction 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) set_default_size(200, 200) contents = Gtk::TextView.new sw.add(contents) ## Create statusbar statusbar = Gtk::Statusbar.new table.attach(statusbar, # X direction # Y direction 0, 1, 3, 4, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) # Show text widget info in the statusbar buffer = contents.buffer buffer.signal_connect('changed') do |buffer| update_statusbar(buffer, statusbar) end # cursor moved buffer.signal_connect('mark_set') do |buffer, iter, mark| update_statusbar(buffer, statusbar) end end def toolbar_cb(*args) dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_CLOSE, "You selected a toolbar button") # Close dialog on user response dialog.signal_connect('response') do |widget, data| widget.destroy end dialog.show end def about_cb(*args) unless Gtk.check_version?(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" return end authors = ["Peter Mattis", "Spencer Kimball", "Josh MacDonald", "and many more..."] documentors = ["Owen Taylor", "Tony Gale", "Mattias Clasen ", "and many more..."] license = %Q[ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the Gnome Library; see the file COPYING.LIB.If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ] transparent = Gdk::Pixbuf.new(Demo.find_file("gtk-logo-rgb.gif")).add_alpha(true, 0xff, 0xff, 0xff) Gtk::AboutDialog.set_email_hook {|about, link| puts "send mail to #{link}" } Gtk::AboutDialog.set_url_hook {|about, link| puts "show url #{link}" } Gtk::AboutDialog.show(self, :name => "GTK+ Code Demos", :version => Gtk::VERSION.join("."), :copyright => "(C) 1997-2004 The GTK+ Team", :license => license, :website => "http://www.gtk.org", :comments => "Program to demonstrate GTK+ functions.", :authors => authors, :documenters => documentors, :logo => transparent) end def update_statusbar(buffer, statusbar) statusbar.pop(0) iter = buffer.get_iter_at_mark(buffer.get_mark('insert')) statusbar.push(0, "Cursor at row #{iter.line} column #{iter.line_offset} - #{buffer.char_count} chars in document") end def register_stock_icons # Register our stock items Gtk::Stock.add(:demo_gtk_logo, '_GTK!') # Add out custom icon factory to the list of defaults factory = Gtk::IconFactory.new factory.add_default filename = Demo.find_file('gtk-logo-rgb.gif') pixbuf = Gdk::Pixbuf.new(filename) transparent = pixbuf.add_alpha(true, 0xff, 0xff, 0xff) icon_set = Gtk::IconSet.new(transparent) factory.add('demo_gtk_logo', icon_set) end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/button_box.rb0000644000175000017500000000504712137115065021171 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: button_box.rb,v 1.3 2005/02/12 23:02:43 kzys Exp $ =begin = Button Boxes The Button Box widgets are used to arrange buttons with padding. =end require 'common' module Demo class ButtonBox < BasicWindow def initialize super('Button Boxes') set_border_width(10) main_vbox = Gtk::Box.new(:vertical) add(main_vbox) frame_horiz = Gtk::Frame.new('Horizontal Button Boxes') main_vbox.pack_start(frame_horiz, :expand => true, :fill => true, :padding => 10) vbox = Gtk::Box.new(:vertical) vbox.set_border_width(10) frame_horiz.add(vbox) vbox.pack_start(create_bbox(true, 'Spread', 40, :spread), :expand => true, :fill => true, :padding => 0) vbox.pack_start(create_bbox(true, 'Edge', 40, :edge), :expand => true, :fill => true, :padding => 5) vbox.pack_start(create_bbox(true, 'Start', 40, :start), :expand => true, :fill => true, :padding => 5) vbox.pack_start(create_bbox(true, 'End', 40, :end), :expand => true, :fill => true, :padding => 5) frame_vert = Gtk::Frame.new('Vertical Button Boxes') main_vbox.pack_start(frame_vert, :expand => true, :fill => true, :padding => 10) hbox = Gtk::Box.new(:horizontal, 0) hbox.set_border_width(10) frame_vert.add(hbox) hbox.pack_start(create_bbox(false, 'Spread', 30, :spread), :expand => true, :fill => true, :padding => 0) hbox.pack_start(create_bbox(false, 'Edge', 30, :edge), :expand => true, :fill => true, :padding => 5) hbox.pack_start(create_bbox(false, 'Start', 30, :start), :expand => true, :fill => true, :padding => 5) hbox.pack_start(create_bbox(false, 'End', 30, :end), :expand => true, :fill => true, :padding => 5) end def create_bbox(horizontal, title, spacing, layout) frame = Gtk::Frame.new(title) bbox = if horizontal Gtk::ButtonBox.new(:horizontal) else Gtk::ButtonBox.new(:vertical) end bbox.set_border_width(5) frame.add(bbox) bbox.layout_style = layout bbox.set_spacing(spacing) [Gtk::Stock::OK, Gtk::Stock::CANCEL, Gtk::Stock::HELP].each do |stock| button = Gtk::Button.new(:stock_id => stock) bbox.add(button) end return frame end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-curve-rectangle.rb0000644000175000017500000000463012416346617023175 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-curve-rectangle.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Curve Rectangle This demo shows how to use GDK and cairo to draw curve rectangle. From http://cairographics.org/samples/curve_rectangle.html. =end require 'common' module Demo class CairoCurveRectangle < CairoWindow # a custom shape, that could be wrapped in a function X0 = 0.1 #< parameters like Cairo::Context#rectangle Y0 = 0.1 RECT_WIDTH = 0.8 RECT_HEIGHT = 0.8 RADIUS = 0.4 #< and an approximate curvature radius X1 = X0 + RECT_WIDTH Y1 = Y0 + RECT_HEIGHT def initialize super('cairo curve rectangle') end def draw(cr) return if (RECT_WIDTH <= 0 || RECT_HEIGHT <= 0) if (RECT_WIDTH / 2 < RADIUS) if (RECT_HEIGHT / 2 < RADIUS) cr.move_to(X0, (Y0 + Y1) / 2) cr.curve_to(X0 ,Y0, X0, Y0, (X0 + X1) / 2, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, (Y0 + Y1) / 2) cr.curve_to(X1, Y1, X1, Y1, (X1 + X0) / 2, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, (Y0 + Y1) / 2) else cr.move_to(X0, Y0 + RADIUS) cr.curve_to(X0 ,Y0, X0, Y0, (X0 + X1) / 2, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, Y0 + RADIUS) cr.line_to(X1 , Y1 - RADIUS) cr.curve_to(X1, Y1, X1, Y1, (X1 + X0) / 2, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS) end else if (RECT_HEIGHT / 2 < RADIUS) cr.move_to(X0, (Y0 + Y1) / 2) cr.curve_to(X0, Y0, X0 , Y0, X0 + RADIUS, Y0) cr.line_to(X1 - RADIUS, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, (Y0 + Y1) / 2) cr.curve_to(X1, Y1, X1, Y1, X1 - RADIUS, Y1) cr.line_to(X0 + RADIUS, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, (Y0 + Y1) / 2) else cr.move_to(X0, Y0 + RADIUS) cr.curve_to(X0 , Y0, X0 , Y0, X0 + RADIUS, Y0) cr.line_to(X1 - RADIUS, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, Y0 + RADIUS) cr.line_to(X1 , Y1 - RADIUS) cr.curve_to(X1, Y1, X1, Y1, X1 - RADIUS, Y1) cr.line_to(X0 + RADIUS, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS) end end cr.close_path cr.set_source_rgba(0.5,0.5,1) cr.fill_preserve cr.set_source_rgba(0.5, 0, 0, 0.5) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/demo.ui0000644000175000017500000002740211701304107017734 0ustar koukou John Doe 25 This is the John Doe row Mary Dole 50 This is the Mary Dole row Copy Copy selected object into the clipboard gtk-copy Cut Cut selected object into the clipboard gtk-cut EditMenu _Edit FileMenu _File New Create a new file gtk-new Open Open a file gtk-open Paste Paste object from the Clipboard gtk-paste Quit Quit the program gtk-quit Save True Save a file gtk-save SaveAs Save with a different name gtk-save-as HelpMenu _Help About gtk-about GtkBuilder demo 250 440 GtkBuilder demo True True The menubar False True The toolbar False 1 automatic in True automatic True liststore1 3 Name list A list of person with name, surname and age columns Name 0 Surname 1 Age 2 2 True False 3 ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/stock_browser.rb0000644000175000017500000001530212142464343021671 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: stock_browser.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Stock Item and Icon Browser This source code for this demo doesn't demonstrate anything particularly useful in applications. The purpose of the 'demo' is just to provide a handy place to browse the available stock icons and stock items. =end require 'common' module Demo class StockBrowser < BasicWindow Item = Struct.new('Item', :stock_id, :label, :modifier, :keyval, :translation_domain) ItemInfo = Struct.new('ItemInfo', :id, :item, :small_icon, :const, :accel_str) ItemDisplay = Struct.new('ItemDisplay', :type_label, :const_label, :id_label, :label_accel_label, :icon_image) def initialize super('Stock Icons and Items') set_default_size(-1, 500) self.border_width = 8 hbox = Gtk::Box.new(:horizontal, 8) add(hbox) sw = Gtk::ScrolledWindow.new sw.set_policy(:never, :automatic) hbox.pack_start(sw, :expand => false, :fill => false, :padding => 0) model = create_model treeview = Gtk::TreeView.new(model) sw.add(treeview) column = Gtk::TreeViewColumn.new column.title = 'Const' cell_renderer = Gtk::CellRendererPixbuf.new column.pack_start(cell_renderer, :expand => false) column.set_attributes(cell_renderer, "stock_id" => 1) cell_renderer = Gtk::CellRendererText.new column.pack_start(cell_renderer, :expand => true) column.set_cell_data_func(cell_renderer) do |column, cell, model, iter| cell.text = iter[0].const end treeview.append_column(column) cell_renderer = Gtk::CellRendererText.new treeview.insert_column(-1, 'Label', cell_renderer) do |col, cell, model, iter| info = iter[0] cell.text = info.item.label if info end cell_renderer = Gtk::CellRendererText.new treeview.insert_column(-1, 'Accel', cell_renderer) do |col, cell, model, iter| info = iter[0] cell.text = info.accel_str if info end cell_renderer = Gtk::CellRendererText.new treeview.insert_column(-1, 'ID', cell_renderer) do |col, cell, model, iter| info = iter[0] cell.text = info.id if info end align = Gtk::Alignment.new(0.5, 0.0, 0.0, 0.0) hbox.pack_end(align, :expand => false, :fill => false, :padding => 0) frame = Gtk::Frame.new('Selected Item') align.add(frame) vbox = Gtk::Box.new(:vertical, 8) vbox.border_width = 4 frame.add(vbox) display = ItemDisplay.new class << treeview @display = nil attr_accessor :display end treeview.display = display display.type_label = Gtk::Label.new display.const_label = Gtk::Label.new display.id_label = Gtk::Label.new display.label_accel_label = Gtk::Label.new display.icon_image = Gtk::Image.new # empty image vbox.pack_start(display.type_label, :expand => false, :fill => false, :padding => 0) vbox.pack_start(display.icon_image, :expand => false, :fill => false, :padding => 0) vbox.pack_start(display.label_accel_label, :expand => false, :fill => false, :padding => 0) vbox.pack_start(display.const_label, :expand => false, :fill => false, :padding => 0) vbox.pack_start(display.id_label, :expand => false, :fill => false, :padding => 0) selection = treeview.selection selection.mode = :single selection.signal_connect('changed') do |s| selection_changed(s) end end def create_model store = Gtk::ListStore.new(ItemInfo, String, String, String) list_ids = Gtk::Stock.ids list_ids.sort! do |a, b| a.to_s <=> b.to_s end list_ids.each do |stock_id| info = ItemInfo.new info.id = stock_id begin info.item = Item.new(*Gtk::Stock.lookup(stock_id)) rescue ArgumentError info.item = Item.new end # only show icons for stock IDs that have default icons icon_set = Gtk::IconFactory.lookup_default(info.id.to_s) if icon_set # See what sizes this stock icon really exists at sizes = icon_set.sizes # Use menu size if it exists, otherwise first size found size = sizes.find do |s| s == :menu end || sizes.first info.small_icon = render_icon_pixbuf(info.id, size) unless size == :menu # Make the result the proper size for our thumbnail w, h = Gtk::IconSize.lookup(size) scaled = info.small_icon.scale(w, h, Gdk::Pixbuf::INTERP_BILINEAR) info.small_icon = scaled end else info.small_icon = nil end if info.item.keyval info.accel_str = Gtk::Accelerator.to_name(info.item.keyval, info.item.modifier) else info.accel_str = '' end info.const = id_to_const(info.id) iter = store.append iter[0] = info iter[1] = info.id end return store end def selection_changed(selection) treeview = selection.tree_view display = treeview.display iter = selection.selected info = iter[0] display.type_label.label = if info.small_icon and info.item.label 'Icon and Item' elsif info.small_icon 'Icon Only' elsif info.item.label 'Item Only' else '???????' end display.const_label.label = info.const display.id_label.label = info.id if info.item.label str = "%s %s" % [info.item.label, info.accel_str] display.label_accel_label.set_text(str, true) else display.label_accel_label.set_text('') end if info.small_icon display.icon_image.set_from_stock(info.id, get_largest_size(info.id)) else display.icon_image.pixbuf = nil end end def get_largest_size(symbol) set = Gtk::IconFactory.lookup_default(symbol.id2name) best_size = :invalid best_pixels = 0 sizes = set.sizes sizes.collect! do |i| width, height = Gtk::IconSize.lookup(i) [i, width * height] end return (sizes.max do |a, b| a[1] <=> b[1] end)[0] end def id_to_const(id) const = '' s = id.id2name if s =~ /^gtk-/ const += 'Gtk::Stock::' s[0,4] = '' end const += s.upcase.gsub(/-/, '_') const end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-long-lines.rb0000644000175000017500000000161312416346617022154 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-long-lines.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Long Lines This demo shows how to use GDK and cairo to show long lines. From http://cairographics.org/samples/xxx_long_liens.html. =end require 'common' module Demo class CairoLongLines < CairoWindow def initialize super('cairo long lines') end def draw(cr) cr.move_to(0.1, -50) cr.line_to(0.1, 50) cr.set_source_rgba(1, 0, 0) cr.stroke cr.move_to(0.2, -60) cr.line_to(0.2, 60) cr.set_source_rgba(1, 1, 0) cr.stroke cr.move_to(0.3, -70) cr.line_to(0.3, 70) cr.set_source_rgba(0, 1, 0) cr.stroke cr.move_to(0.4, -80) cr.line_to(0.4, 80) cr.set_source_rgba(0, 0, 1) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/changedisplay.rb0000644000175000017500000002717412137115065021626 0ustar koukou# -*- coding: utf-8 -*- # # Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: changedisplay.rb,v 1.6 2005/07/30 11:22:15 mutoh Exp $ =begin = Change Display Demonstrates migrating a window between different displays and screens. A display is a mouse and keyboard with some number of associated monitors. A screen is a set of monitors grouped into a single physical work area. The neat thing about having multiple displays is that they can be on a completely separate computers, as long as there is a network connection to the computer where the application is running. Only some of the windowing systems where GTK+ runs have the concept of multiple displays and screens. (The X Window System is the main example.) Other windowing systems can only handle one keyboard and mouse, and combine all monitors into a single screen. This is a moderately complex example, and demonstrates: - Tracking the currently open displays and screens - Changing the screen for a window - Letting the user choose a window by clicking on it - Using Gtk::ListStore and Gtk::TreeView - Using Gtk::Dialog =end require 'common' module Demo class ChangeDisplay < Gtk::Dialog # These enumerations provide symbolic names for the columns # in the two GtkListStore models. DISPLAY_COLUMN_NAME, DISPLAY_COLUMN_DISPLAY = 0, 1 SCREEN_COLUMN_NUMBER, SCREEN_COLUMN_SCREEN = 0, 1 # Main entry point. If the dialog for this demo doesn't yet exist, creates # it. Otherwise, destroys it. def initialize @size_group = nil @display_model = nil @screen_model = nil @screen_selection = nil @current_display = nil @current_screen = nil super( :title => 'Change Screen or display', :buttons => [ [:close, :close], ['Change', :ok] ] ) set_default_size(300, 400) signal_connect('response') do |dialog, response_id| if response_id == Gtk::ResponseType::OK query_change_display else destroy end end vbox = Gtk::Box.new(:vertical, 5) vbox.set_border_width(8) self.child.pack_start(vbox, :expand => true, :fill => true) @size_group = Gtk::SizeGroup.new(:horizontal) frame = create_display_frame vbox.pack_start(frame, :expand => true, :fill => true) frame = create_screen_frame vbox.pack_start(frame, :expand => true, :fill => true) initialize_displays end # Adds all currently open displays to our list of displays, # and set up a signal connection so that we'll be notified # when displays are opened in the future as well. def initialize_displays manager = Gdk::DisplayManager.get manager.displays.each do |display| add_display(display) end handler_id = manager.signal_connect('display_opened') do |display| add_display(display) end signal_connect('destroy') do manager.signal_handler_disconnect(handler_id) end end # Fills in the screen list based on the current display def fill_screens @screen_model.clear if @current_display n_screens = @current_display.n_screens n_screens.times do |i| iter = @screen_model.append iter.set_value(SCREEN_COLUMN_NUMBER, i) iter.set_value(SCREEN_COLUMN_SCREEN, @current_display.get_screen(i)) if i == 0 @screen_selection.select_iter(iter) end end end end # Creates the 'Display' frame in the main window. def create_display_frame frame, tree_view, button_vbox = create_frame('Display') button = left_align_button_new('_Open…') button.signal_connect('clicked') do open_display_cb end button_vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) button = left_align_button_new('_Close') button.signal_connect('clicked') do if @current_display @current_display.close end end button_vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) @display_model = Gtk::ListStore.new(String, Gdk::Display) tree_view.model = @display_model column = Gtk::TreeViewColumn.new('Name', Gtk::CellRendererText.new, {'text' => DISPLAY_COLUMN_NAME}) tree_view.append_column(column) selection = tree_view.selection selection.signal_connect('changed') do display_changed_cb(selection) end return frame end # Creates the 'Screen' frame in the main window. def create_screen_frame frame, tree_view, button_vbox = create_frame('Screen') @screen_model = Gtk::ListStore.new(Integer, Gdk::Screen) tree_view.model = @screen_model column = Gtk::TreeViewColumn.new('Number', Gtk::CellRendererText.new, {'text' => SCREEN_COLUMN_NUMBER}) tree_view.append_column(column) @screen_selection = tree_view.selection @screen_selection.signal_connect('changed') do |selection| @current_screen = if iter = selection.selected iter.get_value(SCREEN_COLUMN_SCREEN) else nil end end return frame end # This function is used both for creating the 'Display' and # 'Screen' frames, since they have a similar structure. The # caller hooks up the right context for the value returned # in tree_view, and packs any relevant buttons into button_vbox. def create_frame(title) frame = Gtk::Frame.new(title) hbox = Gtk::Box.new(:horizontal, 8) hbox.set_border_width(8) frame.add(hbox) scrollwin = Gtk::ScrolledWindow.new scrollwin.set_policy(:never, :automatic) scrollwin.shadow_type = :in hbox.pack_start(scrollwin, :expand => true, :fill => true) tree_view = Gtk::TreeView.new tree_view.headers_visible = false scrollwin.add(tree_view) selection = tree_view.selection selection.mode = :browse button_vbox = Gtk::Box.new(:vertical, 5) hbox.pack_start(button_vbox, :expand => false, :fill => false) @size_group.add_widget(button_vbox) return frame, tree_view, button_vbox end # If we have a stack of buttons, it often looks better if their contents # are left-aligned, rather than centered. This function creates a button # and left-aligns it contents. def left_align_button_new(label) button = Gtk::Button.new(:mnemonic => label) button.child.set_alignment(0.0, 0.5) return button end # Prompts the user for a toplevel window to move, and then moves # that window to the currently selected display def query_change_display screen = self.screen toplevel = query_for_toplevel(screen, "Please select the toplevel\n"+ "to move to the new screen") if toplevel toplevel.screen = @current_screen else screen.display.beep end end # Asks the user to click on a window, then waits for them click # the mouse. When the mouse is released, returns the toplevel # window under the pointer, or nil, if there is none. def query_for_toplevel(screen, prompt) toplevel = nil display = screen.display popup = Gtk::Window.new(:popup) popup.screen = screen popup.modal = true popup.window_position = :center frame = Gtk::Frame.new frame.set_shadow_type(:out) popup.add(frame) label = Gtk::Label.new(prompt) label.set_padding(10, 10) frame.add(label) popup.show_all # TODO: Gdk::Cursor.new(screen.display, Gdk::Cursor::CROSSHAIR) cursor = Gdk::Cursor.new(:crosshair) if Gdk::pointer_grab( popup.window, false, :button_release_mask, nil, cursor, Gdk::Event::CURRENT_TIME ) == Gdk::GRAB_SUCCESS clicked = false popup.signal_connect('button-release-event') do clicked = true end # Process events until clicked is set by button_release_event_cb. # We pass in may_block = true since we want to wait if there # are no events currently. until clicked Gtk.main_iteration # TODO: GLib::main_context_iteration(nil, true) toplevel = find_toplevel_at_pointer(screen.display) if toplevel == popup toplevel = nil end end popup.destroy Gdk.flush # Really release the grab return toplevel end end # Finds the toplevel window under the mouse pointer, if any. def find_toplevel_at_pointer(display) pointer_window, x, y = display.window_at_pointer # The user data field of a GdkWindow is used to store a pointer # to the widget that created it. if pointer_window widget = pointer_window.user_data end return (if widget widget.toplevel else nil end) end # Called when the user clicks on 'Open...' in the display # frame. Prompts for a new display, and then opens a connection # to that display. def open_display_cb dialog = Gtk::Dialog.new( :title => 'Open Display', :parent => self, :flags => :modal, :buttons => [ [:cancel, :cancel], [:ok, :ok] ] ) dialog.default_response = Gtk::ResponseType::OK display_entry = Gtk::Entry.new display_entry.activates_default = true dialog_label = Gtk::Label.new("Please enter the name of\nthe new display\n") dialog.child.add(dialog_label) dialog.child.add(display_entry) display_entry.grab_focus dialog.child.show_all result = nil until result response_id = dialog.run break if response_id != Gtk::ResponseType::OK new_screen_name = display_entry.text unless new_screen_name.empty? begin result = Gdk::Dispaly.open(new_screen_name) rescue dialog_label.text = "Can't open display :\n\t%s\nplease try another one\n" % [new_screen_name] end end end dialog.destroy end # Called when the selected row in the display list changes. # Updates info.current_display, then refills the list of # screens. def display_changed_cb(selection) @current_display = if iter = selection.selected iter.get_value(DISPLAY_COLUMN_DISPLAY) else nil end fill_screens end # Adds a new display to our list of displays, and connects # to the 'closed' signal so that we can remove it from the # list of displays again. def add_display(display) iter = @display_model.append iter.set_value(DISPLAY_COLUMN_NAME, display.name) iter.set_value(DISPLAY_COLUMN_DISPLAY, display) handler_id = display.signal_connect('closed') do display_closed_cb(display) end signal_connect('destroy') do display.signal_handler_disconnect(handler_id) end end # Called when one of the currently open displays is closed. # Remove it from our list of displays. def display_closed_cb(display) @display_model.each do |model, path, iter| tmp_display = iter.get_value( DISPLAY_COLUMN_DISPLAY) if tmp_display == display @display_model.remove(iter) break end end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-arc-negative.rb0000644000175000017500000000215412416346617022453 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-arc-negative.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Arc Negative This demo shows how to use GDK and cairo to draw arc in negative. From http://cairographics.org/samples/arc_negative.html. =end require 'common' module Demo class CairoArcNegative < CairoWindow CENTER_X = 0.5 CENTER_Y = 0.5 RADIUS = 0.4 ANGLE1 = 45.0 * (Math::PI / 180.0) # angles are specified ANGLE2 = 180.0 * (Math::PI / 180.0) # in radians def initialize super('cairo arc_negative') end def draw(cr) cr.arc_negative(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2) cr.stroke # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI) cr.fill cr.set_line_width(0.03) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE1) cr.line_to(CENTER_X, CENTER_Y) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE2, ANGLE2) cr.line_to(CENTER_X, CENTER_Y) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/links.rb0000644000175000017500000000376712137115065020135 0ustar koukou# Copyright (c) 2013 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Links GtkLabel can show hyperlinks. The default action is to call gtk_show_uri() on their URI, but it is possible to override this with a custom handler. =end require 'common' module Demo class Links < BasicWindow def initialize super('Links') title = 'Links' border_width = 12 signal_connect(:destroy) {self.destroy} label = Gtk::Label.new "Some text may be marked up\n" + "as hyperlinks, which can be clicked\n" + "or activated via keynav\n" + "and they work fine with other markup, like when\n" + "searching on " + "Go" + "og" + "le" + "." label.use_markup = true label.signal_connect(:activate_link) {|widget, uri| activate_link uri} add label label.show end def activate_link uri if uri == 'keynav' dialog = Gtk::MessageDialog.new :parent => self, :flags => :destroy_with_parent, :type => :info, :buttons_type => :ok dialog.markup = "The term keynav is a shorthand for " + "keyboard navigation and refers to the process of using " + "a program (exclusively) via keyboard input." dialog.present dialog.signal_connect(:response) {dialog.destroy} return true end false end end endruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/panes.rb0000644000175000017500000001030712416346617020120 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: panes.rb,v 1.5 2005/02/12 23:06:07 kzys Exp $ =begin = Paned Widgets The Gtk::HPaned and Gtk::VPaned Widgets divide their content area into two panes with a divider in between that the user can adjust. A separate child is placed into each pane. There are a number of options that can be set for each pane. This test contains both a horizontal (HPaned) and a vertical (VPaned) widget, and allows you to adjust the options for each side of each widget. =end require 'common' module Demo class Panes < BasicWindow def initialize super('Panes') self.border_width = 0 vbox = Gtk::VBox.new(false, 0) add(vbox) vpaned = Gtk::VPaned.new vbox.pack_start(vpaned, :expand => true, :fill => true, :padding => 0) vpaned.border_width = 5 hpaned = Gtk::HPaned.new vpaned.add1(hpaned) frame = Gtk::Frame.new frame.shadow_type = :in frame.set_size_request(60, 60) hpaned.add1(frame) button = Gtk::Button.new('_Hi there', true) frame.add(button) frame = Gtk::Frame.new frame.shadow_type = :in frame.set_size_request(80, 60) hpaned.add2(frame) frame = Gtk::Frame.new frame.shadow_type = :in frame.set_size_request(60, 80) vpaned.add2(frame) # Now create toggle buttons to control sizing vbox.pack_start(create_pane_options(hpaned, 'Horizontal', 'Left', 'Right'), :expand => false, :fill => false, :padding => 0) vbox.pack_start(create_pane_options(vpaned, 'Vertical', 'Top', 'Bottom'), :expand => false, :fill => false, :padding => 0) end def create_pane_options(paned, frame_label, label1, label2) frame = Gtk::Frame.new(frame_label) frame.border_width = 4 table = Gtk::Table.new(3, 2, true) frame.add(table) label = Gtk::Label.new(label1) table.attach_defaults(label, 0, 1, 0, 1) check_button = Gtk::CheckButton.new('_Resize', true) table.attach_defaults(check_button, 0, 1, 1, 2) check_button.signal_connect('toggled') do toggle_resize(paned.child1) end check_button = Gtk::CheckButton.new('_Shrink', true) table.attach_defaults(check_button, 0, 1, 2, 3) check_button.active = true check_button.signal_connect('toggled') do toggle_shrink(paned.child1) end label = Gtk::Label.new(label2) table.attach_defaults(label, 1, 2, 0, 1) check_button = Gtk::CheckButton.new('_Resize') table.attach_defaults(check_button, 1, 2, 1, 2) check_button.active = true check_button.signal_connect('toggled') do toggle_resize(paned.child2) end check_button = Gtk::CheckButton.new('_Shrink') table.attach_defaults(check_button, 1, 2, 2, 3) check_button.active = true check_button.signal_connect('toggled') do toggle_shrink(paned.child2) end return frame end def toggle_resize(child) paned = child.parent is_child1 = (child == paned.child1) resize = if is_child1 paned.child1_resize? else paned.child2_resize? end shrink = if is_child1 paned.child1_shrink? else paned.child2_shrink? end child.parent.remove(child) if is_child1 paned.pack1(child, !resize, shrink) else paned.pack2(child, !resize, shrink) end end def toggle_shrink(child) paned = child.parent is_child1 = (child == paned.child1) resize = if is_child1 paned.child1_resize? else paned.child2_resize? end shrink = if is_child1 paned.child1_shrink? else paned.child2_shrink? end child.parent.remove(child) if is_child1 paned.pack1(child, resize, !shrink) else paned.pack2(child, resize, !shrink) end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-text-align-center.rb0000644000175000017500000000221012416346617023431 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-text-align-center.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Text Align Center This demo shows how to use GDK and cairo to show text in center. From http://cairographics.org/samples/text_align_center.html. =end require 'common' module Demo class CairoTextAlignCenter < CairoWindow TEXT = "Ruby" def initialize super('cairo text align center') end def draw(cr) cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL) cr.set_font_size(0.2) extents = cr.text_extents(TEXT) x = 0.5 - (extents.width / 2 + extents.x_bearing) y = 0.5 - (extents.height / 2 + extents.y_bearing) cr.move_to(x, y) cr.show_text(TEXT) # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(x, y, 0.05, 0, 2 * Math::PI) cr.fill cr.move_to(0.5, 0) cr.rel_line_to(0, 1) cr.move_to(0, 0.5) cr.rel_line_to(1, 0) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/textview.rb0000644000175000017500000003766312416346617020707 0ustar koukou# -*- coding: utf-8 -*- # Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: textview.rb,v 1.8 2005/02/06 18:25:13 kzys Exp $ =begin = Text Widget/Multiple Views The Gtk::TextView widget displays a Gtk::TextBuffer. One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews. This demo has two views displaying a single buffer, and shows off the widget's text formatting features. =end require 'common' module Demo class TextView < BasicWindow GRAY50_WIDTH = 2 GRAY50_HEIGHT = 2 GRAY50_BITS = [0x02, 0x01].pack("c") @@nest_window = nil def initialize super("TextView Window") set_default_size(450, 450) set_title("TextView") set_border_width(0) vpaned = Gtk::VPaned.new vpaned.set_border_width(5) add(vpaned) ## # For convenience, we just use the autocreated buffer from # the first text view; you could also create the buffer # by itself with Gtk::TextBuffer.new, then later create # a view widget. # view1 = Gtk::TextView.new buffer = view1.buffer view2 = Gtk::TextView.new(buffer) sw = Gtk::ScrolledWindow.new(nil, nil) sw.set_policy(:automatic, :automatic) vpaned.add1(sw) sw.add(view1) sw = Gtk::ScrolledWindow.new(nil, nil) sw.set_policy(:automatic, :automatic) vpaned.add2(sw) sw.add(view2) create_tags(buffer) insert_text(buffer) attach_widgets(view1) attach_widgets(view2) vpaned.show_all self.show end def create_tags(buffer) ## # Create a bunch of tags. Note that it's also possible to # create tags with Gtk::TextTag.new then add them to the # tag table for the buffer, Gtk::TextBuffer#create_tag is # just a convenience function. Also note that you don't have # to give tags a name; pass NULL for the name to create an # anonymous tag. # # In any real app, another useful optimization would be to create # a Gtk::TextTagTable in advance, and reuse the same tag table for # all the buffers with the same tag set, instead of creating # new copies of the same tags for every buffer. # # Tags are assigned default priorities in order of addition to the # tag table. That is, tags created later that affect the same text # property affected by an earlier tag will override the earlier # tag. You can modify tag priorities with # Gtk::TextTag#set_priority. # buffer.create_tag('heading', 'weight' => Pango::FontDescription::WEIGHT_BOLD, 'size' => 15 * Pango::SCALE) buffer.create_tag("italic", "style" => Pango::FontDescription::STYLE_ITALIC) buffer.create_tag("bold", "weight" => Pango::FontDescription::WEIGHT_BOLD) buffer.create_tag("big", # points times the PANGO_SCALE factor "size" => 20 * Pango::SCALE) buffer.create_tag("xx-small", "scale" => Pango::AttrScale::XX_SMALL) buffer.create_tag("x-large", "scale" => Pango::AttrScale::X_LARGE) buffer.create_tag("monospace", "family" => "monospace") buffer.create_tag("blue_foreground", "foreground" => "blue") buffer.create_tag("red_background", "background" => "red") stipple = Gdk::Pixmap.create_from_data(nil, GRAY50_BITS, GRAY50_WIDTH, GRAY50_HEIGHT) buffer.create_tag("background_stipple", "background_stipple" => stipple) buffer.create_tag("foreground_stipple", "foreground_stipple" => stipple) buffer.create_tag("big_gap_before_line", "pixels_above_lines" => 30) buffer.create_tag("big_gap_after_line", "pixels_below_lines" => 30) buffer.create_tag("double_spaced_line", "pixels_inside_wrap" => 10) buffer.create_tag("not_editable", "editable" => false) buffer.create_tag("word_wrap", "wrap_mode" => :word) buffer.create_tag("char_wrap", "wrap_mode" => Gtk::TextTag::WRAP_CHAR) buffer.create_tag("no_wrap", "wrap_mode" => :none) buffer.create_tag("center", "justification" => Gtk::JUSTIFY_CENTER) buffer.create_tag("right_justify", "justification" => Gtk::JUSTIFY_RIGHT) buffer.create_tag("wide_margins", "left_margin" => 50, "right_margin" => 50) buffer.create_tag("strikethrough", "strikethrough" => true) buffer.create_tag("underline", "underline" => Pango::AttrUnderline::SINGLE) buffer.create_tag("double_underline", "underline" => Pango::AttrUnderline::DOUBLE) buffer.create_tag("superscript", "rise" => 10 * Pango::SCALE, # 10 pixels "size" => 8 * Pango::SCALE) # 8 points buffer.create_tag("subscript", "rise" => -10 * Pango::SCALE, # 10 pixels "size" => 8 * Pango::SCALE) # 8 points buffer.create_tag("rtl_quote", "wrap_mode" => :word, "direction" => Gtk::Widget::TEXT_DIR_RTL, "indent" => 30, "left_margin" => 20, "right_margin" => 20) end def insert_text(buffer) ## # Demo.find_file looks in the the current directory first, # so you can run gtk-demo without installing GTK, then looks # in the location where the file is installed. # filename = Demo.find_file("gtk-logo-rgb.gif") pixbuf = Gdk::Pixbuf.new(filename) if filename unless pixbuf $stderr.print "Failed to load image file gtk-logo-rgb.gif\n" exit 1 end scaled = pixbuf.scale(32, 32, Gdk::Pixbuf::INTERP_BILINEAR) pixbuf = scaled ## # get start of buffer; each insertion will revalidate the # iterator to point to just after the inserted text. # iter = buffer.get_iter_at(:offset => 0) buffer.insert(iter, "The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n") buffer.insert(iter, "Font styles. ", 'heading') buffer.insert(iter, "For example, you can have ") buffer.insert(iter, "italic", "italic") buffer.insert(iter, ", ") buffer.insert(iter, "bold", "bold") buffer.insert(iter, ", or ") buffer.insert(iter, "monospace(typewriter)", "monospace") buffer.insert(iter, ", or ") buffer.insert(iter, "big", "big") buffer.insert(iter, " text. ") buffer.insert(iter, "It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as ") buffer.insert(iter, "xx-small", "xx-small") buffer.insert(iter, " or ") buffer.insert(iter, "x-large", "x-large") buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n") buffer.insert(iter, "Colors. ", "heading") buffer.insert(iter, "Colors such as ") buffer.insert(iter, "a blue foreground", "blue_foreground") buffer.insert(iter, " or ") buffer.insert(iter, "a red background", "red_background") buffer.insert(iter, " or even ") buffer.insert(iter, "a stippled red background", "red_background", "background_stipple") buffer.insert(iter, " or ") buffer.insert(iter, "a stippled blue foreground on solid red background", "blue_foreground", "red_background", "foreground_stipple") buffer.insert(iter, "(select that to read it) can be used.\n\n") buffer.insert(iter, "Underline, strikethrough, and rise. ", "heading") buffer.insert(iter, "Strikethrough", "strikethrough") buffer.insert(iter, ", ") buffer.insert(iter, "underline", "underline") buffer.insert(iter, ", ") buffer.insert(iter, "double underline", "double_underline") buffer.insert(iter, ", ") buffer.insert(iter, "superscript", "superscript") buffer.insert(iter, ", and ") buffer.insert(iter, "subscript", "subscript") buffer.insert(iter, " are all supported.\n\n") buffer.insert(iter, "Images. ", "heading") buffer.insert(iter, "The buffer can have images in it: ") buffer.insert(iter, pixbuf) buffer.insert(iter, pixbuf) buffer.insert(iter, pixbuf) buffer.insert(iter, " for example.\n\n") buffer.insert(iter, "Spacing. ", "heading") buffer.insert(iter, "You can adjust the amount of space before each line.\n") buffer.insert(iter, "This line has a whole lot of space before it.\n", "big_gap_before_line", "wide_margins") buffer.insert(iter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", "big_gap_after_line", "wide_margins") buffer.insert(iter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", "double_spaced_line", "wide_margins") buffer.insert(iter, "Also note that those lines have extra-wide margins.\n\n") buffer.insert(iter, "Editability. ", "heading") buffer.insert(iter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", "not_editable") buffer.insert(iter, "Wrapping. ", "heading") buffer.insert(iter, "This line(and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n") buffer.insert(iter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", "char_wrap") buffer.insert(iter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", "no_wrap") buffer.insert(iter, "Justification. ", "heading") buffer.insert(iter, "\nThis line has center justification.\n", "center") buffer.insert(iter, "This line has right justification.\n", "right_justify") buffer.insert(iter, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", "wide_margins") buffer.insert(iter, "Internationalization. ", "heading") buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n") buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n") buffer.insert(iter, "??? ??? ???? ?? ???? ???????? ????? ?? ???? ?????? ??????? ??????? ?? ???? ?????? ?? ????? ?? ??????? ????? ??????? ??? ?????? ????? ?????? ????? ???? ?? ?????? ?????? ?? ???????? ?????? ????? ?? ???? ???? ????????? ???????. ???? ???? ??? ???????? ????? ?? »????????« ?? ???????.\n\n", "rtl_quote") buffer.insert(iter, "You can put widgets in the buffer: Here's a button: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " and a menu: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " and a scale: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " and an animation: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " finally a text entry: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, ".\n") buffer.insert(iter, "\n\nThis demo doesn't demonstrate all the Gtk::TextBuffer features; it leaves out, for example: invisible/hidden text(doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...") # Apply word_wrap tag to whole buffer buf_start, buf_end = buffer.bounds buffer.apply_tag("word_wrap", buf_start, buf_end) end def find_anchor(iter) while iter.forward_char do return true if iter.child_anchor end return false end def attach_widgets(text_view) buffer = text_view.buffer; iter = buffer.start_iter i = 0; while find_anchor(iter) do anchor = iter.child_anchor if i == 0 widget = Gtk::Button.new("Click Me") widget.signal_connect('clicked') { |button| if @@nest_window and ! @@nest_window.destroyed? @@nest_window.present break end buffer = Gtk::TextBuffer.new iter = buffer.start_iter buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, "\nDon't do this in real applications, please.\n") view = Gtk::TextView.new(buffer) recursive_attach_view(0, view, anchor) @@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL) sw = Gtk::ScrolledWindow.new(nil, nil) sw.set_policy(:automatic, :automatic) @@nest_window.add(sw) sw.add(view) @@nest_window.set_default_size(300, 400) @@nest_window.show_all } elsif i == 1 menu = Gtk::Menu.new widget = Gtk::OptionMenu.new menu_item = Gtk::MenuItem.new("Option 1") menu.append(menu_item) menu_item = Gtk::MenuItem.new("Option 2") menu.append(menu_item) menu_item = Gtk::MenuItem.new("Option 3") menu.append(menu_item) widget.menu = menu elsif i == 2 widget = Gtk::HScale.new widget.set_range(0, 100) widget.set_size_request(70, -1) elsif i == 3 filename = Demo.find_file("floppybuddy.gif") widget = Gtk::Image.new(filename) elsif i == 4 widget = Gtk::Entry.new else #widget = nil; avoids a compiler warning #g_assert_not_reached ; end text_view.add_child_at_anchor(widget, anchor) widget.show_all i += 1 end end def recursive_attach_view(depth, view, anchor) return if depth > 4 child_view = Gtk::TextView.new(view.buffer) # Event box is to add a black border around each child view event_box = Gtk::EventBox.new color = Gdk::Color.parse("black") event_box.modify_bg(Gtk::STATE_NORMAL, color) align = Gtk::Alignment.new(0.5, 0.5, 1.0, 1.0) align.set_border_width(1) event_box.add(align) align.add(child_view) view.add_child_at_anchor(event_box, anchor) recursive_attach_view(depth + 1, child_view, anchor) end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/background.jpg0000644000175000017500000005331311701304107021272 0ustar koukouJFIFHHCreated with The GIMPC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"8!1AQ"a2q#BR3rbC1 ?T[C GzFh ʎ^h| lFT{(v4 TQ|Q ¡KHylmUw$"G4dvEL C1H2;ށY $=3Y4pVM'UDkYR#B@X㘧X"A8$rB Kиd֩1`Np˛MTDL~)oϊ%%FQ"-ó<P \(@E/zg[}ST-ɌpD* $EV$~7U ` {U-yZTꍻk :ԃD!7@`5{~(1`vֲ0ݤ}N[ͰPb"7"1 rfV $Oo~Pe5'HqTfڠXEgU27?)7fW]ۉ?mos9 hb$CYQG-3]:sRH;սXf$}YڶB[Pr$G N,T4hx>iFER*@=sb;k|*(O>(P$S aN<2UpXK&v^*=Fse{]t߭e-胯WeqM@~t{ u-ҳqmAjX&O5@W ڝyp*ʾ;hrI =C!9g(ǚ 3X:46P c h46P1:Hd{ EDnH:XE; Pn- OZxB2Ց1#>H1Hӏ(3b]0H:TɽԶ(L#ɥZùa{im-ZKPm?.ucʁRKT-[npX3 k-9\x CSnDSڣNrQ(~(`K UuQv)aseTI2)e+a{$W>৐;U ߎi+P꣰t= :{p8ULZ*k$My N_q&^MFy:N嶽Ř0PtUBuH=Ywz̈%)PzpX!\\'jt9 W\*i$ ' WOhl/K{@`d~h`@2y)K,-UB} ) c梳gdbDH)B@M>GYh -剃<^e{ZgMm-HU'Pfh P#9g; 'GH؊e]V._%DkTobvh:` cMs\`Ph99 ~ᕰ@=A[%Ǹ:*)>cE lF܍H2'4l<:+^%m9ƷLtU@QIJ) r?={. ?[p9-7Mmn:b].ۻY!wU ˃ <]zFڤ*2'B2cnRދ9b7ⅲ}H=sxs@m*-W[;1 ~p *ΉhX悳75,4$x5FPg114 1ދLS.:> Pˤvu9"t4Od|ċi,H"=1K2R{οXu2OĞ>k)!8wTPd yb`5^S[rqgg4[CkԎ2vڨ+dL FKb*=v*YXD I~@A}R΢V٠mȂb5qU@}5VcځllKx@U@-r7'g$h?5 ˘S\zxxs3UhQDe&vf1(HCl6Si@8("o[캤KxUn[Sy`椷K=5%pvhnUd hB TsZ+'.40LcwGqjȝ ,nط[>ªbuAඡ@&;P"1P@*"I<,CL~GuInkF -S)wü zfڵZv ?W0Xb}؏hIKVГ6>dOl@#Ku h?{HDH #E@*K 11As Y v,VmP fl(]*?o\[}: P;-KKA ?;eFIրImRAPǽrݫCI~5pYeK}g@ v ӕB$w!| e r1 S1v3(* #=b'KSIrNKyTnތfU"u:~( [H/RI2I317)ڏbOo`L{(i3tk J+;!Ҵq*!yـLB+cڟ#&c*& РGQ@B'Qa0=I6t&d 䊨,nط[>ªbuAඡ@&;TR*I$)}21dy~T>6:Tkx0`2|; ~nͫ]5`p>jLn &*)݈DTo 0+0#cDH6̴9P̶aT@D 9 Tx[;bN eJb`vlU2 ~Ojnbq۲31F5ŷӮ ð^ jAszFThĝh E$ { -ڴ?`q?Q 6^'{b 9T,NZqojXֹ`m< v!m+;zmw$UXȘR[{ i.9Z:nap+q#KGdx^=EИT\׮qz{Nxaڼuze6Ŷq֦ rO›*qle5\(UQu|Q޵K\r} A(83,g[;GޑWӑ8 ==:M$GP)v(@sW SG$=C1ԁ$fi_UMmVDӺgp-dDk5' A(=TqY$ַm3  U fv"qS*`Bݏ?OyZP=c&g3h LE Ŏ,s1kY N(6*< 7X sO>ɓ'A- EIv o+ DLbk7S 3LAQLWitτ! >aIڃ*=T5[ ?K([f{P)9?jֹ`m< v!m+;zmw$U)%[`5ȗ bz_{4xN] Omz hyW W]gSl[i'jj*^ w$)|Gk0Pc\P͜}QUh0']η=\@T G42; A2ɌuHKaTxqM9P܃ڭcJ )A m>P f {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1ոu=O4ޡԨ{J81{'k*CNF 􂋬ξcܚA$F5UFpX7Hf׶\6vKq>)A m>P f {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1\EtonsEZ*?UGlbR.w :W%D&1Q{z MHwwn8^Z l)$5 Z|S?4!-+V( \ĉ1Y%wi-ALU]axX-+r}6UOj RVia*JݲOrP% Yై5@팪b;H@2\" e(PHzWp"ډ1t8;,++\c5O4 t6B:4Urv(qU<- r>;QM'<_IϨ lg( $ncof6ӥ*e B^~hP:f5QqSݸ.3l QBTsFtœ f9WPyEk :'&OmtzyLXzS>N;iReUq/En~ہ@үQY-qL3q2k/\ A⹺wf׻q&893,H␲Rg,4UWP\P@B2b`KF_oimP/к#gAUSXˀ<8fŲI&gj Gڎ0YV  UP{2a汶 2y 5T[]?LL3$r; j95PPX2Z3q'PҰiR/{{@Ы@H9l* @TfX !e)ɢ2ϘXi@*d1YP0,>f_u$# F` yrN>ؤg%R~)U 2ۍNPlG n2,]V!)R.NG~ G:ɊtLkY_$*[v$h a=iF. @'02IcX$ӥ@ ?j5`ANyWǸ`a-)N⋹!f{M#x۞Oڛ ,dyB[9?4WrA#T#[M*n@)Ҥ:Ivs)P'FbΦ˾D.8ԽhDT)OHKAƝL|Q=*i0 vMf[4" EbqT,,xb!x[aP;%?!-ROv'1G0Y/i5nFg#G _ @'zk2V6;_@a,kĚ/̷Qw7&Z FFPAb-j4@b;^f1Vjjl^^ ~sEGӴ0R:q:WL¬€2 X7fAjı8vbnԅ!53ж"<RT Umo6cڵ7oV`|df"džMJ9 Ub9=-r֡)`)0&55<5@]D=kpl? -rZDRPpuUM#`lsk m7ʆkV@5HΪ 1<$P"LGv(Iv,< 2+9lڊ>p@WC)"KhwUIk,1se[P; KK;d 5U7L[NA^.L)Gi2$p/ AUE(ñ:2.kvRfL6&IX80$ʑW׹E۷Qvy[iQӲ-[>3?5Q4:v&&A|ǦO5y"B0[ĝE⵷gkPa1+{ ds ip]GTy>h[Li(~Y'T q588*4H>Kmq@I3?PIi8QdyDS"*+N"`ڀ$YĒq$qYR촋kwnx NLDOsA*\')BvQJ}(hB/;$@ؖhl@$a@@UBAk-솝"c(arFB{&rV:QHRn(2N5飻!Mh@qAD1}o` 4$R]Ndn>*_='@J;gm753ikǓiDYLfO}TSnB! Nк!bL;UwpKiPhj`chTA rA>&Icj}GC@#7sN s^bm#gt1O4Taʏ$UCV䝘nР(9:8Q.oLs!Ar#u%dVwOg7ٮ{6LY().ZN4&>*a 梪O4 +@Y?]#Hb&!'Fnx NLDOsA*\')BvQJ}(hB/;$@ؖhl@$a@@UBAk-솝"c(arFB{&rV:QHRn(2N5飻!Mh@qAD1}o` 4$R]Ndn>*_='@J;gm753ikǓiDYLfO}TSnB! Nк!bL;UwpKiPPKr@ :pf}ܓM)wA;m-#tm#(w{xp o\ޟfw'@*S6[ޙY\E(UTJ2Di46 {UF V ʼnf*:IHM1gGu5l"FB0Ŷ8&GbPJj&fh vbp5!*1\CR}G$tfi d4cftwQMsV)9d*Nc [cM2l4v 4ffH`'f)\Rn0=y4='rI'C+cjq'z'f6'>")[;i[eN "-y1bFTT3DA&h}CB(aR5kV`~$$p?4PỸfPT!Ʃ`" >hYsm4IOdIX ?zP$ (ղ@?+*ǙQ2i~4V.C\=D*# @1X;k"2mРF̬@S}SNŷ1ʠP"a@;a.޳΢M *b?ZկF%}dɬTO H*, !j'SL>#ǓAmEQZiK*O>!mL Dl(S:קҪɮvMr?yuO&uC7aAzt-xdž2-4 M%3ykV}DZIf 9KjGjqp8xJ)LAuv"~yn(#{e*P*O 4~Xk Z`+hjSB?P`8 ,fALd(AfcrcTH4, $觲O$I(fcj LIcj(b4H!݀ Ѭ[L5I6hP#fVw)SbۈYeP(|@LD\|zYQJ&PD±fڭjףhHvvqo'Qm D9a#q+*;z4Ŧp 9'B椑!w{رPI[lG"!tI<T$ߚY>h| lFT{(v4 TQ|Q ¡KHylmUw$"G4dvEL C1H2;ށY $=3Y4pVM'UDkYR#B@X㘧X"A8$rB Kиd֩1`Np˛MTDL~)oϊ%%FQ"-ó<P \(@E/zg[}ST-ɌpD* $EV$~7U ` {U-yZTꍻk :ԃD!7@`5{~(1`vֲ0ݤ}N[ͰPb"7"1 rfV $Oo~Pe5'HqTfڠXEgU27?)7fW]ۉ?mos9 hb$CYQG-3]:sRH;սXf$}YڶB[Pr$G N,T4hx>iFER*@=sb;k|*(O>(P$S aN<2UpXK&v^*=Fse{]t߭e-胯WeqM@~t{ u-ҳqmAjX&O5@W ڝyp*ʾ;hrI =C!9g(ǚ 3X:46P c h46P1:Hd{ EDnH:XE; Pn- OZxB2Ց1#>H1Hӏ(3b]0H:TɽԶ(L#ɥZùa{im-ZKPm?.ucʁRKT-[npX3 k-9\x CSnDSڣNrQ(~(`K UuQv)aseTI2)e+a{$W>৐;U ߎi+P꣰t= :{p8ULZ*k$My N_q&^MFy:N嶽Ř0PtUBuH=Ywz̈%)PzpX!\\'jt9 W\*i$ ' WOhl/K{@`d~h`@2y)K,-UB} ) c梳gdbDH)B@M>GYh -剃<^e{ZgMm-HU'Pfh P#9g; 'GH؊e]V._%DkTobvh:` cMs\`Ph99 ~ᕰ@=A[%Ǹ:*)>cE lF܍H2'4l<:+^%m9ƷLtU@QIJ) r?={. ?[p9-7Mmn:b].ۻY!wU ˃ <]zFڤ*2'B2cnRދ9b7ⅲ}H=sxs@m*-W[;1 ~p *ΉhX悳75,4$x5FPg114 1ދLS.:> Pˤvu9"t4Od|ċi,H"=1K2R{οXu2OĞ>k)!8wTPd yb`5^S[rqgg4[CkԎ2vڨ+dL FKb*=v*YXD I~@A}R΢V٠mȂb5qU@}5VcځllKx@U@-r7'g$h?5 ˘S\zxxs3UhQDe&vf1(HCl6Si@8("o[캤KxUn[Sy`椷K=5%pvhnUd hB TsZ+'.40LcwGqjȝ ,nط[>ªbuAඡ@&;P"1P@*"I<,CL~GuInkF -S)wü zfڵZv ?W0Xb}؏hIKVГ6>dOl@#Ku h?{HDH #E@*K 11As Y v,VmP fl(]*?o\[}: P;-KKA ?;eFIրImRAPǽrݫCI~5pYeK}g@ v ӕB$w!| e r1 S1v3(* #=b'KSIrNKyTnތfU"u:~( [H/RI2I317)ڏbOo`L{(i3tk J+;!Ҵq*!yـLB+cڟ#&c*& РGQ@B'Qa0=I6t&d 䊨,nط[>ªbuAඡ@&;TR*I$)}21dy~T>6:Tkx0`2|; ~nͫ]5`p>jLn &*)݈DTo 0+0#cDH6̴9P̶aT@D 9 Tx[;bN eJb`vlU2 ~Ojnbq۲31F5ŷӮ ð^ jAszFThĝh E$ { -ڴ?`q?Q 6^'{b 9T,NZqojXֹ`m< v!m+;zmw$UXȘR[{ i.9Z:nap+q#KGdx^=EИT\׮qz{Nxaڼuze6Ŷq֦ rO›*qle5\(UQu|Q޵K\r} A(83,g[;GޑWӑ8 ==:M$GP)v(@sW SG$=C1ԁ$fi_UMmVDӺgp-dDk5' A(=TqY$ַm3  U fv"qS*`Bݏ?OyZP=c&g3h LE Ŏ,s1kY N(6*< 7X sO>ɓ'A- EIv o+ DLbk7S 3LAQLWitτ! >aIڃ*=T5[ ?K([f{P)9?jֹ`m< v!m+;zmw$U)%[`5ȗ bz_{4xN] Omz hyW W]gSl[i'jj*^ w$)|Gk0Pc\P͜}QUh0']η=\@T G42; A2ɌuHKaTxqM9P܃ڭcJ )A m>P f {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1ոu=O4ޡԨ{J81{'k*CNF 􂋬ξcܚA$F5UFpX7Hf׶\6vKq>)A m>P f {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1\EtonsEZ*?UGlbR.w :W%D&1Q{z MHwwn8^Z l)$5 Z|S?4!-+V( \ĉ1Y%wi-ALU]axX-+r}6UOj RVia*JݲOrP% Yై5@팪b;H@2\" e(PHzWp"ډ1t8;,++\c5O4 t6B:4Urv(qU<- r>;QM'<_IϨ lg( $ncof6ӥ*e B^~hP:f5QqSݸ.3l QBTsFtœ f9WPyEk :'&OmtzyLXzS>N;iReUq/En~ہ@үQY-qL3q2k/\ A⹺wf׻q&893,H␲Rg,4UWP\P@B2b`KF_oimP/к#gAUSXˀ<8fŲI&gj Gڎ0YV  UP{2a汶 2y 5T[]?LL3$r; j95PPX2Z3q'PҰiR/{{@Ы@H9l* @TfX !e)ɢ2ϘXi@*d1YP0,>f_u$# F` yrN>ؤg%R~)U 2ۍNPlG n2,]V!)R.NG~ G:ɊtLkY_$*[v$h a=iF. @'02IcX$ӥ@ ?j5`ANyWǸ`a-)N⋹!f{M#x۞Oڛ ,dyB[9?4WrA#Truby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-fill-and-stroke2.rb0000644000175000017500000000163412416346617023165 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-fill-and-stroke2.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Fill And Stroke2 This demo shows how to use GDK and cairo to fill and stroke. From http://cairographics.org/samples/fill_and_stroke2.html. =end require 'common' module Demo class CairoFillAndStroke2 < CairoWindow def initialize super('cairo fill and stroke2') end def draw(cr) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.close_path cr.move_to(0.25, 0.1) cr.rel_line_to(0.2, 0.2) cr.rel_line_to(-0.2, 0.2) cr.rel_line_to(-0.2, -0.2) cr.close_path cr.set_source_rgba(0, 0, 1) cr.fill_preserve cr.set_source_rgba(0, 0, 0) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/infobar.rb0000644000175000017500000000572112137115065020425 0ustar koukou# Copyright (c) 2013 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Info bar Info bar widgets are used to report important messages to the user. =end require 'common' module Demo class InfoBar < BasicWindow def initialize super('Info Bars') self.border_width = 8 vbox = Gtk::Box.new :vertical self.add vbox bar = Gtk::InfoBar.new vbox.pack_start bar, :expand => false, :fill => false, :padding => 0 bar.message_type = :info label = Gtk::Label.new 'This is an info bar with message type GTK_MESSAGE_INFO' bar.content_area.pack_start label, :expand => false, :fill => false, :padding => 0 bar = Gtk::InfoBar.new vbox.pack_start bar, :expand => false, :fill => false, :padding => 0 bar.message_type = :warning label = Gtk::Label.new 'This is an info bar with message type GTK_MESSAGE_WARNING' bar.content_area.pack_start label, :expand => false, :fill => false, :padding => 0 bar = Gtk::InfoBar.new [:ok, :ok] bar.signal_connect(:response) {|widget, response_id| on_bar_response widget, response_id} vbox.pack_start bar, :expand => false, :fill => false, :padding => 0 bar.message_type = :question label = Gtk::Label.new 'This is an info bar with message type GTK_MESSAGE_QUESTION' bar.content_area.pack_start label, :expand => false, :fill => false, :padding => 0 bar = Gtk::InfoBar.new vbox.pack_start bar, :expand => false, :fill => false, :padding => 0 bar.message_type = :error label = Gtk::Label.new 'This is an info bar with message type GTK_MESSAGE_ERROR' bar.content_area.pack_start label, :expand => false, :fill => false, :padding => 0 bar = Gtk::InfoBar.new vbox.pack_start bar, :expand => false, :fill => false, :padding => 0 bar.message_type = :other label = Gtk::Label.new 'This is an info bar with message type GTK_MESSAGE_OTHER' bar.content_area.pack_start label, :expand => false, :fill => false, :padding => 0 frame = Gtk::Frame.new 'Info bars' vbox.pack_start frame, :expand => false, :fill => false, :padding => 8 vbox2 = Gtk::Box.new :vertical, 8 vbox2.border_width = 8 frame.add vbox2 # Standard message dialog label = Gtk::Label.new 'An example of different info bars' vbox2.pack_start label, :expand => false, :fill => false, :padding => 0 end def on_bar_response info_bar, response_id dialog = Gtk::MessageDialog.new :parent => self, :flags => [:modal, :destroy_with_parent], :type => :info, :buttons_type => :ok, :message => 'You clicked a button on an info bar' dialog.set_secondary_text "Your response has id %d" % response_id dialog.signal_connect(:response) {dialog.destroy} dialog.show_all end end endruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-arc.rb0000644000175000017500000000205312416346617020651 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-arc.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Arc This demo shows how to use GDK and cairo to draw arc. From http://cairographics.org/samples/arc.html. =end require 'common' module Demo class CairoArc < CairoWindow CENTER_X = 0.5 CENTER_Y = 0.5 RADIUS = 0.4 ANGLE1 = 45.0 * (Math::PI / 180.0) # angles are specified ANGLE2 = 180.0 * (Math::PI / 180.0) # in radians def initialize super('cairo arc') end def draw(cr) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2) cr.stroke # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI) cr.fill cr.set_line_width(0.03) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE1) cr.line_to(CENTER_X, CENTER_Y) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE2, ANGLE2) cr.line_to(CENTER_X, CENTER_Y) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-operator.rb0000644000175000017500000000506212307003726021730 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-operator.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Operator This demo shows how to use GDK and cairo to use Cairo::OPERATOR_* From http://cairographics.org/samples/operator_add.html, http://cairographics.org/samples/operator_atop.html, http://cairographics.org/samples/operator_atop_reverse.html, http://cairographics.org/samples/operator_in.html, http://cairographics.org/samples/operator_in_reverse.html, http://cairographics.org/samples/operator_out.html, http://cairographics.org/samples/operator_out_reverse.html, http://cairographics.org/samples/operator_over.html, http://cairographics.org/samples/operator_over_reverse.html, http://cairographics.org/samples/operator_saturate.html and http://cairographics.org/samples/operator_xor.html =end require "common" module Demo class CairoOperator < CairoWindow def initialize super("cairo operator") @operator = Cairo::OPERATOR_ADD set_default_size(400, 400) @drawing_area = child remove(@drawing_area) vbox = Gtk::Box.new(:vertical) vbox.pack_start(@drawing_area, :expand => true, :fill => true) vbox.pack_start(operator_selector, :expand => false, :fill => false) add(vbox) end def draw(cr) cr.save do image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") cr.translate(0.5, 0.5) cr.rotate(-45 * Math::PI / 180) cr.scale(0.8 / image.width, 0.8 / image.height) cr.translate(-0.5 * image.width, -0.5 * image.height) cr.set_source(image, 0.0, 0.0) cr.paint end cr.set_operator(@operator) cr.set_source_rgba(1, 0, 0, 0.5) cr.rectangle(0.2, 0.2, 0.5, 0.5) cr.fill cr.set_source_rgba(0, 1, 0) cr.rectangle(0.4, 0.4, 0.4, 0.4) cr.fill cr.set_source_rgba(0, 0, 1) cr.rectangle(0.6, 0.6, 0.3, 0.3) cr.fill end def operator_selector combo = Gtk::ComboBoxText.new operators = [] Cairo.constants.each do |name| operators << name if /^OPERATOR_/ =~ name end operators.sort.each_with_index do |name, i| combo.append_text(name.to_s) combo.set_active(i) if Cairo.const_get(name) == @operator end combo.signal_connect("changed") do |widget| text = widget.active_text @operator = Cairo.const_get(text) if text @drawing_area.queue_draw end combo end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/list_store.rb0000644000175000017500000001153212416346617021202 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: list_store.rb,v 1.5 2005/02/06 18:25:13 kzys Exp $ =begin = Tree View/List Store The Gtk::ListStore is used to store data in list form, to be used later on by a Gtk::TreeView to display it. This demo builds a simple Gtk::ListStore and displays it. See the Stock Browser demo for a more advanced example. =end require 'common' module Demo class ListStore < BasicWindow Bug = Struct.new('Bug', :fixed, :number, :severity, :description) COLUMN_FIXED, COLUMN_NUMBER, COLUMN_SEVERITY, COLUMN_DESCRIPTION, NUM_COLUMNS = *(0..5).to_a DATA = [ [ false, 60482, 'Normal', 'scrollable notebooks and hidden tabs' ], [ false, 60620, 'Critical', 'gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe' ], [ false, 50214, 'Major', 'Xft support does not clean up correctly' ], [ true, 52877, 'Major', 'GtkFileSelection needs a refresh method. ' ], [ false, 56070, 'Normal', "Can't click button after setting in sensitive" ], [ true, 56355, 'Normal', 'GtkLabel - Not all changes propagate correctly' ], [ false, 50055, 'Normal', 'Rework width/height computations for TreeView' ], [ false, 58278, 'Normal', "gtk_dialog_set_response_sensitive doesn't work" ], [ false, 55767, 'Normal', 'Getters for all setters' ], [ false, 56925, 'Normal', 'Gtkcalender size' ], [ false, 56221, 'Normal', 'Selectable label needs right-click copy menu' ], [ true, 50939, 'Normal', 'Add shift clicking to GtkTextView' ], [ false, 6112, 'Enhancement','netscape-like collapsable toolbars' ], [ false, 1, 'Normal', 'First bug :=)' ], ].collect do |ary| Bug.new(*ary) end def initialize super('GtkListStore demo') self.border_width = 8 vbox = Gtk::VBox.new(false, 8) add(vbox) label = Gtk::Label.new('This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).') vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) sw = Gtk::ScrolledWindow.new(nil, nil) sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(Gtk::POLICY_NEVER, :automatic) vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0) # create tree model model = create_model # create tree view treeview = Gtk::TreeView.new(model) treeview.rules_hint = true treeview.search_column = COLUMN_DESCRIPTION sw.add(treeview) # add columns to the tree view add_columns(treeview) set_default_size(280, 250) end def create_model # create list store store = Gtk::ListStore.new(TrueClass, Integer, String, String) # add data to the list store DATA.each do |bug| iter = store.append bug.each_with_index do |value, index| iter[index] = value end end return store end def add_columns(treeview) # column for fixed toggles renderer = Gtk::CellRendererToggle.new renderer.signal_connect('toggled') do |cell, path| fixed_toggled(treeview.model, path) end column = Gtk::TreeViewColumn.new('Fixed?', renderer, 'active' => COLUMN_FIXED) # set this column to a fixed sizing (of 50 pixels) column.sizing = Gtk::TreeViewColumn::FIXED column.fixed_width = 50 treeview.append_column(column) # column for bug numbers renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new('Bug number', renderer, 'text' => COLUMN_NUMBER) column.set_sort_column_id(COLUMN_NUMBER) treeview.append_column(column) # column for severities renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new('Severity', renderer, 'text' => COLUMN_SEVERITY) column.set_sort_column_id(COLUMN_SEVERITY) treeview.append_column(column) # column for description renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new('Description', renderer, 'text' => COLUMN_DESCRIPTION) column.set_sort_column_id(COLUMN_DESCRIPTION) treeview.append_column(column) end def fixed_toggled(model, path_str) path = Gtk::TreePath.new(path_str) # get toggled iter iter = model.get_iter(path) fixed =iter[COLUMN_FIXED] # do something with the value fixed ^= 1 # set new value iter[COLUMN_FIXED] = fixed end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-applets.png0000644000175000017500000000602211701304107021725 0ustar koukouPNG  IHDR00WgAMA abKGD pHYs``zxEtIME ( IDATxYuګg㐢9ҖdkMіI@ӒF 'P q^b=F I6<Yk I @L٢hQ#҈Ԉξw5}(e<) ={#qs$L.KgK v\&H a-'r#pUVW cs1,'og])6˽~ @c[ : (&POsp3_:z|dxp4Ȓ4':NZeMo}ߘ]XY3B|y@.ρ|sy޽_$,H( <ϱ]vX[>G/nN(9&P*/=ra0**,!!IRB_쯹 +baGRR/dS*?{ķ+}5,)nj]R7 4%Mb$%NRUS/.Cȥw}TT*S)K覉a訪,ɿ$4!c8!c8ŕ;%l3j>?w\R*)U*eR4Q5EQd.$邕}(8ˆLKzk}}^o| Ǟ{_꺎ii J ib)2 ,S)Ұt+N9voinʲhF ,Q*WɃYӻ໱/ ,QT$uMes;B6x@Ldp edY)2cPUwH2xId Y\'N*$2YzRra/ۥ'}x"K3,#R,,f4%C|&+!4#R$EcyI(Wpz`Rӿ*2 {AަXS#it2EDa@xv| €(KӘ$Iӄ4MIqyxq7/ӱ]TMR.?݌mj8ꮰQݕw\s|}K" C(&j54z^z;Flj☡a\Ͽ/xAډHdOA@{xظݱpm ױ|;>( g}}3gޣ^gV\,rIݮ= +]iE!Bs=_feNt=/~SJ uD*] U(Cǧ/ֱ]xg"e]iJr|qXZ\4?ȓ?JLN& >]CܵGf׮a'2,bychl!{>A!I8V==X6M�{8*f9 xWJ%Iqˬ?ÿ4X= I,ϒ)aF1AA1iS2M8V#lľW_}N`nvCCyȲ Ο'==? ʪ!q#2%äJozw}yusl^[[[a RNZ1l{ &'%BR 45$&Ŭq% $ } ZZ\4c>{`˲fFFF5A (lvnzSo}͖mwszr;BAk*"$ i"+2*aP_K˫/ߚ8juj'F!%{T;%IUUZa*W):r0體 RVjhɩ19nZoO>.^n(HpZFFmfQ{l CM쯡j*#JwKt72y?\v♶ ' m멅# V,ˆg C3TEsuM!YQU)#m+_܈?%! @C^>kR(uc3e՞]lA_x)n/o+uhZQ`Q,<liOU cg7yA|527]B9p @xq bo?ڧE~p{ ցtc Ř5.a[A}/ ef b\GYD@6$-<E/E,E=<VD8q//.!<+dM`PV<}Cvwb}HB&*za+9B{z4zQ$Pr8C7ze^)|oթ {y շX~o$QajmӢ "EBbxvPZs|EkS؎%_X{.^52* @NwBhJiO{]XdZ8'Z O YG2Ad;@zooAkIENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-fs-regular.png0000644000175000017500000000340311701304107022324 0ustar koukouPNG  IHDR04̓bKGDCIDATx՚KoWC4³*HtEʢ,RB+O]Y#P%XtQHx4< MTv`ĵӅ3;wSP+d߹w|?5w,N`u wP(|b(cccrQ_{@*VܺuKDDfffފ@Jr,bQdttW8%R!"H* ="ɰyf._ X Mlݺu^G\-[044DkkSЗ۷oϋ~abbLM6q :::J~y58yGww77~M85Bs&0 J%sccc\zRĆ ݜ:u {`O&hDhڪy_#GP,QY={| Ju.D>/_N.X\8q߸dF<zlP=QpF_]+!JQTi<8v.`B.rTz*j"U* |t/7,6`*y5SumۦYE8x2ո(fhnnv"(Tbd2&=S_+W.t67ѬEĚ@{}I9'ۿe$,1q>veO|jTytXD)U|DWDXL2,\kI5 $;w͛׆2.Nf`%X!+"ݻϟ%AH~:--UH*(HI|hDbg.\8ϲe^@$fۘML&@H)RT,ʈ5F6%B LNd׮ŋ5HB8i\LNZsZzp\B^'ĶCzXHk. $p?ԜkqUUx$!U}fr1IRcbDgYjM2 [j\Lb&-[IaWJ !vOgwe+l$k KYbbqR"S\4Bgck(Y(Da:khhrָ%Mk!~^|QFљ8؊ð)/ǡCd'B##tiFK(n&6MBJ&S(Ξ=Ú5%$Z%sypn)MCg9n[rp0'C/[ܫ*"ўXOnQ|b"̙_Xv]rzPv۞!Bx߾rO-r}ŵopkJnϟ?GW (Lpzh˸[Xӧfݺ=$0;--u34rps=٩WÇIC\ڀL.~}]rIeޅ)!Т.!k)0CHP*MZ0/dm(C@eIENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/rotated_text.rb0000644000175000017500000000440212416346617021517 0ustar koukou# Copyright (c) 2005-2014 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: rotated_text.rb,v 1.2 2005/03/05 15:01:16 mutoh Exp $ =begin = Rotated Text This demo shows how to use Cairo and Pango to draw rotated and transformed text. =end require "common" module Demo class RotatedText < BasicWindow RADIUS = 150 N_WORDS = 10 FONT = "Sans Bold 27" def initialize super("Rotated Text") drawing_area = Gtk::DrawingArea.new add(drawing_area) drawing_area.override_background_color(:normal, Gdk::RGBA.new(1.0, 1.0, 1.0, 0.0)) drawing_area.signal_connect("draw") do |_drawing_area, cairo_context| cairo_context.set_source_rgb(1.0, 1.0, 1.0) cairo_context.paint cairo_context.save do width, height = size cairo_context.scale(width.to_f / (RADIUS * 2), height.to_f / (RADIUS * 2)) draw_text(cairo_context) end end end private def draw_text(cairo_context) # Center coordinates on the middle of the region we are drawing cairo_context.translate(RADIUS, RADIUS) # Create a PangoLayout, set the font and text layout = cairo_context.create_pango_layout layout.text = "Text" layout.font_description = Pango::FontDescription.new(FONT) # Draw the layout N_WORDS times in a circle N_WORDS.times do |i| angle = (360.0 * i) / N_WORDS cairo_context.save do # Gradient from red at angle == 60 to blue at angle == 240 red = (1 + Math.cos((angle - 60) * Math::PI / 180.0)) / 2 cairo_context.set_source_rgb(red, 0.0, 1.0 - red) cairo_context.rotate(angle * Math::PI / 180.0) # Inform Pango to re-layout the text with the new transformation cairo_context.update_pango_layout(layout) width, height = layout.size cairo_context.move_to(-(width / Pango::SCALE) / 2, -RADIUS) cairo_context.show_pango_layout(layout) end end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-text.rb0000644000175000017500000000203612416346617021071 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-text.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Text This demo shows how to use GDK and cairo to show text. From http://cairographics.org/samples/text.html. =end require 'common' module Demo class CairoText < CairoWindow def initialize super('cairo text') end def draw(cr) cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD) cr.set_font_size(0.35) cr.move_to(0.04, 0.53) cr.show_text("Hello") cr.move_to(0.27, 0.65) cr.text_path("void") cr.set_source_rgba(0.5, 0.5, 1) cr.fill_preserve cr.set_source_rgba(0, 0, 0) cr.set_line_width(0.01) cr.stroke # draw helping lines cr.set_source_rgba(1,0.2,0.2, 0.6) cr.arc(0.04, 0.53, 0.02, 0, 2 * Math::PI) cr.arc(0.27, 0.65, 0.02, 0, 2 * Math::PI) cr.fill end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-clip.rb0000644000175000017500000000131611701304107021014 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-clip.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Clip This demo shows how to use GDK and cairo to use clip. From http://cairographics.org/samples/clip.html. =end require 'common' module Demo class CairoClip < CairoWindow def initialize super('cairo clip') end def draw(cr) cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI) cr.clip cr.new_path cr.rectangle(0, 0, 1, 1) cr.fill cr.set_source_rgba(0, 1, 0) cr.move_to(0, 0) cr.line_to(1, 1) cr.move_to(1, 0) cr.line_to(0, 1) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-image.rb0000644000175000017500000000234212416346617021167 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-image.rb,v 1.2 2005/10/16 12:07:32 mutoh Exp $ =begin = cairo/Image This demo shows how to use GDK and cairo to show image. From http://cairographics.org/samples/image.html. =end require 'common' module Demo class CairoImage < CairoWindow def initialize super('cairo gradient') end def draw(cr) cr.save do loader = Gdk::PixbufLoader.new File.open("background.jpg", "rb") do |f| loader.last_write(f.read) end pixbuf = loader.pixbuf cr.translate(0.5, 0.5) cr.rotate(45 * Math::PI / 180) cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height) cr.translate(-0.5 * pixbuf.width, -0.5 * pixbuf.height) cr.set_source_pixbuf(pixbuf, 0, 0) cr.paint end cr.save do image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") cr.translate(0.5, 0.5) cr.rotate(60 * Math::PI / 180) cr.scale(0.8 / image.width, 0.8 / image.height) cr.translate(-0.5 * image.width, -0.5 * image.height) cr.set_source(image, 0, 0) cr.paint end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/clipboard.rb0000644000175000017500000000413512137115065020742 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # $Id: clipboard.rb,v 1.3 2005/07/28 14:30:38 mutoh Exp $ =begin = Clipboard GtkClipboard is used for clipboard handling. This demo shows how to copy and paste text to and from the clipboard. =end require 'common' module Demo class Clipboard < Demo::BasicWindow def initialize super('Clipboard') vbox = Gtk::Box.new(:vertical) vbox.border_width = 8 add(vbox) label = Gtk::Label.new(%Q["Copy" will copy the text\nin the entry to the clipboard]) vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) hbox = Gtk::Box.new(:horizontal, 0) hbox.border_width = 8 vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) # Create the first entry entry = Gtk::Entry.new hbox.pack_start(entry, :expand => true, :fill => true, :padding => 0) # Create the button button = Gtk::Button.new(:stock_id => :copy) hbox.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect('clicked', entry) do |w, e| clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD) clipboard.text = e.text end label = Gtk::Label.new(%Q["Paste" will paste the text from the clipboard to the entry]) vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) hbox = Gtk::Box.new(:horizontal, 4) hbox.border_width = 8 vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) # Create the second entry entry = Gtk::Entry.new hbox.pack_start(entry, :expand => true, :fill => true, :padding => 0) # Create the button button = Gtk::Button.new(:stock_id => :paste) hbox.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect('clicked', entry) do |w, e| clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD) clipboard.request_text do |board, text, data| e.text = text end end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/theming_style_classes.rb0000644000175000017500000000316612416346617023407 0ustar koukou# # This sample code is a port of gtk3/demos/gtk-demo/theming_style_classes.c. # The UI file used in this sample code is copied from gtk3/demos/gtk-demo. # This is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2014 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 =begin = CSS Theming/Style Classes GTK+ uses CSS for theming. Style classes can be associated with widgets to inform the theme about intended rendering. This demo shows some common examples where theming features of GTK+ are used for certain effects: primary toolbars, inline toolbars and linked buttons. =end require "common" module Demo class ThemingStyleClasses < BasicWindow def initialize super("Style Claases") self.border_width = 12 builder = Gtk::Builder.new builder.add("theming.ui") grid = builder.get_object("grid") add(grid) end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-curve-to.rb0000644000175000017500000000151612416346617021653 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-curve-to.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Curve To This demo shows how to use GDK and cairo to draw curve. From http://cairographics.org/samples/curve_to.html. =end require 'common' module Demo class CairoCurveTo < CairoWindow X = 0.1 Y = 0.5 X1 = 0.4 Y1 = 0.9 X2 = 0.6 Y2 = 0.1 X3 = 0.9 Y3 = 0.5 def initialize super('cairo curve to') end def draw(cr) cr.move_to(X, Y) cr.curve_to(X1, Y1, X2, Y2, X3, Y3) cr.stroke cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.set_line_width(0.03) cr.move_to(X, Y) cr.line_to(X1, Y1) cr.move_to(X2, Y2) cr.line_to(X3, Y3) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/colorsel.rb0000644000175000017500000000410512257552170020627 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: colorsel.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $ =begin = Color Selector Gtk::ColorSelection lets the user choose a color. Gtk::ColorSelectionDialog is a prebuilt dialog containing a Gtk::ColorSelection. =end require 'common' module Demo class ColorSel < BasicWindow def initialize super('Color Selection') @color = Gdk::RGBA.new(0, 0, 1, 1) set_border_width(8) vbox = Gtk::Box.new(:vertical, 0) vbox.set_border_width(8) add(vbox) ## Create the color swatch area @frame = Gtk::Frame.new @frame.set_shadow_type(:in) vbox.pack_start(@frame, :expand => true, :fill => true, :padding => 0) @da = Gtk::DrawingArea.new @da.signal_connect('draw') do |widget, event| if widget.window context = widget.style_context background_color = context.get_background_color(:normal) event.set_source_rgba(background_color.to_a) event.paint end end # set a minimum size @da.set_size_request(200, 200) # set the color @da.override_background_color(:normal, @color) @frame.add(@da) alignment = Gtk::Alignment.new(1.0, 0.5, 0.0, 0.0) button = Gtk::Button.new(:mnemonic => '_Change the above color') alignment.add(button) vbox.pack_start(alignment, :expand => false, :fill => false, :padding => 0) button.signal_connect('clicked') do change_color_callback end end def change_color_callback dialog = Gtk::ColorSelectionDialog.new(:title => 'Changing color') dialog.set_transient_for(self) colorsel = dialog.color_selection colorsel.set_previous_rgba(@color) colorsel.set_current_rgba(@color) colorsel.set_has_palette(true) response = dialog.run if response == Gtk::ResponseType::OK @color = colorsel.current_rgba @da.override_background_color(:normal, @color) end dialog.destroy end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/sizegroup.rb0000644000175000017500000000751312516434313021036 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: sizegroup.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Size Groups Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk::Table widget. Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a Gtk::SizeGroup to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include the Gtk::FILL flag. =end require 'common' module Demo class SizeGroup < Gtk::Dialog def initialize super('GtkSizeGroup', nil, 0, [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE]) color_options = %w(Red Green Blue) dash_options = %w(Solid Dashed Dotted) end_options = %w(Square Round Arrow) set_resizable(false) signal_connect('response') do destroy end vbox = Gtk::VBox.new(false, 5) self.vbox.pack_start(vbox, :expand => true, :fill => true, :padding => 0) vbox.set_border_width(5) size_group = Gtk::SizeGroup.new(Gtk::SizeGroup::HORIZONTAL) ## Create one frame holding color options frame = Gtk::Frame.new('Color Options') vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0) table = Gtk::Table.new(2, 2, false) table.set_border_width(5) table.set_row_spacings(5) table.set_column_spacings(10) frame.add(table) add_row(table, 0, size_group, '_Foreground', color_options) add_row(table, 1, size_group, '_Background', color_options) ## And another frame holding line style options frame = Gtk::Frame.new('Line Options') vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0) table = Gtk::Table.new(2, 2, false) table.set_border_width(5) table.set_row_spacings(5) table.set_column_spacings(10) frame.add(table) add_row(table, 0, size_group, '_Dashing', dash_options) add_row(table, 1, size_group, '_Line ends', end_options) # And a check button to turn grouping on and off check_button = Gtk::CheckButton.new('_Enable grouping', true) vbox.pack_start(check_button, :expand => false, :fill => false, :padding => 0) check_button.set_active(true) check_button.signal_connect('toggled', size_group) do |check_button, size_group| new_mode = if check_button.active? Gtk::SizeGroup::HORIZONTAL else Gtk::SizeGroup::VERTICAL end size_group.set_mode(new_mode) end end def add_row(table, row, size_group, label_text, options) label = Gtk::Label.new(label_text, true) label.set_alignment(0, 1) table.attach(label, 0, 1, row, row + 1, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) option_menu = create_option_menu(options) label.set_mnemonic_widget(option_menu) size_group.add_widget(option_menu) table.attach(option_menu, 1, 2, row, row + 1, 0, 0, 0, 0) end def create_option_menu(strings) menu = Gtk::Menu.new strings.each do |str| menu_item = Gtk::MenuItem.new(str) menu_item.show menu.append(menu_item) end option_menu = Gtk::OptionMenu.new option_menu.set_menu(menu) return option_menu end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-pattern-fill.rb0000644000175000017500000000356112416346617022512 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-pattern-fill.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Pattern Fill This demo shows how to use GDK and cairo to fill by pattern. From http://cairographics.org/samples/pattern_fill.html. =end require 'common' module Demo class CairoPatternFill < CairoWindow X_FUZZ = 0.08 Y_FUZZ = 0.08 X_INNER_RADIUS = 0.3 Y_INNER_RADIUS = 0.2 X_OUTER_RADIUS = 0.45 Y_OUTER_RADIUS = 0.35 SPIKES = 10 TEXT = "Ruby!" def initialize super('cairo pattern fill') end def draw(cr) srand(45) cr.set_line_width(0.01) x = y = nil 0.step(SPIKES * 2 - 1, 2) do |i| x = x_position(i, X_INNER_RADIUS) y = y_position(i, Y_INNER_RADIUS) if (i == 0) cr.move_to(x, y) else cr.line_to(x, y) end i += 1 x = x_position(i, X_OUTER_RADIUS) y = y_position(i, Y_OUTER_RADIUS) cr.line_to(x, y) end cr.close_path cr.stroke cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD) cr.move_to(x - 0.5, y) cr.set_font_size(0.1) cr.text_path(TEXT) cr.set_source_rgba(1, 0, 0.5) cr.fill cr.set_font_size(0.2) extents = cr.text_extents(TEXT) x = 0.5 - (extents.width / 2 + extents.x_bearing) y = 0.5 - (extents.height / 2 + extents.y_bearing) cr.move_to(x, y) cr.text_path(TEXT) cr.set_source_rgba(1, 0, 0) cr.stroke end def x_position(i, radius) 0.5 + Math.cos(Math::PI * i / SPIKES) * radius + rand * X_FUZZ end def y_position(i, radius) 0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/main.rb0000755000175000017500000002330712516434313017735 0ustar koukou#! /usr/bin/env ruby =begin main.rb - Main class of gtk-demo. Copyright (c) 2003-2013 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: main.rb,v 1.20 2007/07/09 13:21:54 ggc Exp $ =end require 'gtk3' $:.unshift(File.dirname(__FILE__)) module Demo class Main < Gtk::Window TITLE_COLUMN, FILENAME_COLUMN, CLASS_COLUMN, ITALIC_COLUMN = 0, 1, 2, 3 def initialize super() @current_file = nil @info_buffer = Gtk::TextBuffer.new @source_buffer = Gtk::TextBuffer.new set_title('Ruby/GTK+ Code Demos') signal_connect('destroy') do Gtk.main_quit end signal_connect("key_press_event") do |widget, event| if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_KEY_q destroy true else false end end hbox = Gtk::Box.new(:horizontal) add(hbox) tree = create_tree scrolled_window = Gtk::ScrolledWindow.new scrolled_window.set_policy :never, :automatic scrolled_window.add(tree) hbox.pack_start(scrolled_window, :expand => false, :fill => false, :padding => 0) notebook = Gtk::Notebook.new hbox.pack_start(notebook, :expand => true, :fill => true, :padding => 0) notebook.append_page(create_text(@info_buffer, false), Gtk::Label.new('_Info', true)) notebook.append_page(create_text(@source_buffer, true), Gtk::Label.new('_Source', true)) @info_buffer.create_tag('title', {'font' => 'Sans 18'}) @source_buffer.create_tag('comment', {'foreground' => 'red'}) @source_buffer.create_tag('const', {'foreground' => 'ForestGreen'}) @source_buffer.create_tag('string', { 'foreground' => 'RosyBrown', 'weight' => Pango::FontDescription::WEIGHT_BOLD }) @source_buffer.create_tag('reserved', {'foreground' => 'purple'}) end def script_info(path) title = nil klass = nil depend = nil file = File.open(path) file.each do |ln| if not title and ln =~ /^=\s+(.*)$/ title = $1 if title =~ /^(.*)\((.+?)\)$/ title = $1 depend = $2 end elsif not klass and ln =~ /\s*class\s+([A-Z][A-Za-z0-9_]*)/ klass = $1 end if title and klass break end end if not klass raise "File not found: #{path}." end return title, klass.intern, depend end def generate_index # Target scripts scripts = Dir.glob(File.join(File.dirname(__FILE__), '*.rb')) # Generate index tree children = {} index = [] scripts.each do |script| next if ["common.rb", "main.rb"].include?(File.basename(script)) title, klass, depend = script_info(script) if depend and not Gtk.const_defined?(depend) next end if title =~ %r{^(.+?)/(.+)$} parent = $1 child = $2 unless children[parent] children[parent] = [] index += [[parent, nil, nil, []]] end children[parent] += [[child, script, klass]] else index += [[title, script, klass]] end end # Sort children children.each_key do |parent| children[parent].sort! do |a, b| a[0] <=> b[0] end end # Expand children index.collect! do |row| if row[3] row[3] = children[row[0]] end row end index.sort! do |a, b| a[0] <=> b[0] end index end def create_tree model = Gtk::TreeStore.new(String, String, String, TrueClass) tree_view = Gtk::TreeView.new tree_view.set_model(model) selection = tree_view.selection selection.set_mode(:browse) tree_view.set_size_request(200, -1) append_children(model, generate_index) cell = Gtk::CellRendererText.new cell.style = Pango::FontDescription::STYLE_ITALIC column = Gtk::TreeViewColumn.new("Widget (double click for demo)", cell, { 'text' => TITLE_COLUMN, 'style_set' => ITALIC_COLUMN, }) tree_view.append_column(column) selection.signal_connect('changed') do |selection| iter = selection.selected load_file(iter.get_value(FILENAME_COLUMN)) if iter end tree_view.signal_connect('row_activated') do |tree_view, path, column| row_activated_cb(tree_view.model, path) end tree_view.expand_all return tree_view end def append_children(model, source, parent = nil) source.each do |title, filename, klass, children| iter = model.append(parent) [title, filename, klass].each_with_index do |value, i| if value iter.set_value(i, value) end end iter.set_value(ITALIC_COLUMN, false) if children append_children(model, children, iter) end end end def row_activated_cb(model, path) iter = model.get_iter(path) iter.set_value(ITALIC_COLUMN, true) lib = iter.get_value(FILENAME_COLUMN) if lib require(lib) klass = Demo.const_get(iter.get_value(CLASS_COLUMN)) window = klass.new window.signal_connect('destroy') do iter.set_value(ITALIC_COLUMN, false) end window.show_all @window = window end end def create_text(buffer, is_source) scrolled_window = Gtk::ScrolledWindow.new scrolled_window.set_policy(:automatic, :automatic) scrolled_window.set_shadow_type(:in) text_view = Gtk::TextView.new text_view.set_buffer(buffer) text_view.set_editable(false) text_view.set_cursor_visible(false) scrolled_window.add(text_view) if is_source font_desc = Pango::FontDescription.new('Monospace 12') text_view.override_font(font_desc) text_view.set_wrap_mode(:none) else text_view.set_wrap_mode(:word) text_view.set_pixels_above_lines(2) text_view.set_pixels_below_lines(2) end return scrolled_window end def fontify(start_iter = @source_buffer.start_iter, end_iter = @source_buffer.end_iter) str = @source_buffer.get_text(start_iter, end_iter, true) tokenizer = RubyTokonizer.new tokenizer.tokenize(str, start_iter.offset) do |tag, start, last| @source_buffer.apply_tag(tag.to_s, @source_buffer.get_iter_at(:offset => start), @source_buffer.get_iter_at(:offset => last)) end end def load_file(filename) if filename == @current_file return end @info_buffer.delete(*@info_buffer.bounds) @source_buffer.delete(*@source_buffer.bounds) file = begin File.open(filename) rescue $stderr.puts "Cannot open: #{$!}" if $DEBUG return end start = @info_buffer.get_iter_at(:offset => 0) state = :before_header file.each do |line| case state when :before_header if line =~ /^=begin$/ state = :in_header end when :in_header if line =~ /^=end$/ state = :body start = @source_buffer.get_iter_at(:offset => 0) elsif line =~ /^=\s+(.*)$/ title = $1 title.gsub!(/\s*\(.*\)$/, '') # Delete depend field last = start @info_buffer.insert(last, title) start = last.clone start.backward_chars(title.length) @info_buffer.apply_tag('title', start, last) start = last else @info_buffer.insert(start, line) end when :body # Reading program body @source_buffer.insert(start, line) end end fontify @current_file = filename end end class RubyTokonizer RESERVED_WORDS = %w(begin end module class def if then else while unless do case when require yield) RESERVED_WORDS_PATTERN = Regexp.compile(/(^|\s+)(#{RESERVED_WORDS.collect do |pat| Regexp.quote(pat) end.join('|')})(\s+|$)/) def tokenize(str, index = 0) until str.empty? tag = nil case str when /".+?"/, /'.+?'/ tag = :string when /#.*$/ tag = :comment when RESERVED_WORDS_PATTERN tag = :reserved when /[A-Z][A-Za-z0-9_]+/ tag = :const end if tag tokenize($~.pre_match, index) do |*args| yield(*args) end yield(tag, index + $~.begin(0), index + $~.end(0)) index += (str.length - $~.post_match.length) str = $~.post_match else index += str.length str = '' end end end end end target = ARGV.shift if target Demo::INDEX.each do |title, filename, klass_symbol, children| if target == filename or target == klass_symbol.id2name require filename window = Demo.const_get(klass_symbol).new window.show_all class << window def quit Gtk.main_quit end end break end end else main = Demo::Main.new main.set_default_size(600, 400) main.show_all end Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-self-intersect.rb0000644000175000017500000000136312416346617023036 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-self-intersect.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Self Intersect This demo shows how to use GDK and cairo to show cross. From http://cairographics.org/samples/xxx_self_intersect.html. =end require 'common' module Demo class CairoSelfIntersect < CairoWindow def initialize super('cairo self intersect') end def draw(cr) cr.move_to(0.3, 0.3) cr.line_to(0.7, 0.3) cr.line_to(0.5, 0.3) cr.line_to(0.5, 0.7) cr.set_line_width(0.22) cr.set_line_cap(Cairo::LINE_CAP_ROUND) cr.set_line_join(Cairo::LINE_JOIN_ROUND) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/expander.rb0000644000175000017500000000250112137115065020604 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # $Id: expander.rb,v 1.2 2005/02/25 17:09:25 kzys Exp $ =begin = Expander (Expander) GtkExpander allows to provide additional content that is initially hidden. This is also known as "disclosure triangle". =end require 'common' module Demo class Expander < Gtk::Dialog def initialize # as opposed to the GTK2 dialog, the buttons have to be enclodes by brackeds # together with their ResponseType AND all groups have to bracketed together super(:title => 'GtkExpander', :parent => nil, :flags => 0, :buttons => [[Gtk::Stock::CLOSE, Gtk::ResponseType::NONE]]) self.resizable = false signal_connect('response') do self.destroy end vbox = Gtk::Box.new(:vertical, 5) self.child.pack_start(vbox, :expand => true, :fill => true) vbox.border_width = 5 label = Gtk::Label.new('Expander demo. CLick on the triangle for details.') vbox.pack_start(label, :expand => false, :fill => false) # Create the expander expander = Gtk::Expander.new('Details') vbox.pack_start(expander, :expand => false, :fill => false) expander.add(Gtk::Label.new('Details can be shown or hidden.')) end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/alphatest.png0000644000175000017500000006364111701304107021151 0ustar koukouPNG  IHDR|B}>gAMA|Q cHRMo?r$m_j<Wmg,IDATxb?(`i0 F(> F Q0 F(! F Q0 F(! F Q0 F(! F Q0 F(! F Q0 F(! F Q0 9]:= h`3Z G[`Q02@G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(`-G(R@,Q0 F~8.h Q0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 FQ0 F v(C D,R @Z``d"ڭ` b?,SLWRdh$7|4CH4 UPvfdd3 gm0$riUR=7 (Y^`8FXrpIgt(( Obm(F5@ qE7B+:`eD(ʠN< $uG"=X!܋@\?`|kn  c$Fp@'FF \SxIg*ZcR@{  ȿHhr uj45cac1#iUQ4}E;D-T2?,H͋U^$&,#, ta|HwTgF(  |X!0F.W"ˀ@c)!L6 aAFF

J˙{Ie`*z .opf N{ e\0Vy02BZxh y/ƚ:$-8* t? S<a![&^(@9k(u09 u)#*F{hnhR9@+Ѐ_?D1 ,5i0N!#\?:3AP\u`<A!5^VDi&j024M j-у]'`U`a&D@]࣏`zlCȒm"v`a [tz5#R,CSϸd@z+0@Y[K¿PQ0 h h#NXvB}vQKA10i.J=G--|:nh+a $pCw"nGŶ,;؊ {>WVOv3V|VON˙ , >.[=6#7 F4PC:-{I3t`p?Rw|ZctC[H4,n',Z7xҎNdufѕ@Jh?M'7!$Q]RҢ@,7sj7踂l ѥ!L1`+`L ޾mrژ3hn!db5qNiO!=,98-'@;>Ⱦ]ٟX{ft< &]hA9]ƭ< ^(p 931q@MPy NrynX̤ Y]eyjD"4#v84`sK.#@ |X|=0g"ҁ.M74T@LjÍ "K PnX9 WdL#t <&$ԁydElYv_Ԍ!Cr;VOpW02, K U@75ő)fA갫$[eO)ӌqotg|FYHe#RflQgD3tUB!R<@X]0w .dZ+i t%aK*#}HQLzU?HsYL%5B##rL!@Fd7 TXoNxt2]A X0v ]ЍrK|2J^r z vhl4<2@W댈$= $0‰.9L`Y Np1@/Jeu,ldY*\v|Q7= {P z0(Ԟ t;l?tfEtd+Z`aT4<@:ms2*D! Hص 7@F8#Al+!U2x !U Ԇ< RCVTbP ^ π-SoB3tP*PqJ 6`퟼RBFB6Vy;l? ~C4Y9v*J1Q.Q!ɦ;v2XXAѥgN+Y :,C[J[u/~~q! QRP2IjvoMgҁD9 N'ygdI0-z7lB,z|!}i8i| ['D!sf}n{SA7q0R-l i!=Ǚz"ub e52,FsE݃p?;bv+$|o'6<ȳׄ+i v/YA0wTЍ $`de@]*H ;+ƉKrJ Djι/tXe{X;(;o>N4U4p;Z(̀m[#҆3/mbwSD|<n^08B-EDܝjq,/_i [XkB\K\!;nSD.az}&qG\&@"pu{D&bsFXfd?8%Ī|/.ˀgF"nS Ԥ`f2,c?.z$'K'~ +naJ?(HI2/IW` tձr FD9$5i@QPWx?c8d?R ^f`VΩ].n?:r!l 8'P֩٠Bco!4aSx\ئgFjdf6 Zӟp`@ HόyZ&0Tk fϻE-̜Z|'t"-eRP4QM;p{aY"` @SGRPCBÚ)ᣨЋi` -/ 3YX>*Izn=0 #p$F3,HV& (,&X=$q˯`` [D y _.sXI[Old?]ʓe{4o~_[G܈ .ݔ)杓.%%hClD=ӂƫ֫ _m (u dd~N7{sQ3->s m7S  XVQ+`Xʎ}SWDI!P"1I` hl#]OFAXà,ǘL\ @0Uևn}m4#Ĵ~BVmId~.6`n?de @޵ ,l$vXXG`D ,RQ@4ugύ?w1ŭ=פ-!*Gr]O̽Q.XN}1* D= LdjP+cHsCHr; {ܯ Ur5(Vtv$[&;䟝<2%uM;Y*1|ɲ| ]"ISf}5Pp0nTdNPA:wG"3Iji܏K*NxH o"=TXgH:| = qah3p`gg\pǪ&yi+$$jIdzjIo{{6l}t41I/Z[/ې)-,F}~m5 K)8 19P@{eYKw$I0E @"+T]q<]oV=dzeCLp67TIJʎ2xgbӟ G߅}!35tgnko0L}oRę1,qJ'^mh')! $"%;)د,s$9(N5Ԥ.bC uYemb쵴`ox %ygo0 Ca# 4l =;P2 0+q+zO wGsX'?}I ER#܎!*K^|AUY6$գ[ٜIBi /$٣{͵(ѥBh*&iӴNݲo~SƘ7 _Q&` v.o]S}kfHSC-@;J*W0C6p%A2p-@C:Jՠ+y|ڮO&jq@^ѼV|M;}/Js`2JlOЦA2m@ tH,0=s9g;' hD}';_,O)x_J)`m琿gZQS}=IS;x*!1k@'-I`|(Fh2N,& 3X-Wtp;'}e'<)[TӨ架9]jaU E2Ĭ4hWUB-.$sϬ39!}x'v@;iȴ(O4 J$Z{{eK+Gy< qa(lo +`c [!SЩ?RN{qv?r ߃݂_Q ZBՁfm"u6x-{z{gJFUL<~q"d%)mFPg-:d>f2Foy'T;UosEn@_/|e?Ø٠m<>21V$Pܳ)Ti]vӱ cۤ qFw 2$Wʝh9{4$):pVY|31unWȻ#bǫkj% lw<,fFo ax< }F7_^熧 'ڂ04<_?*ȍpC8,Z´KМ-W)|FeB%wfEVm!Aչ3Q4zhKv<ڍah4+0ð @T4,Ai#K iqPdYz/:r|X&Rz3^/Dډ䃇A*z XZhh(Nêp9'6=RXa& drѣ*Ct{=}2; {B`2UāWR I{m)lGKR\E7lulw̱* @Q&B҉uԕxS1wC[2=kTDTSapZi>Ydҧ]{#o]Wa&.FCtD=[ZI&8a1!1!>},Q KN?. u{iDF+A;=lˣ{4_C^ P1Skdx/<9L.I0=eyyN)[3 k 'PY_em#|P\ Ң~VDP0iIp+:C,Z{/4Ts1av)f PI@ap#R0N>*E1]#e:< na`bLX“ 0JDWu&9/v~?s2*H}6=/ %ɦ"3ԨGf BuDLk;. s|'ج 0pB"l`Z+)xeӢi~}vވz)@2,02q;0kg;Z fG3'SQTL{e&vIвLEcr8^a?G6zXT&BISg=0 B0%&L9 c{ @!A҄ ``ÿU@#3;2,fN ӋW:vsRHbldiHV4{( @Xa\jYd}jG<{ %=> eMg땓 m]E29.ckGaaXNfũf)9rS]1+ZA,tG&# k(L fvl+L)\PGa 6=QTdp $6LvyWP>~?w70oa /FFVٗ6*UN2@g*NNLw _H9TAKexa4%a}ߘrH)$ID"ؽZD_7=7ucI>TE"+G,7IG+{$o";?ӛ"1Ϡ\1^)S$>NԴG^b F+7]!k6(Y2.1>oGrea5$H>R*ie[bv;znW4CN@JyEo+ -2&MilǁMOW:}[{ QQOL0N DXB %h+J@Y&8tyno@ $l >b5d8>}Ԋ'2N@uO#q9بjUS6S):OF@ y raX &_E#LIL 4֬M~#k܉< b" ,H )OSMceaYCDktLmup [D):*7'B'%iBE<^E% g)؄jJ;9ֻFd; Eh}4zT%1+f CESwGo,;gFL=/钱*z(6F4.*+& !"ѣ19 @ d3 gԾD FT&״>_!Qq {F,`_ OL_ϥ_n;tfUՠ !KFJ˧jlCH2w&~yJ!.WJFJ9YLcsWrfjӗ6g LX4͹Z)cĻCn9`@ExbDxs t htgZZF蟀8Ja]RJI ).I&PI"#f#a>Wڵ\lf ye|>QUYd"U]8|a}</fp?*'zx)7>k+yV(rrKzɒ=2Ç1u½jTn:᬴sR'p*T/KYTŒgBߔ"x Mn*$TO p=9k@ @l,l? J /QKG[UmN/\5XvU|+[>r\@] $R/c]Nj QEp`fYA'ja<6+Ʈocƭ U, K( &h:#(wU%">*rKylI!iؖ\_s4LNxɍάh[&3:Ia* 0[ |ҨABDO+g{v;Ql9 IJS͆`uhJ’Նb8:}YWdoulArdWb5wWV_pVW XdґR?Lm)CZďyg$tux)OAr:dV^ g(XRҰ-R'T4ц\iǟXx%6y!diϰ18GsV3?oȻa(/:@b ŗ1`(}ֲsb=0oZE{۝|Vy03X9j_)sy~viBesG)oe =ssA#TI !s2nn9Iy^]Zd=]z$}3+2ۈ]"Ɠ+k@ `*:%[{N#{8)[rҳG*ߙvE54*=̆[[N* W?k4o0SV -12JE#j Xg,Tº<3GHӏ.3WTzatM.[Ł0lYK0xž$ ;]H.@k̇] 0 t`>$@Gk?/Ikg g>ˈ~]EpoWbpdAui,=/MlzJS tEAd=""2 19ak *!`D:lf,>T1GFc6 : 70#+ZD8d-hMO?x2!fY{BտLgZP|z |Uu#D٣RҐ*mW'Jr\<7]0 Q( 蘀)-2%Cc%t.DZ-)/A;6lrрg5'']^Q$D gcnj}*oxH;ū<,K&kg}7cd1{~,_eO(دN;-EZ$cYŞaG|Àm I&dJ1dRj!.r&$|/s|szR.؄C=0Ke6PhƠ'!w_58S$':E1st}a B;c V`h)bKq]:p"qȎ[YvjݏYf̳$=kX)MެH,4u[~%srЈU{W˦퐺0I+$,+zy{#%w{|`[3Ɛi%+nx"2i:hM @VJuGX`%i/3H4P!a >5ZSr{4tA1}5Ii,_K";OA4>Pw80 LG>03&2&NQ DBU!MrGr}1eYa\wvqd6̞9OYW{D5J/qfRK߬nRo'W])8*Y*8N.(q9on]ʳ6 kWdԥP5U>]M  z$t?R&obDO|(y#vR X׃Z@& 6Z0psH,gfu@|g@/TC#Z(/80zN!ۜ4 LaW .$?ZIO\guЂO@wM[ 1`q sn(<[V*sa);T?LئFDs/#-ȇaڅȆ5OEp#Q?\@a t T@KAܱ=ŽD.q ?-?}5c4+iA(]i@aH?lv͊4t XnC;$,p@7KUlj{;wpv4iRh;q /I'3k݌z -D@@&ʷG5(BjyhΜNʢҜa@tr~ YhEJn6 $#EUJ?8JH(^}?5k+8uЯΒk% Z"]0 sF`؅-x cp&X#m'G>IDqDnq 33+9XtA f-to.c w=7r4-j9kNz+HGCIx$=HrqEoxI=EԊKZu JiF(~Hi(j_r:SEZ񰝩 VƱw|B:z@:J[G*I^C>!{.{ӒOrFrnj1pPsޜ\OBwqSK^QB >s,L8hFf+ Tgw':/ra{M$ ,`UI5!P.)Z*o׷1ȝ'5Q`ݐ4>V\?ŭ6o mnA2kΟ]10 4 /aeGB06 x;?`gbd&>@-T0!*U(Nj_ KGMRs$M~s2C1.Eُ˘}(M=^zucKvGڛV>v|9M.O x׳_m7*˂H:-,dvkpBQ>Y&7M34"54.J0K׏O,\j1 uZ j֋4z{eJ{5ρ A-8W݋ mbo:X"53P1 % Is|9 (~~ŀ߽y$Lej/-|(?&vY%gp >+Nq<w$d2e}r& WYTaAT;xdz-6GFaT1~lv3ihaSePX͇$Њ-֨ CH̞RTzeA9@G4Pf۳e:"`b^CH:W*NB9jldcz\HIEdw=5@CǿܒpEPElUr-`%H>ne>v([@]& e-;G4k$_zkmH :, +r=%`oͨݳJO; z>Oۦ!u`02/w ]e:D0—ZGI;/`o* 7[xXEib2 s+t >y9LÏZ@Tț gv20Zѳ۫ؿ @vv|X5c@@CG/ı+\ !K5La 3ȁ$:tjQj}O9c~G6$PSa"~(SrNfG-89hPˀvяv/@ [\3S&HK؆*B@:ڗQ0E"^Sq tEZҐn@Z+DzA|h UY=뫴4o`,G3E [ zhGEY9b[4T8ȀmE$#j2C0>#@%`+Ax1@k$`%#8i+J{]r vG<_^;stQ#p-;0w1 9?vBeEgqMcjFt-ms!5-`1BVdvV@A„{$FX9 *@P8 0yąe C9!® 6L:={!\`Cag̓@̇,2'@oGfVaq;2,*X:5p" xd>G.G.8t ,GBpaeo u0Xh H1*a~6/F QpCeB IpH]?7юT};Ia״B,z-a%٥Ѝj~IV3A+j"Nć,e 2$)j [x'j˫E;nUrZ%7&o "ZXc3@0RF J"D -]`u4,@2AMbi4Ej/t4/s VbrˇP _0BfXm†l\#M4y#_,ht #J^aqD+f'- w4s ?1zآ ڮ "C`>m3=KP }HA>` aZ9Kۧ"Ō1{xǀ.h993B%jg͋H^+:a,nvA`a@q &3DhfD\ 1kVpwAkDpOYPz*,)&<9%DhCZC{#e4\ |\l?ZKdgN}+zsB@k0gr }BjT!bPF{5}"]ZY7O!N6`-Ki~ϬHFÊ'$3g=ps?lh O瑋~b)3B!ﰞa/)*-Qcహ(֤!f!Hσ Vb/!2B8lk,c abBKp %M?κSn#C @ 59aqĀ=b@ 1_⒃ #xJ;@AG S8ց_.5~Y{!lPZ־cF+hyX>ubdޑcdY 6F*a711X x*ek@eO>x'J;g@ LOܔa7E<,`eWǐPt$ڏ5+ ͺ@[9 r ́!oE=@{F@uo(>0*&Fx&X%݋SKZ)/G((j;Lȣds!M7b3Pm"r /eM@A#9-EN#PlKpfY'h7,S``a ,Z KN]h?Z@C]5ݲ3L6c3! 1^LB2Ƚc4,:r[4ᏂQ0 1(l;j ,AsC{݈qd]=HZc! H{B GSaQ? +Q@5,e%#|3bt)І5H;pQF<NoD*;#|ƙsM#h? F(&0OCo]tdVBG(Y|]SG)## 9|o)@| F Q0 FUb@: ?P;#$d1 G"vm(d2tXRaO` F'mG(TGy g@7WB7sl/@̪{W] ul?|2R}>t@`FfeȜpAl‡&`ECT#(k푶@%jzy-G(T3yO89 P c&`4b:v"GYHGQ@1n?i*;={<ƏybB)RC h? F(x q%[baxv  z ?`@EnciZK,#*Q0 FUj_tfHMa0@o_ފ>ƀ|C*W~:Š4ZQ0 3>e@) ro Ϣ^.AїOJBb2@6o1 Q?|=j)[t//Q@5lr|#DyX Zy8p3u1ݶw3v2"] ,rk= @(j`Bs`&,F l,rqpkrRc8ԀXw/@6U7W H8 끅Q4ZQ0  \!fa Asgawe@ gW*ТTi_5Zc=Q@uPvLX q^(Ȏ,hg@rw0s* 1l+Ew0Q@P~ :gBVVR5_rM7^ueʘ1gP/D\)o6X ]=8@`lYЋt |Ն/+_):,y`둚K ߡ-G(``h`h`h`h`h`h`h`pwm &uHb10 "7'~gx|9u~>}~$Rۥ]'ckxyYkZz62 6 CY#d?^fLe8\F`Ẇ[y_dA }7o/ػAa%xeli?ɱ#;\y4> Ye©Poly%(cE3'!Opnǁ6*VWKSr\8dbuܫ=9=~' v`NiHą*+çï6mv¨r^25ı38vu墜N94;,j4"d0i᷊֭C'})FQ?Cj[Gε铖r,S WBڡr U4e|iF}sn7MH_&##Us}V+_Wu5 ݼ0ֽ}GnkCਓ]UKgFkuyn$O\%#uD\'I%JpX'w97uoswkxݚ[%| {G։DUjuk8#9V;9@uG3rY:1П[sPdD NK(ڡNR֩0&EUC)U]]5nm OZWZީh)bHY [JLL([v!q3@6P!FDWO./4W8!ہM_@E9\q:e @Owjc;tSkJ=|&ՇaT\$Dy<_ܞ&2\cR[O>xԫoZ]ruq q0IYbbyEJo1 _Jӷu$fv$3I)a}7E u **s"D>7@G;hO|G$:qkG֝ӽ*HߵOؽQ`qAN&iK\dBD)W 3aHnIɘc%! ")= \]+36u׶b.AL% C+}vߋ؁jbK$ pXձY=3BծA++-tk ?8ӹN)+'=?$(a3?JnZ^Hئ$Sc!KhrQR\_'_|ӌ#-][r`_?:<ҡ݊ 37 Pshu0ܝV}(~ ӹuW2`=qjm4 6%: 1{҃@=01-4bZ2/)Wr3 L/:PKT@NwАB)&U^yj\`s WEGߐ LR[\~MzÜP^*60"[ rIO]A}F4"΋$K7)$t5(2;Mb;AU씲]C&>pyԷuqq]1Su6vNeN` 1 k'A%.: Vl/L2f6 IwjmobH t=QLc/]d 6U)Kj̣[UVӉlu4g_:_lBjKrZ# lRR tR]myא*srL?E"?}KlsE*&uqC4bLi CCNܓwo{Sdr_iH,_9atO8-=-j0A'|nٴoQ=+SoeJigg {kMx^=^ 4Sot6n3.Ԩ. 5X| K`u7C2F@1Ǘ $} cK#o褙LQQa;A܈ m'1Q4h2s$3[8cfvfM|[6#9ڵixlm?_:TLS 2d.\*bsXRt~i5/<-Mj i58$Ѷ|ؚGQj')!b=d(` ? F( F Q0 F(! F Q0 F(! F Q0 F(! F Q0 F(! F Q0 F(! F Q0 F(! F Q0 F(! V0,$iaX _..b>ik1rNEo穴F'oG~VgOx^Wduuu2]>>٪3-yib<6g-wg@AjB&60MPs|הRW>';S@A|ZSzN)@uECui .W͎ .Tt).#QQ[(.*j μ8BwBpŸb&~i[ -IsmL y }EВe#@7w[Sx|r}ۿ,-*C;sh|hnkM͗Vȧi9d| Q>qgqq Az[4 e5'Fn,F,Dj؀BS #3 S3NS[bɷ#,NwC}yGS?8nb;q 'qF>9cbgKVZKMAt1`wTSk.GzT{*/$|QIFi;Q_Wftwvunb"bۄBͼ՞^KJOret@tKb5ע׿t;t]> \E;Ap1<vsqd$8GuVҳDtU *_`k<%T :ڸ Y +. ~n@qͰ3|+FAu 50d`qf"B.xQNH$T$c[M2>pKη&3@^Rwՙ2nu qAz[{E A|yA)I)$O L{SqOeIv!vgD9tIN [91"4Ǧhd;[[.) [C̯6 *Tj@]<mZx6[ȩᦙ5@U΁ 0p(\ 8]ۻĒ,rkwk /a\aH\mЉie^5sDA4\ϜK4# MSKTOÉKi={b)4s-mv}r6ަԘ63mҏ |]ktw[jRl.u!'ˌh\0@.EGL/ gx81l> X?cS!QC >>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~ぁ=v{! NETSCAPE2.0! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@H 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gNAȚkhq8S)5Hgf>$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P vX(Dːյj7)֩VU{n*4YR{5*ʹ ,hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(ǁd`]&L%Db'\~ rуxvڌԈҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T!This GIF file was assembled by CDavis with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. ! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@H 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gNAȚkhq8S)5Hgf>$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P vX(Dːյj7)֩VU{n*4YR{5*ʹ ,hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(ǁd`]&L%Db'\~ rуxvڌԈҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T!This space for rent...! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@H 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gNAȚkhq8S)5Hgf>$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#! ,L> H*\ȰÇ#JHŋ3jȱǏ CIdA(S\rɅNjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P vX(Dːյj7)֩VU{n*4YR{5*ʹ ,hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(ǁd`]&L%Db'\~ rуxvڌԈҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T!This GIF file was assembled with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set;ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/printing.rb0000644000175000017500000000722611701304107020632 0ustar koukou# Copyright (c) 2008 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. =begin = Printing Gtk::PrintOperation offers a simple API to support printing in a cross-platform way. =end require 'common' module Demo class Printing < BasicWindow Data = Struct.new(:font_size, :lines_per_page, :lines, :n_pages) HEADER_HEIGHT = 10 * 72 / 25.4 HEADER_GAP = 3 * 72 / 25.4 def initialize super('Printing') button = Gtk::Button.new("Print...") button.signal_connect("clicked") do begin run_print_operation rescue dialog = Gtk::MessageDialog.new(self, :destroy_with_parent, :error, :close, $!.message) dialog.signal_connect("response") do dialog.destroy true end dialog.show end true end add(button) end private def run_print_operation operation = Gtk::PrintOperation.new data = Data.new data.font_size = 12.0 operation.signal_connect("begin-print") do |_operation, context| on_begin_print(_operation, context, data) end operation.signal_connect("draw-page") do |_operation, context, page_number| on_draw_page(_operation, context, page_number, data) end operation.signal_connect("end-print") do |_operation, context| on_end_print(_operation, context, data) end operation.use_full_page = false operation.unit = :points operation.run(:print_dialog, self) end def on_begin_print(operation, context, data) height = context.height - HEADER_HEIGHT - HEADER_GAP data.lines_per_page = (height / data.font_size).floor data.lines = File.readlines(__FILE__) data.n_pages = (data.lines.size - 1) / data.lines_per_page + 1 operation.set_n_pages(data.n_pages) end def on_draw_page(operation, context, page_number, data) cr = context.cairo_context draw_header(cr, operation, context, page_number, data) draw_body(cr, operation, context, page_number, data) end def draw_header(cr, operation, context, page_number, data) width = context.width cr.rectangle(0, 0, width, HEADER_HEIGHT) cr.set_source_rgb(0.8, 0.8, 0.8) cr.fill_preserve cr.set_source_rgb(0, 0, 0) cr.line_width = 1 cr.stroke layout = context.create_pango_layout layout.font_description = "sans 14" layout.text = File.basename(__FILE__) text_width, text_height = layout.pixel_size if (text_width > width) layout.width = width layout.ellipsize = :start text_width, text_height = layout.pixel_size end y = (HEADER_HEIGHT - text_height) / 2 cr.move_to((width - text_width) / 2, y) cr.show_pango_layout(layout) layout.text = "#{page_number + 1}/#{data.n_pages}" layout.width = -1 text_width, text_height = layout.pixel_size cr.move_to(width - text_width - 4, y) cr.show_pango_layout(layout) end def draw_body(cr, operation, context, page_number, data) layout = context.create_pango_layout description = Pango::FontDescription.new("monosapce") description.size = data.font_size * Pango::SCALE layout.font_description = description cr.move_to(0, HEADER_HEIGHT + HEADER_GAP) start_line = page_number * data.lines_per_page data.lines[start_line, data.lines_per_page].each do |line| layout.text = line cr.show_pango_layout(layout) cr.rel_move_to(0, data.font_size) end end def on_end_print(operation, context, data) end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-gimp.png0000644000175000017500000000652211701304107021216 0ustar koukouPNG  IHDR00WgAMA1_ IDATxYk]u>{9w޶gllc#ǯ_Qܹu7up,+ k, !]?w @u ܴry=>ّ/$~IDhxm~Gȱ=fR.w'{ˡC"_"#acv*KDv ܂VK6Wztl0[; . 9<ckGn΍lR;y介~ &/xԙ ~w:$\":An(EFW~#AcR)ĭ4\OKs{&R@*=tӪW|B$BDp-xgp7zK~RH ѢrW\OBy񟟞Ǔ4++ݟ~xWQ,Z`olRZ2-v hJC g@ 0`O\!8 3v3X 0zE_s]^fvy\o<ЦMz^0o-[~ c8ȤDIdR!,j9ic_[6#)fݼaÆm޼!!Dqbb?=ȶKF|/b``{ޏ5kǐJǖ-[ƪP*VR1Z[Jz3WpdTMdldS*wx===m۶GǽfIo&q<?ժxWh~~vi^{m?8رcꫯBJVR R*( h֒Ʊ='20I.gN;HCyQyBvr''=Z vڅF3'`Fm<3={e&$A;IIJ({f0$GV (mb 0V:@rhrrB,_ѣGP,šs@>q߃a֭\SOhnRf}uՙ0l#٩T*-uM08O*ܝ=== fFehZ(J(9ϝ93'0n~i(RJT 8{}Π^  &VfX &fgseג3|߇Ð(Bp hPڇo}+ex~ԅSHJkZm IښU@BfÜ_Lkqaya!mU'mhـ=`6`f,? Vl$j ApY)rԇs1ro}c}ɞi4˲waE{{zz0 Q.GbCZITPy>=erJkLL]TIq3|fnqTux+ֺZT (ðJa I\CYV AAlIHc뚶p2z y5@4<5}nב˦pM?qx^R{dyZIΜG&SHrk@+ĄnNF sqnb}3VZZkRv;[P!`if[`f9;;{xHISiFJ* CiTJ0;W<.^Z@d-(B/Stz@n/5̘jg<9덎]` ۼqL |,H6ՆBT,T*7BO="Sgr0}SK0H3zjSU^uWu~NLW̧0iORIENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-image-pattern.rb0000644000175000017500000000174212416346617022645 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-image-pattern.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Image Pattern This demo shows how to use GDK and cairo to use image pattern. From http://cairographics.org/samples/imagepattern.html. =end require 'common' module Demo class CairoImagePattern < CairoWindow def initialize super('cairo image pattern') end def draw(cr) image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") pattern = Cairo::SurfacePattern.new(image) pattern.set_extend(Cairo::EXTEND_REPEAT) cr.translate(0.5, 0.5) cr.rotate(Math::PI / 4) cr.scale(1 / Math.sqrt(2), 1 / Math.sqrt(2)) cr.translate(-0.5, -0.5) matrix = Cairo::Matrix.scale(image.width * 5, image.height * 5) pattern.set_matrix(matrix) cr.set_source(pattern) cr.rectangle(0, 0, 1.0, 1.0) cr.fill end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/builder.rb0000644000175000017500000000221312516434313020425 0ustar koukou# Copyright (c) 2008 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Interface Builder Demonstrates an interface loaded from a XML description. =end require 'common' module Demo class Dialog < Demo::BasicWindow def initialize super('Interface Builder') available = Gtk.check_version?(2, 12, 0) if available label = Gtk::Label.new("Build an interface from XML description.") else label = Gtk::Label.new("You need GTK+ >= 2.12.0 to run this demo.") end add(label) return unless available @builder = Gtk::Builder.new filename = File.join(File.dirname(__FILE__), "demo.ui") @builder << filename @builder.connect_signals {|name| method(name)} @window = @builder["window1"] @window.show_all signal_connect("destroy") do @window.destroy unless @window.destroyed? end end private def quit_activate @window.destroy destroy unless destroyed? end def about_activate dialog = @builder["aboutdialog1"] dialog.run dialog.hide end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-foot.png0000644000175000017500000000554411701304107021234 0ustar koukouPNG  IHDR/0#gAMA1_ IDATxYkly=wfvvfܗ)QŪl#HqdmT i4N A(n ] l<8v*#%RDY$MJ>?2T ,T\0s _e/ׇ o>Н:qj^ڷo߉mXpd WMjo1W[?kll,cСT*5:6M$eW2ob x3}3}xgPUjI3&c+wM& rտ%v{v$+Q):ښNƘUOdΑ/R7ODzHKR"xDb!zKAHiY0 RedLU(fyQݵr]] Cj6ѪU!J-a>奂Jz|q 琈E0ym{A=J|7xx#luS6}Wz6#gޘ%r[%-Mi|Zov,e |YQp"z}_wԪ_hUvyc ѦY|)B&_; qիtMb\^cϏ& G}F+8nu;hdhp6Zbew7%5 3 3j`*-nxw-8ph$Rwmcg.#\ٚmd몂g Kdj,J(*}k_z~'H^sk#-dz7vq5_VONKF8%5*'Qc]Xioiٟĥûo岹#vDP0Ƕ`YoozVYT?/l$,D!M%c-V0̟lV+T%drL\0y?mlВ'FGL%4D2IEM MF>Oy3׳ݽ}X|wo_o,l biuS/#[(=948Ǡ`zz{a[aYGPIg,# Hu^-Cm]X_;+{>VWU mX0, ϣ4C<ЪW`Y"Fni|e̤Pk $>\|r=N"6  CJYǒb!ǶZ@MC#\V˫V)c=vjn̻ [5 VIa[xAqD1׶ XYZd2gr[AWfD/Wk3GiZeyx'eBD1D8%kkeL%OO<^-Fޜ$ 1-;єdhF$EmS'eQ]Ӊm0M,g2x8v,~7|/jf0ֽ%ю^0l8$-I (J=j;.XaZbMo;MC| -Q8<< Image loaded from a file') vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) frame = Gtk::Frame.new frame.shadow_type = :in # The alignment keeps the frame from growing when users resize # the window align = Gtk::Alignment.new(0.5, 0.5, 0, 0) align.add(frame) vbox.pack_start(align, :expand => false, :fill => false, :padding => 0) # demo_find_file looks in the the current directory first, # so you can run gtk-demo without installing GTK, then looks # in the location where the file is installed. pixbuf = nil begin filename = Demo.find_file('gtk-logo-rgb.gif') pixbuf = Gdk::Pixbuf.new(filename) rescue # This code shows off error handling. You can just use # Gtk::Image.new instead if you don't want to report # errors to the user. If the file doesn't load when using # Gtk::Image.new, a 'missing image' icon will # be displayed instead. dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::ERROR, Gtk::MessageDialog::BUTTONS_CLOSE, "Unable to open image file 'gtk-logo-rgb.gif': #{$1}") dialog.signal_connect('response') do |widget, data| widget.destroy end dialog.show end image = Gtk::Image.new(pixbuf) frame.add(image) # Animation label = Gtk::Label.new label.set_markup('Animation loaded from a file') vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) frame = Gtk::Frame.new frame.shadow_type = :in # The alignment keeps the frame from growing when users resize # the window align = Gtk::Alignment.new(0.5, 0.5, 0, 0) align.add(frame) vbox.pack_start(align, :expand => false, :fill => false, :padding => 0) filename = Demo.find_file('floppybuddy.gif') image = Gtk::Image.new(filename) frame.add(image) # Progressive label = Gtk::Label.new label.set_markup('Progressive image loading') vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) frame = Gtk::Frame.new(nil) frame.shadow_type = :in # The alignment keeps the frame from growing when users resize # the window align = Gtk::Alignment.new(0.5, 0.5, 0, 0) align.add(frame) vbox.pack_start(align, :expand => false, :fill => false, :padding => 0) # Create an empty image for now; the progressive loader # will create the pixbuf and fill it in. image = Gtk::Image.new frame.add(image) start_progressive_loading(image) # Sensitivity control button = Gtk::ToggleButton.new('_Insensitive', true) vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect('toggled') do |widget| vbox.children.each do |widget| if widget != button widget.sensitive = ! button.active? end end end end def start_progressive_loading(image) @load_timeout = Gtk.timeout_add(150) do progressive_timeout(image) end end def progressive_timeout(image) if @image_stream buf = @image_stream.read(256) @pixbuf_loader.write(buf) if @image_stream.eof? @image_stream.close @image_stream = nil @pixbuf_loader.close @pixbuf_loader = nil end else filename = Demo.find_file('alphatest.png') @image_stream = File.open(filename, 'rb') if @pixbuf_loader != nil @pixbuf_loader.close @pixbuf_loader = nil end @pixbuf_loader = Gdk::PixbufLoader.new @pixbuf_loader.signal_connect('area_prepared') do |loader| pixbuf = loader.pixbuf # Avoid displaying random memory contents, since the pixbuf # isn't filled in yet. pixbuf.fill!(0xaaaaaaff) image.pixbuf = pixbuf end @pixbuf_loader.signal_connect('area_updated') do # We know the pixbuf inside the Gtk::Image has changed, but the image # itself doesn't know this; so queue a redraw. If we wanted to be # really efficient, we could use a drawing area or something # instead of a Gtk::Image, so we could control the exact position of # the pixbuf on the display, then we could queue a draw for only # the updated area of the image. image.queue_draw end end # leave timeout installed return true end def cleanup_callback @pixbuf_loader.close if @pixbuf_loader @pixbuf_loader = nil if @load_timeout != 0 Gtk.timeout_remove(@load_timeout) end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-calendar.png0000644000175000017500000000530311701304107022027 0ustar koukouPNG  IHDR00WgAMA1_ zIDATx]lWwvvwNvc7֤}B"TDAVT臢ҨQ Ayh)BB R>ѠTb'󹉿];wwfa7N*Du5;wN;Nnn0;x}?&Ex @twRJ"T!@QW @ a H_(yJ6'C""a$ BuZ BiM* *=ܪD;ϏweBB E*es8N2H)A6/O^ZJ)[?J%#/hl34*aH(ω|>*c76 $2'\O6.8y}B1aᅊmsu'X aHB|rןP(J(^)RԑRDJNDΗ^ac_kG-VVW6l |#bhm!ne~ye9FhfA^G#7)rp$^<|] QJ"py2 KV^o $ʈ C;Qؐ{Iȥnc2}8ڭ;rk LdGui 8ƃ@ "Z!&7ֽ@^xO,k*)-l ]o[fMCz8@oܸ K;7ę v(d6LJxh-`Oˌ]5MdU`PHw@1c; 9D5#M@.}@7vg):?yyF+C ? lSKl =˓R)/fYZ)JgDeYZXbbGF@o84ށX5e!J:OS)N)w3ccdYv 180H+Mm֢@QNtR|'C^_Cgzt%eTkÐZ25;5эIXخh&BrĻt[jEZjc'ak*ͮa1yKTu]T%onl(r  ~ضrC4d'Ƅ:o!:zGcXd&zI} !ҩh+-G7 I4[=`ŵ $Mce_ܿ'F{1>7wccۀ^k1.Z\10ŁNVdf9v)c|t=< 3ccL̔1E94y0nzz=Du:3.XLvb+Ng0Ƣ2Eeh8kqIz]T2Gd6%"@nY>| `oFX^=vxƚek-ΝEj @f22kU|as <5d$Z-~@RcF޴,:ۼ|GzrTfIZ!|: 8p 91a@Jߗx+6][=Ӧj>pOn_" bc3?ϛukO!DQkuffZlnl> RiΟybҌԦh2 Gl.hxW^wMDŽ " C(Bk &;;=]u4 ֮T*:œqfKssdWw>?v۝}tZ$nR*?x {!koƯ-?ܳ{rHNSGvIRa8  ~#&qL$R0ers7h$NXťuV$J&WrX._M9<|ߗ~K)58ILb,Zn#ʼni$ J}y`1j s*qȷomR)v{sp/oH?[~qX!RJj*RqOiA)d2A)E$ycZs 9GZ%X\gqao.κ<=stؗŷD>Rz{D)>t|cDQDE$IB) jlr!.-h68r mh6:O|=|?k8VۯGkY$ Ks$Ii2 DQD(A0;3#8~|޲Gfnрtww|LN\B<[?~+? q;h6xO|| \),T*cPJ!GUG @NI!:>rC t]qB̀f3'G'~~OwָcJBeH)B0L}BCkspFYufm_]^!tuG/4GK9RT*8Bnׅ!ֲHE0Dx<RzD⯟},BxX~+~u2c}U/dxkR1뽑V@D¿)i>ed!0 ihQJM H)WIFfIoZGn&js\*x-'FkHd$v>iRΎ1fZE'2zkܠ9Ph-'PX,0Okb–IL&&;|7W 9rUˣ_ρmw#$I SZk8- $sV2[/H)d$J81Sŗ <.diZOZ_rљ#Ϝ9R 9HӔ4M}cJGQV[l4K`MI&|^B»xCheckerboard pattern") vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) frame = Gtk::Frame.new frame.shadow_type = :in vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0) da = Gtk::DrawingArea.new # set a minimum size da.set_size_request(100, 100) frame.add(da) da.signal_connect("draw") do |widget, event| checkerboard_draw(widget, event) end ## Create the scribble area label = Gtk::Label.new label.set_markup("Scribble area") vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) frame = Gtk::Frame.new frame.shadow_type = :in vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0) da = Gtk::DrawingArea.new # set a minimum size da.set_size_request(100, 100) frame.add(da) # Signals used to handle backing pixmap da.signal_connect("draw") do |*args| scribble_draw(*args) end da.signal_connect("configure-event") do |widget, event| scribble_configure_event(widget) end # Event signals da.signal_connect("motion-notify-event") do |*args| scribble_motion_notify_event(*args) end da.signal_connect("button-press-event") do |*args| scribble_button_press_event(*args) end # Ask to receive events the drawing area doesn't normally # subscribe to da.events |= (Gdk::Event::LEAVE_NOTIFY_MASK | Gdk::Event::BUTTON_PRESS_MASK | Gdk::Event::POINTER_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK) end # Create a new surface of the appropriate size to store our scribbles def scribble_configure_event(widget) allocation = widget.allocation surface = widget.window.create_similar_surface(:color, allocation.width, allocation.height) @cairo_context = Cairo::Context.new(surface) @cairo_context.set_source_rgb(1, 1, 1) @cairo_context.paint # We've handled the configure event, no need for further processing. return true end CHECK_SIZE = 10 SPACING = 2 def checkerboard_draw(da, cairo_context) # At the start of a draw handler, a clip region of event.area # is set on the window, and event.area has been cleared to the # widget's background color. The docs for # gdk_window_begin_paint_region give more details on how this # works. xcount = 0 width = da.allocated_width height = da.allocated_height SPACING.step(da.allocation.width, CHECK_SIZE + SPACING) do |i| ycount = xcount % 2; # start with even/odd depending on row SPACING.step(da.allocation.height, CHECK_SIZE + SPACING) do |j| if ycount % 2 == 1 cairo_context.set_source_rgb(0.45777, 0, 0.45777) else cairo_context.set_source_rgb(1, 1, 1) end # If we're outside the clip, this will do nothing. cairo_context.fill do cairo_context.rectangle(i, j, CHECK_SIZE, CHECK_SIZE) end ycount += 1 end xcount += 1 end # return true because we've handled this event, so no # further processing is required. # return true end # Redraw the screen from the surface def scribble_draw(widget, event) event.set_source(@cairo_context.target) event.paint return false end # Draw a rectangle on the screen def draw_brush(widget, x, y) update_rect = Gdk::Rectangle.new(x - 3, y - 3, 6, 6) # Paint to the surface, where we store our state @cairo_context.fill do @cairo_context.set_source_rgb(0, 0, 0) @cairo_context.rectangle(update_rect.x, update_rect.y, update_rect.width, update_rect.height) end # Now invalidate the affected region of the drawing area. widget.window.invalidate(update_rect, false) end def scribble_button_press_event(widget, event) # paranoia check, in case we haven't gotten a configure event return false unless @cairo_context if event.button == 1 draw_brush(widget, event.x, event.y) end # We've handled the event, stop processing return true end def scribble_motion_notify_event(widget, event) # paranoia check, in case we haven't gotten a configure event return false unless @cairo_context # This call is very important; it requests the next motion event. # If you don't call Gdk::Window#pointer you'll only get # a single motion event. The reason is that we specified # Gdk::POINTER_MOTION_HINT_MASK to Gtk::Widget#set_events. # If we hadn't specified that, we could just use event.x, event.y # as the pointer location. But we'd also get deluged in events. # By requesting the next event as we handle the current one, # we avoid getting a huge number of events faster than we # can cope. # NOTE: Gdk::EventMotion#window will be restored from Ruby/GDK3 2.1.1. # win, x, y, state = event.window.get_device_position(event.device) win, x, y, state = widget.window.get_device_position(event.device) if (state & :button1_mask) != 0 draw_brush(widget, x, y) end # We've handled it, stop processing return true end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/menus.rb0000644000175000017500000001241112516434313020127 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: menus.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $ =begin = Menus There are several widgets involved in displaying menus. The Gtk::MenuBar widget is a horizontal menu bar, which normally appears at the top of an application. The Gtk::Menu widget is the actual menu that pops up. Both Gtk::MenuBar and Gtk::Menu are subclasses of Gtk::MenuShell; a Gtk::MenuShell contains menu items (Gtk::MenuItem). Each menu item contains text and/or images and can be selected by the user. There are several kinds of menu item, including plain Gtk::MenuItem, Gtk::CheckMenuItem which can be checked/unchecked, Gtk::RadioMenuItem which is a check menu item that's in a mutually exclusive group, Gtk::SeparatorMenuItem which is a separator bar, Gtk::TearoffMenuItem which allows a Gtk::Menu to be torn off, and Gtk::ImageMenuItem which can place a Gtk::Image or other widget next to the menu text. A Gtk::MenuItem can have a submenu, which is simply a Gtk::Menu to pop up when the menu item is selected. Typically, all menu items in a menu bar have submenus. The Gtk::OptionMenu widget is a button that pops up a Gtk::Menu when clicked. It's used inside dialogs and such. Gtk::ItemFactory provides a higher-level interface for creating menu bars and menus; while you can construct menus manually, most people don't do that. There's a separate demo for Gtk::ItemFactory. =end require 'common' module Demo class Menus < BasicWindow def initialize super('menus') self.border_width = 0 accel_group = Gtk::AccelGroup.new add_accel_group(accel_group) box1 = Gtk::VBox.new(false, 0) add(box1) menubar = Gtk::MenuBar.new box1.pack_start(menubar, :expand => false, :fill => true, :padding => 0) menu = create_menu(2, true) menuitem = Gtk::MenuItem.new("test\nline2") menuitem.submenu = menu menubar.append(menuitem) menuitem.show menuitem = Gtk::MenuItem.new('foo') menuitem.submenu = create_menu(3, true) menubar.append(menuitem) menuitem.show menuitem = Gtk::MenuItem.new('bar') menuitem.submenu = create_menu(4, true) menuitem.right_justified = true menubar.append(menuitem) menuitem.show box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, :expand => true, :fill => true, :padding => 0) box2.show menu = create_menu(1, false) # menu.accel_group = accel_group menuitem = Gtk::SeparatorMenuItem.new menu.append(menuitem) menuitem.show menuitem = Gtk::CheckMenuItem.new('Accelerate Me') menu.append(menuitem) menuitem.show menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F1, 0, Gtk::ACCEL_VISIBLE) menuitem = Gtk::CheckMenuItem.new('Accelerator Locked') menu.append(menuitem) menuitem.show menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F2, 0, Gtk::ACCEL_VISIBLE | Gtk::ACCEL_LOCKED) menuitem = Gtk::CheckMenuItem.new('Accelerators Frozen') menu.append(menuitem) menuitem.show menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F2, 0, Gtk::ACCEL_VISIBLE) menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F3, 0, Gtk::ACCEL_VISIBLE) optionmenu = Gtk::OptionMenu.new optionmenu.menu = menu optionmenu.history = 3 box2.pack_start(optionmenu, :expand => true, :fill => true, :padding => 0) optionmenu.show separator = Gtk::HSeparator.new box1.pack_start(separator, :expand => false, :fill => true, :padding => 0) separator.show box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, :expand => false, :fill => true, :padding => 0) box2.show button = Gtk::Button.new('close') button.signal_connect('clicked') do quit end box2.pack_start(button, :expand => true, :fill => true, :padding => 0) button.flags = Gtk::Widget::CAN_DEFAULT button.grab_default button.show end def create_menu (depth, tearoff) if depth < 1 return nil end menu = Gtk::Menu.new group = nil if tearoff menuitem = Gtk::TearoffMenuItem.new menu.append(menuitem) menuitem.show end 5.times do |i| buf = sprintf('item %2d - %d', depth, i + 1) menuitem = Gtk::RadioMenuItem.new(buf) group = menuitem.group menu.append(menuitem) menuitem.show if i == 3 menuitem.sensitive = false end if submenu = create_menu(depth - 1, true) menuitem.submenu = submenu end end menu.show return menu end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/apple-red.png0000644000175000017500000000673111701304107021032 0ustar koukouPNG  IHDR00WgAMA a IDATx[]Wyk9s8 N)JڄڨB>pE WK R@@@BqS+8v3sk}>31^|֞9e{^tvy_Tz߇} r޽cksM?p<p+E>*ܾ֏ W]vfgvw>yv!'+_dLom]aD֭G7L#ͯ굿>tbލW-,.{>E,&+֬h /ڳ{^>߄z;?/ ;po}U.tKGŇf6)o]EZ91|}~ W--7C4 ;%씍ozۍ! g|aNgnMo,VKU!@0G|׶nڱk5pJog&;W5B8tpao;[6:׽O\ 2R wͮr|Ο=ZEB|[aղ,ꭿw~x VmB)Fhcݷ}\In}GSefc"vԪg/-3j"`wogpr>Aqow;7O ̄ & AXA۰ض8pS9pMNwnmჃja~n,v?s{v}7ُOP v4!tTUMOh[( 0 :4uȢ(;'yn9?Scbጙ!|'/͛7+Wu_իNH)D^'jFĪBĐ,h.%49 0ofH_ CSv&/ʁnzhɖtJ?ܽ^q6]^~ӣ&5)G1!@2 ĺۖzf r\饊6?7=_ޓwַ/;w'W7y'^jc wzCDqbO1H!޴a f曖cP26,dhRЀص0hO~ί{r/VOMVl^}5#ey_\3*1D7*Jx*4+Dƨ$",X^SxAJpǏvpǏ8Gݍ׮YmeM޲zr\ǎ1?L NɈq X4L Iz!u$Dw!P!X(3J⺫~w>*;o; fLթѦO{ A?MtzU:z47"qsHNDS@8ɜn5A75e<3atH` _ v:,~J;I`U"* af#Pp wD0US"Vka`9zT5^W/8Ognl?P2⠥Qs8;A T"J9%3^]vݫ )%@_jBxɘ9w'fT(0 -/lpaAAi#aEN0NKm7]E;tz`@~$Zɘ`xD^1CQƱoN@pu,@z%jS6:ઔEk)e  "`h "TFPv,GbrJ>5ZS TP'4QuGlb*-+18ʨ>L Uǣ",*V1,E, *U;Ή@&D "Ǐљ&}a5\ )"JF0U3 sh БB+isa+  J)-M:&Xɸ "y4âd-TrD@#Ȱ(q@S<ܶwŧULЛYE*J.D B#%Cdb`#j0#qZUT)h}7kCPK VfZaoI@PB iA ֩#  F Q>JdŽP1IP"XTlXE"ia"Z@<hsaЎgyhCL_) LMttzb|[{v0Fԕ*A"E" 'U(G3.ElPSZsD %;١B1rch&3Ԅ%$D9FbwƓ963{;ydb vXs<2N80qY?fza\!9zTr;O97c2~ie8]щblE˜ |\IENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/spinner.rb0000644000175000017500000000274612416346617020500 0ustar koukou# Copyright (c) 2013 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Spinner GtkSpinner allows to show that background activity is on-going. =end require 'common' module Demo class Spinner < Gtk::Dialog def initialize super(:title => 'Spinner', :parent => nil, :flags => nil, :buttons => [[:close, :none]]) signal_connect(:response) {self.destroy} signal_connect(:destroy) {self.destroy} self.resizable = false vbox = Gtk::Box.new :vertical, 5 self.content_area.pack_start vbox, :expand => true, :fill => true, :padding => 0 vbox.border_width = 5 # Sensitive hbox = Gtk::Box.new :horizontal, 5 @spinner_sensitive = Gtk::Spinner.new hbox.add @spinner_sensitive hbox.add Gtk::Entry.new vbox.add hbox # Disabled hbox = Gtk::Box.new :horizontal, 5 @spinner_insensitive = Gtk::Spinner.new hbox.add @spinner_insensitive hbox.add Gtk::Entry.new vbox.add hbox hbox.sensitive = false button = Gtk::Button.new :stock_id => :media_play button.signal_connect(:clicked) do @spinner_sensitive.start @spinner_insensitive.start end vbox.add button button = Gtk::Button.new :stock_id => :media_stop button.signal_connect(:clicked) do @spinner_sensitive.stop @spinner_insensitive.stop end vbox.add button end end endruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-clip-rectangle.rb0000644000175000017500000000140712416346617022777 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-clip-rectangle.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Clip Rectangle This demo shows how to use GDK and cairo to clip as rectangle. From http://cairographics.org/samples/xxx_clip_rectangle.html. =end require 'common' module Demo class CairoClipRectangle < CairoWindow def initialize super('cairo clip rectangle') end def draw(cr) cr.new_path cr.move_to(0.25, 0.25) cr.line_to(0.25, 0.75) cr.line_to(0.75, 0.75) cr.line_to(0.75, 0.25) cr.line_to(0.25, 0.25) cr.close_path cr.clip cr.move_to(0, 0) cr.line_to(1, 1) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/css_accordion.rb0000644000175000017500000000442512516434313021617 0ustar koukou#!/usr/bin/env ruby # # This sample code is a port of gtk3/demos/gtk-demo/css_accordion.c. The # CSS files used in this sample code are copied from gtk3/demos/gtk-demo. # They are licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 =begin = CSS Theming/CSS Accordion A simple accordion demo written using CSS transitions and multiple backgrounds =end require "common" module Demo class CssAccordion < BasicWindow def initialize super("CSS Accordion") set_default_size(600, 300) container = Gtk::Box.new(:horizontal, 0) container.set_halign(:center) container.set_valign(:center) add(container) child = Gtk::Button.new(:label => "This") container.add(child) child = Gtk::Button.new(:label => "Is") container.add(child) child = Gtk::Button.new(:label => "A") container.add(child) child = Gtk::Button.new(:label => "CSS") container.add(child) child = Gtk::Button.new(:label => "Accordion") container.add(child) child = Gtk::Button.new(:label => ":-)") container.add(child) provider = Gtk::CssProvider.new provider.load(:data => File.read("css_accordion.css")) apply_css(self, provider) end def apply_css(widget, provider) widget.style_context.add_provider(provider, GLib::MAXUINT) if widget.is_a?(Gtk::Container) widget.each_forall do |child| apply_css(child, provider) end end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/ruby-gnome2-logo.png0000644000175000017500000001604011701304107022257 0ustar koukouPNG  IHDRPPbKGD pHYs  ~tIME (1IDATxwXT׾{f 0)6@XcIbTSǣѓ)7on<&1ĘfII`b%XPБiLS PL<뙙WoW?Sԟ?Z/m\, 9|Y))vX]@dDFQ#Kr /w^ƺeIvI " ʃdm}ϛ)]T}lMIɓ6}c|qc&%9]p(՝;*/w'ys…'2U˲2y7fJٗbxa` ?eM4RWq??uҕ"G$2E}͙Z J.jirW0}+j5r8dd,a ]OGY5Ĩ x8%es320yz*UDIqqbv]+M@b0+k H~aV+\VkZ]c6s-3׭GxL  8%HQ4-̞q4fOhJJg'4RGeetJ00@]#f/:cȈ eᬨi8bYBX"tpߪg 0R&@*W[QU9κ:pZ-t<`_w[?q Pa xc"'OoؠP6}`GX[ V W]\ՠNwpp* zw82 fpN. g1NE,MLX?l(.z9<57e\T*۱#vhhɘQTpr`*>  bфL;a @N+&vPPj4":ŽOVcb}|!Dp W^I .!P6xh?,BBdуR4}/!TZAj`op]-XxGHRFrtRBe'N-ʸ^faxaX-D qJ,N\ #Gx**S53pWz}=)o[ !4{ALxq@ר$-|X54:,NRpOx4F:,?Y p #L ^w 4ժB!h;ajeRfЃ٠rtl}*rgܩL>jнuX8"mTƨu3|;@駰xv{ ?M>wB2 ]nj.i|-&v Z0Ng <|U#N JQD*F,Rbvp޶y<Գ iؗpԷ=|Ww4nh͎ Bxl.i{EpwP3ca }vCt`C{hY/ y<$:rҟx`ʦw,=.oOqnjd  \N ǫ|徢~\ŝ^V+*7hu#XpV")'Bk(W~v`C~:,U7L/w|hz"OHx-*9߳ᠴ1,_DK$`ihKJ9P vGDJ"C9Nxsfa (~/9@s>${rl~n1EfYە32-9;X4hW1'v0~ ج,>p7pp#¦N%SIQ?ӬVKcƏ;~b923|}3>s {n%Y]v͆ h`̥QBЄP HuyR]ULՔHtTbL >zƬQ  dNL &[Spp?ry.},۽Cdݫ6t>Ze]}LÂc'Μ@L\.s M\PFr:Q4{vvYك-R%?+yzyjk'O 6V ]yAאړr1~CIOeVoh(11!JT a@x`ih5LU˃Y.8xض<9k-Hw&XP37@~{!z?%oC*OzDa KȌ Ď!C #@3!B? Kgn^ h۝0 3xo5@bbǤ7oO Tg|cc]zQk g 1%K?>BRR@9i޵vBu mۆc\b|g֮XVgjԣ1"ޞ-Q^X,~ 4e;f5>ck4DŌQ==iWY3{\Ck5Ho ws^pT=\tjF~j_rGESX.,a{mj C˟̽~JDr 0p ZY z亓eq7q-36IiOe'N0|6l_淬?=\s(JV0 d RxM::m~ە+6r9ܞȠ9hV{YֆU?Lz)R{T uO,Ayt`@vv~_TCA}Y0fje2)}_?fYN$Bsl `}쎏o78.q}ѩ.r_gqufqFlѩ٭%Ill+x]h:(k]Zg'!`aR2W_őc_:֬uu[zLު՗r}:}FQ 0gJO 7uXv4|D"~ Z `ϩOQ,KH.}F'PڅrSr,D:xOU̞RB_X8vlZy=҃kZa5㠮A\8iGOBS*m 17 RTf򈯳z?|.nGѶz 0O^HD' 4ju!p8@XeHoӎN5'O|~U'ѽ'Չz {[6[zbJ <H^={z;xV+eepTV¥R, Ph ´4""CA]]N9n4mڡ}>xnFHr, 6F+iX,8n-lv6Z*ubu:P*s2TNŋ |yyޯmHdٱ>qJ?1ASZ<<<ヌɓ>/l2i4pj5|XI&A ྖe}RMCV#Ny|ƛ4GgXd W}%7N_~8|RMwO8p&}>3u5@5E^bHbn*JS\ BxB)muu<IeK8EiC[/) =pL6ǢFHD])5ï'Nnz=MgN:z?ekl)-Np/++Fa@I  4TV'ESC?ޏx#HV6@Jb  6^Q n30w||HĒN1휥ə>@^vOCz5uy|J;]GHkO8]\ۛ?ZHTG9iUk w&rsAli@-'5; [ ߽լaC07O z SfH8F_o}5m_Vu.^}a4JSXJl, '\@`eutp7%<ܳ_ `ܧսY zn\uZ,H&K5#\,j(*poLqVmge-{+Y'w M8txu,p[M%o" M'້pW ?(#a_-{w֔lyf)ZpI/ Fm/:n{:(PTn!mogYÈDe,1Nq4}󉊮0}:]I|{$^WI_Zjj&5ﮇzh6rk;f!o )_} &@qv\8gH.@H=u}Ktu:DZjUɥOn074s8]ER\p(( (>+ҳ@(fi=cP֦K `@7a=^{xyB v&_[)|aZQ2*X~ pe~F\ %D3 }81fi\GGf7窋 !a4DpMVnLfU@TT8(h2֯7ӢOoV'&0$LR }JTZr:.%RJ+aczIENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/tree_store.rb0000644000175000017500000002057712416346617021177 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: tree_store.rb,v 1.7 2005/02/06 18:25:13 kzys Exp $ =begin = Tree View/Tree Store The Gtk::TreeStore is used to store data in tree form, to be used later on by a Gtk::TreeView to display it. This demo builds a simple Gtk::TreeStore and displays it. If you're new to the GtkTreeView widgets and associates, look into the Gtk::ListStore example first. =end require 'common' module Demo class TreeStore < BasicWindow # TreeItem structure TreeItem = Struct.new('TreeItem', :label, :alex, :havoc, :tim, :owen, :dave, :world_holiday) # shared by the European hackers # columns ( HOLIDAY_NAME_COLUMN, ALEX_COLUMN, HAVOC_COLUMN, TIM_COLUMN, OWEN_COLUMN, DAVE_COLUMN, VISIBLE_COLUMN, WORLD_COLUMN, NUM_COLUMNS, ) = *(0..9).to_a # tree data TOPLEVEL = [ ['January', [ ["New Years Day", true, true, true, true, false, true], ["Presidential Inauguration", false, true, false, true, false, false], ["Martin Luther King Jr. day", false, true, false, true, false, false], ] ], ['February', [ ["Presidents' Day", false, true, false, true, false, false], ["Groundhog Day", false, false, false, false, false, false], ["Valentine's Day", false, false, false, false, true, true], ] ], ['March', [ ["National Tree Planting Day", false, false, false, false, false, false], [ "St Patrick's Day", false, false, false, false, false, true], ] ], ['April', [ [ "April Fools' Day", false, false, false, false, false, true ], [ "Army Day", false, false, false, false, false, false ], [ "Earth Day", false, false, false, false, false, true ], [ "Administrative Professionals' Day", false, false, false, false, false, false ], ]], ['May', [ [ "Nurses' Day", false, false, false, false, false, false ], [ "National Day of Prayer", false, false, false, false, false, false ], [ "Mothers' Day", false, false, false, false, false, true ], [ "Armed Forces Day", false, false, false, false, false, false ], [ "Memorial Day", true, true, true, true, false, true ], ] ], ['June', [ [ "June Fathers' Day", false, false, false, false, false, true ], [ "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false ], [ "Flag Day", false, true, false, true, false, false ], ] ], ['July', [ [ "Parents' Day", false, false, false, false, false, true ], [ "Independence Day", false, true, false, true, false, false ], ] ], ['August', [ [ "Air Force Day", false, false, false, false, false, false ], [ "Coast Guard Day", false, false, false, false, false, false ], [ "Friendship Day", false, false, false, false, false, false ], ] ], ['September', [ [ "Grandparents' Day", false, false, false, false, false, true ], [ "Citizenship Day or Constitution Day", false, false, false, false, false, false ], [ "Labor Day", true, true, true, true, false, true ], ] ], ['October', [ [ "National Children's Day", false, false, false, false, false, false ], [ "Bosses' Day", false, false, false, false, false, false ], [ "Sweetest Day", false, false, false, false, false, false ], [ "Mother-in-Law's Day", false, false, false, false, false, false ], [ "Navy Day", false, false, false, false, false, false ], [ "Columbus Day", false, true, false, true, false, false ], [ "Halloween", false, false, false, false, false, true ], ] ], ['November', [ [ "Marine Corps Day", false, false, false, false, false, false ], [ "Veterans' Day", true, true, true, true, false, true ], [ "Thanksgiving", false, true, false, true, false, false ], ] ], ['December', [ [ 'Pearl Harbor Remembrance Day', false, false, false, false, false, false ], [ 'Christmas', true, true, true, true, false, true ], [ 'Kwanzaa', false, false, false, false, false, false ], ] ], ].collect do |month_name, holidays| [ month_name, holidays.collect do |args| TreeItem.new(args) end, ] end def initialize # create window, etc super('Card planning sheet') vbox = Gtk::VBox.new(false, 8) vbox.border_width = 8 add(vbox) vbox.pack_start(Gtk::Label.new("Jonathan's Holiday Card Planning Sheet"), :expand => false, :fill => false, :padding => 0) sw = Gtk::ScrolledWindow.new(nil, nil) sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(:automatic, :automatic) vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0) # create model model = create_model # create tree view treeview = Gtk::TreeView.new(model) treeview.rules_hint = true treeview.selection.mode = Gtk::SELECTION_MULTIPLE add_columns(treeview) sw.add(treeview) # expand all rows after the treeview widget has been realized treeview.signal_connect('realize') do treeview.expand_all end set_default_size(650, 400) end def create_model # create tree store model = Gtk::TreeStore.new(String, TrueClass, TrueClass, TrueClass, TrueClass, TrueClass, TrueClass, TrueClass) # add data to the tree store TOPLEVEL.each do |month_name, holidays| iter = model.append(nil) iter[HOLIDAY_NAME_COLUMN] = month_name (ALEX_COLUMN..DAVE_COLUMN).each do |index| iter[index] = false end # add children holidays.each do |holiday| child_iter = model.append(iter) child_iter[HOLIDAY_NAME_COLUMN] = holiday.label[0] %w(alex havoc tim owen dave).each_with_index do |person, i| child_iter[ALEX_COLUMN + i] = holiday[person] end child_iter[VISIBLE_COLUMN] = true child_iter[WORLD_COLUMN] = holiday.world_holiday end end return model end def add_columns(treeview) model = treeview.model # column for holiday names renderer = Gtk::CellRendererText.new renderer.xalign = 0.0 col_offset = treeview.insert_column(-1, 'Holiday', renderer, 'text' => HOLIDAY_NAME_COLUMN) column = treeview.get_column(col_offset - 1) column.clickable = true [ ['Alex', true ], ['Havoc', false], ['Tim', true ], ['Owen', false], ['Dave', false], ].each_with_index do |args, i| person, european = *args renderer = Gtk::CellRendererToggle.new renderer.xalign = 0.0 eval(%Q[def renderer.column; #{ALEX_COLUMN + i}; end]) renderer.signal_connect('toggled') do |cell, path| item_toggled(cell, path, model) end attributes = { 'active' => (ALEX_COLUMN + i), 'visible' => VISIBLE_COLUMN, } if european attributes['activatable'] = WORLD_COLUMN end col_offset = treeview.insert_column(-1, person, renderer, attributes) column = treeview.get_column(col_offset - 1) column.sizing = Gtk::TreeViewColumn::FIXED column.fixed_width = 50 column.clickable = true end end def item_toggled (cell, path_str, model) path = Gtk::TreePath.new(path_str) column = cell.column # get toggled iter iter = model.get_iter(path) toggle_item = iter[column] # do something with the value toggle_item ^= 1 # set new value iter[column] = toggle_item end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/dialog.rb0000644000175000017500000001055312516434313020244 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: dialog.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Dialog and Message Boxes Dialog widgets are used to pop up a transient window for user feedback. =end require 'common' module Demo class Dialog < Demo::BasicWindow def initialize @count = 1 super('Dialogs') set_border_width(8) frame = Gtk::Frame.new('Dialogs') add(frame) vbox = Gtk::VBox.new(false, 8) vbox.set_border_width(8) frame.add(vbox) # Standard message dialog hbox = Gtk::Box.new(:horizontal, 0) vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) button = Gtk::Button.new('_Message Dialog', true) button.signal_connect('clicked') do message_dialog_clicked end hbox.pack_start(button, :expand => false, :fill => false, :padding => 0) vbox.pack_start(Gtk::HSeparator.new, :expand => false, :fill => false, :padding => 0) # Interactive dialog hbox = Gtk::Box.new(:horizontal, 8) vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) vbox2 = Gtk::VBox.new(false, 0) button = Gtk::Button.new('_Interactive Dialog') button.signal_connect('clicked') do interactive_dialog_clicked end hbox.pack_start(vbox2, :expand => false, :fill => false, :padding => 0) vbox2.pack_start(button, :expand => false, :fill => false, :padding => 0) table = Gtk::Table.new(2, 2, false) table.set_row_spacings(4) table.set_column_spacings(4) hbox.pack_start(table, :expand => false, :fill => false, :padding => 0) label = Gtk::Label.new('_Entry 1', true) table.attach_defaults(label, 0, 1, 0, 1) @entry1 = Gtk::Entry.new table.attach_defaults(@entry1, 1, 2, 0, 1) label.set_mnemonic_widget(@entry1) label = Gtk::Label.new('E_ntry 2', true) table.attach_defaults(label, 0, 1, 1, 2) @entry2 = Gtk::Entry.new table.attach_defaults(@entry2, 1, 2, 1, 2) label.set_mnemonic_widget(@entry2) end def message_dialog_clicked dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::MODAL | Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_OK, < false, :fill => false, :padding => 0) stock = Gtk::Image.new(Gtk::Stock::DIALOG_QUESTION, Gtk::IconSize::DIALOG) hbox.pack_start(stock, :expand => false, :fill => false, :padding => 0) table = Gtk::Table.new(2, 2, false) table.set_row_spacings(4) table.set_column_spacings(4) hbox.pack_start(table, :expand => true, :fill => true, :padding => 0) label = Gtk::Label.new('_Entry 1', true) table.attach_defaults(label, 0, 1, 0, 1) local_entry1 = Gtk::Entry.new local_entry1.text = @entry1.text table.attach_defaults(local_entry1, 1, 2, 0, 1) label.set_mnemonic_widget(local_entry1) label = Gtk::Label.new('E_ntry 2', true) table.attach_defaults(label, 0, 1, 1, 2) local_entry2 = Gtk::Entry.new local_entry2.text = @entry2.text table.attach_defaults(local_entry2, 1, 2, 1, 2) label.set_mnemonic_widget(local_entry2) hbox.show_all response = dialog.run if response == Gtk::Dialog::RESPONSE_OK @entry1.text = local_entry1.text @entry2.text = local_entry2.text end dialog.destroy end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/common.rb0000644000175000017500000000360212516434313020272 0ustar koukou=begin common.rb - Common class for gtk-demo. Copyright (c) 2003-2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: common.rb,v 1.9 2005/10/15 03:41:36 mutoh Exp $ =end require 'gtk3' module Demo def self.find_file(basename) %w(. /usr/share/gtk-3.0/demo /usr/local/share/gtk-3.0/demo/).each do |dirname| path = File.join(dirname, basename) if File.exist?(path) return path end end raise "#{basename}: No such file or directory" end class BasicWindow < Gtk::Window def initialize(title = nil) super(:toplevel) if title set_title("#{title} in Ruby/GTK") end signal_connect("key_press_event") do |widget, event| if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q destroy true else false end end signal_connect("delete_event") do |widget, event| quit end end def quit destroy true end end class CairoWindow < BasicWindow def initialize(title=nil) super unless Gdk.cairo_available? add_cairo_require_label return end drawing_area = Gtk::DrawingArea.new add(drawing_area) drawing_area.signal_connect("draw") do |widget, event| cr = widget.window.create_cairo_context cr.scale(widget.window.width, widget.window.height) cr.set_line_width(0.04) cr.save do cr.set_source_color(Gdk::Color.new(65535, 65535, 65535)) cr.gdk_rectangle(Gdk::Rectangle.new(0, 0, 1, 1)) cr.fill end draw(cr) end end def add_cairo_require_label message = "This sample requires GTK+ 2.8.0 or later and cairo support" add(Gtk::Label.new(message)) end def draw(cr) raise "not implemented" end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/README0000644000175000017500000000011011701304107017314 0ustar koukougtk-demo for Ruby/GTK To run, do ruby main.rb in this directory. ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/editable_cells.rb0000644000175000017500000001117712416346617021753 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: editable_cells.rb,v 1.7 2005/02/06 18:25:13 kzys Exp $ =begin = Tree View/Editable Cells This demo demonstrates the use of editable cells in a Gtk::TreeView. If you're new to the Gtk::TreeView widgets and associates, look into the Gtk::ListStore example first. =end require 'common' module Demo class EditableCells < BasicWindow Item = Struct.new('Item', :number, :product, :editable) COLUMN_NUMBER, COLUMN_PRODUCT, COLUMN_EDITABLE, NUM_COLUMNS = *(0..4).to_a def initialize super('Shopping list') self.border_width = 5 vbox = Gtk::VBox.new(false, 5) add(vbox) vbox.pack_start(Gtk::Label.new('Shopping list (you can edit the cells!)'), :expand => false, :fill => false, :padding => 0) sw = Gtk::ScrolledWindow.new sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(:automatic, :automatic) vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0) # create model model = create_model # create tree view treeview = Gtk::TreeView.new(model) treeview.rules_hint = true treeview.selection.mode = Gtk::SELECTION_SINGLE add_columns(treeview) sw.add(treeview) # some buttons hbox = Gtk::Box.new(:horizontal, 4) hbox.homogeneous = true vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) button = Gtk::Button.new('Add item') button.signal_connect('clicked') do add_item(model) end hbox.pack_start(button, :expand => true, :fill => true, :padding => 0) button = Gtk::Button.new('Remove item') button.signal_connect('clicked') do remove_item(treeview) end hbox.pack_start(button, :expand => true, :fill => true, :padding => 0) set_default_size(320, 200) end def create_model # create array @articles = [] add_items # create list store model = Gtk::ListStore.new(Integer, String, TrueClass) # add items @articles.each do |article| iter = model.append article.each_with_index do |value, index| iter.set_value(index, value) end end return model end def add_items item = Item.new(3, 'bottles of coke', true) @articles.push(item) item = Item.new(5, 'packages of noodles', true) @articles.push(item) item = Item.new(2, 'packages of chocolate chip cookies', true) @articles.push(item) item = Item.new(1, 'can vanilla ice cream', true) @articles.push(item) item = Item.new(6, 'eggs', true) @articles.push(item) end def add_columns(treeview) model = treeview.model # number column renderer = Gtk::CellRendererText.new renderer.signal_connect('edited') do |*args| cell_edited(*args.push(model)) end treeview.insert_column(-1, 'Number', renderer, { :text => COLUMN_NUMBER, :editable => COLUMN_EDITABLE, }) def renderer.column COLUMN_NUMBER end # product column renderer = Gtk::CellRendererText.new renderer.signal_connect('edited') do |*args| cell_edited(*args.push(model)) end def renderer.column COLUMN_PRODUCT end treeview.insert_column(-1, 'Product', renderer, { :text => COLUMN_PRODUCT, :editable => COLUMN_EDITABLE, }) end def cell_edited(cell, path_string, new_text, model) path = Gtk::TreePath.new(path_string) column = cell.column iter = model.get_iter(path) case column when COLUMN_NUMBER i = iter.path.indices[0] @articles[i].number = new_text.to_i iter.set_value(column, @articles[i].number) when COLUMN_PRODUCT i = iter.path.indices[0] @articles[i].product = new_text iter.set_value(column, @articles[i].product) end end def add_item(model) foo = Item.new(0, 'Description here', true) @articles.concat([foo]) iter = model.append foo.each_with_index do |value, index| iter.set_value(index, value) end end def remove_item(treeview) model = treeview.model selection = treeview.selection if iter = selection.selected @articles.delete_at(iter.path.indices[0]) model.remove(iter) end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/entry_completion.rb0000644000175000017500000000316212516434313022375 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # $Id: entry_completion.rb,v 1.3 2005/02/25 17:09:24 kzys Exp $ =begin = Entry Completion (EntryCompletion) GtkEntryCompletion provides a mechanism for adding support for completion in GtkEntry. =end require 'common' module Demo class EntryCompletion < Gtk::Dialog def initialize super('GtkEntryCompletion', nil, # parent 0, [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE]) self.resizable = false signal_connect('response') do self.destroy end vbox = Gtk::VBox.new(false, 5) self.vbox.pack_start(vbox, :expand => true, :fill => true) vbox.border_width = 5 label = Gtk::Label.new label.markup = 'Completion demo, try writing total or gnome for example' vbox.pack_start(label, :expand => false, :fill => false) # Create our entry entry = Gtk::Entry.new vbox.pack_start(entry, :expand => false, :fill => false) # Create the completion object completion = Gtk::EntryCompletion.new # Assign the completion to the entry entry.completion = completion # Create a tree model and use it as the completion model completion.model = create_completion_model # Use model column 0 as the text column completion.text_column = 0 end def create_completion_model store = Gtk::ListStore.new(String) %w(GNOME total totally).each do |word| iter = store.append iter[0] = word end store end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-clip-image.rb0000644000175000017500000000223512416346617022115 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-clip-image.rb,v 1.2 2005/10/16 12:07:32 mutoh Exp $ =begin = cairo/Clip Image This demo shows how to use GDK and cairo to use clip for image. From http://cairographics.org/samples/clip_image.html. =end require 'common' module Demo class CairoClipImage < CairoWindow def initialize super('cairo clip image') end def draw(cr) cr.save do cr.arc(0.5, 0.5, 0.4, 0, 2 * Math::PI) cr.clip cr.new_path loader = Gdk::PixbufLoader.new File.open("background.jpg", "rb") do |f| loader.last_write(f.read) end pixbuf = loader.pixbuf cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height) cr.set_source_pixbuf(pixbuf, 0, 0) cr.paint end cr.save do cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI) cr.clip cr.new_path image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") cr.scale(1.0 / image.width, 1.0 / image.height) cr.set_source(image, 0, 0) cr.paint end end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gtk-logo-rgb.gif0000644000175000017500000001443311701304107021433 0ustar koukouGIF89ak󪫹ԏƹ/L\lux 4# "7x:Z5d Y$]'+4 ."dܻҼ-E76Z7nNdlG7]9$7L 5(4=`-LE*48  ; &M=r2fpz$L-M>v!C %e)<9 H FE,)7 IKj)%6#&89;4P 4E&@4ޕpA YhPJ,A~(t,0C&Η"Cwa9 ۔ @5qGZpX@QH"\6eSdX:bR\T 2AdvP0CM p% pRBYDMwlBL h6l5zP10abK%qE9JY@+,6儳G[j72YЀtVa-:#,4!*}51a "mBNh[V0vC0A TIZp&: *L(",h:1B[?8[;B: L֭;n|pΗ$#F*`EuY >CF9BCJ7 C#(0BBG@fCd6tuCsyNDWA[zv'%Ԡ7\]凇sSQTa[`hR".Ye-d, BӡJAqAv`0@i,UA<@\b'^ʐcDƝQPp6" zk|U)L\A #(y B !.PB>0\&n`Cbv`->`k0A a@ @H#!~"Y> RWۂ&Q>TzGJWX(c%-%JP xjb[R? E|@$@:\c @AVpOXĀn~I{i"NЁ x"P#` Xo6(nK IVG7@2ˆAREp I! .X `+c,AC?qQrO~% otDAyiBڇ ^N @$$ి",C.tR$$` d4(t&v  Եk]fv^Ć>xS#U <1`"7{N#ȠS5쌷\pA {ݐH$Ћ$KGZPP֠I$Ӈqy8hwum WЇ~C PK VZo!A @HWl{!q` [s r|Eݵ F ыK@o2}ѵrpq #<Ƹ t@~EAM)^o`un "ems H` p y|pqЀ~0[$x_H~47U` 6r `6Pr_#Wt < 3@27UtPcA}x !0U6``` gW `dO@2@}YRPct&j 16`|px `O ) l9j2$ mIZa0o @|~ ؚG~ p P @A $0o밓{ UplJ/ n  X.Lm~ߐQr`Y rĠ UQq.҃)8iJ@RtًAG `6P%; ]ʀR b lRܠ j0mov~飊@j`H` %FAȐ _hbUwФ叛 {Xm kjtrPtʦ ڐAY`Đ lb)Z!7pqeq" Y|4Un``p`pj6 f` UC`r '/yH[W5 O wh*ʰ<$oqQ"}PUTJ(FS% `ZdZ%0.Apg2 OG`. ZlmخK6e!7 °`GW֤N:Щp.7^Xv{ZRnpl&fAp Y ͺ(d",+ 嚮ٕf_! c+ɛؓ`ЭI [m3$+~@sz]WBP!K yڀ&XVJ ^PkmW[Zi ZbG+4`>2\l!GP (+`Ep[hXWR7+["yfo 2 !g] Q D`|G^f7} 1˛ٖu> !0h}j`km˚Z|tp%o&ЅUj au[m~ / , (V$P{`w% Q 7`` kqC6pgxv7ً[f0ʶ f2%`)7b`Wt A$0f⢐c YY& `H7p !`&PܲwɎP #\)`Ƥ  v WTL3[kUP lbzˋ؈T7 Mo! ΜMǰ DMrI 7נZ^h% ;\X;L3٬ -됡^m k6)!F@ GE4t', accel_group) add_accel_group(accel_group) set_border_width(0) ifactory_cb = proc do |data, widget| puts "ItemFactory: activated \"#{Gtk::ItemFactory.path_from_widget(widget)}\"" end menu_items = [ ['/_File'], ['/File/tearoff1', '', nil, nil, ifactory_cb], ['/File/_New', '', 'N', nil, ifactory_cb], ['/File/_Open', '', 'O', nil, ifactory_cb], ['/File/_Save', '', 'S', nil, ifactory_cb], ['/File/Save _As...', '', nil, nil, ifactory_cb], ['/File/sep1', ''], ['/File/_Quit', '', 'Q', nil, ifactory_cb], ['/_Preferences'], ['/_Preferences/_Color'], [ '/_Preferences/Color/_Red', '', nil, nil, ifactory_cb], ['/_Preferences/Color/_Green', '/Preferences/Color/Red', nil, nil, ifactory_cb], ['/_Preferences/Color/_Blue', '/Preferences/Color/Red', nil, nil, ifactory_cb], ['/_Preferences/_Shape'], ['/_Preferences/Shape/_Square', '', nil, nil, ifactory_cb], [ '/_Preferences/Shape/_Rectangle', '/Preferences/Shape/Square', nil, nil, ifactory_cb], [ '/_Preferences/Shape/_Oval', '/Preferences/Shape/Rectangle', nil, nil, ifactory_cb], [ '/_Help', ''], [ '/Help/_About', '', nil, nil, ifactory_cb], ] item_factory.create_items(menu_items) item_factory.get_item('/Preferences/Shape/Oval').set_active(true) box1 = Gtk::VBox.new(false, 0) add(box1) box1.pack_start(item_factory.get_widget('

'), :expand => false, :fill => false, :padding => 0) label = Gtk::Label.new("Type\n\nto start") label.set_size_request(200, 200) label.set_alignment(0.5, 0.5) box1.pack_start(label, :expand => true, :fill => true, :padding => 0) separator = Gtk::HSeparator.new box1.pack_start(separator) box2 = Gtk::VBox.new(false, 10) box2.set_border_width(10) box1.pack_start(box2, :expand => false, :fill => true, :padding => 0) button = Gtk::Button.new('close') # TODO: Need signal_connect_swapped? button.signal_connect('clicked') do quit end box2.pack_start(button, :expand => true, :fill => true, :padding => 0) button.set_flags(Gtk::Widget::CAN_DEFAULT) button.grab_default end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnome-gsame.png0000644000175000017500000001024711701304107021355 0ustar koukouPNG  IHDR00WgAMA1_^IDATxYdWy[{U3ӳ3a0+f1F !HI7x,g~Swoߟk03֫6Y,bMWr?[?;j1񪴜S|zoY|쳷S;s%>sj\3Җ\+A {?+%y2 P/=S .>٘cƘ2j;_ 'VF;k wN;njYo9-dG-ӿw?ӟ=B()9 4&0L.~$%KL(K~| _ѹ|h#B4xۍKx`Fi猆F?Ikm!qcQ%7 BY`x)uJRc|'g8w:{S@6s:.&R0 =y;zRJß[޲t_}&[i؋.YoKU!Ejg;*sf[)y@E ^G٠L^B6v@$9J@YJ@cp@hs;}jP `8V\Ib+~fժR9֘0r#?chEb5USб2wdЙBDEF(ՠ-4ƶu ra"nR͜>Y1U @2q{78asC^,yr\ģ'\kW!WbJCvFdIJjDS2B #l\S8IMJV@]e߳83lu2mu6ZYÿvW녙th6jLLX{wNgy=;wd#lm'Y,}T[ 6NsD:bj^tG)ǟ{Mo󙝇{.[Fxt+(M AElZET'12nF/"QlҜ02J+%Am D)C~l"oKm! dn[yǹOyԣ%!)RjV)5jK)kRJ8L]" i昭nil M3"݄"OZVc6F.[#7UPxSDq[kSkmbst!D@<ߪv:;f4ZG(9Α) /Í#$'eZbkAx>.v^ @^޶ֶMkmZ+1Ba1BITn+$:vgjT3p$(c'h3Mr&&4 HPiz6%t N;jZkT!Xp55afvVhCE4Mb"Ռ7N:!hk3\ Jr$PF;* 6|k1L5!D0?9uY>@1nRIiĒ:6/ʉ Ɉ2ֶhQ8r\g*h^1b!D`E`3U @=v޴V0M "I $ 2.f[ `uu{W[Bkg^ ,hkB$Z;֎$W|?Ԭ7pGjz}أO<,mFWu̥O]{l#3-R=И^ZI+~`6t kur>dZ֒8Ɋ3T̬\3*_;w.6?:p`f9zDgnĮKk)ԆfBXJ Zztx{n޿w5g1IT+dy&,#I0 |$[7 n[H^ѷΏN8%>Zq^sw~) !zvb(pd:H(4IyFRE IZQ=.TZpZ%^+x:򖛿!If)I>3\Gh)cTZ)cGQz@զ2rGKkkHuNIApn˅^R7a@ݡ.QuԽ];vuZ!T}jQNRT+UfXC 0&' B?LKRnsu^\yJ yv~1qFCbðpq1 !B@K)m!)W.|;}?QS 4,JV~ okwN33^zb8)q]Yx2a%b !TVTRqr)egi9#o$4Ea,Q<ׄQ\|+eƽ®z@$GIL/c&J~TN\^VmR1h!e/4OQ ]$q]_x^Dh1'{&o f@&`%4j.)!DF 4n)4ιJڻ0n^@eB'qa_|9?R5-oL Jkgѣ␰4`aaA}l6fxӾVn_LLy^8 +)," }MR]gU/mCCҀ/ \KylA[_/M-uǽv%Jy#҄Dv @tpPKQq?66*y |tKRRUVen~bՊ5.emmqAI}y`=Nm+_ϾNiJg3ޤW e)q+|%Ķ;^s1aIENDB`ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/css_accordion.css0000644000175000017500000000244312257552170022006 0ustar koukou@import url("reset.css"); * { transition-property: color, background-color, border-color, background-image, padding, border-width; transition-duration: 1s; font: Cantarell 20px; } GtkWindow { background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0, linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px, linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px, linear-gradient(333deg, #222, #222 5px, transparent 5px) 10px 10px, linear-gradient(90deg, #1b1b1b, #1b1b1b 10px, transparent 10px), linear-gradient(#1d1d1d, #1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424); background-color: #131313; background-size: 20px 20px; } .button { color: black; background-color: #bbb; border-style: solid; border-width: 2px 0 2px 2px; border-color: #333; padding: 12px 4px; } .button:first-child { border-radius: 5px 0 0 5px; } .button:last-child { border-radius: 0 5px 5px 0; border-width: 2px; } .button:hover { padding: 12px 48px; background-color: #4870bc; } .button *:hover { color: white; } .button:hover:active, .button:active { background-color: #993401; } ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/theming.ui0000644000175000017500000003361612416346617020467 0ustar koukou 6 vertical True False True False False True False False Normal True True edit-find False True False True False False Active True True edit-find True False True False True False False Insensitive True True edit-find False True False True False Raised True True edit-find-symbolic False True False True False Raised Active True True edit-find-symbolic True False True False True False False Insensitive Active True edit-find True True False True False True False True True Search... edit-find-symbolic False False True False True True False True False horizontal center center Hi, I am a button False True True True False False True 0 And I'm another button False True True True False False True 1 This is a button party! False True True True False False True 2 True False True 1 False True False False Normal True list-add-symbolic False True False True False False Normal True list-add-symbolic False True False True False False Active True list-remove-symbolic True False True False True False False Active True list-remove-symbolic True False True False True False False False Insensitive True edit-find-symbolic False True False True False False False Insensitive Active True go-up-symbolic True False True ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/pixbufs.rb0000644000175000017500000001125312307003726020461 0ustar koukou# Copyright (c) 2003-2014 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: pixbufs.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Pixbufs A Gdk::Pixbuf represents an image, normally in RGB or RGBA format. Pixbufs are normally used to load files from disk and perform image scaling. This demo is not all that educational, but looks cool. It was written by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows off how to use Gtk::DrawingArea to do a simple animation. Look at the Image demo for additional pixbuf usage examples. =end require "common" module Demo class Pixbufs < BasicWindow FRAME_DELAY = 50 BACKGROUND_NAME = "background.jpg" IMAGE_NAMES = [ "apple-red.png", "gnome-applets.png", "gnome-calendar.png", "gnome-foot.png", "gnome-gmush.png", "gnome-gimp.png", "gnome-gsame.png", "gnu-keys.png", "ruby-gnome2-logo.png", ] CYCLE_LEN = 60 def initialize super("Pixbufs") set_resizable(false) @background = nil @frame = nil @frame_num = 0 @images = [] begin load_pixbufs set_size_request(@background.width, @background.height) @frame = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, false, 8, @background.width, @background.height) @da = Gtk::DrawingArea.new @da.signal_connect("draw") do |w, e| draw_cb(w, e) end add(@da) timeout_id = GLib::Timeout.add(FRAME_DELAY) do timeout end signal_connect("destroy") do GLib::Source.remove(timeout_id) end rescue message = "Failed to load an image: #{$!.message}" dialog = Gtk::MessageDialog.new(:parent => self, :flags => :destroy_with_parent, :type => :error, :buttons_type => :close, :message => message) dialog.signal_connect("response") do dialog.destroy end dialog.show end end def load_pixbufs # Loads the images for the demo if @background return # already loaded earlier end # demo_find_file() looks in the the current directory first, # so you can run gtk-demo without installing GTK, then looks # in the location where the file is installed. # filename = Demo.find_file(BACKGROUND_NAME) @background = Gdk::Pixbuf.new(filename) IMAGE_NAMES.each_with_index do |basename, i| filename = Demo.find_file(basename) @images[i] = Gdk::Pixbuf.new(filename) end end def draw_cb(widget, cairo_context) cairo_context.set_source_pixbuf(@frame) cairo_context.paint true end # Timeout handler to regenerate the frame def timeout @background.copy_area(0, 0, @background.width, @background.height, @frame, 0, 0) f = Float(@frame_num % CYCLE_LEN) / CYCLE_LEN; xmid = @background.width / 2.0 ymid = @background.height / 2.0 radius = [xmid, ymid].min / 2.0 @images.each_with_index do |image, i| ang = 2.0 * Math::PI * Float(i) / IMAGE_NAMES.length - f * 2.0 * Math::PI r = radius + (radius / 3.0) * Math.sin(f * 2.0 * Math::PI) xpos = (xmid + r * Math.cos(ang) - image.width / 2.0 + 0.5).floor ypos = (ymid + r * Math.sin(ang) - image.height / 2.0 + 0.5).floor k = if (i & 1) == 1 Math.sin(f * 2.0 * Math::PI) else Math.cos(f * 2.0 * Math::PI) end k = [0.25, 2.0 * k * k].max r1 = Gdk::Rectangle.new(xpos, ypos, image.width * k, image.height * k) r2 = Gdk::Rectangle.new(0, 0, @background.width, @background.height) dest = r1.intersect(r2) if dest @frame.composite!(image, dest.x, dest.y, dest.width, dest.height, xpos, ypos, k, k, Gdk::Pixbuf::INTERP_NEAREST, if (i & 1) == 1 [ 127, (255 * Math.sin(f * 2.0 * Math::PI)).abs, ].max else [ 127, (255 * Math.cos(f * 2.0 * Math::PI)).abs, ].max end) end end @da.queue_draw @frame_num += 1 true end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-line-cap.rb0000644000175000017500000000220112416346617021567 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-line-cap.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Line Cap This demo shows how to use GDK and cairo to set line cap. From http://cairographics.org/samples/set_line_cap.html. =end require 'common' module Demo class CairoLineCap < CairoWindow def initialize super('cairo line cap') end def draw(cr) cr.set_line_width(0.12) cr.set_line_cap(Cairo::LINE_CAP_BUTT) # default cr.move_to(0.25, 0.2) cr.line_to(0.25, 0.8) cr.stroke cr.set_line_cap(Cairo::LINE_CAP_ROUND) cr.move_to(0.5, 0.2) cr.line_to(0.5, 0.8) cr.stroke cr.set_line_cap(Cairo::LINE_CAP_SQUARE) cr.move_to(0.75, 0.2) cr.line_to(0.75, 0.8) cr.stroke # draw helping lines cr.set_source_rgba(1, 0.2, 0.2) cr.set_line_width(0.01) cr.move_to(0.25, 0.2) cr.line_to(0.25, 0.8) cr.move_to(0.5, 0.2) cr.line_to(0.5, 0.8) cr.move_to(0.75, 0.2) cr.line_to(0.75, 0.8) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/hypertext.rb0000644000175000017500000001501212516434313021034 0ustar koukou# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: hypertext.rb,v 1.2 2005/12/01 09:27:01 ktou Exp $ =begin = Text Widget/Hypertext Usually, tags modify the appearance of text in the view, e.g. making it bold or colored or underlined. But tags are not restricted to appearance. They can also affect the behavior of mouse and key presses, as this demo shows. =end require 'common' module Demo class Hypertext < BasicWindow def initialize super('Hypertext') @hand_cursor = Gdk::Cursor.new(Gdk::Cursor::HAND2) @regular_cursor = Gdk::Cursor.new(Gdk::Cursor::XTERM) @hovering = false set_default_size(450, 450) self.border_width = 0 view = Gtk::TextView.new view.wrap_mode = :word view.signal_connect('key-press-event') do |*args| key_press_event(*args) end view.signal_connect('event-after') do |*args| event_after(*args) end view.signal_connect('motion-notify-event') do |*args| motion_notify_event(*args) end view.signal_connect('visibility-notify-event') do |*args| visibility_notify_event(*args) end buffer = view.buffer sw = Gtk::ScrolledWindow.new sw.set_policy(:automatic, :automatic) add(sw) sw.add(view) show_page(buffer, 1) end # Inserts a piece of text into the buffer, giving it the usual # appearance of a hyperlink in a web browser: blue and underlined. # Additionally, attaches some data on the tag, to make it recognizable # as a link. def insert_link(buffer, iter, text, page) tag = buffer.create_tag(nil, { 'foreground' => 'blue', 'underline' => Pango::AttrUnderline::SINGLE, }) tag.page = page buffer.insert(iter, text, tag) print("Insert #{tag}:#{page}\n") end # Fills the buffer with text and interspersed links. In any real # hypertext app, this method would parse a file to identify the links. def show_page(buffer, page) puts buffer.text = '' iter = buffer.get_iter_at(:offset => 0) case page when 1 buffer.insert(iter, 'Some text ot show that simple ') insert_link(buffer, iter, 'hypertext', 3) buffer.insert(iter, ' can easily be realized with ') insert_link(buffer, iter, 'tags', 2) buffer.insert(iter, '.') when 2 buffer.insert(iter, %Q[A tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text insid the tag bold. However, the tag concept is more general than that; tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things.]) buffer.insert(iter, "\n") insert_link(buffer, iter, 'Go back', 1) when 3 tag = buffer.create_tag(nil, { 'weight' => Pango::FontDescription::WEIGHT_BOLD }) buffer.insert(iter, "hypertext:\n", tag); buffer.insert(iter, %Q[machine-readable text that is not sequential but is organized so that related items of information are connected.\n]) insert_link(buffer, iter, 'Go back', 1) end end # Looks at all tags covering the position of iter in the text view, # and if one of them is a link, follow it by showing the page identified # by the data attached to it. def follow_if_link(text_view, iter) tags = iter.tags tags.each do |tag| print("Follow #{tag}:#{tag.page}\n") if tag.page show_page(text_view.buffer, tag.page) break end end end # Links can be activated by pressing Enter. def key_press_event(text_view, event) case event.keyval when Gdk::Keyval::GDK_Return, Gdk::Keyval::GDK_KP_Enter buffer = text_view.buffer iter = buffer.get_iter_at_mark(buffer.get_mark("insert")) follow_if_link(text_view, iter) end false end # Links can also be activated by clicking. def event_after(text_view, event) unless event.kind_of?(Gdk::EventButton) and event.button == 1 return false end buffer = text_view.buffer # we shouldn't follow a link if the user has selected something range = buffer.selection_bounds if range and range[0].offset != range[1].offset return false end x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET, event.x, event.y) iter = text_view.get_iter_at_location(x, y) follow_if_link(text_view, iter) end # Looks at all tags covering the position (x, y) in the text view, # and if one of them is a link, change the cursor to the "hands" cursor # typically used by web browsers. def set_cursor_if_appropriate(text_view, x, y) buffer = text_view.buffer iter = text_view.get_iter_at_location(x, y) hovering = false tags = iter.tags tags.each do |t| if t.page hovering = true break end end if hovering != @hovering @hovering = hovering window = text_view.get_window(Gtk::TextView::WINDOW_TEXT) window.cursor = if @hovering @hand_cursor else @regular_cursor end end end # Update the cursor image if the pointer moved. def motion_notify_event(text_view, event) x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET, event.x, event.y) set_cursor_if_appropriate(text_view, x, y) text_view.window.pointer false end # Also update the cursor image if the window becomes visible # (e.g. when a window covering it got iconified). def visibility_notify_event (text_view, event) window, wx, wy = text_view.window.pointer bx, by = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET, wx, wy) set_cursor_if_appropriate(text_view, bx, by) false end end end module Gtk class TextTag attr_accessor :page end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-gradient.rb0000644000175000017500000000163412416346617021705 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-gradient.rb,v 1.2 2005/10/12 15:23:49 ktou Exp $ =begin = cairo/Gradient This demo shows how to use GDK and cairo to gradient. From http://cairographics.org/samples/gradient.html. =end require 'common' module Demo class CairoGradient < CairoWindow def initialize super('cairo gradient') end def draw(cr) pat = Cairo::LinearPattern.new(0.0, 0.0, 0.0, 1.0) pat.add_color_stop_rgb(1, 0, 0, 0) pat.add_color_stop_rgb(0, 1, 0, 0) cr.rectangle(0, 0, 1, 1) cr.set_source(pat) cr.fill pat = Cairo::RadialPattern.new(0.45, 0.4, 0.1, 0.4, 0.4, 0.5) pat.add_color_stop_rgba(0, 1, 1, 1, 0.8) pat.add_color_stop_rgba(1, 0, 0, 0) cr.set_source(pat) cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI) cr.fill end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/reset.css0000644000175000017500000000370712257552170020323 0ustar koukou/* @import this colorsheet to get the default values for every property. * This is useful when writing special CSS tests that should not be * inluenced by themes - not even the default ones. * Keep in mind that the output will be very ugly and not look like * anything GTK. * Also, when adding new style properties, please add them here. */ * { color: inherit; font-size: inherit; background-color: initial; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; text-shadow: inherit; icon-shadow: inherit; box-shadow: initial; margin-top: initial; margin-left: initial; margin-bottom: initial; margin-right: initial; padding-top: initial; padding-left: initial; padding-bottom: initial; padding-right: initial; border-top-style: initial; border-top-width: initial; border-left-style: initial; border-left-width: initial; border-bottom-style: initial; border-bottom-width: initial; border-right-style: initial; border-right-width: initial; border-top-left-radius: initial; border-top-right-radius: initial; border-bottom-right-radius: initial; border-bottom-left-radius: initial; outline-style: initial; outline-width: initial; outline-offset: initial; background-clip: initial; background-origin: initial; background-size: initial; background-position: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; outline-color: initial; background-repeat: initial; background-image: initial; border-image-source: initial; border-image-repeat: initial; border-image-slice: initial; border-image-width: initial; transition-property: initial; transition-duration: initial; transition-timing-function: initial; transition-delay: initial; engine: initial; gtk-key-bindings: initial; -GtkWidget-focus-line-width: 0; -GtkWidget-focus-padding: 0; -GtkNotebook-initial-gap: 0; } ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/cairo-text-extents.rb0000644000175000017500000000211512416346617022557 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-text-extents.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Text Extents This demo shows how to use GDK and cairo to show text extents. From http://cairographics.org/samples/text.html. =end require 'common' module Demo class CairoTextExtents < CairoWindow TEXT = "Ruby" def initialize super('cairo text') end def draw(cr) cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL) cr.set_font_size(0.3) extents = cr.text_extents(TEXT) x = 0.1 y = 0.6 cr.move_to(x, y) cr.show_text(TEXT) # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(x, y, 0.05, 0, 2 * Math::PI) cr.fill cr.move_to(x, y) cr.rel_line_to(0, -extents.height) cr.rel_line_to(extents.width, 0) cr.rel_line_to(extents.x_bearing, -extents.y_bearing) cr.stroke end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/iconview.rb0000644000175000017500000000675612137115065020641 0ustar koukou# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: iconview.rb,v 1.7 2007/08/05 15:41:31 mutoh Exp $ =begin = Icon View (IconView) The Gtk::IconView widget is used to display and manipulate icons. It uses a Gtk::TreeModel for data storage, so the list store example might be helpful. =end require 'common' module Demo class IconView < Demo::BasicWindow COL_PATH, COL_DISPLAY_NAME, COL_IS_DIR, COL_PIXBUF = (0..3).to_a def fill_store @store.clear Dir.glob(File.join(@parent, "*")).each do |path| is_dir = FileTest.directory?(path) iter = @store.append # set COL_DISPLAY_NAME first because changing an iter will trigger the # sort function; if we set something else first, the value of # COL_DISPLAY_NAME for this row will be "nil" and the sort function will fail #puts path #puts GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8") #puts File.basename(GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8")) # iter[COL_DISPLAY_NAME] = File.basename(GLib.filename_to_utf8(path)) iter[COL_DISPLAY_NAME] = GLib.filename_to_utf8(path) iter[COL_PATH] = path iter[COL_IS_DIR] = is_dir iter[COL_PIXBUF] = is_dir ? @folder_pixbuf : @file_pixbuf end end def initialize super('Gtk::IconView demo') @file_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-regular.png")) @folder_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-directory.png")) @store = Gtk::ListStore.new(String, String, TrueClass, Gdk::Pixbuf) @parent = "/" @store.set_default_sort_func do |a, b| if !a[COL_IS_DIR] and b[COL_IS_DIR] 1 elsif a[COL_IS_DIR] and !b[COL_IS_DIR] -1 else a[COL_DISPLAY_NAME] <=> b[COL_DISPLAY_NAME] end end @store.set_sort_column_id(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SortType::ASCENDING) fill_store set_default_size(650, 400) set_border_width(8) vbox = Gtk::Box.new(:vertical) add(vbox) toolbar = Gtk::Toolbar.new vbox.pack_start(toolbar, :expand => false, :fill => false, :padding => 0) up_button = Gtk::ToolButton.new(:stock_id => :go_up) up_button.important = true up_button.sensitive = false toolbar.insert(up_button, -1) up_button.signal_connect("clicked") do @parent = File.dirname(@parent) fill_store up_button.sensitive = @parent != "/" end home_button = Gtk::ToolButton.new(:stock_id => :home) home_button.important = true toolbar.insert(home_button, -1) home_button.signal_connect("clicked") do @parent = GLib.home_dir fill_store up_button.sensitive = true end sw = Gtk::ScrolledWindow.new sw.shadow_type = :etched_in sw.set_policy(:automatic, :automatic) vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0) iconview = Gtk::IconView.new(@store) iconview.selection_mode = :multiple iconview.text_column = COL_DISPLAY_NAME iconview.pixbuf_column = COL_PIXBUF iconview.signal_connect("item_activated") do |iview, path| iter = @store.get_iter(path) if iter[COL_DISPLAY_NAME] @parent = iter[COL_PATH] fill_store up_button.sensitive = true end end sw.add(iconview) iconview.grab_focus end end end ruby-gnome2-all-2.2.5/gtk3/sample/gtk-demo/gnu-keys.png0000644000175000017500000000741411701304107020722 0ustar koukouPNG  IHDR00WgAMA aIDATxkt]e゙[rr-M&i4IoŦC;DgPQTTguleP^Ҧ-msk~9Im}y|)̗:~yy}.qK\2C^Fd"弋Kt᪵UrL+ͷRu-YVV^zU+W (=ݽo `L-(`Fy9&NaYV왳vmۏ:/L/zefB01o2jy_8Pϱup H)B0qm_[ ȿV;@V(\{^fr(6 IG{x3cKս( *H$|)T4h?]ȂeneY9kjx4Jbd+W^y%լhB L  [|aIl2F~~+&OG @Uө|A< _ 8nSOn$I1UfV^~<`wn~ t4'8͞-ZXYyށT{߽ۿ_qǎR\RȬJ Il[8y%e^UQ5Mc_EVvϕxK"yn /﮻iK,554k>+cY=\mOw0 xmO~/P Be``}r!ʊ)- 3blя[i%hF*$LcuTcP⒊;>u{)j0%yyB` p㉸퇿]WWWwBǁQ`rJn'7†jB4E4Lo߫4kp$/w]MP5b$q|tb嗱kҲr=elt_="GeG7tM0M'߽;~rt]G"IA4¡0hhlzFF 3:$ccc$IFc8z9zG BB&Mرc<.馛)/+W||f9pEQP <.ӿxb&8ҊoRinm&77Jj-_Ƽy9s4gΝ"JY8R"}qʦa&j`A4Mlذk\k  ԾZolDUUt]_}}RL7^L@G>2EUPu.+ZJBz{zof$6JEE% ;.' ˪g΂HC "Yz@0H__/CA=ơCعs'K,acض͑#u}ctL%Oxɼ@QQQov(G&]]]]Pe1HSPX+0LښhhlॗvHũcH.iiiq,*QUΞսGbYAx|;w$;7p(*斪yϝxd0 x _bf/H_y_|'<9Bcǎ8y3˙;gPs &pl}G3RK v5V>3tZ͆O~7^/f(=>.\wI àa&M/}TM#;+#?EQQ*̟;˗zΎNod*Iii2~n}.**gdh+HOjo.a 7\rY"&6>55<.<ץ-?žp7QZVi o=B:==Xu,KpUܱAR{`?wE 'OP6ן"#QtM! 12CʛKco}wc) R0u #%'4 U?>D"Yy_?? ,kf:ōm[+k&pmTTT,]=[(x3SE_8R88I*"@+_FW\=|v4 ,\W M -郵ugsrm7d mݽ횪BP@(hB;u…5?=x'uyjS_kOYpݡ:+>6M>۾d;O5;{}#6//oY''UTTT3L'lK}ACRJ%A kBg[ԌT4hzo>JhBkVjUSÙL DUU;?vTaYvȡc=gN7=='yiT]m-mV 3KhqCowL&0 NCDz.L\Τ/y۽e˗rsM5.b$ Dcx}k+V.Ng{cC#4y/x'QV]ʫYZZꍌ Y{Q~WRnaswkwD"&w?K\{;$誂IENDB`ruby-gnome2-all-2.2.5/gtk3/sample/misc/0000755000175000017500000000000012516434313015700 5ustar koukouruby-gnome2-all-2.2.5/gtk3/sample/misc/button2.rb0000644000175000017500000000123012516434313017616 0ustar koukou#!/usr/local/bin/ruby =begin button2.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: button2.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::Button sample") button1 = Gtk::Button.new(:mnemonic => "_HELLO") button2 = Gtk::Button.new(:label => "_HELLO") button3 = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT) button3.signal_connect("clicked"){ Gtk.main_quit } box = Gtk::Box.new(:vertical) box.add(button1) box.add(button2) box.add(button3) window.add(box).set_default_size(100,100).show_all Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/statusicon.rb0000644000175000017500000000536112516434313020426 0ustar koukou#!/usr/bin/env ruby =begin status_icon.rb - Gtk::StatusIcon sample. This sample refers gtk/tests/teststatusicon.c of GTK+-2.10.x. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: statusicon.rb,v 1.1 2006/11/17 18:12:41 mutoh Exp $ =end require "gtk3" if str = Gtk.check_version(3, 10, 7) puts "This sample requires GTK+ 3.10.7 or later" puts str exit end class StatusIconSample < Gtk::StatusIcon STATUS_INFO = 0 STATUS_QUESTION = 1 def initialize super @status = STATUS_INFO update_icon signal_connect("activate") {icon_activated} signal_connect("popup-menu") do |w, button, activate_time| menu = Gtk::Menu.new menuitem = Gtk::MenuItem.new("Quit") menuitem.signal_connect("activate") do set_visible(false) Gtk.main_quit end menu.append(menuitem) menu.show_all menu.popup(nil, nil, button, activate_time) end @timeout = timeout_func end def update_icon if @status == STATUS_INFO self.stock = Gtk::Stock::DIALOG_INFO set_tooltip_text("Some Information ...") else self.stock = Gtk::Stock::DIALOG_QUESTION set_tooltip_text("Some Question ...") end end def timeout_func GLib::Timeout.add(2000) do if @status == STATUS_INFO @status = STATUS_QUESTION else @status = STATUS_INFO end update_icon true end end def icon_activated unless @dialog @dialog = Gtk::MessageDialog.new(:parent => nil, :flags => 0, :type => Gtk::MessageType::QUESTION, :buttons_type => Gtk::MessageDialog::ButtonsType::CLOSE, :message => "You wanna test the status icon?") @dialog.window_position = Gtk::Window::Position::CENTER @dialog.signal_connect("response") {@dialog.hide} @dialog.signal_connect("delete_event") {@dialog.hide_on_delete} toggle = Gtk::ToggleButton.new("_Show the icon") @dialog.child.pack_end(toggle, :expand => true, :fill => true, :padding => 6) toggle.active = visible? toggle.signal_connect("toggled") do |w| set_visible(w.active?) end toggle = Gtk::ToggleButton.new("_Change the icon") @dialog.child.pack_end(toggle, :expand => true, :fill => true, :padding => 6) toggle.active = (@timeout != 0) toggle.signal_connect("toggled") do if @timeout and @timeout > 0 GLib::Source.remove(@timeout) @timeout = 0 else @timeout = timeout_func end end end @dialog.show_all @dialog.present end end StatusIconSample.new Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/print.rb0000664000175000017500000001575611740310343017373 0ustar koukou#!/usr/bin/env ruby =begin print.rb - Gtk::Print* sample Copyright (C) 2007 Mathieu Blondel This program is licenced under the same licence as Ruby-GNOME2. $Id: print.rb,v 1.1 2007/08/05 15:41:31 mutoh Exp $ =end require 'gtk3' # Values returned by a Pango::Layout or set in a Pango::Layout # are always multiple of Pango::SCALE. Those are convenience methods to # deal with that. class Pango::Layout def size_in_points self.size.collect { |v| v / Pango::SCALE } end def width_in_points self.size[0] / Pango::SCALE end def height_in_points self.size[1] / Pango::SCALE end def width_in_points=(width) self.width = width * Pango::SCALE end end class Print < Gtk::PrintOperation FONT = Pango::FontDescription.new("sans 12") FONT_SMALL = Pango::FontDescription.new("sans 8") FONT_SIZE = 12 FONT_SMALL_SIZE = 8 def initialize (parent_window, text) super() @parent_window = parent_window @text = text # with this option disabled, the origin is the the upper left corner # *taking into consideration margins* ! self.use_full_page = false self.unit = Gtk::PaperSize::Unit::POINTS # set default paper size page_setup = Gtk::PageSetup.new paper_size = Gtk::PaperSize.new(Gtk::PaperSize.default) page_setup.paper_size_and_default_margins = paper_size self.default_page_setup = page_setup # show a progress bar self.show_progress = true # You must choose between "paginate" and "begin-print". # "begin-print" is emitted only once and "paginate" is emitted # until the block returns true. # In both cases, you must set the number of pages at the end with # Gtk::PrintOperation#n_pages= signal_connect("begin-print") do |pop, context| puts "calls begin-print" cr = context.cairo_context paragraphs = @text.split("\n") layouts = [] paragraphs.each do |para| layouts << create_layout(cr, para) end # distribute paragraph layouts among pages @page_layouts = [] curr_height = 0 n_pages = 0 layouts.each do |layout| height = layout.height_in_points if curr_height + height > real_page_height n_pages += 1 curr_height = 0 end @page_layouts[n_pages] ||= [] @page_layouts[n_pages] << layout curr_height += height end pop.n_pages = n_pages + 1 end signal_connect("draw-page") do |pop, context, page_num| puts "calls draw-page %d" % page_num cr = context.cairo_context x, y = [0,0] # this means we start at the upper left margin if @page_layouts[page_num] @page_layouts[page_num].each do |layout| cr.move_to(x,y) cr.show_pango_layout(layout) y += layout.height_in_points end total_pages = @page_layouts.length else total_pages = 1 end # page_num starts at 0 draw_footer(cr, page_num + 1, total_pages) end end def run_print_dialog res = run(Action::PRINT_DIALOG, @parent_window) case res when RESULT_ERROR puts "error" when RESULT_CANCEL puts "cancelled" when RESULT_APPLY puts "applied" when RESULT_IN_PROGRESS puts "in progress" end end def run_preview res = run(Action::PREVIEW, @parent_window) end private def page_height setup = self.default_page_setup # this takes margins into consideration, contrary to get_paper_height setup.get_page_height(Gtk::PaperSize::Unit::POINTS) end def page_width setup = self.default_page_setup width = setup.get_page_width(Gtk::PaperSize::Unit::POINTS) end def real_page_height page_height - footer_height end def footer_height 5 * FONT_SMALL_SIZE end def create_layout(cr, text) layout = cr.create_pango_layout layout.width_in_points = page_width layout.font_description = FONT layout.wrap = Pango::Layout::WrapMode::CHAR layout.ellipsize = Pango::Layout::ELLIPSIZE_NONE layout.single_paragraph_mode = false layout.text = text layout end def draw_footer(cr, nth_page, total_page) layout = cr.create_pango_layout layout.alignment = Pango::Layout::ALIGN_RIGHT layout.font_description = FONT_SMALL layout.text = "Page %d/%d" % [nth_page, total_page] + "\n" + \ Time.now.strftime("Printed on %Y/%m/%d at %H:%M") + "\n" + \ "Powered by Ruby-GNOME2!" width, height = layout.size_in_points x, y = [page_width, page_height] x -= width y -= height cr.move_to(x, y) cr.show_pango_layout(layout) cr.rel_move_to(width, -2) cr.rel_line_to(-page_width, 0) cr.stroke end end class Window < Gtk::Window def initialize super signal_connect("delete-event") { Gtk.main_quit } set_default_size(600, 600) @textview = Gtk::TextView.new @textview.wrap_mode = Gtk::TextTag::WrapMode::WORD hbox = Gtk::Box.new(:horizontal) page_setup_button = Gtk::Button.new page_setup_button.label = "Page setup" page_setup_button.signal_connect("clicked") do @page_setup = Print::run_page_setup_dialog(self, # parent window @page_setup) end print_preview_button = Gtk::Button.new(:stock_id => Gtk::Stock::PRINT_PREVIEW) print_preview_button.signal_connect("clicked") do printop = Print.new(self, @textview.buffer.text) printop.default_page_setup = @page_setup if @page_setup printop.run_preview end print_button = Gtk::Button.new(:stock_id => Gtk::Stock::PRINT) print_button.signal_connect("clicked") do printop = Print.new(self, @textview.buffer.text) printop.default_page_setup = @page_setup if @page_setup printop.run_print_dialog end [page_setup_button, print_preview_button, print_button].each do |b| hbox.pack_start(b, true, true) # expand, fill end scrollbar = Gtk::Scrollbar.new(:vertical) vbox = Gtk::Box.new(:vertical) scroll = Gtk::ScrolledWindow.new.add(@textview) scroll.set_policy(:automatic, :automatic) vbox.pack_start(scroll) vbox.pack_end(hbox, false, false) add(vbox) show_all end end Window.new Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/menu.rb0000644000175000017500000000330611701304107017163 0ustar koukou#!/usr/bin/env ruby =begin menu.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: menu.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' def create_menu(depth) return nil if depth < 1 menu = Gtk::Menu.new group = nil submenu = nil for i in 0..4 buf = sprintf("item %2d - %d", depth, i + 1) menuitem = Gtk::RadioMenuItem.new(group, buf) group = menuitem.group menu.append(menuitem) if depth > 1 menuitem.set_submenu create_menu(depth - 1) end end menu end window = Gtk::Window.new("menus") window.signal_connect("destroy") do Gtk.main_quit end window.border_width = 0 box1 = Gtk::VBox.new(false, 0) window.add(box1) menubar = Gtk::MenuBar.new box1.pack_start(menubar, false, true, 0) menu = create_menu(2) menuitem = Gtk::MenuItem.new("test\nline2") menuitem.set_submenu(menu) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("foo") menuitem.set_submenu(create_menu(3)) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("bar") menuitem.set_submenu(create_menu(4)) menubar.append(menuitem) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, true, true, 0) optionmenu = Gtk::OptionMenu.new optionmenu.set_menu(create_menu(1)) optionmenu.set_history(4) box2.pack_start(optionmenu, true, true, 0) separator = Gtk::HSeparator.new box1.pack_start(separator, false, true, 0) box2 = Gtk::HBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked") do window.destroy end box2.pack_start(button, true, true, 0) window.show_all Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/listview.rb0000644000175000017500000000370612516434313020101 0ustar koukou#!/usr/bin/env ruby =begin listview.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: listview.rb,v 1.11 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::ListStore sample") window.border_width = 0 box1 = Gtk::Box.new(:vertical, 0) window.add(box1) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2, true, true, 0) scrolled_win = Gtk::ScrolledWindow.new scrolled_win.set_policy(:automatic,:automatic) box2.pack_start(scrolled_win, true, true, 0) data = [ "hello", "world", "blah", "foo", "bar", "argh", "spencer", "is a", "wussy", "programmer" ] model = Gtk::ListStore.new(String) column = Gtk::TreeViewColumn.new("Data", Gtk::CellRendererText.new, {:text => 0}) treeview = Gtk::TreeView.new(model) treeview.append_column(column) treeview.selection.set_mode(:single) scrolled_win.add_with_viewport(treeview) data.each do |v| iter = model.append iter[0] = v end button = Gtk::Button.new(:label => "add") button.can_focus=true i = 0 button.signal_connect("clicked") do iter = model.append iter[0] = "add item #{i}" i += 1 end box2.pack_start(button, false, true, 0) button = Gtk::Button.new(:label => "remove") button.can_focus=true button.signal_connect("clicked") do iter = treeview.selection.selected model.remove(iter) if iter end box2.pack_start(button, false, true, 0) separator = Gtk::Separator.new(:horizontal) box1.pack_start(separator, false, true, 0) separator.show box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button = Gtk::Button.new(:label => "close") button.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(button, true, true, 0) button.can_default=true button.grab_default window.set_default_size(300, 300) window.show_all Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/dialog2.rb0000644000175000017500000000206712516434313017553 0ustar koukou#!/usr/bin/env ruby =begin dialog2.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: dialog2.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" window = Gtk::Window.new("Gtk::Dialog sample2") button = Gtk::Button.new(:label => "Create Dialog") button.signal_connect("clicked") do dialog = Gtk::Dialog.new(:title =>"Gtk::Dialog Sample 2", :parent => window, :flags => Gtk::Dialog::Flags::MODAL, :buttons => [[Gtk::Stock::OK, Gtk::ResponseType::OK], [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]]) dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample 2")) dialog.set_default_size(300, 300) dialog.child.show_all result = dialog.run case result when Gtk::ResponseType::OK p "OK" when Gtk::ResponseType::CANCEL p "Cancel" end dialog.destroy end window.add(button).show_all.signal_connect("destroy") {Gtk.main_quit} Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/entry.rb0000644000175000017500000000116312516434313017367 0ustar koukou#!/usr/bin/env ruby =begin entry.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: entry.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("entry") window.border_width = 0 box1 = Gtk::Box.new(:vertical, 10) window.add(box1) entry = Gtk::Entry.new box1.add(entry) box1.add(Gtk::Separator.new(:horizontal)) button = Gtk::Button.new(:label => "close") button.signal_connect("clicked") do Gtk.main_quit end box1.add(button) window.show_all entry.text = "hello world" Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/uimanager2.rb0000644000175000017500000000515111701304107020251 0ustar koukou=begin uimanager2.rb - Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: uimanager2.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end callback = Proc.new {|actiongroup, action| puts "`#{action.name}' is clicked. " if action.is_a? Gtk::ToggleAction puts "active? = #{action.active?}" end } callback_quit = Proc.new { p "Quit is called." Gtk.main_quit } callback_radio = Proc.new {|action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" } actions = [ ["FileMenu", nil, "_File"], ["PreferencesMenu", nil, "_Preferences"], ["ColorMenu", nil, "_Color"], ["ShapeMenu", nil, "_Shape"], ["HelpMenu", nil, "_Help"], ["New", Gtk::Stock::NEW, "_New", "N", "Create a new file", callback], ["Open", Gtk::Stock::OPEN, "_Open", "O", "Open a file", callback], ["Save", Gtk::Stock::SAVE, "_Save", "S", "Save current file", callback], ["SaveAs", Gtk::Stock::SAVE, "Save _As...", nil, "Save to a file", callback], ["Quit", Gtk::Stock::QUIT, "_Quit", "Q", "Quit", callback_quit], ["About", nil, "_About", "A", "About", callback], ["Logo", "demo-gtk-logo", nil, nil, "GTK+", callback] ] toggle_actions = [ ["Bold", Gtk::Stock::BOLD, "_Bold", "B", "Bold", callback, true] ] color_radio_actions = [ ["Red", nil, "_Red", "R", "Blood", 0], ["Green", nil, "_Green", "G", "Grass", 1], ["Blue", nil, "_Blue", "B", "Sky", 2] ] shape_radio_actions = [ ["Square", nil, "_Square", "S", "Square", 0], ["Rectangle", nil, "_Rectangle", "R", "Rectangle", 1], ["Oval", nil, "_Oval", "O", "Egg", 2] ] window = Gtk::Window.new("Gtk::UIManager sample2") window.signal_connect("destroy"){Gtk.main_quit} actiongroup = Gtk::ActionGroup.new("Actions") actiongroup.add_actions(actions) actiongroup.add_toggle_actions(toggle_actions) actiongroup.add_radio_actions(color_radio_actions, 1) do |action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" end actiongroup.add_radio_actions(shape_radio_actions, 2, callback_radio) uimanager = Gtk::UIManager.new uimanager.insert_action_group(actiongroup, 0) window.add_accel_group(uimanager.accel_group) uimanager.add_ui("./uimanager2.xml") vbox = Gtk::VBox.new vbox.pack_start(uimanager["/MenuBar"], false, false) vbox.pack_start(Gtk::Label.new("Gtk::UIManager Sample")) window.add(vbox) window.set_default_size(100, 100).show_all Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/label.rb0000644000175000017500000000205412516434313017305 0ustar koukou#!/usr/bin/env ruby =begin label.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: label.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' win = Gtk::Window.new("Gtk::Label sample") win.signal_connect("destroy"){Gtk.main_quit} label1 = Gtk::Label.new("_Not Use Mnemonic") label1.selectable = true label2 = Gtk::Label.new("_Use Mnemonic", true) label3 = Gtk::Label.new.set_markup(%Q[Ruby-GNOME2 is cool!], true) label4 = Gtk::Label.new.set_markup(%Q[_Not Use Mnemonic]) label5 = Gtk::Label.new.set_markup(%Q[_Use Mnemonic], true) box = Gtk::Box.new(:vertical) box.add(label1) box.add(label2) box.add(label3) box.add(label4) box.add(label5) win.add(box).show_all # This can be called after realized only. label1.select_region(3, 8) Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/aboutdialog2.rb0000644000175000017500000000256612516434313020612 0ustar koukou#!/usr/bin/env ruby =begin aboutdialog2.rb - Ruby/GTK sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: aboutdialog2.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end Gtk::AboutDialog.set_email_hook {|about, link| p "email_hook" p link } Gtk::AboutDialog.set_url_hook {|about, link| p "url_hook" p link } Gtk::AboutDialog.show(nil, "artists" => ["Artist 1 ", "Artist 2 "], "authors" => ["Author 1 ", "Author 2 "], "comments" => "This is a sample script for Gtk::AboutDialog", "copyright" => "Copyright (C) 2005 Ruby-GNOME2 Project", "documenters" => ["Documenter 1 ", "Documenter 2 "], "license" => "This program is licenced under the same licence as Ruby-GNOME2.", "logo_icon_name" => "gtk-home", "program_name" => "Gtk::AboutDialog sample", "translator_credits" => "Translator 1 \nTranslator 2 \n", "version" => "1.0.0", "website" => "http://ruby-gnome2.sourceforge.jp", "website_label" => "Ruby-GNOME2 Project Website" ) Gtk.main ruby-gnome2-all-2.2.5/gtk3/sample/misc/aboutdialog.rb0000644000175000017500000000235512516434313020524 0ustar koukou#!/usr/bin/env ruby =begin aboutdialog.rb - Ruby/GTK sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: aboutdialog.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end Gtk::AboutDialog.set_email_hook {|about, link| p "email_hook" p link } Gtk::AboutDialog.set_url_hook {|about, link| p "url_hook" p link } a = Gtk::AboutDialog.new a.artists = ["Artist 1 ", "Artist 2 "] a.authors = ["Author 1 ", "Author 2 "] a.comments = "This is a sample script for Gtk::AboutDialog" a.copyright = "Copyright (C) 2005 Ruby-GNOME2 Project" a.documenters = ["Documenter 1 ", "Documenter 2 "] a.license = "This program is licenced under the same licence as Ruby-GNOME2." a.logo = Gdk::Pixbuf.new("gnome-logo-icon.png") a.program_name = "Gtk::AboutDialog sample" a.translator_credits = "Translator 1\nTranslator 2\n" a.version = "1.0.0" a.website = "http://ruby-gnome2.sourceforge.jp" a.website_label = "Ruby-GNOME2 Project Website" p a.run ruby-gnome2-all-2.2.5/gtk3/sample/misc/itemfactory2.rb0000644000175000017500000000455411701304107020635 0ustar koukou#!/usr/bin/env ruby =begin itemfactory2.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. *NOTE* Gtk::ItemFactory has been deprecated. Use Gtk::UIManager instead. $Id: itemfactory2.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' puts "Deprecated. Use Gtk::UIManager instead." window = Gtk::Window.new("Gtk::ItemFactory2") window.signal_connect("destroy") do Gtk.main_quit end window.signal_connect("delete_event") do Gtk.main_quit end accelgroup = Gtk::AccelGroup.new window.add_accel_group(accelgroup) ifp = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, "
", accelgroup) ifp.create_item("/_Stock") ifp.create_item("/_Stock/_New", "", "N", Gtk::Stock::NEW, 1) do |v, _| p "StockItem #{v}" end item = ifp.create_item("/_Stock/_Open", "", "O", Gtk::Stock::OPEN, 2) do |v, _| p "StockItem #{v}" end ifp.create_item("/_Stock/_Quit", "", "Q", Gtk::Stock::QUIT, 3) do |v, _| p "Quit" Gtk.main_quit end ifp.create_item("/_Item") ifp.create_item("/_Item/Item_1", ""){p "Item1"} ifp.create_item("/_Item/Item_2", ""){p "Item2"} ifp.create_item("/_Check") ifp.create_item("/_Check/Check_1", ""){p "Check1"} ifp.create_item("/_Check/Check_2", ""){p "Check2"} ifp.create_item("/_Toggle") ifp.create_item("/_Toggle/Toggle_1", "", nil, nil, 1){|v, _| p "Toggle#{v}"} ifp.create_item("/_Toggle/Toggle_2", "", nil, nil, 2){|v, _| p "Toggle#{v}"} ifp.create_item("/_Radio") ifp.create_item("/_Radio/Radio_1", "", nil, nil, 1){|v, _| p "Radio#{v}"} ifp.create_item("/_Radio/Radio_2", "/Radio/Radio1", nil, nil, 2){|v, _| p "Radio#{v}"} ifp.create_item("/_Radio/Radio_3", "/Radio/Radio1", nil, nil, 3){|v, _| p "Radio#{v}"} ifp.create_item("/_Misc", "") ifp.create_item("/_Misc/Tearoff", "") ifp.create_item("/_Misc/Title", "") ifp.create_item("/_Misc/Seperator", "<Separator>") ifp.create_item("/_Misc/Image", "<ImageItem>", "", Gdk::Pixbuf.new("gnome-logo-icon.png")) do p "ImageItem" end ifp.get_widget("/Stock/Open").sensitive = false vbox = Gtk::VBox.new vbox.add(ifp.get_widget("<main>")) vbox.add(Gtk::Label.new("Gtk::ItemFactory sample").set_size_request(400, 200)) window.add(vbox) window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/tooltips.rb��������������������������������������������������0000644�0001750�0001750�00000015346�12516434313�020113� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin tooltips.rb - Demonstrates the new tooltip API of Gtk+ 2.12; rg2 translation from gtk/tests/testtooltips.c. Copyright (c) 2007 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: tooltips.rb,v 1.1 2007/07/10 13:17:34 ggc Exp $ =end require 'gtk3' if str = Gtk.check_version(2, 12, 0) puts "This sample requires GTK+ 2.12.0 or later" puts str exit end def treeview_query_tooltip(treeview, keyboard_tip, x, y, tooltip) if keyboard_tip # Keyboard mode path, = treeview.cursor if not path return false end else bin_x, bin_y = treeview.convert_widget_to_bin_window_coords(x, y) # Mouse mode path, = treeview.get_path_at_pos(bin_x, bin_y) if not path return false end end data = treeview.model.get_value(treeview.model.get_iter(path), 0) tooltip.markup = "<b>Path #{path}:</b> #{data}" return true end def textview_query_tooltip(textview, keyboard_tip, x, y, tooltip, tag) if keyboard_tip iter = textview.buffer.get_iter_at_offset(textview.buffer.cursor_position) else bx, by = textview.window_to_buffer_coords(Gtk::TextView::WINDOW_TEXT, x, y) iter, = textview.get_iter_at_position(bx, by) end if iter.has_tag?(tag) tooltip.text = 'Tooltip on text tag' return true else return false end end def drawingarea_query_tooltip(keyboard_tip, x, y, tooltip, rectangles) if keyboard_tip return false end for r in rectangles if r.x < x && x < r.x + 50 && r.y < y && y < r.y + 50 tooltip.markup = r.tooltip return true end end return false end Gtk.init window = Gtk::Window.new(Gtk::Window::TOPLEVEL) window.title = 'Tooltips test' window.border_width = 10 window.signal_connect('delete-event') { Gtk.main_quit } box = Gtk::VBox.new(false, 3) window.add(box) # A check button using the tooltip-markup property button = Gtk::CheckButton.new('This one uses the tooltip-markup property') button.tooltip_text = 'Hello, I am a static tooltip.' box.pack_start(button, false, false, 0) raise if button.tooltip_text != 'Hello, I am a static tooltip.' raise if button.tooltip_markup != 'Hello, I am a static tooltip.' # A check button using the query-tooltip signal button = Gtk::CheckButton.new('I use the query-tooltip signal') button.has_tooltip = true button.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| tooltip.markup = widget.label tooltip.set_icon_from_stock(Gtk::Stock::DELETE, Gtk::IconSize::MENU) true } box.pack_start(button, false, false, 0) # A label label = Gtk::Label.new('I am just a label') label.selectable = false label.tooltip_text = 'Label & and tooltip' box.pack_start(label, false, false, 0) raise if label.tooltip_text != "Label & and tooltip" raise if label.tooltip_markup != "Label & and tooltip" # A selectable label label = Gtk::Label.new('I am a selectable label') label.selectable = true label.tooltip_markup = '<b>Another</b> Label tooltip' box.pack_start(label, false, false, 0) raise if label.tooltip_text != 'Another Label tooltip' raise if label.tooltip_markup != '<b>Another</b> Label tooltip' # Another one, with a custom tooltip window button = Gtk::CheckButton.new('This one has a custom tooltip window!') box.pack_start(button, false, false, 0) tooltip_window = Gtk::Window.new(Gtk::Window::POPUP) tooltip_button = Gtk::Label.new('blaat!') tooltip_window.add(tooltip_button) tooltip_button.show button.tooltip_window = tooltip_window button.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| widget.tooltip_window.modify_bg(Gtk::StateType::NORMAL, Gdk::Color.new(0, 65535, 0)) true } button.has_tooltip = true # An insensitive button button = Gtk::Button.new('This one is insensitive') button.sensitive = false button.tooltip_text = 'Insensitive!' box.pack_start(button, false, false, 0) # Tree view store = Gtk::TreeStore.new(String) iter = store.insert(nil, 0, ['File Manager']) iter = store.insert(nil, 0, ['Gossip']) iter = store.insert(nil, 0, ['System Settings']) iter = store.insert(nil, 0, ['The GIMP']) iter = store.insert(nil, 0, ['Terminal']) iter = store.insert(nil, 0, ['Word Processor']) treeview = Gtk::TreeView.new(store) treeview.set_size_request(200, 240) treeview.append_column(Gtk::TreeViewColumn.new('Test', Gtk::CellRendererText.new, { :text => 0 })) treeview.has_tooltip = true treeview.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| treeview_query_tooltip(widget, keyboard_tip, x, y, tooltip) } treeview.selection.signal_connect('changed') { treeview.trigger_tooltip_query } # Set a tooltip on the column column = treeview.get_column(0) column.clickable = true #column.button.tooltip_text = 'Header' .button not available box.pack_start(treeview, false, false, 2) # Text view buffer = Gtk::TextBuffer.new buffer.insert(buffer.end_iter, 'Hello, the text ') tag = buffer.create_tag('bold', { 'weight' => Pango::WEIGHT_BOLD }) buffer.insert(buffer.end_iter, 'in bold', tag) buffer.insert(buffer.end_iter, ' has a tooltip!') textview = Gtk::TextView.new(buffer) textview.set_size_request(200, 50) textview.has_tooltip = true textview.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| textview_query_tooltip(widget, keyboard_tip, x, y, tooltip, tag) } box.pack_start(textview, false, false, 2) # Drawing area if Gdk.cairo_available? Rectangle = Struct.new("Rectangle", :x, :y, :r, :g, :b, :tooltip) rectangles = [ Rectangle.new(10, 10, 0.0, 0.0, 0.9, "Blue box!"), Rectangle.new(200, 170, 1.0, 0.0, 0.0, "Red thing"), Rectangle.new(100, 50, 0.8, 0.8, 0.0, "Yellow thing") ] drawingarea = Gtk::DrawingArea.new drawingarea.set_size_request(320, 240) drawingarea.has_tooltip = true drawingarea.signal_connect('draw') { cr = drawingarea.window.create_cairo_context cr.rectangle(0, 0, drawingarea.allocation.width, drawingarea.allocation.height) cr.set_source_rgb(1.0, 1.0, 1.0) cr.fill rectangles.each { |r| cr.rectangle(r.x, r.y, 50, 50) cr.set_source_rgb(r.r, r.g, r.b) cr.stroke cr.rectangle(r.x, r.y, 50, 50) cr.set_source_rgba(r.r, r.g, r.b, 0.5) cr.fill } } drawingarea.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| drawingarea_query_tooltip(keyboard_tip, x, y, tooltip, rectangles) } box.pack_start(drawingarea, false, false, 2) else warn "Part of this sample needs Cairo support. Make sure your ruby-gtk2 is compiled with Cairo support, and rcairo is installed." end window.show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/window.rb����������������������������������������������������0000644�0001750�0001750�00000001015�12516434313�017531� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin window.rb - Gtk::Window sample. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: window.rb,v 1.9 2006/10/21 16:58:00 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::Window sample") window.signal_connect("destroy"){Gtk.main_quit} button = Gtk::Button.new(:label => "Hello World") button.signal_connect("clicked") do puts "hello world" Gtk.main_quit end window.add(button) window.show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/drawing.rb���������������������������������������������������0000644�0001750�0001750�00000004530�12416346617�017672� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin drawing.rb - Gtk::Drawing sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: drawing.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' class Canvas < Gtk::DrawingArea def initialize super signal_connect("draw") do |w, e| expose_event(w, e) end signal_connect("configure_event") do |w, e| configure_event(w, e) end @buffer = nil @bgc = nil end def expose_event(w, e) unless @buffer.nil? rec = e.area w.window.draw_drawable(@bgc, @buffer, rec.x, rec.y, rec.x, rec.y, rec.width, rec.height) end false end def clear(b = @buffer) return if b.nil? g = b.size @bgc = self.style.bg_gc(self.state) if @bgc.nil? if (g[0] > 0 && g[1] > 0) b.draw_rectangle(@bgc, true, 0, 0, g[0], g[1]) end end def configure_event(w, e) g = w.window.geometry if (g[2] > 0 && g[3] > 0) b = Gdk::Pixmap::new(w.window, g[2], g[3], -1) clear(b) if not @buffer.nil? g = @buffer.size b.draw_drawable(@bgc, @buffer, 0, 0, 0, 0, g[0], g[1]) end @buffer = b end true end end class A < Canvas def initialize super signal_connect("button_press_event") do |w, e| pressed(w, e) end set_events(Gdk::Event::BUTTON_PRESS_MASK) end def pressed(widget, ev) if not @last.nil? @buffer.draw_line(widget.style.fg_gc(widget.state), @last.x, @last.y, ev.x, ev.y) x1, x2 = if (@last.x < ev.x) [@last.x, ev.x] else [ev.x, @last.x] end y1, y2 = if (@last.y < ev.y) [@last.y, ev.y] else [ev.y, @last.y] end widget.queue_draw_area(x1, y1, x2 - x1 + 1, y2 - y1 + 1) end @last = nil @last = ev true end end window = Gtk::Window.new("drawing test") window.signal_connect("destroy") do Gtk.main_quit end canvas = A.new window.add(canvas) window.show_all Gtk::main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/radiobutton.rb�����������������������������������������������0000664�0001750�0001750�00000002037�11740310343�020555� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin radiobutton.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: radiobutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::RadioButton sample") window.signal_connect("destroy"){Gtk.main_quit} box1 = Gtk::Box.new(:vertical) window.add(box1) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.add(box2) button1 = Gtk::RadioButton.new("_button1") button2 = Gtk::RadioButton.new(button1, "_button2", false) button3 = Gtk::RadioButton.new(button1, Gtk::Stock::QUIT) box2.add(button1).add(button2).add(button3) box1.add(Gtk::Separator.new(:horizontal)) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.add(box2) close = Gtk::Button.new(:label => "close") close.signal_connect("clicked") do Gtk.main_quit end box2.add(close) close.can_default = true close.grab_default window.signal_connect("destroy"){Gtk.main_quit} window.show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/test.xpm�����������������������������������������������������0000644�0001750�0001750�00000003767�11701304107�017412� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 20 19 66 2", /* colors */ ".. c None", ".# c #000000", ".a c #dfdfdf", ".b c #7f7f7f", ".c c #006f6f", ".d c #00efef", ".e c #009f9f", ".f c #004040", ".g c #00bfbf", ".h c #ff0000", ".i c #ffffff", ".j c #7f0000", ".k c #007070", ".l c #00ffff", ".m c #00a0a0", ".n c #004f4f", ".o c #00cfcf", ".p c #8f8f8f", ".q c #6f6f6f", ".r c #a0a0a0", ".s c #7f7f00", ".t c #007f7f", ".u c #5f5f5f", ".v c #707070", ".w c #00f0f0", ".x c #009090", ".y c #ffff00", ".z c #0000ff", ".A c #00afaf", ".B c #00d0d0", ".C c #00dfdf", ".D c #005f5f", ".E c #00b0b0", ".F c #001010", ".G c #00c0c0", ".H c #000f0f", ".I c #00007f", ".J c #005050", ".K c #002f2f", ".L c #dfcfcf", ".M c #dfd0d0", ".N c #006060", ".O c #00e0e0", ".P c #00ff00", ".Q c #002020", ".R c #dfc0c0", ".S c #008080", ".T c #001f1f", ".U c #003f3f", ".V c #007f00", ".W c #00000f", ".X c #000010", ".Y c #00001f", ".Z c #000020", ".0 c #00002f", ".1 c #000030", ".2 c #00003f", ".3 c #000040", ".4 c #00004f", ".5 c #000050", ".6 c #00005f", ".7 c #000060", ".8 c #00006f", ".9 c #000070", "#. c #7f7f80", "## c #9f9f9f", /* pixels */ "........................................", "........................................", "........................................", ".......................#.#.#............", ".....................#.......#...#......", "...............................#.#......", ".......#.#.#.................#.#.#......", ".....#.y.i.y.#.#.#.#.#.#.#..............", ".....#.i.y.i.y.i.y.i.y.i.#..............", ".....#.y.i.y.i.y.i.y.i.y.#..............", ".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....", ".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......", ".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........", ".....#.y.#.s.s.s.s.s.s.s.s.s.#..........", ".....#.#.s.s.s.s.s.s.s.s.s.#............", ".....#.#.#.#.#.#.#.#.#.#.#..............", "........................................", "........................................", "........................................" }; ���������ruby-gnome2-all-2.2.5/gtk3/sample/misc/settings.rb��������������������������������������������������0000644�0001750�0001750�00000002736�11701304107�020065� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin setting.rb - Gtk::Settings sample script. Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: settings.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' spec = GLib::Param::Int.new("integer", # name "Integer", # nick "Integer integer", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE| GLib::Param::WRITABLE) enum = GLib::Param::Enum.new("enum", # name "Enum", # nick "Enum enum", # blurb GLib::Type["GdkCursorType"], #type Gdk::Cursor::ARROW, #default GLib::Param::READABLE| GLib::Param::WRITABLE) flags = GLib::Param::Flags.new("flags", # name "Flags", # nick "Flags flags", # blurb GLib::Type["GdkEventMask"], #type Gdk::Event::LEAVE_NOTIFY_MASK, #default GLib::Param::READABLE| GLib::Param::WRITABLE) p Gtk::Settings.rc_property_parse_color(spec, "{2222,44444,65535}").to_a p Gtk::Settings.rc_property_parse_enum(enum, "watch") p Gtk::Settings.rc_property_parse_flags(flags, "(scroll-mask|structure-mask)") p Gtk::Settings.rc_property_parse_requisition(spec, "{100, 200}") p Gtk::Settings.rc_property_parse_border(spec, "{100, 200, 300, 400}").to_a ����������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/entrycompletion.rb�������������������������������������������0000644�0001750�0001750�00000001314�12516434313�021457� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin entrycompletion.rb - Ruby/GTK sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. Enter "G", "t" on the entry box. $Id: entrycompletion.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new window.set_default_size(200, 200) entry = Gtk::Entry.new completion = Gtk::EntryCompletion.new entry.completion = completion model = Gtk::ListStore.new(String) ["GNOME", "total", "totally"].each do |v| iter = model.append iter[0] = v end completion.model = model completion.text_column = 0 window.add(entry).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/dnd.rb�������������������������������������������������������0000644�0001750�0001750�00000003672�12307003726�017000� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin dnd.rb - Drag and Drop sample script. Copyright (C) 2002-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: dnd.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" class SrcWindow < Gtk::Window def initialize super("Source Window") @label = Gtk::Label.new("Drag here!") add(@label) set_default_size(100, 100) drag_source_set(Gdk::Window::ModifierType::BUTTON1_MASK | Gdk::Window::ModifierType::BUTTON2_MASK, [["test", Gtk::Drag::TargetFlags::SAME_APP, 12345]], Gdk::DragContext::Action::COPY | Gdk::DragContext::Action::MOVE) signal_connect("drag-data-get") do |widget, context, selection_data, info, time| # selection_data.set("text/uri-list", 8, "hoge.txt") selection_data.set(Gdk::Selection::TYPE_STRING, "hoge.txt") end end end class DestWindow < Gtk::Window def initialize super("Dest Window") @label = Gtk::Label.new("Drop here!") add(@label) set_default_size(100, 100) drag_dest_set(Gtk::Drag::DestDefaults::MOTION | Gtk::Drag::DestDefaults::HIGHLIGHT, [["test", :same_app, 12345]], Gdk::DragContext::Action::COPY | Gdk::DragContext::Action::MOVE) signal_connect("drag-data-received") do |widget, context, x, y, selection_data, info, time| context.targets.each do |target| if target.name == "test" || selection_data.type == Gdk::Selection::TYPE_STRING puts selection_data.data end end end signal_connect("drag-drop") do |widget, context, x, y, time| widget.drag_get_data(context, context.targets[0], time) end end end win1 = SrcWindow.new win2 = DestWindow.new win1.show_all.signal_connect("destroy") {Gtk.main_quit} win2.show_all.signal_connect("destroy") {Gtk.main_quit} Gtk.main ����������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/buttonbox.rb�������������������������������������������������0000644�0001750�0001750�00000004127�12416346617�020265� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin buttonbox.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: buttonbox.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" def create_bbox_window(horizontal, title, pos, spacing, layout) window = Gtk::Window.new(title) window.signal_connect("delete_event") do window.destroy end box1 = Gtk::Box.new(:vertical, 0) window.add(box1) if horizontal window.set_default_size(550, 60) window.move(150, pos) bbox = Gtk::ButtonBox.new(:horizontal) else window.set_default_size(150, 400) window.move(pos, 200) bbox = Gtk::ButtonBox.new(:vertical) end bbox.layout_style = layout bbox.spacing = spacing box1.border_width = 25 box1.pack_start(bbox, :expand => true, :fill => true, :padding => 0) button = Gtk::Button.new(:label => "OK") bbox.add(button) button.signal_connect("clicked") do window.destroy end button = Gtk::Button.new(:label => "Cancel") bbox.add(button) button.signal_connect("clicked") do window.destroy end button = Gtk::Button.new(:label => "Help") bbox.add(button) window.show_all end def test_hbbox create_bbox_window(true, "Spread", 50, 40, :spread) create_bbox_window(true, "Edge", 250, 40, :edge) create_bbox_window(true, "Start", 450, 40, :start) create_bbox_window(true, "End", 650, 15, :end) end def test_vbbox create_bbox_window(false, "Spread", 50, 40, :spread) create_bbox_window(false, "Edge", 250, 40, :edge) create_bbox_window(false, "Start", 450, 40, :start) create_bbox_window(false, "End", 650, 15, :end) end window = Gtk::Window.new("button box") window.signal_connect("delete_event") do Gtk.main_quit end window.border_width = 20 bbox = Gtk::ButtonBox.new(:horizontal) window.add(bbox) button = Gtk::Button.new(:label => "Horizontal") button.signal_connect("clicked") do test_hbbox end bbox.add(button) button = Gtk::Button.new(:label => "Vertical") button.signal_connect("clicked") do test_vbbox end bbox.add(button) window.show_all Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/combo_check.rb�����������������������������������������������0000644�0001750�0001750�00000004012�12416346617�020466� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin combo_check.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: combo_check.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" window = Gtk::Window.new("entry") window.border_width = 0 window.signal_connect("destroy") do Gtk.main_quit end box1 = Gtk::Box.new(:vertical) window.add(box1) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2) entry = Gtk::Entry.new entry.text = "hello world" entry.set_editable(false) entry.select_region(0, -1) box2.pack_start(entry) ## Gtk::ComboBoxText is simpler than Gtk::ComboBox, but has less functions. ## Gtk::Combo has been deprecated. cb = Gtk::ComboBoxText.new(:entry => true) cb.append_text("item0") cb.append_text("item1 item1") cb.append_text("item2 item2 item2") cb.append_text("item3 item3 item3 item3") cb.append_text("item4 item4 item4 item4 item4") cb.append_text("item5 item5 item5 item5 item5 item5") cb.append_text("item6 item6 item6 item6 item6") cb.append_text("item7 item7 item7 item7") cb.append_text("item8 item8 item8") cb.append_text("item9 item9") cb.child.text = "hello world" cb.child.select_region(0, -1) cb.child.set_editable(false) box2.pack_start(cb, :expand => true, :fill => true, :padding => 0) check = Gtk::CheckButton.new("Editable") box2.pack_start(check, :expand => false, :fill => true, :padding => 0) check.signal_connect("toggled") do cb.child.set_editable(check.active?) entry.set_editable(check.active?) end check.set_state_flags(Gtk::StateFlags::NORMAL, true) ## Run this code to see all of GtkStateFlags ## # Gtk::StateFlags.constants.each do |i| # p i # end box1.pack_start(Gtk::Separator.new(:horizontal)) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2) button = Gtk::Button.new(:label => "close") button.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(button) button.can_default = true button.grab_default window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/drag-move.rb�������������������������������������������������0000644�0001750�0001750�00000005352�12307003726�020111� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin drag-move.rb - Move widget by drag sample script. Copyright (C) 2011-2014 Ruby-GNOME2 Project Team Copyright (C) 2006 Kouhei Sutou This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: drag-move.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" class DraggableWidget < Gtk::EventBox def initialize super set_visible_window(false) @dragging = false @drag_button = 1 set_button_press_event set_button_release_event set_motion_notify_event end def layout parent end def move(x, y) if layout layout.move(self, x, y) true else false end end def dragging? @dragging end private def set_button_press_event signal_connect("button-press-event") do |widget, event| if event.button == @drag_button Gtk.grab_add(widget) x, y, w, h = widget.allocation.to_a drag_start(x, y, event.x_root, event.y_root) else false end end end def set_motion_notify_event signal_connect("motion-notify-event") do |widget, event| if dragging? drag_motion(event.x_root, event.y_root) else false end end end def set_button_release_event signal_connect("button-release-event") do |widget, event| if event.button == @drag_button Gtk.grab_remove(widget) drag_end else false end end end def set_drag_move_position_event signal_connect("drag-move-position") do |widget, x, y| if layout layout.move(widget, x, y) true else false end end end def drag_start(x, y, base_x, base_y) @dragging = true @drag_x = x @drag_y = y @drag_base_x = base_x @drag_base_y = base_y true end def drag_motion(base_x, base_y) delta_x = base_x - @drag_base_x delta_y = base_y - @drag_base_y if delta_x != 0 and delta_y != 0 move(@drag_x + delta_x, @drag_y + delta_y) else false end end def drag_end @dragging = false true end end window = Gtk::Window.new("Draggable Widget sample") window.signal_connect("destroy") {Gtk.main_quit} layout = Gtk::Layout.new draggable_widget = DraggableWidget.new draggable_widget.set_size_request(50, 50) layout.put(draggable_widget, 75, 75) draggable_widget.signal_connect("draw") do |widget, context| width = widget.width_request height = widget.height_request context.fill do center_x = width / 2 center_y = height / 2 radius = width / 2 start_angle = 0 * Math::PI stop_angle = 2 * Math::PI context.arc(center_x, center_y, radius, start_angle, stop_angle) end false end window.add(layout) window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/filechooser.rb�����������������������������������������������0000644�0001750�0001750�00000002240�12516434313�020525� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin filechooser.rb - Ruby/GTK2 sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: filechooser.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" dialog = Gtk::FileChooserDialog.new(:title => "Gtk::FileChooser sample", :action => Gtk::FileChooser::Action::OPEN, :buttons => [[Gtk::Stock::OPEN, Gtk::Dialog::ResponseType::ACCEPT], [Gtk::Stock::CANCEL, Gtk::Dialog::ResponseType::CANCEL]]) extra_button = Gtk::Button.new(:label => "Extra button") extra_button.signal_connect("clicked") do puts "extra button is clicked" end dialog.extra_widget = extra_button filter_rb = Gtk::FileFilter.new filter_rb.name = "Ruby Scripts" filter_rb.add_pattern("*.rb") filter_rb.add_pattern("*.rbw") dialog.add_filter(filter_rb) filter_c = Gtk::FileFilter.new filter_c.name = "C sources" filter_c.add_pattern("*.[c|h]") dialog.add_filter(filter_c) dialog.add_shortcut_folder("/tmp") if dialog.run == Gtk::Dialog::ResponseType::ACCEPT puts "filename = #{dialog.filename}" puts "uri = #{dialog.uri}" end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/dndtreeview.rb�����������������������������������������������0000664�0001750�0001750�00000002777�11740310343�020556� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin dndtreeview.rb - Drag and Drop sample script. Copyright (C) 2003-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: dndtreeview.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' class TestWindow < Gtk::Window attr_reader :list TARGET_TABLE = [["GTK_TREE_MODEL_ROW", 0, 0]] def initialize() super("Drag and Drop Gtk::TreeView") set_default_size(300,128) signal_connect("destroy") { Gtk.main_quit } data = [["Hello", "KON-NI-CHIWA"], ["Goodbye", "SAYO-NARA"], ["Good morning", "OHA-YO-GOZAI-MASU"], ["Good evening", "KON-BAN-WA"]] model = Gtk::ListStore.new(String, String) view = Gtk::TreeView.new(model) renderer = Gtk::CellRendererText.new col1 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 0}) col2 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 1}) view.append_column(col1) view.append_column(col2) data.each do |v1, v2| iter = model.append iter.set_value(0, v1) iter.set_value(1, v2) end view.enable_model_drag_source(Gdk::Window::ModifierType::BUTTON1_MASK, TARGET_TABLE, Gdk::DragContext::Action::COPY|Gdk::DragContext::Action::MOVE) view.enable_model_drag_dest(TARGET_TABLE, Gdk::DragContext::Action::COPY|Gdk::DragContext::Action::MOVE) add(view) end end win = TestWindow.new.show_all Gtk.main �ruby-gnome2-all-2.2.5/gtk3/sample/misc/style_property.rb��������������������������������������������0000755�0001750�0001750�00000003200�11701304107�021317� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin style_property.rb - Ruby/GTK2 sample script. Copyright (c) 2004,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: style_property.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' class MyButton < Gtk::Button type_register def initialize(label = nil) # When type_register() is used. # super is equivalent to GLib::Object#initialize. super("label" => label) end install_style_property(GLib::Param::Int.new("foo", # name "Foo", # nick "FOO", # blurb 0, #min 100, #max 5, #default GLib::Param::READABLE | GLib::Param::WRITABLE)) do |pspec, str| p pspec, str str.to_i + 10 #return the converted value. end install_style_property(GLib::Param::Enum.new("bar", # name "Bar", # nick "BAR", # blurb GLib::Type["GdkCursorType"], #Enum type Gdk::Cursor::ARROW, #default GLib::Param::READABLE | GLib::Param::WRITABLE)) do |pspec, str| p pspec, str if str.strip! == "boat" Gdk::Cursor::BOAT else pspec.default end end end Gtk::RC.parse("./style_property.rc") win = Gtk::Window.new("Gtk::RC sample") b = MyButton.new("Hello") b.signal_connect("clicked"){ Gtk.main_quit } p MyButton.style_properties win.set_default_size(100, 100) win.add(b).show_all win.signal_connect("destroy"){ Gtk.main_quit } # You need to call them after "Gtk::Widget#show" # (Or in expose event). p b.style_get_property("foo") p cursor = b.style_get_property("bar") Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/frame.rb�����������������������������������������������������0000644�0001750�0001750�00000002773�12516434313�017330� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin frame.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: frame.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("buttons") window.signal_connect("destroy") do Gtk.main_quit end window.border_width = 0 box1 = Gtk::Box.new(:vertical, 0) window.add(box1) box2 = Gtk::Box.new(:horizontal, 5) box2.border_width = 10 box1.pack_start(box2, true, true, 0) label = Gtk::Label.new("Hello World") frame = Gtk::Frame.new("Frame 1") box2.pack_start(frame, true, true, 0) box3 = Gtk::Box.new(:vertical, 5) box3.border_width = 5 frame.add(box3) button = Gtk::Button.new(:label => "switch") button.signal_connect("clicked") do label.reparent(box3) end box3.pack_start(button, false, true, 0) box3.pack_start(label, false, true, 0) frame = Gtk::Frame.new("Frame 2") box2.pack_start(frame, true, true, 0) box4 = Gtk::Box.new(:vertical, 5) box4.border_width = 5 frame.add(box4) button = Gtk::Button.new(:label => "switch") button.signal_connect("clicked") do label.reparent(box4) end box4.pack_start(button, false, true, 0) separator = Gtk::Separator.new(:horizontal) box1.pack_start(separator, false, true, 0) box2 = Gtk::Box.new(:horizontal, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button = Gtk::Button.new(:label => "close") button.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(button) window.show_all Gtk.main �����ruby-gnome2-all-2.2.5/gtk3/sample/misc/scalebutton.rb�����������������������������������������������0000664�0001750�0001750�00000001061�11740310343�020542� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin scalebutton.rb - Very simple Gtk::ScaleButton example. Copyright (c) 2007 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: scalebutton.rb,v 1.1 2007/07/12 14:04:54 ggc Exp $ =end require 'gtk3' window = Gtk::Window.new window.add(scale = Gtk::ScaleButton.new(Gtk::IconSize::IconSize::BUTTON)) scale.set_icons(['gtk-goto-bottom', 'gtk-goto-top', 'gtk-execute']) scale.signal_connect('value-changed') { |widget, value| puts "value changed: #{value}" } window.show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/recentchooserdialog.rb���������������������������������������0000664�0001750�0001750�00000002572�11740310343�022252� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin recentchooserdialog.rb - Ruby/GTK2 sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: recentchooserdialog.rb,v 1.2 2006/11/15 23:46:13 mutoh Exp $ =end require 'gtk3' dialog = Gtk::RecentChooserDialog.new(:title => "Recent Chooser Dialog Sample", :buttons => [[Gtk::Stock::CANCEL, Gtk::Dialog::ResponseType::CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::ResponseType::ACCEPT]]) dialog.signal_connect("response") do |widget, response| case response when Gtk::Dialog::ResponseType::ACCEPT info = dialog.current_item if info puts "----" puts info.uri puts info.display_name puts info.description puts info.mime_type puts info.added puts info.modified puts info.visited puts info.private_hint? p info.application_info("gedit") p info.applications puts info.last_application p info.groups puts info.has_group?("web") puts info.has_application?("gedit") puts info.get_icon(64) puts info.short_name puts info.uri_display puts info.age puts info.local? puts info.exist? end else p "Close" dialog.destroy Gtk.main_quit end end dialog.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/helloworld.rb������������������������������������������������0000644�0001750�0001750�00000001247�12516434313�020404� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin helloworld.rb - Ruby/GTK2 first sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: helloworld.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' button = Gtk::Button.new(:label => "Hello World") button.signal_connect("clicked") { puts "Hello World" } window = Gtk::Window.new("Hello World sample") window.signal_connect("delete_event") { puts "delete event occurred" #true false } window.signal_connect("destroy") { puts "destroy event occurred" Gtk.main_quit } window.border_width = 10 window.add(button) window.show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/stock.rb�����������������������������������������������������0000644�0001750�0001750�00000001434�11701304107�017342� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin stock.rb - Gtk::Stock sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: stock.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::Stock sample") window.signal_connect("destroy"){Gtk.main_quit} stocks = Gtk::Stock.constants.sort image = Gtk::Image.new label = Gtk::Label.new button = Gtk::Button.new("Click!") cnt = 0 button.signal_connect("clicked") do stock_name = "Gtk::Stock::#{stocks[cnt]}" label.set_text(stock_name) image.set(eval(stock_name), Gtk::IconSize::DIALOG) if cnt < stocks.size - 1 cnt += 1 else cnt = 0 end end box = Gtk::VBox.new.add(image).add(label).add(button) window.add(box).set_default_size(200,200).show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/treemodelfilter.rb�������������������������������������������0000664�0001750�0001750�00000002330�11740310343�021405� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin treemodelfilter.rb - Gtk::TreeModelFilter sample Copyright (c) 2004,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: treemodelfilter.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' ls = Gtk::ListStore.new(String, Integer) column1 = Gtk::TreeViewColumn.new("data1", Gtk::CellRendererText.new, {:text => 0}) column2 = Gtk::TreeViewColumn.new("data2", Gtk::CellRendererText.new, {:text => 1}) mf = Gtk::TreeModelFilter.new(ls) mf.set_visible_func do |model, iter| /a/ =~ iter[0] end mf.set_modify_func(String, String) do |model, iter, column| child_iter = model.convert_iter_to_child_iter(iter) if column == 0 child_iter[0] else "#{child_iter[1]} * 2 = #{child_iter[1] * 2}" end end treeview = Gtk::TreeView.new(mf) treeview.append_column(column1) treeview.append_column(column2) [ ["aaa", 1], ["aab", 2], ["aac", 3], ["bba", 4], ["bbb", 5], ["bbc", 6] ].each do |str, num| iter = ls.append iter[0] = str iter[1] = num end win = Gtk::Window.new("Gtk::TreeModelFilter sample") win.signal_connect("destroy"){Gtk.main_quit} win.add(treeview).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/misc_button.rb�����������������������������������������������0000664�0001750�0001750�00000002361�11740310343�020551� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin misc_button.rb - Ruby/GTK sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: misc_button.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' box = Gtk::Box.new(:vertical) #Gtk::ColorButton colorbutton = Gtk::ColorButton.new colorbutton.signal_connect("color-set") do p colorbutton.color.to_a end box.add(colorbutton) #Gtk::FontButton fontbutton = Gtk::FontButton.new fontbutton.signal_connect("font-set") do p fontbutton.font_name end box.add(fontbutton) #Gtk::FileChooserButton filebutton = Gtk::FileChooserButton.new("Gtk::FileChooserButton", Gtk::FileChooser::Action::OPEN) filebutton.filename = GLib.home_dir filebutton.signal_connect("current-folder-changed") do |w, e| p filebutton.filename end box.add(filebutton) #Quit quitbutton = Gtk::Button.new(:label => "Quit") quitbutton.signal_connect("clicked") do Gtk.main_quit end box.add(quitbutton) Gtk::Window.new.add(box).set_default_size(200, 100).show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/threads.rb���������������������������������������������������0000644�0001750�0001750�00000002537�12416346617�017676� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin threads.rb - Ruby/GTK2 sample script. Copyright (c) 2003-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: threads.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" require "thread" label = Gtk::Label.new Thread.new do (0...1000).each do |cnt| p "A:" + cnt.to_s label.label = "A:" + cnt.to_s sleep(2) end end start_button = Gtk::Button.new("start") stop_button = Gtk::Button.new("stop") start_button.signal_connect("clicked") do start_button.sensitive = false @th = Thread.new do (0...10).each do |cnt| p "B:" + cnt.to_s label.label = "B:" + cnt.to_s sleep(2) end @th = nil start_button.sensitive = true start_button.grab_focus stop_button.sensitive = false end stop_button.sensitive = true stop_button.grab_focus end stop_button.signal_connect("clicked") do if @th @th.kill puts "killed" @th = nil start_button.sensitive = true start_button.grab_focus stop_button.sensitive = false end end stop_button.sensitive = false box = Gtk::VBox.new box.set_size_request(100, 100) box << label << start_button << stop_button win = Gtk::Window.new << box win.show_all.signal_connect("delete_event") do p "Exiting..." Gtk.main_quit Thread.list.each {|t| t.kill} end Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/xbm_cursor.rb������������������������������������������������0000644�0001750�0001750�00000003123�11701304107�020377� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin xbm_cursor.rb - Gdk::Cursor sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: xbm_cursor.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' cursor_bits = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xe0, 0x78, 0x00, 0xe0, 0x70, 0x00, 0xe0, 0x70, 0x00, 0xe0, 0x38, 0x00, 0xe0, 0x1f, 0x00, 0xe0, 0x1d, 0x00, 0xe0, 0x38, 0x00, 0xe0, 0x78, 0x00, 0xe0, 0xf0, 0x00, 0xf0, 0xf3, 0x01, 0xf0, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].pack("c*") cursor_mask_bits = [ 0x63, 0x8e, 0x0f, 0x67, 0x8e, 0x0f, 0x06, 0xc6, 0x07, 0x04, 0x00, 0x00, 0xf0, 0x3f, 0x08, 0xe7, 0x78, 0x0e, 0xe7, 0x70, 0x0f, 0xe4, 0x70, 0x03, 0xe0, 0x38, 0x00, 0xe7, 0x1f, 0x0c, 0xe7, 0x1d, 0x0f, 0xe0, 0x38, 0x0e, 0xe0, 0x78, 0x08, 0xe7, 0xf0, 0x00, 0xf7, 0xf3, 0x01, 0xf0, 0xe3, 0x01, 0x04, 0x00, 0x00, 0x46, 0x24, 0x06, 0x67, 0x66, 0x0e, 0x67, 0x66, 0x0e].pack("c*") window = Gtk::Window.new("Gdk::Cursor sample") window.signal_connect("destroy"){Gtk.main_quit} window.realize source = Gdk::Pixmap.create_from_data(window.window, cursor_bits, 19, 19) mask = Gdk::Pixmap.create_from_data(window.window, cursor_mask_bits, 19, 19) fg = Gdk::Color.new(65535, 0, 0) bg = Gdk::Color.new(65535, 65535, 0) cursor = Gdk::Cursor.new(source, mask, fg, bg, 10, 10) window.window.set_cursor(cursor) window.add(Gtk::Label.new("Put your cursor on this window.")) window.set_default_size(200, 100).show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/rgtk+cairo.rb������������������������������������������������0000775�0001750�0001750�00000001726�11740310343�020272� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin rgtk+cairo.rb - Ruby/GTK2 using Ruby/Cairo sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. Heavily inspired from png.rb example of rcairo. $Id: rgtk+cairo.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' require 'cairo' w = Gtk::Window.new.add(vb = Gtk::Box.new(:vertical)) vb.add(da = Gtk::DrawingArea.new) da.set_size_request(200, 200) da.signal_connect('draw') { |widget, cr| # fill background with white cr.set_source_rgba(1.0, 1.0, 1.0) cr.paint # create shape cr.move_to(50, 50) cr.curve_to(100, 25, 100, 75, 150, 50) cr.line_to(150, 150) cr.line_to(50, 150) cr.close_path cr.set_source_rgb(0.0, 0.0, 0.0) cr.fill_preserve cr.set_source_rgb(1.0, 0.0, 0.0) cr.set_line_join(Cairo::LINE_JOIN_MITER) cr.set_line_width(4) cr.stroke } w.signal_connect("destroy"){Gtk.main_quit} w.show_all Gtk.main ������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/button.rb����������������������������������������������������0000644�0001750�0001750�00000003530�12416346617�017551� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin button.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: button.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" window = Gtk::Window.new("buttons") window.border_width = 0 window.signal_connect("delete_event") do Gtk.main_quit end box1 = Gtk::Box.new(:vertical, 0) window.add(box1) table = Gtk::Table.new(3, 3, false) table.set_row_spacings(5) table.set_column_spacings(5) table.set_border_width(10) box1.pack_start(table, :expand => true, :fill => true, :padding => 0) button = [] 0.upto(8) do |i| button.push Gtk::Button.new(:label => "button"+(i+1).to_s) end 0.upto(8) do |i| button[i].signal_connect("clicked") do |w| p [i] j = (i + 1) % 9 if button[j].visible? button[j].hide else button[j].show end end button[i].show end table.attach(button[0], 0, 1, 0, 1, nil, nil, 0, 0) table.attach(button[1], 1, 2, 1, 2, nil, nil, 0, 0) table.attach(button[2], 2, 3, 2, 3, nil, nil, 0, 0) table.attach(button[3], 0, 1, 2, 3, nil, nil, 0, 0) table.attach(button[4], 2, 3, 0, 1, nil, nil, 0, 0) table.attach(button[5], 1, 2, 2, 3, nil, nil, 0, 0) table.attach(button[6], 1, 2, 0, 1, nil, nil, 0, 0) table.attach(button[7], 2, 3, 1, 2, nil, nil, 0, 0) table.attach(button[8], 0, 1, 1, 2, nil, nil, 0, 0) separator = Gtk::Separator.new(:vertical) box1.pack_start(separator, :expand => false, :fill => true, :padding => 0) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2, :expand => false, :fill => true, :padding => 0) close = Gtk::Button.new(:label => "close") close.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(close, :expand => true, :fill => true, :padding => 0) close.can_default = true close.grab_default window.show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/cursor.rb����������������������������������������������������0000644�0001750�0001750�00000001475�12416346617�017561� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin cursor.rb - Gdk::Cursor sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: cursor.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" window = Gtk::Window.new("Gdk::Cursor sample") window.signal_connect('destroy') {Gtk.main_quit} window.realize button = Gtk::Button.new(:label => "Click!") button.use_underline = false cursors = Gdk::Cursor::Type.values - [Gdk::Cursor::Type::CURSOR_IS_PIXMAP] cursors -= [Gdk::Cursor::Type::LAST_CURSOR] cnt = 0 button.signal_connect('clicked') do cursor = cursors[cnt] p cursor.inspect button.set_label(cursor.inspect) window.window.set_cursor(Gdk::Cursor.new(cursor)) cnt += 1 cnt = 0 if cnt == cursors.size end window.add(button) window.set_default_size(400,100).show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/colorselection.rb��������������������������������������������0000644�0001750�0001750�00000000751�12516434313�021254� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin colorselection.rb - Gtk::ColorSelection sample script. Copyright (C) 2005,2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: colorselection.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" a = Gtk::ColorSelection.new a.has_palette = true a.signal_connect("color_changed") do |w| unless w.adjusting? p w.current_rgba.to_s end end Gtk::Window.new.add(a).show_all.signal_connect("destroy") {Gtk.main_quit} Gtk.main �����������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/checkbutton.rb�����������������������������������������������0000644�0001750�0001750�00000002034�12516434313�020535� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin checkbutton.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: checkbutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" window = Gtk::Window.new("check buttons") window.border_width = 0 window.signal_connect("delete_event") do Gtk.main_quit end box1 = Gtk::Box.new(:vertical) window.add(box1) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2) button1 = Gtk::CheckButton.new("_button1") button2 = Gtk::CheckButton.new("_button2", false) button3 = Gtk::CheckButton.new(Gtk::Stock::QUIT) box2.add(button1) box2.add(button2) box2.add(button3) box1.pack_start(Gtk::Separator.new(:horizontal)) box2 = Gtk::Box.new(:vertical, 10) box2.border_width = 10 box1.pack_start(box2) close = Gtk::Button.new(:label => "close") close.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(close) close.can_default = true close.grab_default window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/expander.rb��������������������������������������������������0000644�0001750�0001750�00000001144�12516434313�020033� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin expander.rb - Ruby/GTK2 sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: expander.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' expander = Gtk::Expander.new("Expander Sample") expander.expanded = true button = Gtk::Button.new(:label => "Hide this button.") button.signal_connect("clicked") do expander.expanded = false end button.set_size_request(200, 200) expander.add(button) Gtk::Window.new.add(expander).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/image.rb�����������������������������������������������������0000644�0001750�0001750�00000001506�12516434313�017311� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin image.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: image.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Image") window.signal_connect("destroy") do Gtk.main_quit end window.border_width = 0 box1 = Gtk::Box.new(:vertical, 10) box1.border_width = 10 button = Gtk::Button.new box1.add(button) label = Gtk::Label.new("Gtk::Image\ntest") image = Gtk::Image.new(:file => "test.xpm") box2 = Gtk::Box.new(:horizontal, 5).add(image).add(label) button.add(box2) box1.add(Gtk::Separator.new(:horizontal)) button = Gtk::Button.new(:label => "close") button.signal_connect("clicked") do Gtk.main_quit end box1.add(button) window.add(box1).show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/keyboard_grab.rb���������������������������������������������0000644�0001750�0001750�00000001424�11701304107�021011� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin keyboard_grab.rb - Gdk::Window#keyboard_grab/ungrab sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME. $Date: 2006/06/17 13:18:12 $ $Id: keyboard_grab.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Keyboard Grab/Ungrab sample") button1 = Gtk::Button.new("Grab Keyboard!") button2 = Gtk::Button.new("Ungrab Keyboard!") button1.signal_connect('clicked') do Gdk.keyboard_grab(window.window, true, Gdk::Event::CURRENT_TIME) end button2.signal_connect('clicked') do Gdk.keyboard_ungrab(Gdk::Event::CURRENT_TIME) end window.add(Gtk::VBox.new.add(button1).add(button2)) window.set_default_size(200,100).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/treeview.rb��������������������������������������������������0000664�0001750�0001750�00000003645�11740310343�020063� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin treeview.rb - Gtk::TreeView sample Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: treeview.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::TreeView sample") # Create data model = Gtk::TreeStore.new(String, String, Gdk::Color, Float, Gdk::Pixbuf) # column 1 root_iter = model.append(nil) root_iter[0] = "Root" root_iter[1] = "red" root_iter[2] = Gdk::Color.new(0, 65535, 0) root_iter[3] = 5.0 # column 2 root_iter[4] = window.render_icon_pixbuf(Gtk::Stock::NEW, Gtk::IconSize::IconSize::DIALOG) child_iter1 = model.append(root_iter) child_iter1[0] = "Child_Iter1" child_iter1[1] = "green" child_iter1[2] = Gdk::Color.new(65535, 0, 0) child_iter1[3] = 3.0 # column 2 child_iter1[4] = window.render_icon_pixbuf(Gtk::Stock::OPEN, Gtk::IconSize::IconSize::MENU) child_iter2 = model.append(root_iter) child_iter2[0] = "Child_Iter2" child_iter2[1] = "yellow" child_iter2[2] = Gdk::Color.new(0, 0, 65535) child_iter2[3] = 0.9 # column 2 child_iter2[4] = window.render_icon_pixbuf(Gtk::Stock::QUIT, Gtk::IconSize::IconSize::BUTTON) # Create view tv = Gtk::TreeView.new(model) # column 1 renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new("Gtk::CellRenderText", renderer, { :text => 0, :background => 1, :foreground_gdk => 2, :scale => 3, }) tv.append_column(column) # column 2 renderer = Gtk::CellRendererPixbuf.new column = Gtk::TreeViewColumn.new("Gtk::CellRenderPixbuf", renderer, { :pixbuf => 4 }) tv.append_column(column) window.add(tv).set_default_size(300, 300).show_all window.signal_connect("destroy"){Gtk.main_quit} Gtk.main �������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/bindings.rb��������������������������������������������������0000755�0001750�0001750�00000005232�12516434313�020027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin bindings.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: bindings.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end =begin Usage: bindings.rb <filename> Following key bindings are effective in the TextView area. <space> : scroll down by one page <backspace> : scroll up by one page j : move cursor donw by one line k : move cursor up by one line clicking buttons cause following effect "space" : same as pressing <space> in text view area. "back_space" : same as pressing <backspace> in text view area. "cancel j/k" : disable 'j' and 'k' binding =end require "gtk3" class Pager < Gtk::TextView type_register # widget's key binding can be defined like this binding_set.add_signal(Gdk::Keyval::GDK_KEY_space, 0, "move_cursor", Gtk::MovementStep::PAGES, 1, false) binding_set.add_signal(Gdk::Keyval::GDK_KEY_BackSpace, 0, "move_cursor", Gtk::MovementStep::PAGES, -1, false) binding_set.add_signal(Gdk::Keyval::GDK_KEY_j, 0, "move_cursor", Gtk::MovementStep::DISPLAY_LINES, 1, false) binding_set.add_signal(Gdk::Keyval::GDK_KEY_k, 0, "move_cursor", Gtk::MovementStep::DISPLAY_LINES, -1, false) def initialize(path) @path = path super() @buffer = self.buffer load set_editable(false) set_size_request(400, 400) end def load open(@path).read.each_line do |line| @buffer.insert_at_cursor(line) end @buffer.place_cursor(@buffer.start_iter) end end path = ARGV[0] || __FILE__ window = Gtk::Window.new window.name = "pager_window" sw = Gtk::ScrolledWindow.new vbox = Gtk::Box.new(:vertical) hbox = Gtk::Box.new(:horizontal) pager = Pager.new(path) hbox.add(button1 = Gtk::Button.new(:label => "space")) hbox.add(button2 = Gtk::Button.new(:label => "back_space")) hbox.add(button3 = Gtk::Button.new(:label => "cancel j/k")) button1.signal_connect("clicked") do Pager.binding_set.activate(Gdk::Keyval::GDK_KEY_space, 0, pager) end button2.signal_connect("clicked") do pager.bindings_activate(Gdk::Keyval::GDK_KEY_BackSpace, 0) end button3.signal_connect("clicked") do Pager.binding_set.entry_remove(Gdk::Keyval::GDK_KEY_j, 0) Pager.binding_set.entry_remove(Gdk::Keyval::GDK_KEY_k, 0) end sw.add(pager) vbox.add(hbox).add(sw) window.add(vbox) window.show_all pager.grab_focus window.signal_connect("destroy") {Gtk.main_quit} Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/t-gtksocket.rb�����������������������������������������������0000664�0001750�0001750�00000003305�11740310343�020461� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin Sample script using Gtk::Socket and Gtk::Plug. $ ruby t-gtksocket.rb Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only. Copyright (c) 2003-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: t-gtksocket.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' class MyGtkSocket < Gtk::Window def initialize super("Gtk::Socket Test") set_window_position(Gtk::Window::Position::CENTER) signal_connect("delete_event"){Gtk::main_quit} @buttons = [] 6.times {|n| @buttons << Gtk::Button.new(:label => "Plug #{n}") @buttons.last.signal_connect("clicked"){ plug(n) } } @table = Gtk::Table.new(1, 2) @table.set_size_request(320, 200) add(@table) @vbox = Gtk::Box.new(:vertical, 5) @buttons.each{|b| @vbox.add(b) } @vbox.set_size_request(150, 190) @table.attach(@vbox, 0, 1, 0, 1, :fill, :fill, 5, 5) @socket = Gtk::Socket.new @table.attach(@socket, 1, 2, 0, 1, :fill, :fill, 5, 5) @socket.set_size_request(150, 150) show_all @xid = @socket.id @pid = 0 end def plug(arg) if @pid != 0 Process.kill("SIGKILL", @pid) Process.waitpid(@pid) begin @table.remove(@socket) unless @socket.destroyed? rescue ArgumentError # socket has been destroyed because child process finished unexpectedly end @socket = Gtk::Socket.new @table.attach(@socket, 1, 2, 0, 1, :fill, :fill, 5, 5) @socket.set_size_request(150, 190) @socket.show @xid = @socket.id end @pid = fork { exec "ruby t-gtkplug.rb -x #{@xid} Plug#{arg}" } end end MyGtkSocket.new Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/pangorenderer.rb���������������������������������������������0000644�0001750�0001750�00000003332�12516434313�021061� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin pangorenderer.rb - Ruby/GTK sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: pangorenderer.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' RADIUS = 80 N_WORDS = 16 if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end win = Gtk::Window.new("Gdk::PangoRenderer sample") win.signal_connect("destroy"){Gtk.main_quit} win.set_default_size(400, 400) win.realize matrix = Pango::Matrix.new renderer = Gdk::PangoRenderer.default renderer.drawable = win.window renderer.gc = Gdk::GC.new(win.window) width, height = win.size device_radius = [width, height].min / 6.0 matrix.translate!(device_radius + (width - 2 * device_radius) / 2.0, device_radius + (height - 2 * device_radius) / 2.0) matrix.scale!(device_radius / RADIUS, device_radius / RADIUS) context = Gdk::Pango.context layout = Pango::Layout.new(context) layout.text = "Ruby-GNOME2" layout.font_description = Pango::FontDescription.new("Sans Bold 14") background = Gdk::Color.new(65535, 65535, 65535) Gdk::Colormap.system.alloc_color(background, false, true) win.window.background = background win.signal_connect("draw") do (0...N_WORDS).each do |i| rotated_matrix = matrix.dup angle = 360 * i / N_WORDS.to_f color = Gdk::Color.new(65535 * rand, 65535 * rand, 65535 * rand) renderer.set_override_color(Pango::Renderer::PART_FOREGROUND, color) rotated_matrix.rotate!(angle) context.set_matrix(rotated_matrix) layout.context_changed width, height = layout.size renderer.draw_layout(layout, width / 2, RADIUS * Pango::SCALE) end end win.show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/pointer_grab.rb����������������������������������������������0000644�0001750�0001750�00000001713�11701304107�020672� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin pointer_grab.rb - Gdk::Window#pointer_grab/ungrab sample script. Copyright (C) 2001-2006 Masao Mutoh<mutoh@highway.ne.jp> This program is licenced under the same licence as Ruby-GNOME. $Date: 2006/06/17 13:18:12 $ $Id: pointer_grab.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Pointer grab/ungrab sample") cursor = Gdk::Cursor.new(Gdk::Cursor::WATCH) button1 = Gtk::Button.new("Grab Window!") button2 = Gtk::Button.new("Ungrab Window!") button1.signal_connect('clicked') do Gdk.pointer_grab(window.window, true, Gdk::Event::BUTTON_PRESS_MASK, window.window, cursor, Gdk::Event::CURRENT_TIME) p Gdk.pointer_is_grabbed? end button2.signal_connect('clicked') do Gdk.pointer_ungrab(Gdk::Event::CURRENT_TIME) p Gdk.pointer_is_grabbed? end window.add(Gtk::VBox.new.add(button1).add(button2)) window.set_default_size(200,100).show_all window.signal_connect("destroy"){Gtk.main_quit} Gtk.main �����������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/mouse-gesture.rb���������������������������������������������0000644�0001750�0001750�00000023644�12307003726�021040� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin mouse-gesture.rb - mouse gesture sample script. Copyright (C) 2005,2006 Kouhei Sutou This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: mouse-gesture.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' unless Gdk.cairo_available? STDERR.puts("need cairo and rcairo support for this sample") exit 1 end class GestureProcessor DEFAULT_THRESHOLD = 16 DEFAULT_SKEW_THRESHOLD_ANGLE = 30 attr_accessor :threshold, :skew_threshold_angle attr_reader :motions def initialize(threshold=nil, skew_threshold_angle=nil) @threshold = threshold || DEFAULT_THRESHOLD @skew_threshold_angle = skew_threshold_angle @skew_threshold_angle ||= DEFAULT_SKEW_THRESHOLD_ANGLE reset end def started? @started end MOTIONS = %w(L R U D UL UR LL LR) def available_motion?(motion) MOTIONS.include?(motion) end def start(x, y) @prev_x = @x = x @prev_y = @y = y @started = true @motions = [] end def update_position(x, y) mx = x - @prev_x my = y - @prev_y motion = judge_motion(mx, my) if motion @prev_x = @x = x @prev_y = @y = y if @motions.last == motion false else @motions << motion true end else false end end def reset @started = false @x = @y = -1 @motions = [] end def to_a @motions end def position [@x, @y] end private def judge_motion(mx, my) mxa = mx.abs mya = my.abs distance = Math.sqrt(mxa ** 2 + mya ** 2) upper_theta = (45 + @skew_threshold_angle) * (Math::PI / 180.0) lower_theta = (45 - @skew_threshold_angle) * (Math::PI / 180.0) if distance > @threshold and mya < Math.tan(upper_theta) * mxa and mya > Math.tan(lower_theta) * mxa judge_corner_motion(mx, my) elsif mxa > @threshold or mya > @threshold judge_cross_motion(mx, my) else nil end end def judge_corner_motion(mx, my) if mx < 0 if my < 0 "UL" else "LL" end else if my < 0 "UR" else "LR" end end end def judge_cross_motion(mx, my) if mx.abs > my.abs if mx < 0 "L" else "R" end else if my < 0 "U" else "D" end end end end class Gesture < Gtk::EventBox DEFAULT_BACK_RGBA = [0.2, 0.2, 0.2, 0.5] DEFAULT_LINE_RGBA = [1, 0, 0, 1] DEFAULT_NEXT_RGBA = [0, 1, 0, 0.8] DEFAULT_CURRENT_RGBA = [1, 0, 1, 0.8] def initialize(conf={}) super() set_visible_window(false) conf ||= {} @back_rgba = conf[:back_rgba] || DEFAULT_BACK_RGBA @line_rgba = conf[:line_rgba] || DEFAULT_LINE_RGBA @next_rgba = conf[:next_rgba] || DEFAULT_NEXT_RGBA @current_rgba = conf[:current_rgba] || DEFAULT_CURRENT_RGBA @processor = GestureProcessor.new(conf[:threshold], conf[:skew_threshold_angle]) @actions = [] set_expose_event set_motion_notify_event set_button_release_event end def add_action(sequence, action=Proc.new) invalid_motion = sequence.find do |motion| not @processor.available_motion?(motion) end raise "invalid motion: #{invalid_motion}" if invalid_motion @actions << [sequence, action] end def start(widget, button, x, y, base_x, base_y) Gtk.grab_add(self) @widget = widget @button = button @processor.start(x, y) @base_x = base_x @base_y = base_y @cr = window.create_cairo_context @cr.set_source_rgba(@line_rgba) @cr.move_to(x, y) end private def perform_action act = action act.call(@widget) if act @processor.reset end def action motions = @processor.motions @actions.each do |sequence, act| return act if sequence == motions end nil end def available_motions motions = @processor.motions @actions.collect do |sequence, act| if sequence == motions sequence.last else nil end end.compact.uniq end def next_available_motions motions = @processor.motions @actions.collect do |sequence, act| if sequence[0..-2] == motions sequence.last else nil end end.compact.uniq end def match? not action.nil? end def set_expose_event signal_connect("draw") do |widget, event| if @processor.started? cr = widget.window.create_cairo_context cr.rectangle(*widget.allocation.to_a) cr.set_source_rgba(@back_rgba) cr.fill cr.set_source_rgba(@next_rgba) draw_available_marks(cr, next_available_motions) if action cr.set_source_rgba(@current_rgba) draw_mark(cr, *@processor.position) end @cr.stroke_preserve true else false end end end def draw_mark(cr, x=nil, y=nil, radius=nil) x ||= @processor.position[0] y ||= @processor.position[1] radius ||= @processor.threshold cr.save do cr.translate(x, y) cr.scale(radius, radius) cr.arc(0, 0, 0.5, 0, 2 * Math::PI) cr.fill end end def draw_available_marks(cr, motions) motions.each do |motion| adjust_x = calc_position_ratio(motion, %w(R), %w(L), %w(UR LR), %w(UL LL)) adjust_y = calc_position_ratio(motion, %w(D), %w(U), %w(LR LL), %w(UR UL)) threshold = @processor.threshold x, y = @processor.position x += threshold * adjust_x y += threshold * adjust_y draw_mark(cr, x, y, threshold) end end def calc_position_ratio(motion, inc, dec, inc_skew, dec_skew) case motion when *inc 1 when *inc_skew 1 / Math.sqrt(2) when *dec -1 when *dec_skew -1 / Math.sqrt(2) else 0 end end def set_motion_notify_event signal_connect("motion_notify_event") do |widget, event| if @processor.started? x = @base_x + event.x y = @base_y + event.y @cr.line_to(x, y) @cr.save do if @processor.update_position(x, y) queue_draw end end @cr.stroke_preserve true else false end end end def set_button_release_event signal_connect("button_release_event") do |widget, event| if event.button == @button and @processor.started? Gtk.grab_remove(self) perform_action hide true else false end end end end class GesturedWidget < Gtk::EventBox DEFAULT_GESTURE_BUTTON = 3 def initialize(gesture_button=nil) super() set_visible_window(false) @gesture_button = gesture_button || DEFAULT_GESTURE_BUTTON set_button_press_event end def layout parent end def gesture(x, y, base_x, base_y) if layout layout.gesture(self, @gesture_button, x, y, base_x, base_y) end end private def set_button_press_event signal_connect("button_press_event") do |widget, event| if event.button == @gesture_button x, y, w, h = widget.allocation.to_a gesture(x + event.x, y + event.y, x, y) else false end end end end class Layout < Gtk::Layout def initialize() super() @gesture = Gesture.new() put(@gesture, 0, 0) end def gesture(widget, button, x, y, base_x, base_y) remove(@gesture) put(@gesture, 0, 0) _, _, w, h = allocation.to_a @gesture.set_size_request(w, h) @gesture.show @gesture.start(widget, button, x, y, base_x, base_y) end def add_gesture_action(sequence, action=Proc.new) @gesture.add_action(sequence, action) end end window = Gtk::Window.new("Mouse Gesture sample") layout = Layout.new gestured_widget = GesturedWidget.new gestured_widget.set_size_request(50, 50) gestured_widget.signal_connect("draw") do |widget, event| x, y, w, h = widget.allocation.to_a cr = widget.window.create_cairo_context cr.set_source_rgba([0.8, 0.8, 0.3, 1]) cr.translate(x, y) cr.scale(w, h) cr.arc(0.5, 0.5, 0.5, -0.1, 360) cr.fill false end layout.put(gestured_widget, 75, 75) gestured_widget2 = GesturedWidget.new gestured_widget2.set_size_request(100, 50) gestured_widget2.signal_connect("draw") do |widget, event| x, y, w, h = widget.allocation.to_a cr = widget.window.create_cairo_context cr.set_source_rgba([0.3, 0.3, 0.8, 1]) cr.translate(x, y) cr.scale(w, h) cr.arc(0.5, 0.5, 0.5, -0.1, 360) cr.fill false end layout.put(gestured_widget2, 0, 25) # gesture handlers expand_size = 20 expand_left = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x - expand_size, y) widget.set_size_request(w + expand_size, h) end expand_right = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x, y) widget.set_size_request(w + expand_size, h) end expand_top = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x, y - expand_size) widget.set_size_request(w, h + expand_size) end expand_bottom = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x, y) widget.set_size_request(w, h + expand_size) end layout.add_gesture_action(["L"]) do |widget| expand_left.call(widget) end layout.add_gesture_action(["U"]) do |widget| expand_top.call(widget) end layout.add_gesture_action(["LL"]) do |widget| expand_left.call(widget) expand_bottom.call(widget) end layout.add_gesture_action(["R", "LR"]) do |widget| expand_right.call(widget) expand_bottom.call(widget) expand_right.call(widget) end window.add(layout) window.signal_connect("destroy"){Gtk.main_quit} window.show_all Gtk.main ��������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/properties.rb������������������������������������������������0000755�0001750�0001750�00000004345�12307003726�020430� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin properties.rb - GLib::Object#properties and Gtk::Container#child_properties sample script. Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: properties.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' class MyButton < Gtk::Button type_register def initialize(label = nil) # XXX: # When type_register() is used. # super is equivalent to GLib::Object#initialize. super("label" => label) @fuga = 0 @hoge = 0 end # define new property "fuga" install_property(GLib::Param::Int.new("fuga", # name "Fuga", # nick "fuga fuga", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE | GLib::Param::WRITABLE)) # define new property "hoge" install_child_property(GLib::Param::Int.new("hoge", # name "Hoge", # nick "hoge hoge", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE | GLib::Param::WRITABLE)) # implementation of the property "fuga" def fuga puts "MyButton#fuga is called" @fuga end def fuga=(arg) puts "MyButton#fuga= is called" @fuga = arg notify("fuga") end # implementation of the property "hoge" def get_hoge(child) puts "MyButton#get_hoge is called" @hoge end def set_hoge(child, arg) puts "MyButton#set_hoge is called" @hoge = arg end end b = MyButton.new("Hello") p b p b.label p b.gtype p MyButton.properties p b.get_property("fuga") b.set_property("fuga", 1) p b.get_property("fuga") p MyButton.child_properties p child = b.child p b.child_get_property(child, "hoge") b.child_set_property(child, "hoge", 2) p b.child_get_property(child, "hoge") p MyButton.ancestors �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/itemfactory.rb�����������������������������������������������0000644�0001750�0001750�00000005323�11701304107�020546� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin itemfactory.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. *NOTE* Gtk::ItemFactory has been deprecated. Use Gtk::UIManager instead. $Id: itemfactory.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' puts "Deprecated. Use Gtk::UIManager instead." window = Gtk::Window.new("Gtk::ItemFactory") window.signal_connect("destroy") do Gtk.main_quit end window.signal_connect("delete_event") do Gtk.main_quit end accelgroup = Gtk::AccelGroup.new window.add_accel_group(accelgroup) ifp = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, "<main>", accelgroup) cal_stock = Proc.new {|d, item| p "StockItem, #{d}"} cal_quit = Proc.new{p "Quit"; Gtk.main_quit} cal_check = Proc.new {|d, item| p "CheckItem, #{d}"} cal_toggle = Proc.new {|d, item| p "ToggleItem, #{d}"} cal_radio = Proc.new {|d, item| p "RadioItem, #{d}"} cal_misc = Proc.new {|d, item| p "Misc #{d}"} ifp.create_items([ ["/_Stock"], ["/_Stock/_New", "<StockItem>", "<control>N", Gtk::Stock::NEW, cal_stock, 1], ["/_Stock/_Open", "<StockItem>", "<control>O", Gtk::Stock::OPEN, cal_stock, 2], ["/_Stock/_Quit", "<StockItem>", "<control>Q", Gtk::Stock::QUIT, cal_quit], ["/_Check"], ["/_Check/Check_1", "<CheckItem>", "", "", cal_check, 1], ["/_Check/Check_2", "<CheckItem>", "", "", cal_check, 2], ["/_Toggle"], ["/_Toggle/Toggle_1", "<ToggleItem>", "", "", cal_toggle, 1], ["/_Toggle/Toggle_2", "<ToggleItem>", "", "", cal_toggle, 2], ["/_Toggle/Toggle_3", "<ToggleItem>", "", "", cal_toggle, 3], ["/_Radio", "<Branch>"], ["/_Radio/Radio_1", "<RadioItem>", nil, nil, cal_radio, 1], ["/_Radio/Radio_2", "/Radio/Radio1", nil, nil, cal_radio, 2], ["/_Radio/Radio_3", "/Radio/Radio1", nil, nil, cal_radio, 3], ["/_Misc", "<LastBranch>"], ["/_Misc/Tearoff", "<Tearoff>"], ["/_Misc/Title", "<Title>"], ["/_Misc/Image", "<ImageItem>", "", Gdk::Pixbuf.new("gnome-logo-icon.png"), cal_misc, 1], ["/_Misc/Separator", "<Separator>"], ["/_Misc/Item", "<Item>", nil, nil, cal_misc, 2] ]) ifp.get_widget("/Stock/Open").sensitive = false ifp.delete_item("/Toggle/Toggle2") vbox = Gtk::VBox.new vbox.add(ifp.get_widget("<main>")) vbox.add(Gtk::Label.new("Gtk::ItemFactory sample").set_size_request(400, 200)) window.add(vbox) window.show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/cairo-pong.rb������������������������������������������������0000755�0001750�0001750�00000010650�12516434313�020270� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin cairo-pong.rb - Ruby/GTK with cairo sample script. Original: gtkcairo sample by Evan Martins. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: cairo-pong.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" unless Gdk.cairo_available? raise "GTK+ 2.8.0 or later and cairo support are required." end module Pong class CenteredItem attr_accessor :x, :y attr_reader :width, :height def initialize(x, y, width, height) @x = x @y = y @width = width @height = height end def min_x @x - @width / 2 end def max_x @x + @width / 2 end def min_y @y - @height / 2 end def max_y @y + @height / 2 end end class CenteredCircle < CenteredItem def draw(cr) cr.translate(min_x, min_y) cr.scale(@width, @height) cr.arc(0.5, 0.5, 0.5, 0, 2 * Math::PI) cr.fill end end class CenteredRect < CenteredItem def draw(cr) cr.translate(min_x, min_y) cr.scale(@width, @height) cr.rectangle(0, 0, 1, 1) cr.fill end end class Ball < CenteredCircle attr_accessor :dx, :dy def initialize(dx=0.02, dy=0.02) super(0.8, 0.5, 0.04, 0.04) @dx = dx @dy = dy end def update @x += @dx @y += @dy # ball bouncing if max_y > 1 @y = 1 - (max_y - 1) @dy *= -1 elsif min_y < 0 @y -= min_y @dy *= -1 end if max_x > 1 @x = 1 - (max_x - 1) @dx *= -1 elsif min_x < 0 @x -= min_x @dx *= -1 end end end class Paddle < CenteredRect def initialize(field, x, y) super(x, y, 0.05, 0.3) @field = field end def update(ball) # is the ball coming towards us? if (ball.x < @x and ball.dx > 0) or (ball.x > @x and ball.dx < 0) # move to intercept it @y = ball.y end end def ball_hit?(ball) ball.y > min_y and ball.y < max_y end def update_ball(ball) if ball_hit?(ball) if ball.min_x < @x and ball.max_x > min_x # hit our left side ball.x -= (ball.max_x - min_x) ball.dx = -ball.dx elsif ball.max_x > @x and ball.min_x < max_x # hit our right side ball.x += (max_x - ball.min_x) ball.dx = -ball.dx end end end end class Field attr_accessor :width, :height def initialize(margin=0.05) @margin = margin @left_paddle = Paddle.new(self, @margin, 0.5) @right_paddle = Paddle.new(self, 1 - @margin, 0.7) @paddles = [@left_paddle, @right_paddle] @ball = Ball.new end def update @paddles.each do |paddle| paddle.update(@ball) end @ball.update @paddles.each do |paddle| paddle.update_ball(@ball) end end def draw(cr) cr.set_source_rgba(1, 1, 1) cr.rectangle(0, 0, 1, 1) cr.fill cr.save do cr.set_source_rgba(0.8, 0.8, 0.8, 0.8) cr.set_line_join(Cairo::LINE_JOIN_ROUND) @paddles.each do |paddle| cr.save {paddle.draw(cr)} end end cr.set_source_rgba(0, 0, 0) cr.save {@ball.draw(cr)} end end class Window < Gtk::Window def initialize(speed=30) super() @speed = speed self.title = "Pong Demonstration" signal_connect("destroy") { Gtk.main_quit } signal_connect("key_press_event") do |widget, event| if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q destroy true else false end end set_default_size(260, 200) @field = Field.new @drawing_area = Gtk::DrawingArea.new set_draw vb = Gtk::Box.new(:vertical, 5) vb.border_width = 10 vb.pack_start(@drawing_area, :expand => true, :fill => true, :padding => 0) vb.show_all add(vb) GLib::Timeout.add(@speed) do @field.update @drawing_area.queue_draw unless @drawing_area.destroyed? end end def set_draw @drawing_area.signal_connect("draw") do |widget, cr| window = widget.window cr.scale(window.width, window.height) @field.draw(cr) end end end end Pong::Window.new.show_all Gtk.main ����������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/combobox.rb��������������������������������������������������0000644�0001750�0001750�00000003477�12516434313�020050� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin combobox.rb - Ruby/GTK sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: combobox.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" if str = Gtk.check_version(3, 10, 7) puts "This sample requires GTK+ 3.10.7 or later" puts str exit end window = Gtk::Window.new("Gtk::ComboBox sample") window.signal_connect("destroy") {Gtk.main_quit} # # Text only # combo1 = Gtk::ComboBoxText.new ["foo", "bar", "fuga", "hoge"].each do |val| combo1.append_text(val) end combo1.active = 1 combo1.signal_connect("changed") do p "combo1: #{combo1.active}, #{combo1.active_iter[0]}" end # # Icon and text # model = Gtk::ListStore.new(Gdk::Pixbuf, String) [[Gtk::Stock::QUIT, "quit"], [Gtk::Stock::CANCEL, "cancel"], [Gtk::Stock::OK, "ok"]].each do |stock, name| iter = model.append iter[0] = window.render_icon_pixbuf(stock, Gtk::IconSize::IconSize::MENU) iter[1] = name end combo2 = Gtk::ComboBox.new(:model => model) # column 1 renderer = Gtk::CellRendererPixbuf.new combo2.pack_start(renderer, false) combo2.set_attributes(renderer, :pixbuf => 0) # column 2 renderer = Gtk::CellRendererText.new combo2.pack_start(renderer, true) combo2.set_attributes(renderer, :text => 1) combo2.active = 2 combo2.signal_connect("changed") do p "combo2: #{combo2.active}, #{combo2.active_iter[1]}" end # # Gtk::ComboBoxEntry # combo3 = Gtk::ComboBoxText.new(:entry => true) ["foo", "bar", "fuga", "hoge"].each do |val| combo3.append_text(val) end combo3.active = 1 combo3.signal_connect("changed") do if combo3.active_iter p "combo3: #{combo3.active}, #{combo3.active_iter[0]}" end end # Show main window vbox = Gtk::Box.new(:vertical) vbox.add(combo1).add(combo2).add(combo3) window.add(vbox).show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/composited-windows.rb����������������������������������������0000644�0001750�0001750�00000007151�12516434313�022067� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin composited-windows.rb - Sample script translated from http://library.gnome.org/devel/gdk/unstable/gdk-Windows.html#composited-window-example Copyright (c) 2008 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. =end require 'gtk3' if str = Gtk.check_version(2, 12, 0) puts "This sample requires GTK+ 2.12.0 or later." puts str exit end unless Gdk.cairo_available? puts "This sample requires Cairo support." exit end Gtk.init # Make the widgets button = Gtk::Button.new("A Button") event = Gtk::EventBox.new window = Gtk::Window.new(Gtk::Window::TOPLEVEL) # Put a red background on the window window.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.parse("red")) # Set the colourmap for the event box. Must be done before the event box is realised. event.colormap = event.screen.rgba_colormap # Set our event box to have a fully-transparent background # drawn on it. Currently there is no way to simply tell GTK+ # that "transparency" is the background colour for a widget. event.app_paintable = true event.signal_connect('draw') do |widget, event| # This function simply draws a transparency onto a widget on the area # for which it receives expose events. This is intended to give the # event box a "transparent" background. # # In order for this to work properly, the widget must have an RGBA # colourmap. The widget should also be set as app-paintable since it # doesn't make sense for GTK+ to draw a background if we are drawing it # (and because GTK+ might actually replace our transparency with its # default background colour). # cr = widget.window.create_cairo_context cr.operator = Cairo::OPERATOR_CLEAR cr.gdk_region(event.region) cr.fill false end # Put them inside one another window.border_width = 10 window.add(event) event.add(button) # Realize and show everything window.show_all # Set the event box GdkWindow to be composited. # Obviously must be performed after event box is realised. event.window.composited = true # Set up the compositing handler. # Note that we do _after_ so that the normal (red) background is drawn # by gtk before our compositing occurs. # window.signal_connect_after('draw') do |widget, event| # This function performs the actual compositing of the event box onto # the already-existing background of the window at 50% normal opacity. # # In this case we do not want app-paintable to be set on the widget # since we want it to draw its own (red) background. Because of this, # however, we must ensure that we use #signal_connect_after so that # this handler is called after the red has been drawn. If it was # called before then GTK would just blindly paint over our work. # # Note: if the child window has children, then you need a cairo 1.16 # feature to make this work correctly. # # get our child (in this case, the event box) child = widget.child # create a cairo context to draw to the window cr = widget.window.create_cairo_context # the source data is the (composited) event box # NOTICE: next line generates a GTK warning, it is maybe a GTK problem, it is tracked # at http://bugzilla.gnome.org/show_bug.cgi?id=526965 cr.set_source_pixmap(child.window, child.allocation.x, child.allocation.y) # draw no more than our expose event intersects our child region = Gdk::Region.new(Gdk::Rectangle.new(child.allocation.x, child.allocation.y, child.allocation.width, child.allocation.height)) region.intersect(event.region) cr.gdk_region(region) cr.clip # composite, with a 50% opacity cr.operator = Cairo::OPERATOR_OVER cr.paint(0.5) false end Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/uimanager.rb�������������������������������������������������0000644�0001750�0001750�00000010012�12516434313�020167� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin uimanager.rb - Copyright (C) 2004-2006 Masao Mutoh Original version is demos/gtk-demo/ui_manager.c. This program is licenced under the same licence as Ruby-GNOME2. $Id: uimanager.rb,v 1.6 2007/07/12 14:53:09 ggc Exp $ =end require 'gtk3' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end if not Gtk.check_version(2, 12, 0) recentmenuitem = "<menuitem name='recent' action='recent'/>" else recentmenuitem = "" end ui_info = %Q[ <ui> <menubar name='MenuBar'> <menu action='FileMenu'> <menuitem action='New'/> <menuitem action='Open'/> #{recentmenuitem} <menuitem action='Save'/> <menuitem action='SaveAs'/> <separator/> <menuitem action='Quit'/> </menu> <menu action='PreferencesMenu'> <menu action='ColorMenu'> <menuitem action='Red'/> <menuitem action='Green'/> <menuitem action='Blue'/> </menu> <menu action='ShapeMenu'> <menuitem action='Square'/> <menuitem action='Rectangle'/> <menuitem action='Oval'/> </menu> <menuitem action='Bold'/> </menu> <menu action='HelpMenu'> <menuitem action='About'/> </menu> </menubar> <toolbar name='ToolBar'> <toolitem action='Open'/> <toolitem action='Quit'/> <separator action='Sep1'/> <toolitem action='Logo'/> </toolbar> </ui>] callback = Proc.new {|actiongroup, action| puts "`#{action.name}' is clicked. " if action.is_a? Gtk::ToggleAction puts "active? = #{action.active?}" end } callback_quit = Proc.new { p "Quit is called." Gtk.main_quit } callback_radio = Proc.new {|action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" } actions = [ ["FileMenu", nil, "_File"], ["PreferencesMenu", nil, "_Preferences"], ["ColorMenu", nil, "_Color"], ["ShapeMenu", nil, "_Shape"], ["HelpMenu", nil, "_Help"], ["New", Gtk::Stock::NEW, "_New", "<control>N", "Create a new file", callback], ["Open", Gtk::Stock::OPEN, "_Open", "<control>O", "Open a file", callback], ["Save", Gtk::Stock::SAVE, "_Save", "<control>S", "Save current file", callback], ["SaveAs", Gtk::Stock::SAVE, "Save _As...", nil, "Save to a file", callback], ["Quit", Gtk::Stock::QUIT, "_Quit", "<control>Q", "Quit", callback_quit], ["About", nil, "_About", "<control>A", "About", callback], ["Logo", "demo-gtk-logo", nil, nil, "GTK+", callback] ] toggle_actions = [ ["Bold", Gtk::Stock::BOLD, "_Bold", "<control>B", "Bold", callback, true] ] color_radio_actions = [ ["Red", nil, "_Red", "<control>R", "Blood", 0], ["Green", nil, "_Green", "<control>G", "Grass", 1], ["Blue", nil, "_Blue", "<control>B", "Sky", 2] ] shape_radio_actions = [ ["Square", nil, "_Square", "<control>S", "Square", 0], ["Rectangle", nil, "_Rectangle", "<control>R", "Rectangle", 1], ["Oval", nil, "_Oval", "<control>O", "Egg", 2] ] window = Gtk::Window.new("Gtk::UIManager sample") actiongroup = Gtk::ActionGroup.new("Actions") actiongroup.add_actions(actions) actiongroup.add_toggle_actions(toggle_actions) actiongroup.add_radio_actions(color_radio_actions, 1) do |action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" end actiongroup.add_radio_actions(shape_radio_actions, 2, callback_radio) if not Gtk.check_version(2, 12, 0) action = Gtk::RecentAction.new('recent', 'Open Recent', nil, 'gtk-open') [ 'item-activated', 'activate' ].each { |signal| action.signal_connect(signal) { |action| puts "`Recent' #{signal}, uri=#{action.current_uri || 'no item selected'}" } } actiongroup.add_action(action) end uimanager = Gtk::UIManager.new uimanager.insert_action_group(actiongroup, 0) window.add_accel_group(uimanager.accel_group) uimanager.add_ui(ui_info) vbox = Gtk::VBox.new vbox.pack_start(uimanager["/MenuBar"], false, false) vbox.pack_start(Gtk::Label.new("Gtk::UIManager Sample")) window.add(vbox) window.set_default_size(100, 100).show_all window.signal_connect("destroy"){Gtk.main_quit} Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/togglebutton.rb����������������������������������������������0000664�0001750�0001750�00000001416�11740310343�020740� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin togglebutton.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: togglebutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::ToggleButton sample") window.border_width = 10 box = Gtk::Box.new(:vertical, 10) window.add(box) button1 = Gtk::ToggleButton.new("_button1") button2 = Gtk::ToggleButton.new("_button2",false) button3 = Gtk::ToggleButton.new(Gtk::Stock::QUIT) box.add(button1).add(button2).add(button3) box.pack_start(Gtk::Separator.new(:horizontal)) close = Gtk::Button.new(:label => "close") close.signal_connect("clicked") do Gtk.main_quit end box.add(close) window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/dialog.rb����������������������������������������������������0000644�0001750�0001750�00000002244�12516434313�017466� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin dialog.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: dialog.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" window = Gtk::Window.new("Gtk::Dialog sample") button = Gtk::Button.new(:label => "Create Dialog") button.signal_connect("clicked") do dialog = Gtk::Dialog.new dialog.title = "Gtk::Dialog Sample" dialog.transient_for = window dialog.set_default_size(300, 300) dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample")) dialog.add_button("OK", Gtk::ResponseType::OK) dialog.add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL) dialog.add_button(Gtk::Stock::CLOSE, Gtk::ResponseType::CLOSE) dialog.set_default_response(Gtk::ResponseType::CANCEL) dialog.signal_connect("response") do |widget, response| case response when Gtk::ResponseType::OK p "OK" when Gtk::ResponseType::CANCEL p "Cancel" when Gtk::ResponseType::CLOSE p "Close" dialog.destroy end end dialog.show_all end window.add(button).show_all.signal_connect("destroy") {Gtk.main_quit} Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/t-gtkplug.rb�������������������������������������������������0000664�0001750�0001750�00000002724�11740310343�020144� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin Sample script using Gtk::Socket and Gtk::Plug. $ ruby t-gtksocket.rb Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only. Copyright (c) 2003-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: t-gtkplug.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' class MyGtkPlug def initialize(xid, plug) plug = "Button" if plug.nil? if xid.nil? @window = Gtk::Window.new("Gtk::Plug Test") @window.set_default_size(250, 50) else @window = Gtk::Plug.new(xid.to_i) end @window.window_position = Gtk::Window::Position::CENTER @window.signal_connect("delete_event"){Gtk.main_quit} @vbox = Gtk::Box.new(:vertical, 5) @window.add(@vbox) @button1 = Gtk::Button.new(:label => plug) @button1.signal_connect("clicked"){ $stderr.puts plug} @button2 = Gtk::Button.new(:label => "Exit") @button2.signal_connect("clicked"){Gtk.main_quit} # Exit button to test an unexpected end of child process by Gtk::Socket @vbox.pack_start(@button1, true, true) @vbox.pack_start(@button2, true, true) @window.show_all end end xid = nil ARGV.each_index { |i| arg = ARGV.at(i) if arg == "-x" if arg.length > 2 xid = arg[2..-1] else xid = ARGV.at(i + 1) ARGV.delete_at(i + 1) end xid = nil if xid.to_i <= 0 ARGV.delete_at(i) end } MyGtkPlug.new(xid, ARGV.shift) Gtk.main ��������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/alpha-demo.rb������������������������������������������������0000755�0001750�0001750�00000003336�12516434313�020244� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin alpha-demo.rb - alpha blended window sample script. (need xcompmgr) Original: alphademo.py by Mike Hearn (*1) and David Trowbridge (*2) * (1) http://plan99.net/~mike/blog/2006/06/05/alpha-blended-windows-in-python/ * (2) http://david.navi.cx/blog/?p=91 Translated to Ruby by Juergen Mangler <juergen.mangler@univie.ac.at> Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: alpha-demo.rb,v 1.1 2007/01/06 03:55:44 ktou Exp $ =end require 'gtk3' require 'cairo' class AlphaDemo < Gtk::Window def initialize() super() set_app_paintable(true) set_title("AlphaDemo") set_decorated(false) set_default_size(200, 220) signal_connect("delete_event") do Gtk.main_quit end set_double_buffered(false) signal_connect('draw') do |widget, event| cr = widget.window.create_cairo_context rgba = [1.0, 1.0, 1.0] rgba << 0.0 if @supports_alpha cr.set_source_rgba(rgba) cr.set_operator(Cairo::OPERATOR_SOURCE) cr.paint twidth, theight = widget.size cr.set_source_rgba(1.0, 0.2, 0.2, 0.6) radius = [twidth, theight].min.to_f / 2 - 0.8 cr.arc(twidth.to_f / 2, theight.to_f / 2, radius, 0, 2.0 * Math::PI) cr.fill_preserve cr.stroke end signal_connect('screen-changed') do |widget, old_screen| screen_changed(widget, old_screen) end screen_changed(self) end def screen_changed(widget,old_screen=nil) tcolormap = widget.screen.rgba_colormap @supports_alpha = !tcolormap.nil? tcolormap ||= widget.screen.rgb_colormap widget.set_colormap(tcolormap) end end alpha = AlphaDemo.new alpha.show Gtk.main() ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/tree_combo.rb������������������������������������������������0000664�0001750�0001750�00000003536�11740310343�020346� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin tree_combo.rb - Gtk::TreeView and Gtk::CellRendererCombo sample script. Copyright (C) 2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: tree_combo.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' T_APPLICATION = 0 T_COMBO_TEXT_COLUMN = 1 T_COMBO_MODEL = 2 T_COMBO_HAS_ENTRY = 3 T_COMBO_EDITABLE = 4 T_COMBO_TEXT = 5 # The COMPUTER combo model combo_model = Gtk::ListStore.new(String) ["Ruby", "Perl", "Python", "Java"].each do |v| iter = combo_model.append iter[0] = v end # The table model. model = Gtk::ListStore.new(String, # T_APPLICATION Integer, # T_COMBO_TEXT_COLUMN Gtk::ListStore, # T_COMBO_MODEL TrueClass, # T_COMBO_HAS_ENTRY TrueClass, # T_COMBO_EDITABLE String) # T_COMBO_TEXT view = Gtk::TreeView.new(model) # 1st column(Text) trenderer = Gtk::CellRendererText.new tcol = Gtk::TreeViewColumn.new("Application", trenderer, :text => T_APPLICATION) view.append_column(tcol) # 2nd column(Combo) crenderer = Gtk::CellRendererCombo.new crenderer.signal_connect("edited") do |renderer, path, text| model.get_iter(path)[T_COMBO_TEXT] = text end ccol = Gtk::TreeViewColumn.new("Language", crenderer, :text_column => T_COMBO_TEXT_COLUMN, :model => T_COMBO_MODEL, :has_entry => T_COMBO_HAS_ENTRY, :editable => T_COMBO_EDITABLE, :text => T_COMBO_TEXT) view.append_column(ccol) # Create rows. (1..2).each do |v| iter = model.append iter[T_APPLICATION] = "application #{v}" iter[T_COMBO_MODEL] = combo_model iter[T_COMBO_HAS_ENTRY] = false iter[T_COMBO_EDITABLE] = true iter[T_COMBO_TEXT] = combo_model.get_iter("0")[0] end win = Gtk::Window.new win.signal_connect("delete_event"){ Gtk.main_quit } win.add(view).show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/tree_progress.rb���������������������������������������������0000644�0001750�0001750�00000002232�12416346617�021117� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin tree_progress.rb - Gtk::TreeView and Gtk::CellRendererProgress sample script. Copyright (C) 2004-2006 Darren Willis, Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: tree_progress.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk3" win = Gtk::Window.new("Gtk::CellRendererProgress sample") win.set_default_size(300, 50) model = Gtk::ListStore.new(String, Float) view = Gtk::TreeView.new(model) prog = model.append prog[0] = "bar 1" prog[1] = 50 prog1 = model.append prog1[0] = "bar 2" prog1[1] = 5 prog2 = model.append prog2[0] = "bar 3" prog2[1] = 10 arenderer = Gtk::CellRendererText.new acol = Gtk::TreeViewColumn.new("words", arenderer, :text => 0) view.append_column(acol) prenderer = Gtk::CellRendererProgress.new pcol = Gtk::TreeViewColumn.new("Progress", prenderer, :value => 1) view.append_column(pcol) win.signal_connect("delete_event") do Gtk.main_quit end win.add(view) win.show_all dir = 1 thr = Thread.new do loop do value = prog2[1] + dir if value > 100 dir = - dir end if value < 0 dir = - dir end prog2[1] += dir sleep 0.1 end end Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/gnome-logo-icon.png������������������������������������������0000644�0001750�0001750�00000006022�11701304107�021367� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W��� pHYs�� �� ~���tIME !??G�� IDATxmpnt@MIH͒]ܠ@"@Q8M@iE Ji+`U)*kkR-[B[Xmi$Vc /BD /aþI͋f_<3$ϹynKR7ѣG;` hDb#+cƌq*1J BΝ;ګk>!w*7Bzz=!b!e\RC%%n%% 1#R붅 B :)J)QvPXXX~> =JOdBK#SLq~sD'[J]_f~v!O`lycǽ<q"΢5BHJӡ6$&&չsqcK>9%ͬP^�%95Ms�4|(;NJ+0 �ސ__K@HQ)zo^uu^)X>/D{n˗ԧOo wy aO!)D?><B4H!m3Oǔ ШFnwnB hг7m͚�g!1߾;@LS>&iqgaqG@zDaH)RH֬^n�pKBb4ΝX eA%Ü՞aR!+ !(<R3YdPJr0짔"Ô0gU˕YZ?R*gfeAu˗Uyyî->B4.ȑ#ti+&xJ)-[+:)-n޼e z>,k*V)k(JOCi½5P6>UJPJlBH/P~>~Cr!d%gb@%X',<(bζY!hXB`QTdt96,<�_pR=,3H-6~/옹|HDdž \)Uo� !R#&i.COO掯/23j) @îkY`5UL!<Q.d0"GJ9똏wD4Ο?AW44G ^3w4Tl�lG~5Jy=% |ttii)2�$.Ko؀R !Ē<A҅kn1?<<T ,LhؔTN:q)I&'JsoD$#=uԴhS'HNMgG](95*@A,y3IMOSƧ-]`ОBw"N녤tzGF */"ƴLihk=..Ν` dўB#\0@BJF;`"=%Hb w�WUUս|ܵ4]tq$f:2R!IHH`c=@w8cM7ck8kd6c0$pE~ Gll6<9�Ԣ%-|3^pu�Xr&RX0#mZ(=pBĞB��R5#A~eU%+- ?-9WEEAEs !BBG[ ugVZuSu,"L&RO6kmFtk%esz8ܰEʻAŢaɶ;c^ &{ޝ/혬5S�ئ \jȴN xَ 69^?x@! dONz0Tܱ XcqCaO6lDNKg 1 * OooGLݳC+ B17\ꬿ)!^_ruz:E7[w/ucfiy'Lro ̠"}Ŝ{gs8}+uzozoBT^ćۦlS=gA`Ac,? B\+Z͡o#tq8s+[A1bq\Hw0om| ϯmHK R8ߴI�FXϮA]e`O2b_؀_9k&`͡t]y뙿Йu%wW5JF%%s/.]eoɞn^܊u !?M4Jn�eG u-w{[̡D#)KkeXp_@kmސB(yiO\5-Vf.p?s`K;@4ȏem,/eqQH_evg 깸iOoc8d6rw!aitu]Nw5=m9נn +d:K,P:Z :^r Dp[v@4r |2"'- oeϞwR‹[dƴA"6<Mk5,@Nm]|i7k{|깸wkoev?uwv3Oi)潸5#۟7v6\UHMon$(+)"ϒR:vwe7BQO{H[x!: go<~ϱ$^oNE^4 50tNo ER@Ms[et<" c(>":s^`ۏDBE2%<,u$NG] ͜?,k>#X.?2>;GȎET %;yZ!w`/$@T|uX-= ]54ů=|xd|ε!,{SWQ;-:#^R|GcԽ{uo''ZǜUnJ |ڪxՕ݋: @s[ӈT+Y0R<e[=29ɬǘPą> ÜWwXtÌJ/Ƶԇz?Gq)I����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/gdkscreen.rb�������������������������������������������������0000644�0001750�0001750�00000001266�11701304107�020167� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin gdkscreen.rb - Gdk::Screen sample script. Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: gdkscreen.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' screen = Gdk::Screen.default settings_map = [ "gtk-double-click-time", "gtk-dnd-drag-threshold", "gtk-can-change-accels", "gtk-color-palette", "gtk-font-name", "gtk-icon-sizes", "gtk-key-theme-name", "gtk-toolbar-style", "gtk-toolbar-icon-size", "gtk-im-preedit-style", "gtk-im-status-style", "gtk-cursor-blink", "gtk-cursor-blink-time", "gtk-theme-name" ] settings_map.each do |v| puts "#{v}: #{screen.get_setting(v)}" end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/style_property.rc��������������������������������������������0000644�0001750�0001750�00000000730�11701304107�021322� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* style_property.rc - Ruby/GTK sample rc file for style_property.rb. Copyright (c) 2004 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: style_property.rc,v 1.1 2004/01/25 15:52:38 mutoh Exp $ */ style "test-default" { bg[NORMAL] = { 0.80, 0.80, 0.40 } MyButton::focus-line-width = 3 MyButton::focus-line-pattern = "\10\2" MyButton::foo = 30 MyButton::bar = boat } class "MyButton" style "test-default" ����������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/linkbutton.rb������������������������������������������������0000644�0001750�0001750�00000001642�12516434313�020421� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin linkbutton.rb - Gtk::LinkButton sample. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: linkbutton.rb,v 1.1 2006/10/21 16:58:00 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::LinkButton sample") window.signal_connect("destroy"){Gtk.main_quit} vbox = Gtk::VBox.new # URI only button1 = Gtk::LinkButton.new("http://ruby-gnome2.sourceforge.jp/") button1.signal_connect("clicked") do puts button1.uri end vbox.pack_start(button1) # URI with a label button2 = Gtk::LinkButton.new("http://ruby-gnome2.sourceforge.jp/", "Ruby-GNOME2 Website") button2.signal_connect("clicked") do puts button2.uri end # Global setting instead of using clicked signals. Gtk::LinkButton.set_uri_hook {|button, link| puts "set_uri_hook: " + link } vbox.pack_start(button2) window.add(vbox) window.show_all Gtk.main ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/calendar.rb��������������������������������������������������0000644�0001750�0001750�00000003164�12516434313�020002� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin calendar.rb - Gtk::Calendar sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: calendar.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' cal = Gtk::Calendar.new w = Gtk::Window.new("Calendar sample") w.add(cal).show_all.signal_connect('delete_event') do Gtk.main_quit end date = Time.new cal.select_month(date.month, date.year) cal.select_day(date.day) cal.mark_day(date.day) #cal.clear_marks # # Gtk::Calendar::DisplayOptions::WEEK_START_MONDAY does not exist anymore # cal.set_display_options(Gtk::Calendar::DisplayOptions::SHOW_HEADING | Gtk::Calendar::DisplayOptions::SHOW_DAY_NAMES | Gtk::Calendar::DisplayOptions::NO_MONTH_CHANGE | Gtk::Calendar::DisplayOptions::SHOW_WEEK_NUMBERS) year, month, day = cal.date puts "this is #{month} #{day}, #{year}" cal.signal_connect('day_selected') do year, month, day = cal.date puts "selected day: #{day}" end cal.signal_connect('month_changed') do year, month, day = cal.date puts "changed month: #{month}" end cal.signal_connect('day_selected_double_click') do year, month, day = cal.date puts "dclicked day: #{day}" end cal.signal_connect('prev_month') do year, month, day = cal.date puts "prev month: #{month}" end cal.signal_connect('next_month') do year, month, day = cal.date puts "next_month: #{month}" end cal.signal_connect('prev_year') do year, month, day = cal.date puts "prev_year: #{year}" end cal.signal_connect('next_year') do year, month, day = cal.date puts "next year: #{year}" end Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/textbuffer_serialize.rb��������������������������������������0000644�0001750�0001750�00000010516�12516434313�022455� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin textbuffer_serialize.rb - Ruby/GTK sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: textbuffer_serialize.rb,v 1.1 2006/11/23 08:39:13 mutoh Exp $ =end require 'gtk3' if str = Gtk.check_version(2, 10, 0) puts "This sample requires GTK+ 2.10.0 or later" puts str exit end current_folder = ENV['HOME'] || "." file_name = "serialized.dat" textview = Gtk::TextView.new textview.set_size_request(600, 400) buffer = textview.buffer buffer.text = DATA.read format = buffer.serialize_formats[0] buffer.register_serialize_target(nil) buffer.register_deserialize_target(nil) window = Gtk::Window.new("Gtk::TextBuffer Serialize Demo") vbox = Gtk::VBox.new serialize_button = Gtk::FileChooserButton.new("Serialize to a file", Gtk::FileChooser::ACTION_OPEN) deserialize_button = Gtk::FileChooserButton.new("Serialize to a file", Gtk::FileChooser::ACTION_OPEN) serialize_button.current_folder = current_folder deserialize_button.current_folder = current_folder toolbar = Gtk::Toolbar.new toolbar.append(Gtk::Stock::OPEN, "Deserialize from a file") do dialog = Gtk::FileChooserDialog.new("Deserialize from a file", window, Gtk::FileChooser::ACTION_OPEN, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) dialog.filename = File.expand_path(file_name) if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT file_name = dialog.filename File.open(file_name, "rb") {|io| buffer.delete(buffer.start_iter, buffer.end_iter) buffer.deserialize(buffer, format, buffer.start_iter, io.read) } end dialog.destroy end toolbar.append(Gtk::Stock::SAVE, "Serialize to a file") do dialog = Gtk::FileChooserDialog.new("Serialize from a file", window, Gtk::FileChooser::ACTION_SAVE, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) dialog.current_name = file_name if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT file_name = dialog.filename File.open(file_name, "wb") {|io| io.write(buffer.serialize(buffer, format, buffer.start_iter, buffer.end_iter)) } end dialog.destroy end toolbar.append(Gtk::Stock::CLEAR, "Clear all") do buffer.delete(buffer.start_iter, buffer.end_iter) end toolbar.append_space toolbar.append(Gtk::Stock::SELECT_COLOR, "Color the region") do dialog = Gtk::ColorSelectionDialog.new("Color the region") if dialog.run == Gtk::Dialog::RESPONSE_OK bounds = buffer.selection_bounds color = dialog.colorsel.current_color tag_name = color.to_a.inspect unless tag = buffer.tag_table.lookup(tag_name) tag = Gtk::TextTag.new(tag_name).set_foreground_gdk(color) end buffer.tag_table.add(tag) buffer.apply_tag(tag, bounds[0], bounds[1]) end dialog.destroy end toolbar.append(Gtk::Stock::SELECT_FONT, "Set a font to the region") do dialog = Gtk::FontSelectionDialog.new("Set font to the region") if dialog.run == Gtk::Dialog::RESPONSE_OK bounds = buffer.selection_bounds font = dialog.font_name unless tag = buffer.tag_table.lookup(font) tag = Gtk::TextTag.new(font).set_font(font) end buffer.tag_table.add(tag) buffer.apply_tag(tag, bounds[0], bounds[1]) end dialog.destroy end toolbar.append_space toolbar.append(Gtk::Stock::QUIT, "Quit this application") do Gtk.main_quit end vbox.pack_start(toolbar, false, false).add(Gtk::ScrolledWindow.new.add(textview)) window.add(vbox) window.show_all window.signal_connect("destroy") { Gtk.main_quit } Gtk.main __END__ This is a sample script for rich text serialization/deserialization. 1. Edit this text using font/color buttons. 2. Click save button and save this text (= serialize this as rich text to a file) 3. Click clear button and clear this text buffer. 4. Click load button and load the file which you save (= deserialize this). ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/toolbar.rb���������������������������������������������������0000644�0001750�0001750�00000002735�12516434313�017676� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin toolbar.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: toolbar.rb,v 1.11 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::Toolbar sample") window.signal_connect("destroy") do Gtk.main_quit end toolbar = Gtk::Toolbar.new toolbar.append("Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal", Gtk::Image.new("test.xpm")) do toolbar.orientation = Gtk::ORIENTATION_HORIZONTAL end toolbar.append("Vertical", "Vertical toolbar layout", "Toolbar/Vertical", Gtk::Image.new("test.xpm")) do toolbar.orientation = Gtk::ORIENTATION_VERTICAL end toolbar.append_space toolbar.append("Icons", "Only show toolbar icons", "Toolbar/IconsOnly", Gtk::Image.new("test.xpm")) do toolbar.toolbar_style = Gtk::Toolbar::ICONS end toolbar.append("Text", "Only show toolbar text", "Toolbar/TextOnly", Gtk::Image.new("test.xpm")) do toolbar.toolbar_style = Gtk::Toolbar::TEXT end toolbar.append("Both", "Show toolbar icons and text", "Toolbar/Both", Gtk::Image.new("test.xpm")) do toolbar.toolbar_style = Gtk::Toolbar::BOTH end toolbar.append_space toolbar.append("Enable", "Enable tooltips",nil, Gtk::Image.new("test.xpm")) do toolbar.tooltips = true end toolbar.append("Disable", "Disable tooltips",nil, Gtk::Image.new("test.xpm")) do toolbar.tooltips = false end window.add(toolbar) window.show_all Gtk.main �����������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/iconview.rb��������������������������������������������������0000644�0001750�0001750�00000001524�12516434313�020052� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin iconview.rb - Ruby/GTK2 sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: iconview.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' TEXT_COLUMN = 0 PIXBUF_COLUMN = 1 model = Gtk::ListStore.new(String, Gdk::Pixbuf) iv = Gtk::IconView.new(model) iv.text_column = TEXT_COLUMN iv.pixbuf_column = PIXBUF_COLUMN Dir.glob("../gtk-demo/gnome*.png").each do |f| iter = model.append iter[TEXT_COLUMN] = File.basename(f) iter[PIXBUF_COLUMN] = Gdk::Pixbuf.new(f) end iv.signal_connect("item_activated") do |iv, path| iter = model.get_iter(path) p iter [0] end win = Gtk::Window.new("Gtk::IconView sample") win.signal_connect("destroy"){Gtk.main_quit} win.add(iv).set_default_size(300,300).show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/to_drawable.rb�����������������������������������������������0000644�0001750�0001750�00000001544�12307003726�020512� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin to_drawable.rb - Gdk::Pixbuf(GDK methods) sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: to_drawable.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' filename = ARGV[0] unless filename puts "ruby #{$0} filename" exit(1) end pixbuf = Gdk::Pixbuf.new(filename) w = Gtk::Window.new("Drawable sample") w.realize w.signal_connect('delete-event') do Gtk.main_quit end d = Gtk::DrawingArea.new gc = Gdk::GC.new(w.window) d.signal_connect('draw') do |w, e| unless e.count > 0 width = w.allocation.width height = w.allocation.height pixbuf = pixbuf.scale(width, height) d.window.draw_pixbuf(gc, pixbuf, 0, 0, 0, 0, width, height, Gdk::RGB::DITHER_NORMAL, 0, 0) end true end w.add(d) w.show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/uimanager2.xml�����������������������������������������������0000644�0001750�0001750�00000001576�11701304107�020455� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <ui> <menubar name='MenuBar'> <menu action='FileMenu'> <menuitem action='New'/> <menuitem action='Open'/> <menuitem action='Save'/> <menuitem action='SaveAs'/> <separator/> <menuitem action='Quit'/> </menu> <menu action='PreferencesMenu'> <menu action='ColorMenu'> <menuitem action='Red'/> <menuitem action='Green'/> <menuitem action='Blue'/> </menu> <menu action='ShapeMenu'> <menuitem action='Square'/> <menuitem action='Rectangle'/> <menuitem action='Oval'/> </menu> <menuitem action='Bold'/> </menu> <menu action='HelpMenu'> <menuitem action='About'/> </menu> </menubar> <toolbar name='ToolBar'> <toolitem action='Open'/> <toolitem action='Quit'/> <separator action='Sep1'/> <toolitem action='Logo'/> </toolbar> </ui> ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/misc/assistant.rb�������������������������������������������������0000755�0001750�0001750�00000017365�12516434313�020255� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin test-assistant.rb - Ruby/GTK version of testassistant.c from gtk+ 2.10 sources. Guillaume Cottenceau for the ruby-gnome2 project. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: assistant.rb,v 1.1 2006/11/23 08:39:12 mutoh Exp $ =end require "gtk3" class AssistantRunner def initialize @simple_assistant = nil @generous_assistant = nil @selected_branch = "A" @nonlinear_assistant = nil end def run_simple_assistant @simple_assistant = run_assistant(@simple_assistant, :create_simple_assistant) end def run_generous_assistant @generous_assistant = run_assistant(@generous_assistant, :create_generous_assistant) end def run_nonlinear_assistant @nonlinear_assistant = run_assistant(@nonlinear_assistant, :create_nonlinear_assistant) end private def run_assistant(assistant, assistant_create_method) assistant ||= send(assistant_create_method) if !assistant.visible? assistant.show else assistant.destroy assistant = nil end assistant end def add_completion_test_page(assistant, text, visible, complete) page = Gtk::Box.new(:vertical, 0) check = Gtk::CheckButton.new("Complete") page.add(Gtk::Label.new(text)) page.add(check) check.active = complete check.signal_connect("toggled") do complete = check.active? assistant.set_page_complete(page, complete) end page.show_all if visible assistant.append_page(page) assistant.set_page_title(page, text) assistant.set_page_complete(page, complete) page end def create_test_page(text) Gtk::Label.new(text) end def prepare_cb(assistant, page) if page.is_a?(Gtk::Label) puts "prepare: #{page.text}" elsif assistant.get_page_type(page) == :progress progress = page.child assistant.set_page_complete(page, false) progress.fraction = 0.0 GLib::Timeout.add(300) do page = assistant.get_nth_page(assistant.current_page) progress = page.child value = progress.fraction = (progress.fraction + 0.1).round(1) continue = value < 1.0 assistant.set_page_complete(page, true) unless continue continue end else puts "prepare: #{assistant.current_page}" end end def create_simple_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect("cancel") do puts "cancel" assistant.hide end assistant.signal_connect("close") do puts "close" assistant.hide end assistant.signal_connect("apply") do puts "apply" end assistant.signal_connect("prepare") do |_assistant, page| prepare_cb(_assistant, page) end page = create_test_page("Page 1") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 1") assistant.set_page_complete(page, true) page = create_test_page("Page 2") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 2") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) end def create_generous_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect("cancel") do puts "cancel" assistant.hide end assistant.signal_connect("close") do puts "close" assistant.hide end assistant.signal_connect("apply") do puts "apply" end assistant.signal_connect("prepare") do|_assistant, page| prepare_cb(_assistant, page) end page = create_test_page("Introduction") page.show assistant.append_page(page) assistant.set_page_title(page, "Introduction") assistant.set_page_type(page, :intro) assistant.set_page_complete(page, true) page = add_completion_test_page(assistant, "Content", true, false) next_page = add_completion_test_page(assistant, "More Content", true, true) check = Gtk::CheckButton.new("Next page visible"); check.active = true check.signal_connect("toggled") do puts "beuh" next_page.visible = check.active? end check.show page.add(check) add_completion_test_page(assistant, "Even More Content", true, true) page = create_test_page("Confirmation") page.show assistant.append_page(page) assistant.set_page_title(page, "Confirmation") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) page = Gtk::Alignment.new(0.5, 0.5, 0.9, 0.0) page.add(Gtk::ProgressBar.new) page.show_all assistant.append_page(page) assistant.set_page_title(page, "Progress") assistant.set_page_type(page, :progress) assistant.set_page_complete(page, true) page = create_test_page("Summary") page.show assistant.append_page(page) assistant.set_page_title(page, "Summary") assistant.set_page_type(page, :summary) assistant.set_page_complete(page, true) end def create_nonlinear_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect("cancel") do puts "cancel" assistant.hide end assistant.signal_connect("close") do puts "close" assistant.hide end assistant.signal_connect("apply") do puts "apply" end assistant.signal_connect("prepare") do |_assistant, page| prepare_cb(_assistant, page) end assistant.set_forward_page_func do |current_page| retval = -1 if current_page == 0 if @selected_branch == "A" retval = 1 else retval = 2 end elsif current_page == 1 || current_page == 2 retval = 3 end retval end page = Gtk::Box.new(:vertical, 6) button = Gtk::RadioButton.new("branch A") page.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect("toggled") do @selected_branch = "A" end button.active = true button = Gtk::RadioButton.new(button, "branch B") page.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect("toggled") do @selected_branch = "B" end page.show_all assistant.append_page(page) assistant.set_page_title(page, "Page 1") assistant.set_page_complete(page, true) page = create_test_page("Page 2A") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 2A") assistant.set_page_complete(page, true) page = create_test_page("Page 2B") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 2B") assistant.set_page_complete(page, true) page = create_test_page("Confirmation") page.show assistant.append_page(page) assistant.set_page_title(page, "Confirmation") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) end end runner = AssistantRunner.new buttons = [ ["simple assistant", proc {runner.run_simple_assistant}], ["generous assistant", proc {runner.run_generous_assistant}], ["nonlinear assistant", proc {runner.run_nonlinear_assistant}] ] if ENV["RTL"] Gtk::Widget.default_direction = Gtk::Widget::TEXT_DIR_RTL end window = Gtk::Window.new(:toplevel) window.signal_connect("destroy") {Gtk.main_quit} window.signal_connect("delete-event") {false} box = Gtk::Box.new(:vertical, 6) window.add(box) buttons.each do |label, callback| button = Gtk::Button.new(:label => label) button.signal_connect("clicked") do callback.call end box.pack_start(button, :expand => true, :fill => true, :padding => 0) end window.show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/����������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�016422� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/pixmap.rb�������������������������������������������������0000644�0001750�0001750�00000003313�11701304107�020245� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header pixmap.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/18 17:13:32 $ $Id: pixmap.rb,v 1.5 2005/07/18 17:13:32 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class PixmapSample < SampleWindow def initialize super("pixmap") vbox = Gtk::VBox.new(false, 0) add(vbox) button = Gtk::Button.new vbox.pack_start(button, false, false, 10) label = Gtk::Label.new("Pixmap\ntest") boxbutton = Gtk::HBox.new(false, 0) boxbutton.border_width = 2 boxbutton.add(Gtk::Image.new("test.xpm")) boxbutton.add(label) button.add(boxbutton) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, false, 10) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/fontselection.rb������������������������������������������0000644�0001750�0001750�00000003036�11701304107�021625� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header fontselection.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: fontselection.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by Neil Conway <neilconway@rogers.com> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class FontSelectionSample < Gtk::FontSelectionDialog include Sample extend SampleClass def initialize super(:title => 'Font Selection Dialog') set_window_position(:mouse) # Gtk::Window::Position::MOUSE signal_connect('destroy') { destroy } ok_button.signal_connect('clicked') { puts font_name destroy } cancel_button.signal_connect('clicked') { destroy } end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/menu.rb���������������������������������������������������0000644�0001750�0001750�00000003376�11701304107�017724� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header menu.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: menu.rb,v 1.6 2005/07/18 17:13:32 mutoh Exp $ =end require 'sample' class MenuSample < SampleWindow def initialize super("menus") signal_connect("delete_event") do true end box = Gtk::VBox.new(false, 10) add(box) menubar = Gtk::MenuBar.new box.pack_start(menubar, false, true, 0) menu = create_menu(2, true) menuitem = Gtk::MenuItem.new("test\nline2") menuitem.set_submenu(menu) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("foo") menuitem.set_submenu(create_menu(3, true)) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("bar") menuitem.set_submenu(create_menu(4, true)) menuitem.right_justified = true menubar.append(menuitem) optionmenu = Gtk::OptionMenu.new optionmenu.set_menu(create_menu(1, false)) optionmenu.history = 4 box.add(optionmenu) box.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} box.add(button) button.set_flags(Gtk::Widget::CAN_DEFAULT) button.grab_default end private def create_menu(depth, tearoff) return nil if depth < 1 menu = Gtk::Menu.new group = nil if tearoff then menuitem = Gtk::TearoffMenuItem.new menu.append(menuitem) end for i in 0..4 j = i + 1 buf = sprintf("item %2d - %d", depth, j) menuitem = Gtk::RadioMenuItem.new(group, buf) group = menuitem.group menu.append(menuitem) menuitem.set_sensitive(false) if i == 3 submenu = create_menu(depth - 1, true) menuitem.set_submenu(submenu) unless submenu.nil? end menu end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/entry.rb��������������������������������������������������0000644�0001750�0001750�00000003270�11701304107�020112� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header entry.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002,2003 Ruby-GNOME2 Project Team $Id: entry.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class EntrySample < SampleWindow def initialize cbitems = [ "item0", "item1 item1", "item2 item2 item2", "item3 item3 item3 item3", "item4 item4 item4 item4 item4", "item5 item5 item5 item5 item5 item5", "item6 item6 item6 item6 item6", "item7 item7 item7 item7", "item8 item8 item8", "item9 item9" ] super("entry") box = Gtk::VBox.new(false, 5) add(box) entry = Gtk::Entry.new entry.text = "hello world" entry.select_region(0, 5) box.add(entry) cb = Gtk::Combo.new cb.set_popdown_strings(cbitems) cb.entry.text = "hello world" cb.entry.select_region(0, -1) box.add(cb) editable_check = Gtk::CheckButton.new("Editable") box.add(editable_check) editable_check.signal_connect("toggled"){ entry.editable = editable_check.active? } editable_check.active = true visible_check = Gtk::CheckButton.new("Visible") box.add(visible_check) visible_check.signal_connect("toggled"){ entry.visibility = visible_check.active? } visible_check.active = true sensitive_check = Gtk::CheckButton.new("Sensitive") box.add(sensitive_check) sensitive_check.signal_connect("toggled"){ entry.sensitive = sensitive_check.active? } sensitive_check.active = true box.pack_start(Gtk::HSeparator.new, false, true, 5) button = Gtk::Button.new("close") button.signal_connect("clicked"){ destroy } box.add(button) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/3DRings.xpm�����������������������������������������������0000644�0001750�0001750�00000007504�11701304107�020427� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * DRings_xpm[] = { "48 48 65 1", " c None", ". c #104010404103", "X c #1040208130C2", "o c #104014515144", "O c #000010402081", "+ c #1040104030C2", "@ c #208120815144", "# c #28A241035965", "$ c #30C230C26185", "% c #208130C24103", "& c #104010402081", "* c #104000002081", "= c #000010401040", "- c #492441036185", "; c #596559659E79", ": c #30C220815144", "> c #0820186128A2", ", c #000000001040", "< c #2081104030C2", "1 c #514459659658", "2 c #514455556185", "3 c #104000001040", "4 c #000008200000", "5 c #618569A6AEBA", "6 c #618569A69658", "7 c #410345148E38", "8 c #104020814103", "9 c #79E782079658", "0 c #208120814103", "q c #596571C69E79", "w c #4103514471C6", "e c #2081208130C2", "r c #6185618571C6", "t c #28A228A25965", "y c #596561858617", "u c #96589E79BEFB", "i c #28A230C271C6", "p c #38E345145144", "a c #79E78207A699", "s c #30C2492469A6", "d c #410330C25965", "f c #410351446185", "g c #AEBAAAAAD75C", "h c #38E338E34103", "j c #EFBEEBADEFBE", "k c #208130C25144", "l c #9658A289DF7D", "z c #208110404103", "x c #28A228A26185", "c c #8E388A28BEFB", "v c #208118612081", "b c #38E3451479E7", "n c #4924618579E7", "m c #86178617B6DA", "M c #30C220814103", "N c #104030C25144", "B c #4103410371C6", "V c #86178A28D75C", "C c #DF7DDB6CE79D", "Z c #BEFBC30BD75C", "A c #410330C271C6", "S c #30C228A230C2", "D c #082008201861", "F c #186130C238E3", "G c #0000208130C2", " .Xo ", " O+O@#$% ", " &*=+X-;: ", " >&=,=<11#2 ", " +O34,X567& ", " 8X+=,90q9w. ", " +e<>3r tyu-& ", " Xi%.= paus+ ", " Od-@= fga$h ", " @y7X, Xrjak ", " 2:eaw+ $ag;@ ", " .X@8@k@o@X+ +pl9tO ", " +zX@x$$isikt8o02crv ", " 8@%ip7757ywbs$Ohn6#. ", " &0%$p7r215ybw1pzp2-0= ", " 8tk$#yw21665n;1+%-p$O ", " O<e7pbryq5am9ay6XMpM>3& ", " 9.NtpBw16amclVcm1t%kX*88 ", " +&etd7r6y9ulgglm6>e>3s@83 ", " +0k$y-y69cgCCCZVam%+#ik8X ", " O&oi$d725amgCjCZu962ybtx8+p ", " &X0x$sBym9VZCCCZca;yBbi%08& ", " =++@sApMy5muZZgum6y2wds:>+& ", " #tp;1;yB#i25cVucma5;w-pti@8& ", " .#2alumnBp:@1r59y9y6ywBS$%0X+= ", " %$wmZVu;#tX8X07r1656y2wbp$k@%@OD ", " 0Byc9a;h%0>&D&hBrr2r1bwB-AF:0<&*= ", " kBf;yr#@X+&<%MkhsBwBwpsB#Bktkt8+Oh ", " xt7B-t8*,3O.X00:$i#dBd#bptFek0X.+* ", " Xt#b#@=, =&O+X0Ft%ibsp$p$ki%l5sX&= ", " &<kvX&4 +O*&<X0e:%$pAti%:edugn0= ", " +X@&+, V,O&>+Xt>tktktv0%@k;Cls+ ", " =+O*4*X:p;9cy3&&8ve0FMtt$ee0>z7cZ6k ", " D=D4,=.k$sBs$ee=+X0Fk%-#t%0X&O0nu9bG ", " ,,434*&ze@F<eeeeee><tdhdSMe<&&XAaawx ", " 4,4,=+><peeeeee&=<%M%$hSF0X&O&kw5r%Z ", " D&vSFMF<>&D =0S-2i& ", " +>puB> >0h7s. ", " SM5VqM &0t#$8 ", " XpVV70 &0kMk. ", " XdyB%z *X<%@+ ", " &k$b0X+=8X08o ", " &e:e+=*X.X+& ", " +X.O+X0O.=, ", " +>&+0>3&* ", " &X0k+O, ", " >v,3 ", " "}; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/savedposition.rb������������������������������������������0000644�0001750�0001750�00000004265�11701304107�021645� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin savedposition.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: savedposition.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class SavedPositionSample < SampleWindow Pos = [ 0, 0 ] def initialize super("Saved Position") move(Pos[0], Pos[1]) set_default_size(200, 100) set_border_width = 5 vbox = Gtk::VBox.new add(vbox) hbox1 = Gtk::HBox.new hbox1.border_width = 5 vbox.add(hbox1) label = Gtk::Label.new("X Origin : ") label.set_alignment(0, 0.5) hbox1.add(label) x_label = Gtk::Label.new("") hbox1.add(x_label) hbox2 = Gtk::HBox.new hbox2.set_border_width(5) vbox.add(hbox2) label = Gtk::Label.new("Y Origin : ") label.set_alignment(0, 0.5) hbox2.add(label) y_label = Gtk::Label.new("") hbox2.add(y_label) signal_connect("configure_event") do x, y = window.root_origin Pos[0] = x Pos[1] = y x_label.text = x.to_s y_label.text = y.to_s false end vbox.pack_start(Gtk::HSeparator.new, false, true, 10) button = Gtk::Button.new("Close") button.signal_connect("clicked"){destroy} vbox.add(button) button.can_default = true button.grab_default end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/check-y.xpm�����������������������������������������������0000644�0001750�0001750�00000000533�11701304107�020474� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 10 9 5 1", /* colors */ ". c None", "# c #000000", "i c #ff0fff", "y c #ff1f00", "# c #9f9f9f", /* pixels */ "..........", "........yy", ".......yy.", "......yy..", ".yyy.yy...", "..yyyy....", "...yy.....", "..........", "..........", }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/testgtkrc�������������������������������������������������0000644�0001750�0001750�00000006216�11701304107�020364� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..." # # include "rc-file" # # style <name> [= <name>] # { # <option> # } # # widget <widget_set> style <style_name> # widget_class <widget_class_set> style <style_name> # testgtkrc2 sets all the buttons in the main window to blue by default include "testgtkrc2" #include "/usr/local/share/themes/Pixmap/gtk/gtkrc" #include "/usr/local/share/themes/Redmond95/gtk/gtkrc" #include "/usr/local/share/themes/Metal/gtk/gtkrc" #include "/usr/local/share/themes/Notif/gtk/gtkrc" #include "/usr/local/share/themes/Default/gtk/gtkrc" #pixmap_path "." style "defaultfont" { # fontset = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*,*" font = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,*" } # common default class "GtkWidget" style "defaultfont" style "window" { # bg_pixmap[NORMAL] = "marble.xpm" } style "scale" { fg[NORMAL] = { 1.0, 0, 0 } bg_pixmap[NORMAL] = "<parent>" } style "button" = "default" { # fg[PRELIGHT] = { 1.0, 1.0, 1.0 } # bg[PRELIGHT] = { 0, 0, 0.75 } # bg[PRELIGHT] = { 0.75, 0, 0x00 } } style "toggle_button" = "button" { fg[NORMAL] = { 1.0, 0, 0 } fg[ACTIVE] = { 1.0, 0, 0 } # bg_pixmap[ACTIVE] = "check-y.xpm" # bg_pixmap[NORMAL] = "check-n.xpm" } style "text" { bg_pixmap[NORMAL] = "marble.xpm" text[NORMAL] = { 1.0, 1.0, 1.0 } fg[NORMAL] = { 1.0, 1.0, 1.0 } base[NORMAL] = { 0.0, 0.0, 0.0 } } style "slider" { fg[NORMAL] = { 1.0, 1.0, 1.0 } bg[NORMAL] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0 ,0.0, 0.5 } bg[PRELIGHT] = { 0.75 ,0.75, 1.0 } } style "ruler" { font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*' } style "curve" { fg[NORMAL] = { 58000, 0, 0 } # red } style "red-bar" { bg[PRELIGHT] = { 0.95, .55, 0.55 } } # override testgtk2, introduce the green color in the button list style 'button_list' = 'button' { font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" bg[PRELIGHT] = { 0, 0.75, 0x00 } } widget "main window.*GtkScrolledWindow.*GtkButton*" style "button_list" class "GtkScrollbar" style "red-bar" widget_class "GtkWindow" style "window" widget_class "GtkDialog" style "window" widget_class "GtkFileSelection" style "window" widget_class "*Gtk*Scale" style "scale" widget_class "*GtkCheckButton*" style "toggle_button" widget_class "*GtkRadioButton*" style "toggle_button" widget_class "*GtkButton*" style "button" widget_class "*Ruler" style "ruler" widget_class "*GtkText" style "text" widget "*GtkCurve" style "curve" binding "test1" { bind "<ctrl>1" { "debug-msg" ("jup!") } } binding "test2" { bind "<ctrl>1" { "debug-msg" ("hallo and") "debug-msg" ("huhu") } } # possible priorities are (in ascending order): # lowest # gtk (used by gtk for internal class bindings) # application (for hard coded bindings on application basis) # rc (used implicitel by rc files) # highest class "GtkCList" binding "test1" # implicit : rc #class "GtkWindow" binding : highest "test2" # override "rc" priority binding "clist-test" { bind "j" { "scroll-vertical" (step-backward, 0.0) } bind "k" { "scroll-vertical" (step-forward, 0.0) } } class "GtkCList" binding "clist-test" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/testgtk.rb������������������������������������������������0000644�0001750�0001750�00000010615�11701304107�020437� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin header testgtk.rb - testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2006 Ruby-GNOME2 Project Team $Id: testgtk.rb,v 1.16 2006/06/17 13:18:12 mutoh Exp $ Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end $:.unshift(File.dirname(__FILE__)) require 'gtk3' require 'sample' require 'button' require 'checkbutton' require 'togglebutton' require 'radiobutton' require 'buttonbox' require 'toolbar' require 'statusbar' require 'reparent' require 'pixmap' require 'tooltips' require 'labels' require 'layout' require 'menu' require 'scrolledwindow' require 'entry' require 'spinbutton' require 'colorselect' require 'dialog' require 'range' require 'notebook' require 'shapedwindow' require 'wmhints' require 'progressbar' require 'savedposition' require 'filesel' require 'fontselection' # # Main Window # def create_main_window buttons = [ ["button box", ButtonBoxSample], ["buttons", ButtonSample], ["check buttons", CheckButtonSample], ["color selection", ColorSelectionSample], ["dialog", DialogSample], ["entry", EntrySample], ["file chooser", FileChooserSample], ["font selection", FontSelectionSample], ["labels", LabelSample], ["layout", LayoutSample], ["menus", MenuSample], ["notebook", NotebookSample], ["pixmap", PixmapSample], ["progress bar", ProgressBarSample], ["radio buttons", RadioButtonSample], ["range controls", RangeSample], ["reparent", ReparentSample], ["saved position", SavedPositionSample], ["scrolled windows", ScrolledWindowSample], ["shapes", ShapesSample], ["spinbutton", SpinButtonSample], ["statusbar", StatusbarSample], ["toggle buttons", ToggleButtonSample], ["toolbar", ToolbarSample], ["tooltips", TooltipsSample], ["WM hints", WMHintsSample], ] nbuttons = buttons.size window = Gtk::Window.new window.name = "main window" window.set_default_size(200, 400) window.move(20, 20) window.signal_connect("destroy"){Gtk.main_quit} box1 = Gtk::VBox.new(false, 0) window.add(box1) label = Gtk::Label.new("Gtk+ v#{Gtk::MAJOR_VERSION}.#{Gtk::MINOR_VERSION}.#{Gtk::MICRO_VERSION}") box1.pack_start(label, false, false, 0) label = Gtk::Label.new("Ruby/GTK3 v#{Gtk::BINDING_VERSION.join(".")}") box1.pack_start(label, false, false, 0) scrolled_window = Gtk::ScrolledWindow.new(nil, nil) scrolled_window.border_width = 10 scrolled_window.set_policy(:automatic, :automatic) # Gtk::PolicyType::AUTOMATIC box1.pack_start(scrolled_window, true, true, 0) box2 = Gtk::VBox.new(false, 0) box2.border_width = 10 scrolled_window.add_with_viewport(box2); box2.focus_vadjustment = scrolled_window.vadjustment buttons.each do |title, sample_class| button = Gtk::Button.new(title) unless sample_class.nil? button.signal_connect("clicked"){|obj| sample_class.invoke } else button.sensitive = false end box2.pack_start(button, true, true, 0) end box1.pack_start(Gtk::HSeparator.new, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked") do window.destroy Gtk.main_quit end box1.pack_start(button, false, true, 5) window.show_all end def main srand Gtk::RC.parse("testgtkrc") create_main_window Gtk.main end if $DEBUG $stderr.sync = true Thread.start do loop do STDERR.print("+") GC.start sleep(1) end end $stderr.puts("#{$0}: started GC-thread for debugging.") # timeout Gtk.timeout_add(1000) do $stderr.print("*") true end end main puts("#{$0}: done.") �������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/tooltips.rb�����������������������������������������������0000644�0001750�0001750�00000002162�11701304107�020625� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin tooltips.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: tooltips.rb,v 1.6 2005/07/21 17:47:19 mutoh Exp $ =end require 'sample' class TooltipsSample < SampleWindow def initialize super("Tooltips") set_default_size(200, -1) set_border_width(5) tooltips = Gtk::Tooltips.new button = Gtk::ToggleButton.new("button1") tooltips.set_tip(button,"This is button 1", "ContextHelp/buttons/1") button2 = Gtk::ToggleButton.new("button2") tooltips.set_tip(button2, "This is button 2. This is also a really long tooltip which probably won't fit on a single line and will therefore need to be wrapped. Hopefully the wrapping will work correctly.", "ContextHelp/buttons/2_long") vbox = Gtk::VBox.new(false, 10) vbox.add(button) vbox.add(button2) vbox.add(Gtk::HSeparator.new) button4 = Gtk::Button.new("close") button4.signal_connect("clicked"){destroy} vbox.pack_start(button4) tooltips.set_tip(button4, "Push this button to close window", "ContextHelp/buttons/Close") add(vbox) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/marble.xpm������������������������������������������������0000644�0001750�0001750�00001115707�11701304107�020426� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *granite07[] = { /* width height num_colors chars_per_pixel */ " 384 384 16 1", /* colors */ ". c #000000", "# c #111111", "a c #222222", "b c #333333", "c c #444444", "d c #555555", "e c #666666", "f c #777777", "g c #888888", "h c #999999", "i c #aaaaaa", "j c #bbbbbb", "k c #cccccc", "l c #dddddd", "m c #eeeeee", "n c #ffffff", /* pixels */ "aacfedbbcbbaaaaaaaaabaabaaaaabcbcbbbabbchfdcccbbabbbaaabaabcbaa#aa#######a#aaaabcddeefhec##dgbabbaaadabbcfbaa##########aaabbaaa#a#####a#aa###a#aaabbbbcbbbccdedaaaaa#aaaaa#a#abaaabbabbbeddbbaaaaaca##a#aaaba########aaaadcababbabdehd.##.a######.cgdcb###b##.##.##aaaaa####abcba######a##aac#a##a####aa#aa##babbbcfccbbbcdccccecbbbcbbbcdccddcbcdfeecbhhjihhgffc.aaa####.#######aaaaaaaabbaaaaa", "aaacedccbbcbaaaaaa#bbaabbbaaaabcaabbbbbbafhfccbbbbbbabacbacbaaaaa##########a###abbcdeghhhcagb#ababaaccbacdfca#a####aa###aaaaabaaa#####aca#aabaababbcccccccbcdfdaaaa###aaaaaaaaaaabbbbbbccccccbbcbcaaa##aaaaabaaaa###abdaccceebaaaabehja####a######..#aeec#bb##########aa#####abba#########aaca########aa#aa###aaaabddbbbbbbbbbbccbbabbbbabbabbabcbcbcefhfeddccefhhijheecb#...a####aaaaaaaabaaaaa", "aaabccccccdbabcbaaa#aaaaaaaaaaabbabbbbbccabefdccabcbbabacccbaaabaa######a######aaabceiiiihije#bbabbaaeaabcedcaabaa########aaaabaa##a###ab#aabcababbccccccdeeeecc#a##a##aaaaaaaaaabbbbbbbcccbbbdcbbcdaa#a#aabbaaaaa###acbaa#bccaa#abcfig.#######.#######acddgefdda#######a########a#######aaaaaa#a######aaaa#####aaacdcbabbaaabbbcaaaaaaaaabbbaaabbaabbbcbcbabbabcdeefghjkjgc#..####aaaaaaaaaaaa#", "#aaaaaacbccbcabbbaaaaaabcaaaaabbbbbbabbbcbaabffccbccbccbbcbaaaabaaaa#aa#aa##a#aaaaabbikkjhijicabbbcc#faaacdebcbda#########aaaaaaaaa####aa##cacccabcccdccccdddfdcbaa##a##abbbabccbbcbbbccccaaa#abbaaba#a##abbbbbaaaaaaaaaaccaaca##aabcfic.###aa#######a####bddeeddb####.##.###aaa#########aaaa###aa####aaaa#######aabdbbbbcabbbaaaa#aaaaaaaaabaaabbbaabbbbdbbaaabccccccdcefhhkhda##aaaa#a#aaaaa##", "#aaabaabcecbaa##bcaaaaaaaababbabaaabbabbaabb#chhfdccccbcbecaaabaaaaaaaaaa####aaaaaaabdgjkkijijdabbdcabfaabcecbbec###########a#aaaabaa#######abbaaaadddedddeeefeccaa###a#aabcccdcbcbbbbccbbbbaaaaa#aabbaaaabbbbbbaaaaaaabbbbbaaa####acegha##a#aabbb####a##adccdedbcc#######.###a###a#######aaa#a#aa##..#aa#########abdbaabbabbbaa###aaaaaaaaaaaaacbaaababbdbabbabcbbcbcbccbbdegjkgb#aa#aa#aaaaaaa", "##aa#aabccccaaaaaaaa#aaaaaabbaabbbaaaaabbbcbbcfhhgfcccbbbbccbaabbaaaaaaabaa#aaaabaaaabbcehkljjdabacccbgbaaccdb#adea#########aa#abaaaaa#####ac#ba##accdedddefffeaba##a#aaaaacccccccbbbcccaabaaaaaaaaa#aaaaabcbbaaa#bbbbaaefccdbaaa#aaacdei##aa##aabbbaaa#a#cdcccccbcea.#########bbaaa######a###a#aaaa.#aaba####.###abcbaaabaabbbaa###aaaaaaaaaaaabbaaaaaaaaaaababcbbcbbaabbbdddeghheba##ab#abaa##", "#####bbaaaaabaaaaa##aa#adccaabaaabbbbabbabbbabccbccfdbccbbbbbcaabcaabaaabbaaaaaaaaaaaabbbcglli#accbbbddgabcddbbaacea#a##########aaa#aaa##aaaa####aabcddeeefffgdbbaaaa###baabbbbbbcdabdcbcaaabaaaaaaa#aaaaaabcbbbbadfbbbaejhhebbccaaaaaccfi.aba##abaaaba####ecbbccba#fc.####.##.bba#a#######aaaaaaaaaaa##aaaa######abcdaa#aaaabaaa###aaaaabaaabbbaaba##aaababcbbcbbbbbcbaaabbccccddgggeb#aadca###", "#####bcaaaaaabcbaaa#aaaabcccaaaaaaabaaabbbbbbbaacbabeeddddccbcbbcccbabaaaabaabaaaaaaaaabbbbglmdbcbaabebdgdbcecbbaabdbaa#########aabbaaaa#aa#a##a#aabbdceeedccdcbbaaaaa##aaabbcbbbabaaabbababbaaaa#aaaaaaaabcdccbbbabcbbbcfijfbcdcabb#abcbif#abb##aaabaaaa##fcccbbcaa#db#..##.##.aaa#########ab#aaaaaa#aabaaaaa#####abdbbaaaabbaaaa###b#a#aaaabaaaaaaaaaaaaaabbabbbbaabbbaaaabbbbbbbceffecccbaa##", "#####abaaaaa#accbbbbaaabaaaaaaaaaaadcbaabbabbbabbdcaacgfddddcdddcadfcaaaabcbbabaaaaaabcabbbdjliacbababcbdfcdeeaaaaaabba########a##aa#aabaa##a######abddeggca#bcbaaaaaa####aaaaaabbbbbcbbbbbaaa##a#aaaaaaaabcbccbbaaaabaabfgfiecccccbbaaaccicbbbcbaaabaaabb#ceccccdca##aacdb######aaa###a###aabaaaaaa#aabca#abba#####abca##aaaaaaaaa##a##aaaaaaabaaaaaaabaaaacbcbacdbaaabaaaaaabaaaaabbcddccbaa##", "####aa#aaaaaaabccbabbaaaaaaaaaaaaabfaaabbcbbbbbabdebaabdffddedefedccecccdcbbbbbccbccbbbbbbccekldaabaaabccbfaaaaaaaaaaaba########aaaaaaaaba##aaa###aabbccfgfaababbbaaaaa#aabbaabaaccaabcccbcbaa##aaaaaabaabbbccbbbaabbbbbbdddghdbbbcccb#abcdebcccbaabbbabbcbaecddddbaa##.#acdeca#######a#aaaaaaaaaaaaaaabba##abba####aacba##aaaaaaaaaaaaa##aba#abaaaaaaabaaaabbbbbbcbabbaabbaaaaabaaaaaaaaccbaa##", ".####aa#aabaa##bccbaabbbba#aaaaabbaefdaabbbbccbbbaddaaabadeeffhhhffdedddeecbbbbcccbbabcbabbcfjjlkeaaaaacdadcaa#aaaaaaa#ab######ba#aaabbabcaa#aa###babcddcedba##acbaaaaaa#ababbbacbbbcccdfffbaa#aaaacbaabcbabccbbcbbbbbbcbbccedbbbccdccbaabcgb#bccbbbababbbcccdededcb#a####...addcba##aabbbbbbbbaaaaabba#aaa##abba####abbaa###a#aa#aa##aaa#a##abaaaaaaaaabababbcdbcb#baaaaaaaaaaaaaaaaaa#aaaaa###", "######a##aaaaaa#accbaaabbbaaa#aaababdcaaabbbbcccbbbdbabbbacdccgecadbbbcdccddeddcccccbaabcbbcgjhhjgeb#aacdcccaa#aa#aaa#a#aaa##aaaaa#aaabbaabb#aa###aabccddeccbbbaabcbbbcbbb#aacbbadbabcccddbaaa#aaaaabbbbabbbbcdbbbabbcddcbbbccaabbbccbbaaaadi##abbbbbbbaabbbacdeedbd######aa####bceda#aabbabaaaaaaaaba#aaaaa#aabaaa###acaaaa####aa##aaaaaaaa#aaaaaaaaaaababaaaaabcaaaaaaabbcbaaaaaaaaa###aaaa###", "##########aabaa#accbbabbbbbba##aaaabbcbbbbbbbbcbaaabdbbbbbbddccbbbbaaaabbabbbbcefefdcbaadbcddje#debgfbabecdc####aa##a###a#aa#aa##a##aaabbcabbaa###aabbcceedbcbaaaabdcccbabaaabbbbabbccbbaaaaaa#aaaaaaaabbbbbcbccabcccccdcccbbbbabbababbba#abfe#aaaaaaaabccbbaaaedddc######adcaaaa##dfcaaaaaaaaaa#aaaaa##aabcaaabbaa#aaab###aa###aaaaaaaaaaaa##aaaaaaaaaabaaabaaabcabaaaaaaabcbaabaaa##a###aa####", "#########aaaaaaabbcbbbbabcbaacbaa##aaabaaabccccccbaabecabbbcddbacdeba#aaaaabaaabbdfgedcbaccdcgica#aadghdbddd#aa#aaa#a###aaaabaa#####aaaaabbbbbba#aaabccceecbddbaa#bbccabcbbbbbacccdbbdabbaaaaaaa#aaaa#aabbbbcccdcbcbbccccccbcaababbdbabbba#bbgaabaaa#aaacccdcddbeedba#a##a#aba#aaaa##decbaaba#aaa###a#a###abba#bba###aaba####a####aaaaaaaaaaaa#aaabbbaaabbaabbaabbaaa#aa#a#abbaabbbaaa#aaaa#####", "############aaaaaaacbbbbbbbaa#aaa#a##aaaaaaaacbbbbbbabdcabbbcdbaccdba#aaaaaababbcbbdddedccddefihaa#aaahiiiffd#aaaa#abaa##aaaaacaa##a#bcaaaabbbcaaaabccdddecabaaaaacbbbabbccccccbbdbdfdaabbaaa###a#aaaaaaaabbbbbbbaaabdcddccbbbbabbbccaabbbaabfdaaabaa#aa##aabbbbbddba##aa#a#aa##aaaaaabcdbbaaa##aa#####a#aaabbaaaaa##abb######aa###aaaaaaaaaaaaaaaaabaaaaaaaabbbbaaabaaa#aaaaaaabbbaaaaaaaaa####", "###########aa#aa#aaaccabbaaaaaaabb#######a#aaabcbbbabbaeebbccbcbacdaaa##a#aabbbbccbbcbcdegifdfgifba##aaaagigha#aaaaabbaaaaaaaaabaaa##acaaaaabbbbbbabcdddefeba####abbaabccccbbbcbadcbcbaabba#aaaa#aaaaaababacccbaadbabbccedcccbbccbbabaaaaa##ade###abba#aa##abbba#cebb.#a####.#a#aaaaaaaaacfca#aaa###aa###abaabaaaaaaaabbaa#######aaaaa#aa#aaaaaaaaaaababdaaabbbbbababaaaaaa#aaaaaabbaaabaaaaa###", "##########a#aaabaaaaccaaaaaaabaaaaaaba###a##abaaabbababaccbcbbcccaaba#a###aaabbccdccccccdeegggfigaabb#aaa#fffcba#abbaaaaaaaaaaa#abba##aaa##aabbbcbbbbcdeegfeb####aabaabacbbbcbccaabbabaaaaaaa##aa#aaaaababbabbcbcdbbcccbddcdcccabcbbababba###afba#aabba#acaaabbbbaddb##aa####.####aabbaaaabffcaaaaaa##a##bcabbaaaaaaabbbc#a#a#######aaaaa#####a##ababbbbbaaaabbcbaaaaaaaaaaa#aaaaaabaaababaaaaa#", "#######a#####a#aaaaabcbaaaaaa#aabaaaaaa###abbabaaaaaccaaabdbccbccbaaca#####accddcccccccddeeefikjeabcca#a#abfifbaa#abbbbbaaaaaaaaa#bbba#bcaaaaaaaccbcccceffeccaa##aaabbbcabbacbddbbaabdbaaaaaaaaaaaaaaabbbaabbbbbbbbbcbbccccdcdcccabbbbbaaba###dcaaaabbaaabaabcbccaadba#aaa########aaaa##aaaacgdbaaaa####cfffda#a#aaaabbdbaa#aaa########aaaa#aa##aaabbabbbaaabbbaaaaaabaaaaaaaa#aaaaabaaaaaaaaa#a", "a###########aaaaaaaabbaabaaa###abaaa#a##a###a#aaaaabacaaabccbbbcbbbcbb####a#bdfbbccccccdefecdgiiddaabbaaaabacfeaaaaaabcccbaaaaaaabaaacaa##aaaaaaabccddcfgfgbabaaa#aaabbcccbccbcddbbacabbbbbbbbaaacbaaaabcbabbbbbcbbcbccbccdccdccdcbaabbbaabaaade#aa#baaabaa##abbcbacdb#.#abbccc#.##aaa####aa#aeeaaaaaaabbabddfgfba#aabcd#aaaa########aa##a##aaaaaababbaabbbbbabccbababaaaaaaa##a#aaaabbaaaaaaaa#", "#a###a######aaaaaaaacdaaaaaaaa#aaaaaaaaaa#####a###abbbbaaaaccbbbcbbbbaa#aaaaaeecabcccbccdedcdfgigeaaaacbaaabaacbaaaaaaabcbbbaaaaaaaaabccaaaaaaaaaacccceffffbabb#a####aaaabcccccddcdedbbbbaabcabbbccbccbcbcbbbbbbbbbcecbccccceccccdccbbaaaaaaabce#bbaaa###aaa##ababcacda#abb##a#######a#########bfdca#abcbaabaabcffddbabdc#aaaaa##########aa####aaaaaaabbabbbbbbbcbbbcbaaaaaaaa#aa#aaaaaabaa##b##", "##a#########aabaaaabcdbabaaaaa##aaaaabaaba######a##ababbbbbabbbbcbcdddbbaa#abceecabccccccdddfedgjgdbaaabaaabbbaaba#aabaabaccaaaaaaaabbccbbbaaabaaabcddefgfebbbb#aa####aaaabbcccccbbfeccbbbaaababbbbbbbccba#abbbabbcdccdcbddcddcccdcddcbaaaaaabcfbadaa#######a#abbacbbcc###a#a########a######a##aabdcabccbbababaaaacdfededbbaa#aa##aa######ba#aa#aaabbabaababcbbcbcbbbabbaaaaaaaa##aaabaaacba#a##", "##########a#abaaaaabbbcbbbcaa###a#aaaaa##aba#######aaaaaabbdccbaabccdddecaaaabccdbbacccddcdefdfgiifcba#bbaaabbaaaababbbbbbbabbaabaaaacbbbcbbaaaaaaaceeeefffbaaaa###a##aaaabbcbbbddcddddcbcbbaaabbbbababbabaaabababbbbcccdccddcddccccdecaaaa#abccfbbaaa#######aabbaacabe###a#aa#a#a##.aa#######a#aa#cfeecdcccccabbbabacggcabbaaabbaaaa####aabb#aaaabbababbbbbbcccbbbbbcccbbbaaaa#aaaaaababbaaaa##", "######a####abcbaaaaabbccbcbaa###a##aaa##a###aa######aaaaaabdgebaaabbbccacbaaaaabbbaaabccddcdeeffgigbaaaaaabaabcaaababbbbaabbacbaaabbaaaababccbabbabbdffefhdcaaa###aaabba#aababcbdeeccceccccbababbbbabbabbaaaaaabbaabbcbcccccdcddddccccdcaaaababcdeaba#####.###aaabaab#b####a####a##aa#b########aaaaabedddcccccaaaabbcabeaaaabbccbaaa#abbaaabbbaaaabbbaaacbcbcbbdccbaabbacbbbbbaaaaaaaaabbaa#####", "######aaa#abbcbaaaaabdccbbaaa#######aaa#####aaa##a#a##aaaababcbbaaaaabdebbbaaa##aaaaaaaabccddeefggieaaaaaaaacabaabbbabbbbaaaabbaaaaaaabbbabbccbaabbbdfgghebbbaa#####abba#aabbbcbccdcbbbcddcccbbbabbabbbabbabaaaaaaacbbabcbbccccddddccbcccaaaaaabbdcbc##########aaacbbaa####a####aa###a#aa###aaa###abbceddedcccbaaaacccdca##a#abbbabaaaabaaabbba#aabbbbbbccbbbbaaacccbbcbbaaabbbbbbabaaabaaaa####", "#######aa#aaccabbabaabdecbb#a########aaaa####aaa#aba##a#aaaaaaabbdcaabdcbcaacb####abb#abaabccdeffghfdabaaaa#acbbbbcbabcabcbaaaabbbabaaaabbbbbcccbbbccdfedccbbb#########aaaababbacccbcbbbddbdcccccbbbbaaaabbaabbaaaaabaabbbbccdcceedccccacbaaaabbbbddb####aa######aabbaa####a####aa#aa###a#####aa#aabbddeccddccbbbabbbbceb###aa#aaaaaa##aa####aaaa#abbbbbccacccbaa#accbbbbbaaababbabaaaaaaaaa####", "##a#####aaaaaabbbbabacdddccaa########aa#a#####aaa#aa#aaaaaaaaaaaabcabbcbbbbababa###baaaaaaabccdeeehifbabaaa###abbcbbcaccbcbbbaabbbbabaaabbbbbbbbcccccddbccbbbbba#######aaabbbaabbcccbdcbbdbbddcdcccbabaabaaaaaaaaaaaaaaaabbcccddecccbbacccbbbaabbbceca############aaaaa#############a#############aaaaabccddcbbbabbbbbbba#####a##a####aaa#######aaa#babaabbcbaaa##abbbaabbcbbbbaaaaaaaabbaaa####", "#########abaaabbabbbbbddeccca##aa######a#aa####bbaaaaaaaaaaaaaaaaaabccbcccebacfdb#####aaaaaaabcdddcfgfccbaa##a##abcbbcbbdcccccabbabaababbbbbbbbbbcdccddbabbbbbba########aaababbbacdccccaabcbbcabddddbbaaabbabbbaaaaaaaaabbbddcddecbccbbbdcbabbbaabbcda#############abaaaa############a####bb##a####aaaaabcffdcccbbbbbbbb#######aaa###aaaa#######aabaaaabbcbaaaaaaaa#aaaaaabbccbbaaaaaabbbaaa####", "#########aaabbabcbbbbbdddcbaaaaa###############aabaaaa#aaaaaaaaaaabbabbdefffccbba###aa##aaaaaabcdceecggdcbbaa##aa#aacbb#bcdddddabbbbbabbbabbbbbbbccfeedbbbbbbcbba#a#####a#acababbbdcbcbabbabaabaabeedcaaaaaaaabcbbaaaaaaabbcdfdddccbbbbcbccbabbbaaabcda########a#aaaaaaa#aa#####aaabaaaaaaacb##aaa#aaababbcdefddbbcbccbaa#####aaaaaaaab##a########aa#abbcccbaaaaaa###aaaaabaabccbbbaaaaaaaaa####", "########aaaaaaabbbbbbcdedbbbbabaa##########aa###bbb###a##aaaaaaabbaabbbdfeedb##a#a##aa###aaabbbbccdefbfecbbbaaa####a#adb#acdecdfcbaabcbbbbcbbbbbbcdeffbcccabbcdbbba#a###a#aabaaaaaccccbaaaaabbbbaabdfedaaaababbbbbaaaaaaababbcedcccbbbbaccccbaaaccbbabeb######aaaaa#aaa###a######aaaaaaabacbca#aaaaaabbbbccdegfeccccccbcbaaa#####aaaa#aaaaa###a###aaaabbbcccb##a#aaa#aaaaaaaabbdeddcbabaaaaa####", "#########a#aabbbbbbbbdddccbbba#aaaa##aa##a####a#bba#a#a#aaaabaabbbabbeedeeefdaaaa#####bb##aaabbabcddehgifffdcbaaaa#aa#aaaaaccdeddcabbbcbbbccbabbccdceeecdcaaaabbcccaaaaaaaaaaaaaabacdddbaabaabbbbcccccfdbaabbaabbcaaaaaaababbcccccbbbbbbbccbcca#acbbbbbda#####aaaa####ab##a######aaaaaaabaccbaaaaabbbbbbccceffcdeedcbbbbaaaa#aaaaaaaaa#aaabaaaaaa##aaaabbbcbbcbaa#####aaaaaabbbcccddcbbaaaaa####", "##########a#aabbcbcbbcecccbbbabaaaaaa#####a#aaaabbaa##ba#acaaababbbbbbbcdcfgdbbbaa####aba##aaaabbbccdfefhfgedecaaa##abaaaaacbabebbbbbbbbcccbcbbbbddbedbddcaaaaaabdccaaba#aaaaaa#bbbbbaddccaaabcbbdcbbcbddabbbbbbbccaaaaaaaaabcddcbbbbbbbbbbbbbbaaaabbaabe#########a####bb#aa#####aa#aaaabccdbbbbabbcbbbccccdccbaaeffdbca#aaaa#aaaaaaa#aaaaabaaaa#aaaabaabbccbbcceb#bcaaaaaaaabbbbcdcbbbaaaaa####", "#######aa#aaaaabbccbbcdccddcabaaaaaaaaa###aaa#aabcaaa#bba#aabaabbbbbbabcccdfedcaa##aaa######aaaabbbbcdddghhgfedcbaaaa#aaaaabcbbbccbbbbbbbcbccdcccccbeebccbbbaaaaaccccccba#aaaaaaabaaabbbddbbbbcccbcccbaceeacbbbcbccbaaabbabbbbceccbbbbbabbbbbbbab#aabbbbcc#.######a####.bcbcba####aaaa#bedccbbbbbbbaabccddedaaaaa##beeda#aaaaaaaaaaaaaaaaaaaaabba##babbabbbbcbbbccccbbaaaaabbabaabddcbbbaaaa####", "##########aaaabbbbccccbcddddbaaaa##a#a#a###aaaa#baabbaaaaaaaabbbabcbaabccbddfebaaba#ba######aaaabbbbbcddfiiigggedbaaaaaaaaaabcbabccbbbbbbbcccddddccceecccccbbaaaabccddbbba#aaaaaaaaabcbbbcccdccbcbabcbabceecbabbbbbbaaaabaabbbcddbbbbbbbbaabbbcbbbbaaabcbdc########..####ccccba#abbaaaabddbabbbcabbbbcccceeca###aaa##aaa##a#aaaaaaaaaaaaaaaaaaaaa##aabcbbbbbbbccbbbbcddaaaaacbaaaabddbbaaaaaa###", "############aaabbabcddccdbcdcbcbbbaaaaa##a##aaaa##abaaabaaaaaaabbaacaabddabcefc#aabaaa###a####aaabbbbbbddgihhfffgeaaaaaaaaaaaaabbbcbbbbbbbbbcddeeedceccdcccccaaaaabcbddbaa#a#ab#aaacbbbbbbddebbbbccbbbabbbedbaaaaaaaaaaaabbabbccecbbbbccbbbbaabbbbcc#aaabbcc######a#####.bccabbacbababaabdcabbbabbabbbcbdecabaa##aaaa####aaaaba##aaaaabaaababa##aa#aaabbbbbbbbcbbbbacbedbaaa#bbaaaabcbbbbaaaa#aa", "#######a####aaaaabaabbcccbabbbbbbbcbaaa######a#aa######aaaa#aaa#acbbbabeeebabddbaaabaa####aa#a#aababbbbbcehhgeeffdca##aaaaaaaaaabbbbabbbbbbcdcdddfgfhcbbcbbbcbaaaaabcccdbba###baaaabcbbaabcdeecaaabbbbbbaabddecaaaaaaaabbbbbbbccfcbcbbbbbbbaaaaabbbcca#aabacc#######a####acdcbbbbbbaaaabbccaabbbbbbbabbceecabb#aa#aaaa#######aaa##aaaaaaabbaaaaaaaaaaaabbbaabccbbcbaaacgdaaaa#aababbbabbbbaaaaa#", "###a#####a#aaaaaabcbacbbddcaaabbbbbbbaaaaaa##a#####a####aaaaa#aaabdbcbbedefcaaabaaaaabaaa#a##abaaaaababbbcfgggfeefea##aaaaaaaaaaabcbbbbbbbbcdcdddefgeabbbbaabccaabaaceddeeaaa##aaaaaabbbabbcdedbabbbaaaaaaaacfecaaaaabaabbbbbbcdfdbccbbbbbaaaaaabbbcdbaa#aabdb#########a#acdcccbaaab#aabccbbbbbbabbbceedccbcbbaaaa#baa#a###a#a##aa###aaaabaaaaaaaa##aaaabbaaabcbbbbbabbdfeaaaa#ababbcbbaabaaaaaa", "#####a#####aaaaaabbbbbbbcddcbabccaaabbaaaaa#a##a##a######aaaaaabaaaaacbbbffeaaaababbabbbbbaa##bbaaaabbbbcccghghgeffbaaabbaaaaaabbabccbbbbbbcdddefggecccbabaaabbbacbabbdddecbaa####aabaababbcccdcabaa#aaa###abceedcaaaaabbbbccddefdccdccbcbbaaaaabbccdccdb#abbd###a#####a#a#cddcccaaaaaaaaabccbbbbdeefbba##aabaaa#aaaaaa#aa###aaa##a####aaaaaaaaaaaa##aaaabacbabbbbbcbbbbcfgbaaa#aa#abbab#aaaabba", "##########abaaabbbbbcbcdcccdcbbbcbbbbbba#aaaaa#a############aa#aaaaaaababbdeaaaacbbbbbddcbaaa##abaaaabbbbcccghhhedecababcbaaaaaababcbbbbbccbddceggffecccbbbaaabca#aaaadddedcb#a##aaaabbbabbbbcccdd###aaaa#aa##bcefeddcddccefdddfdcccccccccbbaaaaaabccccdddaabbda########ab##bbbddcbbaa#aaaabcbbbcdddccaaaaa#abaaaaaaaaaa#aa#aaaabaa#####aaaaaaaa#######aabaacbabbbbbbcbbbbdfbbaaaa###baabaabaaba", "###########aaaabbcbbbcccbddbcdccbbbbcabbaaaaaaaaa###a##aa###aaaabaaababbccbbdb#abccabddbbbba#aaaabdbbaabbbbcdehihbaabbbbcdcbbbbaababbedcbbaccdddeeefedabbabaaa#aaa#aa#beeeeffca###aaabbbcbbbbbbcced#a###a##aaa#abffgfedcccfhcbdebcbccdccccbbaaaaaabbcccccddbaabdcb#.#aa#aaa##abdddcbbbaaababbbbbcbdbabbbbbb##ababbbaaaaa#aa#aa##aaa######ababaaa#####a#aabcbbbabbbbbbcccbbbeabcbba###aaaaaaaaaab", "b#########aaaaababbbbabbbbdebcccccbbbabaaaaaaaaaaaa########aa#abbaaabbabbdbcbbbaaadcbcbdbabba##aa##abcb#aaabcdcfhgdabbbccdcbcbbbbbbabcgdcbdbbdedeeehfgdbbbbbaaaa#aaa#abddddgeedcaaaaaabbbdccccccbceeaa###a###aaaacfghhgedccggefbccccccccccbbbbbbaabbcccccccdaabaaccb#aaa###a##adedccbcbaaabbbbcbbcddbaaabbbbaadbbaabbaaa##abaaa#aaaaaaaa#aaabaa########abbadccaaabbbcccccbbdcbcbbba###aaaaaaaabb", "aa##########aaabbbbbbbaabbaccbceeebbaabbaabaaabbbbaaa###aaaba#aabaaaaababbccggcbaabccbbbccbca##aaaabdbbabbabbcdddghbabbccddcbbbcbbbbbccgfcbccceddddeddedddcbababaaaaaa#accdeffedbaaaaaaaacccccbbbccffb#a#####aaaaabfhgghhhhgghecbccbccccccccbbbbaaabbbbcbbbcdcbbabbcb#####abca#abccccccabbbbbbbbbdddbaaaaabab#cdba#aabaaaaaaaa#aaa#a#aa#####aaaa#######aabbbbccbbbabbdeddcbbeaabbcb###aaaaaaaaab", "baaa######a#aaabaabdbbcbabbaccccedaaaaaaaaaaaaaaadbaa#aaaa##aaaaaaaaabbbcbcccdbaaaaabdcbacbcdcaaaaaaaabaaccbbccdddhgcabcccdecbcbbcbbabadedbbcdedcddeeccdddeeedcbbcbaabbbabbcddddec#aaaaaabbcccccbccdffc##a##a#aaaaaafheffhgeccefcbbcbcccccccbbbbaaabbbbccbbddedbabbcc.##a##abc###cdcccbcbbbabbbaddccababbbaaabaddba##aaaaaa#aaa#a#aaaaa##aa##aaaa#######abbbbccbcbbbbdefeeccecaaaaa####aabaaaaaa", "bb#a########aabbbaaababcccdaacdbbaba#aaaaaa#aaa##acaa###aa#aaaaaaaaaaabcdcccaaaaaaaaadbcbbbbacc###aaaaaaaacbbccdcdfggbbbcccdecccddcbbbacdfdbcdebbbcccdcccccdcbefccbaaaaabcbbccabdfcaaaaaaabbdddccccccefe##a##aaaaaaaadfghhhdbbcccccbcbbccdccbbbcaaaabbbbdccddeeba#bbda######.acabbddccabcbbbbbbbddccaaaaaaaaaaabdca#a#aaa#aaaaa##a#aaaaa##aa##aaa#a##a##abbbbccbbdbbccefffeccd#a########abaaaaaa", "aa##########aaaaabaabbaaccdcaacbbaab####aaaa#aaaaaa#a####abaaaaaaabcaaabddcacda#aaabacbbbbddddcbaaa##aaaaa#abbdcccdegfbbcdcdefccddccccbcbbfdccecabccbcbbbcdddcbffdcccb#aacbaabcbbeecaa#aaaabcedddccccddfeb#####aaaaaabbehhfcccbcccccbbccccccbcbcbbaaabbbcdcceddcbbabba########bcbbcdcbbbbbbbbaacccccaaaaaaaaaaaabcba####aba##aaaaaa#aaaaaa##a#aaaaaaa#aaabaabbcbbbbbbbdffffeeeaa########aabcaaaa", "aba#a#aa####aaaaabbabbabbaccaaabaaaa#######a####aaaaa####aaa#bbaaaabaaacbddcbccaaaaaaaaaaacdeabcbba#a###a#aaabccccdeegfcbcdddeedcdccddccccfedddcbbccbbbbbbccddedecccdca#aaaaaaabacedcddcbabaabccccccccceccd####aaaaaabaacdghhfecccccbbccccccccbcbbbaabbbcccccddcddceaca########cdccdccbbbbbbbbbccbcdcaaaaaaaaaaaaaaba#####aaaaaaa###aaaaa##a####aaaa###aabbbbbbccbdbbbcdefffgaa#a#######aabaaaaa", "aa#####aa###aaababbccccbbbbcbaaababa#######a#aabaaaaaa####aa#abbaaaabbaabbdcbbcdbbbbaaaaaabcddbcbba#####a#aaabcdccceefhgbbdcceeeeccccccddeefeeecccacccbcbabbccdefdbcebaaaabaababbbcdcdfffdabbbbbcccccccecade#aa#aabaaaabaackijkidbbbcbccccccccbcbbbbaabbccccccccddegfdaa#######ceedcbbcaacccccbcccccbaaaaaaaaaabaaaaaaaaa####aaa.baa######aaaa####baaa#aaaabbbbbccdcbbcddedfgfb##########abbaaa#", "#a########aaaaaaccbbcdcccbbbba#aaaaaa#####aa#aaab#aaaa#.###aa#aabababcbabaccbccdedaaaa#aaaaabccacbaa#a######aacbcccdffhigeccccdeedddccbcddffdefcbabbbcdecbabbbbcddecddbbaaabbabbbcccddeeffabbabbbbcccccdecdedb#a#aaabbaaaaahifgikfcbcccccccccccbbaaabbcbbbccbbbbcccdhea#a#####aedfebccccbbcbcccccccbaaaaaabaa#aaaaaaaaaba#b###aaa#b#######a####aa##abbbabaaabbbbbcdecbbcdedefghc#########abcedcb", "a############a#abcbbbcddccbbbcaaaaaa#a####a#a###ba#aa#######aaba#bbbbbccaabcccddeebaaaa##aaaabaaabaaaa#####a#aaaabcbdeggihfccccdddffdcbcccdfcbcbbbbbbccbbbbabaabcdfebcbbca##aabbbbcdcdfffeeaabbbccbbcccdeeddeed##aaabaaaaachgcccfijebbcccccccccbbaaaaabbbaabbaabbcbbcfecaaa#aaadcddbbdcccabbcccbbbabbaaaa#aaa###aaaaaaaaaaaaa##aaaaba######a######a#abbbbbbabbcbbbddcabcddddefgfa########aacedcc", "#######aaa#####aaaccccddcdcccbbaaaaa####a####a#aaaa#aa#######abaaabbccacdaadccdddccba#aa#bbaaabaaabaaaaaa#aaaaaababbbdeffiiebcccdddeedcccdcfbcbbbbaabcbbbbbbaaaabcdeefeeddedbaaabcbdccefffffabbbbbbbbbcdcdddddefbaabbbbabaeidccddcejgbbccccccccbbbbaaabaaaaabaaabccccdffebaabbaaddcc#cdccabcccccbbbbbaaaaa#aaaa##aa#aaaaaaaaabaaaba#b##a####a#a#a##a#aabbabbaabbbbddecbbdcccddeega.##.#a##aab###", "#########a#####ababccbbbdcccccabbb##aaaaaa#aaaaa##aaaaaa#..###aaaaaaccbbdcbbccdbccdaa##a#a#aaaaaa#ba###a#a#aaaaaaabbbcdeefhgeccedbbcdedeedgebbbbbbbbcdcbbbaabaaabacccddccccbdcaabbadddeefffgfbabbbbccccccccdddbggbaabbbbabhefcccddddihdccccccccbbbababaaa###aa#aabbbcdeeffa.##abcfedabccbcccabcbbbbbbabaaaaa###aaaaaaaabaaaaaaaaaaaaba#######aaab#####aaabaaaabbbaceffecbccddccdec#####.##aa#aa#", "#aa########a####abbccbbccdcccbbbbba#a##aaaaabaa#aa####aaba#.##baaaabccdabdbabbbbbcccbaa####aaaaaaa#aaaa######aaaabbabccdfeehihfggfdbceedddeddfdccbbcbbbbbbbbbbaaabaccccbbccdddecababedefffffhgdaaabccbcccccdddbfhfbbbcbbackdeeccdddccfhgbccccbbbaabaaabba#####a#aabbbdeddeda.###aeddcbaaccccccccbbbbbabaaaaaaaaaa##aba##abbaaaaaaaaaab######aa##aa###aaabbbaaaaabbbeffffdcdcdeffda######.###aaa#", "#aaa############aabcdcbcdcfedeecbbaba##aaaaabaa###b#a##aaaa####abaaacdcaacdaacbcaaaaaaaabc##aaaabaaaaaa######aaaaabbbdddeddfhhhhhhfcccffffdbaabcbdbabbbbbbbbbbaaaaabbcccbbbbcfdedbbadeddeefdefhffecbbcbcccccceddgibbbbbbdecccbbccccddddhidccccbbaacaaabba########aabccedddeda####cdcecbccccddddcbbbbbabbaaa#a#####a#######abaaaaaaa#aaaa#a##aaaa#a####aabaaaaaaaaabccddfgfddefge################", "##aaaaa#aa######aaabdccbccdeefebbaccb###aaabcbaa########aa######aaba#bdbbbcabbbbbbaaba##aba#####ababaaa##a#a##aaaabbcddedddeeefhghfddccdhecbbbaaaababbbabbabcbaaaaaabbccbbbbbbeefdbbbddbddffdggihiebbbcbbcccccedeicbcbbcdccccccccddddddcfifccbbbbabbabbbaaa####aa#aabcedddefeb##.bdcdeccbcccdddcbabbbbaaaaaa#aa############abaa#aaaaa#aaaaaaaaaa#######aabaaaaaaaabbabbcefgecbcc############a#a#", "##aaaa####aa##a##aaabcdcbbccdcdccbcaba##aaaabbbaa#aa#a####a######aabaaabaaaaaaaabbba#aa###a##a###abbbaa#aaaa#a##aabbcededddddeghggcdfedffddcbbbaaabbbbbccabbbbbcaaaaabccbbbbbbeccefdbcdbcbcefefhgghdbbcbcccccccdcefedbadccbbcccccddddddddeggcbbbaacaabbbaaa######aaaabdcdeedefbaa#deddcdcbbcdedccbbbcbaaaaaa##################aaaaa#aa##abaaaa#aaa#aa##aaaaaaaaaabaabbacdbacbaaba###############", "##a#aaa####aa##a##aaabbbbbcdeccbbaaaaabbaaabbaabaa###aaaa#########aaab#aaaaaaaaabbaaaa#a#a#aa#a#aabaaaa###abb##aaaaabcdeeddefghhhebbbfebbdddccbbbbbaaabdcbcbcbacbaaabbabcbbcccddbbcefecdcbbbcddehgggcbbcbcccccccdddffbbdbbbbbccccddddddddddegcbbaabaaabbbaaa######aaabbbcdefdeca#ddedcdddbacadedccbbbbbabaaaa###############.####aaa##a###a##aaa#aaa#abaabaaaaaaaaaaaaabcdbaaaa#a########a##a###", "a##a#aaaa#####aaaaaaabcccbbcdebbaaba#a#bbaaabbaaaa####aaa#####aa#abaaaaaaaabaaaaaabbbaaaaaa#aaaaaababaaa####aaaaaaaabcddddefedhhgbbbbcefbcdedcedabbbababbbcbbbbbbaaabbaabbbbbcbcddbbbcdcebbbbdcabehhebbbbcccccccceddhfddbbbbbccccddddddddddcdfdaaaaaababbaaaaaaaaaaabbbbccddcdfededffddddcbcabcddccbbcbbaaaaa#####################aa##a#a#######aa###aaaaaa###aaaaaaaaaabbccaabaaaa######a######", "aaaabaa##aa####aaaaaabbccccbcccaabbba#a##aaaabbb######aaaaba##aaaaababb##aaaaaa#aabaaaa#aaa#aabaaaaaacbaa####aaaaaaabcdeddefefhheabbbbbdfgfgedcfaaabbbbbbaaaaaacabaa#baaabbabaabbdeeeccabdccbbbcaachifbbbcccccbcccddejkeabbbbccccddddddddddccceebabbaabaaaaaaa#aaaabbbcbbcccddefgedfedddcccbaabcdcccbcbcaabaaaa########.##.########aa###a########aaaaa#a###a###aaaaaaaaababccaabaa#########aa#a#", "##aaaacb########aaaaabbbbcccbdcddbbcbc#aaaca##a#aba######abca#aaaa#aa###aa###aaaaaabbaaa#a###aaaaaaa##bcbba###a#aaaabbceedddehgfdaaabaccbfhiihffcaaaaccbaaaaaaacabaaabbaabcbbbbbbbcbdeffedfdb#acaabafjgbbcbcccbccccdefiicbbbbacccddddddddccccbbcfbbbbbabaaaaaaaaaabbbcbbbbccccdegfecfdbaabdabbbbcccdcccbbbbaaaa###################a#aa##a#a##a####a#aaaaa###########aaaaaabbbbbaabaa#######aa###", "###aaacba#######abaabbdcbbcdcbbefcbabcbbaaaaa####aa#a#a#a#a##aaab###a#aa####abb#a#aacbaa####aaaaaaa#aaabdcbaaaaaaaaabaceefeeffffbaaabbabccehigfeeddefdbabaaaaabbbabaabaaaaabbbbbbabccbabdedda##aaabbachhbbcbccccbbcccdeghebbbaccddddddddddccccbacecbabaaaaaa#aaaaabbbccbbbbcccdcdgfdfebbbbbcccbcbcddccccccbbaaaaa################aabbaaaa####aa###a##aba#############aaaaabbbddbbaba##########.#", "####aaaba#######aaaaabdfdbbcccbbdebbaaaab#aaa#a###aa###aaa###aba#####aaa#####aba#aaa#baaa#####aaaaa###aabcccaabbbbbcbbbdfffgeccebaaabbbbcbbeffedccfghhebaaaaaabbaaaaaaaabaabbabbbbbacbbbbcbdda####abbabghabbbccccbbccddddghdaabcddddeedddddcccbbabdfdaaaaa##aaaaaabccccccbbccddcbefdffdcbbbcdccbbccddcccccbbbaaaa################bbccbaabaa#aaaaaa#aabba##a#########a#aaaaabbccbcabaa###########", "#####aaaba#######aaacccefcccbcdccbcbbaaaaa#abcba#########aaaaaaa######aaaa####aa##aaa#aaaaaaa##aaaaa##aaaccddcccdddddcceeffdccdccbaaaaabbbbcfggdddfffggfebaaaaaaaaaabaaabccbbbbbbbabccbbbbbcbdb###aabbbbghbacccccccccccdddfigdbcddddddeddddcccbbbabbfeabaa#####aaaabcccccbcbdddecegfffcccabbccccbbccdcccccbbbbaaaa############a#aaaababaaaaaaa#aaa##aaaa#aaa##########aaaaaabbcccbbdba#########.", "#####aaaaa######aaabddefcccbabdccccbaaaaaa###aaa######aaabaabbba#######aaaa####a###aaaaaa#a##a#aaaaaaaaaabcddddcdeeedefgfefecdaabbaaaaabbbbbadfebcfdfgffeeecaaaaaaabaaacabdbaaabbbcdcbbbbbbbbccb#a###abbaegcabccccdcccccdddcfihfdccdddddddddcccbaaaaaddbaa######aaabccccbcbccdddhfcfgecccbbbbcbccbccbccbcccbbbbaaaa#a##########aaaaaabccbcba#aa#aa#aaaaa#aaaaa###########aaaabbaddedaa##a#.#####", "####aaaaaa#######cffdabcbcdcbbadfbcbbaa###a#aaa#aaaaaaabaaaababaa#######a##a#########aaa##aa##aa#aaaaaaaaabdeddccddddddffeeeec#a#aaabbbaaabbbcggdcfeeeeegfdccbabccbbaaabbbcaaaaabbbcdbbbbccbbbdbaaa###abbccebabbccccbcccccddcdfhjhedddddddddccbbaaaaaabdda#######aaabbddccbbdddedccdgeeedccbbccdccbccbcbccccbbbaaaaa#########.##aaabbaabbbcbaaa###aaaaaaa#a#a#a########aaaaabbaccddeb###########", "########aaa######acddbabcbbcccabcddcaabbaaa##aaaaaabbbcaaaabbaaaaaba########aaa#aa###aaa###aa##abaaaaaacbbbcdffeddeccdffffeddbaaaa#abbaaaabaabegebdfeddeffeddddcdddcabbacbcbccbaabbacccbcdbbbcdb#aa##aabbbbbffbbccccbccccccdddedfkkidddddddcccbbaaaaabbabdb#a#####abcccdbccccddfcccdfgeedccbbbcbccccbbabbcccbbbbbbaaa############a#a#aaaacacbaaa####aaa#aa###a##a######aaabaabbbbbbdfa##########", "#################abbcbaacccccbccaacbcaaaaaaaaaaaaaaabccabbbbaaab##bb######a#aba##aa##aaaaa##a#a#acabbbacdcbcddffffdgeefefeddcb#a##aaaaabaaaaaaddfdcfdccccccdcbcbcccecbbabccdddddcbbbbccccccbbbceb#aa###aaaabbfgbacccbcccdcdddeedgjkihccddcccccbbaaaabaabaadca####aabbcccbcddccefdcdeeeedddcacbccccccbabaaabbbbbbbaaaa###########.#####aaaabacbba##aaaaaaa####a####a######abbabbcbcbcdb###a##.##.", "###########aa#####bdbaaaaccddbbdcba#bbaa##aa#aaaabbbbbbaaabaaaaba##aa.####aaa##a#aaaaaabbbaa#####abaabbbbbccdddeefeffddefdccaa####aaaaaaaaaabaeefdedeccbabbbdddbbccccabbbbbbbbcdcccbcccccccccbaaaa#a####aaaabacgcabbcccdddefffedgijfehdcccccccbbbaa#aaaaaaabcbaaaaaabbccdcdddefgecddeefedccbbbabccbbbbaaaaaabbbbaaaaaa################aaabcbabbaa#aaaaa#aaa###a####a####aaabaabcbbbcbba###aa####", "############a#####abaaaaaabddccbcdddbaaaa###aaaabaaabbbaaaabbabba###b######aa######a##aacbcbba##a##babbccccdddddeeefgfeedccdb####a#aaaaaaaaaaadefedecbabbbbbcddddbcddcaabaaaaaabbbbbaabbccdcccbbbcb#a##aa#aaabbbfdbbccddddeffffefggeedjhedcdcccbbaaaaaaaaaaabbcaaaaabbcdcccdeefgdcccdefeccbbbbbbbccbbbbaaaaaaabbbaaaaa#######aa######aaabbbcab#a#aaaaaaaa#a##a#####abaaa#abaabbbbbbdccc####aa#.#", "###aaa###a#a#a####aabaaaaaabdbbbcecdcbaaaaaaaa#aaaaaaaaaaaaabccbb###a########a#a#aaaaa##aaaabca#a##aabbccccccdcccbbbbcbcabbbb#a#a#a#aaaabaaaabbeffddeabcbbbbcccccdccbbbaaaaa#abaaaaaaaaaababbbbbcbb#a##a##a#aaaabefcbdeeddeffffffeddfbchjieccccbbbaaaaaaaaaaaacfcabbbbcdddcdehggffeeddgfecbbccbbbccbcbbaaaaaaaaabaaa######a##aaa####aaaaaaabbaa##aaaaaaa#aaaa#####aabbaaaabbbbbbccccddbaaaa####.", "####aaaaa#aaaa#aaaaaaabbaaabccbbbcddbbdcbaaaaaabaaaaaabbbbaaaaabaaa###############aaaaa##a#aaaaaaaaaaabbccccdcbbbaaaaaaaabaaa#######aaaaabbbabaacffffbbbbbbbbbbbbccccbaaaaaaaaaaaa##aaaaaaabbccca#######aa###aaaabcgfcdeeefgggggggeffcbbehkjebbcbbaa##aaaa#aaaadheabbbcdddcegfbccdfffgggedccccbbbbbabbbaaaaaaaaabaaaaaa######aaaaa#aa##aaaabaaaaaaaaaaaaa##aaa##aaa#acbaaabababbcccdecbaaaa###a#", "#######a###abaaaaaaaaaaabbdccccbbbceefebcaaaaaa#aaaaaabbbcccaabaaa###aaa#######a###aaaba##aaaaaaa#aaaabccccccbbbaaaaaaaaabaa###a###a#aaaaacbababa#eeedbbbbcddbcbccbccccaaaaaaaa#a#aaaaaaaabbbbcba########aa####aabbbghdeeegggggghggfedbbbcdikgbbbbbaa#aaaaaaaaaabheaabccddegdccccdddccfffddbbabbbcbbbbbbbbbbbaaaaaaaa########a###aaaa#a#abaaaaaaaaaaabbabaaaaaaa#a##ccaaaaaaaaaabcccbacaaabaa###", "##a#aa#####aaaaaaaaaa#aabbbabbcbbabcdeedcbbbaaaaaaabbbccdddccccbbccbdcbcca########aa####aa##a#aaa###aabbccdccbbbaaaaaabaaaaa#########aaaaabcaaabaa#dfcccbcccbcccccdccccdbbaaaaaa###aaaaaaabbbcb######aa###aaaa###abbcfheeffghhghhijifcbbbbbehjhcbbba##aaaa##aaa##afgdbbcefecdcdccddddddeedcbabbcbbabbcbbbaaaaaaaabaa######a#a#a###aaaa#aaabaaaaa#aaaaaaaaaaaaaaaa#a#bcaaaaabaaaaabbcccbcabbbaaa#", "aaaaaaaaaa#aaaaaaaaaaaa#abaa#aaaaaaaaabcbbaabbbabbbbccddddddefdbcdccdecddcaa##aab######baaaa##ab###aaaabbbcccbbaaaaaaaaaaaaaa########aaaaaacdbaabaa#dcabccdddcccccdeeddddddbaaaaaa###aaaaabbbca#a#########a###a##aaabcegefgfhhggiiihddbbccbbfegihfb###aaaaa#aaaa##adgfefecbddccccddcedccefdcbabcdcaabbbbbbbaaaaaaaaaa#a####aaa#aa###aaaabaaaa#aaaaaaa#aaa##aaabaa##abcbaaa#aaaaaaabbbbdddbbbaaaa", "aaaabbabaaaaabaaaaa#a#aaa#abaaaaabaaaaaaaaababbbbccdddeeefdfffedccbbbbcccccaaaaacb#abaab#aaba#aaa###a#aaaabccbaaaa##aaa#abaa###a##a#aa#aaaaacca#abaaadbabddddfededcbbcaaabcddcaaaaaa###aabbbcdca######a####aa##aaaaabbcdkgghhhhhgiigecabbbccffedgiida#aaaaaaa#aaaaaabfecbccccbbbabbbddddddccbaaacdcbbcbbbbbbbaaaaaaaaa##################baaaaaaaa######aa#aaaaa#a##abbbbaaaaabbaaaababbddcbbbbaa", "aaaaabcccbbbaabaaaaa#aaaaa#aaaaaaaaaaaaabaaabaaabbbcdffefgffdcccdddcccccbaabaaacbab#aa##aaabb#a#a##aaaaaaabbbcaaa###aaaa#aaa#a###aaa#abaaaaaacccbaaaabcbaaccbbdccbbbababba#abccbaaaaaaaaaabdeabaa##########aa####aaaabbceghghhihiihhgcbbbbbbegdcdedhhdd#aaaaaaaaaaaaabdccccccaaabbbbcddddfeffdbbabcbbbbbbbbbaaaaaa###a#########aa#######acbaaa#####aaaa##aaaaaaaaa#a#aaaaaaaaaabbbbaabbccddbbbba", "aaaababbbccbbcbaaaaaa#aaabba#aaaaabaaaaababbbbbaaaaaa#aabbcaaabbbbbbbbbcbaaaaaabaaaa####a##aaaa######aaaaaabbbbb#######a#aaa#a###a##a#aaa#aaacbbcbabbabcabbbcddbaaabbaaaa##aaaabbaaaaaaaabbcdbaaa###########a####aaaaabbbcfihghhhihhhdabbbbbbeeccccbdehfaa##aaaa#aaaaaabedccbaaaabcdcddcbfeffddeedccbbbbbbabbaaaaa#############aa########ababaa###aaaaa###aaaaaaaaa##abaaaaabbbbbbbbbbbbcdffabaa", "aaaaabbacbbbabaaaa#aaa#aaaacba###aaabaaaaaababaaaaaaaaaa##aaaaaaaaababbccc###aabaaaa##a##aaaaa#aa##aa#abaaaacccb##a#a#a#aaaaa####aaaa###a#aa#ababdbbbabcbabbbbbbbbbcbbaaaaaaaaaaba#a###aaacbcdaaaa#########.#####aaaaaabbccfkjgfhhifdfdaaababbffcbbbbbacgda#aaaaaaaaaaaaaddcba#aabccccdbbdeefeddfdfecbbacaaaabbaa##############aaaaa#######a#aa###aaa####aaaaaabaaaaaaaba#aaababbbcccddddgihcabb", "baaaaababccccbbaaa##aaaaaaa#cddb#####aabbbbaaaaaaaaaaa#####aaa##aa#aabadedca#abbaaaaaa####aaaa#a#aaaaa##aababcbca#aaaa#####aa###a#aa##aaaaa#a#aaacbaabbbcbabcccbbbbcbabba#aaaaaaaa#bbaaaaabbadb###################aaaaaabacbgkkihhggfedaaaaaaaceecbaaaaabffgeca#aaaaaa###acdca#aaacbbccbcbeeefffdabdfecabaaababbaa#a##########aaaaaa#######abaa##aaaa#####aaaaaaaaaaaaaabaaabaabbbbbcdegghffdabb", "bbaaaaaabbcccccbbaaaaaaabaaaabccca###aabcceebaaaaaaaaaaa#a##a#####aa#aaaddbbaaabaaaaaaaaaaaaabb##abb#aaaaaaabcbba##aaa###aaa#########a#aaaaaaaaaaaaaabbbccbaabccbcbbbbbaaaaaaaaa##aaabaaaaccbed#################.##aaa#aaaaacekljihhhdbaaaaaaabdeedbaaaaaabceffdaaaaa#####abdd##abbbbccccbcedfeddbbbbdddbbaaababaaa#################aa#aa.###aa##ba##aa###aaaaaaabaaaaabaaaaababbabbbdfhjifeecba", "bbbaaababaabbcccbaaaaaa#aaaaa#aaba##aaabcbbccbaaaaaaaaaaaaa#aa####aaaaaabccbaaa#aaaabaabaaaa#abdca#acaaaaabaabbaba#aaaaaaabba##aaaaaaaaaaaa##a#aabbbbbbbccbbbacbcbabbbbbaaa#aaa##aaaaaacbccccdbbba#a########a#.####aaaaabaaaaafklljhfcaaaaaaaa#dcgfcbbaaabccccdggcbaaaaa#aaaacdaabbbbbbbbcbddeeddccccbbcecbaaaaaaaa#a##############aaa##a####aa##b###aa#aaaaaaaaaaaaaa#aabaaaaaabaabbdggghhfbdeb", "bbabbaaaaaabbcbccbabba#aaaa##a#aaa#a#aaabbabbbaaaaaabbabaaaa#a#####aaaaaadcba###aaaaaaaaaaaaaaabbaa#abaaaabbbcbaa#aaaaaaaaaaaa#aaaaaaaaaa#aaaaaaaabbbbbbbcbababbbcbbbbaaaa###a###aaaaaaaccddcddbaaba#aaaa####a#.#.#aaaaabbaaa##djlljc#aaaaaaaa#afdfebaaaabccccddegfdbaabbbbbbabddbbbbbbbbbadceedcdcccbbabdebaaaa#aaa#############aaaaaa#ab####a##ba#####aaaaaaaaaaaaaaaaaaaaaaaaaabcdfebbbabbbcc", "ecabbaaaaababcdcccbbbcdbaaaabbaa#aaaa##aabcbbbaabaaabbaabaaa#aa###aaaaaabecbaa#a#a#aaaaaaaaaa#aaaaaaaaaaaabbcbaa###aaaaabaaaaaaa#a####aaa#aabaaaaaabbbbbbdcbbabbbcbbaaaaa####aaa#aa###aaabcccccbaabbba##a####aa#####aaaabaaaaa##ahlkfa#aaaaaaa##fbbecaaaabccbcdddceghecbbccccbbbccddbbabaa#ccedddddccbbaaacfbaa#a##a############a##aaaaaaaaa##a###ca#aa###aaaaaaaaabaaaacabbaaabbbbddea###aaaabc", "abbcbbbbaaaabbccbbbbaaaa#a#aaaabcaaaaaa#aabbbbaabaaccbbabaaaaaaaaaaaabbabdcbaaaaa###aaaaaaaa#aaaaaabbbaabbbabaa#aaaaaa#aaacbbaaa##aa##aaaaabcbaaaaabacbccccabaabaacbcbaaa####aaaaa####aaaabdccdba#abbaaa#######a######aaaaaba#####dljfa#aaaaaaa#ddaadcbccbbbbccccdccehihfddccccccbbdfaaaabbbceefedddcbbbbaaaecaaaaa##a###a####a##a##aaaaaa####a###ba#aa###aaaaaaaaabbbbacbbbbbaaacccdd#####aaaab", "babbbcccbbbaacdbccbbbaaaaa######aaaaaaaa##abbbbabaaabbaaaaaaaaaaaa##abbbdcccbaa#aa#####aa#aaaaaaaaaaabcbabbabaa##aaaaaab#accbaaaaa#aaaaaaabcddbaaaaabbbccccbaabbbbaabbbbaa###aaaaa#####a#abceeeaaa#aaaaba#######a#######aaaaaaa###.cgjgb#aaaaaaaafcaacdcdcbcbbcbbccdeefeeghfeccccbcddc#aabaaaeffeccccbbbbbaaacdcaaba##aa##a#aa#aaaa#aa###a####a####b#a##aaaaaaaaaaaaabbbbcababbbbcdddeb#a#####aa", "bacbbcddcbbbbacddccbabbaaaaaa#a##aaaaaa####aabbaaaaaaabaaaaabaaaaaaaaabbcccbbabaaaaa#a#aaaaaaaaaaaaaaaabbccbbba##aaa#aaaaaabbbaaaa#aaa##abbaabbcbaabbcccccbbbbbabbbabbbbaa#############aaabbcedbaaaaaa#aaa######a########a#aaaa##a##adhjc#aaaaaaacdb##bddcbbbbaabbccefgecceffgfcbceccedabbaaacffdccbbbbbbbbbaabccbbaaa#aa####a###aaaaa#a##bb##a###ab##a###aaaaaaaaaaabaaabbbcbcbbbcefeb#####aa#a", "aaccbcddcbbabcbcddcbbbcbaaaaaaaa#aaaabaa##a#aaaa##aaaaaaaaaaaaaa#aaaaaaaaabbccaaaaaaa#aaabbaaaaaaaaaa##aabccccbaa#aaaa#abaaaaaaaaaaaaaabbbbaabbaccbddedcbbbbbabbbcbcbbcaaaa############a#aacbcba##aaaaaa#aaa#a###########a###aaaaa####adid#aaaaa##eca##addcbbaaaabbcddefddefddgiedccccffbaaaaaefeccbbbbbbbbbaabacdbbba####aa#a##a##aaaaaaccbba###.aa#aa#ba#a#aa#aaaaabbabcbccbcbcccegc######ba#a", "abcbbccdedcbbbabdddcbabbbbbaa##aa#aaabaa######aaaaaaaaaaaaaaa#aa#######aa#aabcbbaaaaaaaaabcaaa###abaaa#aaabcbcb#aa##aa#abbaaaaaaaabbcaaaaaabbgecbbbbccbbbbbabcabbcbbbbaaaaa##############aaabaaaa#aaba#######a###########ba#aaa#aaa###aabffcaaaaaabeb####cdcbaaaaaaabbccdeffeeegihfddddffcaaaabefeccaabbbbbbbaaaabdba#aa####aaaaa###aaaacccbbba#######aaaa#aa#a##aabbbbbbbccccccccddgf#aa##a#aaa", "aabcdddddddbbbccabcdccbaaaaaa#####bbaaaa#######aaaaaaa###a#####a#########aaaacbbbaaaa#accdddba#a#aaaaaaaaabbbcbaaaaa#aaaabaaaaabba#bdaaaaabeecbbcbcbccbbbbabbbbbbbabbbbaa#aa####a########aaaaacaabaabaa#######aa########abbbbaa##aaaa###aaegfb#aa##dcaaaabddbaaa##a##aaabcdfgffgiggfffedefea#aabffccbaaabbaaabaaaaacbaaaaaaa####a##aaaaaabbabaaa##aa##aaaaa######aabcbaabbccccbbddedeeaaaaa#baaa", "aabbdeedeedddaccbbbcbcccbaaaaaabbaccaaa#a#aa###aa#aaaa#########aa#a#####a##babbbbbcbbcfdccccbbaabaaaaabaabbbccbbaaaaaaaaaabaaaaaaaaacfcaaabcbbaaababbcaabbbabbbbbaaacbabaaa####a##.########a#abd##baaaaaa##.###aa#######abbadb#a#########aaeiib####bca#aabadcba########aabccdgghgfeddddeedegdaaabdedbbaaabbabbaaaaa#cbaaaaaaaa#a##a#aaa#abbbbaaa#aa##aaaaaaa#####aaabaabbbbccbbbcdecef######acaa", "baabcccddedddbacccbccdcbbbbaa####aa##aaa###a###aaaa#a#####aaaa#a#aaa###aaaaabbbbbabcgjfdccbbbaaaaaaaaaaaabbacccba###aaaaaaab##aaaabbbdfdbaabdecbbbabaabbbbbbbbbbbbababbaaaaaa######.########a#acdb#aaaaaaa######aa######abbccb####aa######afiifa###bca#aaaabcbba#a######aaabcdeefcbcedccccceffaaaaacdbaaabbbaabbabaaabcbbaaaaaaaaa##a#a##abbaaaa#ba##aaa###a####aaaaaaaaaaccbbbcccdeff.######aaa", "a#aabbbcdeddcccbcccccdcbbabaaaa##a###aa#a#a#####aa##a###a##aaa####aa#a#a#aaabbaabbbbbffdccbbbabbaaaabbbbbabcbbbaaa##aaaaaaaaa###aabcbbcdfdaacebbbbbaaabbbbbbbbbaaaaabbabaaaa###aa############abcdcaaaabbaaa######aa#####abbbdc#############adghf###cdaa##aaaabbaa##.##.##aaabcdecedbbcdecbbbccebaabacdaaaaabbbbbbbaaaaabdcbaaabaaaaa##aa#aaabaaa#bcaaaaaa###aa#a#a#aaaaaaaaababccdceec##########", "###bbbbcdeddddcccccbccbccbbbaaa#####.#a##aa######a##aaaa###aaaaa##a###aaaaaabbbbbbbccddcdcbbbbbcdbbbadecccccbcb###a###aaaabaaaa###accbbccfhcacbbbabbabbbbbbbbaaabbbaabbbaa####aa#########.####aabcbaaaabbaaaa#####a#####aabacfb###############dhhc.ddb###a###bbca#.#....##aaabcdccecbbccedbbcccedbabbdcbaaaaaaaabaaabaaaacccaabaaaaaaaaaaa#abaaabbcaaaaaa###########aaaaaaababbbceeda.#####a###a", "#baaabbcdeddddddddbbcccbcbbbbaaaa################aaababba####aaaaaa###aaaaaaabbaabbdecbccccccbbbccccbcbbbcbbddeeca###aaaabccaaaaaa##abbbbcdedbbabbaaaaabbbbbbbbaaaaaaabbaa#######aaa##########aabbbaaabbaabaaa########aaaaaabdfb####aa#########cghhceba###a##aabaa#.....###aaabcdceebbbbbddcbccbcdcabcedbbaaaaaaaabaaaaaa#cddbbbaaaaaaaaaaaaaaaaccbaaaaaba#a#a######a##a#aaaaaaccdeed####aa####a", "aaabaabccceeddeedcabbbcbbcbbbbbbaaaaa#########a##aaaaabbcbaa#aa#aaaaa#aaaaaaaaaaabbcddcbbbbbbbbbbbbbabbbbbbaabbdgfba#aaaaabbaaa##aaaaaabbbcceedaaaaabbabbbabbbbbbaaaaaabba#######aba#########a##abbcaabcbaabbba########aabbaabddca#aaaaa#########adjhaaa#aa#####aaa#...####aaabbcccfdabbbbbddcccbbccacffccbaaaaaaaaababaaa##bccccbabaaaaaa#aaaaabdcaabbaaaaa#########a#a#aaa###bcddhga####aa####", "##aabbbbcdffeddeebdcbbbbbcbbcbcbaaaaaa##.##aa######aabbbbaaaa#aaaaaaa##aaabb#aaaaacddfbcbabbccbccbbbaabbaaba#abadfdbbaaaabcaaaaaaaaabbbababbceedaaaabbabbbbbbbbbbaaaaaaaaa##.#####aa#########aaa#aacdabbbaaaaaaaa#######bbbbccdcddbaabbaaa####aa###bhgea#######.##aaa#####aaaababbbcebababbabdeccbbbceffeecbaaaaaaaaabaaaaaaa#bcccbbbbaaaaaaababbbbbaaaabaaa#######a##a#aa#aaaaabddhg###########", "#a#aaabcdddffdddeeedbbbbbcbbbbcbbbaabaaa#a##a##aacaaaaaaaaaa#a##aaaaacdaaaabaaaa#accdeaaaaabbbbccbbbbaaaaabbbababcdddcccbbaaaa#aaaabbbaaaaaabdeeeaaaaaababbbbbbaaaaaaaaaaaa###a####ba####a####aaaaaabecaa######aaa#####a#ababccccbcbabaaaaaaa###a####dijdb########a#a###aa##a#abbbbddbaaaaabbabdddcfeffffeccbbaaaaa#aaaaaaaaaa#abccbcabaaaaaaaabbaaababaaaaa#aaaa###aaa#aaaaaaaaabchga#####aaa##", "#a#a###abccdddefdeeecbbbbbbaabbbbbbbbba#########abaa#aaaaaaa##a#aaaaaccbaaabbabbcbbccfbcaaaababbbbbaaaaaaaaaaaabbbabbabaabaaa#aaaaaabbabaaa#abcdfea#aaaabbbbaaaaaaaaaaaaaaaa#######bba##########aaaabcedbb#######aa#####a##abdcbbccbaaaaaa#aaaaa#aa###bgjjga#######aba#aadba##aabbbccbaaaaabbaaabedffeffffdcbbaaaaaaaaaaaaaaaa#aaaccbbbaaaaaaaaaaaababbbaaaa#aaa#####aaaaaaaaaaabbbghc#####aaaaa", "a##a#aa#aabccbdfgeefeccababbbaabaabbbaa#a##.######aaaaaaabba##aa##abbbcbcbbccacbbdedgheccbbabbaaaaaaaaabbaaaaaaaaaaaaaaaaaacbbba#ababbbbaaaaaaabdeeca#aabcbaaaaaaaa#aaabaaaaa####.##ba###########aaabbceeba########a#########cbbbabbbaaa#aa#aaaaaaaaa###djkjb#b#..#abbcaaabcba##aaabbcaaa#aaaaabaacfffffedffccbaaaaaaaaaaaaaaaaaaaabcbbaaaaaa##aaaaabaaabaa#aaaaaaa#a#a#a#aaaabbbbccgc######aaa#", "##aaaaaa##aaccbaeihfgggcbabbbaaaaacbbceceeca########aaaaaabaaaaaaaabbbdcccdebbcbbabacedecbbbabaa#aaaaaabbbbaaaaaaaaaa#aaaaa#abbbbacbbbbbbaaaaaaaccddbbbbbbbaaaaaaaaa##aaa#a##a#####aa#############aaabbceeea########a########aaaaaaaabbaa###a###aaa######agjkhgfb.#aabddaaaaaaa###aabdb##b###aaaaa#cffffeeeeeccbaaaaa#aaaaaaaaaaaaaabcbaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabbbbbdfeba####aaa#", "#a#aaaaa###aacca#cjjhhjebcbaa##a##acegebdcbdb#.#cbcaaaaaaaaaaaaaaaaaabbcdgiecbbaaabbbcbcdcbbbbbaaaa#aabaabcbaaaaa#aa#aa#aaa###aaaaaa####a###aaaabcddbcbbbaaaaaaa#aaaa#aaaaa##a#####baa#.#######a##aabbcdddffa##.####aa##.####aaaaaaaaaabaaa###########a####chhiihc..ceffbabaaabaaaaabccaacc###aaccbbegfffededdccbaa#a#aaaaaaaaaaaaaaaabcbbaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabcccefeaaa###aa#a", "aaa#abaaaa##aaba##eiiikhccbddefeeffgecccdccdeffefddc#aaaba#aaabaabbaaaabcdhfbbbbaaacdecbbaabbbcbbbbaaaabbbbbbaaaaaa#######a###aaa#aaaaa######aaaaaccbcbaaaaaaa####aa##aaaaa#####a##############a##aaabcccccdfb##.#####a######aaa#aaaaaaaaaaa##########aaa##.#aejjifb#cffacbbbaaa#acbbcc##ddda##cddeefgfffeedddcabbaa#aaaaaaaaaaaaaaaaaaacbbaaaaaaabbabbbcaabaaaabbabbbbabbbbbbbbbbbdfc####a##aa#", "#aaa#a#a##a####b###dgkkjgccfiifdfdeeccddddcdcccccbca#aa##aa#aaaaabbbaababeggdbaaaaadfcbbbbbbcccbabcbaaaaabcabbbcbaaaaaa##########a#a########aa##a#accbbaaa#########aa###aaaa###aaa####.#########b##aabcbbcddfb###############aaaa###abbaaba#aaa#########aa#####djjjifbcebccdcba#bbacbcb##addccdcdeeefgfffeecbccbbbaaaaaaaa#aaaaaaaaaaaaaabbaaaaaaabaabbbbbaabababbbbbbbbbccccbbbbcced####a###aa#", "a##aaaaaaaaa#a#ba..#agkgfecfikgddcccdcccbcccbcbcbbdba##bccaaa#bbccccbaabbefffcaaaabdfbbbbbbbbccaaabaaaaaaabcbbbabbbbaaaa#######aaa############aa###abbaaa####a############a####a#######.#####a##aaa####aaaacfa#######..######aaaa###a#cdcbbbabcbaa#aab#########.chiiihfcddeghhgdccdabdaa#addcddceefeeffeeeedbbcccbbaaaaa#aaaaaaaaaaaaaaaaabbbbaaaaaaabaabbaaaababbbbbbbcccdccdcbbceea####aa###aa", "a####aaaabaaabbab#.#aaeecdhfijfcccddcccbbbbccbbbccaaa###.a#abccccbcbcbbbbbff#a###abcebabbbbccbcaabbaaaaabccbbbbbbbbbbbaaa#aa####aa##############aaaa#ababaa##############a#a######a####################aabbcacaaab#####.#.##abbaa###aaabcacbcaaaaaaa#aa#########.bgihiifcdgijjjiidaaabe#a#bdcbccccddddddecdecbbbccbbaaaaa##aabbaaaaaaaaaaabbbbbabbbaaaabbbbbaaabbbbbbbccdddedddefeffa####a#####a", "#######aaaaaaaaaa#.#abcdaahkkjgbbcccbbbbbcbbcbbbbaaaa#a######abddedccccbbacffcbb##acccacdcabbdccdbabaaaa#abbbbbaabbbbcba###a############.##.###########ababaa##################a##a###.################aaabcbcdbbbaa##.#.#.#aabaa###abcdcaabaa####aa#aabbb###a###.#bgjhacegijjjjjjhedfgea##cbbbccbbbcccccdcccbbbccaabaaaaaaaaaaaaaaaaaaaaaabcbabaaabaaabbbbbaababbbbbbccddddedffceedb######aa###", "aaa#a####a##aaa##a.##acda#cejjfdbbbbbabcbaabbcbbaa#aaa##a#a###baecbdfedddefhhgefea#cedbafecbbcbecbbccbbbbabbbbbbbccabbcdcaa####################.#######aaaaca##########################.########a######aaaaccccbbca#a########aaaa####bedcaabaa##aaaabaaabc########..#figefhikjihhhhiijiihd##bbcdbcccbcccddebcbbbbcdbaaaaaaaaaaaaaaaa#aaaaaabbcbbbbbbbabbbbbbbabbbbbccddedeedffa###a#####aaaaaaa#", "###aa############a#.##bccbbbbehhaabbbaaabbabbcbaba#aaa#######becdda#fgecddeehghegdabdecaabedbcaacbbddbbbbbbcbbbbbbdbaaccccba#########a################aaaaabcaba###############################a#####.###aaaabccbcb##a######aab##a###accbca#b#####aaaaaaaaa###.####...diihiiihfgeffeffhijid##ddcdccccccddddccbbaabddcaaaaaaabaaaaaaaaaaaaaaabbcbbabbababbbbbbbabbcbccdddedefc.##########aa#aaaa#", "#aaaaa#aaa##a######.#abbccaaaabgfb#ababa#aaaacbaaaaabbbab####edeefeccgedcddehhfacebadecaaaabcccbbbbcbabbbbbcbbcbccccccabccdb#######abb###a##############aaaacbccba##########a######.########a###a#########aabcceccb###a#####aaaa##aaaaacbb##ac######aaaaa##aaa#######..diihffffffdeddddefiigaaeddddbbcdddccdccbaaabcedbbbaababaaaaaaaaaaaaaaaabdcbaabbababbbbbbbbbbbbcceeegc.#############aaaaaa", "aabcbbaaaaaaaa########bbcdbaaaaaffa#aaaaa#aaabbaaaabcdeddabaefcdddefcgfddddeghcccffddbaaabbbbbccbccdbcbabbbbbbcbbbbbdcabbbddb########bca#a#######a##a###aaaaaaabdbaa#aaa####aca##...###aa####a##a########aaabbbdecc##aaa############aa#abba##a#########aa#aaaaa########.bgiedcccdccccccccdhigdeeeeedcdddccbcebaaaaaaceebbbbbbbababaaaaaaaaaaaabcccccfedcbbbbbbbbbbbbabcfffe############a###aaaaa", "a#aaedbbbbaaa#a#######abddca#aaaadcaa##aa####aabababbbccccfggcbcccccfgeccccdddffedfecddcbbbbccbbccdcddbbbbbbcbbbaabbcc#abaacba########aa##..#######aa####aaaaa###bbaaa#aaaaa#cc###a.####aa##aaa#########aaabbbbadcdaaabba##########a#aa#bbaa##a#######a#aa#aaaaaa#######.ageccbbbbbbbbbbbcbehigffeedddddccbcccbbaaa#accdcbbbbbbaaaaaaaaaaaaaabbcbccdbaadfdcbbbbbbbcbcefccba#################aaa#", "#aaacbaabbcbbbaa#######abcca##aaabbcba########abbaaabaabccdcbabbbccbcedccccccccccccedbbcdbbbccbcbbcbcbbbbbbbbbbabbbbcccbbaaaaaa##a####a#aa####.#####aa##a#aaaaa##abbcaaaabbbabcaaa#.#.###aa#a##a########aaabccabbddbaabaa####.##.aaaaaa##bba##############aaaa##a########.#bddbbbbbbbbbaaaaabfhhgfeedddccbccbdabaaabbbccddcbbbbbbaaaaaaaaaaabacbbcceb#a#babcbbbbbbcbce##.####################aa#", "aaaaaa#aaaababba#######abcccb#a#aaacddb######aaaaa#aaaaabbbbbbbcbbbbcdcbcbccbccccddbababcccccccccbbbbaaabbbbccbdcbbbbabcbbaa######aa#aaa############aa#####aaaaa#acbabaa#baabbcb#a##.#####baaa#########aaaabcdcccccbaaaa##########abaaa###aa##############a####aaa########.##dcbbbbbbbaaaaaaaabghgffedccccccbbcabbaaabbcbdedbbbbbbaaaaaaaaaabaaabccdecbcabbbcbbbbbcbeea###aa####################", "aaaaaaaaaaaaaa##########acceeba###bbbcda#######a####aaaaabbbabbabbbbbcccccccccbcbbcdcbaabbcbcccccbbbbbcabbbbddegebbbbbbbcaaaaa#########a######aba#####aa#####abaaaabcbb#aa##abaaba#####a##aaaaa######aaaaaaacccccbccaa##a#######aa#aabaa##aaa####aa########a#aaaaaa###########addcbbbaaaaaaaaaa#fieeeddcccbbbbbaaabaabbaaabdedcccbaaaabaaaaabbaabbbcdebaaccbbdddcbbcdc#aaaa###########.########b", "aaaaa#aaa#aa#############abcdfdaaaabcdf###aaaa##a#####aaaaabbccabbaaaabbbcccccbcbabbccbbbbbbbbbbbccbbcccbbbcdcdedecabbbbaaaaaaa########abb##aa#aaabaa#aba###a#aa#aabcccbabb###aa#aaa######aa##aa######aaaaaaaccccdaba###########aaa#aaba#aaaa#aa##a########aca##aaa######a######cffaaaaaaaaaaaaa#ehfeeedcbbbbbbcbaabbbbbbbaadeeefedcbaabbabbccbabbdcbcaabdcccccceedffb##aa####################a#", "aaaaa###aaaaaa#####.####aabccfgbaabbcfeda##aaabaaaaaa#aaaaaaaccbccbaaabcccbbccbbbbbbcbbbbbbbcbbbbbcabcccbababccdeccbabbbbaaaaa#aa########aaaaaaaabedaa##a#aaabaaaaabaccbaaaca###aaaaaa#####a###aa###a##aaa#aaaccbbabaa############aaaaaaaaaaaaa#########a##acdaabaaaa############acecaaaaaaaaaaaaafhffeddcbbabbcbbabbbbbbbbaabbdeddfeddbabbbdcabbabbababbbcbcbccddffcdaaaa##a###################", "aa#a#####aa#aaaa#########abcdcfeaaacbdccfcbbbdddbbbbbaaaaa#aaaabcbaabbbcccbbbcbbcccccccccbbcbcccbbbbbcccbbabbacddedcaabbabaaaaa##aa########cb##aa#cfdaa##aaababbbbaaaabbbbaabaaa#abaaa#####a#bbaaaa##a##aaaaaabbccdaaaaa#####bb#####aa##aaaaaaaa############aabbbbaaaa##aa##########deaaa###aaaaabcgiggddccccccccabbbbbabbaba#aabcaacccccbbcdbaacbbabbbbabcbcdddd####abaa#a##a#a#aa############a", "aaa#####aa#a#aaaaaaa######abccdfa#bbcddbcccdcdaaccdecbbbbbbbaabccbaaabbcccbbbccbccccddccccccddccbbbbbbcccbbbbbcccdddbabbbabaaaa########.####bba##a#aca###aaaaaaaaaaaaaabbbaabaabaaabba#######ababba.##aaaaaaaaabcdcb#aaaa#####a##########aaaaaa#a####aaaa##.##abbba#aab#aba#aa#a#####cgeaa####aa#aabfiigdccccbccccbbbbaabbbbaaaaaabccbbccccdabcbccaaaaabbbccdebdbaaaaaaaaa#a######aaaaa#########", "#aa#a###aaa####aa##a#####aabbbbeb#abbceeba#a####aaaba##cdbbbcccdccbbbbbbccbbabcbbbcbcddccccccddddddccdcabbbcbccbbbddcbbbbbbbaaaa#########.####aaa####a#a#aaaaaaaaaaaaaabbbbaaabaaaaaaba####a#.a##ab##.a##a##aaaabbddb##aa#####aa######.##aaaaaa#aa####a#aaa###abbb###acaacaaaa##a#####bff###a##aaa#aacghhfccbcbcbbcbbbbbbbcaaaabababbdccccddbbccccaaaaaabbccee##aaaabbacaaaa######aaa#aaaaaaa###", "#aaa##########aaaaa########bbbbbea#babcea#a######aaa####bccddcddedcccccccccbcbccbbbcbcddddcccbbbcccdefedcbaacbbcbbbbbbbbababaaaa############.###aa#a##aaa#aaaaaacbba##abbcbaaa#aaa#aa#########a#######a##aa#a#abbcbcc#a############aa####aaaaaaaaaa#######aa###aabaa##bbaaaa#a##aa######dea#####aaaaaa#behhdccbccacbbbbbbbcbbbaabbabbbcdcccdddbbbba#aaaaabbddb#######bcaaaaaa######aaaabbbaaaaaa", "aa#aa##########aaa########aabbbbbedbaabddcb#aaaa#aaaa####cccaacdeeggecccccccbbabbbbbbbbccddcccbbbbcbcddeedcbaaabbabbbbcbbbabaaaa###########.#####aba#######aaaaaabbba#aabbbbaa###aa##a#####.#a#.#.####aa##aa#aaabccbca#aa#..########a######aaa##aaa#########aaa#aaaaaabcaaaa##a##a###a#a#bdb#aaaaaaaaaaabcfhfccccabbcbbbbcbcbbbaabaabbabcddcdcccbba##a#a#abddb########aaaaa#aaa####aaaaaaaabbaaa", "aaa#aa##########aa#a#a#######abbabgebaabacca#ba#aaabaa#########a##bdeddeedddcbbbbbbbcbabacdddcccccbbbcdcdcdcabbbbbbababbbccbabaa###############aaabb####aa##aaaaabbbaaaa#abbbaa###aaaa###a###a##....###a##aa##aaabbbca##aa#.#######aaa##aa######aaa#########abaabaaaaaacbaaaaaa##a###a##a#afb##a##aabbbaaaaeggecebcbbbabbbcbbabaabbbbbbabbdddccccccabaaaaaaccc#####a#aaaa#a#####aaaaaaabbbaaabaa", "aaaaa############aa#a########.#abbcffcabbceccaaaaaaaaa###a###aa#######aaeebccccccbbbbcbbccbdddccccccbbbccbbbbbbbcbbabbbbbccbbbbaaa########.#aaa#a##aba#aa##aaabbbabbbaaa###abaaa#########aa##a############aa###aabcc#aa#aaa#######.##aaba#aaaaaa##aaaaa######baaaaaaa#aaaaaaaaaa###aaaaaa###ebaaaaaaaaaaaaabbfhgedbbbbbcbbbbbbabbbbbbbabbbbddecbcbbbbbbcbbbceaa#####aabca#a#a#a##a#aaaaaabbbbbaa", "aaaaaaa####aaaa#aa###########..#aabdddbbcccccaaaaaaaaaa##a##aaa###aa#####eddedddcddccbccbccccbbcbbcedbbcccccbbbbbbbbababbbcbbcbaaaaa############a#a#aa#aaaaabbaabaabaaa#aaa#abaaa#######aaaa#a###########.#aab##aacc#aa####a######..##aa#aaabbaaa##aaaaaaabbaabaccbaa###aaaaaaaaaa##aaaaa##a#ccbaaaaaa###aaaadgggfeababbcbcbcbbaabbbbaaabbbccddbcbbbbbcdccccca#a#a###aaaaaaaaaaaa#aaaaaaababccba", "aaabaaa#a#######a#aaa####aa###.###bcdcbcbabddbaacbbababaa#a##aaaa#aa#aacdccbddddddbbbbbaa#aaa######bfggfdcccbabbbbabaaabcbccabbaaaa#########a#aaaaa#######aabaaabbabbaa####aaaabaaa##aa##aaa#b####.#########abb#aaee##a###.##.##.###..####abccccbaaaaaaaaabcdaabbccba##a#aa#aaaaa#a#aa#aaaaaaaabebaaaaa#a##aabbfghhgedaaabbbccababcccbbbaabccbcccbbcbbcdcdcaaa########aaaaaaaaaaa#aaaaaaababbccb", "abaaaaaaaaaa######aaa########aa####bbccbbaabceaa#cbbbbbba#a##aaaa#aa###debacb#aacabaa##aa###########.#afhgeecbccbbbabaacbcccbbbbbbaa#a#########aa#aaaa####aaaaaabbbbbbbaa###aaabbba###a##aaa###.#######ba##aaadbaabeaa##aa#..###.##########abaaabdbaaababababbaabddbaa##aaaaaaaaaaa#aaaaaaaaaaa#aecaaaaa#aa#aaabdghhhfecccbcbbabbacccccbbbbbcbbbbbcbabbdcbcba########aaabaaaa##a###aaaaaaaaaabbb", "baaabbaaaaaaaaaaaa###########aaa####acccbaaaabcbcabbbbbbba#####aaaba#acbcaa#aaaa#abaa############.#####.dhihgeefccbbbbaabccbbbbbbaaaa##########a#aa#aa####aaa#aabaabcbbaa####a#aaaa###a#aaa################abbeebbbdd##a#######..####.######aaaaabcbbbbbbbbbbb#abcccbaaa#aaa#aaaaaa###aaabaaaaaaa#bcbaaaaaaaaaaaabehhhfedaaabaaabbccccbabbbbccbbabccbbbdcbbaaa#######a#aabaaaaa#aabaaaaaaaaaaabb", "bbaaaaaaaaaaaaaaaaaaa#########a#a####bbcbaaaaabeecbbaaabbaba###a#aaa##cedb#aaabaaaaa##a#########.##.###a#bfgedeffdccccbaaacdccccbbaa###########aaa######aaba###aabaabbbaaaa#####aa#a##abbaa####.##.####aaa#acbddddfega#a#######.######.##a#aaaa#aaaaaaaabccddebaba#bcba##aaaaaaaaab#aaaaabbbcaabaaaaccaaaaaaaabaabbehhfgebaaaaaaacdcccaabbcbbcbbbbbcdcbbcaaa#a######aa#abbaaaaaa#abbaaaaa#aaaaab", "bbbaaaaabbbaaabaa#aaaa###.#######a####abb#aa#a#cfecaabbaaaba#######aaa#bddcdaaabaaaa#a#aa######.########ba.a####bfddcccbbacdccccccaa############aaa######adb###aaaaaaabaaaaaa###aaaa##abaaa#####..#####aaaaabbcdeedfgd#aa########.#######a##aa#aaaa#a###a#abeedecc##aaba#aaaaaaaa#bbaaaaabbbbaaaaaaaaaccbaabaaababbadgggfdb#aaaaaabcbbbbbbccccdcaabbcdcccbaaa#######aaaaaaaa##aa###aaaaaaaaaaaba", "bbbbaa#aaaabaaaaaaaaaba#a######.#######abbbca##acdedcaabca#a#.###a######bddcfcaabaaa##a##a#####...##aa####a####a#abbccddcbbddedccccbaa####a######aaa#####acb###aaaaaaaaaaaaaa###########aaa####.####a##aaaaacdeceeeedc##aa########..#########aaaaa##a###aaaaaabcdedcb##aa#aaaaaaaaacbaaaaabbbbaaaaaaaaadfdaabaaaabbbbcdggfebaaaaaaacccbbbbbbccdcccbbbdcecba#####a####abbaaa#######a#aaabbaabaabb", "bbaacbabaabaaaabbaaabbaabb#.####.#######abbcba#aabecdbaccaa#a#.##aa##a###acacecbaaaaaa##########..######..abaa#aa####aceeddceggeddccbaa##########a#aaaa##aaa##a##aaaaaaaaaaaaa#########aaa####a#aaa####aaaabbdffffgebca#ab#######.#..#aa######aa###aa####aaaa#baabbdcc##b##aaaaaaaaabaaaaaabbbbaaaaaaaabcegcabaababbbbabgfgfdaaaaaabbabbbabbbcdddbcbccccdbaaa#a##a###aaaaaaa#########abbbbccbaab", "baaabbaaababaabbaaaaaaaaaaa##############abbaa##aadd##abbaaaa#.##aaa##a####aabcbaaa#aaa###a######..####.#..cdcbbbaa###abdcdedfghffddcbba###########aaaaaaaaaaaaaaaaaaaaaaa#aaaa########a#aaa#####aaa#a#aabbccddghhhfcca#aa##########...##########aa#aa###aaa##aaaa#a#bb####aaaaba#a#aaaaaaaabbcbbaaabaaabbefdabaabbbbbbbbfgggfdcaaaaabbbbbbbccdbdbcbcccbcbba##aaaaaa###aa#aaaa########bbabbbbaaa", "aa#a#aaaaaaaaaaaaaaaaaabbabaa#######.#.####aaaaaaabdeb#aababaa####aaa#abba#####aaaaa###a##bdba##a######....acdbabbaaaa#####cddaeggffedcba##########aaaa###aaa#abaaaababaaaaaaaaa##a###abaaaa###.#bbaaaaabdcddeefhhifdda#bb#aa##aa######..########ab##a###a##a#aaaa#abaabaaa#aaaaaaaaaaaa#aaaababbbbaaaaaaabcffbbbabaabbbaacefggdba#aabbbbcbacddccecbbbcccbba##aaaaaaaaaaa#a##a#a#######aaaabaa#a", "ba###aaaaa#cbaaaaa#abababa#a################aabbbbbbbea#aaabbaa#####a##adc##aaaaaaba##a####a########.#####...aca###########.####cffdcdecaaa#######aaabaa##aaaaaaa#aaabbbaaaaaabaaaba##babba######accbbbbbfccdeegdgfggeb#dc#####aaa#####...#######aaaa#aa##a#aaabaaa#bbaaaaa##aaaaaaaaaaaaaaabaabbbbbaaaaababbegdbbaaababbaabffffecb#aabbbbcbbcdddecbaabcbaaba#aaaaaaaaaaaaa###a########a#abbaabc", "a#######a###aa#abaaaabbccba###.##############abcbcbbcbea#aaaaaaa#######.##ba#a#aa#a#a#a##a####.###########..###ba##############a#aeedbadfcdddcbb##aaaaaaa#aa#aaaa#aaccbbbaabbbbbabcbbcdccb######abcdbddeeefddddb#afdcfebdca#####aaa######.#####aaca####abaa#aa#abcb#accaaaa##aa#aabbaaaaaaaaaaaabbbaaaaaaabbbbbgdbaaabbbbaaaccffgfdcaabbccccccddddfcbaaaaaaaaa#aaabbaaaaaa#a#aab####aa##aaa#bcc#", "aa###########aa#aaaaabbabbaaaa##..###########abdcccccbcdcaaaaaa#a##########aabb#abaa##########...#.########.######################.bfdaaccefddddbaaaaaaaaaaaaaa#aaababcccbbbbbccbbcddcabca####aaacdcabeggfdda.##.#cc#aefdbaaa###aaa###.##.####aaaaa#a###abd##a###ababbdc#aa#aaaaaaaabaaaaaaaaaaabbcbbaaaaaaabbbbgfbaaabbbbaabbbcefffddbabbcdccccedcabaaaaaaaaaaaaaaaaaaaaaaaaaaa#####aaa#aaaaaaa", "aaaa##########a######.#a#abbaa##########a####abdedcccccccba##########a######aaaa#abaaaaa#######..################aa#aa###############ddabedcgededbbbaabbabaaaaaaaaaaabbccccccbccdddba###abacbbcccba####aaaaaaaa##.###acfcaaa##aa#a############aa#####a#a##aea#aaa#aabbcda##aaa#aa#aaaaaaabaaaaaaababcbaaaaaaaabbbgfbabbbabaabcdcbdefffdbbcccccccdda#aaaaaaa##abaabbaaaaaaaabbbaaaa####a##aaaabaa", "aaaaabaa#######a###a##.###abbaa###############acdeccbbccdga##########a######.#aabaaaaaaaaa#a############.###aa###aaaaa###############.cdbbdefhhhfdccccbbbaaabaaaabbbbbccccdddcdccdb#####bbcbcddba####aa####a#a#####.##aedaaaa###aaa#######..#########a###a#bbbbbaaabbbbaba#aaaaaaa#aa#aaaabbaaababbabccbaaaabaabbbggdabbbbcbbbddcbcbdffdcaccccacccd#aaaaaaaaaa#abbbaaaaaaaabbabbabaa#aa####aabaa", "aaaa#aaa##########a###.##aaaaaaa####.##aa#####abccdcaabccffa##########a###aa####aabaaabaa#aaa####a######..###a#####aaa############aa###bdddeeddfgfeeeddcabaaabbbbbbbbbbcdddddeeeecaa####abbaaaa#######a#a########.###aaadaaaa#####aa########.#..##.##a######aaabbba#bbca##a###aaaaaaaaaaaabbaaaabbbaabddcaaaaaaaaabfgdaaabbbabdacdbcbdfffdbbdccbc#cbaa##aaaaaaa#aaaaaababaaaa#abbaaaaa#aaaaaaa#a", "###a#aaaaaaa######accbaaab#####aaaa####a#######accccabacccfe##.############aa####aa###aaa#aa####.#########.##########a############abca##bfcfabbbcaafffffdbbbbbbbbbabbcccdeeedefcaaaaaa##aaaaaaaa################a#.###abbcaa#aa#aaaaa#######....########aa####a#abba#bbbbaaaaaaaaaaaaaaaaaaabcabbbbbbabeedaaaaaaaaacfgecaabbabbacdbabcffffccccdda##aaaaaaaaababaaaaaaabaaaaaaaaaabaabaa##abb####", "a########aaa#######cddebba########aaaaaa#######abccccbabcdefea#.########aaaaabb##aaa#####aaa##.....#.##.##############a#####.#####aabcbaabfc######.afggggcbbbcbcccbbbccceeeeffhgccbaaa#aaabbaa#a######aaa########a#.##aacdba##ab#aabb##.#.####...########aa#####aaaaaaaabbaaaaaaaaaaaaaaaaaaccbabbbbbbabefdaaaaaaaaabeffabaaababdedabbcfffecccddaaaaaaaaababaaaa#aaaabbbaaaaaaaabbaaa#aa##ba###b", "#####aa#####aaaabbaaaacdb.#a#########aaa########abcbbbbbcdeeeefc.######aaaabaacbaaaaa##########..#..#....##############a###########abbbba#bd#a######aabbcfedccdddccccdddeeeeefgiedeebaaaaaabaaaa#aaaaa#aaaa###########aabcca##aabaaabba#....#....##.###.#aaa#######a#abaabbaaaaaaaaaaaaaaaaaaddbbbabaabbbddaaaaaaaa##adfecbbbbacddedbbccdffdccddaaa#aaa#bbaabca##a#aaabbaaaaaaaaaaaabb#aaaa###a#", "####aaba######aa#abbaaaba###aa#############.####aabcabcbbdegfebc.########abbbaaaaaaaaaa#########.....#.#.######.#######aa#####.#.##aaabbbbbc##a#######..##ehfeeeedddcedeffeeeeehf#abcecccbabbbbbaabaaaaaaaa########a###aacdba#aaaabaaaaa#..##..##.#..####aaa##a####aa#aaaabaaaaaaaaaaa#aaaaaabeeccbababbbbbaaaaaaaaaaaabcffbbbbcdccdcbbbcdfgfedcabaaaa##bbababa#####abbaaaaaaaaaaaaaaaa#aaaaaa##", "#a###aabaaaa###ba###ab##ba###a#############..###aaabcaabbdedefgb####aaa###aaaaaaaaabaaaa###########...#.############################aabbbadcaaa#####.######bfhhgggffffffffeeeefhhcaa##acfffeedddbaabaaaabaa########a####abebaaaa#a#a#aa############.###..#aa##a###aba##aaaaba#aaaaaaaaaaaaaaaaccdcdcbbbbabbbaaaaaaaaaaaaacfeaabbbbccdabccbdfffed#aaaaabaaaaaa#aa###aaaaabaaaaaaaaaaaaaaaaaaaaa##", "###aaa#aaaa#a##.a##a#aba#aa###########.#.#....####abcbbbbccdffegb...##aa###abaaaaaaaa#a#aa#######aaa###.####.#####################a##abbcfda#aaa###########.#acfhihhhijiiiihgfhhgcaaaa#..acccddccecccbaaabcb#######aa###abcdbaaaaa#aaa#aa##########.##########aa##aaa#aaaa########aaaaaabaaabbaaababaacbbabbbaaaaaabaaaaa#cefdabbbabbcbbbccdfggeb#aaaaaa###aaa#a###aabbaaaaaaaaa#aaaaaaaaaaaaaa#", "#aaaaaaaaaa##aaaaaaaa#aaaaaa##.###aa###.###...####aabdbbabbcfeced.#########aaaba#aaaaaa##ca#######aaaa######.########.########a#####aaabdhgfeaaaa#############.#aaba#addfghiiiiheb###aaaa###.####bdbcdcdcbbca##a##a##a##aabbdbaa####aaaaaaa#############a#.##aaaaaaaaa##aaa##a#a#acbaabbabbbaaaaaaaabbbbbaabbbaaaabaaaaa#a#bfgebaaababbbbbbbcggfeaaaaaaaaaaaaaaaa####aabaaaba###aaaabaaaaaaaaaaa", "a##ba#abaaaaaaaa####aa###bbaa##.#######b#####.#.###aacbbaabcdeccc##.########aabbba#a##aaa#bba######aaaaa#################.######aa##aabbfhhihdabaa##############aa######.##a#bgfb###aaaaaa########cbacccdfeecaa###aa##a#aaabcdbab##ababaaaaa##########aaa#####aaaaaaaa#a#aaba##aabfdaa#aaaaabbbabaaababdbbbbbbbbbbbbbaaaaaaa#dffcbaabbbbbbbbbcefgdba#abaaaaaaaaa#aa##abbbaaacba##a###aaaaaa##aaa", "aaaaaaaaaaaaaaaaaa#####a##aaaa########ab##.####..###aadccbbacdcaa###.######aabaaabb#aaaa###############aa#####a#####.##############aabbbehhhfcaaaa#####.########aaaa##aaa##a#.#caa####aa##########cdbbbbbcedefdcbbaa##aaaababbdbaaaaaaaaa#aba#########aa######aaaaaa#a#aa##aaa##addbbaaaaa#aaaaabaaaaaaccccdcbbabbbcbaabaaaaa#cfgdbabbbbabbbbbcfgedda#aaaaaaaaaab#a##aabbbaaaba#aa###a#aaaaaa#aa", "aaaaaabaaaaaaaa#accb#########babaa###aaa##.##a##.####abcbccabdeaaab#..######aaaaaaa#####################aaa####a#####.############aaaabdgihgcbaaa################aaaaaaaaa#aa###a######a##########dbaaaaaaaacbcefgfddcccddegdcbdbaabaaaaaaaaaaa######aaa####aaaaaaaaa#############aaaaaaaaaaaacaaaaaaaaabbbbdeccdccbbbbaabaaaaabefecbbbabbbbcbcegededcaabaaaabaaaaaa##aabbbaaaa#aa#aaa#bbaaaaa#a", "a##a#aaaaaa###aa#bbcbaa##aaa#aaaca##abb########a#####aacbbccbdeaaaba#########aaa##a#a####.################ba#########.##..######.bbabaaehhhgbaaaa#################aab#aabaa#aa###a##########a.###.ab#aa#abababbbcbcdcaacecccdefdc##abaaaaa##aa########aaba#aaa#a#aaaaba#a#aa#a##.##abaaaaaaaaabbabbaaaaaaaaaaccbbbcdbbbbaaabbbabbdgfdbbbabcbcccdddeeedcaaaaaaaabaaaaa##aabbaaaaa##aa####aaaaaaa#", "####aaaaaaa######abbcca##aaaaa##abbabba#a#####aaa######aabccedfaaaab#########aaa###.#######################b########.#ba#...##.#acbccccfgggebaaaa##a###############aababaaaa#a##a#a####a##a########c#aaaaaaaabbaaaaabccdebabbbdgeaaabbbaaaaa##a#######aaab##a##aaaaaabaaa###aaaa####ba#a##aaaaaabbaaaaabbaaaaacbbbcbbbcbbaaabbbbcbcfgecbcbbbccddccceddccaaaaaa#bbaaaaaaaaaaaa#aaa##a#aa#a#aa####", "##a###aaaaa#######aaaaaaaaaaaaa#aabbcaaaaa#a###aa########aabeeea###aaa#######aabb#####a######.#######aa##.######aaaabedccbbb##bbbbaabbbbccdeaa##a##a########aaa#####aabbbba#a#aaa#a####a###########caba###ababbbaabbabcdcddcbabehcaaaaaaaaaa############ab##aaaaaaaaaaaaaa#baaaaa###bb#a##aaaabbbbbaaaaabbbaabbbbcccbabbbaaaabbccccbfffcccbccccbccccddeedaab#aaaabaaabaaabaaa###aaa###bb##a#####", "aaaa##aaaaa#aa#######a#abbaaaab######aaaaa#aaaa#aa#######aabdefb#aaa#bc#######abcb#####a#################aa#a..###aabcdfffggfdcbbbbbaaaaaabdeaaa###########aaaa#####aabbbbbaaa#aaa#####aa#a##.#####aaaaaa##abaabcbbbaaabaabbbbcdefaaaabaaaaaa##a######aaa######aaaaa#aaaaaa##aaaa###aa#aaabbbabbaabbaaaaaaaabbbbbacccbaaaaaabbccdccdefegffdccecbccccdeeddcbaaaaaaabbbcbaaabaaaaaa#######aa######", "#aaaa##aaaa#############abaaaaaba##aaaaaaaabaaaaaba#####a##abdgca#aaadeb########bba#####aa#aaaaaa###aaa#ab#aa#.###.#acfhfddgccbaa#aaaaaa#abcfaaaa#######aaabbaaa#####aaaaaaaaa#aaaaa#aaaa##########aaaa#aa##aaa#acccabaaba#a###acdbaaaaaaaaaaa###a##.##aaaa###a###aaaaaaaaa###aaaa#abb#aaaabbbbbbbabaaaaaaaaaacbbbccbbbbaabaaacccccdfdbdfgeefcddabccbcedddccbbaaaaaabbbababbaa#aaaa#a##ab##a####", "##aaaa#############aa#####abaaabda##abaaaababbaaaaba####aa#abbdeaaaaaadf###############a#aaabbbbba#aa#aaaa#baba.#accbffffgddcbbaa#####aa##acfeabaaaaa###aabcdcbba######aaaaaaaaaaaaaaa#aaa##########dbaa########bbdcaab#abaaa##abceaaaa#a#aaaaaa#a###.######a#####aabaabb#aa#####a#bcbaaaaa#aaaabbbbbaaaaaaaaaaccccbccabacaaaabceeeeggdcdfffccccca#bbcbddeccccca#abbbbbbbaaabaaa#a#aaaaab#######", "##aaaa####.##########baaa##aaaaabda#aaaabbaaccbaaaa#####aaaaabbcbbaaabdgfe###aaa#######a##aaabbabbb#a#a#aabdceeedcabcaeddcfhecdb#########aacdhcbccbbbbbbbbdehhedba##aaaabbbbbaaaaaabbaaaaaaa########cba#######a#abbda#aabcbaa##aabceaaa######aaa##aa########aaa##aaaaaa#aaa###.###aabaaa#aaa#aa##abbbaa#baaaaaaabbbbbbdbbabaaaacaddacbbbbddccccbbda#cbbcdcddeccccbaabbbbca#aabaaaaaaaaaaaaa#####", "#aa###a####.##########aa#a##aaabaccaba#aabbaccbaaaaaaaaaaaaaabbccabaabeffeebbcb#.####.#aaabbaabbccccccccdddcec.#aaaaaaadccbbcccca.#######aabdhecdddeeeddeefecbbeedcaaaaabbbbbbabbbbcbbaaaaaaaaaba##aba####a####aacdccaa#ccbbaa##aabcdaa########a##aa########aaaa##aaaaa##aaa#########aaa##aa#aba#aabbbaaaaaa#aaaaaabaaaccbaaaaabccababbbb###bcbcbbecabbccdcddcdcccaaababbbbaaaaaaaa#aaaaaaaaa###", "#aa#aa##########a######a#####aaaaabc#abaaaabbcbbaa#a##aa#baaabbbbbabbcfffgghebdcbbacacbbbbbbbcbccdccfdaaabdedcaaabaaaaacccbbbbbbcb########abcfgedeffeeeegfcbbcbadgdddaabbbbbbbbbbcccccbbaabababbbaacbaa#########abcccbabccbbbaa##aabcb#a#######aa######a#a##abbbbabaa###a#aa########.bbaaa#aaaaaa#aaabbbccbaaaaabbbbbbbaaaaaaaaabbbccccaaa###bcdbabcbbbabcdddcbddccbbaaaabcccabaaaa#aabaaaaaaba#", "#aaaaa#######a####a###aa##.###aaaaabc#abaaabbcbba###aa####a#aaabbbaabcdcdeccdecccccba##aaabbaaaaaa##beaaabacfdeaabdecb#bdcbbbbbbaca#######abcdegeeeeffgfdabbccddeehhhfdbbbddeeccdcccdccbbbbbbcccbcca##a###a########aa#.aceccbbaa#aa#acb###.#####aa#####aba###abcdcbcbaaaaaaa#####a###bc#abaaaa#aaa#ababbbbccbaaaaabbcccbcbaaaaaabccdacccb#a###abddbbbbbbabbcebcbbdcccbbaabbabcabaaaaabcbaaaa#aaa", "aaaaaaaaaaa####aa#####aaaaa.###a#aaaccaaabaabccaa##aa#######aaaaaaaaadc##abaaaaa###a#######a#########cb#aaaacdddb#bbdda#becbbbbbbac#######abceffhffffda##babcccdeeddbddeecdcdebdeeccdddeddcccdeba#b###aa##a#########a###bedbbbbaa#a##aca###.#####aa####aaa####bbcdddbaaaaaaaaa#######adbbabaaa##aaaaaaacbabbccbaabaabbccccaaabbcbdcbcecccaa#a#a#adcabbbbbcbbcbccaabccdcbbbbcacbaabbaabcbaaaabaab", "bdbaaaabbaaaa#aa##a#aba#############abcaabababcba##aa#########aaaaaaabdb##aaaaaa###a##################b####aaccdeaabcbbaaeddbabbbabb#######bdfhghhgda###aabbcccecbbbdcccefdbbcbcb#eefgghggfeegdaa##a###aa#######aaa#####bedcabbaa#####acb##########a##aaaa####acbccccaaabaabbbba####a##dbba#aaaaa##aaaabdababbccbabaabbcddcbacbbccdacdbba#####aaaabcbbbbbbbccbbababbcddcbabbbabaaabcaaabaaacabaa", "aacdbaa##.##a##aa#aa#aba###.#########abca##aabbbca#..###########aaa##aab######aaaa#########aaa#a###aa#######aaccdfbabbaaaeeddbbcbbbdbaa#abcdfhjigca######abccbadb###cfbcbbecabbba#begfhggddcggdbbaaa##############a#aa#.cddccbaaaa#####ab##########aaaaaba####accbbbbaaabaabbbabb#######aba###aaa#aa#aaabcaaaaabccbabbcccdedcbdbbacdcdccaa##a#aaaaabcbbbbbacccbaaaabaccccbaaaaaaaabbbbaaaaababba", "aababbaa#####a##a##a###a####.##########aba###abbbbba####.#.#######a###aab######aa#a#########aaa#####aaaaa#####bbceebbbba#ceedccedcegdcbcddedbcbed#######aabccdbdda##adeeb##abbaaaaacbadeddfdghdcbbbaaa###########abbbcdbbdcbbca##aa#####bd###.#.###aaaaaaaba##abbbbbbbaaaaaaaabbaaa#######aa###aaa#aaaaaabcaabb##abcbbaabcedccdcbaaccccba####a#aaababcbaaaabbccbbaaababccbaa##aa##aaabaaaaaaabaa", "aabaaaaa#a#####a###aa##########..######aaba####aaaabb#.###############aaab##.###a#a#######aaaaaaaaa#a#aa###a##aacdceddfgfcfffgdccdeeefggdbaabbbbdcaa###aaabbcddeb##a#adfeaaaaaaaaa#bbaaccbeedhecbabbaaa#########.adccbcdbdbbcbba#######a#cda########abbaaaba##abbacbbaabaaaaabaaaaaa########aba##aaaaaaaaabcaaa#a##abca#aaabdefecbaadbbbaa##aa#aaaaaabdcbaaaaabcbaa#aaaabbbaaaaaaaaaaaaaaaaaaaaa", "aaabbaaa#########a##aaa###########.##.##aaaa#####aa#cba################abcb.####aaaaaa##aaaabbabaabbbaaa##aaaaaccgghggecdfihhg#a####a#a#abbccccacdcabbbbbacccdfeba#####aaaaaaa###a#ababbccadcgedccbaaa############ccbabccbcacabaa#####a#bacd###.####aaaaaaa###aaabbccaaaaaabbabbaaaa###.##..#bbb###aaaa#aaaaaaa########a#aabccceecbbdbbbbaa#aaaaaabbaadccbaabaabba#####aaaabaabaaa##aaba#aaa#aaa", "aaaa#aa##############bba##########..#.############aaaaaa#####.##########abca..####abaaaaabbbcccbbccddbbabbbbbcdefebdfd##a#.bedaa#########aabbbcbcddddcbbbcdeffd#########aaaaaaaa#aa#baaabcbacegedbbaaa##########bcdbaabbcccbbbaaaaa#####abbcca####.##aaa####aaabbcccdbaaaaaaabaaaaaaaa####.###abba##aaaa#aa##a############aaaa##cfebdcabcb###a##aaaabbabacbaaaaaba#a####aaa#aaaaaaa####aaaaaaaaa", "abbaaaa####a##########aa###################aaa####abaa#a################aabc#.#####aaaabbbcdddcdfffefgffeddfgdcdcb####aaaa###bb#######a##aabacdcddbdccacdefecc#a##a#####aaaaaaaaaa##aaaaabbbabfgdcbaa########aaacbbbbabbbbcdaba##a#####a#abccda####aaaaa#aaa#abaaaccbbbaaaababbaa##aaa#########bbba##abaa#####aa#a##aaa#a###aaa##defdcabbbaa##aa#aaaabbbaaccaaaaab######aaba#aaaaab####abaaaaaaa", "aaabaaa#################abba###############aaaaa##aaaaa#a###############aacaca.#####aabbbbccddfda#adeca#####b###aa#aa#aaaa##aaba#a####aa#aabccdccedebaacccb####aaaa###a###abaaabaaaaa#aaaaaababdgdbb##########cabbdbbbaaaaaccaaaaaaa##aaa##acdc#.#aaaaa##a##aabaa#ccaaabaabbaaacbb##abaa######..abca##aaaa#####aa#aaaaaa######abaabdggcaaa#aaaaaaaaaaacba##bbaaaabba#aa#aaaaa##aaaba###aa#aaaaa#", "#########.#################aaaa#.#.##aaa###aaa##aaa##a##aa###############abbbba#.##.#aabbbbcefc####...#####aa#####aa###aa####aa#######a#aaacbacbbdddbbccdfecbcc###aa####aa#aaaaaa###aaaaaaa##aaacfdaaa#####aaaabbabbbbaaabbabbaaa###aaaaaaa#abce..##ababc####aaaaabdaabbbbbbaaabbbaaa#a##.#######abaa#aaaba##aaaaa#a##aaa###aaa##ababehcaaaa##aaaaaaaadc####abaaaaaba###aaaaaaa###aaaaa#aaa#####", "####a######################aab#....##aacaaa#aabbaaaaa#####a##############aabbbcb##.###abbcceca###################aaaaaa#a#aa##a#aaaaaabaabbbbbacaaabbabaafddcbcb###aaa#aab##aaaa######a#######a##cfeaaa#####abcbbbbaaaaaabbabba###aaaaa#aaaabaaee#.##ddaaa####aaaaacaaabdcbbbbaabaaba#aa##.#######aaaa#aaabaaaaaaa##aaa#a##a#aaaaaaabbcgebbba#aaaaabaabbaba###aaaaabbaaaaaaaa#aaa##aa#a##baa#a##", "####a##aa##################aabda#.#####bcaa#abaabaaaaaa###################aaabcdb.####bbbdea##########.###########aaaaa##aaaaa##aaabbbbcbccbbaaaaaaaabbbaaaacdcbbbaaaaaaaabaa#aaa################abecaa####aadcabcaaaaaaabbaab#####aab#aaaaabaaade#..#ca.#a####abcbbb#abbccaaabbbabbbb#a############aa#aaaaaaaaaacaa##aaa##a#aaaaaacabccfebbbbaaaaabbbbaaba####ababacbaaabaaaa##a#aaaaaa##aaa###", "#####aaaa###.#a######a#######aab##..####abbbbbbbbaaa#aaa####aaaaa##########aabddea.###abda#################a#########a#####aaa###aaabbcdcbdbbaaaaaaaaabbbaaaaacddcbaaaa###abaa######..############abeda###ababbbccbaa#aaaaaabaa##a###ab#aa#aaaaaacec##ab.########babbaaaabbababababbcda###############a#aa###aaabcbbaaaaa###aaaa#ababbcdcdecaabaaababbaaa#######aaabbbbaaaaaabaaaa######a#aaaaa#", "a#######aa#a######aa#a#aaa###aaac#########abddccbbaaaaaaa####aa#aa########.abehghhc##abca##aaa##################################a#aabccb#aabaaaaaabbbaaaaaabaaabbbdba#aa###aaa##################aa#abefccaabbbcbabbaaaa#aaaaaaaa#aa###abaa##aaaabbcfdaba.#a######bacc##aaaabaababaabcbca##.#####a#####a#aaa#####aaaaab##aa##aaaa#aaaabccebbffbaaaaaabcaa###a#####bbbbbbbaaaaabaa#aa######aa#aa#a", "#baa#aaaaa###a#a#aaaaaaa####b#aaba#########aacbdcccaaa##a###aaa#aa##########bbfikjicacc###aa#aaaa#############a###################aaabccca##aaaaaabbaaaaabbbbaa#aabcbbaa####a#################a#aabaabdfbdcccbbbbbbbbaaaaaaaabbaaaaa#a#aaa#aaaaaabbcfdbb#######a#aaac##a#ababaaaabbcdaaaa##########a#aaaa#a#aa##a#aaaaaa#aaaaaaaaaaabbccdcaaegcbaaaaacaa#####a####bbbbbbbaaaabba##a###aaaaaa####", "####aa#aaaa##a#aaaaaaaaa##a#####aba##########aadcbbba####a####a#aa##########abcdfhiigc#a##aaaaaaaa#aa#####################a#######aadccccaba##aa#abaaaabbbcaabaaba#aaaaaa####a###a#a###.#####acbbcbaabcehfdccccbbbbbbbaaaaaaabaaaaaabaaaa###a#aaaabbcddca####.#####aa##aaacbabbbbaabcba#bc############aaa##aa##aaaaa#baaaaaa#aaaaaaaabccdeba#cgfbaaabca#a###aa#a###bcbbbbbbaabbba##b###aaaa#a###", "###a#aaaaa#aa######aaaaaaaa######aaaa#######a##aaaa####.###aaaaa#a###########abacdhiiga##abbaaaaaaaa##############a########a##a##abbcabc#abbaaaaaaaaaaaaaacaaabaa###a###aa###a###aaa########bbbbcbbbbddceihebbcbbbbbabbaaaaaaaa#aaaaaab#a#####aaaabbcccfb#.########aa##abaaaaaaabbaaaabbcbc#####a######ba##aaa###aa###aa##abbaa#aaaabbbdcccbbabdhebcbaaaaa####a#####accbbbbcbaacba#aa###a#aaa###", "#a####a#aaaaa#aaaaaaaaaaaaaa#######aba#######a####ab########aaaa##a#a##.#..#####aehhjihb#abacba#aaaaaa############a#a########aa#aabdcc####abaa##a##aaaaaa#ababa#a##aaaa#######a#aaaaaaaa##aacaabcccbcbabbcghgdbbabbbccba##aaaaaaaaaaaabaaa####aaaabcbcdccaa#########.##aaaaaaaaabababbabaa#######a#a##abbba#a######a###aa#aaaaaabbaabbcdbbbbabbadffbbaaaaaa#a##a####aabcbbbccabbabaaaba##baaaa##", "##aa###a#aaa#a##aaabbaaaaaaaaa##aa###a#############bba#.###aa#aaaaaa#######.####adfehjif###aaaaaaaabbaaa#a########aaa###a######abbbbcca.###a###########a###aa###a#############aaabbbbbaaceb#aaabbbccbaaabbbdggdcbbabbbbaa###aaaaaaaaaaba#aa#a###aabbbbcdc#####aa#######aaaabbbaaabbbbbbba#aa#######a##aabbaa#######aa###aa#aaaaaabbbbbccaaccbbbccdfgedaaaaaaaaaaaa##aaaccbcccbbccba##aa##abaaa##", "########a#aaaaa#aaaaaaaaaaaaa#aa#ba###########a####aaaaa#.##aaaaaaa##a#a########bbceeijfc####bbababaaaaaaa#########aa##a#aaaaabbadcccba####.############aaa#aa#############a##abbabbbaa##ceaaa#aaaabbbaaaaabbdgfbbbbbabba####aaaaaa#aaaaa#####a#aabbbccdccca#aaaa######aaaaababbaaabcabba##ba##a##a#aaaaaaaaa#######a#a##aaaaaaaabbbcccaabbddcaabbabdffdbbbaaa#aa####aabbccbbcbbddbaaa####acbaa#", "#######aa#a#aabbaaaaabaaaaaaaaaa##aa#a#############abaaaa####abb###aaa#a########babcfhiiea###acbbabbaaaaaaaaa####aaba#aaaaa#aaabaccbcbaa###############aaaa###a##############aabaaaaaa####bbbabaaaabbbbaaaabbbcffbbbbbbbbaa##aa##a###aaaa####aa##aabccefcadda##aaaabb#aaaaaaaaaabbbbbbbba##abb######aaaabbba###############aa#aabbcccbabbaabdccccaabacfggccbaaaaaa##a#aabccbbcaabdbacba####bbaaa", "aaa####aaaaaaaaaaaaababaaaaaaaaaaa#aa##############abbbbaaaaa##bbbaaaaaaa######ab#bccehiic###abcaabbbaaaa#aaaaaaaa#aaaaaaaaabcbccacba########.##########aa###############a#aaa#aa#a##a#####acbddcbaaabbbbbaaaabbefcbbbabaaaaaaaa######aaa###aa#####abcdghedcbbbbbcccdcbbaaaaaaaabbbbbbabaa#.acca#a###aaaaaaa########a##a###aaabbcdcaaaaaabbaccddaaaaacaadggfdbaaaaa#aaaaaabccbbaacbaababaaaabbaa", "aaa#a#####aaaaaabaaaabbbaaa#aaaaaaa###aa#######.#a###abbbaabbbbaaaaaaaaaaaa####a##ababchie###aabbbaaaaaa#aaaaa#aaaaaaaaaaaabccccbccb####a#############aa######.###########aa###aa#aaaa#a###abcccdbbbbaaaabbaaaabbceebbaabbaaaaa#########aaa##aa#####acdfdefebcddcbbdffdcbaabbaabbbbbcdbbaaa##abca#####aaaa#a##a#aa####a#a##aabbdedaaaaaa#aaccbeda#aabbaaaacefgfdbaaaa#aaaaabcccbccabaaabbaaaacc#", "##a##aa###aaabbbaaaaabcbaaa#aaaaaaa#a##########a#####aabbaaabaabaaaaaabcccca########aaacfhc##aaabccba#aaaaaabbaaa##abbababbcccbeecba#####a########a####a#a#####.##########b######a##a##aa###aababaaabbaaaaabaaaaaabdfcababbaaaa##############.#######bddcbdeffcbbba##dihdcbaaaaacaabbbdcaaabaa#aba#####aaa######aa##a###aa#abcdccdb#aa###aaaccdcbaaaaaaabbaaabehhebaaaaaaabaccbcbbbaaaaaaaaaaacb", "a##aa#####aaaabbbaaaaaababaaa#abaaa#############.###aaaabcaabaaaabbbbacdedaaaa######a##bccdccaaaaaacdcaaababbbaababbbccbcbbcdcceedc####a##a###########a#aaa######..####.####.###aa######abbaaaabaaaaaaaaaaaaaaaaaaaacfeedbbaa############.######aaaa#abbaaaaccbabaaa###igdccbbbaaaaaaabcbabcbcb##a######a####a#aaaaa####aaaacb#abdcaaa#a###a#acddcbaabaaaaaaaaadfhhedaaabbabbcccbbaaaaaaaaaaaaaa", "ba##a##a#aaaaa#aaabaaaaaaacaabcbaaaa#aa#########.#########aaaaaa##ababdefcab#aa########aabdfgbaaaaaacdcaaabaaaaabbbbabbcbbbcccddaaaa####aa#aa########a#aa#########..##.##..###.###aaba###aaaaa#abaaaaaaa#aa#aaaaaa#aaaegdcbbbaa###########.######aaa##aaaaab#abaaaaaa#.febaaabcccbcbbcbbaaadbcecbaa#####a#aaaaa###aaa#aaaaabaaaabccaaaaaa#aa###adbbbcbbaaaabaaaabbchifbabcccabbccaacbaaa##a#aaba", "#ba########a###aaaaaaa#a#aaa#abaaaaabaa##a#aa###############aab####aaaaabccaaa##a#.#####abcdfb#aaaaaaaaabaabbbcbbbbbababbcdddfedcb#a##aaa#aaaaa###aaaa##aaa##.######.###.###########a#########aaaabbaaaaaaa###aaa##a###bfedcbbaaa############a####a######a#aaabcbbbaaa#gdaaa###bcddcecccca#addefgfddca###a##aaaaaaa##aabaacb####bbdcaaaaaa#aa###ccbbbccbaaaaaaaaabaadhieabaabbccdcbabbaa#####aaa", "#aab####aa###aaaaaaaaaaaaaaaa#aaaaaaa#####aaa#a##.############aa#abaaaaaaabaaaaa########abccdfcaaaaaaabbbaa#abbcbbaacabbbbcddecdcc####aaa#aaaaa#aaaaaaa##aaaa###..######.#####a########aaa#a####aaaaa#aaaaa########aa####dedbbbaaa##############a###a#####ababccbaaaaa#gcaaaa####bdebbbbbca#bddcbaabccaa##a##aa#aaaaaaabbaca####abdbaaaaaaaaaa#a#ccbbbbbbbaaabbaabba#adhgcbaccccccdccba######aaa", "a##aa#a###aaaaaaaaaaaaaaaaaaaaaaaaa#aa###aaaaa###.#############a##abababbaaaaaba######aaabbcddhcaaab##baaababaabaaabbabbbbcdddffeeb###aaabcaaaaaaaa###aaa#aa####.######a#######b#####aaacb#######ababaa#aaa##aa########a#aaeecbbbaa##################a##a##bbaabb#aaaa#cd#aaaaaaaace.aaa#bdccdcaaabcacbaba###aaaaaaaabaabccaa#aaabbd#aaaaaaaaaaa#bcccbbbcbbaaaaaaabbaabbhidbbcccbdeddaaa#aa#aa#a", "aaaa#aaaa##aaaaaaaaaa#aaaaaaaaaaa######aa#aaa####..#########.###aaabbbcbbbaaaaaaba#####aabbcccegcbaaaaaaaacbaabbaaabaaaabcccdeeffddaaaaabcbbbcfffecdcba#abb#############aa#a##acbbcba#bbaa########aabba###a##########aa#aaa#eedccbaaa#####a#a###########aaa#aaa#bcaaaaaafaaaaaaaaacfa##a#aaaba#abaaccbcbbccbaaaaaaabbbbbbaaaa#a#abccc#aaaaabaaaaaadcbbbcbcabbbbaaaaabaaccfjgbccbcccccaa##aabaa#a", "#a#aa#aabbaa#aaaaaa##abaaaaaaaaa##aaabaa##aa#a###.#.##############aabbbcacbaca#aaca#####aabbccdeedbaabbaaaabbabababaaaabbccdddffedffb###bbccefebccbdeda#aaabbaaa#######aaaaa###aabcca#adaaa#####aba#aaaa##aa################.cedcbbbbaaaaaaaaa##a######aa####aa#bbaaaaaadc#aaaaaabbee####abaaa#aa##abaaabbabdcccdcbbaccbcb##aaaaabbcdbaaaaababaaaacbccbbccbaaabbbbaabababadjiedccccbbbaaaa#aa#a#", "aaaaa###aaaa##aaaaa####abaa#aaa#a###aaaa######aa#################a##abbbcccbbbaaabba##.#aabbbbddedd#aacb#aaaaaaaaaaaaabbbccdddggffghecbbaabbbddabaa#aaaabaaa#bbbaaaaa##a##aba###aaabb##bbaa####aaaa###########a########.#####aaeecbaabbaaaaaaaaaaaaaa###aaa##a##aa###aaabeabaaaaaabchca###a#aa#a###a##aa####bca#abdecbcdbaaba#aaabbdcaaaaaaaabbaaaaccbbbccdbabaaabbbabbbabacjkjgfdccbaaaabbaaa##", "#a#aaaa###caa#####aaadb#aaa#aaaa#aaa##aaa###aaaa#a####a##a######a#a##aabbbbabba##aabaa##aaaabacdececaaaba#aaaabaaaa#aaaaccdeeefgeeefbcbbbcbbbcbaaaaaaabaaaaaa##abba##a#####aaa###aaaa##.#ba##.###aa############.##.#############dedcbaabbaaaaaaabaa###a###aa##aa#aaaaaaa#dbbbbbbbaacgg#b####a####a##aaabaaabbcaa#abacdcaaaabaaaaabbccaaaaaaaabbbbcbabcacccccbabbaabbbabcbbaaejklhfcbcbbaaaa#aaaa", "####aaaaa##aaaaabaaaaabbaaa##aaaa###aabbaa###aa#aaaa###aa#######aa#a##bcccaaabbaa#acaa###aaaabbcdcdcbaabaaaaaabaa##aaaabbccdfffghffdaabbaabccddbabaaaaaaaaaaaaaaaaa##a#######a####aaa###.aba######a#################a############bfedbaabbbbbaaaaabaa##a#########abbbba##dcbabbbaaabcgdc#####aabaa###a#bbbbbbbbbbaaabbcbbabbbaaaabbbdebaabbbaabcbbbbacbabbabbbbabbbaababbbbbghillgcbbbbbaabbaaa#", "###aaaaaaccdcaaaaaaba##aaaaa##aabaabaaab########aaaba####a###a##aaaaaabccbba##bbba#bca###aaaaabdcddcda#abaaabaaaaccaaabbbccefgfghffaaaabbaaabefbcbaaaaaaaaaaaabaaaa##aa#########a########aaa###a##############.##.#.############a#abdebabcdcbbcbaabba############acdea#abecbaabbbaabbdfc##aaaa#a#aaa##abbbcaba#adebaecabbaccdcbbabbcbdddbabbbabccccbbacbbbbbabccbbbbbaaaabcbcfijjkjfddcbabdebaaa", "db#bdccbbcb##aabbbbaa###aaabbbbaccaaaabca####.#####baba##a#aaaaa#aba#accbbbbaaaaaaaacbaaaaaaaaacccdccc##abaabbaaabdbabbcccdffffhggbaaaaabdbaaaababbaaaaa#a#a#aaaaba#a#a################aabaaaaa###########.#####...#####.##.####aaaa#bedcccaaaaabbaaaaa##a#####aaaaddaabdebabbbbbabbbbgcaa#a#aaaa###aaabdaddabaadcfdfgdacbaabcbbbcccbdcdffdacdcedccbbbacbbbbcccccbbbbabacabbdgigbbgjjedcbbbccaaa", "#bbbaaaaaabaaabbbea#aaa#abbbbabaaaaaaaaba#############b####aaaaaabaa###abbbbbaaaaaaaacbaaaaaaabbcccccdd##cbcbcaaaaaaabcdeffgggiigabbbbbaabcaaaaaaaaaaaaaa#aaa##aaaaaaa################aaba###baaaa#######.#####....#########.#a##aa##a#adfca###abbaaaaaaa#####a####bdbacfdaaaaaabbaacedfa#aa#########abefeddcccdebccfggfedaaccbacddecdccdeddccefddcccccccabaabbabaabbaabacbbhijgdbacfkjeedcba#a#", "###aaaaa#abbaaaaaaa#a####bcaaaba###a#aaaa######a####aa######aaababaaaa##aabbaaaaaaaaabcaabbaaaaabcbccccbcbaaaaababbcccdefgfgghkgbaabbcbccbaaaaaabaaaaaaaa#aaaa#aaaaaaaaa####a########aaabba#aaaa#####a#.###.######.#####.####.##a#abaaa#aaddaaabbaaaaaaaa#########aabgggfbaaaaaabbbabbcfea#a#####aa##afghhfggghhgccddffhfffcccbccdfgeeeceec#aabcddcdddccebaaabaaabaaacbbbb#ejhjgbbceceikibbceba#", "aaa##a#aabbabbaaaaaaab####bc#aaaa#aaaaaa#ab##aaaa##a#aa######aa#baaaaaaaaaaaaaaaa#aaaaacbaabaaaabbcccccdbaaaabbbbccddeeefeegjheb#a#aabaccdcaaaaaaabbabaa#aa##aaaaaaaaaaaa#######a###aaaabba#abaa####..###.###.####..#####.#######aa##ba#####bcbaaabbaaaaaa########abdfggebabaaaaaabbbbbchfaaa######abbfegggefgghgffeecefggfhheecdddeeefdcefcabaabccbaabcbcbaaaaaaabbabbbbbbfghggdbcbcbbgkjfbbecb", "#aa#a###aababbbaaaaaaac###.acaaaba#aba####ac#aba###aaaaaaa#aa##a#a########aaaaa#aaaaabbbbbaabbaaabbbccccebaaaabbccddddedegggfhbaaa##aaabcccaaa#aaabbbbcbaaa#####aaaaaa#aaaaa#####a###aaaaaabbdaaa########...##.###..########.#####aa#aba###a#accbaaaaaaa#######aaaaabccdeeccbbaabaabbbbegfgeca#####adefffefgggfghggfeeccegihijigedbccfeceddfeaaabcacbbaaabbaaabaaaabbbbbcbchgghfgdabbaa#bgkjgcdd", "d#a#a####aaaabbbabaaaaaa####abaabaaaaaaa###acdbaa#a###aaaaaaaa###########aa#a####aaa#abbbbbaabaaaaaabcbccdaaaaabccddeefefhgefgbaaaaaaabaabbaa##ababbaaabcca#aa#aaaaaa##aabaaa####a####aacba#bcb#aa#.####.#...##.##..################a########a#adbaaaabaa#aa##aaaaabbbcdeddddcbabebbcbbffeefdec##adeeefeffefghgghghhgfedfheabfghhfdcegecbbbbccaaaabcaaaaaabaaabaabbbbabbcdfffgffffabbbbbcabgkjec", "cdaa##aa#aaababbbaabbaaaa####bbabcaaaaaaa##.acaaaaaaaa#aaaaa#ba###########aaa#a###aaaababbaabaaaaaaaabcccdgbbbccccddeffefgfeffbaa###a#aaaaaa#aaaaaaabbbccaaabaaaaa##a###aaabfd#####aaaabbaba#aa########.###.##.###############################bacedcbbbbabaaaaaaaaabcccccddedddbbdeecdefeededdeeffdegffeddefgfgggggcb##abbca###bbefeefeddcdcbeeaaaaab#a###babbbbbababcbccfgfeeefegcbaaabbca#afkh", "gdcbaaaaaabbbaaabaaabbbbaaa###bbcbaa#aaaa#####a###aaaaaa#aaa#aaaaa##a#####a#aa#aa#a#aaaabbaaacaaabaaaabccdfgddddddccdfhhffddfbaaa####aaaaaaa##a#aaaaaabbdb#aaaaba#a#######aacegdbaa#aaabaabbb########.#.##.##..#...####.#######################babedededcbaaaaaaaaabccddeedefecfffeeffddddddeddeeeddeggfddeeffbaaaaaaaabdb#baa#a##cbdfeaaabbcdfbaaaaa####a##abbbbaabbbbdcgfgeeedeefabba#aaaaaabg", "gjgccbaaaaabbbbbbbbaacbaaaaa###aaaaaaaaaaa####aaa#####aaa##aaa#a#a#######aaaaaa##aaaaaaaabba#acaacbaaa#acccfgdefefcdecfhhddbcaaa#a#####aaa#aa###aaaaaaabbeebaaaaaaa####.###aaacdcbaaaa#aaabba#############.#.#.#...###########..###############aacddeeededceeedccefggfgggfedggghfdfecdddccccddeeeeefddfffddddbabbbaaaaabefcdb#aa##aaabcaaaaa#bdgb#abaa#######ba#bbaabaaeegfgfeeeecfcaaa#aa#aaaa#", "#bgifcbaaabbbcbbbbaabbbaba#a#aa##aaaaaaaa######aaaa##a#aabaaaaaaaaabaaaba##aaba###aaaaaaaaabbabbabaa#a#abcceffeecb#cddeeggcdb##a##aa##aa#########aaaaaaa#bedaaaaaa##########abaa#aaaaaa#aaabaa#####a####################..######.#a##.#########aabcccbcda##afgggffdbbbabdhheghifedddeecbccdcdefffeeffdfggfdbaaaaa#aababbacdddb#bb#aaa#a####ababbdebbbaaa####a#babbaaacddfgffeefeeddcbabbaaaa#aaa", "a##ehiecbbbccdccbbbbaabbaaa#aaa##aabaaaaaaa####aaaa#####aaba#aabcbbbaabbba##abaaa######aa#abbacbaaaaaaaaabcccdfcaa##bbbbceabaa######aa##a##aa####aaaaaaaa#abaaaaaa###a######abbbaba##aaa#a####aaa###a############.########################a####aa#dcddcdb#a#dedeedcaa#baacgegiifedddddddcdddefeffggfgeedbba#aaaabbaabaaaaabceebbdaaaaa######aaaaabdddb#aaaaaabacbbbaabdfffgfgfeeeeddgcbaaaaa####", "#b##adiifdbcefedccccbaabaaaa#aaaaaaaaaaaaaaaa##abaa######aabbaabbcbbaaaaaaa#abaaa#######aaaaabcca#aaa##aaaabbccc#########a###aa##a###aa########aaa##aaa#aaa#aa#aba##a#######aabbabcaa#ababbca##aa####a#####a.#########################a###a##acba.ddeecccba#cfeeedcaaaaabccbaigfeeeddddcbcdcddfeffggeedaabaaaabaaabbabaaaaa##cffedeaa#a#aaa#aaaaaa#abfebabaaaaaacadcaaffecffffgfffeeggaaabaa####", "#caaa#.ahjgffefgggffecbbbabaaaaaaaa#aaaaaaaaababaa#aa#a#aaaabaaaacccaaaaaa#a#aaabaa######aaababaaaaaaaaa#aaaabccb####aaa##ab###aa#####a#a####.#aabaaaa########a##aba########acbbaaaaaaaaaabbbaaa################a###a####aa############aaccb#adcbbdddccbcdebdedccba#a#aabdcbaggeeddedcbbbccdeeffffhggfcbaaaabbbcaabaaaba####a#debceea#aaabaaaaaba#aaa#cfgcaa##aabcbcbdffedfeeeefefeedhcaaaa#a###", "####aa##.behhgfeeeddefedbbbbaaabaaaaabaaaaaaaabaaaa#aaaa#a#abbaaabbcbbaaaaaaaaaaaba####aa#aaabaaaa##a#aa#a#aaabbcc.##ab##aabca##aaaa############aabaaaaa#a#a#####aaa#bb#.####bccbaa##aaaa###aaaaa######a#######bbabba####bb###a#a###a###bcccccdcdccddcbbabcdcddccba####bdddb#bdcecdedcbbbbbcceeeeehhcdaaaababcbcaaaaabaaa#####ab#aabb###bb##abcaa###a##adfeba###aabaaefefffedddeedefefhbaaa###.#", "#####aaaa###chikjiigedcegcccbabbaaaaaabbaaaaabaa#aaa#a#a##aaaaaaaaabaa#aaaaaaabbbaa######aaaaabaaaaaa##aaba##aaabab.###aaaaaabaa#aa#a#############a###aaba########aa#cbb####abcbaaa##aaa#a######a#.####aa###bbccbbdccbaaabb###a#aaaaa###cbbbaccccbbcccaaaabbccccbbaaa#accdcb##bacgeeedccccbccdeeefggebdaaaaabbbbbbaaabaa#####a#a#aa#####aaaa##ca#####a####beeca#b#abadgefffedeedfdcffeff#a#a###.", "..######a#aaadd#acdhihecdgecbcaa#aa####ba#aaa##aa##aaa###aaaaaaa##ababaaa#aaaaabbbaa######aaaaaaaabaaaa##baa##a#a#b######aaaaaaaaa#################a#aa#bcb#####aba##a######bbbcbaabcaa#################a#abcdbdefededcbcbaa##aaa#a###bcbababbccbbbbbcaaaaabcccbaabaaaabcdbba###bhhfhgeddccbccddfhhhfbbaaaaaabbbccaaaabaa####aa#a#####b####aa#aa#ab###a##aaabefd#a#abbfgfeeeeeedeeddefggbaaa####", "##.######aaba#abaaaabeiiebceddcbaaaaa###aaba#########a##aaaaaaaa###aaaaaaaaabaabbbbaaa###aaaaabbbaaabbaaaaa###a###bb#####aa###########a######a#####aa#baaaba##abcedcbaa##a##bcccbaaaddccaa##############a##bbceffgfededdedcbaa#a#aaa#bcabaaabbbccbbbbbbaaaabbcbbbbaaaaabbcda#a##ehgfeeeeecddbcddfhhgcbbbbbbaaaabcbbbaaaaa###.#a#a#a####aaa###aa##a########aabbbedbacfegggfeeefeddccddgihdaaa####", "##.###a####aaaa#bacbaa#chidccdfdbbabaaa#ababaaa###a###aa#aaaaaaaaaba#aaaabccccbcccccabb###aabaabbbcbaabaa########aaab.####aaa##################a####b##aaaabb#aacdddcbb#######bccaaaabdbba#####aa#a#########abccccccddcffhigcbaaa#aa#acaabaabbbbaaabbbbbaaaabbbbaaaaaabcccdda#a#higheddefedeecdffffeeaaabbbbaaabcbaabaaaa#########a####aaaa######a#######aaabdcbadgfdeddegfgfeedcccccehigaaa####", "###########aa#####aacdb##ejgcbbfedcaaaaaacbabaa#####aaaa#aaaaaaaaaaa##abbbbbbaaabbcddddbccdcccbababaaaaaab#########aba..####aa###################aa########aa##aaaabbbba##a####ccaababdaa#aa#####aa##########aaaaabbccdfgjjihdcaa#aaaacbaabbababbaabbbabaabbbbbbbbbbbbbcccddebadhggfffeeffffeeeffdccddaaaabaaabbabbbbaaaa######..######aaaaaa#a###a#aaa###aaaccc#ceggedddcffffedcbabccdfgebaa###", "#########aabaaa####a#aabbachjgbacdedcccbabaaaaaaa#####aa#######aaaaaa#aaaaaaabaaaabbccdccddcbbbabaaaaaabbaa########aabb.#######a##################aaa##########aa##abaaaaa######bbaaaaba#a#a#.##.#a#aa###aa###aaaaaabcddgijijjigeba#abdcbbcdcabbbbaabbabaaabbbbaaabbbbbcacddee#dfeeeffeccdghhfffebccccaaaaababbbbaaabba#a########.###a##aaaa##aa##aaaaa####aababbddceggfedcdffedcbaabcdeeffaaaa#", "#######a#aaaaaa#a#####aaaabcdiibaaacecddcbaaaaaaaaaa##aaa########a#aa###aaaaaaaaaaaaabcccbbaaaaaaaaabaabbaaa######aaaaca.###.##a#a####a########aaaaaaa##...###a###a##a#aaaa#####bdaaaaaa########a########a##a##aaaaabbbbegfeedeghgeccddeeefgcbbaaaabbbbaaaabbbaababbbbcccbceeebegdddeffedbdeiihecbcbdbaabaaababcbbaaabaaa#a#.############aaaa##b#a##aaaaa##aabbbbccdceghgeddefedcaaaaccdedfaaaa#", "########bcaaaaa##########aaaa#gidaaabedcccbbbaabdbaa####aba#a#############aaaa###aaaaaaacbbaaaaabbabbbbbcbbabaa######aabb..##.####aa#aaa######aaaaaaa####a#.####aa##ba#aaaba#####dbaaaaa######aaa#aa######aa###aaa#aaabccebabaabbdfhhhgfghggdbaaabbcaaabbaaabaaaaaaabccccccedchigdcdddcedccabghdbaaabcaaabaaaaabbbbcbbaa##a########a##.#aaaaaaaaa#aaaaaaaca#acbbbbbcccdefeddeecdcbaababcfdfeaa##", "########baaaaba#aaaa#####a####aciib#aacdddbabbaabbb#aa#####aa#############aaaa##aaaabaaaabaa##aabababbbbccbbbcb#######aaaa#...##.#####aa########aaaaa######a############a#aaaab##abbaaaa#######cb############aa#aa#aaaaabaaa#######bfhigihhfbaabaaaaaabaaaabbaaaabaaaccbccdcchiihhdbcddcddccbbeeaaaabbbaaaababaabbbeeeaa#####.###.aaaa#aaaaaa#aaa#aaaaaa#bbadccbbbbccccbcddddcbcccbaaaaddddge###", "########a##abbaaa#########a#aaabcfjhaaabcdecaabaaaaaaa#######a########a#aa#abaa#####aaabaabaa##ba#abbccbaccaaca########abcb..######################aa###ceb#######aaa#####a#aaa###acaa#aa#######b############a#a##aaaaaabaa########abacfhhfcbbaaaabaaabaaaaccaaaaaaaacbcbbcffgfgcegeddeddcdccbcd#aaababbbaaababcaabaaccba########a#abaa##aaaa##aaaaaaaaaababcbbbaccbbcbccdddcbbbcbbcbbadcdeehd##", "########bb####aaba#########a####aabfjfbbcbcfdbabaaaaaaba######aa######aaaaaaaaa##a#####aaa######aaaabacbbaaabaa#########aadc...#######.##########aaaaaa#ddeb#a####aaaabeb######a###bbaaaa##b####aa#.##########a#a#a#aaaabaaa##b###.adbaabeecbaaaaaababaaaaabcabaaaabbbbbcdcfgeddgbbggeedddcccccc####aabaaaaabbaabaaa#acda############aaaaaa#aaabaaaaaaaaaabcbabbbabcbbbbcddccbcbbbabbbbccdfggf#a", "aaaa####bc##a#aaaaaaa###.#####.####aciiecccbceebaabbabbb######a#a####a##aaaaaaa########aaa#######aaabcbbabbaaaaa#########acfc..####.#.###.###aa###a#a#aaabcaaaa###aaaa##########a##bdcaaaa#ba###baa##########aaa####aaa#bbababdcbaacbbbaaaabbaaa##aaaaaaa#aabbbaaabbbbbbcdcccddcdec#adfedddcccbe#####aaaaaaaaaabbbaaa#bdb##.#######.####aaaaa###aaaaa##aaabccbbbaababbbbbcdccccbcbbbcbbbdcefghc#", "########a#####aa#bbaaaba######...####adhifegfddfdcabccbaa###aaaaaaa######aaaa##aa##a###b##########aa#aaaaaabaaa######a###abdfb..#######.##.#####aaa#a###baaa####aaa#########a####a#bddcbaaaa####aaaa####ad##aaaaaa#######abadddccccdcba##a#ababa###aaaaaaaaabaaabbbbbcbbcbbccdccbaba##afedddccbfa######a#aaaaaabbabaaaaab#####.##..#..a###aaaaa#aabbaaaaaabcccbbbabbbbbbbbddccbbcbbbcbbcfdeeffha", "##############aababaaaa##########.##.#..chjjhjifffdeccdbaa#aaa###aa#####.##aa#######.#######a#########aaaaaaaaaac########acchc.....#..###########aa##aa#abaaa##aba##a######aaaa##a##bdcbaaaa#####a#aa###bd###aaaa#aa##a####adgdcbbcddbb###aaa#a#####aaa##aaa##abbaabbbbcbbbcccddeccc#a#bhggfedaec##########aa#aaababaaaaaa#####.##.##.####aaaaaaaaaaaaaaaabdcbbbababbabbbabddcbbbbbbccbbdifdefge", "a###a##########abb#aaab#a#######...#####.##a#acgkigfeefdcaaa##aa#aaba####..######.#a###a#aa#aa##.#######aaaaaa##ba#####aaabbeha...###.###.#######a##aaa#aaa#a#aaaa###aa#a###aa###a###cdcaaa######a#####abb####aaaaa####a####deebbbccdbba##aaa#aa####aabaa#a#aabbbaaaaabcbcbbccbcedbba###cdffffeefba###########aaaaaabcaba#####.####.#######a#aaaaaaaaaaaaacdccabbababbabbaabcccbbbbbbbccdeeedefh", "f#######aa##a##aaa#aa#bba#########..############afkjgfgfeeeba#aaa##a#######.####.#.#####abbbaa##########aaaa##a#a#######abbcdhe#...######.##a####aa#a###aa#a#aaaaa######aaa###########bdbbaaa####a######aa##.##aaab####aabdecdcbaabbbaba##aaa#########abaaa##abbbaaaaabbbcdbaccbcebaa####adghfedeeba#############aaaaabbcb##########.######aa#aaaaaaa###bcdccbbabbbacbaabbbbbbdcccbbbbbcccccddeh", "hc#####aa######aa####aaaa#####a###.......##aa##a###gijhhhggeb##baaaa####...#####.#..a###acccaaa##########aa#####aaa####aacdddhf#..###.#..####aaaaaaaaaa###a#aa#aaaaa#####aabb##########cecaaa####a##############aabb##aabacddbcbbabbbaaaaaaaa##a#######baaaaa#abbaaa#abbbabcbbbcdgd####a##adcgfecdeb######a########aaaa#baaba########.######aaaaabbbbbbcbccbbbbbbbbbaaaaabbbbbbccbcbbbbcccccdeed", "egb##baaaaa####a##aa#aaa#a#######.#..###.###########adfilkhfca#abaaa#####..##....#....###bbccaa##a##aa####aaaaa##a##a##abbcfhjfb#..#####.######aaaaaaa######aa##a#abbbba###aba#aa#######cecaaaa###a#.#######aa##aa#aa###aaabcbcbbcbbaaabb##aaaaa#######abaaaaaabbaaa#abbbbbabbabdfeaaaa##a#ca#eecccfcaaaaaaaaa#a#a######aaaaabca########a####aaaabababbbbbbbbbbbbbbbaaaaaaabababccccbcccdccbdffd", "cfhd#acaaaa##a#######a#a##a###a##.....######.##########bddjkidca#########..###....######acaacbbb#a###ab##aaaaaaaaaaaaa#aabcfgejfa#.###a######a##aaaa#aaa#a###aa##a#abbcba#####aa####a###aeedbaaa##aa####...#aaaa#bcaccbaaaabcdccabcbbbaaca#aaaaa#########aaaaaaabaaaaabbbbbbbaaabbecbbcaaaaaa#adecccedcaaaaaaaaa##a###########abaa######a####aaaabdbbbbbbbaabbbbbabbaaaaaaaabbaabccbccbccdccdefg", "fedfea#a####a##a#a#######a####a#.##..#.####...########aaaaaeikhea#####################aaacbabbdfdbbaa#aaabbcbbaabaaaaaaabcdfbbeica..#a########aabaaaaaba#a###aa#######aaa#####aaa#.aa###adffdbaaa##ca####.#########abbcdeeeefcdcbabbbbbaacbbaaaaaa##a##a##baa##aa###aaaabbabbaabaadfb#bbbbbaa###feccbeecbbabaabaaaaaaa#aa###a####a########a##aaaaabbbbbbcbabbaaaaaabbbaaaaaaabbbabccccccddddeeee", "fggehdaaa######a##########aaaaa#.##.####..#..##.#######aabbaadjljgda.#################aaaccbccddcccccccccccccdcbbccbcbaabbcfdcbgf#...#aa######abcbaaaaabaaaaa############.##aa##a########dffedcbaa#cc##########a####bbbbcdffeedaaabbbbbcbabbaaaaaaa#######abaaaaaaaaaaaabbabbaa#a#bdcbbbaaaaa###cfeeehhecabbbbbbaaaaaa##aaa##a###a########aa#aaaa#bbcbbbabbbbaaaaabbbbbabaaaaaaaabbbbbcccddddeee", "edehhg#aaa######a#a#####a##abbaa###.###################aaabbcaacjllkhbaa#######a######bbaefddddcbbbaaaababefeedddccffdccdfgeeeefec#...#ab#.####abccbbba#aaaaaa###########..###a##########bfdfdccaaacfb.######aababaaaccccbdffebbbbcbbaacccbabbabaaaa######aaaaaaaaab#aaabaaaabaaaabbeffcaaaa####aeeeefiihfcabbbbbbabaaaaaaaa##a######aaaa####abbabbabcbaaaaccbbbbbbbbcbcaaaaaaaaaaaacbbcdddddede", "eefgghcaa#######a##aa######abbbcc#.############.###a#aaaaaaaaccbafjllkjecbaaaaaaaa##aabcccgefeecccbba#aaaa.acffffffcacdccbbbfffefda#.##########aabcedba##aa#a#####a#####..#####aa###.####bceecccbaabdfa##aabbbaabbbbdcbbccdcceebabbbaaabcdcbbbbbaaaa######a##aaaaaaacaaaaabbaba###acdeegcbbb#####aeffgfgijkgcbbbbbbbbabbaaaaa##a#aaa#abaaaa##aacdbabbccbaaa#bbbbaabaabccbaaaabbaaaaabbbccdeedddd", "deeffdfd#####a######a#######aaaca#a############bdca###aca##aaaceddfijjnligdcbbcbaaaaabcddchgedddbccaaa#aaaaa##accfbbbaa####bdhfedhd#.###########bbcccdba###aaa#####a##a#.#####a####.####.#abedebdcbbcfe#####adcbcddbbdbaaacbcbccbbbaaa#bbcbbbbbbaba#a############aaaaaaaaaabaaaaaaabdfcccbbba#####aceffgiijihedccbbbbbabbaaaaaaaaaaaaaaaaa#####aabaaabbbaaaaaabbaabbbbbcabaaaaaaaaabbbbcccdddddd", "ddddecbdca###a###a##baa#aa##abaaba#a###.#####.#aabaaa#aaa##aa#acdhilmklmlmkheegecbbbbccbcefgedcdcbbbbaaaaa#aba#a#cdabcbaaa#achihggfa############abdb#bcaa##aaa#########a###.######..########beddecbcdffc###.#acdfffdabcca#aabacbbbbbaa#abbbbbbbbbaa#############a#aaa#baaaaaba###aaadfd#babacababbbcegfhhiihgfdddcccbbbaabbaaaaaaaaaaba#aaa###a#aaaaaaaaaaaabbabbaabaaabcbbbaaaaaaababbccdddddcd", "deddddcacaba###a####aaaaaa#aaaa#aaa###aa#########a##aa#aaa##aba#.cfehhjkjllmllihfedcccbbdefgdcccecbbbccbaaaaaaaaabdbbbcbaaaabhjjhggea#.####a##a#accaa#cdaa#aaa#.#############a##a##.###a####.cedccccefbbaa#####deffeaacdaaaa#aabbbbbaaaaaabbaaabbaba#####a.###a###a#a#aaaaaaa#a##aaacdecaaaabaa#aa#bdgfeeefhhfdccccddcbbaaababaaa##aaaaaaaaa###aaaaaaaaaaaaaaaabbaaababbbbabbbaaaaaabbbbcdcdccdd", "dddcccdbbbcba#bb#aa###aa##a##a####a##.####aaa##a#aa##a#a#ba######.fffkjlhkkljmmmlieeddccefaeeeccdedbcdccbcbaaaaaabaccbccaaaabeijjigieba.#######aacbaa#accaaaaa##########a#a###aaa#############decabdeeeaba###..adeddcaabcbba##aabbbaaaaaaaaaaaaaaaaa#####a###########aa#abaaaa##a#abbcdeba#b#aa#####cefedcbbdeedcccdddcbbbaabbaaaaaaaaaaabaaa###aaaa#aaaaa###aaaaaaaaaabbbaabbcbaaaaaabcccccccdd", "ddccbcccbcedaddaaaaaaaaaa#aa#a######...###########aaaaaaaaaa####..cfhjjkmlmklkklmnjfeedeefebdeddegheeedddccbbbaaabbccbcbbaabbbgjkjjhifda.#######aaaaa###abaaaa####aaa###########aa##########..adccaddcecbabbaa##dedddcbabcbca#aaaabbaaaaaaaaaaaaaaaaaa###############aabaa##a####aacbcddebaaa########cffecdcbceeefdddddcbbbaabbbaaaabaaaaaaaaaa###aaa#a#aaaaaaaaaaaaaaaabbbaaaacbbaaabbbbcdcdccb", "cdcccccbbcdbaacbbbbbbaaa#aa#aaaa#####..#..##.#####a#aaa####aa######eigfcfgijjjlmmmmnlhfhiggdddeefgegfgffdeddcdcbaaccccbcbaaabbcfjkkkijgfb#######a#aa######a#############a###aaaaaba############abcc#ddcccbdecdcaddddddecbbbccaa###aabaaabaaaaaa#aaa#########.####a##a##a#aa#a######abccdgbb#ba#a######cffgfdefffehgdddeccccbaabbbaaabbabaaaaaaaaa###aa##aaaaaaaaaaaaaaaaaaaaaaaabbba#aabbacddccc", "cddcccbbcccaabbabaacbaaaaa#aa#aa#.#...#...#..###a###a#########aa##adeaaa#abedefijlkmnnlkkjdddfdcebb#degfaefgfeddcbdcddbacbbbbbbdjjklkkihgc#aa#####aa################aaa##a#aaabaaaaa###########aabdbedcabdddeeddddedcccddccbbbca###aaaaabba#a#####a#a###aaa###.###a#######aaaaa###aabbbbcdaaabaa##a####aeghhhggghhhfedddcccccbbbbbbbbbbbbbbaaaaaa####aaba#aca#aaaaaaaaaaaaaaaaaaaaabaaaaabbbcddd", "dddcccbbdedaabdaaaabbabbbbaaaaaa#.##.##.#.#####################aaaddbbaa#aa##a##aceejnllkkhfhfccfbbaaaabafabdeffgfcdddcabbbbabacgjkkllkhjhbaa#####aa############a##aaaa###aaa#aa#a#####.####a##aa#deedcabdeeeedeeddeedbccdcccdcb####aaabbbaaa#####a##a##a####################aa####aabbbcdea##a########aaabehiiiiiihfedfdccccccbacbbabbbcbbbbaaaaaaaa##ab##bbaaaaaaaaaabaaaaaaaabbbaaaaaabbbbbdd", "ddccdbcbedcaabbbbaaaaaabbababbaa#################a##########a###a#ecbaababaaaa#####abkllllljgbaaccbababbabaaaa#cedfheedcabbbbbbbchkkkklkhggeba###aba####.####a####a##aa##aaaaaaa##aa####.####a####dfdcba#bdeeeeeefedddcbbcdbbadcba###abaaacaaa###a##a###aa#####.####a######.##a####abbbbccbbc#ab##a#aa#ca###cfggihhihffffedcccccbbabccccdccbbbaaaaaaa#aa#aa#aaababaaabbaaaaaaaaaaaaaa#aa#abbcccc", "dedcccbcecaaacbababbbaabbbbbcbaaa#..###.#########a##############.cdabbbbbbbba###aabcddilmmljeaaabcbbbbbbbbbbbabaabcefgfecbbbbbbcdfjjkkkmkhfgecbaaabb########a######aaaaa####aaa###################befcbaabbadfeeeeffededcbbccabccccaa#aaa#abaa#######a########...###########.##..###abbbbcbbf#aa###abaa#a#####acfgffgfggefddcccccbbabcecbbbcbbaaaaaaaa##aa#aaaaababbbabbbbbcbbabaaaaa##aaaaabbcc", "cddecccccdcaaaaaabbbbaaaabbbbaaaa########.####################..aaababaaacbba#abddbcdfeejmllf#aabbbaabbbbbbaaaaaaa#afffdedcbbbddffjfijjkkkhgfed####aba#######a####aaaa#aa#####a######a############adffddcaa#befefedeeddccccbcbaacbaabbaa###aba####a###############.###########.######aabcddcefbb###bbaaaaaabba#cffffghhgfffedccccccbcbbebbbbbbbaaaaaaaa####aaba#aaaabbbbbbcbaaaaabbcbaaaaaaaabcc", "dddddfebdfeba##aaaaaaabbbbabaaaa####.#########################.abbaaaaaaaaabbaaabba##aceeilmme#aaaaaaaabbbbaaaaabbbbbefgeddcddddegiighiiggjggfdba##aaaa##############ba#b###aaaa#######a##a#aaa####dfgffgcaabefeeededccccdddcbbbbbaaacbab###aaaaaa########a#a########.#########..####aaabdcdecbdc#aa###aabbcccaacegggfgghggfeeeddddcccbccbbbbaaaaaaaaaaba#aaaabaaaaaaaaaaaaaaaaaaabbaaaaabbabbbc", "bcdeeeeedeeda##aaaaaaaccbbaaaaaaa####..##.#########a##########aaaaaaaaaaaaababba#aa####abbdhkmgbbbaaaaabbabaaaaababbbaehfcdeeeegghkkjjigdeehfeccaaaabcba########a####aaa#####aa####a####aa###baba##adfgfffdeeffdcddddddbcccdccbbbbbbb##bdb###aadb#a##############.##.######.##########abcdcedecegdb#a#aaabbcddaa#adfghfghgffefeefeeddcccccbbcbaaaaaaaaaaa#aa###aaaaaa#aaaab##aaaabbbabaaaabaaabb", "cbceeeefffffd#aaaaaaaaaddbaaaaaaaa#############.#############cbbaabaaaaaaabaaaaaaaaa###aaa#achlkigdaabbabbbbaabcaacaababccdbbdedcdfehkkjgeceheccda#aabbba###.######a#aaa#####aa######.#a#aa##aa#aa##adgggfeeggffdcccddcccbbcbccbbbaaa####ca##abcba#aa##########.#####a######.#.#######abbcbddbdfhgeaaa##abbcdcaaa##aaceghdfgffffffeeddddcccbbbaaaaaaaaaaaa##aa#aaaaaaaaaaab##a#baabbabbbaaaababb", "ccddefgfefffd#a##aaaaaabccbabaabaaa##########...############acbaabaabaaaaaaa#aaa#aabaaaa#aaaabgkjiifbabbabbaaaabaaabbabaaaaaaabcc#####cgkmjgfhfcbcaaaabcbaa########a#aa###a###########.####a######aa##bghfefgeddeccbbbccccccbcdcaaa#a##a#aa#a#aaaacbaa##.############aa########.#######bbbccddddggfbaa###abbcbaaaa#aaabeeeeggghgggffeedcccbbbbbcbaaaaaaaaaa###aaaba#aaaabbaa#a#abbbbbbabdbbaaaab", "bcceddefhgfcbaa#a#aaa###aaabbbaaaaa#######################aababaaaaa#aaaaaaaaaaa#aaaaaaaa#aa###cefllgabaaaaabbbaaaaabaaabbabaaa#ba######bfjljhghcac##aaacaa########a###############aa#.##a#############afgfgfedcccccbbccccccddcccaa##a####aa#aaaaaabaa#################a#a##.#########aaabccccddeegfbaa###abbaaa#aaaaaabdfceghhhhhhgfedddcbbbbbbbbaaaaaaaaaa###a##aaaaaaabbbaaacbbabbbbbcccdaaaa", "bbcccdefhiea###a##aaa######aaaa#aacb##############a####aaabcbbabbaaaaabaaaaaaaaa##a#aaabaaaaaaaaabekljbaaabbaabaabaaaaaaaabbaaaa#a#aa#####aekkhhiba###aabbbb#####a.#########a#a#####a#######aa####.#aba##gggfeedccbbbbbbcbaabccbcbaa##a###aa##abaaa#aa###..###########.###a##.#######aaaabbbcdddcefgaaaaa##abaabaaaabbaabdeffghighhgfffeeccbababbbbbaaaaa#aaaa#a####aaaaaabbaabbbbbbbcccbcccdbaa", "bcccccdefgeaaaaaaaaa#a#a#a##aaa#a#aba#######a#.###aa######bcaaaaaaaaaaabaaaaaaaa###aaaaaabbaa#aaabbchkkc#aaaaaaaaaaaaaaaaaaaaa#a#aaa#a#######dkklibca#aaabcdca#a#aa#################a######aaaa######aab#cghhgfddcbbbbaabaaaaabbca##a##abaaa##abaaba#a#aa############...##.###.#..####aaacbbcdccdcdedbaaa#a#acbaaa#aaaaaaabcffffghhhfggfeddbcbbbaaaabbaaaaaaaaaaa#aa#aa#aaabbbcccbbbbbbbbbbcdccb", "bbbccccdfcec##aaaaaa####a####aa#aa#aca##a####baa#######a##bbbaaaaaaaabbbbbaaaa#aaaa##aaaaabbba#aaaaaadijgaabaabbaaaaaa###aaaaaaaaaaaaaa#######behlidcdbaaabbcecaa######a###aaa###########a####a#######aaacghihgfedcbaaaaaaaaaababbbaa###aaa####a#aba##a#a#####..######......#...#.#.####aaccbcccdcdehhdaa####bcba###aaaaaaabaaadfeeegihgecdedcbcbaaaabbaaabaaaaaaa##aaaa#aaabcbbbccbbbbbbbbbcbbb", "babbcdddddde######aaa###########aaaabda##a####abaaa#####abbaaaaaaaaaaaaaaabbbaaa#aa##aaaaaaaaabaaaaaabcdkib#aaaabbaaaaaa####aaaaa#aaaaaa##a##a##acgjhfgefcbbacccbaa####a######aaaa########a#############bfffhjigedddbaaaaaabaabbbbccaa####aa###a##aa#################a##.....#..#########aabbbbcccddfheaaa####bba####abba#aaaa##bca.#bghfedecbccbbbaaaaaabaaaaaaaaa#a#aaaaabbbbbbbbbbbbbbbbbbaba", "bbabbdcdddcec#####aaaa#a####a###abaaaaaa##bda##aaa######aaaaa#######aabbbaaaaaa##a##aa#a#aaaaaaaabaabacbdjjbaaaaaabaaaaaa##########a#aa##aaa##a#a##cfhhededabbdcbcca##########aaaaa############a######a##dffgjiiheedcbaa###bbaabbbddba#########aaa####################a###..###..##..###aaaabbbbcbcfffebaaaa#aabaa##a#aaaaaaa#####aa#.bdegfeccbbaabbaaaaaaaaaaaaaa#aaaaaaaababccbcbaabbbbbbcbbab", "dbbbbcdcdcdcea###a####a#aab#aaaa##aaaaaaa##a####aaa###.##aa###########aaaabaa#aaaaaaaaaaaaa#aaaaaaabbaabbbhkfcaaaaabbaaaaa##########aaa###aaba######.ekjgddbabbaabccbba########aaa####.#######aa##aaa#####dgfgghgggedcbbaaa#aabbbcbedba#######aaa#a####################aa#.......##..####aabbbbcbcdefeebb#aaa#aaa##ab###aaa#######a###.##cgefdccbbabbbaaaaaaa#aaaa#a#aaaabbccbbcbbbaabbbbcbccbbb", "bcabbcceffabbc########aaa#aaaaaaba#aaaaaaaa########.#####aa######aa####aabbbaaaaaaa##aaaaaa###aa#aa#aaaaabbfkjhdaaaabaaa#aa##aa#####aa#a#a#aaaa######aikjjhbaaabbaacbaaa###############.###################bfhggggggfedcabaaaaabbcdeccaa########aa##########aa######a#a##a##..#.#...#####aabbbbbcccecdgccb##a####a##a############aaa######agfedccccbbaaaababaaaaaaa####aabbaaaaabbababbbccccbbcb", "ababbccdffdbbbba###aa#aaaaaaa#baaaaaaaaaaaa#########.####ab###########aaaaaaabcbbbaa###aaaa#ba###aaa###abbbbflljeaaaaaaaaa###########aa##aaaaa#######.afikkiba#abbaaba##########a############################ehffgggfeedcccbaabababcccbaa######aa##aa###.###aa####...#########...########abbbbcbbbcdecfgdaa#######################aa##a####bfeeddccbbbbbaaaaaabaaa#abaaaaaaaaabaaaabbbbbbccccccc", "adbbbbcdddecbaba#a#######a#a##aaaaaaaaa#aa##########.###aac##########a##aa#aaaabcbbaaaa##aaa####aa#aaba#abbbbdillhcaaaaa####aa####aa#aaaa##aa#########.#chkli#aaaaabbaaa########a#aa###a###############.###aa#fggffgffedeecbbbaaabbbbcbaaa#####aa###a############################.######aababbcbbbccedcfccaaaaaaaa###############.####a#####bffeddccbbaaaaaaaabaaa###aabaaaaaaaaaaababbbbbbbcccc", "ccbbccddeeeccaaca##a####aaaaaa##aaaaa#a#aaaa#########.###ab####.#a###aaa##aaa#aaaabbaaaaaaaaaaba#abaaaaaaaaaaachkklfbaaaa##########a##abaaa############..#bimiaaaaaabaaba##########aa#babaa##############.##a##aegfcbdeedfedbbbabbabbcbbbaa#####a#####aa######################.#########aabbbbbcbbacddddccaaa#aaaaaa###a#####################afgeecdccbaaaaaaa#abccbaaaaaaa#aaaaaaaaaaaabbbccbcc", "ccedcdddeeeccbbbcba#a###aaa#a#a#aaa#####aa#a#############ab#####.#####aa#a#aabaaaabbbbabbba##aa###acb#aaaaaaaaacfihkida##a#a###.####aaaaaaaa##a###aa######.ahljc#abaaaaaaa###.####a######abaaa############.#####.bababeedegdcbccbcbabaaabba#a##aa####aba#aba#a###################.####a##ababbbcbbbcdddedea#aaa#a####aa#######.###.######a##a##fgfedddbbaaaa#bcdccbbba####aaaaaaaabbabbbbbbbcbbc", "cddeddddeefddcbbcc#a#aa#aaaaaaa#aaaa####aaa######aa######ab#a########aa#a#aaaaaaaaaaabbaabba#aab###abb######aaabbcfheihc######a#####aa#aaaaaaa####aaaaaa###.aikjcaaaaaaaa#################aaccbaa#a################aaaaaaabdddcbccbaaaaaaaaaaa##b####abbcccb##.###a#############..###aaaaaabbbbbccbbccccddecaaa#aaaa###a########################effedccaabbaccbbaaaacc####a#aaaa#aabbbbbbbbbbbcc", "dcdcdcdeddfecdcbcdaa#aaa##a###a###aa##############aaaa###aba#############aaaabaaabaaaabbabbaaa#aba####a##a###aaabccefadhhb##aaa#####aaaaa#aa#a##aaa#aaa#####.aflkcaaaabaa####################ddcbaaa#################a#aaa#bdddbbcbaaaabaaaaaaa#a####a#baa####a###a###aa#############aaaabccccbcccbbcdcdedefb##a###aa##aa###############a##aa####efddcbcecbccabbaa#aacc###a##aa#aaaabbababbbbccc", "ccdddcbcfhfddcdcbbc#####a#aaa##a########a#a#aaa#####aaa##abaaa##.#######aabbaabbaaaaaaaababbaaa#aaaaa###a#a#a#aaabccdha#diga##aba#####ca##aa####aaaaa#a#######acildaababbaa###########a#######abccbaa#########.#########a###cdedbbdcbbabba#aaa###a####aaaa#aab###a##a#aa######aaa######aabbccccccccccddddeddfca#aa##aaa#aaa#####a####.###aa#a##a#cfeddedacaaabcaa###aacc###########aaaaaabbbbbcc", "ccccddccdeffdcccdccb########aa##########a#aaabaa#####aa##ab#aa###########aaaaaaababaaaaaaaabaabcabba############aaabcffb.afjfa#aba####a#a########a#a########aa#abhjb#aaaba#a##########a#######aabcccbb####.#..###aba#########abddbcecbbcbba#aaa########aaaa#a#a###aaa########aaaaa#####aabccdcddccccccccddedcec###ba#a####a#a##########.######aa#adedcbbaabaaabbaa###aabca##aaa#a##aaaaaaabbbbbc", "cccccdcedcddfebbdcbdb#######################abcbba#######bbaa######.######aaaaaabbabaaaa##aaabababaaaaa########aaaabbcfiea#bgjeaaa######aa#a#############a####a#acgigaaabb##########.##a#######aaa#adcba##########ba#a#a#####a#adfcddbcccbaa#aaa######aaaaaa##aa#aabbab#aa####aaaa#####aaabbccdddcdcbbbbcccddegd##baaaaa#########a################abbcccbbbbabbbba#####abca##aaa####aa#aaabbbbbb", "bbbccddcdcddefdbcdadcaaa#####################aabbbba#a#aabba#aa##########aaaaaabbaaaaaaaaa#a#aaabbbbbaaaa###a#aaaaaaaabfifa##ejgbaaa########a##################acbcfigba#aa###########a#########a#aaabbbba#######.#a#a#######aaaaffddccbccba##aaa##########a######aabaaa#.####aa######aaabbbccdeeefggecdedcdfedcbaacbaaaa##a#a####a############a##aa#accdcbcbbbbbba#####aaca#aaaaaaa###a#aaabaab", "bbbbcccccddddfecbccbdc#a############a###aaaa#aaa#aa##aabcccc###########aa#aaaaaabaaaaaaaaaa#aaa#aaabbbbbbaa###a#aabaaabbbhie#.bfhfbaaaa###aaaaaaaaa#######a####aaabdhifbaa########aabaa###a######aa#####bccaa#####.#####a########afgeddccdcba###aa########a#a#######aa######.##########aabcbcccdffghihgdcddcbacbbeabaaaaaa#a###################a##aaaa#bcddcdcbbbab##a##aaaba#aabcaa####a#aaaaba", "bbbbbbcccccdefedbbcacdc####aa##a#.##a#.##abb######a##aabbccc###########aa#aaaabbbbaaabaaaaaaaaaaaaaaabbbccbaa##aaabaabba##diic##adhebaaaa#aaa#aa##aa##########aabaaagjjf#a######a#aaaaaaa#a#######aa#a###bdddaa#a###.#a###########adcdddddcba#aaaaa#a###a##a##ba#b###aa####.###aa#####a#abcdcbbcdghihhgdcaaaaaabcfdccaaaaa#aa###################a##a#a##acbcdcbbcba#a#####aaba##abaaaa###aaaaaaa", "aaaaabbbbbcddeedccebaccb###a####a####a#..aba##########aaaaccb.############aaaabbaabbaabbaaaaaaaaaa#baaaccbbaaaa#aaaaaaaa####fjfb###egebaabcb##aaa##############aaa#achkjbaa######aaaaaba#a#aa###a###########abba###################abaceddcbaaaaaaaa#####a#####a####a##a######.###a##abaaccddedeeffdghfaaaaaaaabbdfcabbaaaaa###############.#########a###bccbedcbdaa######a#abaaaba########a#aaa", "#a#aaaabbbbbbcdedcccbabbb##aa######.######ba#############abcc##############aaaaababaaaaabbaaaaaaaaaaaaabbcbbccba#aaaaaaaaaaa#beihb##afgdbbcba#aaaaa######a######aa#abcilheba#####aaaaabaaaaaa#########a####a##a#aaa###############a#aaadedbbaaaaaaaaa##aa##a#######a##aab######.##aaaababceefcddcb#.#gfaaa#aaaaabcfgcaaaaaba########.#####################aabddcbcabaa##a##aaabaaaa######a######", "##a#aaaabbaabbccdcbcbbbacb###a###########.aba#######aa###aacf#######.#######aaaaaabcaaa#acaabbaaaaaaaaabababbbcdcbaabba#abaaaaabfje#a#aehdaaaaaaaaba#####ab#a####aabaabijiebaa##aaaaaabaaaba##aa#####a#a###########a###a###########aaaaaabbbaaaaaabaaa#aaaaa#####a##abaaaaaa########abbabcdgeba##.##.bdaaa#a#aaaacfgcaaaaaa########.a########.#######a#aa###abccbbbaaaa#aa#abbab#abaa####aa#####", "#####aaabbaaaabcbccccbbbcca###a############a#########aa##aaacb###.#.########aaaaaaaaabcbaaabaaaaaaaabaaaaaaaaaabcaaaaabaaaaabaabaejhbaa#aggcaaaaaaaaa####abb#a###aa##aabhigddbababba#acbabaaa###aa####a#c#a#############a#a########aaaaaaaabbaaaaaaaaaa#aa##a#####aaaaaa###aaa######aabbabege##b#######aa#a##aaaaaceecbaaa############################aaaa##aaacbbbaaa##aaa#aaaaa##aa#####a#####", "####aaaaaaaabbabbdcbcdccbbba#aa####a##a####a######..##aaaaabab###.###########aaaaaaabbbbbbaaaaa#aaaabcbaabaaabbaaaaaaabbaaabbabab#bghcaba#dhfaabaaaaaa#aa###aa##aaaaaaaabeegbccbaaabcbbbaababa######aa#aaaaa##aa#.######aaa#########b#aaaaaabaaaaaaaaaaa#a##aa#aaa#aaabbab##a####ab#aabbbbcfhaaca##############abbabddbbaa####################.###a##a#aaaaa#aabbbbbaaaaaa###aaaaaaaa#######a###", "#####aaaaaabbbbbccdbccdcbcca##########a#####aa##a######a#aaaabc###############aaacaabbabbbbbaaaaaaabccbbaaaaaaababcaa#bbaaaaaaaa#ba#eiebabaafhb#aaa###a#a####aaabbaa#baabbbigcebaaabcbbcdbbbcca#a##a###acbbaa#ab##########aaaa########aababbbaaaaabaaaaa##a###a#aa###aaaca##a#aa.bc#abbdccbdga#####.###########abbbbcdebaa##a##a##########a####.###a#aa###aaa##aabbabbba#a#####aaaaaa########aa#", "#####bbbabbbabbcddddcccbbbcca#a##aa###a#################aaaaabb#a####.########aaaacaaaaaacaaaaabcaaabbcdcbbbcbabbbabbaaaaaaaaa####aa#cijdbababhfa#aa###aa##a##a#aaaaa#aabbbflggfaabacbaabbbaacbba##aa#abccbbaa###aaa#####a#aaaba###a#aaaaabbacbaaaaaaaaaaaa###aaaaaaaaaacaaaa#bbab#abbcccccbdc#################aabdceedebaa#########################b#####aa#####bbbabbaa#a####a#aa##ba########a", "aa##aaabbbbccbbcccddcdccabbdfa####a###########aa######a#a#aacc#######.#########aaabababbaaaabbaaaaaaaabbbbaaaaaaabaabbbaaabaaaaacba#a#beijbaaaaehfa###########aa#abaaaabbbbdhjghffedccaaabaabaabbaaaacbcbcccbaa#aaaaaaaa#aaaaaaaa####aaaabbaadebbaaaaaaaaaaa###aaabaa#a#aaaaabbbbbbbabcdcccefe####.##.#######.##a#aacccccaa#aa#####.###############aaa###.#a###a##bbbbbaa#a########aaaaa##a#####", "###ab#ababbccbcbccdddccccbbbeda##aaa######aa###abaa####a###abdb#a###.######aaa#aaabbbaaaaaa#abbbaa#aaaaabdaabbcbabb#aaaaaaaabaaacbcba####ejdbbbacgjd##aa#aa#####aaabbaabaabbejiiiihhggfbaabbbaabcba#bcdcdddddcaabbbbcbaaaaabaaaaaaa##aaabbbbcdedbcbaaaaabbaa#aa#aabbaaaaaaabccbbbbbcdccddffebb####################aabccccca###########.#########a####aaa####a##aa#abbaaaaaa########aaa####a#####", "#aaaaabbbabbcccccdedccccedccdebabaa#aa###########baa##.##aaa#aca#######.#####aaa#aaabaaaaaabaaaacbaaaaaaabaaaabcbaabaa##aaabaaaaabaaaa###.cjgcbbbadiib##aaaaa####aaabbaaaaabdhlijjiiihfefcbaabbbbbbababdedfddedccbccdccbccdccccbaa#aaaaababcccdddcccbaaabbaaba#aaaabbaabbaccdddcdefffedeeed..################.######abcbdfbab#a###########################a#a#####aaaaaaaa##aaaa######a##.#a####", "###aaaaabcbabccccdcddcccccbbccebaaaa##############a#a####aaa##abb##############aabaaababaaabaaaabbaaaaaaaaaaaaaabbcbabbaabaaaaaaaaaaaa####.afhdbbaabfihb.#aa###aa###aaba#aaacclljjiijigddecbaabccbabbbdbadcbeffffeffgghhhighgfhgffcaaababdbbbbcfddddcbbbbbccabaaaaaaababddehggfegjiedaaaa#a####a##############.######bcdcddbaaa##a###################a#a#####aa####aaaa#aaa#a########a#######aaa", "aa##aaaabaaabbbdddccdbcddcccccdd##a#aa##aa########a######aaba###ab##############abaaaaacbaaaabaaaaaaaaaaaaaabbaabbaccbaaaaaaaaaaaaaa#########bfgbaabbdije.######aa#abbaaaaaaabellkkkkllkiiigfdcdcbabbcbcdcbcgijkjhhhhijjic#dcbcbddghffeeeihiggfgddedcccbcdcdcbcbcbabadeeffghhhebegdddb#########a#a####################babbbcbbb##a##################aa##a####aa#a###aa#a#aaa##a#######aaaaa##aa#", "a#aaaaabaaaaaabcdcceccefcadgeceebba###a#aaa########a#####aabaa#aabda########a####aaaaaaabbaaaabaaaaaabbaaaabbbbaaaaaabbcbaaaabaaaaaaa#aa######.eiebbbbcfihc#.###abaaa#aa##aaaabellkjlkjklmnnmlkgfccbbdddeefghjijkkllkhd#cfeabcbbcbbdgjjhgecccehieeededccceeedddddefcdffcedbacdec#bbaba#########aaaba#########.#######aaaacccdbbaa####################aa##a####aaaaa#aaaaa#a####aa######aa#aa##aa", "a#aaaabaaaaaaaabcccdddggedbdfccecaaa###aaba#a#######aa#.##aabba#aabc###########aaaaabcbaaaabaabaabbbabaaaaaabbcccaaaabbbbbbaaabaaaaaa#aa#aba###.bigbbbccdilid.##aaaaaa####aabbbcekmljgdfiijikmlmnkgdeefeeegieeddgdcghgdbabcfdebcccceffggfcbbbbbcefgedddcceeefdedcbccefgb####babedcaa##aa#######aabcda##.#############aaaaabcdcdbaa#########a########a###a###aabbbbaa#aa#aaaaa##aa######aaa##aaa#", "##aaaaabbaaaaaaabcdceeffedccfgedcaaa##aaaa###a#a#####aa..##abaaaabbd#########aaaaa#a#bbbbbbaaaaaaabbbbbaaaaaabccbbaaabaabbbbab#aaaaaaaaa#aaaaa###ahibbcdccgjkg####a#aa####aabbcddegkhddgihhghiibdilmljjjjiiihfaaa##aeeedcbbdghfdbbdfedfedccbbbbdbffhfededeefhhfc#####cea#####aaabdfda.a######.##abdfb##########.###a##aaaabadefecb#a##########aaa####a##aa####acbbbaa##aaaaaaaaaaa#####a######a#", "a##aaaaaabaaaaaabacddeddfdccefffd#aaaaabbaa#a#####a#.aaa###aaaa#abbdb########aaaaba#aaaaababbaabbbbbbbbbaaaaaaa#abcbaaababbbbcb#aa#abaaa###########fhdcccdcehihb###aa######a#bccdefggiglkjjhiihba#cglkjhiihgebcaaaaaa#aacdbbdefhfdbbeedbccbbbabdcbgjifefedeggfgfa#aa#a.aa######aaaacffba####.###abdeca######a###########aabbegffgedaaa##########aa####a##aaa#####aaaab#aaa##aaa#aa######a#######", "##aaaaa#aaaaaaaaabbcdddceddeeecdfbaaaaabbbaa#####ab#########aaaaaabbc########aababbaaaaaaaabbbaaaabcbbabbaaabaaaaaaabbbbaaabaabbbcaaaaaaa##########.bhfcccdddefigc#abaa#aaaaaacccdegeiihkihhjhbbaa#.#a##a#..##aaaaaaaaaaaacaabaacefedefbbedcbaccdbcfgiihhfdec.addb#ba###aa######aaaaadgeca#######aceaaa#################aaabdgeeghffb########a######aa####abaa#####a#aaaaaaa#aa###a#.######aaaa#", "a##a####aa#aaaaaaabccbccdedefebbef#baaaaaabaa#####a#aaa####aaa##aaaada########aaabbbaaaaabbaaaaccbbcabbbbaaaabaaaaaaaabbbbabbbbaabcb#a##a#########a##bifdccdddefgjeaaabaaaa##accbbcddfhehijhdb#aaaaa#a####a#abaa#aa##aa#aaaaaabbbaabefigffefdbcccdcbaacbbdhhfeaacbabb##a##########aaaaadhgb#####aabecaa########a###########baegfefgfeca##a#######a##aaaaa#aaaaa####aa#aabbaa#aaa###a#.#####a#aaa", "#aa#####a#a#aaaaaaacccbbccdcdedbcfcaaabbbaaaaa####a###a###abdb####aaeda######a#aa#aabbbabbaaaaacddbaaaaabaaaaaaabcbaabbbaabbbbbbababa####aa###aaa#####dihecccdedeejgaabcbaaaaabcbbbcdeheggeabaaa####aa########aa###aaaaaaaaaaaaaaccbaabdegedddddddccbbbba#abaabcbbaaaa##a##.#.#####a#a#abefb#####abdfaaa#####aaaa#a########aaadfeeffffc#######a######aa#aaaaaaa#aa##aa#aaabaaaaaa#######.###a#aa", "aaaaaa#aaaaaabaaaaabbcbbabbbcceedffdbaabcaaaa##abaa##aa###acefa####abdaa###.####a##aabbbcbcbaaaaabba##aaabaaaabaabbbaabbbaabbbbabbcbba#a##aa###aaa#####bhjgccdddefdhheabbaaababcbbabcdehfcaaaaaaaaa#aaaa#######aa###a##aaaaaabcdaabbbbabbbefedeccddcbbbaababbbcccca#a####aa#############aaceda###aabfebaa####aaaaa##########aaadefedegca########aaa##aaa#aaaaaaa##aaa##aaaaaaa#bcba#########aa##", "#aaa#aaa#aaaababcbbbbccbaaabbbbdgffgbaabbbaaaa#aaa####a##abbgea##aa##bca#########a#a#bcbabbbbaaaaaaaa##aabaababbbaabaabbbbbbbbbaaaabbaa##a#####aaa######adhidddddfhdfigbcba#aaaaaaaacbcfdabaaaaaa#aaaaaaa#######bb#####aaa##aabccaaabdcaaaeeefeddefcbbbbaaaabcbbbcdba#####a####..#######a##abdb#aabcefdaa####a#aaaaa#######aaaaaabacefc#########a###aaaaaa##aaaaaaaaaaaaabaaaa##aaaa###.#####aa#", "#############aabaaaabcbbaaaabbcceeeeeaaabbaa##a###ab#####abddb#####a##cb#######aa#a##aabbbbbbbaaaaabaaa##bbabbbaaabaabbbacbcbbbcbbbbaaa###a######aa##a#baaagkecdeegfeehfcbba##aaaaaaaaccdcbaccbaaaa#aaa##aaa#########a##a###aaabcaaaadeddbbdcdeigfdbcccbaa##cbabcbcdaaa####aaa######.######aa#debaacfdcaa#####aaaabaa########a##aabccdd#############aaaaaaa###aaaaaaaaaaaaaa###aaaaaa#########aa", "#############aabbbcbbccbaaaabbccddeedca#abaaa#aa###a##.##aaaa#######aaaca############aaaaaabaabaaaaaa##a#aaaaabbaaaaabbbabbbcbbccbccbaba##########a##aaabaabejfddddehddhgdbbba##aaaaabbbcccaabaaaaa#a#a##a#aaa###############aabcaaaaaegeddcecacdghfdccbaaa#cbabcbac#######bba#################bcdcbeebaaa###aaaa#aa#a###a####abaabdcdcba#a##a####aa###aaaaa##aaaa#aaaaaaaaaaa#aaa##aa#########a", "aca##########a#aaabdbcccbaaaabbccddeedbaaaaaa#aa#########abca#######a#aca############aaaaaaaaaaaaaaaaaaaaaaaaabbabaabbbbbabbbcbbbbcabbbba##########aa###aabbbeidbbccehefhhcbbaaa#aaabbaaabbcaaa#abcaaaaaaaaaaaaa#####.########aaabaacbedfdbbbdccccfhebaabaaa##a#acaba######daa###.######a####aa##acfdfdaa####aaaaaaaa###aca#aaaabaabccdeaaa###aa#aaaa##a#aaaaaa#abaaaaaaaabaaa##############.aab", "aa#bb#####.######aaabcccbbaaaabbbcddeebaaaa########.#####abca##########abaa####a#####aaaaaaaaaaaaaa#aaaaaaaaabcbbaaaaaaaabbbbbbbbbccabbaa#a#########a#####aaaachdbccdefehgiebbbaaaaabaaabccacbaaaacbaaaaaaa#aaaaaa#############a#baaaaceddbaabcbebbefdcaaaaa###ba#baa#####.aba##############a#a##aacfghdcaaaa#abaaaaaa######acbababbbdbaa###aaa#aaaa#a#aa#aa#aa##abaaaaaaabaaaaa##############ba", "a#aa#a#####.###a#aaabbcccbbbaabbbccccge#aa#######.#######abbba#######aaabbaa####bba###aaaaaaaaaaaaa#######aaaaabbbbabaabbaabbbbcbbbcbabbbaaa#a##a##########aaaabeccccddfgefhgaccaa#abbabbbbabbbba#aa#aaaaaaaaaaaaa#######a#####aaaaaabacdccabbbcecaacdfecbbaaaa#aaabaaa#####aa########aaab####a###aabeggbaaaaaaaaaaaaa#a##a###aaaabcccccaa###aaaaaaa#aa#aaaaaaaa#abaaaabaaaaaaa#a###########a#aa", "###aaaa###a######aaaacccbbbbbbbabccccehb#a########..#####abbca#######aaaacaa####cca###aaaaaaaaaaaaa#######aaaabaaaacdbaaabbbbbbbaabbbbcbccaa############a#aaaaabaccbdccegeccffbbaa######.#abaabbbaaaaaaaa#aaa#aaaaaaa#a##########aaaabbcc#abbabaabaddcbceebbba#aaaaaba######a############aba###a##aaaccggbaaaaaaabaaaaabaaaaa#a#bbabbccdb#aa###aa#aa#aaa#a#aaabaaaaab###abbabaaa###a#a########aa", "###aa#a######.######aacccbbbbbabbbccccfheaaaa#############bbcaa#######aaabcaa#####aa####aaaaaabaaaaa#aaa##aaabaaaaaacdcbaabcbbcbbbabbaabbbbca#a######aaa##a##a#aaacabccdeggacge.#aa####a#baaaabbabaaaaababbaaaaaaaaaaaa#########aaaaaaabda#aaabbbacbcdbbcdeca#a#aaaaa#a#aa#aa#############aa#####a#aaabcfgcabaaaaabaaaa#aaa#####babbbcccc##aa#a#aa#aaaa###aa#aaaaaaaaaaa#aabbaaaa###a#a#####abba", "###aa##aa##########a#acbcccbbbbbbbbbcceffebaa#############accbaaa######a#bdcaaa####aa##aaaaaaaaabaaaaaaaa#abbbaaaababcddccbcccccbaabaaabbbbbca####a######aaaaa##a##bbabcbdgefeed########a#a###ab#aabbbaaaaaaaaaaabaaabba#####a#.#a##aaaabca##abbbaccbbdcbcdedb#aaaaabaaa###aaa#########aa#aaaaaaaaaaaaabceecc##aaaaaa#a#aa########abbacccc##aaa#aa##aaaa###aabaaaaabaaaaaaabaaaa####aa#####a#a#a", "b###aaaaa#######.##a##abbdcbaabbbbaabccdegea########a#####abcbba###aa####acccaa######a#####aaaacbbbabbccbbaaccaaaaabbbcccbcbccbbaaaababaaaaabc###a#aa#####a#aa#a#aabdaaacbbafhgbfa.#####aaaaaaaaa#aabaaaaaaaaaaaabbbaaba###a###########baba##aaaabacaabccbccdeeaaaa#aaab####.########.##aabbbaaaaaaaaaaabccaccba##abbaa###a##a###a#aabbccca#aaa#a#abaaaaaaaaacaaaa#aaaabbaaaaa#aaaa#a#######a##a", "baabaa#######aaa#####aabbccbbaaabbaaabccdfeba#######aaa###abcabbaa##aaa####ddbaa######a###aaaaaaaaaabbcbbbbbccaaaaaabbbbbcccccbbbaaaaaaaaaa#abca##a#aaaaaa##aaaaaaabcaaaabaabgicce##.#a##aa#a#aaaaabaccbaabaaaaaaaaabbbaaa#aabb##########aa#aaaaaaaaaaabccccddfebaaaaabbaa################bbbbbbaaaaaaaabbbc##acbbaaaaaa####a#####aabbbcccb###aaaaaabbaaaa#a##aa####aba#bbaaaaaaabaaa#######a##a", "baaaaa#######aa#######aabccbabaabbbaabbbcdgdb#a########a##abdbbaaaa##aaa##abdcbaa#############aaaabbbbbbbbbabccaaaaaaaacbbbcccbccccbbaaaaaaaabbca#aaa#a#aaaaaacbabaa#aaaaaccbbjgabc###bb######abaaabbcccbabbbaaaaaaaaaaaaa##aaaaaa#######aa###aabcbaaaabbbccdeeefebaccbbbbb#.####a####.###abaabbbbbcbaa#aaabca.##acccbaaaa########aaababbcba##abaaaaaaaaaaaaaaaa#aaa#baaababa#bbaaaaaaa#######aa", "aa##aaa###############a#abcbabbaaaabaabbbcffcaa##aa##aaaa#abbbbaaaaaaa##a##abdbaa##############aaaaabbaacbabbbcaaaaaaaabbbaaabacbccbbbaaa#aaa#aabb#aaaaaaaaaaabbbbaaaa##aabbbadiabbc.##c#######aaaaaabbccbbabbaaababaaaaaaaaaa##aa#######a#####aabbaaaabcbbbcddcefhgceeaabba##############abbbbbbcbaa###.###aca####aacdba#a#a######aaaabbcbbaa##aaaaaaaaaaaa#aaaaaaaaaaaaaa#bababaaaabaaaaaaa#ab", "cb####aa################abcbbbaaaaabbaabbbdgdb##a#aa#aaaaa#abaabaaa#bba####aaddba#######a#########a#abbaaccccccbaaaaabaabccbbabaabcbbbbaaa#aa###acda####aaaabaaabbcbbaaaaa#bcbcebbccd#.aba######aaa#a#acbaaabbbbbaaabbdbbca##ba###abc.#.####.##a#bbaaaaaaccccdecdefghgfccccb#.####.#...###aaaabbabddba###...##bb#####a#bcba##########aaabbccaa###aaaaaaaaaaaaa##a#aa#aaaaaaaa##ababbaabaaaaaaaab", "ec##########a##aa#.#####abbcbbaaa#aa#ababccfffcaaa#aabaaaaaabbaaaaa#aba###aabbfdaa###.#############a#aaabbccbbccaabbaabbbbbbbbabaaabbbbbaaa#a###aacdba##aa#abbacbbcbbbaabaaabbceabccde.#c#aa######aaa#aaa#aaababbabaabbdefecd#aaaaaaec#.#########aaaaaa#aacdcbdbabdfegddffdba##.#.###.###aabbbbabbccbba###.#.##bc#######abbba########aaabbbddcaa##aaa##aaaaaaaaaa#aaa#aaaa#aaaaaababaabbaaaa##ab", "bca######.#####aa#######abbbbac#a##aa##abcdcehfaaaabbbaa#abcbbbaaa#aaba#####acegdaa####.############aaaaabbbbccccbabababcbbbbbaabbcbbabaa##aaa###aacebba###bffcdbcbbcbbcaaaabbbhbabbcee.##aa##aaa#acaabbaaaaaaabccaaaaaabdefge##aaaacea###########a######abdfdabaaaaababaceeb###.#...#.##aaabbbabbbaabaaa###..##bea###a##a#aca#a#a#####aaababb####aaaa##aaaaaaaaaaaabaaaaa#aaaaaababaaaaaaa###ab", ".#a###########.b########aacaaaacaaaaaaa##acdffgbaaabaaa##aaehdbaaaa#aaaa#####acfgbaa#########.########aaaabbabcdecbaabbabbbbbbbaaababaaaa######a##aaddbaaaaab##a##abccccccbbaabfhaababgd.######aa#aaaaaaaaaaaaabacdddbaaaaaaddeda#aa#ba######..##a########abdcaaaaababcabbbcddb#a###..#.##aaabccbbaaaaa#########abed#########cb#a#a####a#aaaaacb###a#aaa##aaaaaaaaaaaabaa#aaaaabaaaababaaa######", "#########aaa###a########abbaaaaaaa#a#aaaaaacdegeaabaaccbaa#acefcaa###aabba###aadfdbbaa####.#############ababaaabcccaaaaabbbbbbbabaaabbbbaaa#####aaaabdeaabbba########aabdedcbabbffaababhd########a#aaaaaaaaaaaaaaacedbabaaba#bfggcaaa#########..#.########aabcb#aaaaaabaababccddba#..##.####aaabbaaaaaa##...#####acecb########abba#aa#a#aaaaabbca##aa#aa#aabbaaaaaaaaaaaaaaaaaaabaaaaaabaaa#aa##", "##########aa###a#####aaaaaaa##aaaacc#a###aabbcefbabbcfcddddbabgfa#a#aaaadbaa##abdedcaaaaaa#############a#aaaabbbbaacbbabbaabbaaababbaabababa##a##aaaaaccbbbb########.###abbacdcccgbabbbcida####aa#a#baaaaaaaa##aaabccaaaaaacbbabggb#a#####aa##..##aa######aabbcbaaaaaaaba#aabbcccca#.########aaaaaaaaa###...#######abdec########abb#aaaaaaaaaaabcbaaa#####aabbbb#aaaaaa#abba#aaaaaabaaaaaaaaabb#", "###########aaaaba###aaaaaa####aaabdebca###aabbcfgfbacdccdeheaadgea###a##dcabaaaabdedcbaa##################aaaaabbbccbaabcbaabbbbabbabbbaaabaa#####aa#abddbcb##a########a##.##accdeedbcccejcbaa####aaaaaa#a#aaaa###aabbbbaa#bdbb#chfa####a########.###########babbaaaaaabaa#aaaaabbcdc#..######aa#aaaaaa###.#..#####a#abdeba#######bbbbaaa#aaaaaabcca#aaaa#aaaabbbaabaaaaaaaba#aa#bbaabbaaaa#####", "######a##a###a#aaaaa#aabaaa##aaacddbbcaa##aaaabdifdadeeddfffaabdddbaaaaabd#aaaaaacfedcaa#################aa###aaaacccbbabbbbaaabbbbbbbbbaaaaa######a#aaacdddaaa#########a######aabbicceedghcbb##aa#aaaaaa#aaa#a####aaabbaa#adffbafgd####aa###################aaaaaaaaaaaaa#ababaaabbbcb#.####aaaa#a#a#a##..########a#aabbcdd#.###a##bbaaaaaaaaabbbbba######aaaacbb#abaaabaa#a#aaaabaabbbabaa####", "######aaaaa####aaaaba#abaaa###a#bddccaaa######abcfgghhhfdfffcacbabdecca#bca#aba##aeffeba##############.########aaaaccbbbabcbbbaaaababbbbbbbaaaa######aaaabeeaa#aaa######a###a#aaaabfgdbbddhhccb###aaaaaabaaa###aa##aaaaaaaa#bffgd#cda##a#a######a#a###########aaaa#aaaaabb#abaaaa#aaaabbca####aa#aaaa####.#############aaabcdc#####a#abba###aaabababc#aaa##aaabcaaaaabaaaaaaacaaaabaabbbbbaaa###", "a######aaaa##a#aabbaaaaacba##a##acccddbaa#a##aaaaacccdefefefdacaaaacgebcdb#a##aacbbegfdba#aba##############aa###aaabcdbccbbabcbbbbbbbaabbabaaa###a###aaaabcdb#baa#a###########aaabddgcdcbbcfidbcb#aaaaabaaa#a#a#abaa###a#aa##dfffeaa#####a#####aa##b.######.###aaaaaaaaaacbacaabaaaa#aaaacccaa####################a########abceca###aa#abaa#aaabaaaacda#aa###aacaaaaaabaaa#aaabaaaacbbbbacaaaaaa", "aa##a###aaaa#a##aaaaabbbbbbba####bbbacbaaaa##aaaaaabccbdedcefaccaaa#accccaa##aaabcddfgefeeffea################aaaaaabbcbcbbcbabbbaabbaacaaaa#a#######a#aaaacfcaaa##a############aacdee#a####eifccc#aaa#ccaa###aaa#ba###a###a#befffd######aaab###aa############aaaaaaaaaabbcbcdbbaa###abbaaabccdca...#######aa#a####a######aaaabcdc######aaaaaaaaaaabbcdbaaa##aababaa##aabaaaaaabaa#abbbbaaba#aaa", "#aaaaa##a#.###a#aaaaaceccbbbab##aaaaaaaaaba#aaaa#aaabccbcdddgfdaaaa######aa##a#aaaeggihgeefeddeca###############aaaaababcbbbbaabaaaaabacbaaa##a#####ba#aaabadgeaa#a##a####a##a##aabbeeaa#####bhibaca##aadbaaaaaca###########aadfddfda###abaabb#aaba#####a######baa#aaaa#abdc#bccbaaaa###ba#aaabdfeec#########aa#aaaa####aa#aaaaabde###a###aaaaba#aaaabbccbaaaaaaaaaa#a#aaabaaabbaaaababbbbaabaaa", "##aa####a#####aaaaabcccbbbcbbaa##aaaaaaaaabb#baa##aaabbcccdefgiecbaaa##aabba###a#affghihfccdddddeca################aaabaaaabaaaaaaaaa#aaaabaa########aaaabaabcgcaaaadda#aa#######aacdde#######aegbbdbaa#adbbaabcaa#aa#########acfeeecaaaaaaaabbaaaba###########aaaaaaaaabddfbaaababaaaaaaa##aba#acefgca###aa#####abb######aaaaaaabcfa##a###aaaabdaaaabbbbdb###aa#aaaaaaaaaabcbbbbbbabaabbbbbbaa#", "####aaaa#a#####aaabccccbaabcbcca##aaababbabbabaaaaaabcccbacddefffdccabccdedaaaabdeeffgggeccddccdcdca#a##############aaacaaaabaabaaaaaaaaaaaaaaaa###aa###aaaaacdgcaaabaaa#######a##abdchaa######.cfcbcb#a.bffcbbbab###aaaa###a###ceedddabcbaaaabbabbaaaa##..#####aa##aaaa#acecbbcbaaaaabaaaa##aba#aecbccdcabaaa##abbaa#a##aaaa##aaaabdd##aa##aaa#aaababbbbbdb#a##aabaaaaaaaaaaaaabbbbbbcbbbbcbbaa", "aaabaaaa####aaaacccbbcbbbaaaabdaaaaabcaabcbbbbbaa##abcddcbcdefedffedbdccdeec#aafffdddeffcccbcdcccccccaa#############aaaab##aacaaaaaaaaaaaaaaaaaaa###aba#aaababdefaaaaaaa##a###aaaaabccgcaa#######bgcdeca##bhgbabaac##a#aaa##a###befddfdddbddbaacabbbbaa####.#######a#aaaaaacbaabbbaa##ababa##aa##acaaaabbcb#aa#a#aaa##aa#####a#a#aaaabeca#aaaaaaaaabaabbbbbdb#aaa#abaaaaaaaaaaaaaaaaaabcbaababaa", "aaaaaa#aa#####abbbcbbabcccbbaaabbccccdbabccbbbbbaaabbcddcbceeeddeggddfbcdeec###dffedddeddcccedccccbbcdb#################aa#aaabaaaa#baabaaa#aaa######aaaaaaaabbcdfaaaaaaa#a####a#aaaabge##########bhcbccaabdeeaaaa###a###aaaaaabceedefeeedeeccabbabcbbaaaaa##.#.#######aaaabbb#aaaaaaaaaabaa##a##aaa#acbcabca###aa####aa#########a##aaaedb#abaaaaaaabbabababccb#aaaaba#aaaaaaaaaaaaaaaaabbbbbaaa", "aaabaaaaaa###aaabbbbbaaaacbbbbbcccddefdaabbbbccbbbbabbccbcdddddeeeffefcedffedbabeeecddcbcccbdbbbabbbabba#aaaaa##a######aa#a##aaaaa#a##aaaaaaaaa###aa##aa###aaabbdedaaaaab#a####aaaaabbgha#a########becaccdfgddda#aa#aaaabaaa#a#addeecdcdfeeeddcacbbbcbbaaaaaa###########aabacbaaaaabaaba#baba#aa##bbbdbacaabcb##aaaaaaaaaa#########a#aaabddbaaaaababbbbbaaabcccbabaaaabaaaaaaaaaabaaabaaaabbbbaa", "abbabbaaaaaaaaaaaabbabaaaaabbcbbcdedfggccbaaabbbbccccbccddeddccdddcddecddeffddecddccacbaacbbbbaabaabaaaaaaaaaaaaaba####a###ba#ba#aa#####aa#aaaaa############aabbcdebbbaaaa########ababdhf#a#########afecfffebceaa###aaa#aaaaa##abeeddddeegffdcfdbbabcccbaaaaba###########aaaabaaaabbaaabbbaabbaaaaacdcaacaaaabca##aaa#aa#aa#aa#######aaaaacee#bbaababbbbbbbbbccdcaaaabbaaaabbbaaaaaaaaaabaaaaaab", "babbaaabaaa#aaa#aaaaaaaaaaaabbbbcdbadccdbbbaabbbbbcbbccdeeedeabcccccccccdeedfddcccdbcbaaaaaaabbbaaaaaaaaaccaaa#aa##aaaabbaab#a####aa####aa##aaa###############abcdedbcba#####aaaa#aabbdhie.#####a#####fgffececeda###aaa#aaaaaa#cddecddcddefeegefeccbccccbaa##aaa#.#####.##aaaabaa#aaaaa#aab#bcccbbccbbaab#aaaabcbbaa#aaaa#a#a######aaa##aaabdfdbbbbabbbbbbbbbbccccaaaaaaaaaaabbbbbaaaaaaaaaaba#b", "bbaaabbaaaaaaaaaaabaabbbaaaabbabcedcbbabccaaaaabbbaabbceffcccbbcbbbbbbbbddcdddbbbabbbbaa####aaabaaaaa##aacfeaa######a##aaabbbaaa##aa#a#####bcca#a##aab##aaa#aaaacccgdbbb#######aaaaabbbdhhb###########aeifddbbceda#aaa##aaabaabefffcdddccdeeeedeffefeddccbaa##aaa###.###..aa##aba##aaa#aaabaaabccddcccaabaababaabcca###aa#aaaaa####aa#####aaacffbbbbbbbbbbbbbbbbcdcaaaabbaaaaaabbaacbaaaaaabbbab", "babbbabbaaaaaaaaaaaaabbbaaaaabbbceddcbaaabbbbbaaaaaaabcdffdcabbccbbaaaabbbbbbbbaaaaaabaaa#a##aaaaaaa####aadd######a########abbaaaa##a#####a#aa########aaaaaa#aabbbbdgcaaa###aa##aaaaabadfgb######aa###aadidcdbaceca#aaaaaa#abcdeeeccdeddccddeadeefffffffecbaba#######.###.##aa#abaaaaaaaaabcaaabaabcbd#abaabbbbaaabdba#a#a##a###aaaa#########aacefdbbbbbbbbbbbbcbcccaaaabaaabbaabaaccaaabbaabbaa", "baababbbbabaaaa#a##aaabbbaaaaabccehdbaaaaaaabbaaaa##aabdgieccccbcbaaaaabaaaaaaaaaabaaaaaaaaabaaaaa###a###aaa################aaaaaacba######a#a##########aaaa#abbbbbcdhb##a####aaaaaaaacbfe.##aaaaa#####aadhcbbaaefbdb##aaccddfgedbddccccbbcdedceceggfeefefdcbaaaa#####.###.###aaaaaaaaa##aba#aaaaababdb#aa#aaabaa###bcbaa#######aa#############abdffcabbbabbcbbcbcbcdcbbaaabbbbbbbaacabaaaaaaaaa", "bbbbabbbbbbbaaaaabdcabdcaaaaaabbcdffcbaabaaabbbaaaaa##bcgjfbbbcdddcbbbbbbbbbaaabaabbbaaaaaaaaaaaba#########a#a###############aaaaaabaa#######a######aa#a##aaaabcbabbcceda#aaaaaaaaaaabbbec.a#aaaaaaa####aadhcabbbeecbaaadefggfeddcddcccccbccdccdddeghggeeeddcbaaaaa############abbaabaa#aaaaaaaaba#ba#aaaa#abaaaaa##aabbb###aa#a#a##a##########abbcffdcabbcbbbcccbbccccbaaaaaabbbbaabbabaaaaabba", "bbbbbbbbbbbbbbaaabfdcccbcbaaaaacdceebaa####aaabbbbaa##bdghfcbaaacdddccccccccccbbababbbaaaaaaabbbaa#a##aa#a#b##a#aa###a#######abaa###aaaa##a################aaaaabbbcbbcffaaa#cbaaaaaaaacec.#####aadea##a#aabgdababdfda#adfggeddccccbbbaccbbcbcddddgghigffffbabbaaaa##########ab#aaaaaaaaaaaaa####aaaabaaaaaaaaaa####a##aaca##a######a#########acbbbbcdefdabbaabccbbbbccccbcbaaabbbaaaababaaaabcc", "bcbbbbbbbbbcbbbbbcecccbaccedaaabddcaaa#######aabcbbbaabdfhfdcaa###acdcabdfeeedcccccbbcbbaaaaaaacbaa###aaaa#aaa#####a#aa##aa###ba###aaaaaaaba############aa#aaaaaaaaaabbbfgaa#adbaaa#aaaaehaa###aa#adea#a#aaabgbabacefdb#dfffedccbbaaaaaaccbbcdecdggihihhfdffcbbaaaa###aa###..#aa####baaabaaaaaa#####aaaaaaaa#aba#a###abaa#cbaa##.##aa####aa##aa#baaaacccefdbbabbcccbbbdccdbaabbbbbbbaaabbaaaaabc", "cabaabbbbbbcbcccccddb##abaccbabbdbcaa#a##a####aabdcdbbcdddghcbaaa####bcacigggecbbbcbcbbabcaaaaaabaaa#a##abb#########a##aaaaaaaaaa###aaaaaaa########aa##aaaa#####aaaaa#acegfaaa#aac##aaaachfc###aa###aabb###a#bbabccddefdceffedbcaaaaa#aaabbbbcdegihhhhgggdcffecabaaaa##a##.###abca#aaa##aaaaaaaa######a###b###baa####aaaaaaaaabca###############aaaabbbbbbdfebbabcccbcdcbbdcbbaababbabaabaaaabbb", "febaaaabbbbcdcccccb#####abbabbcccbbaaa####aa#a#abdeccbddeeehgcaa#a#aa#addhifdddbbccbcccbbbbaaaaaababaaa#aaba####a##a#a##aaaa#aaaaa#a##baaaaaaa#####b###aaaaaa##a##aaaabcefihefc##aaaaaabbdha####aaaa#ab######aaaabbccdefegffdcccaa#a##aaaaaabbehhhhffffcddbdcdbbba#ac######..###bb###a#abaaaaaabba#####aaa######a#aa#####a#####bbca###########a##aaabbbaaaabdfdbaccbccbcbbccdcbbbbaaaabaaaaaaabb", "dedbbbbbbccbcdccddb#####bbbaacccacbaaaa###aaaaaaacfdcbcdegghigbaa#aaaaaadfhgedcccccbbbbbbbbbbbbbbbbaaaaaabbba########aa#aaaa#abaaa####aaaaaa############aaaaaaa###aaaabcfghgihfbcb#abaaabbge####aaaaab######a#aaaaaaccdeeddfdbcbaaa##a##aabaafhgggfedccccdccbaaabaaaaaa#########a#####a##aabaabcaa#aaa#a#####.####a###########a#aaaba##a####a#aba#aaaabbaaaaabdeecccbbcbbccccdcbabaaabbbaaaabbba", "bccdcbbbcccccbcdfda#####acbabcbaabaaa#a###aa#aabbbefedcdffiihhcaaaaaaaabacfffefedcbbbbbaaaabbbbbbbbcaaaaaabaaa####a###a##aaaaaaaaba#####aabaa###########a#a####a###baabccghfhiieaa##aaaaabdga##a#a#aaaa######aabbaaabbbcddegdcbbaa##aaaaaaabbfedfddecbbbbbbaabbabbaaaaaaaaaa####aa####a#a#aaaabcbaaaaaaaa##############.######a#a#aabbba#a####a#aaaabaaabaaabbabcfedcbbbcbccccccbabbabaaaaabbccb", "bbccccbbcccccdddeca####aabbccca##aaaa##a#####abbbbeeffeeccfjjifbaabaaabbbcdecdeffdbcbbbaabbbccccbbdcbaaaaa###########a#a#aaaaaba#a######aaabcaaabaa###aa#aaa######acedbcdfihfhifba####aaaadhc###aaa###########a#bbaaabbccccfecaaacca##aaaaaccffdfccedbbab#a#aaaabbaaabababaa###########aaa###bbaa#aaa#abaa##########.########aa####a#aabba#a###a###aaaaabaabaaabbbcdfedbcccbcccccabbbbbbabbbbbbc", "bcdcbbcccccddddddba####abbbbdca#a###a###aa####aaabcededcbbgiijjhcabbaaaaaccddddcceedddddddeeefedbbcbcccbbbbaaa#a###aaaaa###aaaacaaa##a###a##acca############acaaaaa#abbccdghccggfcaba#aaaacggdaaa###############abbbaabbdeefedbaaaadda##aabbchedeefedbaaab#####aabbaabacbabaaaa########aa#a###aa####aaabba##a##.#############a#a####aaa##abdba#########aabbaabbabbaabdeddcbbbcccccbbbbaabbbccbba", "bbddccbccdccdcebcbb#####abccbcd######aa##a######abcddcdddeggiihhhdaaaabcccceedccbbcbbccbccdeeeggfeddccdeccbbaaaaaaa#a##aaa###aaaba#a##aa######a#####a######aaaaaaabaaababcehb#adcbdbba#aaabdceaa#################abbbbbacgeeecca###bedcaa#adfhccdffbbbba###a####aaaaabbbbaaaba###aaaa##########aa#.##aaaaa#aa#b######a#######aaaa##aaaa###abcdb######a#aabcbaabaabbaaabcdedbbbcddcbbbbcabbbccbbb", "bcdfdddcccdddcecbb####a#aabccabaa#####aaaaa#####abbccdedeedcijfggfabaabbbbccddccbbbabaaaaaaaaabbbgihihffedccbbbbbbbba#a#aa####aaaaaaa##aa#######a###aaaa########abaabbbbaccega#cdaaabaaaaabbfea#a#################abbbbbaeedddcbaaabacceccefihdccedcbaa##########aaaaaaabbbaaaa#####aaa##a############aa####aaaa######a#####aa##a##aaa###aaa#a#abc#aa###aabcaaaabbbbbbbbbbcddcbccddcbbbbabcccdcc", "ccbcffhfdddddccadbaa#####aabbaaba##########a##aaabbaacdddfeehjifgha#aabcbacddccbbbbbabbaaa#aabcccefgdddeffeecdedbbbbcba###aa####a##aaaaa##a###aa###aba#aa######a#aaabbba#abbfcbcccccbaaa#abbfjg#aa###########aaabbaaabbcbdedcdbbaaabbbcceghhiiedcedbbaa######a###aaaa#abaaaaaaaa##aaa##a##############aa####aaaaa#####ab#####aa##a###aa#aa#a#####aaaa##aaaaabbbbabbbbbbbbbbbbdddccddccbcbbbcccdd", "eecbdggfdddedcacda####a###abbaaca######aa##aaa#aabcababcdeeedgigdfgbbcbbbbbcccbbbbbaaaaaaaaaccddddefdecccbbcbbddcbccddedcaaa#a#aa##########a########adbaa#########aabbbcbcabbdcdcbbbcbaa##abbfiaaa##############baaabbbbccedcccbaa#abbbbbefgihfdcccbaaaa###a######aaba#abaaaaaabaa#aaaaaa######...#a#.#####aa#aaaa########a##aaa###a###aa#aa#aaaa#aabbabaaaaabcbbbbbbbbbbbbbbbccdeddcccbdccccdde", "eedfhhfcba#abb##a#####a#aabcaaccbc#####a#aa#aa###ccbbbabcdfffhgifehfebbbabbcccbbbbbbbbaaaa#ccdcddfghfeccccbbbbabcddegcbccdcaaaaaa###a###a######a#a##accba#########aaaabbccbbcbcehb###cbba##bdehe###############aa##aabbbccdcbccba##aacccbcceffedcbbaaa#####a######aaba##aaaa#ababcbbbbcbaa########.#.##a####a####aa######aaa###aa####a###a##a#aaa####aaadbbaaacccbbbbbbccbcbcccbcceeeeededcdbccd", "dgghigdb##a#a########baaa#abbcbdbbb#####aa#aaaaaaabaababcdegiihdggffdcbaabbbbabbbbbabaaaaa#ccdccdegedccbbbbbbcbbbbaadbabaacdb###aa###############aaaab#aa##a#######aaaaababbbabbfieaaaa#aaa#chke.#########..#aaaaaaaaababbccbbcbaa#aabbcbabcdeedcba###a#####a#a##.###baabbaaaaaaaabbaaba#########....#.#######ab#a#######a######a#########a##aabba###aaabbbbbbacdcbbbbcbcccccbdddeededegeddddcdc", "dhghhfa##a######a######aabaacccedaaa#######aaaaaaaababbbccdghgfedgfgcabaaaaaaabababaabaaaaabdcceeeecdbbbababbbbccbbbbbabdbabcba#a############aa##aaaaab#aa###########aababcbbaabeggh######aaagj##############aa#####abbaabbbbbabbbabcabbaaaabcddccba#######.###########ccaaa###aa##aaaa###a###..##....#.aa##a############aaa#####a#####a###aaa#aaaa#aaacaabbbbbbeccccbbccddccdegghhgfeegd#bddccc", "ffhhhe###########a#####b#bcadddcbaaaa#####abcca#aaaaaaaaabdhihgddfgfgcaaaaaaabbbabbbaabaaaabedcefecbbbbbbabbbaaabbacdca#aaa#bbdb#aaa#########aa####aa#a###a#####.###aaaaadbbaabaddcggbaaaa#bbdia#a##########aaa###aaabaaaabbbbbbaacefebaa#aaaabcccbaaaa###########.#.##ad#####.##aaa#aa#aa#####...#...###ab#ba######a###a##ab#####a###aaa##aa#aaaaaaaabbbbbbbbbbceddeeccbccccddfhijjhggghb#bba##", "#afhgcaa###########a#a##aabcddca###aa######abbbabaaaaabaaaeiiihgbbgeddaaaaaaaaabbaabbbaaaaabdcccddddccabbbbacaaaaabbbaaabaa##acdd###a######..a#a#####a#aa##a########a##aaecb#abbbcccfgaaaaaaaeia#a#a##############aabbaaaababbababdgeca####aaaaabcbbba#####a####.#######da##############aaaa#######.##.#.#ba########.#a#aa##abba##aa#aa#aa###aaaaaaaaaabbbbbcbccccefgeeccbccbbbbdfiihgggeb#aaaa#", "##bhgd###############ab#ababcdd###aaaa####aaaaaaaaababaaaadhhigebabfddcaaaaaaaaaaaabaaaaaaabcbbbcbbcecbbbabbbaaaabbaaaaaba###abadea#########.#a##########aa#a###a###a####aabbabbaadccghbbbaaabfi#a##a###aa####a##a#aaabaaaaaaaabbacfdba##a#aaa#aaaabbb######a######.##a#######aa#a##a#a####aa#####a#.#a####aa#########aaaaa##aaa###aa#aaaaa#aaaaabaaaabcbbbbccccceeceeeefedddcbbceeffhgfebaa####", "##.dhdb#########ab###bdababaddc######a###.#a######aabacaaaadghfdbbabecdba###aaa#aaaaccabaaacababbbbbbbcbcbbcbaaaaababaaaba####abbcfbaa#aaa###.###ab#####aaaa##a######aa#ba#aabbbabdcabefbcaababhe#a##aa##aa###a#####aabba#aaaaabbbefcba###aaaa#aaaaaaaa#########a#.##############aa#bb#aaa##a####.###########aaaaa#######aaaa###a####a##aabaabaaaaaaaaaabbbcccddebbbbdedefdcccccbceeghgfdaaba#aa", "aa#aeea##########c####ba###aca#####aba#############abcabaa#acdefccbacdbdc##aaaaa###aabdbaaabbcccbbbbbbbccbabcabaabbabbaaaaa###addbcdba#a################a####aaaa#aaaaaaaa#aaacbabdcbbbehca#abbeh#aa######aa######aa#aacfbaaaaaabbdgdbaa###aaaa#aaaa########.###aa#a.###########aaa#bbaaaaaa####a#.##.#######aba#####a#############a#aaaaabbba#bbbbaaaaabbcddddddbaabcedccbaadfdcceeggdbaaaaaaa#", "aa##ada#a########aaaa###a###a######abaa#########aa#abbbaaaabbcddeeebcdbabb#aaaaaa####aaaabcccbccbaabbbabccbaaaaaaaabbaaaaaaa##aabcccfeb##############a####ab#aaa##aaabbaacababaaaabcdbccffc##abeh.##aa###a#########aaaaacbabaaaccddfgdbaaa##aaaaaaa#######.##.#######.#########aaabaab########a#a##.#########aaa#####aa##a#aa###bdaaba#aa#aabaaaabbbabbbbcddefecbcbaabbdcbaabcecccefgcaaaaaaaaa#", "aaa#aaaa#aaaaa#####aaaaaa###########a#####a##ab#a##aacabaaabcccbdhedfdbbabc#aaaaaaaba##aaaeheaaaaaaabbbacddbbaaabbbaaaaaaabc#aa#a###cfgb#a#########aa###aaaccaaaaaaaacbabcdaacbaaabcddcccgfcaabeg.#a#aa#a###aaaa####aaaaabaaaaaaceefhfdbaa###aaaaaa########.####.###.####.####aa#abcbaaa####aaa#############aaaaaaaa#aaaa#ba#babffb#acb#aaaabaaabbccabbcccfgdaa##bcbbaaacbcbacebbbcddbbaaa#a####", "accccedaa#aa#aaa##a#aabda#################a#a#a##aaaabbbabbcccdcccfcfecbaaceca#aacdbcccba#ahgabaaaaababbbccccbaabbbbbbbaaabcb###aca#aabcc##a##########a###a#abaaa#aaabbddddbbbcbaaaaabcdddhecccg######ba#a##.#a###aaceca#cbaaaaacdefhgfcaaa#aaaabba#########..#####...#.#######aaabccbaaa####aa########.####abb##aa#aaa#a#ba#abbefba##bbbaaaaaabbccc#ccddeffcaaaa#baaaaabebbbbcbbbbcbbbbbaa##a##", "#abeeebaaa###aa###aa###aaa###################aa###a#aabbbbcddddccefegfcca#adhbaacccaaabcbcdecaaa##aaacabdabdcbaabbabbaaababbcb#aabb#aa##dea##aa#######aaa##a##aabaaaacacdfebbbbbbabccccfeddfgfed...#a##aa###########acdbabbb#aa#acddegfecbaaaaaaabaa#########...#####.#########a#abbbabba##aa#####.##....#####a##aaaaaaaa#baaaceeebaaaaeedbbbabbbccb#cedddcccbaaaaaaabaa#bebbbbbbbbbbbbbaaaa####", "##aadba#aa##a#######abbda################a#######aaaa#ababccdeeddffhhgccbaabefdbbaaa#aabcbbabca#aaaababbbbcccbaaacaabaaabaaaabbaaaab#aaaaefaaaaaaa#.###a#a#a######bbbaabccabbdcbabbcbcdbbaaaefeiiffa####a#######a##aaaaabbcba#baabdddefffdcaaaaaaaaaa##########...##############aabbbbbdabaaa###.....########aaaaaaaaaaaaabcccbdfebaaaaaacfdccbcddc##baabcbabaaaaaaaaabaaaedbcbcccccbbccbaaaaaaa", "a##aba#a####.######a##bgb#######a########aa#######aaa##aabbcceedddeghiebaaabccebaaaaaaaabaabaaabbaaabbaaabbbbbaaabbaaaaaaaaabbccbbcba#####cfebbabbbacaaaaaa#aaaa###acbbbbbbbbcbaabbbccbaaab#.aceffdfghfa#a####aa#aa##acbacbbbaaaaabcedcddedbaaabaaaaaa#######..#.################aabccccdbbb####.#..#..#.#..########aa#aaa#aaabdddbcababbbdeddedeeb####aaaaaa#ba#aababcbbbaeccbcbcbcbbbbaaaa###a", "ba#a#####a#############cb#########aa##a###a####ab#aabaaaabbbbedcdccehihcbbbbbbccaaa#a#aaaaabbaaaabbbcbbaaabbbccaaabbaaaaaaaaaabbbbacda####aaedbaaabddba#aaab###aa####aaddcceebabbbcbcdca#aaba#aaabaabfmka##aabaaaaaa#abbabbbbaaa#acccdddccedbbbbaaaaaaaa##a####.#.###############aabddcbbcaaa####.#......aa###aa####aaaa#aa##aacccccbbbabbcdedddea####a##aa#a#bccbccbcbbaaaadddccbbbbbbaa#aa####", "ab##aaaa######a##########aa###b##aaaaa##a#a#####ababbbaababbbccccdcdgjifbbabbcccca#aaaaaaaaacaaaaabcccbaaa#bbbcaaaaaaaaaaaaaaaaccbaabbaa#a#a#bcbbaa##a###aaba######aaaaaaddfhgccddddacacaaaaa#aaaaaaabhnk.aabbb##aa####aa#acaabb#aabccddeecccbbbabaa##aa###aa#######.######a###aaaabdddcdedda#########...#####aaaaaaaaa##a###aabcbbccbbbbcddeeefc##a####aaaaaacdccbbaababaaabccdccccbbbbaa#a####", "#####a#aaaaa###aaa######ba###aa#bba#aa#abca##bb#abaabbbbbbaabbbbdccceihgecbcdccbcd#ababa##aaabaaaaaabccbaabbddbbaa#aaaaaaaaaaaaaccbaaa#a######aabdcb##aaa##a#a#####aaaa##aabffebccddcb#aa#######aaaaaadlnd#aabbabaaaaa##aaaa####aaaabccdeedbb#aa##a###############.##..#.#####aaaaabccdeecdaa#####.########.###aaa#aa###aaaa#aaabcbccccbbccddeef##aaaaa####aaaccbaabaaaaaaaaba#bcddcbbbbbb#aaa#a", "abaa###aaaaa##a#a##a#############a#a#ababda#aaaaaaaabbaabbbbcbbbddbddgifhedbcccbbcc##aabbaa#aaaaaaabaabbbccccdebaa##aa#aaaaaaaaaabedaaaa##########becaaaaa#a#########aaa##abceffdccb##aa########a#abbabilk#a#a######ab#aa#aa#####aaabbcddedbaa#a######a#####################a#aaaaaabdddfgfc##########...a#a###aaa#a#aa##a###aaaabbbbbcbbbcceghfaaaaaaaabbabccbbbaaaaaaaa#abba#aacedcccbaaaaa#aa", "bbaa##aa#aaaa#aaaaaaaaa#aaa##########abaaaa#baaaaabbbbbabbbbccccddbddggghhfdbbcaabbbbbaabbaaaa#aaabbaaabbb#bbbaaa#####a#aaaaaaaaaabb##aa##########aabdcbabaaaa####aa###aa#abbcdhhcaba#baaa#######aaaaabhlmc#a#####aaaaa#a##abba#aabaaabcdgfbb################################aabbaabbccdhigca#########.########aaa########aa#a##aaabbbbccbccdgfha#caaa.##fedbbcbaaaaaaaaa#aaa###aaadecccbbaaaaaa", "#aa###aaa#a#aaabbbbbcbaa##a#######aaabaababaa#aaaaabbbbbaaababccdecdfhhiihgfdbccbbcbabaaaaaadca##abbaaaaaaa#bb##aaa####aa#aaa#aaaabbda.##########aaaabddcbbaa#a##aa#aaa##aaabbdecca#a#aa#a########aaaaaeili##a######abaa###aaaaaacfeaabddcdbaa##############################aaabbbbbbcdfgjieba####.#####aa#aa############aaaaa###aaabcbbcbbcefggcbbfeedbedbcbabbaaaaaaaaaaaaaaa#aaa#cdcddcbbaaaa", "aa#a###aa#a##a#aaaabbccaa#aaa########bacbaaaaaaaaaaaabcbbbbbbcedcdccfhfhkhggfdbbccbbabaabaabdda###aaa#aaaaaaacb#########aaaaaa#aaaabec##########aaaaaaabddcbaaaaaaaaaaaa##aabacbaaaba#####a##a######aaabgklbaaa#####aaaaaaaaaaabbbfdaacddeddcbaaa#########aaab##########a##aaaabbcbbbbeffhjifdcb#####.##acbb#aaaa###########aaaa#aaacbcbbcbcegfaccgghgffdcbbaabbbaaa#aaaaaaaaaba#aaaabeecccbaaaa", "aaaa########aaaabbabbbbcbbbaaaa#####.##aaaaaaaaaaaaabbbbaaaaadedcdccegijkifddebccbbccaabaaa##aa######aaaaaaba#aa#########aaaaaaaaa#bccda#######aaaaabbaaabddcba#aaaaaaaaaaaaabcdaaaaa##abaaa#a#a#a##aaaafhlg.aa#a#a###ba##b#acaabcdfaaaccdccedba##########adcbca#########a#aaabbcddccbdefggiigecb########aaaa#abba###########aaaaaa#bdbccbccef#abdeddeeddccba#bbbbbaaaaaaaaaaabcaaaaaa#eedccbbba", "aa#aaaaa###aaaaaaaaabbbbbbbbaaaa#######aabaaaaaaaaaabbaaaaabbbfeccccdfiljigcdeccccbccbccbbaaaa#######a#aa##aaa#####..#..#aaabaaaaaaabacb######aaaaaaabbaaaacddcbaaa##cbabaaaaabcbaaaaa###a##a####a##aababchl#.###a#####aaaaaa#aabbdeaaacbbbbdfdccbabb####a#ddbbbba##########abbbccdcccddefghhfcaaa######aab#abaaddaa########ab###aaaacccccdefd#dbgebcccdcaabbbaaaaaaababbbaaabacaaaaaba#eeddcbba", "aa#aaaaba#a#a##aaababbccbabbbbba########aa#a#aaaaaaaababbaaaaadcccaddfhkjigdcdecccbbcdcecbaaaa######aca####aa#####a#####.#aaaaa#aabababb######aaaaaabbabaaaaabcdcbaaaaaaaaaabbbcaaaa#a####aa####a#aaaaaababjh.####a#####aaa##aaaabdabaaaabbabdeeeddddcb#.##debaaabaaaba####aaabbccdcccddeffgfgcaa##aa###aaaaaccaddca########a#a###aaaccbbceffbaacgeaabbbbabaaaaaaaaaaabaaaabbcaaabaaaabbbccdedcb", "ba#a#aaaaa####aaaaaaaaaaccbcbbaa#######aaaa###aa##aaaaaaaabbbabbcbbefffhjihfcbfcbcbbbcfhgcaaa#####a#deaa##aaaa###############a##a###aaaaa###aaaabbaaaababbbbbbbbedcbaa#abbbbbcccaa##a######aa##aaa##abaa#aabja##.#######a#a###aaabecaaaaaaacccbcaaaabbdddefedcbaa###aaaa#aaaabbbcccccccddfggghdba####aababababcbbddba###a###a#aaa##aabbcccegfbaabcaaaaaaabbaaaaabbaabaacaabbbabbadbaaaaabba#aefc", "ba#a#aa#######aaaaaaabaabbebdbbb######aa####a###a####aaaabbaabcabcccddffjhfdbaefcdbbbbdjkjebaa#####bccb##baba#####aa######a###a#a####aaaaa##a##aabaaaaaaabbbbbbabefdbbcbbbcbbbcbaa####aa#######aaaaadaaaaabbdg###a#a####a#aa#aabccccaaaaaabcdbccaaaaabbdeeedcdcba###aa#aabaaabbbcbcccddddeffffdbaa####abccbb#bbccdbccaa###a#aaaa#a#aabbdcdfgdaaaccaaaaaa#aaaaababbaaabbbbbabbbbbcbcbaaaabaa###be", "fcb#############aa#aaaaaaadegdacbaa###aa####aaa#a####aaaabbaaabaabddccehieabaabecccbbbbbikkgca####acbb###baba#####aa####aaaaaaaa######aa###aaaaaaabaaaaaaaacbbbbbbeffedccbcddddbaaa##aaaa###a##aaa#adba#aaabbie.#.#aa##aaaaaaacecaaaba###a##aabdb#a#aaccccccccbbba###aaa###aaabbbbcccdddedegcddcbbaaaabbabbabbaabbaaddbaa#####aa##aaabbddefgcabagbaaaaaaaaaaaabbaaacabaaaaabbbbabbaaaaaaaaaaaa#a", "bdeba#########aaaaa###aaaaacfebbbbaa###aa#####aa########aaababaacbdeccehhbaaaaaddcbbbbbcgijhea####acb########a##aa#a##a#aaaaabaaaa####aaab###aaaaaaaaaababbccbbbbacbedffedcdeeaaaab#aaa#aa##a##aa#a###aa#aabackc.#.##aaaaaabdefb#a#aaaaa#a####abc####abcbbeecbbaaabb#aaaaaaaabbbbcbcdededdefdcaccbca##aaaa###aaaaabaaeccaaa###aaa#aaabcccdffbbacfc#a#a#aaaaaaabbaaaaeabcbbabbbbcbbabb#aaaaaaa#aa", "##aba######aaaaaaaa##a#aaa#fdaabbccb###################a#aaaabbabccccdehibabbbbcfdcbbbabgihc#a####abbaa##a###aa##a#aaaa##aaa##aaaaba###daaa###abcaaabaaabbbbbccbcbcdcdddggfedbcbaaaaa##a#####aaaa#aa#####abbbbdjb.a##aaaaabeecabba##aabda######aa####aaabbdcdcbaa#bcbbaaaaaaaabbbcccddedefffdcbccbab####a#####a#aaabaabeeba######aaacbcddegebbacccba##a#aaaaaaaaaaaaccbbbbbabaaa#aaabbaaaaaaaaaa", "aa##baa####aaabaaaaa#####aacaababbccbaa##################aaaaaaaabbccbegifaaaabbcecbbbbaadgb#####aeeabc#.######aa##aaaaa#aaaaa###abaa##edaaaa##aabbaaaabbbbbbbccbbdccccdddehhdabbaaaaaa##a###aaaabb######cebcbcgj#aa##abdfggcbbbaaaabdfea####aaaaa##aa###aaa#aaaa#aaabbaaaaaaaabbccddeeddeffeeeefcabaa#aa#####aa#aabbbacccbaaaaaaaabcccdegfbbbceaacb#####aaaaaaaaaaaacccabaaaaa#a#abbccaabbaaaa#", "#aaa#daaaaaaaabbbaaaa####abbaabaabcbbbbb##aa################aaaaabbbddehecacbaaaabecbbbbabaa#####adcca#########a#a##daaaaacaaaaaa###aa#aca#aa##aaaabbbaabccbbbbcddaccdeddecfhgcabaaa#ab#a####a####aaa#aaaabbbcbcijdchihgighedbcbbcdfdabbbbccaaaaaa###caa#aaaa#a#a##aaaaaaaaaaaaabcccdddddeeedeeeffbaaaaaa##aa###aaabbbabcdeabaaaabbbbcdegibabbfaabca####a#acca#aaaaaaababbbaaaa##aaababbaaabaaaa", "#####adcbbbaabbbaaaa#a#a#####aaaabbaaabcbaa#################aa#aaaaabddgeadbcaaaaabccbbbbba#####a#a##aaaaa###aa#aa#bccaabaac#aaa#####a#..#####aaaaaabcbaaabbbbcdccdcddedceefgfccbaaaaaa#aa###aa##accaaaaaaaabbbbdjkfdfgjjhgfeeeeeedcaabaabaaaaa#####ab#a#aaaa###a####aaaaaaaaaaabbccddccccdccdeeegfbcbcaaa#aaba#aaabdcbbbababbbaabbcccdghg#aadbaabbaa###a##acdaaa#a#aa#baaaaaaaaa#a#aaaccbaabaaa", "a##a#aaedbbcbabaaaa##a##aa####aaaababbaabacaaa###a#######a####aaaaaaaccehbbbbcbaaaaacdbbbcb#a#a#a#.####aaa##a#aaaaaaabaaaaab##aaaaaaaa#####aaa##aa##abbaaabbbccbccbcdcdcddeffcaabaaaabba#aa####a##bcbaaaabababbbbejib#abccdcbbccba##a##aaaa##a######a##aaaaa#a###a#####aaaaaaaaabbccccccccccccdeegfcdabbaaaaaaa#aaaabccbbbaccbabbbcddefedea#cd##a#aaab#aaa##bcb###aaa##abaaaa#####aaaaabbcbaabbb", "aa##aa#bhgccbbccbbaaaaa########aaaaabcbaaaabbaaaa###aa#####a#a#aaaabbbbcega##acbabababecccdabaa##########aaaaaaaaaaaaaabaaa####aaaaaaaa##.##abaaa#aaaaabbbbbbbbcdbbccddcdcegeaaaab#aaaaaaaaa####aabbabbcbbbcaaabbcegiaaaaaa##abbcbca##.###aaaaa####aaa##abbaa#aaaaa####aaaabbaaabbbbccccbcccdddedfddcaaaaaaaaaaaaabbccdbbbcecbbccdefged#a###fa######aaaaaaaabaa#######aab#aaaa#aa#aaaaaabcccabaa", "aa##aadafhhfeccbbbaa#aaa##a####a#aaaaaaaaaaaaaaaaabaaaabaa#aa###aaaaaabbcfd#a#acbaaaaabeecdcc#############abbaaaaaaaababbba###aaaaaaa#a#####aa#aaaaaa#aaaabbbabcccehgeecdegebaaaaaaaaa#aaa#aa###aaaaababccbbaa#aabceggaaaaaa#aaaabcb####a###aaba######a#a#####aaaaba#####aabbaaaabcbbbbcbbacceeddeebabdbabbaaaaaababcdccdccdcbbccefecb#####cc#########aaaaaaaaaa##ba#aaaaabbbbaaa#aaaaaabcccdgdb", "##aaacdggggghgdbbbbbaaaaa#aa###a###aa##aaaaaaaaaaaaabcbbaaaaaa#aaaaaaabbbdfd#aaacdaaaaaadgefc#######a#a###abb##a#aaabaaaaaa#######aaa#a########aaaaa##aabbbbbbbbccefhfeeegfbbba#aaaaaaaaaaaa####aa##abbcdacbaa##aabcehfaaaa###aaababa##.##a#aaaca#a#aaaaaa#aaaa#aabcc#####aaaabbbbbadcabbbbbbceedefcaabcecaaabaaababccdcdddccbbcceda#####baeaa#aaa#####ab##aaaaa##aaa##abbbbbbbbaaaaaaaaabbbagig", "f#aaaehhfffeffhfbccbbaaaaaaa####a#aaaaa###aaa#a#abaabccabcbabbbbabbaabbbbcehdaaaaaaaaaab#dgeaa##a###########aa####aaaaaaa######a####aaaa###a###aaaaa###aabbbbbacccdedddfgebcbaaaaabbbaabaaba#########abcbdabaaa#aabcdeibaaa######aaaca######aabbb####aaaaaaaaaaa##bbdb####aabbbbaaaacdcaabbbbcceddeccccaba#aaabaaaabccddddddceddeec#aca#aabebaaa#######aaaba#######aaaaabbbabbbbbaaaaaaaaaba#dii", "hd#aaejiedefeeddedccbaaaaaa########aaa#######a#a#aaaabbaacbbababccbbabbbbbceidbaaaaaaaacbcgeca#############aaaaaaaaaaaba######.a############a##aaaaaaaaaaaacbbbccccedbcfcbbbbaaabbbbaaaaaaababaaa#baaaabababbabaaaaabdfhaaaaa#aa##b#bbaa#####abb##a##aaaabbba#aaaaaacda#####abbbbaa####a#abaabccbdecdbbaaaaaaaaaaaabccceeedcdfgffeba#aa#aa#bcaaa##########aa##a####aaaaa#aaabbbbaaaaabbbcbbbeefh", "ggecdhjkiefeeddcdefdababaaa########aa##a########abaabaabcdabbcdccbcbabbbbccchiecaa#abbbaaaadeca#####a#######aabaaaaaabba###a##.#############a##aaaaaaaaaaabbbccdddbbeccdbbcbbbabbbbbbcbbaaaabccaaaabaabcabbabaaaabaabcefeabaaaaa####aaccb####aaa###a###aabbab#a#aaa##aaa#####acbba#a######aaaabbbbfefdaaaacaaaaaaaabbbcefffeefbed########a##dbaaa#######a#############a########aaaaaaaaaccfgfhdf", "efddegijmkfeeeddccdgdbcccbaaa####a#aaa#####a####a###aabbcbabacccdccbbbbbcbbdfijhbaaaaabb###cedbaa###aaa#####aabbccbaaaaa###accb###a##########aaaaaaaaaaaabcbbccddddcddaaaabbbabbbbbbcbaabbbbbaaaabbaaaaabbbbaaa#ccaabbddheabaaaaa####abca#####ba##a####abcaaaaaaaaaa#aaaa#####bbaaa##aaaa##aaabbaaadfdbaabcbaaaaaaabbacehhhhcaaaa#####a#ab##ccaa########aa#############ba#a#aaaa#aaabdaaeffghgff", "eddcbcdefijgeedcccbbdeccccbaaaaaaaaaa#a#########aaa##a#abcaacccccccbcbbccccdefikibaaaaaaaabbdddca#a#a#aa####aaabbbaaaa##a##aaaba##aa##a######aaaaaaaaaaabbbbbccccddddaabbaabcdbbbccbacbabcbbccbaa#aaaa###baaaaa#a#aaabcdfjb#aaaaaa####abaa.####a##aa####bcbbaaaaaaaa#####aa##abaaa#a##aaaaaaaaaaaaabecbaababaaaaabbbcbcehhcaaa##aaa#######b#.cbabaa#####aa##a#####a#########aa#a#aaabdefffggfefe", "ddcaaabdefhihecdbbbbacdecccbbaaaaaaaa############aa##aa#ababbcbcbbbababccdceeegijgaaaaaba###bfcdc##aaaaa######aaaaaaaaa#aaaaaacba#aaa#a#ba#aa#aaaaaaaababcbbbbbcedabbaabbaaabbbabbdccbbbaabbbbbaaa#aaaaa##aaaaaa#####abcehka##aaa#####aaaa###..a#aba#####abcaaaaaaa#a##a##a###ba########aaaa####aa#deaaa#aaaaaaabbbbbccefcbaba##abaaaa.#a#ba##dc#a#a####abaabb#a##aa##a###a###aaaaabaceecddhhedd", "cccbabbcdfffhheccbbbbbcdfccbbbbaaaaaa###############a##aaaabacbbbbaaaacccddcdefhjjhbaaaabaa##dfbbc###aa#aa######aabaabaabbbbbabdb#aa#a###bba#a##aaaabbabbbbbcbbcedbaaaaaaaaabbbbbcbccbcebbbbaaaaaaaaaa#####aaa####aa#aabdegj.############a##a##a#aba####a##baaaaaa#a###aa#aa########a##a#aaaa####a#eeaa###aaaaaaaaabbcdgfdbaa####aabbcb#aabc###cda#aa##aababcbb#a#aa###a##aab#aaaaababdecbcdheed", "cbbaccbcddeffeedcbbbbbbccffdbbcbabbaaa#aa########a###ca#abaabbbabaaaaabcccddcdgiikjgbaaaaba##afcacba###aa########abbbbaabbbbbbbcbbbb#aa#a###aa##aaaaababbbbcbccdca#a##aaaaabaaabcccbbcbcbaabba##aaaaaba#####aa####aabbbddcdjd.#########.#..#######aba######aaaaaba########aa#######aaa#aba#aaa###aacaaaa##aabaaaaaaabbcefcbbaaaaa##aaacabaaaa###bca#####aaaaacaa#a###a##a#aaa#a#aabbbbcddcccegdd", "cbbabbbbccddeedddcbbbbbbbbdfheccccbaaaa###########aa#bd##baaaabaaaaaababcddcccggijjjbaaabbaa##bcbabba##aa#######aaaaaaabbbbbbbbbcccaaaa##a##aaa##aaaabbbdbcbbcdfbaaa#aaabbbbbbbbbcccbccdedaaa#aaaabbaaaa#a#aa####a#abcccdccfi###########....#######aa##aaaaaaaaaaa##########a###a##aa#aa#aaa#####aaa#aaaa##abbbaaaaabcdefbbaaaaabaa####aa####a#a#dba#####bb##b###########aaaaa#aaabbaabbbccddede", "baabbbbbccccdeedcccbbccbcbbcdiheccbbbaaaaa#aab##aa###aa###aaaacbaaaaaababccccdfhjjjl#abbbaaba#abeaabb######a#####bbaa#aaaabbbcbbabbaa###aa####a###aaaabacdcccdceaaaaaaaaaababbbbbbbcbbbcbdba###aabbbaaa#aa##########aabbabccgb.###.#########.########a#aaaa#abaa#########a##aa#####bcaabaaba###aaaaaaaa#####aaaaaabbbdhidabaaaaaaaa###########a###ebbb###aaa####a###aa#aabcaabbaaababaaabbbbbdcb", "abcbbbbbbbccbbcddbcbbbbbbbbbcfeghfccbbabaaaaabaaaa####a#b##aaaabbaa#aaaaabccbceefhegdedaaaaaaa#abdaaba#aa##a#####aaaabaaaaaaabbbaacc###aa#aa####a#aaaaaaabcccddfbba#aaaaaabbbbabbccccccbcbdaa#####ac#####a##########aa#aabcbdh..#########.#####.####aaa#aaa###abb###########accaa###a##aaabbbba#a##a#abba####aaaaaccegcbbaaaaaaa#aa###.##a########aeaaaa###a#a######aaa##aaaaaaaabbaabbaacaacced", "cadbbbbbbcbccbbacbbbbbbbbabccdeehgffccbcbaaabaaaaaa###a####aaa#aaaaaaaaaaabccbdeeffeehgcaabaaa##adb#aca##aaa#####aaabaaaaaaaaaabaacdb##aaaaaaa#abbaaabbbabbdecffbaaaaaaaaaaaaaabbaccbcbcccdcaa#############aabb######aaaaabbbehd..###d#.#.######.####adbaaaa##abba########aaaaaaaaaaaaa#aaaaaaa#a#aa#abaaa####aaacdeheaaaaaaaaa##aa#aa#####a####a#.cdaa######a##a###########aa##aabb#aabaaabbadf", "cabdabbbabcccdccbccbbbbbbaabdcdefdcfgccbbbbaabcbaaa###aa##aca####aaa##aabbbccccddffhihhfbaba#c###bdaaagaaa#a######aabaabaaaaaaaa#a#aa####aaaa#aabbaaaabbbbbcddfeca###aaaaabbaabbabbcbccbbbccdada###aa######aaba####a###abaabcafjlf..defe##...#########bbaaa###aab#a#######aaabcb#aaaaaca##aaaa####a##aab###a##aabdfiida###aaaaa##ca#aa#####a####a###ecaaa########a##a#####a####a###aaaaaaaaaabab", "ccbbbbabbaaabccdcbbbbbbaaaabcdbbbeeadgeccbbbbabbbaaa##aa#abedbaa####a####bbbcbccddehhhfdaa###da#a#ddaabhaa###########a#abaabbaa######a####aaaaaaaaaabbbbbbcbdeefcb###aaaaaaaaaabbbbccccbbaabbcaaa############aacbaabaaaaaaabccbdejkbd..bgccdcba########aa######aaa#a#######aaaccaba#bcaaba#a##aaa#####abba#aa#aabdgkjkihgdb#.cedcbb#.###dc########b##ebaaaa#########################aaa#aaaaaaba", "abeecbbaababbbabbdbabbbbbaaabcccbdcb#ehedccbbaabbbaaa#abaaaedba###########acbbbcceeeggdaaa#bacaa#aadabbdf#######.#######aaaaaa######bca###aaaaaaaaaabbbbbbbccfffbaaaa#aaaaa#aaaabbccabbcccbbbbaaaaa#######a#aa#acaaaaaaaaaaaabccceglh.#....#baacca..####ab########aaa####a##ababbbba#ceaaaaaa###a######aa##acbbbbchgcddfgjihddigefegfffba#affeecbbaaabda#aa######a#a################aaaa#aaaaaab", "babfdcbcbabaabababbbaaaaaaaabcccdbaaaacifddcbbbbbbbabaabaacecabaaaaa######aaabbcdeeedifba#adcbaaba#bcabbfe#aa####aaa###a#abaaaa######aaaac#aaaaaaaabbbdbbbbcceebbba##aaaaaaa#aaabbbbbbcccdcabaaaaab##a#aaaaaaa######abaaaaa#abbbbddei#####a####.#ee######aa######aaaba######abaaaa#a##bc##aa#a####a###a#aaaabcbbbceecbbcbdeffgfdccccdefeefgffedcefeb##cdbcba########a###########a###aaaabaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 384 NAXIS2 = 384 HISTORY Written by XV 3.10a END 3"3wUD3D3"3""3"3"333""""""""3DDDU3""""DwUUD3333333"3""3""DfD"3""""""""33DUfffUw3""UD3""3"3D"33wf"""""""3""""""""D""""""""333U3333DDff333"""""""""""333333DDDUD"3"""""3"""""""""3""""""3333UUf"�ff"""""3""3"""""3D"""""""""3D333DffD33D3UfwwwUDDDDUfwffwwwfUDfwf3DU3D3"""""""3""""""""3ffD33""3"333"33U3"33333"""3DDD3UD3ffUDD33""333""""3"""fU3""D333DDfffU"""3"D""""U"33Uw�""""""3D"""""""""""3333333DDwww3"""""""""""""33DD"33DDD3333"""""""""D""""""""""""3DDDfݙ�����3""DD"��"3"""""3"3333"Df""""""""""D3333DDUUwUUfwfwww3""wwffD33"""3U"""""""""""""""3DD3333"33"""3DDUD333333""""3DU333ff"UfDD3333"333""""""3fU3"""333D3DDUUfwU""U""UU""3""""3""33"""""""""""""333333D3UffwD3""""""""""3333DDDD33""33D"""""D3""3"""""""3DD3Uf3U��3DDUD3""""""""""DD"3"3D""3""""""33"""""3U̻̪U3�DfUD33�UD3f3"""""""""""""3"D"3U"333"3DDDUDD3DD333333""3UDUfwUDwDD3333""3D3""""""D""""""333DDDDUUwww3"3"D3U"""""""""3""3"""""""""""""""""33""""33333DUUwfD""""""33""33"33D3DD333DDU"U"""""3"""3""3D"ww��Ufwf���33"""""3""""3D3"""""D""""""""3"""3UwU""""""D"""""fD"""""""""""""""""3"3D"U333333D3DD33"D33333333"3DDUffwwDD3D3"""3"""""""""""""""""""""3DD3UffwwffD""3""""U3"D"""""""3""""""""""3""DU3""""""""33"""333"33UfDww3""""""""""""""33"DD3D3DDDUD""""33"""""333fU��U���"U3"""""33"""""""""""""""""""""""""3""""""DUff"""""""""""""""�DU""""""""33""3"""33"Uw"3D3333333DD33DUU3D333333333DwfwDD33"3"""""3"""""3""""33"""""""3DD3DffwfUfU""""""""3U""3""""""""3"""""""333""DD""""""""""""3DDDUUw33"""""""3333"33DDDDDD3D3U"""D"""""3D3U����"""""""33"DD""""""3333""""33""""""DDfD33"""""""""�""f"""""""""""""""""33""33""D""DDfU3""33333DDDDUffUDDD33DD3D33DUfDD333"""""""3""""""""D3""""""3"3DDDDUw"333""3""3f""33"33""""""333D33"33"""""""""3"DUDDDUDf""""""""""3"3333333D333D3U3"""333"""""""33"3DD3���""""""3"""""3D""3""3"""""""""""""""333UU"3"""""""""f333""""""""3D""33"""3"3"""33333UD3D33"3333DDUUffUUUD33333333UwfDDDD3""""""3U3""""3""""""3"3DUUDDD3"""33""3D3"33""""""""""333333333DDD""""""""""""333U3D33DUw3""""""333333333DDD3DDUfU"""""""33"""""""""3DDDUDDw����""""""""""""""""""""""""""""""333"""""3DUfw33"""""3""""""U3"333""""""""33""333DDUUfUfD33"DD3DUUfwwffUD333333DDwwU33D3"33""""""D""3""333"3"""""3DDDUUDU̻3""""3""wD"D3""""3333""3333333D3333""""""""""3"3333D3DDUD"""""""3"""3DDD33D3D3""33""""""3"""""333UUDUU����"3""""""3"""""""3""""""D""""""3"""""""33DfwD33""""""""D"3""""3D""""""D"""""""""""3333DUUDDDfUUDDD3"33DUwwwfDD33333DUwDD3333"""""""""""3"D3333""""DDDUUDUfw3""""3""Uw33D""""""3""3""33333"3U3"""33""""""33"33333D33DfU3"""""""""33333D3DD3Df3333"""""""""""""""""3Uf�""""3""3""""""""""""""""""ff"""""""""""33DUwU3""""33D3""3DDU"""""3"3D33""""""3"""""3"3UfD3DUffUUUD"""3UfwfDU3333"DUfDDD33"""""""""""""3"33D3D333"3"3DDUDfff"""""3"3wDUD""""""""""""""""""""D3"""""3"""""""""""3"3D33333DfU"33""33"""333"33UDD333""33333"""""""""""""""3Df""""""""��""3""3D""""""""""3"""""""Uf""""""""""33333DDfwD3"3""3""""�"3"UD"""3""33""""""""""3"DffDUUfUUfUUD3DUfwffUDDD33UfDDDD3""""""""""""""""3D""DDDDDDD3D33DDDDUfw̪3""""""""33UUUD""""""""333""""""""3"""""""""""""""33333DDDDUUUU""33""3DU333DD3"D3"3D33DD3""""""3"""""""""3DUw3"""""""3""�"""3D33"""""""""""3"""""""""""""""""3fD3""3"3"""""333D3DfD""""""3�D3"3""""""""""""3UfwwwwfwffwUUfwfffUUDDUU3DDD3"""""""""""33D3"3"DDDUDD33333D33Uw3"""""33DfU3"""""""33DD3""""""DD3"""""""""""""3D33DDUUUUDUU""""333"333333D3""33333""""33"""""3333"""DD""33UUf"3""""""3D"3"""3D""""""""""""""33""""""""""33"""UwU3""3D3"""""""33"DfD""""""3DD""""3"""""""""3U""fwwwwfDU̪fwffUUDUfwU"3"3"""""""3""3""3DU"33DUDD3D3"3333DDDfD"""333""""UfD""""3""""""33""�""""""""""""333DDUUU33fDDU33D333"333333D33""""3DD""""3""3D"33"3""""3""3Dfwf"3"""""""DD3""""""33"3""""""""D33""""""3333wfwU""""D""""""""333Dfwwwffw3fU"U3""""""""""""""DDwwUwU""ffUfwffUUfUDD3"""""""""""""""33""D33"3"3DD33"33333DfU3""""""""D3DfD""""""""""""3"�""""""""""""""D333DDDDfU3DwD3333"""3333"""""""3"3"""3""""3"3"33"3"""""3Uw"""""""333"""33"""""333"""""""DU""3333""""3""3DD3UfDU33""""""""""""3DDDfffUDUwwwf3"""""3D""""""""""""""3333"""""333D333ffww"""fwwwfwww3DD33""""""""""""""""""3""3DD"3D3"3333"33""3333DfU""""""""""3Uf"""""""""""""""""""""""""33333"DDDUfUUUwf3D3"""""333""3""3""3D3U"3"""""3DUf3""""""D"""333"""""""""""33U3""3333""""DUD""3333DDfUUfDDDD"3""""3""""3DDUUUUUUDfUUffD"D"""3f3""""""3""""""333"33333"""""""""3"U"""DUU33333"""""""""""""""""""""""3D33"""""""""""""333UwU"""DU""""""UfwD"""33""""3"""""""""""""""""33333333DDfwwfffw333""""""""""""""""33DU"D3""""3Dfw"""""""3"3"�""""D""""""""""""""3DD""""33333"UD"333333DffUfwD""3DfD"""3"""3"3DDUDUUUDD33DDfU"3"f""""""3"""""""""33333333"""""""""333"""""U"wwfDD333""""""""""""""""""""""""3""""3""""""""""33DwU""D3"""""3ffDUDD"33""""""""3"333"""""""""""""""""""""333"3DDDfffDUff3"""""""""""""""""""3"3DD33""""3Df""""""""""3D3"""3"""""""3"""33""""3D3333D33"DDffUUff3"3U3"33""""""3"3DUDDUDDUD33DDfwfD3DD""""""""""3""""""3333"""""""""3DDDUU3""""3DD33DD33""""""""""3D3""""33""""""""""""3333Df""D3"3"3"3fDDDU"3""""""""""""""""3"""""""""""�"3""""""""33333333DU33DDUUDUDff""""3"""""""""""33"33D333D"""33Df"""""""33D3D"�"""""""""33"""""""""""33"""3333DDDD3DDDUUUfUwUUD"""""""""""""33DDU333DfD33DDUfwfU"w"""""""""3""""3""""""""""""3DDD"3""""""fU33D3"3"""""""""""3"33""3"D""""""""""""DDf3333D3"""""DU333D3"""�"""""""""""3"""""3""""""""""""""33"""333DD3DD3DUDUDUUfwwD""3""""33""""3D3""""3"3"3333f3"3DDUD33DD3""""""""""""""""""""""""33DDDDDDDDDDDDUffwDU"33"""""""""""3DD333"DD3"333DUUfwfUf"DU""""3"""3D3""""3"""""""""33D3""333"UD333""333""""""""""33"""3D3"""""""""3UUf"U3D"""""3DD33333""""""""""""3DD""3""D""""��""""""3D3"""3333DUDDUDUUfUDffwwDD3"""""""""""DD""""""""3333UwUwwffffffUD""3""3""""""3"""""""""""""""""33DDUUDDDDUDDUfffw3D3D"""""3""""3UD333"3"333""33DDDU""U3""33""""DU""""""3"""""""""""""DD3""3""""""U""""""""333"""""33""3""3D33333"""""""333UUffD"D3""""3fD3333"3"""UDD"""U"""""D"""""""""D"""""""333""3DD3333DUU"DDUfUUfDwD"3""""3"""""""""333D3DUDfU3D33DUwU"3333DD""""""D"""""""""""""""""""""3DDDUUUUUfffUfffww3"""""""""""333"3DUf"3""""3333DUf3"33w""3D"""DD""""""""3"333"""""""3"33"""3""""""3"""""3"""""""D""3"33DD3""""""""""33DD3fw""""33DfD3333""U3"ff"3D�"""""""""""""3""fU""""""33""""3333333DD33UDDDDUUUfU"33"""""""""""33Df3D3D"""3UwD333""""3Uwf""""""""""""""""""33""""""""33DDUUffUUfwwffffwD"3""""""""333"DDD3""""""""3DDDUfw333Df""D3""""""""""""DDD"3"""""""33DD""33"""""3"""""""""""""wU""33DD3"""""33"3DDDDUf3"3333DwUD333"3D""33"""""""""""""""""3"U""""3D"""3"""33333DD3D3DUDUUUwfU3D3"""""""""""""3333U3�""""""3ffD"33"""3U""""""33UDUD3""3D33""""""""333DDDUUfUfwwwUD3DD3"3"""""3""3ff3""""D3DUUff33"DDD3""""""""""""""DD33333"3""""""33""""""""""3Uf3"""""""""""Dwf3333"""""""""3"3""D3UfDDf3"""""UUD33333Df""D3""""""""""3"""""""3""""""""""3"33DD3333"D3fUwwfUDUff""""3"""""""""""""3"DD��""""""3Ufw3""""""""3D"3D33ffD33"""33""""""""3333D3DUfUfUUfwUD"DD3D""""""""""3""fDD"""""""""3DDDUww33"DwD"""""""""33""""f"3D33"3333D33"33"""""""""wD3"""""""""UfU"D3""""""""""""33"""3""3UUDDff"3""3fDDD33333̈D""D333"3""""""""""""""""""""3""""""""D333333fwwfUDD3DUUUU3""""""""""""U3""""33f��"""""""""DfD"""3""""3U3"""DDDDDDDD333"""""""3333DDDUUUfUfDUUD33""""33"33"33""33""UU3"""""""33UUfwD"3"3""""""""""""33"""D"3"""""3333"33"""""""""""""3"""""""""""3""33f3U333""""""""33""3D"3DDDUUwwwU3"fwDU3333U̻f3""3DD33"3""""""""""""""3"""""""333333"3fwU33D333D333D3"""""""""U"""""33U"""""""3DDDD""""""3DU3DD"""""33UfffUDUD3"""""3"""333D3DDDUUUUfwwwwU3"""3DD3333DDU3DD""""""""""33UDUwU"""DD"""""""""""3"33"""33333"33333D3D3""""3""3f3"""""""""""""""""DD3D33""""""""""""""""333"33D33fwwwwD3wD3D333DwD""""Uf"""""""""""""""""33""""3"33333333fUD3"""33333DDD"""""""""3""""3"�"""""3fD"""""""DDD3D""""33UUUfwfUD3""""""""""333DDDDDDDUUwU3"""3"3"3"3D33UU3""""""""33DDDfw3""3D"""""""33"""""33""3""D""333"33"U3"""""33""fwD""""""3""""""3"33DD3"33333""""""""""""3"33"""""UDDD"UUw̻UDUfDDD33DUDfD3"""""D""""�"""""""3"3"33""""""33"3"""""3DUD3""""""""""333D""""""""""""""3"3�""""""""3U"3""""33"3UfffUUUUD3�Uf3"""3"""3""""33DDUDDDUUfwwwD"""""""""DD"UUD""""""DD33Dfww3""Df""3333"3"""""""""""3""""33D"""3""""333DDUfUD3""""""""""""""""33333333""""""3""""""""""33"""""333wfDDDDUwݻDUfDDDD3DD3DD33""""""""""����"""3"""""""3"D3"""""""33""""DUUD3"""D3"3"""""3D3""""""""""3"3D�"""""""""33Uf"""D3333UwUDD3"33"UU3333""333DDUDDDUUfwwD"""""3"3""UU"""3""""DDDDDUfwUU3f3DDDUD""333"""""""3"333"""3"D"""""3"ffUUD33"""""""""33"3333D333""""�"""""""""""""3333"""""UfUDUDDf̪wUUf3DD33DD""3"""""""""""3""""""""""""3DDU""""""33"""3UUD3""""""""""""""3DU""""""3""""""""""w݈�""""3"3"D""3DUw"""DDUDDfU3""UD3D"""""33DUUDD3UfwfD3"""""33"""""""3U3DD3DDfw"3UfUUffUUDD3"33333"""""""""""3D""""""ffUDD333""""""""""""33DD"""""3"D3""""""""""""3D333333DfUDUDDww̙wU33DD33"3""3""3UU"""""""""""D3""""""""""3fD"""""""3UUD3""""""""""""""3"D3"""3""""""33""""""""""""""333wU""DUUfUUD3""""""3"""""33D3333fwwwUD3�"D33"""""""""""D3D33D3Dfw"DDwwUD33""333""""""""""""3"""""3ffDDD3"""""""""""""33333D3""""""3""3"3"""""""33333"""3"3DDUfDUwwU3DD33D3"3""""""UD""33"""""""33""""""""""""33U"�""""3UUD33"""""""""""33UfDD""""""""""fݪ""3""""""""Dwf""3UUDU3"""""333333DUwf3"�""""""""""""3D33D33DfwD33wffU3fU3D3"33""""""""""""""""""DUDUUD33""""33"""""""""""""""""""""3""""3"""""33333"3333DDDDUU3UUwU33D""33333""33"""""""33"""333333""""""""""""""33""""3UD3"3"""""""""33DUD"3"3""""""""3D""""""""33"""3"""3DUw33""33""33DDUD"�"""""""""3333DD3DDUw"D"""�wfU33D3"""""""""""""""UfDDD33"""""""3"""""""""""""3"3U"""""""""33""3333D333UU3UUwfU3DDD33DD""33"""""""""3""333DDDDUf3""""""""""""""3fU""""3fD""""""""""3DfwwUDD3""""33"3"""3"""""""33DUUfU3"""""""""""3UUUwwD���"""""""""""""33333D333DDfw""""""""33"3DD333"""""""""33"""DfUDDD3""""""""""""""""3"""33""""3D"33"3""333333""3333UDDDffD3DUDD3DU"3"3""""3""""""3DD3""33UU33"""""""""""""""DD3""""""3UD3"""""""""""3wwf3DDUUD3""""""""UU""33"3"""""""""""""3DDUffU33"""����"""""3DDUffDU""��""""""""""""3D3DDDD33DDUUffw""""""""DD3""3""""""""3"3DUUD333333"""""3"""""""3""""""""3"333""3"333DDDDUDUw33"33DDDD""""""""""D"""""3DDD3"""333D""""""""""""""""DD3""33""""3D33"""""3"""""""UUwDDUUUU"D"D""""""""""""3�""333"""""D""33""3DDUUffDDD333"3""""""�"""""3UUUDUfUU"���""""""""""""3D33DD3333DUUfffwD"""""""DUDD33""3"3"""3DDUDDDD3333"""3"""D3"""""3""3""""3333fUDUDDfD333333DD"""""""""33""""333D33"""333DD"""33""""""""""3333"DU"""fU3"""3UU3""""3""""UUDDff3"333D3DUD"""3""""3""3w"""3"""""""33"3333""""DDDUUUDDfU3333"""""""""��""3UUD33D"""�������""""""""""""DDDDD333"33DUfUUUf"""""3DD3DD3D33""""UUUDD333333""""""3""�"33""""""""33DDffUUUff3"""3DDf3""""""""3""3"""33"""33"""33333"""33"""""""""33DD33D3"Dwf33"333"D"""""""""""D33333333D3""333DD3"""3�"DfwwUww"""""""D3"D333"""""3DfUDUUfU3"""3""""""���""3DDDDU333��������""""""""3UUU3D"3"333UfUUfUff3""""""3"""3"3D333"fDD3D3D3D3333"""""""U3"""""33U"""""""3"3DDUffUUwwDD3""3fwU33"""""3D33"3D"""""3"3333DDD3"""D""3"""3""""33""""3""""fw"""""""�"""333""3DD"33UD3"33D3DU33"""fwfww""""""""33D3"3""3UUUfwwwUD""""""""""���""33333U"3"""�����"""""""""""""3DDD3Uwf3""""""DwUDD3DUUD3""3D3"3"""""""""3"""fU3D3DDDDD33DD3""""""""3fff3"""""""""""""""3333DUUUUDDfwfwDD""U3""DDD"""3D3DUfD""""""D"3U"3UD3""33"33"""3"33D3""33""Uf"""""""""3""""D"DUwf333333"3DDDDwfUUwwfU���""""DU3"333"""DUUfwfD3"""""""3""����""333"33"""�����"""""""""3"""Dfff3""""ffU333"333DD3DfUUUDDD3"""""""3""3f3333333333333"""""DDDDfU""""""""""3U""""""""333"33DDDUDDDwDwfD3""DfD"""DU3DDD3"""3"""""3"333DDDD3""3333333"""3D3"D"""3DD""""3""""""33UUUU333D3"""""3DUUUfDDD3""�"""DfD"D3"""""DUfwwD"""""""33"������"""3DD3"""""�"33""""""3""33fw3"333""""""33DDDDDUUfwwD""""3"""""3f3333D3333D33333""""""""""""""""""""""""3"""D"3"""3DDD3UfUwU33"3D"""""""3""""ff"""""""333"DUU33"""333"""""""3D"""Dw3""""""DD""""""""D3"3DU""D3"""3DUUDDDwD""3f�"""""""""""""3""""""DffwwU3""""""""����"""3D3""""""""""""""""""3"3"3ww3"D3""""3"""33DD"33DDDwU""3D33"""D3D3"Df333DUU33"""""""U"""""""""3"""""333""""33DUUfff3DU3"33""""""""""3DDD3DD3""333"3DD3""""""""33"""""""""3DDDwf3""3""""""33""D"3"3""""3DU3DDwwD"3f�""""""""D3"3"""DDUUwU3""""""""""���"""3""3""�""""""""3U""3"""""3""""333"3333DUUfwfD3D3""33UD3""3DfDDDfwD""""""""""""ff"D3""D""3""3D"3"""DUfwDD3"DU3UD"""""""3U3"""33DDD3333333DD3"3D"3""33"33""""""UU3DU3""""""""""""""""""D3"3UD333fD""33f""""""""Dw3""""""33UU3""""""""""�"""�"""33"""""""��"3""""""""333"3333"""""33DUUUUUU3""3DfUDD3""UwUDDffU3"""""""�UU3"33U"3"3"UUD"�"""3"D""""UwU33"3fDU3""""""""DD"3"""D"3"3333333D3D33D3"""""3"3"""3""33Dw3"""""�"3"""""""3"""333"3UD"3fw3D""3"3f""""""""33""""""333fwD3""""""""""""""�""33""""�"""""""""""""3""3""""""""""333DDDUUf3333UfUfwUDDDDD3DffwU""3"""3U"3"3"3DUU"""""""""""""3"3""""Uf3"3wUUD""""""""""""3"""""""3D333D33DfD333"333""""33"""""3""3"Uf"�""""""""33"33""UDD333"""3w"""""""""3""""""""33"DwU3"""""""""333"�"""""""""�"""""""""""""""""""""""3""""3D3333DDDDDffDffffwfUUUD33Dffwwwf3"""wD""""""3DUUD""""333"3"""""3"""f33fUU"""""""""33""333"""""3UDDDUUUUDD"3333"D"""""333"""3"""DUU"��"""""""""fD3"333DDDw"""""""f"""""33""""3"33"3"3UfD""""""3D333""�U"""""���3"�""""33"""""""""""""""""33333D3DDDDfwffDD3DD3333Uwf3""""wwf"33D"UUUD3"""""3DD""""""""""3UUUwwD"""""""333"333""3""""3fUDfwfD333333"333"""33"DUD""""33U3"""""""""�"""""U33""3"UUD3""""33U""""""""3""""333333""Dfwf3""""""3DDD3""""��"U�"""""""������"33""""3""""""""""""""3333333333DfUUffDD3DDDDUUw333"Uw"""""3""DDDfU"""""""""""3"333DDUwfUwD"3"""""""3"3"3""3"""""3UDDffffDU333"3"3333DD33333"3U3"3D3"""""""""3""""3"3D33""3f""""""33""33333"333"3D"33""""3DUUDD3"�DD""""""""""�������""""""""""""""""""D""333333fDDDD33DDUUDDUfwffU3UUDDDUU3""3""""33D3U333"""""""""3""3"3DUfUwwUD3""3333"33333"3"""""DDUDDUffUDD333333D3333""U3"3""DU3""""""3""""""""3"333"33wf"""""""Df���"""""""""3"33DD33D3""""33D3"3DUffUD3""""�3""33""""""""33""3"�����"3""""""33""""333333"DUD3333D3DDDDD3UUUffUfUffUUUUDUDffUwwD3""33""""3D""DD3D"""""DD333"3DUwwwwfwf333"33DDD33333333""""DDUDUUwwfDDDD3333"3DUUfD3DDUD"""""""""""DD3"""""33DD33D3Df3D33"3Uff""""333DDUD3DD3"""DDD3DDfwwfUD33""""""3""""""3"3D3333D3""��""""""""""""""""""U33"""DDD333333DD3D3DDD3DDfffffUfUDU3DDUffD3UwUUUfUD"DU"""33""D""""""""3D"3"3DUfffUUw33D33333DDD33333"""""""""DDUUUUfwUfDDD33D33UUD3DDUUfUD""""""""U3""""333D3D"33UDUD333D3"""33w"""3"""3333DDfUDDD3"""33333fwwUDDD3"""""""3""3""""""3""""""""���"�"""""""""""""""""""""33"3"""""3D333333333333333DDUfUUDDD3UDDDDUUfDD3DwwwUUUUUDD"U3""""33""3"""""33""DUUUwffw"""3D3"DUUDD33333"33"""""3DDDfwUUUfwwffDUfU3333D3"""""""""""""3"""""""333""33wD3DDDDD3""""33w"""""33"""33D3UfUDU33"""333DDffUDfU33""""""""3""""""""""""""""""""3"""""""""""""""""3333"333333333333UUUDDUUDD3D333DDDUU3DUwUUUDDDUUUDfD33"""3DD"3""""""""33DDUfUffUDww"3""3333DDUUDD333"3"""""""""333wwfUDD33333333"""""""""""""""""""3""3333"DDf"DU"""3"""""33wf"""33333"ffUUUD3"""3"DDfDDfwUDDfUD3"""""""""333""""""""""""""""""""""""""3D""""3D""""3333333333DUUD3DDUUD3333"3DDDUDD33UUDD3DDUDDUDf3D33"3DD3DU""""3DUUDUUUfU""""3DDDDffUDD33D33DD3DDUfffwfUUDDUfDD33""""""""""""""3"""""""""""""3"""3"3Df3"UD3U33""""3UDf"""33333"DfffDD"3fUD"""UwDDUww3333"""""""3333"""3"""""""�"""""""3""""""""""3DU3"""3D3""3""33"""3DUfU333DUUD3333D"333DD3333DUD33DDDDDUUUUUU3""3333UD""""""""3DfUfUD33D"33"""""DDUUUUDDffUUUUUUUfffwfU33D3DDD3333"""""""""""""D""""""DD""D""""""33DDUDDwD"3"""""DU""""333""33UffwfU3""""UU"""33DfUffwfU3"""3""33""3"D3"3""""""""""""33""�""""""3U3"""33""33"33""3UfUUD333DDDDD3333""333DD33"33DDDD33DDDDDUUUfD"""33DDD"""""""3333ffwwffDDww3""3"""333DUfDUfwwU3D333""333DDDD33UD3""""""""""""3"""""3D"""3""""""""DfU3DUwww3"""""UD""""33"""33DDDDwfD"""DD""""""DDwwUwDDfU33"3"""""33"""3"3"3"""""33""""""3""�"""""33""""""""3""3"""333DUwfU3DDD3DDDDD"333333"333333D3DDUD333DDDDD3DUwU""D3"3D3""3""""""""333fwfUDUwwD""""""""3"DwwwfwfUD33333""""33333333D""""""3"""""""""""""3"""3"""""3""3DDwf"""""""3U"""""""""33"""333DUUfUD33"""""""""33wfUwUUfD333333""33"33""""""""""""""""""3D3""""""""�""""333"""""""3"""3"""33"3DwfUD333D3DDDDDD3"33"3"""""33DD3UfU333333DD3DUDDUU3333""DDD"D3"""""""""""DwUD3DUf3""""""""UwfUDDDDD3333333333333333""""""333""""""""3""""""""""""""""""""3Dww3D3"3"""33f"""""3"""""""DDUffUUwU3D3""""""3""wwfUDDDDUDD3"""3""""""""""3""3D""""""�"""""3""""3"""""33"""""3UffDDD33D33DDDDUD3"3"""333""""333"wf3""""3333DUDDDDD3"33"33DDD33"""""""3UfDD3UUfffD""""""UUwUUU33DD3DDD3333""""""3"3"""""3""""""""""""""3"""""""3"""""""""""3DfwfwD""""""33U""""""3""""33DDUfwfwwUDDD"""""""""33fwwwwDUU3UDU333""D��33""3""""""33""""""""33D"""""333""""3UwU3"DD3DD3D33DDUD3333""""3"""""""33D"3""333333D3DDDDDUU3"3"DD3"33U3D""""""3UDU33DUUUD3"""3D"DfD333D3D33"3D""""""3"""""33""""""""""""""""""""""""""""""Dfw"""""D""""DwD""""33"33"3DDUUfwUDfwwfU3D""""""""3333DUfUDwwfD"3"""""�"3D"""""""""""""33"""""""""""3D"""""333333Uwf33"3DDD3DUD33UD33""3"33"3""3""""3333D333333333D33333DfDDD3"DDfU"""3UUD"""""3D333""3UwwUD"""DUD"3UwfffUDDDDD33D33"""""""D3""""""""""""""3""""""""3"""""""""""""333w"""U3"""""""f"""""Uf"""""33"3"DfwU3UwwwfUDD33""""""DD33DUfDUwUwwD33""""""��""3"""3"""""""""""""""3"""3""D3""�""""""3""""DDDfwU33"33DDD333UDDU3""3333333"""33"""""3D33333333333333"""3wUDDD3D3"""""DUDff3"""""3333""3UwD3"""DUUUDDDDDDDDDD33"3"333"""""""333""""""3"""""3""""""""""""333D33Dww"""D3""""""""DfD�""Uf""""3U"3"3UwU""UwfUUDDDD333"DD33D3DUUUUwwww3"33"""""3"""""""""""""""""3"""""""""""""D""""D3333DUfwU"33""3DD3333DDDD3D3"""333""""3"3""""3DD3333"3333333"""""3UD"3UD""""""33DUwwD3""3"""333"""""3Dw333DUUUD333333333"""3""333"""""""""""3"""""""""3""""""""""3D3"33DDfU""""""""""""333fD�""""""""""UD"333ffD3"""UfwwfUUDUUDDDDD3DDUDDUUUffffUUD3""""""33""3""""""""""3"3""""""3"""""""333""""""33DwwUD"33D333DDD33DDDD3""""""3333""33"3"""""33"3""3"3333"3""""""""333"""""3DDfU3"""""""33""""""3UfDDDD3D3"""""3""""""""""3"""""""""3"""""""""""""""D3""""""""33333DU3"""""""""D3wf�"""""""UD33""fw3U3""DDUUwfU3UUDDDD33DUfUDfDfwffwfwUD3""""��""""""""""3""""""3"3U3"""""3""3D3"""""3UwwD"333"33D33D3D3DUD33"""3333333""D"3"""""""""3"333"33"""""""""""""333"""""333DfUUD3"""33333"""""""3DUwwUD"33DD33""""33333333""""""3"""""""""""""UU""33""""""""""""""""3333UD""""""""""3"Uw3""""UUDU3"DfD""""""""3DUfffDDUfUUDDUUf"UffwwwwwwwfD3"3"��"""3"""""""""3D"""3""3D3U"3""3333"""3U3""""""""""DfwU333333333333D3DDD""""3"""33""3""DD"""33""33""33"""33"""""""""""3""333""""33"3DfUD33"3DD"""""333""33DfwwDDD33D33333333UUDUUU333"3333"""""3"""""""Dwf""""""333""""""3DD""""3"""""""DDDU333"""""333U3"fwUU33DfU"""""""3""3fwwwDUUUDDUffffUfwwfwfUUDD3"""""���"""3"""""""3"""3DDUUDDD""3""3"3""3DD"""""""""""""Dww3333333333333333DUD""""33""""""33""D3""""""333"33"33"""3""""""""""""""""""3333DU3"UDDU333""33333D33DDUfffUf"3DDDDDDDDDUffUwUUDDDU3D3"""""""333"""""""""DD"""""""""33""3"""""""""3DUfU3D3"""""""33Uf�"wwwfDfDfU""""""""""DUUfDUUDUUfwfffwfDD3DDDD3"""""��""""3"""""""""33DDD33DD33""3""""3D33""""""""""""""3UwU3333"3333333333DDDD"""""""""""33333""""""""""3"3"33"33""""""""""""33"3"""""33D33DUfUwDD3"""3333DDDD3DDUUfUUDDUUUDUUfDUUfwwUUfDUUDD"D3""D3333""3""3"""""""""""""3""3"3""""""""""""33DUf333"""""3"3Uw""wfDwwwf3Df"""""""""""3ffUUUUffwwUDwU33"3DDD3""""3"""""3""""33"""333""33"""""DUD""D""""3D"""""""""""""""Dff33""3"333333333DDUD""""33""""333""""""""""3""""""3"""3"""""""""33333""""D33333DDDUUfwU""3333DD3333"33DD3DUUUUUfffwwfwDfUwwfU3"3fffDUUD3DDD3U333"333"33""""""""""""""""""""""""""""""""33UfU"""""3""""""33""3fD"DDUwUUU"""""""3"""""UUffDUDUwfffUUD"D333D33""""""""3"D3"""""3""3"3"3"""333U3"D""3D3""""""""""""""3UU3"""""3"33333"""3DDD3"3""""3""""""""""3"""3""""3333"""""""""""333D33"3DDD33"""33DDDDU3"3DD33333"""33DUUD3DfffUUfUUw3DUffDUwwfUUUfUUDDDfUDDDD33DU3"""""3""""3""3""""""""""""""33DUw"""""""""""""3f3D3DD""3Uff"""""""""""3DffUfwfffUffDD"33"3D33"""""��""""333""""""""""3"""""""D3D"3D"""""""""fU3"3"""""""33"3"3"3DD3""""3""""""""""""""""""33333""""""3""""""""DDD33D333""""3U"""""3D""3D33333"""3DUUD3DUfwfUwwfU3UDDUffD""wwwUUUfwwDDD3DUDDDDDDD""""""3""D""""""""""""""""""""3""""3"3Ufw"""""""""""""3DDD""3DUfD"33"3""D"""""3fwUUwUUU3UU3""D"3333""�"""""""D3""333"""3"3""""D""""33D3""""""""""""""3fD""""""""""3""33333U3""""3""""""""""""""""""3D3""3"3""""""""""3DDDD3""3D3DD""""3"33"33"3""""""3DDD3"DUUfwwwUDD"3DDUfU""""3UffwwfDDUUDDUDUD"""""D""""3""3"""""""""""""""""""""""DUD"""3"""""3UD""�DwD3D3"�3wwD333"3"""""DffUUU"3D3""""33"33""""��"""""""DfD33D3"""""3"""""3""fD3DDUD"3""""33"""""""""""3UU""""""""3"33333U3"""3"""""""""""""333333D3333D33""""""""""3DDD333D33"""""""""""333"""""33DDDUfwfD3"""""33"""wwwDDUUUUUfD""""3""""3"""""""""""""3""""""3""3DD""""UU"""""DUUf"f33U3"""U33""3D"""""DwfffD""""""""33"""3""""""""""3UUw3"""3"3""""""""3""DfwD""""33"""""""3Dw""""""3U""""3333U3""""""""""""3D333333"3""333333""""""""�""""""DfDD333"3"""""""""3""""""""3DD3DUUUwU""""""""""fffwfUUfD""""""3"3D3333""3"""""3"D3""""3""""3"Uf""""""""33ff""33"D"""U3"""""D"""UwUUwU""3""33""3""3"""""""3UD3DD3""""3""""3UwffD"""""""""""""3Uf"""""3"""""33DD3""""""""""""""3"""33""""3"3333""3""""""""""""""""3333333"333"D3""""""""""3DD3UfUDfw"DD""""DDDD"""""3DUUwfwffwwf"""""""33D3D33D3"333""33""D""""""""""DwD""""""DUff"fwDDD"""DD"""""3"""3fwwwU"""3""""""""""""33D3DU33"""33"""3DDUD"���""""""""3DUD"""""""""""33DU3"""""3"3""""3""""""3"""3333""3""""""""""""33"""""D3"""DDDUU3""""""""DDDUfwfwfwU"D""""Df3DU3"""D33fwU3""3""""""3DU3DD33"3D3333333""33"3""""""""3DU33""""""3UUDUD33DwU3D3"""""3""""""3"""""Uwwwf"""""3��""""""""""D3"D""3""""""""DDD""""3DfD""""3"""""3""""DU"""""D""""""3""""""3""""D3333"D"""""""""""""""3""3""""3UUDD""""3DwwUwwwD"D3"3UfDD"3D""3""fwwf3"�""""DD333"3D333""""3"3333333""""""""3ff"""""""""""3wU33UUDD3""""""3"""""""""""""3wwUDU""""""""""""""33"3""""""""33D"""""""�"""3DUD""33""""3"3"3D""""""3D"""""3"""""""D""""3""33333"""""""""""""3""""""DUU33D""""""3UwU"UffUUwww""3UUU3"""""3U""""""DwfUD""""""""DDD33"3333"""333333333"""""""""DUUU""""""33DDffUD33"""""""""""""""33"""Uww3"wU""""""""""""""""3"3"""333D3�"""""""��"""33DUU�"33"""""""""33333"""""D33"3"""3"""""""3""333"3""""""3""""""""""3Uf3D"""33Dww3"DUDDUff""Uf""UD"3""""3UfUD3"""""""333DD3""3D3""3333"33"333"""3"""""3UU3D3""�"DDUffU3DDDfD3"""""""""""""""3333""3U33Dw""�3"33""""""3"""""""33DUD��""""""""���""3Uf3"3333"""""""""3DD"""""""""333""3"""""""3"""33""33""""""""""""""""""DD"""33Dfw3"33DwDUUUU3"3w""""""U3"""3UfUD"""""""""""3333""D33"33""33"""3"33""3"3"3"""""""DD3333�"33"DUDDD3"333DU""""3"""""""""""3DD""""""D33"33"""��""""33D3"""""""3"""33DDDD"�"""""""""���"3UfD"33"""""""""""3D3"""""3333"""""""33"""""""3"""""""""33"""""33""""""""""""""DUff""3""DD3"""DfwD""""33"""UwU33""�"3"3"""3DDD"""""3333333"3"""3333"""""""3Uf""333"""3UfUD3"33ww""3"3U""""""""""""""""DfU3"3""3"3wD"""���""3D3""""""3""3"3DDUU3"���"""33""""""���"DfD3"33"""""""""33D"""""""33"""""""""""""""""""3""""""3"""""�"�3""D""""D""""""""DUww3"""3"""""fU3"""""""""Dw3""�""""33"3DUfD3""33"3333333"""3"3"""""""UU3"""""3""3DDDDDD33""3w""3"3U�"""""""""""""""3"DUUU3""""""UUfU"""3"��""3UD"""""3"3D"333DUU3"���"""3DD33""""""3fUD3""""""""D3""""""""""""""""3"""""""3""""3"3"""3D"�"""3333"D""""3DUDfw""""333"""3D333"""""3""DfU""�"""""3333DDDD3"3"3"3D33333""33D33"3"""""""Df33"3wwDU3D33D33D""""3333"33Dff�""""""D""33"""""""3DD""""""3Ufwf""""Df"""3UwU"3"""""3"3"Dff3�����"""333"333""3"""��3f""""D""""""3"33""""""""""""""""3"""""""""""3"3""""""""3fD"""�"33D33""""""3"3DDwwwD"""""3""""""33""""""3"""33wU""�""""33DD33DD""33""33333333"3"""33333""""""DU3""""33"D33D333""3"""33Df"3DDUf�D"""""""""""3"33"3""33UfwfDU""""""fD�""""""""DUD3U3"3UwfUUwwU3"���""3333"33DD33"��3D"333""""333UUD""""""""""""""""""""""""""""3"3""33"""""3D3"""3D333"""""33""333UU3"""""""""3""3"""33"""UU3""""33""DDDDDD3"""""3""3DD33"3""3D3333""""""DU"""""3"""33D33"""""3D3Df33DDU�"3""""""D3"""33333"""33U33D"3""3D���"33""""""DDDDUfDUfwwDDDD3�����""""33"3UU3"���33"3D3""""33DD"""""""""""""""""""""""""""3"33""3""""""""3"""""""3D3"33""""3""333DwwD"""""""""3333"""""""""3U3"""""""33""D3"333D""""""""333"""3"D3DD333""""""""33"""""""""""3333""""""333"U"33D�D""""""33DD33"33"""3"3"""""""""""""""33""""3D333DUUDfwDff""33""333333D3""�"D"""DU3"""""""33D33""""""""""""""""""""""""""""3"3"3""""3""""""""33"""""""""3DD3"3""333""333DUU3"""3U33""""""""3UD3""""""333333333"3DD""""""""D333DDD3DDDD33""""""""33D"""""""""""D3"3"""""""DD33"3D33"3"""33DDD3"333"""""""""""""""""""""""3D3""""333DDUfffwf3"DD33333�"�"3""33333D3"""""3D"�"DDD3"""""""3"33D3""3"""""""""""""""""""3"""3"3"33"""""""""3""3"""""""33DD33"""33"""3DDUwf3"""""3D"33"""""UU3"""""""""""""33D33333DD""""""33333DDDDD333"""""""""""3D"""""""""""""""3D""""3""3DDf�"""""""""3"DD3""3"""""""""333"""""33"""""""""""""3DDDDUUwf3"""""33""333333""""""""333D"D33"""""""""333DDD3""""""33""""""""3"33"""""""3"""""3"""""�""33UD3""3333""3DDUff"""3D33""""DDD"""""""D333"33DD33""DD"""""333DDD3D3DD33""""3"3"""""3D"""""""""3U"""D33"w3w"�"""""""""""3""""""""""""333""3""3"3"""""3"D""3DD3DDUff"""""""3��""333"""""""""""3DD"DD3""33"""""""33DDD""""""3"""""""""D""""""""33""""""""""""""""""D3DDD333333333DDfwwf3"""DD3""""3UD""""""""""""""3"""""""""333""""3"3DUUDD3DDDDD3""3"""33333D""""""""33"3D3UfwffU"""3""333"""""""""""3"""33""�"""""3D""333"DD33UD3DUfU3"""""3"""""""""""""""""""""3DffDD""""""""""33"DDDD"""""""""""3"""""3"""""""3""""""""""""�""DDD33333"333DDDDwf""""33D"""""3D""""""""""3"""""""""""3""""""DUD3""3D33D333"33""3333D""""""""""D"3DDUf"Df�"""3""""33"3"""""3"33"""""""""""""""""""3U""""333"D3DU33DUfD""""""""""""""""""3DwD"3"""""3"""""""3"333DDDD""""""""""""""""""""""""33"""""""33""""""""""DDD3333333"3DDDDf3"��"33D"""""D""DD""""""""""""""""""3""""DU3"""3333333""3333D3DD""""""""3"DD3UDDffDDww33""�"3""333"""""""""""""""""""""""33DD"33"3""3"UUD3Dff333""""""3"""3"""""DD3"""""""3"""""3""""""33"33DDU3"""""""""""""3"""""3"33"3"""""""""""�""""33DDD333""333DDDDf""�"333""""33""33"""""""""""""""""""3333"3""33""3333D333D3"333"""""""""3fDDDDUUwfw"DD"""33"3333"3333"""""""""""""""""""""""3"DUDD"333DfD""DUwfD33"""""""3""""""""3"""3f3"""""""""""""""""""3DDDDD""""""""""""""""""""3""""3"""""""""""""33�"""3DDD33""""333DUUff3""""�"3D""3""""""""""""""""""""""""""3D33""""""""333333333DD"33""""""""DU3DDUfwff333"""""3"""3DD"D3""""D3""""""""""""""3""""DfUU3""3D3f33fwUD"""""3"3""�"3"""""DwUD"""""3"""""""D3"3"333U3"""""""""""""""""3"""""""3"""""3""D"""""3U3DDD3""""33DDUUffU3"""""""""3D"""D""""""""""""""""""""""""""33"3""33333"333D3333D"3333"""""333fU33DDffwD33""""""33"""33D""""3D"""""""""""""�"""3""D3fUwU333UDDDDwf3""3"""""D"3"U""�""""DwUwU"""""""""""D"""""3""3DDUf"""""""""""""""""3""""""""3"""�""3""333D33DD3""""33DDUUffUD""3""""""�"""""""D"""""""3""3""""""""""""33"""""333"333D33DD3DD3"3"""""3""3fwUUUUfUUU333""""""333DDD""3"""""""""""""3D"""""ffUUDfD"DUwUDD3"""D3"3D3"D33"3DUD3ff3""""""""""""3""3UDUD3"""""""""""""""""""""""""""""""""3""""3D33""""33DDfffff"""33""""3"3UU3"D3"""""3333333"""""3"""33"333"""3""333"D3D333D3333"""""""3"""fDUffwffwD33"""""""""DDUD3"DD3"""""""""""""""3D""""UfUU33UDUfwU3DDD3""D3"3D3DU""""""�""Uf3""DwUD""""""3"""""3DDUU"""""""""""""""""""""""""""""""""""""""3"3D3333DD3"""3333Uww3""333"""""""""33f"""3D"""3D3"3333""""""""""3""3"333""3""333333333""""33"""""""UUUUUUwUw3D3"""""""""D3DwU"3"""""""""""""33"""""3DD"""3UD"""fffwfUUfwD3333""""3D333DU3""��""3U3""3DfwU""""""""""""""3"DfwD""""""""""""""""""""3""""""""�""""""""""""""3"""""33D33"333DDffUwwU3""3D"""""3"""""Dfw""3U""�"""333D3D3"""""33""""3""""3""333""333""3333"33D33"""""""3DDUUUfwUf"33"""3"3D33"3DUfwD""""""""""""""""""""""3DU""3333"333fwfUfDDUUD333""3"333DDDD""""""DfU"""3wf3""""""""""UfwfUfD""""""""""""""""""""""""3D3""""""""""""""DDD33DDUDUfU3DwD"""333""""""""3U3""fU""""""333"33"""""DUU3"""""3"""""""3D3""333""333333"3"3""""""UfDDDUfUff""3D3"""""3D333DUfff"3"""""""""""""""""""""DD3""3UffUUUUUUUDD3333""3""3D33"""""��"""3fw3"3Uw"""""""""""UwffwwwwD"""""""""""""""""3""""""�""""""""""""""3DD3DDUfUfwf33fw3""""""3"""""""""""""U""""333"""""33""""DD33D"3333""""3""""""""3333"3333""3D3"""3wUDDUUUfwf"""3"""""DD33DUUwfU3""""""""3""""""""""""333""3fwwwfwU3DDDUD3""D33Uwf""D3"33""""""U3""3fD"""3"fwfwwfD"""""""""""""""""33""""""�""""""""""""""""""33DUUUDfUUfffDUw3"""""333"""3""""""33D""3"33""""""""333""""3D33"33"""3"""""""3333"""3""333D"""""""�3wDDDUUUfwD"3""""""""DDDUff̪33""�""��""""""""""""D""3""DfwfUfw33fUD3"DDU3DwwUfD�"UU33""""""""UfD""Df""""""3Uffww3""""3"""""""""""""�"""""""""""3""""""3"DUUfUUwUDDfwwwU"""""33""""�""""""""33U3""""3""""""3"33""333333333""""""""3D3"""3"3333D3"""3"""wUDDDUDf3"""3DDUfw̻3"D̻f3D""""""""DU33UfwwU33ffU3DD333"3UD3wfwfUfww""""�""""""Dww3"�"3UfD""""33fwwfU"""""""""""""3""""""""""""""33"""""""3DUDffwwfUDDwfUD"""""""""""��"3""""33U""""""333333"""""""33333""""""3DD33"""3""3333"3"""""""""""""""33DUDD̈"""""33DUUf̙UU3Uݻw""""fffUD33UwU33UwfUwfUDD3333U3wwwfUfUffwwDDf""""3UwU"�"�"3Uw3�"""""3"UfwfD3""""""""D333""""""""""""""""""""3""""""""3DDDUUUfU3UwDDfD"""""3""""�""33"""3D"""""3D3""""3""3""333"3""""""33DDD""""333333"""3"""""""""3"�3333DDUݪU�""""""""333DfݻUẅUffwfffffUUUDU3"3DwUf3DDDDfwwwD33333DfwfUUUDDfffwUfUD3DDfw33"3fUD""""""3DU"�"""""3DUDU3"""""""3333"""""""""""""""""""""""3""""""3DUDDfDDfwD"UfDff33""""""""3""""3U"""""""""33""""3""""""33""""3333""""""33D3""""3"""""""""�ff3333DwD�"3"""""""""3f̻̻̈wDD33UUUffw̙UDwf"3D33D33UfDDDffffUfUDDDfffUUUUUfwDUwwDfU3"DUfD33"3""""3"�""""DDDU33""""""""""""""""""""""""""""""3"""333UUUDDU3DUUDDDDDUU""""""""3""3"3"""""D3""""3""""""""""""""33""33"DD3""""""""""""""3w3""33Uf�"""33"""""""3f̪wUDUD3"33D3DUD3D̻DUD3D3UUwwfffwUUfUDDD3DUDUD3D3D3"3"Uffwwf3fUUU3""3"333D333""""""""""""""""""""""""""3D3"3DDDDUDUUDDDDD33DDf3""""""""""33""3"""3"3"""3""""33""""""""""""""33D3"33""3""""""""""""�"wU33""3w3�""""""3""""DDݻUUfD3""3DD3"333U3"UD3fwwwwfwwwwwD"""3"3U3333DwUUUUD33333DD"3"""""""3"3UUfwffU""""""�3DUDUU3"""""""""""""""""""""""""333"33DDDDDUfUDDDDfUDDUf3"3""""3""�""""D"�""""""3""""""3""""D3"""""""3""""3D3""3"""""3"""""3""""�DD333"U3""""""""33"""""3UݪwfwD3""333333"3"3UfUwUUfUDD3DDUDD3DDUDDDD3"""""""3"3DDDUUUDDD3"""33""3"""""33""33"DDUUUDUfwwwfUfffU���"3D3Uw3"3""""""""""""""""�""3"3"33DD3D3DDUUUDDDD333fU"""""""3""""3U3"�""""""333"""""""333"""""""3U""33D3"33""""""""3"""D3D3"fU333"DU"""""""33""3""33fw3""333""3D3"3DUDUUUUUD""3333D3"""""3""""""""""3333DUfU3D3"""""33""""""33"""""""3DD33333DUDDUUwwf33""3DDDDD"�""""""""33"""""""""""""""3333DD33DDDUUDUDD"33Uw""""""""DD�"""3"3"33""""33""""""""3333"""""""3""333"""3"""""D3""3f3""""fw""""3""""3333UwwfUDD"""3""3""33""""D3D3DDD3""""""""""""""""""""""33""Uf33""""""""""""""3""""""""3333333"3DUDDDfwf���"""DDDDD""""�"""�""33333"""""""""333"333"33DUUUUDDD333DD""""""""""33"�""""D""""""D"""""3D"""33DUD333D3"333"33"""""""""""DU3"3"3w""""""""""""""333w݈w""3"D3""333""D33""""3DD33"""""""""3"""""""33"D3""""""""""""""""""""""D""""33"3"33DDDDD3UD""3UDffUf3""3""333"33""""""3""""""""33333DDU3DDUD3DD""""""""""3D"""D""33"33333"""""""3DD33"""""""3"3D""33""""""""3"ff3"3""w3""""""""33""3""333Df3"""3D33DU333DD""""D33"""3""""""3"333"""""3""""""""""""D""""�3D"33UDD3U"�"3333DUf3"""""�""""""""33"333""""""""""""""""""33"33UD3DUDD333""""""��"""""3"3�"""""""333333"""""""""3D3""3"""33"""""""33"""33"3"33D"3"Uw""3""""""""""""""""""3ff3DD3"""3D333""3"3""""""""""�"""3""""""3""""""""""""""""""""33"3""3""3333Dw""D""33"3UU33""�"""""""""33333""""""""""""""""""33""""3D3DDDD333DD""""""""D3��"""""""""3D3"""3""""""""3""""""""""3D"""""3"""""3""3"f3"""D""""""""""33"""""3UU3"3"33""D3"3""""""D"""""""""""33""""""""""""""""""""""""33"3ff3""""""""DffD3""""""""""D333"""""""""""""""""""33""33DDUD3D333"D3"�"3"""""Dw�""""""3D""""D""33"""""""""3"3"333DUD3""33""3"""""3wf""fU""""""""3""3"""3""3f3""""""""3"""3"""""""""""""333""""""3""""""""""3"""""""33"3DUf3"��3U""""""""DwD""""""�"�""""3DD333"""""""33"3"3"""""""""333333DUfUDDD3"333""�3""3DD"""""3"3"""""33"""""""""""""33D33DD3""""""""""""3f3"wU33D3""""""""""3Dݙf3""""""3""""""""""""""""UfU33"""""""""""""""3�""""3"3DffwDUUD3�w""""""""3DwD"""""3"�""3UUD3D"3""""""3""""""""""33333DUUffUDDf3"DD3"""��"3"""""DD3�""""33""33""33""""""""""3"""DD33""""""""""""ww3ff3""3D3"""""""D̻3"""""""3""""""33""3"DfUUD3""""""""""""�""3""DDUUfUffwwUw""""""""33UwD"33"""""�"3DD3fUD3U""""3"""3"""""333333DDDDDUfwfU33D"DUD"""�"�"33"""33DDD""""""3333"""3"""""""""""""""333DD3"""""3""33"UD"Uf3"""""""""""""3"""w"""""""""""""3UUU"""�""UDUUUUUD3"""""""""3"3""�""""3DUD33DUUD""""""3DwUDD"""""""""""D3DUD33D3""""3""3"""""""""""3333DDDDDUUUUwfD3DD3UD"""""""""""""3DDDD""""""""3""""""""""""""""333333"""""3"""333f�3ww3"""""""""""""""""3Uw3""""3"""""3DD""�""wfUUDDUD3"""""""�""3D3DDDUwwUDUUD3"D33f"3""""""""""""3DUUDUD333"3""""3"""3D"""""""3"333DDUUDUDUUfwU3DU"UD"""""3333""""33"""""""""33"""""""""""""33333"""""""""""""3ww"f3"""""D3Dw3""""""""3333"�""""""wwUUDD3DD3"""""""3"""�"""""333DDUfffwfDUfUDUwfUD3""D3"""""""""""DDUD3D333333"""D""""""""""""3""3DDDDDUDfUDUUwf33UD3U3"3D33"33""�""""""33"3"""""""3"3"3"""""""""33Dwf"3f"""""""""D"""33�"""""UD3"3"""""UwDUU3DDD3"""""""""""""""33"3"""""""""33DDUUUDUD3333DDDUUfU3"""""""33DDD3333"3333""3D"""""""""333333DDDDUUDDUfwwUDDDUDD3""""""3"""""3"""""""""3"3""""""""3""3D"33""""3Dww3�"ww""3""""""""33"""3"""""3DDD33���"3""3UU3DfD33D33""""""""""""""""""""3DDUDUUDDDDDDDDUUfUDfD3""""�"""UfUD33""3"""33""""3D""""""""""""33333DDDUUUD3DwwUUDUD33D""""""""""""""3"""�""33""33""""""""3"33""""""""""""""3DDU"U""3"D""""""""""DU""3"33""""3DD3""�"DUfU33UD33"33"""""""""""3"""""""""33DDDDDDDDDDUUUUfUUwD""""""""""�""""DwfUUfU"D"""3D""""DD""""""33333DDUDUDUDUfUUwfDUD3DU""""""""""""""3"""""3"""3""""33"33""""3""""""3DDfw"U3"""""""""""""""""�"wD""""3""UUD3"""""""3UUU33D3""""3"""""""""3""""""""""3DDDD3DDD33DUDUfUfw3""""""""fwUUD3DfD3DD"33""""DD"""""""33"3"3333DDDDUUfUUUUffwUUD33DD""""""""""""""""""""3"""""""""""""""33""33"""3"33"""33DwfD""""""""""""""""�"̻D""""""""""DD3""""""""""3UUUD3DD3"""""""""""3"33DDD3�"��""""""33333DD33DDDDUUfD""""""""fwwfUDD""33"DD33""""DD"""""""33333333333DDDDfUDUUUfffDD333D3""""""""""""""3�"""""3""""3333"333""""D3"""""""""Dw̪U"""�"""""""""""�"ݻD"3"""""""�""3"""��3"3"3ffUfUD3DD3D3"3"""33"""""3""3""�""3"333D333DUUUfUf"""""""��""wwfUUU33""""3DUDD333"""""""""33"3333333D33DDD33DDUUfffDD""D""""""""""""""""""�"3�"""""""""""33""""""""""3""3"""""""""""Dw3""""""3"""��3""""""3""3"""3"3""�""fwD3UffUwfU333"33"33D333"""""�""33333D33"DUUUUDD"""""""""""wffDUDD3""""""""3DD3"""""""""""""""""""333DD3DD"U3333DUUUfD3"3"""""""""""""""�""D"""""""3D33"""""""""""3""3333UݙD"""""""""""""""�Dݪ"""""33"""""""�""wwwwwfUffD333"""3333D3""""""�""3"33D333DDfUDwDD""""""""�"3wwfUUDD33""""""""3"""""3"""""""""""3"3333333DDDD"3"33DDUwwU3333""""""""""3""""""""""""�"3"""""""3D333""""""3"""""3333wݻf""""""""""""""""�"w̪3""33""3""fwwwffUDDD3""3"3"3DDD3""""""�""������"3333D333DUfDwU"""""3wffUUDD33333""""""3""""3"""""""""3""""333333DDDDDDD3D"33DDfww"33D"""""""""3"""""""""�""""""333""""""""""""""""""""""33w̻U""""3""""""""""""""""̻3"""33""D3"""�3wwfUD"3"""""33DUfDD"""""""""������""33333DDDfDUDD3"""""""wfUDDDD33""""3"3"""""""""33"""""33"3"333DDDD33D3U3333DUDUDUDf"""""3"""""""""""""""�""""""3""""""""""""""""""""""33""333wD"""""33""""""""""3"�f̻UU3"33""3DD33""""�"""""UwfUD33"""""333D3fU3"""""""���������""3333D3DUfwff33"""""""3""""�DfwUDD33"333""""""""""""""""33DD33D333""3333D3DD33333"33UDUUUDfD"""""""3""""""3U"""""""""""333""""""""""""""""""3""3"D3U3""""""3""""""""""""""DwfUfU"33UD3DD""""""""UwwffUD3""33""333UU3"""""������""""3333D3Dwwwf3""""""3""""""""""""�3UfwfDD33""33""""""""""""""""""""""3"3DD3D3""333333D33"33"33DUUUUUUf"""""""3U"""3""""33"""""""""""""""333""""""""""""""3""""""3DU̪3""""33""""""""""""""""""""DwfwD33"DDD3""""""""3wwwfUUU3""""""3""3333DD""""""""�������""3333DDDUUwf"""33""33"""""3D"�3wfUfD3DD333""""""3"""""""""""""""333333333333333333"3"333DDDDUwDfD""""""""""""D""3"""333""""""""33333"""""""""""""333"""""""U""3""33""""""""""""""""""""3fݪUDU3"""33DfD"""""""""""DwfUD3""""""""""3"333"""""""3"""�������������""DD3DDDUDUfU""3D3""""""""3"""UwffffDUfUD3D3""""33"""3""""""""""""""3D333DD333333333D3333DDDDDUfwf"""""""""""""""""3""�""3D"""""""""""3""""""""""""""33"""""33DD""""""""""""""""""""""""""Uݪ3D""""3DUD"""""""""""3DwUUD3333""3"""""33D"""3""""3""3""""�������"""D33DUDDUDUfU3"""""D3""""""""""3DwwwwwwfUU3D333""""33""""""""""""""""""333DDD3333333333DUDD333DDDUfwf"""""""""""D3""""3D33"33"""""3"""""""""""""3"""""""""3fݻ3"""33""3""3""""""""33""""""""f̙3"""3333"�"""""�"3"wffUDD333333D3""3DD3D3""""""3"""""���"�""""333DUUUDfw""""""3""3""""33""3UfwwwwwffDD3"3"33333""""""""""""""""33""3333333DDD3DDDU3""3DDfUUfwwD3"""""""""333"""""""3"3""""""""""""""""""""""""""Dfw݈"3"""""333"""""3"""33"3"""3"3wݻD"D"""D"""""�""wwwfUDDDDD33DDDDDDUUDDD"""""""""""3""""�"""3DDDDUUffw3"""33"""""""""3UwDfwfUUUD33333333""""""""""""""""""333"""D33"33333DDDU""""DDUUfwwfwwwU"""""""3DD3"3""3"""���"D3""3""3""""""""""""3""""""""3̻w3"33"33""""3"""33"3"""""""3DDDwwD3D""""3D3""""""�"""3wfwfUUfDD333DDDDDD3DUD""""""""""""D3""�""�333DDUUUUw3"""33D3"""""""3ffffwwffUDDD33333D3"""""""""""""3"""""33""""333333"3U33""""3D3DffffwwwwwU"""""""""UU3""""""""�D33""3"""""""3"""""""""""""D̪U""33"3333""3D""D""3"3DDU33UfUDUwf̻fDffDDU"""333"�""""""�""""""""UwffwwUDDDUUDDD33D3DD333"""D""3D3"""�"��"33D3UU3Uwf""""33DUD"""""DfUwwwwwwwffUUUUDDD333"""""""""""""""""""""""""3"3""33"333""""3"333DUfffffUffU""""""""DD33"""""""���""""""""""""""3"33""""33U333"""""33"3"""""3"333"fwDUffff̻UffwfDD""""3D3""""""""""3"3""UwwwwUffwwUDUUUUUU3DDDUDD33333333U3""U3"���"3DUDfUfDfU3""""33DUU"""UwwwwfwffwffUUDDDDD33D3"""""""""""""""""""""""3""""333"3""""3"""33UUUUUwf3Uwf3""""""""3333"3""""��"33"""""""""33"""33""Dfff""""""""3333"""""33333fwfUUDUUUUfwU3"""""3"3"""""""""UwwwD""3fwfffUfUDDDDUUUD33333"""D3"3""""""""���"""3UDUfD3UD""""33DDD""DfwwfffUUUUDDD3DD3333""""""""""3"""""3"""""""""""""""""""33"""""33"333DDUUfDDDDDUD""""""3333""""3333""""���"""3"3"""D33""3UU3DUwffw""333""333333""""""""wwwUfUD333UUwww̙wfU"3"""""""""""UwwUUD""3fwfwfUffUUDDDD3D3""D3""33"""3""��""3DUUDfw3333""""""33"DwwwwwwwfUDDDDDD3D33f3333333""""""""""3"""""333333D3"""""33D3""""""""3DDUfUDDD3DfD"""D3"3"333""33333D3"""���"�DU"33333333"""3DUUݻf"""3D33333333333"3""3DfwwfD333333DUw̙wfD3"""33"""""""""3fwD3""33"UwffffwwfUfUD33DD"3DDDD""""""3"""������"3333D33w"""3""""DwwwwfwUUDDDDD33"3DfD333D33"""""""""""""""3"333"33333D33"3""""""""""33DDUUDDU3D3fUD""3333""""""33"3"33"""""fD3""3"3"""""3ݻ3""DD3"3"33"3""""DfUwffUD"3333333D̙f3""3"�"""""""""""""�"UwUD3"3UffffffwfUUUD33DU33"UD3""3"""D"""""""�"�""3333DD33D"3"""D"DwwwwwfUDDDDD33"3DDDDUDD333""""""""""""""3"3"""33"""""""""""""""""33DDDDUUUDDD33UfU""3U""""33"3333""""""����"""UU33""""""Dff̙wwDDw33""""3"w"3UfwwwDUUUD"3333"3"D̙3"""""""""""""""�"""UffUD"3UffffUffUUffU3DDUDDDUD3"""333""""""""""333DUf"""""3fwfUwUDDDDDD3"D33"333D3333"""""""""333""""""""""3""""""""333""""""33333UUDUUDDD33DDD""33"3""D3"""""""""���������"""""Uf""""3fUfw̻UUUwUDf33Ufw"fwwfUUD3UDUU3"D333333U̪D"""""""""""3"""""""3U3fUD"3UUUffUUUUfUDDDUUDD333D""""""33"""""""�""""""""3333DU"""3""""fwfUUUDDDDD33333333333333""""""""3""D""""""""""""""""""""""3"""""333DUUUDUDDDDD33DU3""D333333"""""""""�����""""""fwDwݙwUUUffwfwwwUfUUDUD3""DDDD3D3"""33Dw̪w3""""""""""3""3DDUUDDD3UfDUD"UUUUUUfD333DD""""3"""3"""""""""�"""""""3DDU333""DwwwUfwwwfUUUfDDDD3""333"""33"3"""""""""""""""""""""""""""""""""""333"""33"DUUDDDUUDD3DDD3DfU"UU"""""""""""""���""""""""""��DwwffUffwf3UfUUffffUUUDD333"""33DD3D33""333̻wU"�""""""3"""""""""��"UDD"UUDfD3"33""UfUUUD3"3D3D"""""33""""""""""""""""""""3"""""D3DUUf3"""DwwfDUD3DfffwUUUUUD333""333""""3""""""""""""""""""""""""""""""333""""D33"""3333DUDUDD3UUUDDDU333D3"33"""""""�""""""""3"�www̻ݙݻݪffUUDDfw"fffDDUfU3DUDD3D3""""""3"DD3DD""""3ff3"�""D3"""DD""""""""""UfD"3Ufff"3"��"UfUUD""3D33"""333"""""""""""""""""""""3""""""33DUf3"3""DfwfUD33UffUDDDUUUD333""33"""""""""""3""""""""""""""""""""""333""33D3""""""3DDDDDDDUUUfUUUUD"D"3""""""""""""""""""""""""3"�Dwf̻ݪwfUDDD33UfwUDDDfD333DD3"""""""""3U333D3""""3f"�"""DD""DU"""""�""�"�DfUDDDDfw33""Ufwwf""DU""""""33333""""""33"""33"3""�""""""""""""""DUfD""""3""""3UwfffwwUDDDDUUD33"""3"3""""""""""""""""""""""""""""33"""3"3333"333""""""3333DUDUDDUUUUUUfD3UD"""3"""""3""3""��""3"""""""""DU̙fffD3333DD3DfwfUDUD3333""""""3""DU"3D3""""Dw""3U33D""""""���3fUUfD3DUwwD�"DUwwwU"3DD"""3"D33333"""333333333""""""3"""""3""""UwU3"3"D"3"333DfwwUUUDDD333""33""""""""""3"""""""""""""""""33"33""3"""3D333"""""""3"33DDUUUUUDUUffwwUwU"""""D""3UD""D""""DfUUwݪUD33D3"""""3DUUDfUUU3DD"""""""""DDw333""3UwfUU�33DDDU3""""""�"��"3fUf3UD33Dwf"UD3DUU33U3"""D3D3DD333"""33D333333"3""""""""""""3"""""""3UwDDD333""DfwwfUDD33333"33"""""""""""""""""""3"""333""""""33""33333D"3"""""""""3333DDDUUUUUUffwD""""""333DD��"""""""""DD3"w̻fD3""""""""""3DDDfwffDDD33"""""�"DwwwwwwD"DUDD333wwwfwU"�""3DfU3"""""��""�3DffDDD3""3Uw"""333""3333UD33DDUDDff3"333"""3DUD33333""""""""""""D"""""33"3""DUffD333"fwwẅD33333333"33""""""""""3""""""DU3"33DD3"""3333""3""3DD3""""33"""""333DDUffUUUUfUf"""""""33""�"""33D""D̙3"""33"fwUUUUD333""""3"3fwffUUUDDwwUDDUwffffwfD���"3�"3DD333"""""""��"3wUwUDD"""Dw3�""3"3"""DDDD3Uwwf3333D33""DDD3"33"3"""""""""""""3"""3""""3""""33fwwD"""""ffffwwD"333333"3""""""""""""""33"33"3D3""""DD33333333D3D""""""""""""D33DUUUUUfUfwfU"""""""""�������""33""UݻU"�"""DD3DDUUDDDDDDDDDDDDDUD33DD3D3""33DwUD3w���"""3D3"""""3"""""�"""UwwfUD3""DD"3333DUwwffU"""33333D3"33""""""""3""""""""""""33"33"""3UD333"""""DwffffD"333333"""""""""""""""""33D333"3333"""""33333"3""""""""33333DDDUUUUfffwfUwf"""""""�������"""""f̙f""""D3"33UwU33"""""33D33""3"""""""3DUw33fD"��"""3"""""3""""""""""�"""UwwU3"""D"�"33DUffffwDUD3"33333""D33""""""""3""""""""33"33""3""Uw333333""wfDD3ffD33"3""3"""""""""""""""""333333D3"33""""""333"""""""333"3DDDDDDUUUUffffDwU"D"""""""""������3UU̪UD"������"D""D333""3"""""""""""""""3Dwfw"�""""""""""""""33D3"""""ffU3"""""���""""3D"DD3""""3DUDD"3D333""D"""""""""""""3"""""3333333"""33fD33D"""""""UfDDDfUD"""""""""""3"""""""3U3333333""33333"33""""""""33""3DD3DD3DDUDDUfwf33""""""""""""����"Uw̙wD""3"""����������33DD"""""""""""""33Dww3���"""""""""""3333""3"""DfD"""""�"""""""""3D3D33D33"""33""""""3""""""33""""33333"33"3Uwf"""""D"ffDDDwD""""""""""""""""3D""""""3"3"333333333333333"""""""3"3"3DDDD3DDDUDD3UwwUD"""""""""�������"""f33""""������""DDD""""""""""DUUUw�����""""""""""""""""""""33DfD""""""33""3"DUU3D33"333"""""""""3""""""33""""333"3D333DUU""UDwfDUf3"""""3""3"�"""""333333D3DD333333333"""""333333DD3D3333DDDDDUffUw""""""""33"��"w̻wwfff3"""""���"333"""""""""33DUf����"""""""""""""""3U33""""""�"""3""3UfDUD3""333"3"""""3""""333"""""333DU3"DD3Df3"""UwfUff3""""""33D3�"""""""""3DUDD33"333"D3""333333UDDD33333DDDDDUUf"""33"""3"����""D̪wffwUD"""""""3"���""""""�""""""3""""33f"�����""""""""""""""""""DUD"""""33""""""Uff333DDU33""""""""3"""""333"""""3D3D33DD3DfU33"DUwwwwffw3"""""""3D"3"��""""""""""""""DUDD"33"3"33"33""3DDD3333333DDUfffUfw""3"3""""����DwwwUfDDU3"""""""�""�"""""""""""D"DDD�������"""""3""""3"""""""3UD3"""""""3U""""""""UUD33DUU33"""""""""""33""3333D333DDDUUfDDD"3wfU"fD"""""3"3""""""���""""""""""""""""3UD333"3"33"333"3UUD333333DD33UwUfwf"""33"""3"���"UwfwUUwUD"3DD3""""""""""""""""3""""""""3"""""3Uw3����""""3""""""""3UUD3"""""""""U"""""""3"UUUDDDDUD3"""3"3""""""""""3"""33333D33D33DDUDD3"3""wfUUUDD3w""""""""33"3"""""3�����""""""""33""""""3DDD333"33333333UUDD33D333D33DwUffww"""""3D""""""""��"DfDDD3Dff3""33"333""""""""""""""""3D33"33""""""DwD�����"""""""3D"""""""""3UD""""3"3""""""""33"3"3UD3""D333""""33""""""""""""333"""333333DUDDDUUDUfD"UwfUUUDDD3f""""""""""333"""3U3��"""""""""""""3DD333""3"33333DUDDDD3D333D333UDfwD33""3""""3ww33D3DwU3"3""""""3""""""""""""""""""""3"D33"""3""""UD����""""""UUf3"""""3f3"33""""3""�"""""""3"""3�"U3""3ffD3""""""3"3"""""3D"3""""33333DUDwfUU33ffUUUDDDDDD""3"""""33""3""""DU""""""""""3""""""""""3D3"333"3D3333DUUDD3D333"3333DDUww"""33"""""""3Dw"""3DUfD""3""""""""""""3"""""3""3""3""33DD3"DD""D""3D3��""Df3""""""""D""""3""""""""3"""3"DwwD33""""3"""3""""DD""""""""D3D33DwwwDffUUfUUDUDD3DU"""3"333"""3"3D""3""DD3"""3""""""""""""""""3"3D333"DD33D3DDUUUD333D33D33"UDUffU3""""3"""""""D3""DUUU3"33""333""""""""""""3""""3""""3"3"3333DD333D3""""����"""""""""""""3"33""""D3"""""""""3"""3ww3""3""""""3""""33""""3"""DD3DDUDDU3DUUDUUDD33ff""""333""""3"3""333fff""��"""""""""""""""""""33"UDD3333DDDD3DUUUUD3DDD3""""UUUUf3D"""""""""U"""3fUDDD333""3U3"""3"""""""""""""D33"""""33"33333D33"3""""33���"""""""""""""�""3""""3"U3""""""""""""""""""3DDf3"3""33UwwU3"""33D"""33"""3"""""""3DDDDDDfUDUDUUUDfUDD"3U3"""3D"""3"""""3333D33""""�""""""""""""""""D""D33333DDDUfwfUUffDUD3""3"3DwUwf""""""""""""""3DU3"""DfDUUD3"""""""""""""""""""""""""""""3DDD33"""""""""3""33"""""""D"��""""""""""���"""""""3U""""""""""""""3333fwffUffDDUUfffwD33""""3333""""333""3"3333DDD3Dfff3fUUUfwwfU3UffD3D3U3""3"""3"3D33"""3""""�""""3""""""""3333DDUDffUUfwfUD""""DDUfUw""""""3""""""33"D3"DUfUDDD3"3""""""""""""""""""""""3""""33DDUDDUUD333"3""""""33""""33�"""""""3"""""33""""3"""��"""""""""""3DUUf3""3UD33DUD"3333""33"3"""3333"""33333D"DUUffUwfffwwfDDUwwwf3DDDD"""""3"3333"""33""�""""""""""""""3"33UUDfwfUDUwwfUD3""3DUffww""""""""DU3fD33wfUD""""""D3"3""""""""""""""""""333333"""33DUUUU3DDUDDD3"3"3""""""3"3"��""""""""""3333""DD""3"3U"""""""""""33DDUwUD""""""D3""33"3"33""333"3""3333333333333DDDUUf3"UwwwffwwwwfffwwUDDUU""""3"""33"3333""""��""""""""""""""DDDDffUUUDwwwwfUD3"3DDUwf3""�"""""3"D3""DUDDUwU33"3""""3"3"""""""""""""""3"""""3DDDD3DDDDD"33""3""333D3""3"""""3�""""3""""33""DUUUD333DD""""3U33"""""3DDDDDDUUDwwD3""""""D""3""3333"""33333""""3333""""""3DDDUU""fUUfwfUffDUwwwwff"""3333"""3D3""3"""""""""""""3UD3"UwUfUUfwwffUDDDDDf"""�""3""3""""3ff3DfUUD3"""""""3"""""""""""""""""""3""3333""""""""333"""33""""""33""""""3"""3""3DfUD3"""3DDD3"""UUDD"""33DfwwwfUfUUfUD3""""""3D"3"""333DD333333""""33D3333"""""33DU""fwfffffDUU3DUUwD333333""""3D333"""""�"""""""""""333fU3"DwfwfffwfUUDDUUU"""��""""UU"DUfDUfD3D""""3"""""""""""""""""3"3""""""""333""""""""""3""""3""""3""""""""""""3D3"3""333D3""3D""""3DU3UfwfUfUD3D3""""""3D3"3"33DD33333D"""""3DDD3""3""""3DU33"3wfUUDD3DDUUww33""""""333DD""""3"""""3"""""3""""3fwU""33wwffffffUffUUfw3"""""""D̻fUDfDDD3"33""""""33"""""3""""""""""""""""3"""""""""333"""""""3""""""""3""""3"3�""""""3""""""""3"""D33"3D3""""""""�""33DD33UDD3"""33""""""D333"DDDD33DDD""""33DDDD33""""DDUD33"DfffUDDDD3DDUfffwf3U"""""333333"""3""""""""""D""3ffD"3"3"UfwwwfUffUwUDwwfww""�""�3fwfffUUfwfU3333"""3"""""3""""""""3""""""""""33"""33D33"""""""""""3""""""3"""""""""""33DD�"3""3D"""""""3""""""""""33�3DD3""""""""""""33"33"33"""3DDDDDUDUDDUUD33"3DUDUUDD3"3UUU33UDfDUfUD33333DDfffffDU""""3"3D3D"""""3""""3""3333"3D""""Uwf3"""3""fwfwwwfUUUffUfwfw3"""�D"""�"wwfwwwfD333"3"""""""""""""""""3"3"""""""""3""""DDD""""""""""3"""""3"3"""""""""""""3DD3""""3""""�""3""""""3""D33""""""""""333"""""""""DD3"UD33UUUDD3DUf3UfUDD3""""3UD3"ffUUfUD333DDUffwwwwwD3""""333D""3"""3""Uf3Dff""""3"""""3""""DwD""""3D3D3UwwfUwffffwfwffUD"""""3"UwU3DfwfUDDDD3""3"""""""""""""""""""""3""""33""33D33""""""""3""""""""3DD""""""""33DDD""""""""""""""""""3""""33"3D"""3"33D"""""�"""D3"�UUffDDD3"DwfffUD"""""3DD3"wfffUUUUD3DUDUUwfwwffU""3""""3"""33"3"""""DwwfUf"""""""""""""3wf3"3""""""D"UD""wwfDwwwwwwwff"""3"""ffD333DDUDD3333""33""""""""3"""""""""""""3"""3D333""333""3""""""33"D3"""""""""3DDDUwD""3333Df"3""""""""""""""""3""""""""333"3"""""""""�"""UDUUDU3"UfUffUD""3""DfwfUUUUUUUDUUUfwfwwwffU33"""""33""3"""""3Dff33U""""""""""3UUU3""""""3"D333""3UwwwwwffffUUD3"""""3wD3"""333D3333""333"3"""""""""""""""""""3"""""""""3"""3"""3""""""""""33"33"3""""3DDfwwffD3DUUffDU3""""""""""""3fU"""""""3"""""""""""3"""���"�""3DDD3DU""wwwU333"3UfwfUUUffD3DDUDUfwwwffwwUwwU3"""""""3"33"DUUU333"""""3"33Uf333""""3"33"""DUUwwwffwffUUD3"33"""""""DD3"""""33333333""D3"""""""""""""""""""""""""""""""""""""""""33""D""D3""""DDDwUfwfwDUfDwUU3D""""""""""""""""33ff3"""""""�"""DUD3"""""""33"��������""DUUfffUfUDfffUDDfwwwfUwUwfDUUUDDDDUUfffffwUUwwwUUUU3"333"""""3fwDU3"""""3D"""""3U3"3""3"33""3""ffwwffffDwD"""""""""UD3""""""333"""3"""3333"""33D3""""""""""""""""""""""""""""""""33"""D"""3""""3DDUwUUUUUUDDUwwwUUw3"""""""""""""""""33U3""""3""""DfU3"""""3""333���������3"3fUfUfUD3"""""""""3DDUUffUfwfDwwwffwwUUUUUUfUUfffUUfwUUffww3""""""""3U33"""D3Uwf"""33DUw3"""""""3333""3333UDwfffUffw"33"""""""3DU"""""""3"333""33""""33"3D"""""""�"D"""""""""""""3"""""""""3"33""3""""""""3DDDU333DDDDUUfwwfwwfww3""""""""""""""""333DD"""3"""""""""3wU""""33"3"""���3"DfUD3333"3"""""""""3DDDDDUUfUUU33UffDUfwffUfUUffwwUfwwfUUfwwD3"33D"33fwffwfUUDUD3ff"""""3"3"33333"3"3D3DDwwfffwfD3"""33D""w̙U""""""333"3"""""""3""3""""""""DU3""""""""""""""""""33333""3""""""3D3DDU"""""3DDUUffwfwfw3"""""""3""33"""3"33"""3DD"""""""""""3""""""D3"3D3""��������"""U3""""3"""""""""333DUfUUUUD3"3f33D33wwffwUfD"UfffwfwwfwwfUwf"3wwUDffD3333DD""""3D""""""3"""3""3333"33DUwwwwwww"33333D"3̻fD"""""3"333"""""""D�"D"""3""3""D"3""""""""""""""""""""""33333""33"""333DDDDf3""""33DDUUUUfUfw3""""""3DDD""""""3333D3"""""""""""""""""""""33U"""�������"""3"""DD3""""""""""""3DDUffDD33""3""3333fwfD""UfwwwfwwwffDDffU3DDwfDfUUwf"""3D"D33"""33"""3""""33333D3DwU"33""3̻DUU""""""33"33"""""""33D"""""""""""3"""""""""3"""""""""""""""""""""D3""3""""33DDDDDU3""""3333DDUUfffwfff3"""3"DDUD"""""""33"3"""""""""""""""""""""33""3""�������""3"3D3"""33"""""""3Uwf3"3""""""33333Dw""""33wffwwwffDfwwffDUUUfffwUDfwD"3""3DD3""3D3D3"""""""33"333333wU3D3D33̻w33fD3""""""33""""""""3D"""3""""""""""""3"3""""""33"""""""""3D""33"""""3D3DDDD3D3"""""3"33DDDUfwẅ3""33D3DD3""""""3"""""""""""""""""""""""""33""""""�����""3"""""UU"""33""""""""""3w3""""""333"33Dwf"""""wwDDUUwwwwwDDD3DDUwfffDffD""3DUUDUUUDDf3"""3"""3"""D3333f33DfDf̪33Df3"333""""""3"""333f"""""3333"3""""""""3"3""""""3"""33333""""""""D3"""""""33DDDDDUUD3D3D"""""""3DUfww"33333""3D""""""""""""""""""""""""""3"3""""������"""""UwD""33""""""""3U3"DwU""""""33""DfUw""""3fwfUUDDDUf3DDwwfU""DD3"DUUfDUDDUfUUDDfwUUDDDDDDD"3""33"3""33""3"D33U3"Dw̻ffUD3""U33UDD33D3""3333"""""3333"DD""""3D"�3"3""""""""3""DD3333""""""""D3"""""""""DDDUDDD"3""33"""3U3"33DDDUwwww3"""""3U3""""3"33"""""""""""3"""""3"""""������""""3fUDDD"""""33""""""""""UU""3Uf3"33333"3333D""""""""""3U"UU"3""UDwUwU"D3""3D333DDD3UDUwwU"DUDfUDD333"D3333DDDDD3333"3"D"33U33fUD333DD"""""""""DDUD""""""3""""""""3""3"""3"""3"""""""""3DD33"333"3D""""""3UDUUDU""3"""3""""DD"""333DDfwwww""""33"""3fw3D3""""""""""""3"""""""""""���""3Uf3"3DUD33D3""33""DUf""3fD3""333""33UwD"""""""""333D"3""Uf3"fD"33"DDUD33"33D3UUU3"333"3DDDD33"D33333"3DD33333""""3D3Dw̻wUUD3"3Uf3"""""""""""""3"""""33"""""""""33"""""""""""""3DDD"""33"""D""""""33DUDUD3""3""""""3""""""33DDUwwwwwU""33""3DDUU3"3""""""""""""""""""""""�"3"""3wfU3""33333"""""3""""3333"UD3"333"""3DUD""3"""3333333333"""33D33"333""""333Uf3""333""3D3333"D3"33"3333"333""3"33333݈D33333""33""""""""D"""""U3""""""""""""""""""""""""3333"33"""3""""""3"DUfDfD"""3"""""3""""""""DDUfffwfffw3D333D333D3"""""""3"""""""33"""""""""�3"�""��UfUD3""33"""""""3""""""""""""""U3333333""D3"""""3"""33D"""3"DUD""""3"""""33DD""""""""3333D3"3D"DDDDD3"33""333"3D33""fݙwD3D33"""""""""""""""""""""""3""""""""""""""333DDD333"""33"�""3333UUfUU""D3"""""""""""""333DDUUUwwfD33""333UU"3""""""3"""333"""""""3""""3333"""""""�""ffD3""33"""""""""""""""""""""""3f"3""""""3DD""""""""3D""3UfD3DU3""3""""33UD""""""""33""""DD333DDU3"3"""333"333"3"D̻wUDD3""""33""""""""33"""""""""3""""""""""""3"""""��""333D"D3"D"""D"""33DDUffU3""33""""33"3"3"3""""33DDUUUwwfUww333DDfwf3DD3UfU""""33""""""""""3DD""U""""3"""""""�DfUD3333""""""""""""""33""""""UD""""""33ff"3""""""3"""33"3UDDDUD33"DD3D3"""""33DU3"""""3"3""""D3DD33DD3"""3333""3"3"3"UfUDDDD333"""""""""""""""""""""""""""""""""""""""""���"""333D333""""""3"""33DDDfD3""""""""D3""33"""3""""3DDDUffwwUU"""""3D333DwwwfDUD3""33""""D33D3"33""""33"""""""ffUDD3"""""""""""3D""""""w"""""""""Dw"""""3""3""DD3D33DD3"""""""333333""""""3DDD"""""3""""""UD333D3D"3333"""""3""DDw3DD3DDDDD""""3"""""""""""""""""""""""""""""""""""""""�""3"3"33"""""3""""33DUUD"""33"""3"3""3"""33"3333DUUUwwff3"""3D"""""""""""""�"3"""D3"3"3""""""""""ffD333""""33""33""""DU""""""""Df�"""3UDDUD"""3D"D3"3"""""""""3""3DD"""""33U"""""""""""3DDD333D33"""""""33""33U33DDD3UfUU""""""""""3"""""""""""""""""""""""""""""�"""3"""""""3""""""3DDUwD"""""""333"""33D33""D"3333DUUfDUDD"""""""""""""""""""���"""""""""""""""""UfU333""""""3"3DD3"""""D""""3Uf33333D"3UUD3""3DD""""""""""""33"D""3U3"""""""""""DD3333333"""33""33""UD3"DDDDDDUDD3""""3""""""""""""""3"""""3"""""""3"""""3DD""""�"3DUw3"""""""""3""333D33333"3"33DUUUwfUD3""""""""""""""""���"""""33"""""""""""3wfUD33"""""""""3D333"""U"""3DUUDfDDDD""UUfwwUUD"""""""""""3""D333UD""""""""DD333DD3"""""""""3""Uf"3""33DDUD3"33"""""3"""""""""""3"""""""D""3D3""""""�"""""""3"3UfwD"3""""3Uw3""""""DUD"""3"""""3333"33D333DDDUU"""""""""""������""3"""""""3""""""""""""""""""fUD333""�""""""""3"3""""""�wf3"""3DDD3D33D33"""U3DfD3""""""""""""""""3""""3DD"""""""""U333D33""""3""""33Dw3"3DDD"33DD""D3""""""3""""""""333""""""3"3""""3"""�""""3D""3""""3333"DUfU"""""3DDUDD""""""DUD"""3"333""3"333DD3D33DUDDffUD""""""����"""33""""3""""""""""""""""""""DwffU33""�"""""33""""DD3"3"""UDD333"""""""3D3"3D3D3""""""""""""D3"3UD""""""DUUD3""3"""""""""UwfU"""33"33DDD33""""""""""""""""""""333"""""3D3""""""""""""""33"""3""3""""""3DDDD""""DwD"""3DD3"""""""33""""33"3"33DDD3ffD3"""""�3""""""3"3"""33"""""3""""""3UwD"3"33""""�3UUD3UfwwD333"UUD3"""""D""333UD"""3"""3""""""""""3DUDDU3"""""DDUD3"""""""33"""3ff3"""""""3"DD3D333"""""""""""D3""""""""""3""""333""""""""""""�""333""3333""""""""""""""3"3Df""333"""""""""""""""""""""""3DDDD3DD3"""�""""""""""3DDDU3333""""33""""33Dff33""33"""""""""""DUwUfwf3DUUD33UwwUD3""33""33333DU33""""3D"""""""""""""33UfU""""""""DD3fU"""33""""DfwwU3"""""""""3DDD3DD"3"""33""""DD""""""""""""""""3"3""""""""""""""3333"""""333""""""""33DDfD"3D""333"""""""""""""""""""""3D3DD"D3"�"""""""""""D3UUD3"""33333""""33fwD333"3""""""""""""""3DUfUD33333DDDUD33""""""""333333"3""�"DD""""""""""""""33DUD""""""33"DDUU"""""D""UwU3"""""""""""3DD33""D3""3"3""""33"""""""33"""""3""""""""""""""3"""""33""""3"3Dwf""D33"33"""""""""""3"""""""""3"DD3D3"""""""""3""""""333"3""""3333""""333Dww33333333"""""""""""""3DDfwD"UU"""""33""""""""""33333333""33""""333"""""33DDD3"33""3UDDDD""3"DwDD3"""""""""3DD33D""3U3"D3"33""""""""""""""""""""""""3"""""""�"""""""""33DffwD33"3"3"""""""""""""""33"UDDD3"�"""""""33"333""Df"""""""333"""""33Uw33333"33"""""""""""""""333DDUDDD""""""""""3"33"""3D"33"3""""""""""""""""""""""333DDD""33UUD""33"3UwwU333"""""""33DD33D33UU3""""D3""""""""""""33""""""""""""33"�""""""""�"Uwfw""""""""33"""""""""3333DD"�""""""""33333""Df3"""333DD3"""333UUD33"3333""""""""""""3""""""3333DUD""""""333"""3333333""""""33""""""""""""33333DD""DD333DDUwfU"""""""""""""""DD3DDD33DD3""""3"""""""""""""""""""""""""3"""3""""""���"f3"3"D3"""""""""""""3UDD"3""""""""""3"3"""""""""""""""""D""3DDD3D3"33DU33"333DD3"""""""""""""3"""""""3D3DUDD""�"""""""""3"3"33"3"""""333"""""""""""33""33DU3333"33"Uww33""""""""""3D333DD"33"3"""3"3"""""""""""""""""""""""""""""�"""""""3"DU""33""""""""""""33D"3D"33""""""""""""""D"""3"""""""""3333D3333UUDff33D33333"33""""""""""""""3"""""33DDDw3�"""3"""""""33""""33D3D"3"""""""""33""""""333UDDD33"3Uf3D3"""""""DD3333D3""D3"""""""""""""""""""""""""3"""UD333""""""3DUwD""""""""""""""UDDDD"3""""3""""333D""3""3""""""""""�"D33D3""3DfwUDDDD3333333"""""""3""""""3"""""""""33DUUD"�"""""D3"3333""3D3"3D""""""""""3""""""""""""""3DDUf3"Dw3"""3D"""""3D333333""333"3"""""3""""""""""""""""3""3"""D3UDDD"""""""""33w̻D"DD""""""""""3DDD"""""""33"""""3333""""3D33""""""3""3Uw3UDDD33333333""""""""33"""""""""""""""33DwU33""""D""3"3""""33DU""""""""""""""""""""""""""""""33DDUD""fD3"""""D"""3333333""""33"""""""""""""""""""""D"3UUDD33"""""""""""�"3fD"3D"""""""3DD3""3""""""333""""""3"""333U3"""""""""3fwDD""333D3"33"""""""""""""""3""""""33DwU"3"�"3"DD""""3""3"3""3D3D"�""""""""""3""""""""""3DDf33ww3""""""3D"""3333333"""""3"""""""""""""�""""3��"33333333"""""""""""""3UUf"�"3U"""""""""33DUD3U33"""""""""333"""""DUUD3"""""3""��"3fU""3"333DD3""""""""3""""3""""""""DfD"3�3"33""""33"3"3"3"33DU"""""""3D33""""""""""3"33DUDUfD""3"""3"33""""""3333""""""3"""""""""""""""3U"�3D"""3""3"""""""""3DU3�333Uf"�"""""""""""""3333D3DD33""""""""333""""DUD333""""""""3""""""3fD""""UD"3D"""""""33""3""3"""""3"""Uf��D"�""3D333"33DD"""333"3333"""""""""""""D""""""""""""D"3DDwf3333"""""3333""3""3"3"D3"""3"""""""""""""""""3����""D"""""33""""""""333D3�"33DDfD"""""""""""""""""3""33333"D"""33"3""wUUD3D3"""""3""""""Dwf""""3D3333""""""33"33""""""""""3""ff�UU""""""""D"""3UD3333""3""3"""�"""""""3"""""""""""""""""""33Df333""""""3""33"3""""""33""""""""""""""3"""�""""��"""""""""""""3333"��""3333DfwD���""""""""""""D3"D33UUU33DDUwfD3DD""""""""""""""""""""DwU"""""""33"3333"""33"33"""""""""""3Df��"3"3D"""""3U""333333"""333""""�"3"""""3""""""""""""""3"3fD""""""""""""UD"3"""""3"""""""""""""""""""3""""33""""""""""""""D"D"�""3333DDUUwU""UfD"3""""""""""3""""""3DDUDDfUf3""DDD3""""""3"""3"""""""""""3"3UU33D"33U333"""""DD"""""""""""DUD�""""""""3""DD"""3""33"""D33"3""��"3D""""""""""""""3""3UD""""""""""""""D3"33""""33"""""""""""3"""""""""33"""""""""""3"""""3D�""""333DUUUDUwwwfwwwfUUwUDUD3""""33"""3"DUDUU3UDD"DUfwfDD"""""""""""""""""333"3wUD3"""""D3333"3333DU"3""""3DDU""""""""""3"""DD333""""3"33"""""333""3""""""""""""UfwUD"333""""""""333""DD"""""3""3""""""3"3"""""""""""""33"���""""""�"3D"��"3"""""333DDD33DDUU33"33333DUfwf3UwU"�3fU""""333D3DUUUUD333DUfwwU""""""""""3"""3D3"DffU33"""3DU3""33DDD333""""""33DD"�""""""33DDDU3"""""""3""""""""�"33""""""""""""Dwf3UD"3D3"""""33"3"D3"""""3""""""""""""""""""""""""33"""""""��""""""D3""3D3�""""""""""33"3""333""""""""DDfDUw""""33DDDD"DUD"33333"DDDUwf3""""""""""3"33DD"UDfUDD3"""DD3"3DD3D"D"3"""3"DU�""""""""""33DD""""""33"33""""���333""""""""""""""3DDDffD33U3333""""""""33""UDD3""3""33"""""3""3"""""3"""""""""3"""""""""��""3"""""33�"""3�"""""""""""""""""DUDfUUwwDwwwUDDUfffwU3""3333UD"""""33DUUf3""Uwf"""""""""33""DD3ffUfD3"33"""�"UDD3DU3U33D33""DU""33"""3""33"D33""3"""""3"""""""3""""""""""3D"""""3D""""3UfwfD3""U333""""""""""3UD3"""""3D3""""""333"""""""""""""""""""""""3"33""""""�"3""33333"��"""3"""""""""""33Dff3333"DffUDDfUDfUD3DUUfU3D3fU""3DDU3UU""Uff3"33"""""D3"UfUUwUUD333""""333DU33UD33D"""3U��"""""""3""3333333""""""""33""""""""""""""3D""33"3D33""3DfUDDUD3""DDDD3"""""3"3D3""""33DD33"""3"3DD3"""""""3"""""""3""""DU3""�""""""3"�"3D"""333D"��"""""3""""""""""""DDUw3"33"""ffUU33D333U3"""3DUwD""3DD3"U3Dw3D33fD"333"3fwUUDU33""""""�DUUDD3"""""3"""""3""DD3333"""3""333"33"3"""""""""3D"""""3DD3"33DDDUfUD3U33"DUDUDD""""""""3D33333"DDD3""""3"DDDD3""""""""3333"""""3"33"3U3""""33""""""""3""3D""3"3"3D3""""""""""3U3"""""""3""DDUf""3D33""fUU3"333"333UwU"""33DDDfD333UDDDfwU33D3D3ffwwffU""""""""3fUD"33"""D3""""""D3DDDD"""3""3333""U33""""""""""3U"3"33DD3"3""33DUUD3"D33DDU"DU33"""""3D3333333DD33"3"33DUUD3"333"3"""3D"""3"""D"3""""""""""""""""""""�""""DD"""3""3DD"""""""""""""UD"3"""""""D3""""DUUU333UU"3fD333333"D"3DfwwwwwwU"3"3DDDUffUU3UUffDUDUf3UffDDUUUfUUDDDUf3"3""""3fU3333""""D"�"""""33DUUU3""""""""""U33"3""""""""""D3"33DD3""3""33DDDD"""33D3UD3DfDDD"""""UD"33333D33D3DD""3DDUD3333D"D3""33""3D3""""3""3"""""""""�"""""3D"3"""33D33"""""""333""3DUDUfDDUfDDDDD3""""33""""""3f"""3"DwUf""3UfD33UD333333"D""3DUfffffwwwU"33DDUUffwU333UUffDDUDDDUDD333333DDD3DD"""""�"DfDD33"""""D3�"""3""3DUD3D3""""""""3D"3""""""""3"3333DD3"""""33DDD3D3""""""3DDU"DDD3""3UU333333"33Df3D33UDDD33""33"3D"3"""""3D3""""""""""""""""""3D"3""""33D33"""""3"""33333"33Dwwwf3UD33"D"D3333333D3DDUDDwU"""3UfUD"""3"""""DDD333333D3"3DwfUfwwffffwD33D3"UUUU""3333333333DDDDD33""3"3"333""D3"""3DDD3"3DD333""""3D3""""""3333"3"""""�33""""""""""""333DD3"""""3333333"""""""""333DDDD"""3DU3"3D333"3DUUUD3UUDD33""""3DDD"3""""""3""""""3""""�""""""3"DD"3"""33"DD3""""""""""""""33DD"3""3fwwff33D3��"""33""33DDDDDDDDUUUDfD�"""""""UDD33DDDD"�""3UfDUUUfffUUffwfD33ffUD"""""333333"3333D33"""""""""3""3""""DUDD""DD33""""3DU"""""""""""""""""""""""3"""333""""""""""""3"""DD3"""""3DD"3"33333D3D33fD"33DDUDUUDUDDD"""3"3333"""""""""""""""""""""�3""""""""3U"""""33""DD3"""""""""33D33"""3Uwf"""""""33"333""""3UDfffUD"3D"fUUDwfDU3""DUD3DD33333333UffU3"""""33333""""""33"""""""D3"""33U"""3D3""""3Df""""""""""""""""""""�""3"""""""""333""3"""""""333333U33"3""""D"UU"D3333UUDDDD33U"D33DUDUUfDDDD3""3333D"""3""""""""""""""""""""3"""3U""3""""3"33""""3""""33Uf""""""Uw""""33333"""""""3"3"�"DD3wwwwUUD33"""""Dwf"3"""""""3DUD33"""""""""""""""""""U3""33UD""3"3""""3Df""""""""""""�"""3""33"""3D3"""""""""33333""""""""""DDDD3DD"3"D""""3DffffUDUwwwDDDDD"33D3UUfDDDDD""3333333"""3"""""""""3"""""""""3"""""3"""""""""3"""""3"""3UD""""Uf333"""""""""""""3""��"DwwUUDD3"""""""""3Dw"""""""33"""""""""""""""""""""""""""""""DDD"3""3"""DU3""""""""""""�"""""""""""""""""""33""""3333333"3""""""""""D333DD3333""3"""DDDDDUwU3UwffwDUU"3DD3DfUUUDD33""""""333"3"33""""""""3""""""""""""""33""""3"""""""""""""3Ufw3"""3D"3D3""""��""3DUwwwwUD33333""""""3Uf"""""""""33333"""""""""�"""""""3""3D333"""3""3333DUfw""""3""""""""""""""""""""""""""""""333"33""33""""""""33333"DDD3""""""33DDUDDUfwfwwUDDfD3DDDDUffUUD3"""""""333D3"""3"""""""""""""""""""""""""""""33D""""""""""3fff""""""33"�""�""""3fUDD3333333""3333DDUf"""""""""3333"""""""D"3""3"333""33"3DUDUUD3"3fD"""""""""""3""""""""""""""3"""""33"""""33333"""""333""3333DDD3"333""""33DDDD3wwwDDD3DDDD3DDDDUUffU""3""""3"""3"""3""""""33"""""""""33DD"""""""33"33"""""""3DDfUw""""3"""�3�3"����"D3DDDDwf3"""""""3"3"""""""""D""""""""33"""""3DDUf3"333Uf"""333"""""""""3"""""""3"""""""3""""""""33"""""33"""""D333D333D33"""3333D3DwfD3D333DDUUDDDfUUDD""""""33"""""""""""""""""""""""""""""""33D3""""""""D""33"""D33DD3Uf"""3""""""�3"����33"3""f3""""""3""3""""""��"3"""3"3"333D3DUD""DfDDDUfwUD"3"""""""""3"""""""""3"""""�"3"""""""""33"33""""""""""DD333DU3333"""333"33UwU333"3D3DDDUUUfffUD""""""""3"""""""33""""""""""""""""""""3"""""""""DD33"3"""""�"�"3D3DD"3Uf"""3��"""""""""""�""""3UD3""""""""""""""""U3""""""""D3DfwwUUDDDUUfUD3U3""3"""""""""""""""""""""""""""""""""""D"""""""""3333UfDDUDD3333""3"""""3fwfD333"3333D3DffUfUD""3""""3""""""""333"""""""""33""""""""""""""""""""""""""""""3���""UDD33"DUD""�""3"""33"""""""�""333fwD""""�""""""""�D""""DU33333DfUfwUD33""""""3"33U3""""""""""3""""""""""""""""UU33""""""""""3""""""DDDDUD33"333D3""3"""""DwU3"3333"33333DwfUU"""""""""""3"""333"""3"""""""""""""3""3""""""""""33""�3��""D33""3DUfDDD�""333"""""33""""""�""""33wU"3""""�"3w3""""""D3"DDDUwffD""""""""3DU3"3"3"3"""""""""""""""""""3"""3wU"""""""333"3"""3"3U3333333333333"""""""UwwD3""333333333DfwU3""3""""""""""""333"""D3"""""""""""""""""""""""""""""""""""�""����""3U33"33DwfDfU�"""3"""""""D"""""��""""3Uwf""""�""3""UUwf3""""�3U3DUDUD33D""""""33U3""""""""""�"""""""""""""""D3""33"333""""""""33333""333""""3""""""3wf3"""3"3333333Dwf""""""""""""""""""3"""3"""""3"""""""""""""""""""�"""3"""������"3D3333DDUwwf3���"""3""""""""""""""��""33DwU""""�"DwwD""""��"DDDUUDDfDDD3"""3D3"""3DU3""""""""""�"""""""""""""""3"""33"""3"3""D33"333""""""3"""""DfwU"333"33D333DDUwf3""""""""""""33""""""""""""""""""""""""""3""""3""33""��"""3D""33UfUfw3""""""""""""3""""����""333"UD"""�3wwwwwwwwwffffwD"""DwwwffUUU3""3""""3""""3f3""""""""���""""3"""""3"""""""""""""""""DDUDUD3333"333"""""""""""""Dwf""3333DDU"3DD3UwwwfU"""""3"""""""""""""3"""""""""""""""""""""""3""""33"""3"""�""3D"3D33Ufwf3D�"333""""""""""��������""��"""33333D"��fwffffUUUDfUfwwfffffw"3DfDDD3"33333""3"""""""""""DU3"""""3"""""�������""""""""""3"""""""""""""""""3ffDD3"3"33333""""""""""""3Dww3333DUDDUD333DUwwfUD"3""""33"3"3""33""""""""""""""""""""""""""""33""""DU3�"""""3D33333DUffffwD�""""3""D3"""""��������""3333"3U"""33DwfUDDUUUDDDDUUUfffffwfUff3""""""3"""""""""""""""3DD"""3"""33"����������"""""3""33""""""""""""""""""UU333"3""333UU"""""""""UwfD3333"DUUfU33DDUwwUDDUU""""""33""3D"""""33""""""""""""33"""""""""DUUf33""""""""3DDDD3"3DUfwf"�"""""33""""""�������"�""3D3""3wD�"wD333D3DDD333DDDffffwwDD3""""""33"""""""�""DU3""3""33�����""""""""""33""""""""""""""""""DD3"333333"3fwU"""""""""3fww"3"""3"3UfU"33DwwwfDDDUU"""""""""3"3""""""""333""""""""33"""""3"3"""""""""DD3"""3""""""DDDD"3"DDDwf�"""""""""��""3D"3wDw"333D""wwwwwU333333333"33DDDUfffUfwD"""""""""""""""�"33D"""""""""����""""33"3333"""""""""""""""""""3D"333333"3ffU"""""""""DwfD""33"33"DU3"3DwwwwDDDDUU""""""""""3"3"""""""3""""""""""3""3"""33""""""""�"""""""�"""3DDUD""3DDww""""""3"""3""""""��""""""3UUUffUUwwfffUUD"3"""3333333333DUUUUUffffD"""33""""""�"""U""""""����""""333"33D""""""""""""""33""""333""3UUD"""""""""3wU"""333"3U"DU3D3UwwwU33UDD3DD3"""""""""""""""3"3"""""33""""""""""""""""""3""""�"33"""DUfDD33DDU""�""3""""""""""�"""""""�DU33UfwwUDDDD333"""3""""33333DDDDUUUDUDDU333D3DUU3"""""�"fU"""""""��""33333"""3333"3""""""""""""""33"""3"33"3DD3""""3""333U"3333D333UUD3D3UwwUD"DDDD"DDDU"""""""""""333""""""""33"33"3""""""3"""""""�""33""""3UfUDDDDDDD3"""""""3"""""��""""UU"3fUDfUfU333""33"3"""""""""""33DDDDDD3DDUUU3""3"D33DDD3"""""""""�"DwD"""""""""""f""""""33DU"""""""""""""3"""""""3"3D3""""""""333w3"333"3""3DUD3UfwwwU33DDDDDDDUU"""""""""3""33""""""""333"""""""""3"""""""""""33"33""""��"3UDDDDD3DUD"""""""""33"3""������3wU""DDfwUUUU3"""""""""""""""""3"3DDD33333DD33DUUD"3D""""DUD"3fwUU"��DD"fwU3""""""��"""""""3U""3"33UD""""""""""3"""""""""""33D33"""""""3333w3"""3333""333DfwwwUU3"33DUDDDDfUD"3""""""""""""""""""""""""""""""""""""""""""3""""33DD3"�"3D3D33D3f""""""""�3""""""""���3"""ffU3"UwDUUUD33"""""""""""""""DD333""33333"3D33DUDD3"3DU3UUfffwUUUU3"wUDwf3UD""""�""D""3"""""3D3"DD""""""""33""""""""""""333"""""""33333U3"""3333"""DDwwwUD""33DDDDDDUUUUwD3""""""""""""33"""""""""3"""""3DD3""""""D3""""""3"3"3""""3333333f""""33""""UD""""""3"""����"D"�DwwUDUfD""""""3""""""""""""333""""""3"""3"3"33""DD33333wDDUffUwf3UD"""���""""""""""3"""33""""""""""""""""""""3""33333"""""3"33fU33"""3"33""3wwwwfD3""3333D33DUUUfD3""3D3""3"""""""""""""""""33""3D"""""""""""""""""""""33"3""��"""""""3Uf3""3"3""""""33"""""""3U3""����"DU3"33""""DUU"fwwfUD3"""""""""3""""3"3"""""""""""3""""�33"""""3UDUUffwwUU"33""""��"3""""""""3""3"""""""""""""""""""3"3333"""""""3Dww333"3""333""DfwU3"""3333D3"DUUDDfD333DDD33"""""""""""""""""""3"""3"""33"""3"3""33""""""""""""33""""UU"33""""�""""""3D3"""""""�����DUD333"""3UDUfUwwwUUD33""""""""""""""""""""""""""""""""""""""33DDUUwDD"""���""""""""""""33""""3""""""""""33D33"""3"""33fwU"3""33333333wwUD"""""3333333DDU3U3D3DDD3D33"""""""""""""33"3333"""33""D3"3""3""""33"""33""33��"33D3"""3fDU3"DD"""�""""D"DfD3""""""����"3"""""DffUUDffUUDD3"""""""""""""""""""""""""""""""""""33Uwwwwf3D""3���""""""""""3""33UDD3"""""""""3""""""3333""""""""3DfD"3""3"3333"3wwU""""""33"333"333DUUU3D3DDDDU3"""""""""""""3333DD3""33333""""""3"""""""""3""�"333D""DUfUD""3D""�"3UUDwD""3"""""���"""""33DDUUD33UUfUDDDD3"""""""D3"""""""""""""""""�""""""DUfDffffUD""��""""""""""""3DUfUD3"""""""""""D3"""""3333"""""""""UwU""3""""3333DUwf3"""""""DDD333333DDUDDD333UDfD3"""33"""""""33""3""33333"""""333"""3""""""�""33"""DwfD""33"""3""""3UUDU"""3"""""""�3"�"3wUUDDD33"DUDDDDDD""""""U3"""""""3"""""""""""3"""��"""""33DUffUwU""�""""""""""3ffUfDD""3"""""""""33"""""3333"""""""""DD3""3"""3"33"UwU3""""""3D333333DDDDUD""33DUDDD3""""""""""""""""""""""""3"33"""""""""""""""""""""33D3"""""3ffD33"""33"3"""""DfU3"""3""""""��"3wfUfwwUDDDD3"""DUDDDD33"""""""3"""3""333""""""""33""��""""D3UUUUwf""��"""""""""""""3DDUUf3"3"3D3""""""""""3"""""333D""3""""DD""""""""3""33fwf3"""""""DUDDD""33D33D33333DUD33D"""""""33"""""""33""""""""""33"""33""""""""""""""""DDD3""""3D3D"3333333""""3""D3D"""""""3""��UffwDD3333""3DD333333""""""""""""""3""3D33""""""""""""33ff333UU"���"""""3D33333333333"3DDD3"""""""""""""""3"""""""3D3""""""""""""3fwfU"""3"""33DDDD3"3333DD33"3DD333UD33""""""3"""""""3"""""""""""33"3"""""""""""""""33DD33""3Df""D333333""""""""Uf3"D3""D"3""""�"wffD3DD333"3""D3DDD333333"""""""""""""""3333333"""""333"""""�3""""U3""3f""""���"3"""3U3"""3"3"3"33""3UU3"""""""""""""""""""""""""fD""""""""""3UwfDDD3D33"33"DDDDD33333D33333D3"33UD3D3""""3"""""""""""""""333"""3""""""""""�3DUD3D3"3UU3""D33"3"3"""""""""""DUDD3UUUUUU33333"""""3wwUDDD3"3333"3"""3D3DD"33""""""""""""3"""33"33""""""3""""""""3�"33""ff"�����"3DDDD3"""""""""3DU""33DD3""""""""""""""""""""3f3""""""""33wfU"""333DD"3"3DDD333""3DD3DDD33D33DUDUD"""""""""""""""""""""3"33DD3"""""""""""""��""3UUU33DDDDD""""""""""""""""fUUfUUUDUUDD3DD3DDDD33D33DfU33DDDDD33333333"3"333D33D3""""""""""""""33""3""3"""""""3""""""""�""3""DD"""��"""""33""""""""""33""3"DD3""""""""""""""""""DD3""""""""""Uwf"3"33D3D3D33""3333"""333DDUU3D33333DUDDDDD""""""""""""""""""""""3"3DD3"""""""""�"33DwwD"33DfDD""""""""""""""ff3DDDDDD3333D33DD3UUUDDDDDD333DD3333333D33"33333DD3333"""�"""""3""""""333"333""""3""""""""""3DD"""""�""3""""""""""""3"""""""""""""""""""""""f3"""""""""""""33wfU33333D333333"3333333"3333UUfD3D333333D333Df""""3D"""""""""""33333""""""""""""33"3f3""3"DD"3""""3"""3UfUUffUUUD3333333D3"3"DUUUDDDDD333DUDUDUD"333333"3"333DD3"3"""""33"""""""333"""""333""""""""����""""""333D"""�"""""""""3""3""""""D3""""""""""w3"""333""""ffDf3D333"333D33"3""333333"33UUUDDDDDD"3""""""DDD"""""""""""""333"""3"""""""""""33333fU3""3UUD3""""""""DDD""DUfffDDDDDDD33"33333333DDUUDDD3333D3DUUffUD3"""33"3333D333"3""""�"3"""""""333"""3333"""""�"��"""""""3DD3D"""��""""""""""""""""3D""""""""3U3"""""""""""3DwwDDDD"33D3333D3D333""3""33"3DUUDUDDD33""""3UU3""""""""""""""""33"""""""""""33333f"3"3Df"""""3DDUUDUUfUDDDDDDDDD3D3DD333D3DUUUUDDD333DDDUfwfUD3""D33D33333333"3"3""""�""""""""""""D33""33D3""""""""""""""33D3DD"""""""""""""""""3""33"""""""Uf"""""""3fUDD3DD"D3333333D333""33"333DUDDDUUU3333""""""33UU33D""""""""""333"""""""""""""""""3333f3"33Dff3"""""3"DU333DDDUDD333333DD33"3D333D3DUUDDDDDDUUUUUUDDUD"333D3DD333UUD3333333""""�"""""""""""""""""""3333"""3""""""3""�""3�""""""33UU3""""�"""""""""""""333"D""D"""""3ww""""""DwDD3D3D33D3333333D""""3"3"33UDDDDUU33DDDD""""""33DDff""""33"D""""""""""""""""""""""""""""3DDUw"33DUU3DDDUDU""DDUfD3333333""3DD3"""33DDD333DD3DDDDUUDDDDDDUUDD333333DDD33333DDDUUU3"333"3""""�33"""D"""""""""""""""333""3""3"""33""3"33"�"""""""""3DUD3""""""""""""""""�"333"""3"3""""Df""""""3wUDDDD3DDDD3333""3333""""""3DD33DDDDU"3D3DD"""""333DDUf3U3"""""""""""""""""""""""""3DUDwf"""D3UDDwD333UUU33333"""""""""3D3""333DDD333D33DDDDDDDDD33D3DDD33333DDD33"33"DUUfUD""33"3"""""""D3""DwU"""""3"3333""""3333""3""""3""""33"""""""""""33DDU"""""33""""""""""""3333""""""Uf""""""""3DUUDDDDDDDD"33333"33"3"""3D""DDDDD33DU3""D33"3333"3D3DUUUU"3"""""""""""""""""""�""3DDw3""33DwfU""""3"""""""""""""DD3DD3"""3DDD33DD333333D3333333D33333D"3DDD3"3"3DDUfDD3"3333"""""""""""""""3fU""""""3"""""3"DD3"""D"""""""""""""""""DD33"3"""""""""""""""""DU""3"""""DfD"""""""""""""wwwfUUD33"33D33"33333333""33UfUUwfUU3"333UD"33"33"3"333D3D3DDUUwwDU""""""""""""""""3DUwU""""3DUw""""""""""33DD"33""""333DDDDD3D3"33DD33333333333DD33DDD333DUDUfUfD"3333""""""""33"""""3"""3""""""3DDD3"33""""""""""""""""DDDDU"3""""""3"""""""""D"""""Dww"""""""""""""fwfffUD333333D3""3333333""UfffwfUD3""33"33DD3"33UD3D""3UDDDDDDffUww3""""""""""""""""""DDff3"333DU"""""""333"33"33333DDDDDDDDD3D33DUD3""33D3DDDDD33333D"3333UUff3333333D"""""""3""""3""""3D33"""3""3""""""""""""""DDDDD3DD"""""""3"""""""""""""""UUD333""""""""""wfffUUDDD33333"""3""33"""3UfUDDD3""""3"""""33""333DUf3""DD33UUUD33DUD""""�3""""""""""3"33""3DDD3""""DUU3""""""""""3333333D3333DUD3D3DD3DDDDUU3"3"3DDDDDDDDD3333"""3333DD3UD3333"3D33"""""""""""""""D3"3""3""33D3"�3"""""""3DUDDDDD3"""""3"""""""""�UD3333333""""""""3wwfUDDDDDD33D"33"""33D3UfU333333""""""""""3"""3DDUfD3D"333D33333D3ff""""""D3""33D333"""3DD""""33D3""33"""3""3DDUD3"333DD3DfUDDDDDDDDDDDDfU33DU333DD3D33D3D3333333333"3333DDD33""""""""""�"""""""""33D""""333"3D"""��"""""""3DD"33UU3""3""��""""""33""""""�3UU333333333"""""3wwffUUUDD3DD3U"3"""333DDUUD333333"""""""""""3"D33DDf3"3"3D333333D3Df�"""""fU3333"""""3UUD"""""UD""""""3"3"333DDDDwD3DDDDDwfDDDDUUUwwfUwfDUUD3333DD33DDUDUU333333D333""33DD"3""D3"""��"""""""33""""""""DD"�""""""""3333"UDU"""33""""33""""""""""""�"fDD33333333333D3fwwffUUUUUDD3DDD33""""DDUD333333""""""""""""""33D3DDU3""UwUD3333333D3DfwDD3""""""3D33""""""""33DU3"""""ww"""""""""33""""3DUfUU"3"fwDUUUfwDwUUUUfDDDwwUU3"""33333DD3DDU3D3"333333D33333UD"333UU33D"""""""""""3U3""""""D"���"""""""333UfDD""""""33"""""""""�3fUDDDUDDDDDDDDUUfffffUDUUUDD3Df3""""""Dff3333333"3"3""""""""""""3DDDDDwfUD333333333333"3Dwwwf"""""""""""""""�"33DD""""3w3"3"3"""""D3"""""333"3fUffwfDDfUDUUfw"Df3"UfD""""3DDD3333D3"33333D33D3DDDDDD"3DDU3"33"""""D3DD3""�""""3DDfDD3""""""""""D33"D""""""""��UwwwwwwUfUUUUfw""fUUUU33DUUUDDUDD3"""3DfU333""3"3""""""""""""""""3UD3""33"3"333333333333DDfffD�"""""""""�3DD3333f""333"""33"33D3"3""""3fDUU"wfDUUfffU"3UfD""3fU3D""D33UU333333D333333U3""DDDD3"""""""3D"3""�""""3DD3D3"""3""DD3D"3"""""""""����UwfwwfwwUUUDUDDDDDDUUUUDD33""3UUD"""""""3"""""""""""""""33D33"33"3"3333333"33D3DDUUUfUfwD�"""""""""""""""�"DU"DfwU33333"3D3""33D33"""""""3"fD3UwfUUUfwfwf"DfU3"wfD33D3fD33DD3333"3333333DD"33DUD""�""""D"�"""""DDDD33D""""""3fUD""3""""""3"""3D��wfw̻U33DU3DDD3DDDUUf3D3333DU3""""""""""""""""""""""33D3333333"3333333"33333DDUUfUffUww"""""""""""""""""""�"3DU""̻33DDD33333D33D3333""""""3UUfUDDDD33"DwwD33"DDD"DUD"33UDDU3"3"""""33333""3333D3""��"3"3""""�"""3D3DU333""���""3"""3DUD""3""""""333"�3"DffUwf"D333DD333DDDDDUDDD333DD""3""""""""""""""""""""""3D3"3"""3"""33333""3"333333DDUUUUfUwwDffU3"""""""3"""33"3�""ffDUwwDDDUUDDD3333DD333DD"""�""3DDDD3D3D33333ww""3Df3"3333DD3D""33"""""3DD33333333333""""""""""""3"3"""""""33D"D"""3��"33"""""3D"D3D"""""""""�3wDUU"""3f"3UD3DDDDUUUUUUfDUfD333DD33"""""""33"""""""""""33333"333""""33333"""3333333DDUUUfUUUfwfww""""""""""""""3"��"̈wfDẅUUDDDUDDD3DDD3D3D33U3"3DD"""33DDDD3""33fwwwD""""3Uw33333333DD"""3"""""""3D333"3333""""""""""33""""""�""""""""Dw"��"""""DUD333"3D3""""3�DwDUUfUDDU"3U"""UUDUUDffwffwwffffU33DDD33""""""""""""""""""""""3333"""""""3""33""""3"3333333DDDUDDUD33Dff"""""""""""3U̻DDwwUwUffDDUUUUDUDDDDD3D""""""""""333""3"3fU3"""""UwD333333DDD3"3D3"""""3D"333D3""""""""""""DD33""""""""""""�3""3D33DUUw3"""""33""3""""""Uw3Df3DDUD3"33"D3D3"UUDDUDUfffwwwwffD3DD333""""""""""""""""""""""33"""""""3""33333""3"3"333333333DDDD3333DDfU"""""""3""""""3"f̙DD3UUfwffwwfDDDUDDUfwwfwUUD"""3""""3""33""""3DUw3333"""DUfD33""333D3333""""333333""""""""""""""""""""DD3D3"""""""""""""""""""3DDDDDUw3�""""""""""""""""""�"fw3Dww"D333""""D33DDUUU"DUUffwwwwffUUUD"33"""""""""""""""""""""D33"""""""33"333D""3""""33"3333"33333333333UwD"""""""""""DD"Df3D3""""Dff3UD3U3�D3D""""""""""""""""""33DUfD33"""333D3DUD33333""""""3""3D3"""""""""""""""""""""""3DUU3D333"""""""""""""""""3""�"""33DUUUww"�""�""""""""""3""""DD��Dfww3"3"""3"""""3DD""DD""DD33fwwwfUfUUDD3"""""""""""""""""""3D33"""""""""""""3"""""""""""""""""""""""3DDDfwf""""""""""""""DD3"fwD3"333"""""D33DfDffD"""""""3""""""""333UDDDUf33D33"3"DfUfD333"3""""""""3333""""""""""""""""3333"D333333"""""""DDUU3333333"""""""""""""""""""33Dfff""""""""""33"""""""̙w3�""3UU"""""""""3U33"""""DwwwwfffffDD3"""""""""""""""""""3D3"""""""""""""""3"""""""""""""""""""""""33333Uwf3""""""""""3DD3UwffwfDD"3"333""3""333"""�"""""""33""""333D3D33DD"D33UfUfDD33"33"""""""""33""""""""""""""""""D333""3"3333"""""""3UffD"""3D3"""""""""""3"""""�3""""33Dff3""D333"333""""""""""""""U̻33��"33D"""3D3""""33D""""""""3""DwwwwwfUwwDD3""""""""""""""""""""3D33"""""""""""3"""3""""""""""""""""3333DDD""""""3DDUUUfwUfffD333333""333333333""3"""""""""""""""DD3"""33"33D33DDw3D""""3"33333""""""""""""333"33"3""3"""""""""33"3""""3DUwf"""""3333""""""""""""""""33"""""3DfU33""""3UD33DD3"""""""""""""3""3"""U3"""333DD3"""""33"""3fUwwfwwwwUD33"""""""""""""""""""DD333""""""""""""3"333""""""""""""""""""333D"""""""""3DUUUwwUUUfffU33333D3333D333""3"""""""D""""""""""""""""DU""""3"""""DDUf"""""3333DD3333"""""333"3"3DUUUDDD33""""""""333""""""3Ufff""""""3"333333"""""""""""""3""""""""3fD"""""""3"3DDDD3D3"3""""""""UU3""""""3333UU3"""""33"3UUUDwfwwwwfDD33""""""""""""""""3DD3D"3""""""""33"""3"3"""""""""""""""""""""3D""""""3333DUwwfUUff3UD33333D33D3D3""""""�""""3333""""""""""""""33"""""DUUw3D3"33DD3DD333""33""3""3"UwU33""""3D"""""""""333"3"33DffU""""33"3333333333"""""""""�"""""""DU"333""""""""3333DDUDUU3""33"""""3f"�"""""""3"333Df3"3"33"3UfDD333DfwwffD3"""""""""3"""""""3DDD3333"""""""3"33333""""3""""""""""""3UU"""3""3DDDffUUffUD"333D33D333333"""""""""""33D3""""""""""""""""""""33DUUD3333333333333"333333""33Uw3""""""33"""""""""333DDffU"""""33"333"333333""""""33""3"""33D""3D3""333"""33""3UUD"""""""U""""""""���"""33DDDwU"33333UUDDD33DD"DwwDD3"""""""""3"3"""3DDDD3"3"""""""""""3UD""33""""""""""3DUU"""3"""33DUfUUUUUUUU33DDD3D3333"""""""3"33""""""""""""""33""33UfD3DDDDDD333DDDD3D333D33UUffD"""""3DD"""""""3333DUfU33"33"""""33333333"""""""33"""""""333"""33""3"""""""""3Uw3""DDf3""""3""�����"""3DUDff33333UUD3DD3DUD"3DfU33""""""""3""""""DUU333""""""""""""""""DD3"""""3"""""""""""DDUffU"""3333DUfUUUUDDDDD3DD3DD333"""�""""""""""""""""""""3333333DDUUDUD33333DU333"UfDDDDD3D3"""""3"""""DD33DDwD"D333"33"33333333"""333""333""""�""3D3""""33"""""""3"Dw3UD�UU3"33D"�����"""3DUDDfD33DDfU33DDDfU3"33UD3""""""""3"""3""""DDD""3""""""""""""3"""33D"""""""""""""3"333DffU"�"""""333DUfUUDDD3DDDDDUD33"3"""""""""""""""""""""""33""33333wwUDD333"33""""33333"3D333""""""""""""""3D33DUwU""Df33333"""333333333"""""33"3"""""""3DUD""""33""""""333UD"UwDU""""""33""��"""3DUfDfU33DUfD333DDf3""3"DU"""""3333333"""""3UD3"""3""""""""""3"""3D"""""""""""""""""""3"3DDUDffD3""3DDDUUfUUU3"DDD3DDUD3333""""""""""""""""""""""""""33333"3DwUDD333""""""""""""33"DDD3""""""""3""""333UwU3""3UfD333"3""333333333333"3"33""""""�""DU3""""""""""33DD3"""ww"3D"""""3D33"""""3DUffwD3DfUDDDDDfww"""""DU3"""333""33"3"""3D33""""""""""""33""""3"""""""""""""""DD333DDDUfww�"""""33UffUffUUU"DD333D3DDD3""""""33"DD""""""""""""""""3"33333D33DwUDDDD33""3"""""3""333DD33""""""""""3"""""""""DwD"""3D33"""3"33D""333"33333"""D3"3""""�""3U3""""""�"""33"U3"""f33D"""3"UD3"""3DDUwfUUUUffUfU"""3UfU33"""33"33"""""D3""""""""""""""3333"""""""""""""""3""3333DD333DUfDfw"D""""3DUUUUUUU333DD"3DUDD3""""""33"""""""""""""""""D333"""""DDUUU3"""""""""""333D3"""""""""3"""""33"3U"""""3ffD33D3D3DD3333"3333333"3333""""""""""D""3""3"""""3333""""""""fw3""UD""""3UU3"""""""3DUwwwwwwfUfwf"""3wwDD3"""33"""3"""""D3""""""""""""""33"3""""""""""""3D3""33DDDD33UUfUff"""""3""""3D33DDUfUD333"3UUUD3"33333"""""""3"""""""""""""""""""""""3D33"""""""""3D""""3""""""3D3D3"""""33""""""""33D""""""33fD3333DD33333"3D"33D3333""""""""3""""""3""3"""""""""3wwD""""""3f3DUD3"""""""33DDUfwwfffwUUUUwwD""""3fwfDD""3333333""""3U3""""""""""""DDD333""""""""""3333333DDDDDDDDUUw""""""""DD3DUUD33"3D3DUUD333D3""""""""""""3""""""""""""""""""""""""""""""33DD""""""""""33""""""""""""3DDDD3"""""""3""""""""""""""3333""33"DD3UUfUD33333"333D3D33D"""""""D3D3""""""""""""""""""UU"""""fD""UUD33""""33DUUfwUUfwUUfUDDDDww3"""""fwfDD333333333""3"DU333"""""""""""DD33"�""""3"""""""""33"3D3DD3D3DDDfD3""3"D33DUUD3333"DUUDD3"33"""""""""""""""33"""""""3"""""3"""""""""33DDD33"3""""""""""""""""""""""33DD333""""""""""333""""""""33""33D3""33DDDDD33333"333"3333"""""33DfU3"""""""""""""""""UD"""""""DU33UUD3333""33DDfwfDDfwwwD3DfDDfU"33"""DwwUDD333333333""3DD33""""""""""""33""3""""""""""""3"""333D3D333Dfwf3"""3"333DDD333""DU3DD333""""""""""""""3333"3"""33"""""""""""""333UDDD3"""""""""""""""""3D3"33"3""""""""3"DD3""""""""""""3DUU3"""""333DDDD3""3333""3333"""""""""3Dfff"""""""3"""""""""�D3""""""""wD""DUDUD3D33D33DDUffwffwfDDDD3DUUD""3"""fwwfDDDD33333"""DUD""3""""""""""""""3""""""""""""""3333D"3"3333DUUUf3""""33D3333""""33DD3333"""""""""3D""""""""3333""3""DD33"3""""""""""""33"3UD3"""""""""""""""""""333""333"3"""""""""""D33""""""""""3D3"""""3"D3DDDD"3""3""D3D3""""""""""""3UDDU3""33"""""""""3"Uݻw""""""""UU""UD3DD3333DDDDUDDfwUUDDDDDD33Uw""""333DffwfUUUD3333"""fD""""""""""""""""3""""""""""""3333"D33333"""DDDUU""""3fD"33"""""3"3DUDDD333DU3""""33""""""""3D333""3"""33""3"""""""""""3fD3""""""""""""""""""""""""""33D3"""""""3"""""""""""""3""""""333333UD33"333D33"""""""""""""3DDDDD3""333""""""""3""""""w""""""""w33fD""""3DD3DUUUDffD33DDDD333DDUU33"3""DDfUUUUUDD33"""Dw3"""""""""""""""D""""""""""""3""""D"33"""3333UUf"""""3D33"33""""""33D3DD3"33"""""""""""""33"333""""""33"3"""""""""""UD3""""""""""""""""33"""3""""333D3""""""""""""""""""""""""""""""""3333333D3"3"333D3333""""""""""""DDUUDUU3""3""""""��"""""33"""UݻD"""""""""wUwf3""""3DDDDUUfwU3""333333"3UU333333333"UDffUDUDDD33"3Uf3""""""""""""""3"3"""""""""""""""""""""""""""3DUwf333"333DD333"""3"3""33DDD3"""""""""""""3""""3D33DD3"""""""""""""""""""""3DD3"""""""3""3"""""3UD""D"""""3""33"3""""""""33""""""""""""""""3333333DD333"D3D3"33333""""""""""""D3DDDDU333"""�"""""3"""""wݻwD""""""""UDwD33"""3DDDDUD3"""""""""DU""33333333D3UUffUUDDDD33DfD3"""""""""""""""3""""""""""""""""""3""""""3""33Uw3Uf333""""""33DDDDD33"""""""3""""3DDD"""3DDff3""""""""""""""""""UU33"""3"""""""""""""33"33"""""""3D33""""""""""""""""""""""333DD3""3DD3D33333""""""""""""3""""DD3fU�""""""""DfݻU3"""""""3UffU3""""""3DfwwU""""""3UU"3333DDDD3DfUwfUU3333UUU33"""3"3"""""""�""3""""""""""3"""""3"""""3"33"333UwwffD3"3"""""3"3DDDD33""""""""""DUU3""3333""""""""""""""""""3"UfUD""33""""""""""""""""""3"3D3D"""""""""""""""""""D3""333D3"3DDD3333D3"33"""""""""33"""""33"U3""""""3"D3̪wfU"""""""DffD3"""""3wwfD""""""""DUD""""D33DD3D3fffwwwU"3UwfD"3"""3"33""""""""""3""""""""""""""""""""3"""3""33333DUfwwU"33"""""33"D333"3"""""""""""D3""""3""""""3"3"""""""""""""""""""3"33DDD""3"""""""""""""""3""""DDD3""""""""""""""""3"3U333"3D3"333333333D33""""""""""3"""""D3DU""""�""""""33DDw̻wwUwU"""3"33wwD33333"DU""""""""""""""UUD3"""3DDDDU33UffwfUUwUwfD33"D""""33"""""""""""""""""""3"""""""3""""3"333DDDUUUUD"33""""3"333DD33D3"""""""""33""""""3"""""3"33333""""""""33D"""333333333D3""""""3"""""""""""""""33333"""""""""""""D33D3"33"3D"333DUU3"""33""""""""33""""""""33DU3"""""""""333DwU"333333ffDDDD3Ufw""""""""""""3fUDD3""""3DUDUUD3wfwwUUffUDD333333"33""""""""3"3"""""""""""""""""3"""""333333333333DUww"3"""""""3DDD333""3"""""""""""""""""""""""3"""3"""333DUwwfwwwUDDDUUUDDDDD3""3"""D3"3"""""33"""""""""333D"""""""""""""""3""""""DDD3""""3D3""DD33UDD333"3"33""3DD3""""""""""3Uf"3""""""""33DfD333333fUDUfUUU"""""""""""""3UDDDDDD"""3333DUUUUwfwwU33"3D333333333""""""""""D3"""""""""""""""""""""""""""3333""33DDUU3333"""""33"3"""""3""""""""""3"""""3"""""""""3"3333DDUUUfffwUwwwfUDD3333DDDDD"""""D3"3""3""3"""""""""3DD3""""""""3"""""""""""DD""3"""U3"3UUUUwfUfUD33D"""3DUUD""""""""333DUD"""""""""33DÜfD"333DDwwfUU""""""""""""""3wfD3DDDD333"333UUUUUUDD3"""DUD33D3333333"""""""""3"""""""""""""""""3333"""""33""""3"33UUD3333"""""""""""""""""""""""""3"""""""""""3D33""333"3333DDUUUUUUfwU3DUDDUfDUUD""""33"""""3""""333DDD33""""""""""""""""""""DU3""3""UD"3DDUUUDDDDDUffUUUUUU3"""""""""""333D"""""""3DffwwUU33DD33wfw3""""""""""UwfwfD3UUDDDDUUDfUDDfwUD3"3DUD""3333333""""""""""""""""""""3"""""""""""""""""3"""3D3""""""""""3333UUU333"""""""""""""""""""333"33D33"3DUffUD333"""""""333DDUUUDDDD33DD3UD3DD"""""""""""33DDUDD333""""""3""""""""""3D"""3""UwDDD3DDD3DDDDDUDDDDU33"""""""""""""333D3"""""""33DwffwwwD33333fD333"""""""""wU33DfwfDUDUDDUUUUUUffUD3"33D33"33D333""""""""3""""""""""""3""""""""""""""""""""""3D"""""3"""""33DDD3D"333"""""3"""""""""""33UDDDD333Dffwf3D""""""""""""333DDD""3""""""""""3""""""""""""3DDDDDD333"""""""""3"""""""""D3"3"3"fffU3333DUU3D3DD3DDDD"""""""""""""""""3333D3"""""333UfffwfU333DÜ33333""""""""""""3f""3DDUUfUDDDDUUUDDwwwUU33"333D33333333333"""""""""""""""3"""""""""""33"3""""""""DD""""""""""3DDD3"D"""3""""""""""""""""""33"""3DD333DUU33UD3""""""3""""""3333"""""3""""""""""""""""""""33DDDDUD333""""""""3""""""""333"3""Dwwww333333333333DDDD3"""""""""""""""""""33DDD"""""""3DwDUfffwfwwD33f̻f33D33""""""""""Uf"333DUUUDfw3DDUwwwfUDDDD33333"333"""""""""3"""""""""""""""""3""""""""""""""""""""D3"""3"3"33DDDUfD3"""""""""""""3""""""3U333DfDUD3"""""""""""""""""""""3DD33""""""""""""3D""""33DDDDDDUDDD3333D3D"3333"""""""3""""33fwwUUf"3D3333DDDDDUDD333""""""3""""""""""3"33333D33"""""""3fwD3UffUUfwwwwwwfUUw3DfDDDD333""""""""""""DwD"3333DUUUDUfwwffUUwfD33DD333DD3D33"""""""""3""""""""""""""33"""""""""""""""33""""333333DDDDUU3""""�""3""""""3UUDD3DUUU3""""""""3"""333""""33"33"3"""""D3D33""3"33DDDDUUUUUfffwwffUDDU3""""""""""""UfwfUfD3"33333DUUUU3DUUD""3""""""33333""33DDUDDD333D3""""""333wU33DDUUUUfwwwwfwffUfUDUDDD33"""""""""""33D"""""33DUDDDUffwUDDDUfwfDD3333333DD3333"""""""333""""""""""333D"3""""""""""""3""""3""333333UDDD""�""3U3""""DDUU33UD3"33""""""""333333"""3""""3"""�""""""""""333"""3""33333DDUUUffwfwwUUfwUDD""""""""""""3"ffwUfUfDD3"333UUU33DDDD"33333333DUDDD3DDDDDDDDD3"""""""""3"DD"33DDDUUUfwwwfUwfUDDDDDDD333"""""""""3D3""""""33DDUDUUUfwfDUUffwfUDD333"3DD3333""""""3333"""""""""3D3"33"""""""""""""""3""3D333D33""""33D3""DDDDD3DD""D3D"""""""""""""""3DD"3333"""333""3"""""""""""D"333"DUD3DUUwwwwUffwfwfUUD3""""""3""""""UUwUDwUDDDDDDUD3D3DDDfD33"3DDUUUUUD3333DDDDDD333Df3""""""33w3"DDD3DDDUDUUUffU̪DDUUDDDDD33""""3""3""UD"""33DDD3DUUDDfwUDUffffUUUD"D3DDDDDD3"3"""3333333""""�""""3"D33"""""""""""33"33D3D3DU3"��""""DUU3"3D33DDD"3DUUD""33"""""""""333D""""33"""""3""""""""""""3""""""D333DUwwfUUfDDUwwwwfUU3"""""33""""3""3ff3UwfUUfwwfUUUUDUUUD"33"D3D3DD3""33"DDD3DU333DU3""""33333ww33DDDD3DDDDDDUUUfUw̪UUUUUUUDDD33"""""33"3U3""3DDDU3DDDDUUwDDDUwffUDD333D3DDDD33"33DDD333333"""""""""D"D3"""""""""""""3""333333Uw"""""""DwwU"3D3DUD33"Uw3D33"""""""""""""3""""3"3""""""""""""""""""""3UfUUDDUUUUUUwwffffD""""333"""333DUDwfffffwUDD3"3DD33"""333D"""""333DU3333DD333U3""""33DDf3"33DDDD3DDDDDUUDUwfUUUUUUUUUDD33""""""3UU""""33UUDD33UUUfUDDUfffUDD33DDUDD3DD3D3DDDD333"""""�"""33""333D3""""""""""""""""""33"DDUUf3""""""""3UUfwDDD3"3UDDDD3""""""""""""3""333""""""""""""""""""""""""3DUUUUDUfffUfwwfwfDU""33"""""33333"Uwf3DwUwwwfffD"""""""3"""D"3U3"""333DUD33333333DD3""33"fD"3DDDDUDDDDDUUUDwwUDDUUUUUUUUUDDD3"""""UU3"""""3DDDD3D3DDUUUwDwfDDD3333D3DD3DD3DD3DDD3333"""""""""""3DD3D3"""""""""""""""""""33"UUfU"""�"""3""""DDDfwDDD3DUDD3D33""""""3D3""""""""""""""""""""""""""""""""DDUUDDDUUUUUDDffwwUDDUDD3"""""3333DwUUUwwwwf3""""""""""3"""3DD3333333"3DD33333D3U3""33333"DDDDDDDDDDDUUUwU3DUUUUUUfUUUUDDD333"33wf"3""""""3DDDDD3D3UUUfDfwwwDDD"33DDDD33DDUDDDDD3333"""""""""3"3"""""""""""""""""""""""33DDD33U3"�"""3""""""3UwU33DDD33Uf33""""3""""""""""3"""""3""""3""""""""""3DDD""33333D333UwwwfDDf3"""3333D33fwwfUDDwf3""""""33""""""""3""33"33333"D3333D3UU""33"3"333DDDD33DDUUUUU""3DUUUUffUUUUUDDD33"3UwU"""""""""""3DDDDDD33DDUUD3fwUwwUD333DUDD33DDUUDDDDD333""""33DD3""3""""""""""33""""""""33DD3D"3"""""D3""3""33UD33DUD33fwD3"3D33""""""""""""""3""""33"""D3""""""""""""3UD3"""""""""3"Dffwffwwww3"""33"3DDfwffUUfwU3"3"""""333"3""3"""""333333"3DD3"3UfUU""""33"D33D3DDDD33DDDUff333"DDUUUUUUUUUUDDDD3"DfD3"3"""""""""""333DD3333DDDUDUwUwf33333DDD3D3DUUDDDDDD33"""""""33""""""""3""""""333UU33"3"�""""D3"""""3333DDD3UDUU33D3D"""D"""3""3D"""""""""""""""33"""""""""""3D33""""""33DffUUUfwU"""3"DD3wwwD""""DD3"""""""D"3"""33""3D3333333D3UfwwfUwU3"D""3"w33D3DDD3DDDDUfwD3333"DDDUUUUUUUUDDDD33Dw33333"3""""""""""333D3333DDDDUfwfDwU3""3U"3333DDDUDDD3333""""""""""""""""""""""33333""3""""""""3""""""""""33DDDD3DDD""333""""""333""""3""""""3"33""""""""3"""""""""3""""""D3"""""""""3DUfUUfwfwf"33333UwwfUDw"""333333""""""D"3""3"""33"3""33UfffDD"3UDD333D""Dw333DDDDD3DDDUUff"3333DDDDUUUUUUUUUUDDDff3"33""3"""""""""""333D33DDDUUfwfUwfUUUDDD3""3DUDDD3D3D""3""""��"""""""""""""""""""3"3DD""3""""""""""""""""""3DDD33DUf33""3""33"""33""""""""""3""""""""3""""""333""""""""""""3"3"""""""""""3DUUUUfwfU3333Dfw3DUfUDfU"333"3"333D333333"""33""33333D3DUU333DUDf3333UD"3ff3333DDDDDDDDfUUwUU33333DDDDUUUUUUUUUUDUwU""""""3"33"""""""""""3333DDUUDUwfUfUwwUUUUD3D"3DUUDD33D33"""""""""""""""""""""""""""33DD""3"""""""""""""""33333DUfDD33"""""33"""33""3"""""""""3"""""""""33"""""""""""3"""""33"""""3DUffUUfwf333wf33UUUDD33333"""3UD3D3D3"D3"""33"3D33DDDUU33DfwfDUD333DUUfD33D3DDDDDDDUUUww33U33333DDDDUUUUUUUUUUfD33""3"""333""""""333DUfwUfD"UUfUDUUU3"D"UfUDD33333"3""""�""""""""""""3""3"""""""""""""3DU3"""""""""""""""""3DUD33DDUDUDD3D"3"""""333""""""""3"""3""""""""333""""""333"""""""""33DfUfUUUUUfDUwfUwwUUD333"""33333DD"33333D"""""3DD333333fDDfwU3DU3D3DfwfwU33D3DDDDDDDUDfwfU3"UDD33DDDDDUUUUUUUUfD333""D""333"""""""3UDUffUfw3""UfUUDUD33DUfUDD333D3""""""""""""""3"""""""""""""""""""3""33"DU3"D3""3"""""""""""3UDD3DDUffwf33"DD3"""3D3""""""3"3U333D"333333""3""3""3"3"""""""""33DUUfUUUfffwwUUDDUfD333""""3"333"33"3D3""""""33DD333333ffwU333UU3UUwwUf333D33DDDDDfUfD3D33DUDDDDDDDDUUUUUUDwwDD3333"33"333"""""""3DfUUUfwf3�3UDUfDD3DDDUUUD3"3333"""""""""3"""""""""""""""""""3""""""""33"33DfwfD3DD"""""""3DUD3DUDwfUffD33"3""""""3""3""""""3"""DUD""DU""D3D""""""""3D""""3"""""""""""333UUUfUUwwDDDwwwwU3""3D3U3"3333333333"""""33DDD3333DwUfU33"UfUUffwUfwwwfD33D3DDDDDDfUU333333UfDDD33DDDDUUUUUDDDD33""D"""33"""3DDfUUUfU"DUDfD3DDDDUUUUD33333"33""""""3"""""""""""""""""""3"""""""""3DDUUwwUUfwf""""33DD33DDUDDD33333"""""""3""""""3"�3""""3DDU"3U3"33333DDD3"""""""""""""""""33"3DDUwffwwU3DffUUUfUUwUDD33D3333333333"""3"DDDD33DDUUUfD"3"3fUfwwwwwU"""3DD3DDDDDUUU3ww333D33"DUffDDUUUDDw3DDDD333""3"""33""""333UfUUfU"�"fUUD3""DDDDDDDD33333"3"""""""""""3""33""""""""""3"""""""333"""""333fwwwwUDUDUfwwU"�"""""3"3DD333UDDDDD"333"""""""""""""""""��""""""DD33UD33DDU3DDU""""""""""3""""""""""333DUffwfDDfU33DUfUffUf33333333DUD333""3"""3"DDDUUDDDD3UD""33"UUUffwwww3"3333DDDDDDDDUUU33""3333"3fwDDDUUUUUDDDDDDDD333"3"3"""""""333DUffww"�"3DwfU"3DD3DDD"3D333333"3"""""""""""""3""""""""""""3""""3"""3""""333"DfwwfD3DDUUDDUfD�""""""""""DDDDUUDUDDD33""""""""""""""3"""33DD"DU""UDDUUUDD3"""33"""3"""3""""""""""""3"333Ufwwf3DDDUUUffUDDDUDw3D3333""3D333333""""3DUffwffUUfU3"""3D3UDDfwwwww"333333333DUDUUUUUfw3""3333"3"fUDDUUDf33DDDDDDDD3333"""3"""""3"""3DDDDUwwf3""33""UUDDDUDD"3DDDDD33333""""""""""""""""""""3"""3"3"""""""33"33""3333UUfD33UDDDUUff"��"""3"""3D333DUUDD333D"""""""""3"""""3"33333DD""3DDDUUff3""""""""3"""3"""""""""3D3UfwDDDDUUUwwUD3DDDUwD3D333333DD3333"3""3DUwf3D33D"""3333DUDUwwwff""333DD33DDDUffUUffU"""3"""""DDDDwf33DDDDDDDDD33"""""333""33""33D33DwfD""""""UDUU33UDDD"33DDD333"33""""""""""""""""""""""""3""""333333"33D333UUD"3DUUUUfww"""DfUDD"""""""DD33DUDDD3333""""""""""""3""""�""""3"3"3D3"3"DD3DDUfU"""""""""3DD"D3"""""D3DDDUwwfDDDDUffUUUDD3DUUwwUfwD3"333DUfD3"3333DUUfDUU33"""33"333DDDUUffww"33"3333DDDDDUfDUfU3""""33"""""wwD3DDDDDDDDDDD33"""33D333DD3333DDDUf"""fUwf3DDDD33D3DDDDDDD3""""""3"""""""""""3"3"""3""""333"3"""33333DUfD33DUfUfwD"3DfUD3"""""""3"33DDDD3333D3"""3"3""""3"""""""""33""""33""33UD33DU3333""""""3DUU3D33"""""3DUDDDffw33UDDffffDDDDDDUUffwfffDDD"DDD3D3"33DDUfwU3Df3""""3""3"333DUDUwwwU"33333DDDDDDDfD"Uf""""3""""3""D̪̪U333D3DDDDDDDD3D3333""33DDDDDDDDUUfwU""DffUD33D""DDDDD3DDDDD3""""""""""3""""""""""""�3""""""3"""""""33333DDUD33DUUfUww3"33""""3"""""""""33"33"33"DD"""3"""""""""""""33""""3"""D3UUD3DD"""""""""""DUf"3D33""""""3DDDDUffwD3DUUUffUDUDDUUDDDDwfUUUD33DD333333DDUUfUfDDDUD""""""""3"DfUDUUD3"3""3DDDDDDDDDfDDU""""""3""DUwfDDDDD33DDDDDDDD3D333""333DDDDDUUDUUDf"D"DUDDUDD333333333DD3DUD""""""""""""""3""""""""""""""""""""333333DD3U333DUfwww"""""3""""""""""""3""33""DDUD""D33""3""""""""""""3"""""""3D"""3UUD"DU""""3"D3333UUUUD3"""""""""33UDDDUfw33DUDUfwDDUUDDDD3D33wUDDfD"3DD3D333DUUUD3wwUDDD3""D3""3D33ffD""""""3DfUUUDDDDUUwf3""""""33fwDDD3DDDDD33DDDDDD3D3D33"""333DUDDfUUD33"33"3D33DUD33333333""DDDDD""""""""""""3D3""3""""""""""""""""""""""""3""33D3333333Uwwwwfff""""3D""""33"""333"""3"3DDDU""DU33"3"""""""""""D"""""""""""""""3DUDDD"""""""""U3D3333"DD""""""""D33DDUDUw333DDDUfDDDUUD333"DUwU3DUf333DDDUDDDDDUD3fwDD3"""""3D33DD"3UwD"""""""33UUUDDDDDDfwf"""""""""UwU33DDDDD3D33DDUDD333D""""3333UDDUUff3"33U"�"D"33UUDD"3D3333333UUDD"""""""""""3UD""""""""""""""""""""""""3333DD33U33DDfwwwfDDU""3""""""3"""""""3""3U33D3"33"DDDDfU"""""""""""""""U3"""""""""""""""333D3DDDU3"""""3UD3"D3DUD""""""""3""DD33DDUUUD"3DDDUfD3D33D33"3"UfU33DUfUDUUffDDUUUfffUD33D3""333"33DUUUUfD""""""33DDDDD3DDUwwD""""""""wfwwfDDfwD33D3DDDDDDD3333"""3333DD33UUfU3"33DD�""3DDUDDD3D333"333"UUDD"3"333"""3"UU3"""""""""""""""""""""""3333DD3D3333UfwffDDfD"""""""3"""""""""""3333333""33"DD3Dfff33""33""3"""3333""""""3"""3"""""3"33DDD3""3DD333DD3D"""""3U33"33"33DUUU3"33DDUUD333D33333DDwD3DDDfUUUUfUUfUUUD3"3"3"""""""DDUfwwfU3""""""""DDDDD333DDww3""""""3wfD3DD3DDDDDDDD3333"""3333D333DUD33"33D3"3D""3DDDDDD"333333333UUU3"""""3"3DU3"""3""""""""""""""""""""3333DD333"33UfUUD33f""33D3"""""""""33"""""3"3333"3333Uf3DDDDD333"3"""""""""""""""33"""33"33U3D333"""UD3D3U3"33""""3D3"""3DUDwU"333DDUD3D333333"3DUD3U33UfUfffwU33333""""""""3UUUUffUD""""""333UDDDDDD3Dff"""""""DwfUDDfw3DDDDDDDDDD333333""33DDDDDDDU""3""DD3"""""UfUDD3D3"""3333D33DUU3"""3333""U33""33""""3""""""""""""""3"""33"UDD"""333DDDDD33UD3D333"""""""""33""""33D333DDD3UU3DUDD3333D"33""""""""""""""""3"""3"33DD33U3"3DD"3UU3333"""""3U33""3333DUf3""3333DUD3333""3"33fUD33"DDUUUfffwfU"33"3""""""""3ffffwwD""""333D333333DDfU""""""3wwwfUDDDwD3Uf3D3DDUDDDD33""""""33DDDDDUU3""3UD3�""""""3UUUD333"""3"33333D3U3"333333"3"333"""""""""""""3"3""""""3D333"333333DDD333f"3D33"""""""""""3"3"""33333D3DUDDDUD333D333333""""""""""""""""3"33Uf""""D33333UUD3""""3""""3333DDDfUfD"3"3D3""""""3"3D33333DD3UUDfwwfDDD333"""3D"""""UUUfUD3"""""333"3333DDDUU""""""3DfwfUUDUUDDfwUUUwUDDDDDDDDD33""""""3DDDDUUU""33U""3333UUD33""""""3D333DUUUDD""""""3""""""""""""""""3""""""""""""3""D3"333333D3333Uw33""""3""3""3""3""""""""3333333DUUD3"3DD"""33""""""""""""""3"""""D333wwf""""3"33"33333""33""""3333DDDfww3"""33""""""33"3DD333333DUUUfwfDDD3"3"""333"D3"33UUUfD3""""3""3"33DDDUD"3""""""3DffUD"""""3333DDUUfwUDDUDD3D33"""""33DDUDDU3"33U"""DUUDDD"""""""""3DD3333Uffw33"""3"""""""""""""""""""""""""""""""3"D3"33333D3333Dw3""""""33"3""""33"""""""""3D3"D33UUD"""3333333""""""""""""""""3U3D33fUfwD"""3"""""3"""""3"""""3"333Dwwffwf""""""""""""3D33333333DUDUUUfwf"3333""3DD""3""DfUUff"""""""""333"33DUfU3"333""""""""DwfD"""""3""333333DUwU3DD33333""""""333DU3""""3U3""DUDDD3"""3""3DD333333"333DffUDD3D33""""3"""""""""""3""""""""""""33"""3D33333"33Uwf"""""3"33D33""3""""""""""""3""33DDD3"3333333D3""""""""""""""D333"3fff3"3UU3"""3"""""""3"33333DfffwwUD"""""""""""3333"333333DUDUUUwwD33D333D3"""""3DDDU33"3""""3D33""3DUffD"""333333""3UUfD""""""""3333333DDwD3D3333333"""""333DD"""3"DD""DUD333333""""33DD""3333333"33DffD"33""""""""""""""""33""""""""""""333""3DD33D3"""DU""""""3"333"3333""""""""33"3DUUDDU3DUD3D333"""""""""""3"""3"""""""33""D""3UU"3DfwD""3"""""""333333UUwwwf"""""""""""""333D333333333DUUfffUDfDDUDDDDD"""""3D3UU3""""3"""D333333UUf3333DD333"333fU3""""""""""""33"33DDfD3333DD3333""3333DD"""33DD"�3DD"33"D3"3"3""3UD"333"33"333D3UfD"3""""""""""3""""""3"""3"3""""""33333333D3333"D3fU3"""33""""3D3333""""""""""3333DDDD3DUUUU3"""""""""""3""33""""""""333"3D3""3DD3UUwf3""3"3"""""33333DUUwfU3""""""""""3D3"3DD3333333DDDUUUUDDDffDDDDD33""""3DDUU333""""""""""3D333DDDUDD3D3"3D3"3DffD3"333333""""3""333DUU33333333""333D3333"""3D3UD��DDDD3""33""""3UU3"333D"3333DDDDffD"""""""""""""""""""""""""""""""3D3333333DD3333DUU"""""D3""""3UU33"""""""""""""33DD33DUDDUUD"3""""""""""""""3D"""33"""3""333333"3DDDUwfUD"""""""""3333DUUUwfUD3"""""""""3D333DD3333333D3DDUDDDDD3ff3DD333"""""DDDDDD3""""""""3"""333UU3333DDD3DDD3"Dff"D333D3DD3"""33"3333DfDD33333"3333333"3""3333DD�"�3D3D3"""""3fUDD3333333""3DDUUfU"""""3ffU""""""""""""""""""""""33"3"33"3333D333DDDD33"""""33"3""3UUD333"""""""33D3D33DfDDD333"3"""""""""""33""3""D"""3"3333333DUDwU333"""3"""""333DDUwfwwfUfD""""3"""""D3"3f33333333DDD3D3333UU3fU3UUD""""""3UDD""3"""""""33333"UUDD"""3D33UD33D3UU"3333333DD"""""""""3DUUD33333333333333""""33""3f"33""""""""3DDU3333"33D333DDDDUDD3""fwwU3D"""""""""""""""""3""""""""3""33DD33DDf33D""""""""3333DUD333""""""""33333333UUUDD333"""""""""33"""""""3""333"33ffUfffwU""""33"""33"3DUUfwwwUD3"""""""""""DDUfUUD"333D333DD3"33DDUDfffDUD""""33DDD""""""""""""""3"DUUU3""3""3333DDDDDwU3""33""33D"""""""3"33DDDDD3333333DD3DD""D33333U""""""3""""""""3"DD3"""""333333DDDfwwDUffUD3333""""""""""""""""3""""""""""333D33D3""""""""333DDDUUD33""""""""""""333333DUfU3333"3""""333""""""""33""333UwffU3"""""""3333DDUfw3wfD333"""""U3"DUfDUwD3""3D3333D333333DUfww3DDD"33DU333"""""3"""""DDDD3"""""3333""3UwfU""""3"33333"""""""3"33DfUDDD3333"DDDD3"""DD33"3f3""""""""""""""""3"D3D"""""""3333DDUfwfDDDDDD3D3"""""""""""""""""333DDD3""""""""""""33UfUUD3"3""""""""33"3D33333UUUD3"""""""3"""""""""""""""33"33UfwwwDD33"""""""""3DUDffDUD33""""""D333DUUUUU"33333"333"3333333DDwffU333333D33""""D"3"333UD3D3"33"3""3""3ffUD""""""""3D33"""""""33DUwUUUDD3333D3DD3"333"""3DU""""""""""""""3"""""""D3""""""3"33DUfwUU33D3DD3""""""""""3""""33DDD3"""""""""""3""3DD333""""""""""3"""33"33333UUfDDD""""""33""""""""""""""""""3DD3DDDf3"DwU3"""""""3DUUUDwwDD3""""3D33D33UDDDDD"33"3""3"3333333333DUDDUU3"333333""""3"333"DUDDDD""3D33D"3UUUU33"""33"333"""""""""333UUDUUfD3DD333UD3"333""33DU""3"""""33""""""3DwwUDDD33333333"""""""""3""""33D3""""""""""""""33DD33""""""333""""""""""3333"3"DUUUDD""""""""""""""""""""""3D"33D3333"3"3"3"""""""3DDUfffw3"3""""33D33D"DD3D333""3333"3"""33333333DDDDDUU3DD33333""""333""33DDD3UD33U33UUDUDDD3"3""3""""""""""""""""33DDDUUfDDD33"DDD333""333DfD""""""""""""3DDUUD333"3333333"""""""""3"3""33D3""""333""33D3333""""""""33"""""""DD"33"3""3UfD33"""""""""3"""""""""33UD""3UD3D""D3"33"3""3DDUfwwwU"3"""""D3333D3"3D"3D3""""333"3""""33333DDD333DDUwfUDD333""""3"33"DDD3D333UU3UDDDDD3333""""33""33"""""3""3333DDUDDffUDDDD"D3""""3333UU3""""33""""""""""""33UUfDDUUDD333"3333Df3"""""""""""""""33333DD"DDD3"""DD33333"""3"33"3"""""""""""""33D3"""""3UDD33"""""""""""""""3"3D33"""""3Uf333"""""""""""3DDUUffwf""""""""D"3""333"3333""""33"""""""333"33DD3""333Uwf333"""33"""333D3DDUD333DUUDDD333"33"333"33"3"""""""D33"3D33DDDDUUUUDD3DDD""""""33UD3D"""D33""""""""""""33DfUUfUDDD3""""DDDUD"""333"3""""3"""333"""333333DD3333"""DDD33D33"""333333"3"""3""""""3D3"""""33DD3D3"""""""""""""""3Uf3"""333DD"D3"""""333"""3DDUUDUffww3""""""3""3D"""3"3333""33"D3"""33""""3"3DD3"33"33UwwfwUD""""""33"""3"3D3UffDDDfDDDD3"3"3333"33"33""""""33""33D3DDDDDUDUUUUDDDDUD""""3"3DUf"3"�"""3""33""""3"""""3fUUUDDDDD""""33D"3f""""33DD3""""33"""333""""333"""D3D3D33UDD3""33"D33333"""""""""33""""3"""""333D333D"""""""""3"""""""33UDD3""3DDUUUfD""""3DDU33"DDDUUDUfwUwwD3"33"""33""""3"3333333"33""3""""D333D33"""""""Dffffwww3"""""""""33D333UUDUUUUD3D33"""3333"3"33"3"""3"3"3333DDDUDDUUDUUDDDDUfD"""""3DDw33"""""33""D"3f"""""�"""""DwffDUDDDDD"333"3"DD"33"""33""""""33""""33"3"333333DDD33333DDD333""""""""""3"33"""""""3""""3DU3"3""""""""""3""3"""3"33333"3333D3DUUU33"""3DffD"3DDDDDDUUUwfUU3"""3"""333""3"""3""3"DD""""""""33DD333"""3"""3DUUfwwf3333""""""33DDDDD33wfDD333"""3"3333333DD3""333"33DUDDUD3UUDUUDDDUDUUD3""""""3Dw3"U""""33"D33DD""""""3UD"3DD33"3"3""""DUwfUfU33""""""3""""""33"3""3"3D33D3D333"33"""""""""""3"""D3""""""""""""DU""""""""""""""""""""3333""""DD333D3333"""""""ffD"3DDD3DDUfUDUwf""""D3"""3""D3"""""""3D333"""""""""3DD""""""""""DDDDfwwww3"33"""""3DDDDDUUDUfU3333""3D"333DD3DD3D3D333333333DfD3DDDDDfDDDDUDD33"""""""3Df33"""""""3"3D"DU""33""3wUD""3D3""3""3DwwUU3"3UD""""""""""""""33"3333333D333D3""""""""""""""""3""3"""""""""33""3""""3"""""""""""3"D"""3DD333D333D33"3Uw33DDDDDDUfwfDUUU""33""""3"Dwf""""""3DDD3"""""""3"""D"""""""""3DDUUDww3"3""""""33DDD3DD3DUU33"D"33333333"""D3""""3D3"33333D33D3DD3DDUDDUDDUD3""333""3"""Uf""3"""3"""33D3"DU3�"33DDD�""""""ff"""""""33"3UUww3"""3DU"""""""""""""3"33""33333"3DD3"3"3""""""""""""33"""""""""""""""3D3""""""""3"""""""33"3"""""DD"""3U3DD3DD3""D""DDUUDDDDDDDUUfffw̻f"3DD"""3ww3"""33333"""""""""333"3D"""""""DD3DDDDfwwfDD"""""333D"33"D3UU33""3U3"""""""""""""""333""333333333D33DDDDUDUDDD"33333""3"UD""""33"""3""3D3DD""U3""""""""""""DU3""""DwwwU""""""33U3""""""""""""""33"333"""333""""""3"""""""""""""3""""""""""""""3""""DD"""""""3""""""3"""3"""33"3"3"DD3D33DDD""3"""""33DDUDDDDDDUffw""33"""wwwD3""33""""""""""""33""""""333D3333DUffwf3""3""3"D333D3DD""33"3""""""""""""""3"33"33D3DU33DDD3UUDUDDD"3D33"3"33""w3"""33""D"""3333"UU3""�""33""""3wwD"""""""3D"33"""""""333D"""""""""3"33333""""33D3"""""""""""""""""3"""3"3""""""""""""DD"33"""""""33""""3D333"33"ff33DD3D3"DU""""""3333DD33D3DUfwUww3"""""""""""33"""""""""3""""D"""""333333"3DUUUfwf3""33""3DDDD333D3"UD3D3""33"""""""""""3"3"DDD3""U3"33DDfUDDD33DD33"3""""""Uf"33""""333"Df33�"�""""""""""DwD"""""""3""3""""""""33""""""""""""""""""""3"3U"""33333"3"3""""""""""""33"""3""""""""""""D3333333""""""""""""""D333333"3UD"333DU3"DDU3"""""""3"33D33UUUfUDDUUfw"""""wwU"""""3"""""""D"""3D""""333D""""3DDUUUfD"3"""""D333"33DDDDDD33U3UwU""33""""""""""""3333333"""3UDUUDD3333"333DD""333""3wU"""3""""""33333UU3""""""""""""3DU33"""""""""33""""""33"""""""""""""""""""3""""""""3333"""3""""""""""333""""""""""""""""33D3333"3D3""D3"""""3"""3DDDDDD3""3fD"333DUU3"DUf3""""""3"""33UwfUD3"DDUDD"""UU3UUU""""""""""3"""""""333333""""3DDDffD3UU3""33DD"3D33333"DDDU33U"33"""""""""""""3333DDDUD3D33DDDDDD3D""3"33U3"333"33""3""""""DDDUDUU3ffU3""""3"""""UfD3""3"""""""33"33"""3"""""""""""""""""333"""33""33""33"""""""33""333"""""""""3"""DD33"333333"""""33D33333333D3"""3U333333UUDD3333""""33"3333DfwfwUD3""U3DUUfUf3w3"3fDUD""""""""""""33D"33""""33DDffU3D3""""3UDDD3"3"""3333"33DD33""""""""""""""33333D3DD"3DDDDDUDDD3333"33"3"333""3wf""""""""3DD33"""fUUUD"UD""""UwD"""""""""""""""""3D"""33"""""3""""""""""""""""""""""""3"""3"""3D"3"""""""3D3""3""""""""""""""DD3"""333""""""3"3UD"""3333DDD333U3"333"DUDDfD"U333DUDDUUfUUDDDDD3""3D33Df3""DUDDD"""""""""""""""""""33""33""""3DDUUfDD333""3D333D333""D33"U3"3DDDUU3""""""""3333"3333DU333"33DUUD333DD""333DD33""""U"3333333""333"DUffU3U""3DfU"""33"3""""""""3""""""""3""""D"""""""""""""""""""""""""3"3"""""3D"""""""33D3"""""""""""""�""""3""3DD3""3333""""""33"fwU""3333DD333"UU"""3"UffwwwwUfUUUffD3333DDD33"3D3"33Dwf"""""DU"UD""""""""""33""""33"3D""""3"3DUUDfU3""D3"""""""3"333"D333DDDUwww3""""""D3""3D3"3DD33D333333D33DDfU333DDUDD3""3D33DD333"3"333DDDUfUfUD3"���"UUD3"""33333333"""""33"""""33""33""""""""""""3"""""""""3"3"33DU3D33""""""""""""""""""""""""""""""""3DD3"33"""""""""""""3w"""33D33333"3Uf3""3UwwUUfUfwfUDDfDDDUD33333DD3DD333333DDfU""3"""3DD3w"""""""""""3"""""""""3""""""33DDww""3"333"""""""33""3""DD""3DDD3D3""""""""3""333DD333""333333UUUU333DDD3"3DUf3DDD3""333"33D3"fDUUUU3""�"DUfD"""""""""""""""""33""33"""D3"""""""""""""""3""3"""""""3""""333333D3"33""33"""""3""""""""DD3"""3""""""DD3333"""3"""""""""""UD3""33"333"33UD""DwUUUUDUUUD"UwD""""3D33"3""""""3D"333Uݪ"D3"3"3D3UwDUff""""""33""""""3""""3UUfD"3D3""""""""""""33333D33333""""""""""""3D3DD33""""3""3wwfDDDDD33"""DDD333D3"""3"""33DfDDDDUD"""DU3""""""3""""""""3D""33""3D""""""""""""""""""3"""""""3""""D3D3"DU3"""3""""""3"""""33DUUDD3""3D""""""3D3"""""""3DDD"""""""3"""3333333""D3"3ffUUUUDD3D33DDD3"3""""3""3"""""""""3333U3D3""3f3UU3DfD33""3U3""""33""""""""""33UDfffUDDUD33""""""""33D333"3"""33"3"33""""""""""""3DUDD333"3D333Dww3DUD"33"3D3w"33"""3""""wDDD33D""U3����""""3""""""""3""""""3U33""""33""""3"""""3""""""""""""""33"3333""333""""3333333DfwwfDDD3""33"""""3""""""""UDD""3"""3333"33"333"3DD3DDwU3DD33333D""3D""3"""33""""""""""""333Dݪ"DD333UU"3DUU33""Df""""""""""""""3DUUfffwwwU33""""3""333333DU"3UD3D"""3"""""""""""""3D3333"Uw333"ff33DD"""""DDw�"3""3"""3"fD33DD3"wD���33""""""""""""""""""3DU""""""3""""""""3"""333""3""""3"3D33D33333D3"""33DDDDUUf3""UD"""""3DDDD""""""""""""""33""333"""""333D33DwwDDD3333DD3""33"""""""3""""""3""""33DfݻU"3"DDD33""DDU3"Uf""""3""""""D3""DDUfUUUfwwwf"3"""""""DDDDDDD333DDD""3""""""""""""""3D33"""3333""fwDDU3""""""DUf""""333""""DUDDDDD3Df"�33"""""""""�""3"�"3D3"""3""333""""""""""""""33"""""""""""3"3D33D33""333UUUff3""3"3"""""3""3DfD3""3D""""""""3"33"3"""33"33""33DwUDDDD3D3fD"""3"""""""""""""""""3U̪U"33UD"3w""3DfD33fD"""""3"""33""""UUUfUUUfffwfDD"""""3DDDUD3D3333DD3333"""""""33""""333333"""""""33333""""Df""""333""UDDUfU3DD�""""""""��"""3U3""33"333"""""""""""""""D3"""3"33U3"33"3D33D3D3DD33Uf̈3"""""""""""""""""D3DD3D"333""""""3D"""""333333"333D3""3wwDD3DD3DD33D3""""3""""""""""""""33̻D"333DDw"""DUf3D3U""""""""""""D"DDD"3DDDUDDDDUUUwUD3""""333"3DD33D333DDDD""""33""3"""33333""""""""""DD""D"""3DwD�"""3UUffUU3��"""""""""""""""3U3333D"333"""""""""""""3"""333""3333U33"""3DDDDDDUDfw̙U""""""""""""""3DDDDDDU3"3D3""""""""""""""33"33333DD"3fwUDD"3D33"3"DDD3"""3""""""3Dff33"33""f""3DfUD""3""""""3""""3""3D"3"33DDDDDDUffffDD""""""""""""3333333DDD333UD33DU"""""33""""""D3""3DD"""3Dw��"DUUfwUU"""""""""""""""""DUD3"33"""333D"""""""""333"""33""333D3D3"33"3DUffw̻D��"""""""""""""""DfUDD33D3""""""33""333""""3D""333333"wwDD333333"3"D3"D3"""""""33DUfD"3"3"3""DD3"DUwD"""""""""3""""D"""3""3"33DDDDDDD3DUwU"""""""""""""""333333DDDDDD33D3D""""""""3"""""3U"DDDff3""""3f""��"ffD33"""33"""D"""""""""3UU3333333333DD33"3333"33"33"3D3D3DfwwfUUDDfwffD3���"""""""""3"""""""DwfU33D33"""""""""3""3"""""3D3D333"33DwUDDD33"333"""3""3D3"""""""""3DUUffwfDU3"33"""U"33Dw3"""""33"""""""""""3333D333DDUfU""""""""""""3"""33"333fUU33"""""D"""""3"""""UD"3"33"3UfU��"�DUD33��""""""3D3""""D""""""3"333DwDD333DUDDDDfD333D333DUDDUUD3DUwffD3wwD�"""�""""""""33"""""���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/radiobutton.rb��������������������������������������������0000644�0001750�0001750�00000003356�11701304107�021310� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header radiobutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/18 17:13:32 $ $Id: radiobutton.rb,v 1.7 2005/07/18 17:13:32 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class RadioButtonSample < SampleWindow def initialize super("radio buttons") set_border_width(10) vbox = Gtk::VBox.new(false, 10) add(vbox) button1 = Gtk::RadioButton.new("button1") vbox.add(button1) button2 = Gtk::RadioButton.new(button1, "button2") vbox.add(button2) button3 = Gtk::RadioButton.new(button1, "button3") vbox.add(button3) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, true) button.can_default = true button.grab_default end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/test.xpm��������������������������������������������������0000644�0001750�0001750�00000003767�11701304107�020144� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 20 19 66 2", /* colors */ ".. c None", ".# c #000000", ".a c #dfdfdf", ".b c #7f7f7f", ".c c #006f6f", ".d c #00efef", ".e c #009f9f", ".f c #004040", ".g c #00bfbf", ".h c #ff0000", ".i c #ffffff", ".j c #7f0000", ".k c #007070", ".l c #00ffff", ".m c #00a0a0", ".n c #004f4f", ".o c #00cfcf", ".p c #8f8f8f", ".q c #6f6f6f", ".r c #a0a0a0", ".s c #7f7f00", ".t c #007f7f", ".u c #5f5f5f", ".v c #707070", ".w c #00f0f0", ".x c #009090", ".y c #ffff00", ".z c #0000ff", ".A c #00afaf", ".B c #00d0d0", ".C c #00dfdf", ".D c #005f5f", ".E c #00b0b0", ".F c #001010", ".G c #00c0c0", ".H c #000f0f", ".I c #00007f", ".J c #005050", ".K c #002f2f", ".L c #dfcfcf", ".M c #dfd0d0", ".N c #006060", ".O c #00e0e0", ".P c #00ff00", ".Q c #002020", ".R c #dfc0c0", ".S c #008080", ".T c #001f1f", ".U c #003f3f", ".V c #007f00", ".W c #00000f", ".X c #000010", ".Y c #00001f", ".Z c #000020", ".0 c #00002f", ".1 c #000030", ".2 c #00003f", ".3 c #000040", ".4 c #00004f", ".5 c #000050", ".6 c #00005f", ".7 c #000060", ".8 c #00006f", ".9 c #000070", "#. c #7f7f80", "## c #9f9f9f", /* pixels */ "........................................", "........................................", "........................................", ".......................#.#.#............", ".....................#.......#...#......", "...............................#.#......", ".......#.#.#.................#.#.#......", ".....#.y.i.y.#.#.#.#.#.#.#..............", ".....#.i.y.i.y.i.y.i.y.i.#..............", ".....#.y.i.y.i.y.i.y.i.y.#..............", ".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....", ".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......", ".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........", ".....#.y.#.s.s.s.s.s.s.s.s.s.#..........", ".....#.#.s.s.s.s.s.s.s.s.s.#............", ".....#.#.#.#.#.#.#.#.#.#.#..............", "........................................", "........................................", "........................................" }; ���������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/layout.rb�������������������������������������������������0000644�0001750�0001750�00000005202�11701304107�020263� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header layout.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: layout.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by Minoru Inachi <inachi@earth.interq.or.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class LayoutSample < SampleWindow def initialize super("Gtk::Layout") set_default_size(200, 200) scrolledwindow = Gtk::ScrolledWindow.new add(scrolledwindow) @layout = Gtk::Layout.new(nil, nil) scrolledwindow.add(@layout) # We set step sizes here since GtkLayout does not set # them itself. @layout.hadjustment.step_increment = 10.0 @layout.vadjustment.step_increment = 10.0 @layout.set_events(Gdk::Event::EXPOSURE_MASK) @layout.signal_connect("expose_event") do | w, event | layout_expose_handler(event) end @layout.set_size(1600, 128000) for i in 0..15 do for j in 0..15 do buf = "Button #{i}, #{j}" if ((i + j) % 2) != 0 then button = Gtk::Button.new(buf) else button = Gtk::Label.new(buf) end @layout.put(button, j*100, i*100) button.show end end for i in 16..1279 do buf = "Button #{i}, 0" if (i % 2) != 0 then button = Gtk::Button.new(buf) else button = Gtk::Label.new(buf) end @layout.put(button, 0, i * 100) end end private def layout_expose_handler(event) imin = (event.area.x) / 10 imax = (event.area.x + event.area.width + 9) / 10 jmin = (event.area.y) / 10 jmax = (event.area.y + event.area.height + 9) / 10 for i in imin..imax-1 do for j in jmin..jmax-1 do if ((i+j) % 2) != 0 then @layout.bin_window.draw_rectangle( @layout.style.black_gc, true, 10 * i, 10 * j, 1 + i % 10, 1 + j % 10) end end end false end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/sample.rb�������������������������������������������������0000644�0001750�0001750�00000002731�11701304107�020233� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header sample.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: sample.rb,v 1.9 2005/07/21 17:47:19 mutoh Exp $ =end require 'gtk3' module Sample def destroy super @destroyed = true end def destroyed? @destroyed end end module SampleClass def invoke @singleton = nil unless defined? @singleton @singleton = new if @singleton.nil? or @singleton.destroyed? unless @singleton.visible? @singleton.show_all else @singleton.destroy end end end class SampleWindow < Gtk::Window include Sample extend SampleClass def initialize(title) super(title) @destroyed = false signal_connect("destroy") do destroy end end end class SampleDialog < Gtk::Dialog include Sample extend SampleClass def initialize(title) super(:title => title) @destroyed = false signal_connect("destroy") do destroy end end end OptionMenuItem = Struct.new("OptionMenuItem", :name, :block) def build_option_menu(items, history) omenu = Gtk::OptionMenu.new menu = Gtk::Menu.new group = nil items.size.times do |i| menu_item = Gtk::RadioMenuItem.new(group, items[i].name) menu_item.signal_connect("activate") do |widget| items[i].block.call(widget) end group = menu_item.group menu.append(menu_item) menu_item.active = true if i == history menu_item.show end omenu.menu = menu omenu.history = history omenu end ���������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/buttonbox.rb����������������������������������������������0000644�0001750�0001750�00000005540�11701304107�020777� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header buttonbox.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: buttonbox.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Rewritten by Minoru Inachi <inachi@earth.interq.or.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ButtonBoxSample < SampleWindow def initialize super("Button Boxes") signal_connect("destroy"){destroy} set_border_width(10) main_vbox = Gtk::VBox.new add(main_vbox) frame_horz = Gtk::Frame.new("Horizontal Button Boxes") main_vbox.pack_start(frame_horz, true, true, 10) vbox = Gtk::VBox.new vbox.border_width = 10 frame_horz.add(vbox) vbox.pack_start(create_bbox(true, "Spread", 40, :spread)) # Gtk::ButtonBox::Style::SPREAD vbox.pack_start(create_bbox(true, "Edge", 40, :edge), true, true, 5) # Gtk::ButtonBox::Style::EDGE vbox.pack_start(create_bbox(true, "Start", 40, :start), true, true, 5) # Gtk::ButtonBox::Style::START vbox.pack_start(create_bbox(true, "End", 40, :end), true, true, 5) # Gtk::ButtonBox::Style::END frame_vert = Gtk::Frame.new("Vertical Button Boxes") main_vbox.pack_start(frame_vert, true, true, 10) hbox = Gtk::HBox.new hbox.border_width = 10 frame_vert.add(hbox) hbox.pack_start(create_bbox(false, "Spread", 30, :spread)) hbox.pack_start(create_bbox(false, "Edge", 30, :edge), true, true, 5) hbox.pack_start(create_bbox(false, "Start", 30, :start), true, true, 5) hbox.pack_start(create_bbox(false, "End", 30, :end), true, true, 5) end def create_bbox(horizontal, title, spacing, layout) frame = Gtk::Frame.new(title) if horizontal then bbox = Gtk::HButtonBox.new else bbox = Gtk::VButtonBox.new end bbox.border_width = 5 frame.add(bbox) bbox.set_layout_style(layout) bbox.set_spacing(spacing) button = Gtk::Button.new("OK") bbox.add(button) button = Gtk::Button.new("Cancel") bbox.add(button) button = Gtk::Button.new("Help") bbox.add(button) frame end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/filesel.rb������������������������������������������������0000644�0001750�0001750�00000003753�11701304107�020402� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header filesel.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: filesel.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class FileChooserSample < Gtk::FileChooserDialog include Sample extend SampleClass def initialize super( :title => "file chooser dialog", :buttons => [ # TODO # [:cancel, :cancel], # Gtk::Stock::CANCEL, Gtk::Dialog::ResponseType::CANCEL # [:open, :accept], # Gtk::Stock::OPEN, Gtk::Dialog::ResponseType::ACCEPT [Gtk::Stock::CANCEL, Gtk::Dialog::ResponseType::CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::ResponseType::ACCEPT], ] ) @destroyed = false signal_connect("destroy") do destroy end signal_connect("response") do |widget, response_id| case response_id when Gtk::Dialog::ResponseType::ACCEPT # TODO puts filename destroy when Gtk::Dialog::ResponseType::CANCEL # TODO destroy end end set_window_position(:mouse) # Gtk::Window::Position::MOUSE end end ���������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/Modeller.xpm����������������������������������������������0000644�0001750�0001750�00000007557�11701304107�020731� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * InterfaceModeller_app_2_Tile_xpm[] = { "48 48 66 1", " c None", ". c #86174D344103", "X c #69A651445144", "o c #8617410330C2", "O c #69A6410338E3", "+ c #30C218611861", "@ c #AEBA6DB66185", "# c #71C638E328A2", "$ c #69A634D328A2", "% c #30C228A228A2", "& c #79E73CF330C2", "* c #BEFB9E799E79", "= c #8E3869A66185", "- c #514424921861", "; c #A699A289B6DA", ": c #A6999E79A699", "> c #71C65D756185", ", c #9E799A69A699", "< c #8E3882078E38", "1 c #861779E78617", "2 c #A6999A69AEBA", "3 c #8E388A289658", "4 c #71C675D679E7", "5 c #96588A289E79", "6 c #30C230C238E3", "7 c #C71BC71BC71B", "8 c #9E79A289AEBA", "9 c #AEBAAAAABEFB", "0 c #96589248A699", "q c #A699AAAAB6DA", "w c #AEBAAAAAB6DA", "e c #D75CD34CD75C", "r c #EFBEE79DEFBE", "t c #BEFBB6DABEFB", "y c #B6DABAEAC71B", "u c #AEBAAEBAB6DA", "i c #E79DDB6CDF7D", "p c #96588E389658", "a c #596559656185", "s c #AEBA8E388E38", "d c #CF3CCB2BCF3C", "f c #9E799A699E79", "g c #86177DF78E38", "h c #69A6659571C6", "j c #AEBAAEBABEFB", "k c #96589E799E79", "l c #B6DAA699A699", "z c #E79DC71BC71B", "x c #B6DAB6DAB6DA", "c c #861786179658", "v c #B6DAB2CABEFB", "b c #BEFBAAAAAEBA", "n c #C71BBEFBC71B", "m c #514441034103", "M c #41033CF34103", "N c #492428A228A2", "B c #AEBAA289B6DA", "V c #618530C22081", "C c #69A630C228A2", "Z c #69A630C22081", "A c #596528A22081", "S c #492428A22081", "D c #618528A22081", "F c #596520811861", "G c #69A628A22081", "H c #FFFF14514103", " .X ", " .oO+ ", " @.o#++ ", " @.o$%+ ", " @.&#++ ", " @.o#++ ", " @.o$++ ", " @.&#++ ", " .O#++ ", " *=-$++ ", " ;:>+++ ", " ;,<1% ", " 2,34 ", " 2;,51 ", " 2,,,,6 ", " 7777 28888,6 ", " 77777777 2829,,,06 ", " 9qwwe7rrrrr77rr 828,9tyt,6 ", " uuwriirrieiiieii77pa< 82,8,,,8,06 ", " s=1ttiieeeeded77eufgh>j,8,8,k,0,6 ", " =@lzieeeeee77eeex:fpcg4>9,,,,qjv6 ", " =O=blt7eeee7deenw:ffp<gha:t979;06 ", " =OO@=@zieeee7ex:::fffff0,v72444h6 ", " =OOo&Osst7iee7wkf:f:ff;t721444ham ", " =#&&&&OO@di7eu:ff:fferiv114444hmMX ", " =O&&&..o.sdp33fff:errrii7cc1hhh6mmNX= ", " =O&&&@.o.@sberrrrrriiuxuxnB;44aMmVCO#OX ", " =O&&o@..o.zrrrie777nnxtuxx:x;n:>mV##&&O$mX ", " =O&&o....zrrieieuxunx7txx:nnfwpMmVZ#$ZZZVVN ", " =O&oooo.*rrde77ewxnxxtnw:f4M%M%+NA#$Z$ZZVmN> ", " =Oo&ooo@iree7inxn7nnuuff4h%M>m%S-AZ$CCZDZmSX ", " =O&o.o.@rrn7eulun7xxuwp4mm6ahM%--AZCCZDDDANX ", " =Ooooo.*rixenuwwn7nxupph%M>>h6mAADVVZVVDDANX ", " =O&o.o.zrexwwnwuxxnughX%mahhmMN-AZCCVVDDAAN> ", " *XOoo.*iin7n777xxxtphaM+ama>MSNFVCZZVVDAAAS> ", " 1O..izewxux7nuuux4%++%hha>%N-DDCZZVDAAAASX ", " 1.=ituu:uButnxxuX%>hh>M%++NADZZZVDADAA--X ", " :e7f::lnn7*ppnx6ahm6++mNN-ADCZVDDAAAA-SX ", " 7nupp:wxxg%MMau6%++NmmmADADVVVVVDAA---NX ", " 7uBgh1wwxg6h>m%:MmmVNAVDZVZCVZZDAAAAF-S+X ", " nfgaM%pnwhX6%mXb6$DVVZC$C#C$ZZDVAAA---+NX ", " 27a%MaM47:mN.OoolmODGZ####$$ZZVDDA-----SSX ", " 2gmg<m6p7wmmOo...O$GZ####$$CZVVDAAA----++X ", " qBcaM <gxgmXmo.@.o&$$##$$$CZZZDADA-A-++-NX ", " M6> paMa HX.@@@oZ$###$$CZVDDAAAA---SS+X ", " 43 p=&@@&&$##$CCCVVVAAA--+S+S+%X ", " k =o@.##$VVmmmNNNSSSSSS%XXXX ", " s>OSSNmN>>aaa177777 "}; �������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/wmhints.rb������������������������������������������������0000644�0001750�0001750�00000001774�11701304107�020451� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header wmhints.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: wmhints.rb,v 1.8 2005/07/21 17:47:19 mutoh Exp $ =end require 'sample' class WMHintsSample < SampleWindow def initialize super("WM Hints") realize circles = Gdk::Pixmap.create_from_xbm(window, "circles.xbm") window.set_icon(nil, circles, circles) window.icon_name = "WMHints Test Icon" window.decorations = Gdk::Window::DECOR_ALL | Gdk::Window::DECOR_MENU window.functions = Gdk::Window::FUNC_ALL | Gdk::Window::FUNC_RESIZE vbox = Gtk::VBox.new(false, 10) add(vbox) label = Gtk::Label.new("Try iconizing me!") label.set_size_request(150, 50) vbox.pack_start(label, true, true, 0) vbox.pack_start(Gtk::HSeparator.new, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, true, true, 0) button.can_default = true button.grab_default end end ����ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/button.rb�������������������������������������������������0000644�0001750�0001750�00000007173�11701304107�020272� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header button.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/17 16:55:26 $ $Id: button.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ButtonSample < SampleWindow def initialize super("buttons") box1 = Gtk::VBox.new(false, 0) add(box1) table = Gtk::Table.new(3, 3, false) table.row_spacings = 5 table.column_spacings = 5 table.border_width = 10 box1.pack_start(table, true, true, 0) button = [ Gtk::Button.new("button1"), Gtk::Button.new("button2"), Gtk::Button.new("button3"), Gtk::Button.new("button4"), Gtk::Button.new("button5"), Gtk::Button.new("button6"), Gtk::Button.new("button7"), Gtk::Button.new("button8"), Gtk::Button.new("button9"), ] button[0].signal_connect("clicked") do button_window(button[1]) end table.attach(button[0], 0, 1, 0, 1, [:expand, :fill], [:expand, :fill], 0, 0) # Gtk::EXPAND | Gtk::FILL button[1].signal_connect("clicked") do button_window(button[2]) end table.attach(button[1], 1, 2, 1, 2, [:expand, :fill], [:expand, :fill], 0, 0) button[2].signal_connect("clicked") do button_window(button[3]) end table.attach(button[2], 2, 3, 2, 3, [:expand, :fill], [:expand, :fill], 0, 0) button[3].signal_connect("clicked") do button_window(button[4]) end table.attach(button[3], 0, 1, 2, 3, [:expand, :fill], [:expand, :fill], 0, 0) button[4].signal_connect("clicked") do button_window(button[5]) end table.attach(button[4], 2, 3, 0, 1, [:expand, :fill], [:expand, :fill], 0, 0) button[5].signal_connect("clicked") do button_window(button[6]) end table.attach(button[5], 1, 2, 2, 3, [:expand, :fill], [:expand, :fill], 0, 0) button[6].signal_connect("clicked") do button_window(button[7]) end table.attach(button[6], 1, 2, 0, 1, [:expand, :fill], [:expand, :fill], 0, 0) button[7].signal_connect("clicked") do button_window(button[8]) end table.attach(button[7], 2, 3, 1, 2, [:expand, :fill], [:expand, :fill], 0, 0) button[8].signal_connect("clicked") do button_window(button[0]) end table.attach(button[8], 0, 1, 1, 2, [:expand, :fill], [:expand, :fill], 0, 0) box1.pack_start(Gtk::HSeparator.new, false, true, 0) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button[9] = Gtk::Button.new("close") button[9].signal_connect("clicked") do destroy end box2.add(button[9]) end private def button_window(button) unless button.visible? button.show else button.hide end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/reparent.rb�����������������������������������������������0000644�0001750�0001750�00000005171�11701304107�020573� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header reparent.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: reparent.rb,v 1.6 2005/07/18 17:13:33 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ReparentSample < SampleWindow def initialize super("reparent") vbox = Gtk::VBox.new(false, 0) add(vbox) box2 = Gtk::HBox.new(false, 5) box2.set_border_width(10) vbox.pack_start(box2, true, true, 0) label = Gtk::Label.new("Hello World") frame = Gtk::Frame.new("Frame 1") box2.pack_start(frame, true, true, 0) framebox1 = Gtk::VBox.new(false, 5) framebox1.border_width = 5 frame.add(framebox1) button = Gtk::Button.new("switch") button.signal_connect("clicked"){ label.reparent(framebox1) } framebox1.pack_start(button, false, true, 0) framebox1.add(label) label.signal_connect("parent_set"){ |child, old_parent| puts "set_parent for \"#{child.class}\":" puts " new parent: \"#{if child.parent then child.parent.class else 'NULL' end}\"," puts " old parent: \"#{if old_parent then old_parent.class else 'NULL' end}\"," puts " data: 42\n" } frame = Gtk::Frame.new("Frame 2") box2.pack_start(frame, true, true, 0) framebox2 = Gtk::VBox.new(false, 5) framebox2.border_width = 5 frame.add(framebox2) button = Gtk::Button.new("switch") button.signal_connect("clicked"){ label.reparent(framebox2) } framebox2.pack_start(button, false, true, 0) vbox.pack_start(Gtk::HSeparator.new, false, true) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, true, 10) button.can_default = true button.grab_default end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/check-n.xpm�����������������������������������������������0000644�0001750�0001750�00000000533�11701304107�020461� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 10 9 5 1", /* colors */ ". c None", "# c #000000", "y c #666666", "i c #ff1f00", "# c #9f9f9f", /* pixels */ "..........", "........yy", ".......yy.", "......yy..", ".yyy.yy...", "..yyyy....", "...yy.....", "..........", "..........", }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/colorselect.rb��������������������������������������������0000644�0001750�0001750�00000001434�11701304107�021267� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin colorselect.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project $Id: colorselect.rb,v 1.5 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class ColorSelectionSample < Gtk::ColorSelectionDialog include Sample extend SampleClass def initialize super(:title => "color selection dialog") @destroyed = false signal_connect("destroy"){destroy} color_selection.set_has_opacity_control(true) set_window_position(:mouse) # Gtk::Window::Position::MOUSE color_selection.signal_connect("color_changed"){ color_selection.current_color } ok_button.signal_connect("clicked"){ puts color_selection.current_color destroy } cancel_button.signal_connect("clicked"){destroy} end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/checkbutton.rb��������������������������������������������0000644�0001750�0001750�00000003521�11701304107�021261� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header checkbutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: checkbutton.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/17 16:55:26 $ $Id: checkbutton.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class CheckButtonSample < SampleWindow def initialize super("check buttons") box1 = Gtk::VBox.new add(box1) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.add(box2) button = Gtk::CheckButton.new("button1") box2.add(button) button = Gtk::CheckButton.new("button2") box2.add(button) button = Gtk::CheckButton.new("button3") box2.add(button) box1.pack_start(Gtk::HSeparator.new) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.add(box2) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} box2.add(button) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/spinbutton.rb���������������������������������������������0000644�0001750�0001750�00000012576�11701304107�021167� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header spinbutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: spinbutton.rb,v 1.7 2005/07/30 10:24:57 mutoh Exp $ Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class SpinButtonSample < SampleWindow def get_value(spin, label, data) if (data == 1) buf = sprintf("%d", spin.value_as_int) else buf = sprintf("%0.*f", spin.digits, spin.value) end label.text = buf end def initialize super("Gtk::SpinButton") main_vbox = Gtk::VBox.new(false, 5) main_vbox.set_border_width(10) add(main_vbox) frame = Gtk::Frame.new("Not accelerated") main_vbox.pack_start(frame, true, true, 0) vbox = Gtk::VBox.new(false, 0) vbox.set_border_width(5) frame.add(vbox) # Day, month, year spinners hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, true, true, 5) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Day :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(1.0, 1.0, 31.0, 1.0, 5.0, 0.0) spinner = Gtk::SpinButton.new(adj, 0, 0) spinner.wrap = true vbox2.pack_start(spinner, false, true, 0) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Month :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(1.0, 1.0, 12.0, 1.0, 5.0, 0.0) spinner = Gtk::SpinButton.new(adj, 0, 0) spinner.wrap = true vbox2.pack_start(spinner, false, true, 0) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Year :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(1998.0, 0.0, 2100.0, 1.0, 100.0, 0.0) spinner = Gtk::SpinButton.new(adj, 0, 0) spinner.wrap = true spinner.set_size_request(55, -1) vbox2.pack_start(spinner, false, true, 0) frame = Gtk::Frame.new("Accelerated") main_vbox.pack_start(frame, true, true, 0) vbox = Gtk::VBox.new(false, 0) vbox.set_border_width(5) frame.add(vbox) hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, true, 5) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Value :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(0.0, -10000.0, 10000.0, 0.5, 100.0, 0.0) spinner1 = Gtk::SpinButton.new(adj, 1.0, 2) spinner1.set_wrap(true) spinner1.set_size_request(100, -1) spinner1.set_update_policy(Gtk::SpinButton::UPDATE_ALWAYS) vbox2.pack_start(spinner1, false, true, 0) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Digits :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(2, 1, 5, 1, 1, 0) spinner2 = Gtk::SpinButton.new(adj, 0.0, 0) spinner2.wrap = true adj.signal_connect("value_changed"){ spinner1.digits = spinner2.value_as_int } vbox2.pack_start(spinner2, false, true, 0) hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, true, 5) button = Gtk::CheckButton.new("Snap to 0.5-ticks") button.signal_connect("clicked"){ spinner1.snap_to_ticks = button.active? } vbox.pack_start(button, true, true, 0) button.set_active(true) button2 = Gtk::CheckButton.new("Numeric only input mode") button2.signal_connect("clicked"){ spinner1.numeric = button2.active? } vbox.pack_start(button2, true, true, 0) button2.active = true val_label = Gtk::Label.new("") hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, true, 5) button3 = Gtk::Button.new("Value as Int") button3.signal_connect("clicked"){get_value(spinner1, val_label, 1)} hbox.pack_start(button3, true, true, 5) button4 = Gtk::Button.new("Value as Float") button4.signal_connect("clicked"){get_value(spinner1, val_label, 2)} hbox.pack_start(button4, true, true, 5) vbox.pack_start(val_label, true, true, 0) val_label.text = "0" hbox = Gtk::HBox.new(false, 0) main_vbox.pack_start(hbox, false, true, 0) button5 = Gtk::Button.new("Close") button5.signal_connect("clicked"){destroy} hbox.pack_start(button5, true, true, 5) end end ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/shapedwindow.rb�������������������������������������������0000644�0001750�0001750�00000004306�11701304107�021446� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header shapedwindow.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: shapedwindow.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ =end require 'sample' class ShapeSampleBasic < Gtk::Window include Sample extend SampleClass @@root_win = nil def initialize(xpm_file, x, y, px, py, type) super(type) @destroyed = false signal_connect("destroy"){destroy} realize @@root_win = Gdk::Window.default_root_window unless @@root_win window.set_events(window.events | Gdk::Event::BUTTON_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK | Gdk::Event::BUTTON_PRESS_MASK) signal_connect("button_press_event") do |w, event| if (event.event_type == Gdk::Event::BUTTON_PRESS) @x = event.x @y = event.y Gtk.grab_add(self) Gdk.pointer_grab(window, true, Gdk::Event::BUTTON_RELEASE_MASK | Gdk::Event::BUTTON_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK, nil, nil, 0) end end signal_connect("button_release_event") do Gtk.grab_remove(self) Gdk.pointer_ungrab(0) end signal_connect("motion_notify_event") do xp, yp, mask = @@root_win.pointer move(xp - @x, yp - @y) end move(x, y) style = Gtk::Widget.default_style fixed = Gtk::Fixed.new fixed.set_size_request(100, 100) add(fixed) gdk_pixmap, gdk_pixmap_mask = Gdk::Pixmap::create_from_xpm(window, style.bg(Gtk::STATE_NORMAL), xpm_file) pixmap = Gtk::Image.new(gdk_pixmap, gdk_pixmap_mask) fixed.put(pixmap, px, py) shape_combine_mask(gdk_pixmap_mask, px, py) end end class ShapeSampleModeller < ShapeSampleBasic def initialize super("Modeller.xpm", 440, 140, 0, 0, Gtk::Window::POPUP) end end class ShapeSampleSheets < ShapeSampleBasic def initialize super("FilesQueue.xpm", 580, 170, 0, 0, Gtk::Window::POPUP) end end class ShapeSampleRings < ShapeSampleBasic def initialize super("3DRings.xpm", 460, 270, 25, 25, Gtk::Window::TOPLEVEL) end end ShapesSample = Class.new class << ShapesSample def invoke ShapeSampleModeller.invoke ShapeSampleSheets.invoke ShapeSampleRings.invoke end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/labels.rb�������������������������������������������������0000644�0001750�0001750�00000005110�11701304107�020206� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- =begin header labels.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002,2003 Ruby-GNOME2 Project Team $Id: labels.rb,v 1.7 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class LabelSample < SampleWindow def initialize super("Gtk::Label") set_border_width(5) vbox = Gtk::VBox::new(false, 5) hbox = Gtk::HBox::new(false, 5) hbox.pack_start(vbox, false, false, 0) create_frame("Normal Label", "This is a Normal label", vbox) create_frame("Multi-line Label", "This is a Multi-line label.\nSecond line\nThird line", vbox) create_frame("Left Justified Label", "This is a Left-Justified\nMulti-line label.\nThird line", vbox) do |label| label.justify = :left # Gtk::Justification::LEFT end create_frame("Right Justified Label", "This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)", vbox) do |label| label.justify = :right # Gtk::Justification::RIGHT end vbox = Gtk::VBox::new(false, 5) hbox.pack_start(vbox, false, false, 0) create_frame("Line wrapped label", "This is an example of a line-wrapped label. It should not be taking up the entire width allocated to it, but automatically wraps the words to fit. The time has come, for all good men, to come to the aid of their party. The sixth sheik's six sheep's sick.\n It supports multiple paragraphs correctly, and correctly adds many extra spaces. ", vbox) do |label| label.wrap = true end create_frame("Filled, wrapped label", "This is an example of a line-wrapped, filled label. It should be taking up the entire width allocated to it. Here is a seneance to prove my point. Here is another sentence. Here comes the sun, do de do de do.\n This is a new paragraph.\n This is another newer, longer, better paragraph. It is coming to an end, unfortunately.", vbox) do |label| label.justify = :fill # Gtk::Justification::FILL label.wrap = true end create_frame("Underlined label", "This label is underlined!\nThis one is underlined in 日本語の入用quite a funky fashion", vbox) do |label| label.justify = :left label.pattern = "_________________________ _ _________ _ _____ _ __ __ ___ ____ _____" end add(hbox) end def create_frame(title, label_str, vbox) frame = Gtk::Frame::new(title) frame.show label = Gtk::Label::new(label_str) yield(label) if iterator? frame.add(label) vbox.pack_start(frame, false, false, 0) end private :create_frame end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/testgtkrc2������������������������������������������������0000644�0001750�0001750�00000000670�11701304107�020444� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..." # # include "rc-file" # # style <name> [= <name>] # { # <option> # } # # widget <widget_set> style <style_name> # widget_class <widget_class_set> style <style_name> # this file gets included from testgtkrc style 'main_buttons' = 'button' { font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" bg[PRELIGHT] = { 0, 0, 0.75 } } widget "main window.*GtkButton*" style "main_buttons" ������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/togglebutton.rb�������������������������������������������0000644�0001750�0001750�00000003057�11701304107�021471� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header togglebutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/21 17:47:19 $ $Id: togglebutton.rb,v 1.6 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ToggleButtonSample < SampleWindow def initialize super("toggle buttons") set_border_width(5) vbox = Gtk::VBox.new(false, 5) add(vbox) (1..3).each do |i| vbox.add(Gtk::ToggleButton.new("button#{i}")) end vbox.pack_start(Gtk::HSeparator.new, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.add(button) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/dialog.rb�������������������������������������������������0000644�0001750�0001750�00000001660�11701304107�020211� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin dialog.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: dialog.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class DialogSample < SampleDialog def initialize super("Gtk::Dialog") set_default_size(200, 100) button = Gtk::Button.new("OK") button.signal_connect("clicked"){destroy} button.can_default = true action_area.pack_start(button) button.grab_default button = Gtk::Button.new("Toggle") button.signal_connect("clicked"){label_toggle} button.can_default = true action_area.pack_start(button) @label = nil end private def label_toggle if @label == nil then @label = Gtk::Label.new("Dialog Test") @label.signal_connect("destroy"){@label = nil} @label.set_padding(10, 10) child.pack_start(@label) @label.show else @label.destroy end end end ��������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/README����������������������������������������������������0000644�0001750�0001750�00000000402�11701304107�017276� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-testgtk - testgtk.c rewritten in Ruby/GTK To run, do ruby testgtk.rb in this directory. ---- (Maintainer from Ruby/GTK2) Masao Mutoh <mutoh@highway.ne.jp> (Original Author of Ruby/GTK version) Hiroshi Igarashi <igarashi@ueda.info.waseda.ac.jp> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/notebook.rb�����������������������������������������������0000644�0001750�0001750�00000016156�11701304107�020600� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header notebook.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: notebook.rb,v 1.11 2005/07/18 17:13:32 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' $book_open_xpm = [ "16 16 4 1", " c None s None", ". c black", "X c #808080", "o c white", " ", " .. ", " .Xo. ... ", " .Xoo. ..oo. ", " .Xooo.Xooo... ", " .Xooo.oooo.X. ", " .Xooo.Xooo.X. ", " .Xooo.oooo.X. ", " .Xooo.Xooo.X. ", " .Xooo.oooo.X. ", " .Xoo.Xoo..X. ", " .Xo.o..ooX. ", " .X..XXXXX. ", " ..X....... ", " .. ", " " ] $book_closed_xpm = [ "16 16 6 1", " c None s None", ". c black", "X c red", "o c yellow", "O c #808080", "# c white", " ", " .. ", " ..XX. ", " ..XXXXX. ", " ..XXXXXXXX. ", ".ooXXXXXXXXX. ", "..ooXXXXXXXXX. ", ".X.ooXXXXXXXXX. ", ".XX.ooXXXXXX.. ", " .XX.ooXXX..#O ", " .XX.oo..##OO. ", " .XX..##OO.. ", " .X.#OO.. ", " ..O.. ", " .. ", " " ] class NotebookSample < SampleWindow def initialize super("notebook") vbox = Gtk::VBox.new(false, 0) add(vbox) @notebook = Gtk::Notebook.new @notebook.signal_connect("switch_page") do |widget, page, num_page| unless destroyed? page_switch(widget, page, num_page) end end @notebook.tab_pos = :top # Gtk::PositionType::TOP vbox.add(@notebook) @notebook.border_width = 10 @notebook.realize @book_open = Gdk::Pixbuf.new($book_open_xpm) @book_closed = Gdk::Pixbuf.new($book_closed_xpm) create_pages(1, 5) vbox.add(Gtk::HSeparator.new) cbutton1 = Gtk::CheckButton.new("popup menu") vbox.add(cbutton1) cbutton1.signal_connect("clicked"){ @notebook.enable_popup = cbutton1.active? } hbox = Gtk::HBox.new(false, 5) hbox.border_width = 10 vbox.pack_start(hbox, false, false, 0) label = Gtk::Label.new("Notebook Style :") hbox.add(label) =begin omenu = build_option_menu([ OptionMenuItem.new("Standard", proc { standard_notebook }), OptionMenuItem.new("No tabs", proc { notabs_notebook }), OptionMenuItem.new("Scrollable", proc { scrollable_notebook }) ], 0) hbox.add(omenu) =end button = Gtk::Button.new("Show all Pages") hbox.add(button) button.signal_connect('clicked'){ @notebook.each do |w| w.show end } hbox = Gtk::HBox.new(true, 10) hbox.set_border_width(10) vbox.pack_start(hbox, false, true, 0) button = Gtk::Button.new("prev") button.signal_connect("clicked"){ @notebook.prev_page } hbox.pack_start(button, true, true, 0) button = Gtk::Button.new("next") button.signal_connect("clicked"){ @notebook.next_page } hbox.pack_start(button, true, true, 0) button = Gtk::Button.new("rotate") button.signal_connect("clicked"){ @notebook.tab_pos = (@notebook.tab_pos.to_i + 1) % 4 } hbox.pack_start(button, true, true, 0) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, false, 5) button.can_default = true button.grab_default end def standard_notebook @notebook.set_show_tabs(true) @notebook.set_scrollable(false) if @notebook.children.size == 15 10.times do @notebook.remove_page(5) end end end def notabs_notebook @notebook.set_show_tabs(false) if @notebook.children.size == 15 10.times do @notebook.remove_page(5) end end end def scrollable_notebook @notebook.set_show_tabs(true) @notebook.set_scrollable(true) if @notebook.children.size == 5 create_pages(6, 15) end end def create_pages(start_page, end_page) start_page.upto(end_page) do |i| buffer = "Page #{i}" child = Gtk::Frame.new(buffer) child.border_width = 10 vbox = Gtk::VBox.new(true, 0) vbox.border_width = 10 child.add(vbox) hbox = Gtk::HBox.new(true, 0) vbox.pack_start(hbox, false, true, 5) button1 = Gtk::CheckButton.new("Fill Tab") hbox.pack_start(button1, true, true, 5) button1.active = true button1.signal_connect('toggled'){ @notebook.child_set_property(child, :tab_fill, button1.active?) } button2 = Gtk::CheckButton.new("Expand Tab") hbox.pack_start(button2, true, true, 5) button2.signal_connect('toggled'){ @notebook.child_set_property(child, :tab_expand, button2.active?) } =begin button3 = Gtk::CheckButton.new("Pack end") hbox.pack_start(button3, true, true, 5) button3.signal_connect('toggled'){ expand, fill, pack = @notebook.query_tab_label_packing(child) @notebook.set_tab_label_packing(child, expand, fill, button3.active? ? :end : :start) } =end button = Gtk::Button.new("Hide Page") vbox.pack_end(button, false, false, 5) button.signal_connect('clicked'){ child.hide } child.show_all label_box = Gtk::HBox.new(false, 0) pixwid = Gtk::Image.new(@book_closed, @book_closed_mask) label_box.pack_start(pixwid, false, true, 0) pixwid.set_padding(3, 1) label = Gtk::Label.new(buffer) label_box.pack_start(label, false, true, 0) label_box.show_all menu_box = Gtk::HBox.new(false, 0) pixwid = Gtk::Image.new(@book_closed, @book_closed_mask) menu_box.pack_start(pixwid, false, true, 0) pixwid.set_padding(3, 1) label = Gtk::Label.new(buffer) menu_box.pack_start(label, false, true, 0) menu_box.show_all @notebook.append_page_menu(child, label_box, menu_box) end end def set_page_pixmaps(notebook, page_num, pix, mask) child = notebook.get_nth_page(page_num) label = notebook.get_tab_label(child).children[0].set(pix, mask) end def page_switch(notebook, page, page_num) old_page_num = notebook.page return if (page_num == old_page_num) set_page_pixmaps(notebook, page_num, @book_open, @book_open_mask) if (old_page_num != -1) set_page_pixmaps(notebook, old_page_num, @book_closed, @book_closed_mask) end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/statusbar.rb����������������������������������������������0000644�0001750�0001750�00000005126�11701304107�020763� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header statusbar.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/21 17:47:19 $ $Id: statusbar.rb,v 1.6 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class StatusbarSample < SampleWindow def initialize super("statusbar") set_border_width(5) @counter = 1 vbox = Gtk::VBox.new(false, 5) add(vbox) statusbar = Gtk::Statusbar.new vbox.pack_end(statusbar, true, true, 0) statusbar.signal_connect("text_popped"){|o, mid, text| @counter = 1 if text puts "poped" } statusbar.signal_connect("text_pushed"){|o, mid, text| # do nothing... as of gtk 1.2.6 puts "pushed" } button_push = Gtk::Button.new("push something") vbox.add(button_push) button_push.signal_connect("clicked"){ @counter += 1 statusbar.push(1, "something #{@counter}") } button_pop = Gtk::Button.new("pop") vbox.add(button_pop) button_pop.signal_connect("clicked"){ statusbar.pop(1) } button_steal = Gtk::Button.new("steal #4") vbox.add(button_steal) button_steal.signal_connect("clicked"){ statusbar.remove(1, 4) } button_context = Gtk::Button.new("test contexts") vbox.add(button_context) button_context.signal_connect("clicked"){ ["any context", "idle messages", "some text", "hit the mouse", "hit the mouse2"].each do |str| puts "Gtk::StatusBar: context=\"#{str}\", context_id=#{statusbar.get_context_id(str)}" end } vbox.add(Gtk::HSeparator.new) button_close = Gtk::Button.new("close") button_close.signal_connect("clicked"){destroy} vbox.add(button_close) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/progressbar.rb��������������������������������������������0000644�0001750�0001750�00000011503�11701304107�021300� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header progressbar.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: progressbar.rb,v 1.9 2005/07/18 17:13:32 mutoh Exp $ Rewritten by Minoru Inachi <inachi@earth.interq.or.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ProgressBarSample < SampleDialog def initialize super("Gtk::ProgressBar") set_border_width(10) vbox1 = Gtk::VBox.new(false, 5) vbox1.border_width = 10 child.add(vbox1) frame = Gtk::Frame.new("Progress") vbox1.add(frame) vbox2 = Gtk::VBox.new(false, 5) frame.add(vbox2) align = Gtk::Alignment.new(0.5, 0.5, 0, 0) vbox2.pack_start(align, FALSE, FALSE, 5) @pbar = Gtk::ProgressBar.new align.add(@pbar) @timer = GLib::Timeout.add(100){progress_timeout} align = Gtk::Alignment.new(0.5, 0.5, 0, 0) vbox2.pack_start(align, false, false, 5); hbox = Gtk::HBox.new(false, 5) align.add(hbox) label = Gtk::Label.new("Label updated by user :") hbox.add(label) @label = Gtk::Label.new("") hbox.add(@label) frame = Gtk::Frame.new("Options") vbox1.add(frame) vbox2 = Gtk::VBox.new(false, 5) frame.add(vbox2) tab = Gtk::Table.new(3, 2, false) vbox2.add(tab) label = Gtk::Label.new("Orientation :"); tab.attach(label, 0, 1, 0, 1, [:expand, :fill], [:expand, :fill], 5, 5) # Gtk::EXPAND | Gtk::FILL label.set_alignment(0, 0.5) =begin @omenu1 = build_option_menu( [ OptionMenuItem.new("Left-Right", proc { |w| toggle_orientation(w) }), OptionMenuItem.new("Right-Left", proc { |w| toggle_orientation(w) }), OptionMenuItem.new("Bottom-Top", proc { |w| toggle_orientation(w) }), OptionMenuItem.new("Top-Bottom", proc { |w| toggle_orientation(w) }) ], 0) hbox = Gtk::HBox.new(false, 0) tab.attach(hbox, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5); hbox.add(@omenu1) =end check = Gtk::CheckButton.new("Show text") check.signal_connect("clicked") do |w| toggle_show_text(w) end tab.attach(check, 0, 1, 1, 2, [:expand, :fill], [:expand, :fill], 5, 5) hbox = Gtk::HBox.new(false, 0) tab.attach(hbox, 1, 2, 1, 2, [:expand, :fill], [:expand, :fill], 5, 5) label = Gtk::Label.new("Text align :") tab.attach(label, 0, 1, 2, 3, [:expand, :fill], [:expand, :fill], 5, 5) label.set_alignment(0, 0.5) hbox = Gtk::HBox.new(false, 0) tab.attach(hbox, 1, 2, 2, 3, [:expand, :fill], [:expand, :fill], 5, 5) label = Gtk::Label.new("x :") hbox.pack_start(label, false, true, 5) adj = Gtk::Adjustment.new(0.5, 0, 1, 0.1, 0.1, 0) @x_align_spin = Gtk::SpinButton.new(adj, 0, 1) adj.signal_connect("value_changed"){adjust_align} hbox.pack_start(@x_align_spin, false, true, 0) @x_align_spin.sensitive = false label = Gtk::Label.new("y :") hbox.pack_start(label, false, true, 5) adj = Gtk::Adjustment.new(0.5, 0, 1, 0.1, 0.1, 0) @y_align_spin = Gtk::SpinButton.new(adj, 0, 1) adj.signal_connect("value_changed"){adjust_align} hbox.pack_start(@y_align_spin, false, true, 0) @y_align_spin.sensitive = false button = Gtk::Button.new("close") button.signal_connect("clicked"){ GLib::Source.remove(@timer) destroy } button.can_default = true self.action_area.add(button) button.grab_default end private def toggle_orientation(rmitem) return unless rmitem.mapped? i = 3 group = rmitem.group group.each do |g| break if g.active? i -= 1 end @pbar.orientation = i end private def progress_timeout new_val = @pbar.fraction + 0.05 new_val = 0.0 if new_val > 1.0 @pbar.fraction = new_val @label.text = "#{(new_val * 100).to_i}" true end private def toggle_show_text(cbutton) @pbar.show_text = cbutton.active? @x_align_spin.sensitive = cbutton.active? @y_align_spin.sensitive = cbutton.active? end private def adjust_align @pbar.text_xalign = @x_align_spin.value @pbar.text_yalign = @y_align_spin.value end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/range.rb��������������������������������������������������0000644�0001750�0001750�00000003515�11701304107�020047� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header range.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: range.rb,v 1.6 2005/07/18 17:13:32 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class RangeSample < SampleWindow def initialize super("range controls") vbox = Gtk::VBox.new(false, 10) add(vbox) adjustment = Gtk::Adjustment.new(0.0, 0.0, 101.0, 0.1, 1.0, 1.0) scale = Gtk::HScale.new(adjustment) scale.set_size_request(150, 50) scale.update_policy = Gtk::UPDATE_DELAYED scale.digits = 1 scale.draw_value = true vbox.add(scale) scrollbar = Gtk::HScrollbar.new(adjustment) scrollbar.update_policy = Gtk::UPDATE_CONTINUOUS vbox.add(scrollbar) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, true, true, 0) button.can_default = true button.grab_default end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/FilesQueue.xpm��������������������������������������������0000644�0001750�0001750�00000005503�11701304107�021222� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * FilesQueue_xpm[] = { "44 31 64 1", " c None", ". c #E79DE38DDF7D", "X c #CF3CC71BCF3C", "o c #71C675D671C6", "O c #B6DAB2CAB6DA", "+ c #CF3CD34CCF3C", "@ c #DF7DE38DE79D", "# c #FFFFFBEEFFFF", "$ c #EFBEEFBEEFBE", "% c #DF7DDB6CDF7D", "& c #BEFBBAEAC71B", "* c #BEFBBAEABEFB", "= c #BEFBC30BC71B", "- c #71C66DB671C6", "; c #D75CD34CD75C", ": c #9E799A699E79", "> c #E79DE38DE79D", ", c #CF3CCB2BC71B", "< c #B6DAB2CABEFB", "1 c #BEFBBAEAB6DA", "2 c #B6DAB6DAB6DA", "3 c #618561856185", "4 c #C71BBAEABEFB", "5 c #AEBAAAAAAEBA", "6 c #965892488E38", "7 c #A699A699A699", "8 c #38E338E338E3", "9 c #F7DEF7DEF7DE", "0 c #E79DEFBEEFBE", "q c #DF7DE38DDF7D", "w c #C71BC71BC71B", "e c #C71BC30BBEFB", "r c #BEFBC30BBEFB", "t c #B6DAAAAAAEBA", "y c #410345144103", "u c #D75CDB6CD75C", "i c #C71BCB2BC71B", "p c #BEFBCB2BBEFB", "a c #9E79A289A699", "s c #86178E388E38", "d c #CF3CCF3CD75C", "f c #CF3CD75CCF3C", "g c #C71BC30BCF3C", "h c #28A22CB228A2", "j c #000000000000", "k c #D75CD34CDF7D", "l c #10400C300820", "z c #E79DEBADEFBE", "x c #DF7DDB6CD75C", "c c #514459655965", "v c #8617861779E7", "b c #DF7DD34CD75C", "n c #CF3CCB2BCF3C", "m c #618555555965", "M c #861786178617", "N c #30C234D330C2", "B c #EFBEEBADE79D", "V c #DF7DDB6CE79D", "C c #D75CE38DD75C", "Z c #514449245144", "A c #186120812081", "S c #79E77DF779E7", "D c #6185659569A6", "F c #9E7992489E79", " .XoOX+ ", " @#$%&*=-o;: ", " @>,=O<12*&:-<3X ", " >%&1*4*2*OO**56758790 ", " 9qX+we=r*&e<<<251t5555yu9 ", " $qu++;ipi=p*=p**2tOOO27a5s<- ", " #9udfXi;,gi&**4**4r*Ot5t55tehj ", " 0qku+u;+d,gg=*=r*&**&<255t<*yl1 ", " $$zq@%xk%uf;,w,i=i=e**r=12tO1=8cvj ", " $@%>.%.%%%xbkx,w+ni,wwrwe*4*1=;8mMNj ", " zz@Bz>>>V%%%C+u;;dfnnfwggi&=&X+yZsNll ", " af#9@B0>q>qqq>xk.;;;kfX+XnXw=g,fycMhhN5 ", " al5#9$$>qzBV.%x%%b;x+fnf+,X,iiqym6NAo-j ", " #roS%#$zz>>V%%xkk%f;;+df,XnwnVZD:8AS-j* ", " D-9Oy*9$Bz>q%qx%%u;x;;dknX+d>Zm:hhSDjr ", " a3o+>S3z#90@@z.%>qCC%uu;ff%@Zm:NhMoj= ", " wlvvo#:3599$>B>q>%%%%+f;fk$ymaalMvjr ", " 0.a--S49mct9$z@.qkkqC;xu%@Zm5AlvSj* ", " ohu%3:Z:9@y609q@@>..>Cx>$Zm5NhMvjr ", " -j797Zv5705y=#$0>>V.%>#Z378AMMj* ", " Zj9Xo-McBXDv%90.%%#9cc78AsMj* ", " 8hM#M-DSF96cvz0>z#c35Nhs6j1 ", " jl9#o63vx#-D###mmt8N66j* ", " 5jc@fZF3o%+ZFDm<8A6FjO ", " :j50sSay<$ss2Nh:FjO ", " 6880&SDMF.rNNFFj1 ", " 8jr#:SFScA6ajO ", " Alr$DSysajO ", " >jy#51:jO ", " %Dy*gjO ", " alla "}; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/scrolledwindow.rb�����������������������������������������0000644�0001750�0001750�00000004072�11701304107�022011� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header scrolledwindow.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/21 17:47:19 $ $Id: scrolledwindow.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ScrolledWindowSample < SampleDialog def initialize super("dialog") scrolled_window = Gtk::ScrolledWindow.new scrolled_window.border_width = 10 scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vbox.add(scrolled_window) table = Gtk::Table.new(20, 20, false) table.row_spacings = 10 table.column_spacings = 10 scrolled_window.add_with_viewport(table) table.focus_hadjustment = scrolled_window.hadjustment table.focus_vadjustment = scrolled_window.vadjustment for i in 0..19 for j in 0..19 buffer = "button (#{i},#{j})" button = Gtk::ToggleButton.new(buffer) table.attach(button, i, i + 1, j, j + 1) end end button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} action_area.pack_start(button, true, true, 0) set_default_size(300, 300) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/circles.xbm�����������������������������������������������0000644�0001750�0001750�00000006335�11701304107�020565� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define circles_width 64 #define circles_height 64 static unsigned char circles_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0xf8, 0x1f, 0x00, 0x20, 0x00, 0x00, 0xff, 0x03, 0xf8, 0x0f, 0x00, 0xff, 0x07, 0x00, 0xfe, 0x03, 0xfc, 0x07, 0xc0, 0xff, 0x1f, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xf0, 0xff, 0x7f, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0x07, 0xfe, 0x03, 0xfc, 0xff, 0xff, 0x01, 0xf8, 0x0f, 0xfe, 0x01, 0xfe, 0x8f, 0xff, 0x03, 0xf0, 0x0f, 0xfe, 0x01, 0xfe, 0x01, 0xfc, 0x03, 0xf0, 0x0f, 0xff, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x1f, 0xff, 0x00, 0x7f, 0x00, 0xf0, 0x07, 0xe0, 0x1f, 0xff, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0xc0, 0x0f, 0x00, 0x80, 0x1f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x81, 0x3f, 0x00, 0xe0, 0x0f, 0xf0, 0x1f, 0xfe, 0x01, 0x7f, 0x00, 0xf0, 0x07, 0xf0, 0x0f, 0xfe, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x0f, 0xfe, 0x03, 0xfe, 0x01, 0xfc, 0x03, 0xf8, 0x0f, 0xfc, 0x03, 0xfe, 0x8f, 0xff, 0x03, 0xf8, 0x07, 0xfc, 0x07, 0xfc, 0xff, 0xff, 0x01, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0xff, 0xff, 0x00, 0xfc, 0x07, 0xf8, 0x0f, 0xf0, 0xff, 0x7f, 0x00, 0xfe, 0x03, 0xf8, 0x1f, 0xc0, 0xff, 0x1f, 0x00, 0xff, 0x03, 0xf0, 0x1f, 0x00, 0xff, 0x07, 0x00, 0xff, 0x01, 0xf0, 0x3f, 0x00, 0x20, 0x00, 0x80, 0xff, 0x01, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk3/sample/testgtk/toolbar.rb������������������������������������������������0000644�0001750�0001750�00000004771�11701304107�020422� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header toolbar.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Id: toolbar.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ToolbarSample < SampleWindow def initialize super("Toolbar test") toolbar = Gtk::Toolbar.new toolbar.append("Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal", Gtk::Image.new("test.xpm")){ toolbar.orientation = Gtk::ORIENTATION_HORIZONTAL } toolbar.append("Vertical", "Vertical toolbar layout", "Toolbar/Vertical", Gtk::Image.new("test.xpm")){ toolbar.orientation = Gtk::ORIENTATION_VERTICAL } toolbar.append_space toolbar.append("Icons", "Only show toolbar icons", "Toolbar/IconsOnly", Gtk::Image.new("test.xpm")){ toolbar.toolbar_style = Gtk::Toolbar::ICONS } toolbar.append("Text", "Only show toolbar text", "Toolbar/TextOnly", Gtk::Image.new("test.xpm")){ toolbar.toolbar_style = Gtk::Toolbar::TEXT } toolbar.append("Both", "Show toolbar icons and text", "Toolbar/Both", Gtk::Image.new("test.xpm")){ toolbar.toolbar_style = Gtk::Toolbar::BOTH } toolbar.append_space toolbar.append(Gtk::Entry.new, "This is an unusable Gtk::Entry ;)", "Hey don't click me!!!") toolbar.append_space toolbar.append("Enable", "Enable tooltips", nil, Gtk::Image.new("test.xpm")){ toolbar.tooltips = true } toolbar.append("Disable", "Disable tooltips", nil, Gtk::Image.new("test.xpm")){ toolbar.tooltips = false } add(toolbar) end end �������ruby-gnome2-all-2.2.5/webkit-gtk2/������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�014743� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/test/�������������������������������������������������������������0000755�0001750�0001750�00000000000�12423063747�015733� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/test/test_webkit_gtk_webview.rb�����������������������������������0000644�0001750�0001750�00000001743�12423063747�023206� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestWebKitGtk2WebView < Test::Unit::TestCase include WebKitGtk2TestUtils::Omissions def test_webkit_gtk_webview omit_on_os_x assert_nothing_raised do WebKitGtk2::WebView.new end end end �����������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/test/run-test.rb��������������������������������������������������0000755�0001750�0001750�00000004276�12257552170�020053� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2013 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gio_base = File.join(ruby_gnome2_base, "gio2") atk_base = File.join(ruby_gnome2_base, "atk") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gtk2_base = File.join(ruby_gnome2_base, "gtk2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") webkit_gtk2_base = File.join(ruby_gnome2_base, "webkit-gtk2") modules = [ [glib_base, "glib2"], [gio_base, "gio2"], [atk_base, "atk"], [pango_base, "pango"], [gdk_pixbuf_base, "gdk_pixbuf2"], [gtk2_base, "gtk2"], [gobject_introspection_base, "gobject-introspection"], [webkit_gtk2_base, "webkit-gtk2"], ] modules.each do |target, module_name| if File.exist?("Makefile") and system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" $LOAD_PATH.unshift(File.join(webkit_gtk2_base, "test")) require "webkit-gtk-test-utils" require "webkit-gtk2" exit Test::Unit::AutoRunner.run(true) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/test/webkit-gtk-test-utils/���������������������������������������0000755�0001750�0001750�00000000000�12423063747�022116� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/test/webkit-gtk-test-utils/omissions.rb���������������������������0000644�0001750�0001750�00000001641�12423063747�024470� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 module WebKitGtk2TestUtils module Omissions def omit_on_os_x omit("Skip this test on OS X") if RUBY_PLATFORM =~ /darwin/ end end end �����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/test/webkit-gtk-test-utils.rb�������������������������������������0000644�0001750�0001750�00000001610�12423063747�022441� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013-2014 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 require "test-unit" require "test/unit/notify" require "webkit-gtk-test-utils/omissions" module WebKitGtkTestUtils end ������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/Rakefile����������������������������������������������������������0000644�0001750�0001750�00000003117�12446160551�016417� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/WebKitGtk2 is a Ruby binding of WebKitGTK+ for Gtk 2.0 Toolkit" package.description = "Ruby/WebKitGtk2 is a Ruby binding of WebKitGTK+ for Gtk 2.0 Toolkit" package.dependency.gem.runtime = ["gobject-introspection", "gtk2"] package.dependency.gem.development = ["test-unit-notify"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = ["glib2", "gobject-introspection"] package.windows.build_packages = [] end package_task.define namespace :dependency do desc "Install dependencies" task :install do # TODO: Install gir1.2-webkit-1.0 on Debian. end end task :build => "dependency:install" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/README.md���������������������������������������������������������0000644�0001750�0001750�00000001017�12123512153�016215� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/WebKitGTK2 Ruby/WebKitGTK2 is a Ruby binding of WebKitGTK+ for GTK+ 2. ## Requirements * Ruby/GObjectIntrospection and Ruby/GTK2 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [WebKitGTK+](http://webkitgtk.org/) ## Install gem install webkit-gtk2 ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/COPYING.LIB�������������������������������������������������������0000644�0001750�0001750�00000063642�12123512153�016412� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/lib/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015514� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/lib/webkit-gtk2.rb������������������������������������������������0000644�0001750�0001750�00000002603�12516434313�020174� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "gobject-introspection" require "gtk2" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) module WebKitGtk2 class << self def const_missing(name) init if const_defined?(name) const_get(name) else super end end def init class << self remove_method(:init) remove_method(:const_missing) end Loader.load("WebKit", self, :version => "1.0") end end class Loader < GObjectIntrospection::Loader end end �����������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/sample/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12147676243�016241� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk2/sample/brower.rb��������������������������������������������������0000644�0001750�0001750�00000002066�12147676243�020072� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "webkit-gtk2" window = Gtk::Window.new window.signal_connect("destroy") do Gtk.main_quit end scrolled_window = Gtk::ScrolledWindow.new view = WebKitGtk2::WebView.new view.load_uri("http://webkitgtk.org/") scrolled_window.add(view) window.add(scrolled_window) window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/COPYING.LIB�������������������������������������������������������������������0000644�0001750�0001750�00000063642�12257552167�014301� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�015056� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/test/�������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�016040� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/test/clutter-gtk-test-utils.rb������������������������������������0000644�0001750�0001750�00000001531�12077252561�022752� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "test-unit" require "test/unit/notify" module ClutterGtkTestUtils end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/test/run-test.rb��������������������������������������������������0000755�0001750�0001750�00000005217�12516434313�020156� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2012-2013 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 have_make = system("which make > /dev/null") ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") clutter_base = File.join(ruby_gnome2_base, "clutter") gdk3_base = File.join(ruby_gnome2_base, "gdk3") gtk3_base = File.join(ruby_gnome2_base, "gtk3") clutter_gtk_base = File.join(ruby_gnome2_base, "clutter-gtk") modules = [ [glib_base, "glib2"], [atk_base, "atk"], [pango_base, "pango"], [gdk_pixbuf_base, "gdk_pixbuf2"], [cairo_gobject_base, "cairo-gobject"], [gobject_introspection_base, "gobject-introspection"], [clutter_base, "clutter"], [gdk3_base, "gdk3"], [gtk3_base, "gtk3"], [clutter_gtk_base, "clutter-gtk"], ] modules.each do |target, module_name| if File.exist?(File.join(target, "Makefile")) and have_make `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $VERBOSE = false # TODO: remove me $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" $LOAD_PATH.unshift(File.join(clutter_base, "test")) require "clutter-test-utils" $LOAD_PATH.unshift(File.join(clutter_gtk_base, "test")) require "clutter-gtk-test-utils" require "clutter-gtk" # exclude sample/test-* clutter_gtk_test_base = File.join(clutter_gtk_base, "test") exit Test::Unit::AutoRunner.run(true, clutter_gtk_test_base) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/test/test-clutter-gtk-embed.rb������������������������������������0000644�0001750�0001750�00000001576�12257552167�022704� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 class ClutterGtkEmbedTest < Test::Unit::TestCase def test_new assert_not_nil(ClutterGtk::Embed.new) end end ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/Rakefile����������������������������������������������������������0000644�0001750�0001750�00000004362�12416375023�016534� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013-2014 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/ClutterGTK is a Ruby binding of Clutter-GTK." package.description = "Ruby/ClutterGTK is a Ruby binding of Clutter-GTK." package.dependency.gem.runtime = ["clutter", "gtk3"] package.dependency.gem.development = ["test-unit-notify"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", "gobject-introspection", "clutter", "gdk3", ] package.windows.gobject_introspection_dependencies = [ "atk", "pango", "gdk_pixbuf2", "clutter", "gdk3", ] package.external_packages = [ { :name => "clutter-gtk", :download_site => :gnome, :label => "Clutter-GTK", :version => "1.6.0", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :patches => [ "0001-actor-fix-clutter-win32.h-include-path.patch", "0001-Use-no-undefined-ld-flag.patch", ], :need_autoreconf => true, :built_file => "bin/libclutter-gtk-1.0-0.dll", }, } ] end package_task.define namespace :dependency do desc "Install depenencies" task :install do # TODO: Install gir1.2-gtkclutter-1.0 on Debian. end end task :build => "dependency:install" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/README.md���������������������������������������������������������0000644�0001750�0001750�00000001413�12077252561�016344� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/ClutterGTK Ruby/ClutterGTK is a Ruby binding of Clutter-GTK. ## Requirements * Ruby/Clutter and Ruby/GTK3 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [Clutter-GTK](http://blogs.gnome.org/clutter/) ## Install gem install clutter-gtk ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ### Exceptions Ruby scripts and image files in sample/ are ported and copied from Clutter. Headers in samples/*.rb describes that the location of the original file of the Ruby script and image files. The original files are licensed under the LGPL v2.1 or later. ## Project Website http://ruby-gnome2.sourceforge.jp/ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/COPYING.LIB�������������������������������������������������������0000644�0001750�0001750�00000063642�12077252561�016541� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/lib/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015627� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/lib/clutter-gtk.rb������������������������������������������������0000644�0001750�0001750�00000004405�12516434313�020424� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013-2014 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 require "clutter" require "gtk3" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) module ClutterGtk LOG_DOMAIN = "Clutter-Gtk" GLib::Log.set_log_domain(LOG_DOMAIN) class << self def const_missing(name) init() if const_defined?(name) const_get(name) else super end end def init(argv=[]) class << self remove_method(:init) remove_method(:const_missing) end loader = Loader.new(self, argv) loader.load("GtkClutter") Clutter.init(argv) if Clutter.respond_to?(:init) end end class Loader < GObjectIntrospection::Loader class InitError < StandardError end def initialize(base_module, init_arguments) super(base_module) @init_arguments = init_arguments end private def pre_load(repository, namespace) init = repository.find(namespace, "init") arguments = [ [$0] + @init_arguments, ] error, returned_arguments = init.invoke(:arguments => arguments) @init_arguments.replace(returned_arguments[1..-1]) if error.to_i <= 0 raise InitError, "failed to initialize Clutter-GTK: #{error.name}" end end def post_load(repository, namespace) end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12147676243�016354� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/window-test.rb���������������������������������������������0000755�0001750�0001750�00000005430�12147676243�021172� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gtk/examples/gtk-clutter-window-test.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # The original header: # (c) 2009, Collabora Ltd. # # Written by Davyd Madeley <davyd.madeley@collabora.co.uk> # # Copyright (C) 2013 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 require "clutter-gtk" require "gdk_pixbuf2" window = ClutterGtk::Window.new window.signal_connect("destroy") do Gtk.main_quit end window.set_default_size(400, 300) NAME_COLUMN = 0 PIXBUF_COLUMN = 1 store = Gtk::ListStore.new(String, Gdk::Pixbuf) theme = Gtk::IconTheme.default [ "devhelp", "empathy", "evince", "gnome-panel", "seahorse", "sound-juicer", "totem", ].each do |icon_name| pixbuf = theme.load_icon(icon_name, 48, 0) iter = store.append iter[0] = icon_name iter[1] = pixbuf end icon_view = Gtk::IconView.new(store) icon_view.text_column = NAME_COLUMN icon_view.pixbuf_column = PIXBUF_COLUMN scrolled_window = Gtk::ScrolledWindow.new window.add(scrolled_window) scrolled_window.add(icon_view) scrolled_window.show_all # Widget 2 is a toolbar stage = window.stage toolbar = Gtk::Toolbar.new [ Gtk::Stock::ADD, Gtk::Stock::BOLD, Gtk::Stock::ITALIC, Gtk::Stock::CANCEL, Gtk::Stock::CDROM, Gtk::Stock::CONVERT, ].each do |stock_id| item = Gtk::ToolButton.new(:stock_id => stock_id) toolbar.insert(item, -1) end toolbar.show_all actor = ClutterGtk::Actor.new(toolbar) actor.add_constraint(Clutter::BindConstraint.new(stage, :width, 0.0)) actor.signal_connect("enter-event") do |_actor, event| _actor.save_easing_state do _actor.easing_mode = :linear _actor.opacity = 255 _actor.y = 0 end Clutter::Event::STOP end actor.signal_connect("leave-event") do |_actor, event| _actor.save_easing_state do _actor.easing_mode = :linear _actor.opacity = 128 _actor.y = _actor.height * -0.5 end Clutter::Event::STOP end actor.y = actor.height * -0.5 actor.opacity = 128 actor.reactive = true stage.add_child(actor) window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/test-actor.rb����������������������������������������������0000755�0001750�0001750�00000010653�12147676243�020776� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gtk/examples/gtk-clutter-test-actor.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "clutter-gtk" MAX_N_WIDGETS = 4 WINDOW_WIDTH = 400 WINDOW_HEIGHT = 400 RADIUS = 80 do_rotate_p = true window = Gtk::Window.new window.signal_connect("destroy") do Gtk.main_quit end vbox = Gtk::Box.new(:vertical, 6) window.add(vbox) clutter = ClutterGtk::Embed.new clutter.set_size_request(WINDOW_WIDTH, WINDOW_HEIGHT) vbox.pack_start(clutter, :expand => true, :fill => true, :padding => 0) stage = clutter.stage button = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT) button.signal_connect("clicked") do |_button| window.destroy end vbox.pack_end(button, :expand => false, :fill => false, :padding => 0) stage.background_color = Clutter::Color.new(0x61, 0x64, 0x8c, 0xff) widgets = [] # create a new group to hold multiple actors in a group group = Clutter::Actor.new create_gtk_actor = lambda do gtk_actor = ClutterGtk::Actor.new bin = gtk_actor.widget vbox = Gtk::Box.new(:vertical, 6) bin.add(vbox) button = Gtk::Button.new(:label => "A Button") vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect("clicked") do |_button| puts("button clicked") label = Gtk::Label.new("A new label") label.show vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) end button = Gtk::CheckButton.new("Another button") vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) entry = Gtk::Entry.new vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0) bin.show_all gtk_actor end add_clutter_actor = lambda do |actor, container, i| container.add_child(actor) # Place around a circle w = widgets.first.width h = widgets.first.height x = WINDOW_WIDTH / 2 + RADIUS * Math.cos(i * 2 * Math::PI / (MAX_N_WIDGETS)) - w / 2 y = WINDOW_HEIGHT / 2 + RADIUS * Math.sin(i * 2 * Math::PI / (MAX_N_WIDGETS)) - h / 2 actor.set_position(x, y) end MAX_N_WIDGETS.times do |i| widget = create_gtk_actor.call widgets[i] = widget add_clutter_actor.call(widget, group, i) end # Add the group to the stage and center it stage.add_child(group) group.add_constraint(Clutter::AlignConstraint.new(stage, :x_axis, 0.5)) group.add_constraint(Clutter::AlignConstraint.new(stage, :y_axis, 0.5)) window.show_all # Create a timeline to manage animation timeline = Clutter::Timeline.new(6000) timeline.repeat_count = -1 # fire a callback for frame change timeline.signal_connect("new-frame") do |_timeline, m_secs| rotation = _timeline.progress * 360.0 if do_rotate_p # Rotate everything clockwise about stage center group.set_rotation(:z_axis, rotation, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 0) widgets.each do |widget| # rotate each widget around its center w = widget.width h = widget.height widget.set_rotation(:z_axis, -(2 * rotation), w / 2, h / 2, 0) widget.opacity = 50 * Math.sin(2 * Math::PI * rotation / 360) + (255 - 50) end end end # and start it timeline.start GLib::Timeout.add_seconds(3) do if MAX_N_WIDGETS == widgets.size # Removing an item group.remove_child(widgets.pop) else # Adding an item widget = create_gtk_actor.call widgets << widget add_clutter_actor.call(widget, group, MAX_N_WIDGETS - 1) end keep_callback = true keep_callback end Gtk.main �������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/multistage.rb����������������������������������������������0000755�0001750�0001750�00000005123�12147676243�021063� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gtk/examples/gtk-clutter-multistage.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "clutter-gtk" require "gdk_pixbuf2" window = Gtk::Window.new window.set_default_size(600, 400) window.title = "Multiple GtkClutterEmbed" window.signal_connect("destroy") do Gtk.main_quit end notebook = Gtk::Notebook.new window.add(notebook) clutter0 = ClutterGtk::Embed.new notebook.append_page(clutter0, Gtk::Label.new("One stage")) stage0 = clutter0.stage stage0.background_color = Clutter::Color.new(0xdd, 0xff, 0xdd, 0xff) vbox = Gtk::Box.new(:vertical, 6) notebook.append_page(vbox, Gtk::Label.new("Two stages")) clutter1 = ClutterGtk::Embed.new clutter1.set_size_request(320, 240) stage1 = clutter1.stage stage1.background_color = Clutter::Color.new(0xff, 0xff, 0xff, 0xff) texture1 = ClutterGtk::Texture.new texture1.set_from_stock(clutter1, Gtk::Stock::DIALOG_INFO.to_s, :dialog) texture1.set_anchor_point(texture1.width / 2, texture1.height / 2) texture1.set_position(160, 120) stage1.add_child(texture1) texture1.show vbox.add(clutter1) clutter2 = ClutterGtk::Embed.new clutter2.set_size_request(320, 120) stage2 = clutter2.stage stage2.background_color = Clutter::Color.new(0x00, 0x00, 0x00, 0xff) texture2 = ClutterGtk::Texture.new texture2.set_from_icon_name(clutter1, "user-info", :button) texture2.set_anchor_point(texture2.width / 2, texture2.height / 2) texture2.set_position(160, 60) stage2.add_child(texture2) vbox.add(clutter2) stage2.signal_connect("allocation-changed") do |actor, allocation, flags| texture2.set_position((allocation.x2 - allocation.x1) / 2, (allocation.y2 - allocation.y1) / 2) end window.show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/redhand.png������������������������������������������������0000644�0001750�0001750�00000020072�12077252561�020463� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������������bKGD������ pHYs�� �� ����tIME 3x<,��IDATx]y|M~>( "HQV> Q)UU:hPzRJu]\PBiBEDD99Z9kwg=Z888888888888888888888888D),rU0H#ۜ#Tىm!8Ad' ` (�@9�cɂ 4$ p.w Y�) $m"!Eچ.�RT 3 49m0L)c&f=(cl+TRJRJ/e-JcPJ#VboL)}RYp'l0t0;]X Lfse(4VuC]e J)SDؐmC)N)-۸6?! [R:ֆ^l*xE%<c~|�8es J;jۆRM*mNnXŢ%Lcu'3~&<nam% d'_NMJWI<pf.'"u:'$CNAr L&?BH!$-LJy)\,Bל2qpWJ0BlɄ3gPK//60>#wo&&+b�}i)JFuZ ` aa+<\0N<5uWT�@m:t@P>M芋Qv~ 0Cpu٪EeB:8:A.BK-۸W�`v2ϖ-vDN M^KKݠz }=s&&u156v- l0Dھ4^^6O x1J~ζqwGOHر$$t !dBJSRpaLzγuktZ�Æ:3CMw?J:l:/^ m|^f=H3y6z…h9tlu1{Fm i"KXn*b)ANJ�we:\0AZ|ot7n<uJ;7ҟbY Lm=c:Lnm pPoM4*B, G<!$MҔl2?.D2͓kTTסCE؟=0}wO^_˟.m^z qK~GEkVţE ݽ[jܶ2VJrE֢E ��]/m6pv$Y� ?*iQ6r�@5O6Rg&Lƍ^I=cA{x *6Mp;oKܵkQzA~Y[WRӧFf,_J_Iy瑵x4tcRؗ,_޴|k՞?GJd/]j|j O?VPY}$z]&~}jx tBDPY+kڬ׶lAC~E{`F#B/u̴|"[:ԅtK)&8 A�>|c.Ńpv_ԀE;wZɢEۆR\ۺ6דE-ÑҔW2QmӺPq٦637lZCEΉ 0A�Wµz%"%lnb9/GDRKca+.bi9R4ټ.TuiY^@-<kQƂrl IKVbihpjQ%0J Xj;'R#̜ ~ @m!NM \Ap +W \Ap +W>s +W \ApuvApipU],L],s +Ws +W \Ap \Ap +W . TNJ^Z v]ލX[ S}=�P @􄛏. .AX�}yC+A8x cp +W vBJhPrWSXUgQaKvѣ;wX ׯa(;reRW֮qMouuq3V(ؼ`= @WRf<3gx RG>\s^O0Jqu2Ǐ󞼛ۥ!sB{ _c O2EA4h||  D3F6264^GqӮ5d ҿ!t Ovh֩uxm Z-A�[v)5@u:XX<E\+W@umi4TVi8(B�$& 11Rh4иC wx"Gr JKC4%5|Arڠ <Z>}֬m3A68!!d ̞ ]QdT?d1h4>C؜w#gX"ƍCsϡ>?׶l-[k(6rUwfwDz _}E?eP061Bj:bOfqqDj6jBG=^8䷻K qHX:ur=VawNkxic 4.Wx8]Ĥ$:>:|88)S xxpK8E˸1iՙH??͝>w,gXz}=̓Sw_.u+:&;w!߿]j!fL$&%eK>]ٳiɁ v'VD7ް+7C-͛ǹ pGϤ$9/D<qehw40憸3kVNcQp&-ZmyNt>OO\7O3)<Q~~HܴBD2O 1{wދ3<cgVKk;]>- Ɛ vI'ӵZ$Xx l ܯ|rⷄիp#$Vpr?>13XDA_3,l1nZ],Gw<,B|h'A@ŋ pTKۼ9by9s t,:k>z4lq ~I`hSvi<S]Qu,._F]v6 0Ԁ MH}|٪|:tol,{WDݝl$ :} f4BwCdgA}(ܶ 'N?k#"b`],ݺ!駑ĥBJlWeh,*յky3eegTu99]W֮_׮h+h#Z~4l$fAWZd.ZC!{2P4<Gz%xGE! ?_?s)޻ /Ʀedd183itk $ՃȘ?ƍS4.w!CPvjE. hRcu5Ne]\<Um'N1*HرՕOAm@z\9?L${cjB&ߕÞB3Jx1rWR~D.'mP^l!cnݪxѭFpNrgpibm'1 g@MFzGEkW 䡇-d~\ieɓnU-~+ ~ Qn̙`&CtVMFR2c{qNt)rW@]vb$$Xug#wdD`ފ+)A5aF\S^77],],B=p嫯`wN+LNV `^R^pWP7i`+ڕ,wX쁡¡;p6ٶ :u1Pbk*|t=*.F/( j ʸ'F#ʎqSl!x4A䚥ڶU4 Jn؝>T>J{o%5/t%GV._v0 u99RJDj rĀb }yWjxAkkjԔD< R)8NEco 6*)E�4NՁJJ# TA:Aj)j1$_1iR[gh2y<+lljF4XM6?||NΜ.K$HCa" VԢԫbWCHgEgQgUEa[#X vv_)KRPX[ =GZ HQTCcQ'(u[tŋ5O8|wX<UZ"o{W$2RREj32K߭UHO?XY5钟ue^ADh+)p4TUV脠ԩi!!ʉȭ �pB 5>>OV?XFwTCvZ/*eF~qDRJ*RSq7we/n&)VRE/ �A0Jk|ˡC[ 5xy)VdiJU]aQ/OwMQtY#0ŗK~ c�|Ʈ]3, ݖ-y"Ed%Q/j%o鸾cw< :#-[YG]vR]s7DԔ)h+vG�$~*+n a lwg^ $Um�D9zmx6VWO?aH}oL ۷\bfB>jƢϏ??!A oWD b@jU'h}m3֒O]i^3W.:.:i5rZScj LLD={9q7bBeˬZ\߱Ckޜ d/o.]$ULw 6oV=@hݹ-~&hat?xP_L ":H1c$W.grȦ߭w.?dq|cb{Yz[j)Q:<.Q1� hva,/[CUJCiJ ʏEcQ݉L4Cp<ݻJf4S92(1#!DA6j7mTÆ)zm 5 R_G}~>srTܚ5gVn׮FY_@ƍ>cJ! �Qjpx�ß~/)t8t}0TVި_D܂bjA?(ꋘy+v^۲ nwEd̟/;9BH-d<J Ji3#Z!&yuQ f)v_PhMe�BB cɔG)^vCGCy`bY@ӹh2M9 `!d!$R<MugRym9]YE;wQ-N)ν]s$'RJU �ꟐVZQp7PP9gGUvޣ'!dcoP"B-c)v|]5*+qajh# "룏l^JABPJB3VHQ֭NSy4ҦLQgBmf&Nw~t$J)OUS)϶6 11VhN\=KUxN }y+4ח/kHbɠRTD@O>zE7Ғ%uT**pbh4+~N~ [˟+9I,Nhd;SݔҖo}fƐ1o2,*SUׯctD3IVb5A*2Gʳ//$\)֜q~tlvFȑ]T$c�$qalYܤC a*V *OƩ瞃X:40�i'gh:B2%^Ba� Bڴie<Zk8'+Ji.s|/">#G1~<í}wъĬ"k�L򬩡#GYYA &0VW㷷FmN>"'L@W_l c Rڌr _ǯh((NO=N qV[Y2uJݳf[="}�t(!Drݚt CUlulqs"tpTcu5.})~K-R qfJM1\2E b.x3g>_~(N-CFG;MQ8Î\Ih}w$,Q fW$�Wr�N=쇤4h;q"^z -Z8(3*Ϝ%K\z�}w풲30!d1/!jQ̤I6I 6>^gǎ!{R8w܄n˗OJvA0)N3I^$Xò4%ƏYXZ?$"'NOt](TGiJ rWDّ# pG T f~+YSSqz8+*lVO"?8iUWnߎk?<΂ q&)7pIL5=�Xڬ,3W//48-~!<�VQףEߏw*-Q"1nO|72O5I҆r Ut%%8=a*S迧 zkWxGFB4h<}Ǐ)4.5XG}>62WUIYE ͮooxGF«MxiPh' `�`24>/ h((�3Ȗ 13!$@ﺶe .̞ cM M C e%K6 \`M`9O>~{"gO>28Ɨ qQ|MScAv'93f~e An"9H"h1E`^|09D" �4}w Uh>pqڍb  D^p'縺aO0*A$;~IW}_!_ 1ßŀ#G1nbpr&H!�kQڅQ}^| / ;!qj*o:M1ďMm}E򓒐Դeopxݿ<"O!3 7d IrɄ_~Aߢx^氹9s.gnsE2"/ cM Cю(=|bAVs"rD8EY]p"t8~%QԤDtvht^Y},!$ɡ r𪛱UgϢ*- 騹pOs;_Fѣل(#l�jףh((iny9Luuz}jh<= ot4~]u."p(ܤ&�X�+κs4B,8b )] !�mP�!_v,j ' AӽٗxsX�`r8,A?n#$�x.x1TSD99k !;n&\�yXG$KqfPJ#<+r]RRB�sUq dx|8AĹ_]0@;8BT3� !ܟ3)42�0&hJsXsWե?nf$� cs �6M Ncx3a"54+ rR SpքpRDsV����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/window-test2.rb��������������������������������������������0000755�0001750�0001750�00000010473�12147676243�021257� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gtk/examples/gtk-clutter-window-test2.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # The original header: # (c) 2009, Collabora Ltd. # # Written by Davyd Madeley <davyd.madeley@collabora.co.uk> # # Copyright (C) 2013 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 require "clutter-gtk" require "gdk_pixbuf2" window = ClutterGtk::Window.new table = Gtk::Grid.new table.hexpand = true table.vexpand = true add_button = lambda do |stock_id, row| button = Gtk::Button.new(:stock_id => stock_id) table.insert_row(row) table.insert_column(row) table.attach(button, row, row, 1, 1) button.signal_connect("clicked") do |_button| puts("button clicked: #{stock_id}") toplevel = _button.toplevel if toplevel.is_a?(ClutterGtk::Window) # create a texture from the button image texture = ClutterGtk::Texture.new image = _button.image size = image.icon_size texture.set_from_stock(_button, stock_id.to_s, size) # position the texture on top of the existing icon stage = toplevel.stage stage.add_actor(texture) allocation = image.allocation # replace the icon itself blank = Gdk::Pixbuf.new(:colorspace => :rgb, :has_alpha => true, :bits_per_sample => 8, :width => allocation.width, :height => allocation.height) blank.fill!(0x00000000) image.pixbuf = blank # animate a fall due to gravity toplevel_allocation = toplevel.allocation texture.save_easing_state do texture.easing_mode = :ease_in_quad texture.easing_duration = 200 texture.set_final_state("x", allocation.x.to_f) texture.set_final_state("y", allocation.y.to_f) texture.y = toplevel_allocation.height.to_f end first_completed_id = texture.signal_connect_after("transitions-completed") do image_allocation = image.allocation # do the second animation, have the icon grow out from the middle of the # button texture.save_easing_state do texture.easing_mode = :ease_out_sine texture.easing_duration = 100 texture.set_final_state("x", image_allocation.x.to_f) texture.set_final_state("y", image_allocation.y.to_f) texture.set_final_state("scale-x", 0.0) texture.set_final_state("scale-y", 0.0) texture.scale_x = 1.0 texture.scale_y = 1.0 texture.set_final_state("scale-gravity", Clutter::Gravity::CENTER) end texture.signal_handler_disconnect(first_completed_id) second_completed_id = texture.signal_connect_after("transitions-completed") do # undo our changes puts("set stock = #{stock_id}, size = #{size}") image.icon_size = size image.stock = stock_id texture.signal_handler_disconnect(second_completed_id) texture.destroy end end end end end add_button.call(Gtk::Stock::OK, 0) add_button.call(Gtk::Stock::CANCEL, 1) add_button.call(Gtk::Stock::CLOSE, 2) add_button.call(Gtk::Stock::ABOUT, 3) add_button.call(Gtk::Stock::BOLD, 4) add_button.call(Gtk::Stock::ITALIC, 5) window.add(table) window.show_all # override the gtk-button-images setting, since we kind # of rely on this to be true to actually show the stock # icon falling off the button settings = window.settings settings.gtk_button_images = true window.signal_connect("destroy") do Gtk.main_quit end Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/events.rb��������������������������������������������������0000755�0001750�0001750�00000013742�12147676243�020217� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of # clutter-gtk/examples/gtk-clutter-events.c. The image file used in # this sample code is copied from # clutter-gtk/examples/redhand.png. They are licensed under the terms # of the GNU Lesser General Public License, version 2.1 or (at your # option) later. # # Copyright (C) 2013 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 require "clutter-gtk" require "gdk_pixbuf2" window = Gtk::Window.new window.title = "Gtk-Clutter Interaction demo" window.set_default_size(800, 600) window.resizable = false window.border_width = 12 window.signal_connect("destroy") do Gtk.main_quit end vbox = Gtk::Box.new(:vertical, 12) window.add(vbox) clutter_entry = nil gtk_entry = Gtk::Entry.new gtk_entry.text = "Enter some text" vbox.pack_start(gtk_entry, :expand => false, :fill => false, :padding => 0) gtk_entry.signal_connect("changed") do |editable| clutter_entry.text = editable.text end hbox = Gtk::Box.new(:horizontal, 12) vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0) # Set up clutter & create our stage clutter_embed = ClutterGtk::Embed.new hbox.pack_start(clutter_embed, :expand => true, :fill => true, :padding => 0) clutter_embed.grab_focus stage = clutter_embed.stage clutter_embed.set_size_request(640, 480) stage.signal_connect("captured-event") do |_stage, event| case event when Clutter::ButtonEvent puts("#{event.type.nick} captured at (#{event.x}, #{event.y})"); when Clutter::CrossingEvent if event.source == _stage and not event.related.nil? if event.type == Clutter::EventType::ENTER stage_action = "Entering" actor_action = "leaving" else stage_action = "Leaving" actor_action = "entering" end puts("#{stage_action} the stage and #{actor_action} '#{event.related.name}'") end when Clutter::KeyEvent if event.type == Clutter::EventType::KEY_PRESS format = "the stage got a key press: '%s' (symbol: %d, unicode: 0x%x)" unicode = [event.key_unicode].pack("U") puts(format % [unicode, event.key_symbol, event.key_unicode]) end end not Clutter::Event::STOP end clutter_embed.signal_connect("enter-notify-event") do |widget| puts("Entering widget '#{widget.class.name}'") false end clutter_embed.signal_connect("leave-notify-event") do |widget| puts("Leaving widget '#{widget.class.name}'") end # Create the main texture that the spin buttons manipulate pixbuf = Gdk::Pixbuf.new(File.expand_path("redhand.png", File.dirname(__FILE__))); hand = ClutterGtk::Texture.new hand.from_pixbuf = pixbuf stage.add_child(hand) hand.anchor_point_from_gravity = :center hand.set_position(stage.width / 2, stage.height / 2) hand.reactive = true hand.name = "Red Hand" hand.signal_connect("button-press-event") do |actor, event| puts("Button press on hand ('#{actor.class.name}')") not Clutter::Event::STOP end # Setup the clutter entry clutter_entry = Clutter::Text.new clutter_entry.color = Clutter::Color.new(:black) stage.add_child(clutter_entry) clutter_entry.set_position(0, 0) clutter_entry.set_size(500, 20) # Create our adjustment widgets vbox = Gtk::Box.new(:vertical, 6) hbox.pack_start(vbox, :expand => false, :fill => false, :padding => 0) box = Gtk::Box.new(:horizontal, 6) vbox.pack_start(box, :expand => false, :fill => true, :padding => 0) label = Gtk::Label.new("Rotate x-axis") box.pack_start(label, :expand => true, :fill => true, :padding => 0) button = Gtk::SpinButton.new(0, 360, 1) box.pack_start(button, :expand => true, :fill => true, :padding => 0) button.signal_connect("value-changed") do |_button| hand.set_rotation(:x_axis, _button.value, 0, hand.height / 2, 0) end box = Gtk::Box.new(:horizontal, 6) vbox.pack_start(box, :expand => false, :fill => true, :padding => 0) label = Gtk::Label.new("Rotate y-axis") box.pack_start(label, :expand => true, :fill => true, :padding => 0) button = Gtk::SpinButton.new(0, 360, 1) box.pack_start(button, :expand => true, :fill => true, :padding => 0) button.signal_connect("value-changed") do |_button| hand.set_rotation(:y_axis, _button.value, hand.width / 2, 0, 0) end box = Gtk::Box.new(:horizontal, 6) vbox.pack_start(box, :expand => false, :fill => true, :padding => 0) label = Gtk::Label.new("Rotate z-axis") box.pack_start(label, :expand => true, :fill => true, :padding => 0) button = Gtk::SpinButton.new(0, 360, 1) box.pack_start(button, :expand => true, :fill => true, :padding => 0) button.signal_connect("value-changed") do |_button| hand.set_rotation(:z_axis, _button.value, hand.width / 2, hand.height / 2, 0) end box = Gtk::Box.new(:horizontal, 6) vbox.pack_start(box, :expand => false, :fill => true, :padding => 0) label = Gtk::Label.new("Adjust opacity") box.pack_start(label, :expand => true, :fill => true, :padding => 0) button = Gtk::SpinButton.new(0, 255, 1) button.value = 255 box.pack_start(button, :expand => true, :fill => true, :padding => 0) button.signal_connect("value-changed") do |_button| hand.opacity = _button.value end window.show_all # Only show/show_all the stage after parent show. widget_show will call # show on the stage. stage.show Gtk.main ������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/test.rb����������������������������������������������������0000755�0001750�0001750�00000010711�12147676243�017663� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of # clutter-gtk/examples/gtk-clutter-test.c. The image file used in # this sample code is copied from # clutter-gtk/examples/redhand.png. They are licensed under the terms # of the GNU Lesser General Public License, version 2.1 or (at your # option) later. # # Copyright (C) 2013 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 require "clutter-gtk" require "gdk_pixbuf2" N_HANDS = 4 WINDOW_WIDTH = 400 WINDOW_HEIGHT = 400 RADIUS = 150 fade_p = false fullscreen_p = false pixbuf = Gdk::Pixbuf.new(File.expand_path("redhand.png", File.dirname(__FILE__))) window = Gtk::Window.new window.set_default_size(WINDOW_WIDTH, WINDOW_HEIGHT) window.title = "Clutter Embedding" window.signal_connect("destroy") do Gtk.main_quit end vbox = Gtk::Grid.new vbox.orientation = :vertical vbox.hexpand = true vbox.vexpand = true window.add(vbox) clutter = ClutterGtk::Embed.new vbox.add(clutter) stage = clutter.stage stage.background_color = Clutter::Color.new(:sky_blue_light) label = Gtk::Label.new("This is a label") vbox.add(label) label.hexpand = true button = Gtk::Button.new(:label => "This is a button...clicky") button.signal_connect("clicked") do |_button| fade_p = !fade_p end vbox.add(button) button.hexpand = true button = Gtk::Button.new(:label => "Fullscreen") button.image = Gtk::Image.new(:stock => Gtk::Stock::FULLSCREEN, :size => :button) button.signal_connect("clicked") do |_button| if fullscreen_p window.unfullscreen fullscreen_p = false else window.fullscreen fullscreen_p = true end end vbox.add(button) button.hexpand = true button = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT) button.signal_connect("clicked") do |_button| _button.destroy end vbox.add(button) button.hexpand = true group = Clutter::Actor.new hands = [] N_HANDS.times do |i| if i.zero? hands[i] = ClutterGtk::Texture.new hands[i].set_from_pixbuf(pixbuf) else hands[i] = Clutter::Clone.new(hands[0]) end # Place around a circle w = hands[0].width h = hands[0].height x = WINDOW_WIDTH / 2 + RADIUS * Math.cos(i * Math::PI / (N_HANDS / 2)) - w / 2 y = WINDOW_HEIGHT / 2 + RADIUS * Math.sin(i * Math::PI / (N_HANDS / 2)) - h / 2 hands[i].set_position(x, y) # Add to our group group group.add_child(hands[i]) end # Add the group to the stage stage.add_child(group) constraint = Clutter::AlignConstraint.new(stage, :x_axis, 0.5) group.add_constraint(constraint) constraint = Clutter::AlignConstraint.new(stage, :y_axis, 0.5) group.add_constraint(constraint) stage.signal_connect("button-press-event") do |_stage, event| x, y = event.coords actor = _stage.get_actor_at_pos(:all, x, y) if actor.is_a?(ClutterGtk::Texture) or actor.is_a?(Clutter::Clone) actor.hide end Clutter::Event::STOP end stage.signal_connect("key-release-event") do |_stage, event| puts("*** key press event (key:#{[event.key_unicode].pack('U*')}) ***") case event.key_symbol when Clutter::Keys::KEY_q Gtk.main_quit when Clutter::Keys::KEY_r N_HANDS.times do |i| hands[i].show end end Clutter::Event::STOP end window.show_all # Create a timeline to manage animation timeline = Clutter::Timeline.new(6000) timeline.repeat_count = -1 # fire a callback for frame change timeline.signal_connect("new-frame") do |_timeline, msecs| rotation = _timeline.progress * 360.0 group.set_rotation(:z_axis, rotation, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 0) N_HANDS.times do |i| hands[i].set_rotation(:z_axis, -(6.0 * rotation), hands[i].width / 2, hands[i].height / 2, 0) if fade_p hands[i].opacity = (255 - (rotation % 255)) end end end # and start it timeline.start Gtk.main �������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/sample/test-scroll.rb���������������������������������������������0000755�0001750�0001750�00000011226�12147676243�021161� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gtk/examples/gtk-clutter-test-scroll.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "clutter-gtk" N_WIDGETS = 5 WINDOW_WIDTH = 400 WINDOW_HEIGHT = 400 RADIUS = 80 do_rotate_p = true window = Gtk::Window.new window.signal_connect("destroy") do Gtk.main_quit end vbox = Gtk::Box.new(:vertical, 6) window.add(vbox) clutter = ClutterGtk::Embed.new clutter.set_size_request(WINDOW_WIDTH, WINDOW_HEIGHT) vbox.add(clutter) stage = clutter.stage button = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT) button.signal_connect("clicked") do |_button| window.destroy end vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) # and its background color stage.background_color = Clutter::Color.new(0x61, 0x64, 0x8c, 0xff) widgets = [] # create a new group to hold multiple actors in a group group = Clutter::Group.new create_gtk_actor = lambda do gtk_actor = ClutterGtk::Actor.new bin = gtk_actor.widget scroll = Gtk::ScrolledWindow.new scroll.set_policy(:never, :automatic) bin.add(scroll) vbox = Gtk::Box.new(:vertical, 6) scroll.add_with_viewport(vbox) button = Gtk::Button.new(:label => "A Button") vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) button.signal_connect("clicked") do |_button| puts("button clicked") label = Gtk::Label.new("A new label") label.show vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) end 6.times do |i| button = Gtk::CheckButton.new("Another button") vbox.pack_start(button, :expand => false, :fill => false, :padding => 0) end entry = Gtk::Entry.new vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0) bin.show_all gtk_actor end N_WIDGETS.times do |i| widget = create_gtk_actor.call widgets[i] = widget # Place around a circle w = widgets.first.width h = widgets.first.height x = WINDOW_WIDTH / 2 + RADIUS * Math.cos(i * 2 * Math::PI / (N_WIDGETS)) - w / 2 y = WINDOW_HEIGHT / 2 + RADIUS * Math.sin(i * 2 * Math::PI / (N_WIDGETS)) - h / 2 widget.set_position(x, y) # Add to our group group group.add_actor(widget) end # Add the group to the stage stage.add_actor(group) stage.signal_connect("button-press-event") do |_stage, event| x, y = event.coords actor = _stage.get_actor_at_pos(:all, x, y) puts("click at #{x}, #{y} -> #{actor.gtype.name}:#{actor}") if !actor.is_a?(Clutter::Stage) and !actor.is_a?(Clutter::Group) actor.hide end end stage.signal_connect("key-release-event") do |_sage, event| unichar = [event.key_unicode].pack("U*") puts("*** key press event (key:#{unichar}) ***") if event.key_symbol == Clutter::Keys::KEY_q Gtk.main_quit end end window.show_all # Only show the actors after parent show otherwise it will just be # unrealized when the clutter foreign window is set. widget_show # will call show on the stage. group.show_all # Create a timeline to manage animation timeline = Clutter::Timeline.new(6000) timeline.loop = true # fire a callback for frame change timeline.signal_connect("new-frame") do |_timeline, m_secs| rotation = _timeline.progress * 360.0 if do_rotate_p # Rotate everything clockwise about stage center group.set_rotation(:z_axis, rotation, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 0) widgets.each do |widget| # rotate each widget around its center w = widget.width h = widget.height widget.set_rotation(:z_axis, -(2 * rotation), w / 2, h / 2, 0) widget.opacity = 50 * Math.sin(2 * Math::PI * rotation / 360) + (255 - 50) end end end # and start it timeline.start Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/patches/����������������������������������������������������������0000755�0001750�0001750�00000000000�12142464343�016511� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/patches/0001-Use-no-undefined-ld-flag.patch�����������������������0000644�0001750�0001750�00000002627�12142464343�024530� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������From c42a07c632ef64d34e57723b5effd643ea0a7c86 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou <kou@clear-code.com> Date: Mon, 29 Apr 2013 18:08:59 +0900 Subject: [PATCH] Use -no-undefined ld flag It fixes DLL generation by cross compile. --- clutter-gtk/Makefile.am | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clutter-gtk/Makefile.am b/clutter-gtk/Makefile.am index 9a35919..3963ac0 100644 --- a/clutter-gtk/Makefile.am +++ b/clutter-gtk/Makefile.am @@ -47,7 +47,7 @@ source_h_private = \ libclutter_gtk_@CLUTTER_GTK_API_VERSION@_la_SOURCES = $(source_c) $(source_h) $(source_h_private) libclutter_gtk_@CLUTTER_GTK_API_VERSION@_la_LIBADD = $(CLUTTER_GTK_DEPS_LIBS) $(LIBM) libclutter_gtk_@CLUTTER_GTK_API_VERSION@_la_LDFLAGS = \ - $(CLUTTER_LT_LDFLAGS) \ + $(CLUTTER_GTK_LT_LDFLAGS) \ -export-symbols-regex "^gtk_clutter.*" cluttergtkheadersdir = $(includedir)/clutter-gtk-@CLUTTER_GTK_API_VERSION@/clutter-gtk diff --git a/configure.ac b/configure.ac index 7d381e2..8db163b 100644 --- a/configure.ac +++ b/configure.ac @@ -56,7 +56,7 @@ AC_MSG_CHECKING([if building for some Win32 platform]) AS_CASE([$host], [*-*-mingw*|*-*-cygwin*], [ - CLUTTER_LT_LDFLAGS="$CLUTTER_GTK_LT_LDFLAGS -no-undefined" + CLUTTER_GTK_LT_LDFLAGS="$CLUTTER_GTK_LT_LDFLAGS -no-undefined" platform_win32=yes ], -- 1.7.10.4 ���������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gtk/patches/0001-actor-fix-clutter-win32.h-include-path.patch���������0000644�0001750�0001750�00000001521�12137115064�027221� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������From b692fd86471c8b3c5e0e92007b7b2d5cfd058af7 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou <kou@clear-code.com> Date: Sat, 13 Apr 2013 19:19:36 +0900 Subject: [PATCH] actor: fix clutter-win32.h include path It is installed under "clutter/win32/" directory. Other include paths were fixed in 9da7dd191dae7d1cc626ea22998145ebc2bb0722 but it was not fixed. --- clutter-gtk/gtk-clutter-actor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clutter-gtk/gtk-clutter-actor.c b/clutter-gtk/gtk-clutter-actor.c index f95caed..67d9cdd 100644 --- a/clutter-gtk/gtk-clutter-actor.c +++ b/clutter-gtk/gtk-clutter-actor.c @@ -59,7 +59,7 @@ #endif #ifdef CLUTTER_WINDOWING_WIN32 -#include <clutter/clutter-win32.h> +#include <clutter/win32/clutter-win32.h> #endif #ifdef GDK_WINDOWING_WIN32 #include <gdk/gdkwin32.h> -- 1.7.10.4 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/����������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�014273� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/�����������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015255� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-desaturate-effect.rb��������������������������������0000644�0001750�0001750�00000002145�12423063747�023642� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterDesaturateEffectTest < Test::Unit::TestCase include ClutterTestUtils def setup default_factor = 1.0 @desaturate_effect = Clutter::DesaturateEffect.new(default_factor) end def test_factor_accesssors factor = 0.8 @desaturate_effect.factor = factor assert_equal(factor, @desaturate_effect.factor) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/clutter-test-utils.rb��������������������������������������������0000644�0001750�0001750�00000002473�12446160551�021407� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2013 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 require "test-unit" require "test/unit/notify" module ClutterTestUtils private def only_clutter_version(major, minor, micro=nil) micro ||= 0 unless Clutter.check_version?(major, minor, micro) omit("Require Clutter >= #{major}.#{minor}.#{micro}") end end def omit_if_clutter_color_hash_expect_arguments unless Clutter::Color.method(:hash).parameters.empty? omit("This test can't be run on this environment.") end end def omit_on_travis_ci omit("This test can't be run on Travis CI") if ENV["CI"] end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-blur-effect.rb��������������������������������������0000644�0001750�0001750�00000001756�12423063747�022454� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterBlurEffectTest < Test::Unit::TestCase include ClutterTestUtils def setup @blur_effect = Clutter::BlurEffect.new end def test_blur_effect_new assert_kind_of(Clutter::Effect, @blur_effect) end end ������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-property-transiton.rb�������������������������������0000644�0001750�0001750�00000002153�12446160551�024145� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterPropertyTransitionTest < Test::Unit::TestCase include ClutterTestUtils def setup @transition = Clutter::PropertyTransition.new end def test_property_name_accessors only_clutter_version(1, 10, 0) name = "clutter property" @transition.property_name = name assert_equal(name, @transition.property_name) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/run-test.rb������������������������������������������������������0000755�0001750�0001750�00000004120�12516434313�017363� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2012-2013 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") pango_base = File.join(ruby_gnome2_base, "pango") clutter_base = File.join(ruby_gnome2_base, "clutter") modules = [ [glib_base, "glib2"], [cairo_gobject_base, "cairo-gobject"], [gobject_introspection_base, "gobject-introspection"], [pango_base, "pango"], [clutter_base, "clutter"], ] modules.each do |target, module_name| makefile = File.join(target, "Makefile") if File.exist?(makefile) and system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $VERBOSE = false # TODO: remove me $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" $LOAD_PATH.unshift(File.join(clutter_base, "test")) require "clutter-test-utils" require "clutter" Clutter.init([]) exit Test::Unit::AutoRunner.run(true, clutter_base) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-text-buffer.rb��������������������������������������0000644�0001750�0001750�00000004300�12446160551�022471� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# coding: utf-8 # Copyright (C) 2012-2014 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 class ClutterTextBufferTest < Test::Unit::TestCase include ClutterTestUtils def setup @text_buffer = Clutter::TextBuffer.new end def test_text string = "clutter test" @text_buffer.text = string assert_equal(string, @text_buffer.text) end def test_max_length length = 80 @text_buffer.max_length = length assert_equal(length, @text_buffer.max_length) end def test_length_read_property string = "clutter test" length = string.length @text_buffer.text = string assert_equal(length, @text_buffer.length) end def test_insert_text string = "clutter test" @text_buffer.text = string append_string = "append" append_string_length = append_string.length result_string = string + append_string assert_equal(append_string_length, @text_buffer.insert_text(string.length, append_string)) assert_equal(result_string, @text_buffer.text) end def test_delete_text string = "clutter test string" @text_buffer.text = string delete_text = "clutter" delete_position = delete_text.length delete_string = " test" delete_string_length = delete_string.length result_string = "clutter string" assert_equal(delete_string_length, @text_buffer.delete_text(delete_position, delete_string_length)) assert_equal(result_string, @text_buffer.text) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-flow-layout.rb��������������������������������������0000644�0001750�0001750�00000005076�12446160551�022533� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterFlowLayoutTest < Test::Unit::TestCase include ClutterTestUtils def setup default_orientation = Clutter::FlowOrientation::VERTICAL @flow_layout = Clutter::FlowLayout.new(default_orientation) end def test_column_spacing_accessors column_space = 1.0 @flow_layout.column_spacing = column_space assert_equal(column_space, @flow_layout.column_spacing) end def test_homogeneous_accessors @flow_layout.homogeneous = true assert_true(@flow_layout.homogeneous?) end def test_max_column_width_accessors max_width = 300 @flow_layout.max_column_width = max_width assert_equal(max_width, @flow_layout.max_column_width) end def test_min_column_width_accessors min_width = 10 @flow_layout.min_column_width = min_width assert_equal(min_width, @flow_layout.min_column_width) end def test_max_row_height_accessors max_height = 400 @flow_layout.max_row_height = max_height assert_equal(max_height, @flow_layout.max_row_height) end def test_min_row_height_accessors min_height = 5 @flow_layout.min_row_height = min_height assert_equal(min_height, @flow_layout.min_row_height) end def test_orientation_accessors changed_orientation = Clutter::FlowOrientation::HORIZONTAL @flow_layout.orientation = changed_orientation assert_equal(changed_orientation, @flow_layout.orientation) end def test_row_spacing_accessors row_space = 1.5 @flow_layout.row_spacing = row_space assert_equal(row_space, @flow_layout.row_spacing) end def test_snap_to_grid_accessors only_clutter_version(1, 16, 0) @flow_layout.snap_to_grid = false assert_false(@flow_layout.snap_to_grid?) end class TestEnum < self def test_enum assert_const_defined(Clutter::FlowOrientation, :HORIZONTAL) end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-color.rb��������������������������������������������0000644�0001750�0001750�00000003307�12257552167�021372� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 class ClutterColorTest < Test::Unit::TestCase include ClutterTestUtils def test_rgb omit_if_clutter_color_hash_expect_arguments assert_equal("#ff0000ff", Clutter::Color.rgb(255, 0, 0).to_s) end def test_rgba omit_if_clutter_color_hash_expect_arguments assert_equal("#ff00007f", Clutter::Color.rgb(255, 0, 0, 127).to_s) end def test_hls omit_if_clutter_color_hash_expect_arguments assert_equal("#20dfdfff", Clutter::Color.hls(180, 0.5, 0.75).to_s) end def test_hlsa omit_if_clutter_color_hash_expect_arguments assert_equal("#20dfdf7f", Clutter::Color.hls(180, 0.5, 0.75, 127).to_s) end def test_pixel omit_if_clutter_color_hash_expect_arguments assert_equal("#20dfdf7f", Clutter::Color.pixel(0x20dfdf7f).to_s) end def test_parse omit_if_clutter_color_hash_expect_arguments assert_equal("#20dfdf7f", Clutter::Color.parse("rgba(32, 223, 223, 0.5)").to_s) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-shader-effect.rb������������������������������������0000644�0001750�0001750�00000004040�12423063747�022743� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterShaderEffect < Test::Unit::TestCase include ClutterTestUtils def setup @shader_effect = Clutter::ShaderEffect.new(Clutter::ShaderType::FRAGMENT_SHADER) @fragment_shader_source = <<-EOS #ifdef GL_ES precision mediump float; #endif void main( void ) { gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); } EOS # TODO: use original Cogl::INVALID_HANDLE # original value: NULL # ref: https://developer.gnome.org/cogl/1.18/cogl-General-API.html#COGL-INVALID-HANDLE:CAPS # It should create gi based cogl binding? @cogl_invalid_handle = 0 end def test_set_uniform_value gvalue = 1.0 assert_nothing_raised do @shader_effect.set_uniform_value("components", gvalue) end end def test_set_shader_source result = @shader_effect.set_shader_source(@fragment_shader_source) assert_true(result) end def test_get_program @shader_effect.shader_source = @fragment_shader_source assert_not_equal(@cogl_invalid_handle, @shader_effect.program) end def test_get_shader @shader_effect.shader_source = @fragment_shader_source assert_not_equal(@cogl_invalid_handle, @shader_effect.shader) end class TestEnum < self def test_shader_type assert_const_defined(Clutter::ShaderType, :VERTEX_SHADER) end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-canvas.rb�������������������������������������������0000644�0001750�0001750�00000002503�12423063747�021520� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterCanvasTest < Test::Unit::TestCase include ClutterTestUtils def setup @canvas = Clutter::Canvas.new end def test_scale_factor only_clutter_version(1, 18, 0) scale = 2 @canvas.scale_factor = scale assert_equal(scale, @canvas.scale_factor) assert_true(@canvas.scale_factor_set?) end def test_height_accessors height = 320 @canvas.height = height assert_equal(height, @canvas.height) end def test_width_accessors width = 640 @canvas.width = width assert_equal(width, @canvas.width) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-page-turn-effect.rb���������������������������������0000644�0001750�0001750�00000003130�12423063747�023376� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterPageTurnEffect < Test::Unit::TestCase include ClutterTestUtils def setup default_period = 1.0 default_angle = 180.0 default_radious = 20.0 @page_turn_effect = Clutter::PageTurnEffect.new(default_period, default_angle, default_radious) end def test_angle_accessors page_angle = 150 @page_turn_effect.angle = page_angle assert_equal(page_angle, @page_turn_effect.angle) end def test_period_accessors page_period = 0.5 @page_turn_effect.period = page_period assert_equal(page_period, @page_turn_effect.period) end def test_radius_accessors page_radius = 50.0 @page_turn_effect.radius = page_radius assert_equal(page_radius, @page_turn_effect.radius) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-colorize-effect.rb����������������������������������0000644�0001750�0001750�00000002277�12423063747�023335� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterColorizeEffectTest < Test::Unit::TestCase include ClutterTestUtils def setup omit_if_clutter_color_hash_expect_arguments default_color = Clutter::Color.rgb(255, 0, 0) @colorize_effect = Clutter::ColorizeEffect.new(default_color) end def test_tint_accessors color = Clutter::Color.rgb(127, 127, 0) @colorize_effect.tint = color assert_equal(color.to_s, @colorize_effect.tint.to_s) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-feature.rb������������������������������������������0000644�0001750�0001750�00000002266�12446167141�021704� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterFeatureTest < Test::Unit::TestCase include ClutterTestUtils def test_avaliable feature_flag = Clutter::FeatureFlags::SYNC_TO_VBLANK assert_boolean(Clutter::Feature.available?(feature_flag)) end def test_all assert_kind_of(Clutter::FeatureFlags, Clutter::Feature.all) end class TestEnum def test_flags assert_const_defined(Clutter::FeatureFlags, :TEXTURE_NPOT) end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-actor.rb��������������������������������������������0000644�0001750�0001750�00000014127�12446160551�021356� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterActorTest < Test::Unit::TestCase include ClutterTestUtils def setup @actor = Clutter::Actor.new end def test_flags actor_flag = Clutter::ActorFlags::REACTIVE @actor.flags = actor_flag assert_equal(actor_flag, @actor.flags) @actor.unset_flags(actor_flag) assert_true(@actor.flags.empty?) end def test_scaled assert_false(@actor.scaled?) scale_x = 5.5 scale_y = 7.5 @actor.set_scale(scale_x, scale_y) assert_true(@actor.scaled?) end def test_rotation_angle only_clutter_version(1, 12, 0) rotate_angle = 0.5 @actor.set_rotation_angle(Clutter::RotateAxis::X_AXIS, rotate_angle) assert_equal(rotate_angle, @actor.get_rotation_angle(Clutter::RotateAxis::X_AXIS)) end def test_name actor_name = "ClutterActor" @actor.name = actor_name assert_equal(actor_name, @actor.name) end def test_fixed_position_set @actor.fixed_position_set = true assert_true(@actor.fixed_position_set?) end def test_x_align align = Clutter::ActorAlign::FILL @actor.x_align = align assert_equal(align, @actor.x_align) end def test_y_align align = Clutter::ActorAlign::CENTER @actor.y_align = align assert_equal(align, @actor.y_align) end def test_content_gravity gravity = Clutter::ContentGravity::CENTER @actor.content_gravity = gravity assert_equal(gravity, @actor.content_gravity) end def test_opacity_accessors opacity_value = 220 @actor.opacity = opacity_value assert_equal(opacity_value, @actor.opacity) end def test_easing_delay delay_msec = 300 @actor.save_easing_state @actor.easing_delay = delay_msec assert_equal(delay_msec, @actor.easing_delay) end def test_easing_mode only_clutter_version(1, 12, 0) mode = Clutter::AnimationMode::EASE @actor.easing_mode = mode assert_equal(mode, @actor.easing_mode) end def test_pango_context @actor.create_pango_context assert_kind_of(Pango::Context, @actor.pango_context) end def test_width_accessors actor_width = 20 @actor.width = actor_width assert_equal(actor_width, @actor.width) end def test_height_accessors actor_height = 30 @actor.height = actor_height assert_equal(actor_height, @actor.height) end def test_x_accessors actor_x = 35 @actor.x = actor_x assert_equal(actor_x, @actor.x) end def test_y_accessors actor_y = 15 @actor.y = actor_y assert_equal(actor_y, @actor.y) end def test_z_position_accessors only_clutter_version(1, 12, 0) actor_z_position = 55 @actor.z_position = actor_z_position assert_equal(actor_z_position, @actor.z_position) end def test_pivot_point_accessors only_clutter_version(1, 12, 0) pivot_x = 1.0 pivot_y = 3.0 @actor.set_pivot_point(pivot_x, pivot_y) assert_equal([pivot_x, pivot_y], @actor.pivot_point) end def test_pivot_point_z_accessors only_clutter_version(1, 12, 0) pivot_z = 5.0 @actor.pivot_point_z = pivot_z assert_equal(pivot_z, @actor.pivot_point_z) end def test_reactive_accessors @actor.reactive = true assert_true(@actor.reactive?) end def test_scale_accessors scale_x = 1.5 scale_y = 3.5 @actor.set_scale(scale_x, scale_y) assert_equal([scale_x, scale_y], @actor.scale) end def test_scale_z_accessors only_clutter_version(1, 12, 0) scale_z = 4.5 @actor.scale_z = scale_z assert_equal(scale_z, @actor.scale_z) end def test_text_direction_accessors direction = Clutter::TextDirection::LTR @actor.text_direction = direction assert_equal(direction, @actor.text_direction) end def test_clutter_transform # TODO: !!needs CoglMatrix!! # Clutter::Matrix equals Cogl::Matrix # ref: https://developer.gnome.org/clutter/stable/clutter-Base-geometric-types.html#ClutterMatrix # Cogl::Matrix type is returned by Cogl::Matrix.init_identity API in clutter 1.18 end class TestMargin < self def test_margin_top margin = 3.0 @actor.margin_top = margin assert_equal(margin, @actor.margin_top) end def test_margin_right margin = 5.0 @actor.margin_right = margin assert_equal(margin, @actor.margin_right) end def test_margin_left margin = 3.5 @actor.margin_left = margin assert_equal(margin, @actor.margin_left) end def test_margin_bottom margin = 4.5 @actor.margin_bottom = margin assert_equal(margin, @actor.margin_bottom) end end class TestEnum < self def test_allocation_flags assert_const_defined(Clutter::AllocationFlags, :DELEGATE_LAYOUT) end def test_actor_align assert_const_defined(Clutter::ActorAlign, :FILL) end def test_actor_flags assert_const_defined(Clutter::ActorFlags, :REACTIVE) end def test_content_gravity assert_const_defined(Clutter::ContentGravity, :CENTER) end def test_content_repeat only_clutter_version(1, 12, 0) assert_const_defined(Clutter::ContentRepeat, :BOTH) end def test_scaling_fliter assert_const_defined(Clutter::ScalingFilter, :LINEAR) end def test_request_mode assert_const_defined(Clutter::RequestMode, :WIDTH_FOR_HEIGHT) end def test_offscreen_redirect assert_const_defined(Clutter::OffscreenRedirect, :ALWAYS) end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-brightness-contrast-effect.rb�����������������������0000644�0001750�0001750�00000003546�12423063747�025512� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterBrightnessContrastEffectTest < Test::Unit::TestCase include ClutterTestUtils def setup @effect = Clutter::BrightnessContrastEffect.new end def test_brightness brightness = 127 @effect.brightness = brightness assert_equal([brightness, brightness, brightness], @effect.brightness) end def test_brightness_rgb_params brightness_red = 120 brightness_green = 200 brightness_blue = 250 @effect.set_brightness(brightness_red, brightness_green, brightness_blue) assert_equal([brightness_red, brightness_green, brightness_blue], @effect.brightness) end def test_contrast contrast = 127 @effect.contrast = contrast assert_equal([contrast, contrast, contrast], @effect.contrast) end def test_contrast_rgb_params contrast_red = 250 contrast_green = 120 contrast_blue = 100 @effect.set_contrast(contrast_red, contrast_green, contrast_blue) assert_equal([contrast_red, contrast_green, contrast_blue], @effect.contrast) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/test/test-clutter-timeline.rb�����������������������������������������0000644�0001750�0001750�00000003563�12446160551�022056� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class ClutterTimelineTest < Test::Unit::TestCase include ClutterTestUtils def setup default_duration = 100 @timeline = Clutter::Timeline.new(default_duration) end def test_auto_reverse_accessors @timeline.auto_reverse = true assert_true(@timeline.auto_reverse?) end def test_delay_accessors delay_msec = 2000 @timeline.delay = delay_msec assert_equal(delay_msec, @timeline.delay) end def test_direction_accessors timeline_direction = Clutter::TimelineDirection::FORWARD @timeline.direction = timeline_direction assert_equal(timeline_direction, @timeline.direction) end def test_duration_accessors duration_msec = 1500 @timeline.duration = duration_msec assert_equal(duration_msec, @timeline.duration) end def test_repeat_count_accessors count = 5 @timeline.repeat_count = count assert_equal(count, @timeline.repeat_count) end def test_progress_mode_accessors animation_mode = Clutter::AnimationMode::EASE_IN_QUAD @timeline.progress_mode = animation_mode assert_equal(animation_mode, @timeline.progress_mode) end end ���������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/Rakefile��������������������������������������������������������������0000644�0001750�0001750�00000010545�12446160551�015752� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2012-2014 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/Clutter is a Ruby binding of Clutter." package.description = "Ruby/Clutter is a Ruby binding of Clutter." package.dependency.gem.runtime = [ "cairo-gobject", "gobject-introspection", "pango" ] package.dependency.gem.development = ["test-unit-notify"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", "gobject-introspection", ] package.windows.gobject_introspection_dependencies = [ "atk", "pango", ] package.external_packages = [ # Build note: # We need to modify /usr/i686-w64-mingw32/include/GL/ directory because # MinGW w64 bundles old OpenGL headers. Here are changes to build Cogl: # # (1) Put the latest glext.h that can be downloaded from # https://www.opengl.org/registry/api/GL/glext.h into # /usr/share/mingw-w64/include/GL/ directory: # # % wget https://www.opengl.org/registry/api/GL/glext.h # % sudo install glext.h /usr/share/mingw-w64/include/GL/ # # (2) Add missing declarations and includes to # /usr/share/mingw-w64/include/GL/gl.h: # # Before: # ... # typedef double GLdouble; # typedef double GLclampd; # typedef void GLvoid; # # #define GL_VERSION_1_1 1 # ... # # After # ... # typedef double GLdouble; # typedef double GLclampd; # typedef void GLvoid; # # typedef ptrdiff_t GLintptr; # typedef ptrdiff_t GLsizeiptr; # typedef char GLchar; # #include <GL/glext.h> # # #define GL_VERSION_1_1 1 # ... { :name => "cogl", :download_site => :gnome, :label => "Cogl", :version => "1.18.2", :compression_method => "xz", :windows => { :configure_args => [ "--disable-glibtest", "--enable-introspection", ], :built_file => "bin/libcogl-20.dll", }, }, { :name => "json-glib", :download_site => :gnome, :label => "JSON-GLib", :version => "1.0.2", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :patches => [ "json-glib-1.0.2-add-missing-config-h.diff", ], :need_autoreconf => true, :built_file => "bin/libjson-glib-1.0-0.dll", }, }, { :name => "clutter", :download_site => :gnome, :label => "Clutter", :version => "1.20.0", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :build_concurrently => false, :built_file => "bin/libclutter-1.0-0.dll", }, } ] package.cross_compiling do |spec| if /mingw|mswin/ =~ spec.platform.to_s spec.add_runtime_dependency("atk", "= #{package.version}") spec.add_runtime_dependency("gdk_pixbuf2", "= #{package.version}") end end end package_task.define if Rake::Task.task_defined?("native:clutter:i386-mingw32") Rake::Task["native:clutter:i386-mingw32"].prerequisites.clear end namespace :dependency do desc "Install depenencies" task :install do # TODO: Install gir1.2-clutter-1.0 on Debian. end end task :build => "dependency:install" �����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/README.md�������������������������������������������������������������0000644�0001750�0001750�00000001367�12257552167�015576� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/Clutter Ruby/Clutter is a Ruby binding of Clutter. ## Requirements * Ruby/GObjectIntrospection in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [Clutter](http://blogs.gnome.org/clutter/) ## Install gem install clutter ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ### Exceptions Ruby scripts and image files in sample/ are ported and copied from Clutter. Headers in sample/*.rb describes that the location of the original file of the Ruby script and image files. The original files are licensed under the LGPL v2.1 or later. ## Project Website http://ruby-gnome2.sourceforge.jp/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/COPYING.LIB�����������������������������������������������������������0000644�0001750�0001750�00000063642�12077252561�015756� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015044� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter.rb��������������������������������������������������������0000644�0001750�0001750�00000011737�12516434313�017064� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 require "gobject-introspection" require "cairo-gobject" require "pango" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) if vendor_dir.exist? require "atk" require "gdk_pixbuf2" end module Clutter LOG_DOMAIN = "Clutter" GLib::Log.set_log_domain(LOG_DOMAIN) class << self def const_missing(name) init() if const_defined?(name) const_get(name) else super end end def init(argv=[]) class << self remove_method(:init) remove_method(:const_missing) end loader = Loader.new(self, argv) loader.load("Clutter") require "clutter/actor" require "clutter/actor-iter" require "clutter/animatable" require "clutter/brightness-contrast-effect" require "clutter/cairo" require "clutter/clutter" require "clutter/color" require "clutter/event" require "clutter/point" require "clutter/text" require "clutter/text-buffer" require "clutter/threads" end end class Loader < GObjectIntrospection::Loader class InitError < StandardError end def initialize(base_module, init_arguments) super(base_module) @init_arguments = init_arguments @key_constants = {} @other_constant_infos = [] @event_infos = [] end private def pre_load(repository, namespace) init = repository.find(namespace, "init") arguments = [ [$0] + @init_arguments, ] error, returned_arguments = init.invoke(:arguments => arguments) @init_arguments.replace(returned_arguments[1..-1]) if error.to_i <= 0 raise InitError, "failed to initialize Clutter: #{error.name}" end @keys_module = Module.new @base_module.const_set("Keys", @keys_module) @threads_module = Module.new @base_module.const_set("Threads", @threads_module) @feature_module = Module.new @base_module.const_set("Feature", @feature_module) end def post_load(repository, namespace) @other_constant_infos.each do |constant_info| name = constant_info.name next if @key_constants.has_key?("KEY_#{name}") @base_module.const_set(name, constant_info.value) end load_events end def load_events @event_infos.each do |event_info| define_struct(event_info, :parent => Event) end event_map = { EventType::KEY_PRESS => KeyEvent, EventType::KEY_RELEASE => KeyEvent, EventType::MOTION => MotionEvent, EventType::ENTER => CrossingEvent, EventType::LEAVE => CrossingEvent, EventType::BUTTON_PRESS => ButtonEvent, EventType::BUTTON_RELEASE => ButtonEvent, EventType::SCROLL => ScrollEvent, EventType::STAGE_STATE => StageStateEvent, EventType::TOUCH_UPDATE => TouchEvent, EventType::TOUCH_END => TouchEvent, EventType::TOUCH_CANCEL => TouchEvent, } self.class.register_boxed_class_converter(Event.gtype) do |event| event_map[event.type] || Event end end def load_struct_info(info) if info.name.end_with?("Event") @event_infos << info else super end end def load_function_info(info) name = info.name case name when "init" # ignore when /\Athreads_/ define_module_function(@threads_module, $POSTMATCH, info) when /\Afeature_/ method_name = rubyish_method_name(info, :prefix => "feature_") case method_name when "available" method_name = "#{method_name}?" end define_module_function(@feature_module, method_name, info) else super end end def load_constant_info(info) case info.name when /\AKEY_/ @key_constants[info.name] = true @keys_module.const_set(info.name, info.value) else @other_constant_infos << info end end end end ���������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/����������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�016526� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/animatable.rb���������������������������������������������0000644�0001750�0001750�00000002141�12077252561�021153� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter module Animatable alias_method :set_final_state_without_conversion, :set_final_state def set_final_state(property_name, value) property = self.class.property(property_name) value = GLib::Value.new(property.value_type, value) set_final_state_without_conversion(property_name, value) end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/brightness-contrast-effect.rb�����������������������������0000644�0001750�0001750�00000003344�12423063747�024322� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 module Clutter class BrightnessContrastEffect alias_method :set_contrast_raw, :set_contrast def set_contrast(contrast_all_or_red, contrast_green=nil, contrast_blue=nil) if contrast_green.nil? && contrast_blue.nil? contrast_all = contrast_all_or_red set_contrast_raw(contrast_all) else contrast_red = contrast_all_or_red set_contrast_full(contrast_red, contrast_green, contrast_blue) end end alias_method :set_brightness_raw, :set_brightness def set_brightness(brightness_all_or_red, brightness_green=nil, brightness_blue=nil) if brightness_green.nil? && brightness_blue.nil? brightness_all = brightness_all_or_red set_brightness_raw(brightness_all) else brightness_red = brightness_all_or_red set_brightness_full(brightness_red, brightness_green, brightness_blue) end end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/actor-iter.rb���������������������������������������������0000644�0001750�0001750�00000002016�12077252561�021130� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter class ActorIter private :init def initialize(root) super() init(root) end def each loop do have_next, child = self.next break unless have_next yield(child) end end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/clutter.rb������������������������������������������������0000644�0001750�0001750�00000001755�12423063747�020553� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 module Clutter class << self alias_method :check_version_raw, :check_version remove_method :check_version def check_version?(major, minor, micro=nil) check_version_raw(major, minor, micro) end end end �������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/color.rb��������������������������������������������������0000644�0001750�0001750�00000004656�12147676243�020216� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter class Color private_class_method(:from_hls) if respond_to?(:from_hls) private_class_method(:from_pixel) if respond_to?(:from_pixel) private_class_method(:from_string) if respond_to?(:from_string) class << self def new(*args) if [Symbol] == args.collect(&:class) name = args[0] get_static(name) else if args.empty? args = [0, 0, 0, 1] unless private_method_defined?(:initialize_alloc) end super(*args) end end def rgb(red, green, blue, alpha=255) rgba(red, green, blue, alpha) end def rgba(red, green, blue, alpha) new(red, green, blue, alpha) end def hls(hue, luminance, saturation, alpha=255) hlsa(hue, luminance, saturation, alpha) end def hlsa(hue, luminance, saturation, alpha) if respond_to?(:from_hls, true) color = from_hls(hue, luminance, saturation) else color = new color.from_hls(hue, luminance, saturation) end color.alpha = alpha color end def pixel(pixel) if respond_to?(:from_pixel, true) color = from_pixel(pixel) else color = new color.from_pixel(pixel) end color end def parse(string) if respond_to?(:from_string, true) succeeded, color = from_string(string) else color = new succeeded = color.from_string(string) end unless succeeded raise ArgumentError, "invalid color string: <#{string}>" end color end end end end ����������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/threads.rb������������������������������������������������0000644�0001750�0001750�00000002635�12077252561�020520� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter module Threads class << self alias_method :add_timeout_full, :add_timeout def add_timeout(interval_or_priority, interval=nil, &block) if interval.nil? priority, interval = GLib::PRIORITY_DEFAULT, interval_or_priority add_timeout_full(priority, interval, &block) else priority = interval_or_priority add_timeout_full(priority, interval, &block) end end alias_method :add_idle_full, :add_idle def add_idle(priority=nil, &block) priority ||= GLib::PRIORITY_DEFAULT_IDLE add_idle_full(priority, &block) end end end end ���������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/event.rb��������������������������������������������������0000644�0001750�0001750�00000001501�12077252561�020176� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter class Event STOP = true end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/cairo.rb��������������������������������������������������0000644�0001750�0001750�00000001726�12077252561�020163� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Cairo class Context def set_source_clutter_color(color) Clutter.cairo_set_source_color(self, color) end alias_method :source_clutter_color=, :set_source_clutter_color end end ������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/actor.rb��������������������������������������������������0000644�0001750�0001750�00000002247�12077252561�020175� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 module Clutter class Actor # TODO: use prepend after Ruby 1.9 support is dropped. alias_method :save_easing_state_without_block, :save_easing_state def save_easing_state if block_given? save_easing_state_without_block begin yield ensure restore_easing_state end else save_easing_state_without_block end end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/text-buffer.rb��������������������������������������������0000644�0001750�0001750�00000002434�12446160551�021313� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 module Clutter class TextBuffer alias_method :set_text_raw, :set_text alias_method :insert_text_raw, :insert_text alias_method :emit_inserted_text_raw, :emit_inserted_text def set_text(string) set_text_raw(string, string.length) end alias_method :text=, :set_text def insert_text(position, string) insert_text_raw(position, string, string.length) end def emit_inserted_text(position, string) emit_inserted_text_raw(position, string, string.length) end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/text.rb���������������������������������������������������0000644�0001750�0001750�00000001627�12077252561�020052� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter class Text # Remove deprecated property accessors remove_method :position remove_method :set_position end end ���������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/lib/clutter/point.rb��������������������������������������������������0000644�0001750�0001750�00000001703�12077252561�020212� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Clutter class Point alias_method :initialize_original, :initialize def initialize(x=nil, y=nil) initialize_original init(x, y) if x and y end end end �������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/���������������������������������������������������������������0000755�0001750�0001750�00000000000�12257552167�015571� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/drag-action.rb�������������������������������������������������0000755�0001750�0001750�00000011421�12147676243�020310� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/drag-action.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "optparse" require "clutter" drag_axis = :none x_drag_threshold = 0 y_drag_threshold = 0 parser = OptionParser.new parser.on("--x-threshold=PIXELS", Integer, "Set the horizontal drag threshold", "(#{x_drag_threshold})") do |pixels| x_drag_threshold = pixels end parser.on("--y-threshold=PIXELS", Integer, "Set the vertical drag threshold", "(#{y_drag_threshold})") do |pixels| y_drag_threshold = pixels end axises = { :none => :axis_none, :x => :x_axis, :y => :y_axis, } parser.on("--axis=AXIS", axises.keys, "Set the drag axis", "[#{axises.keys.join(', ')}]", "(#{drag_axis})") do |axis| drag_axis = axis end parser.parse! drag_axis = axises[drag_axis] stage = Clutter::Stage.new stage.title = "Drag Test" stage.set_size(800, 600) stage.signal_connect("destroy") do Clutter.main_quit end handle = Clutter::Actor.new handle.background_color = Clutter::Color.new(:sky_blue) handle.set_size(128, 128) handle.set_position((800 - 128) / 2, (600 - 128) / 2) handle.reactive = true stage.add_child(handle) handle.signal_connect("enter-event") do |actor, event| transition = actor.get_transition("curl") if transition.nil? transition = Clutter::PropertyTransition.new("@effects.curl.period") transition.duration = 250 actor.add_transition("curl", transition); end transition.from = 0.0 transition.to = 0.25 transition.rewind transition.start Clutter::Event::STOP end handle.signal_connect("leave-event") do |actor, event| transition = actor.get_transition("curl") if transition.nil? transition = Clutter::PropertyTransition.new("@effects.curl.period") transition.duration = 250 actor.add_transition("curl", transition) end transition.from = 0.25 transition.to = 0.0 transition.rewind transition.start Clutter::Event::STOP end action = Clutter::DragAction.new action.set_drag_threshold(x_drag_threshold, y_drag_threshold) action.drag_axis = drag_axis action.signal_connect("drag-begin") do |_action, actor, event_x, event_y, modifiers| copy_p = modifiers.shift_mask? if copy_p drag_handle = Clutter::Actor.new drag_handle.set_size(48, 48) drag_handle.background_color = Clutter::Color.new(:sky_blue_dark) stage.add_child(drag_handle) drag_handle.set_position(event_x, event_y) else drag_handle = actor end _action.drag_handle = drag_handle transition = actor.get_transition("disable") if transition.nil? transition = Clutter::PropertyTransition.new("@effects.disable.factor") transition.duration = 250 actor.add_transition("disable", transition) end transition.from = 0.0 transition.to = 1.0 transition.rewind transition.start end action.signal_connect("drag-end") do |_action, actor, event_x, event_y, modifiers| drag_handle = _action.drag_handle if actor != drag_handle drag_handle.save_easing_state do drag_handle.easing_mode = :linear drag_handle.opacity = 0 end drag_handle.signal_connect("transitions-completed") do drag_handle.destroy end parent = actor.parent succeeded, real_x, real_y = parent.transform_stage_point(event_x, event_y) actor.save_easing_state do actor.easing_mode = :ease_out_cubic actor.set_position(real_x, real_y) end end transition = actor.get_transition("disable") if transition.nil? transition = Clutter::PropertyTransition.new("@effects.disable.factor") transition.duration = 250 actor.add_transition("disable", transition) end transition.from = 1.0 transition.to = 0.0 transition.rewind transition.start end handle.add_action(action) handle.add_effect_with_name("disable", Clutter::DesaturateEffect.new(0.0)) handle.add_effect_with_name("curl", Clutter::PageTurnEffect.new(0.0, 45.0, 12.0)) stage.show Clutter.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/drop-action.rb�������������������������������������������������0000755�0001750�0001750�00000013223�12147676243�020341� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/drop-action.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "clutter" TARGET_SIZE = 200 HANDLE_SIZE = 128 stage = Clutter::Stage.new stage.title = "Drop Action" stage.signal_connect("destroy") do Clutter.main_quit end target1 = Clutter::Actor.new target1.background_color = Clutter::Color.new(:scarlet_red_light) target1.set_size(TARGET_SIZE, TARGET_SIZE) target1.opacity = 64 target1.add_constraint(Clutter::AlignConstraint.new(stage, :y_axis, 0.5)) target1.x = 10 target1.reactive = true on_target_over = lambda do |action, actor, over_p| final_opacity = over_p ? 128 : 64 target = action.actor target.save_easing_state do target.easing_mode = :linear target.opacity = final_opacity end end target1.add_action_with_name("drop", Clutter::DropAction.new) drop_action = target1.get_action("drop") drop_action.signal_connect("over-in") do |_action, actor| on_target_over.call(_action, actor, true) end drop_action.signal_connect("over-out") do |_action, actor| on_target_over.call(_action, actor, false) end drag = nil drop_successful = false add_drag_object = lambda do |target| if drag.nil? drag = Clutter::Actor.new drag.background_color = Clutter::Color.new(:sky_blue_light) drag.set_size(HANDLE_SIZE, HANDLE_SIZE) drag.set_position((TARGET_SIZE - HANDLE_SIZE) / 2.0, (TARGET_SIZE - HANDLE_SIZE) / 2.0) drag.reactive = true action = Clutter::DragAction.new action.signal_connect("drag-begin") do |_action, _actor, event_x, event_y, modifiers| x, y = _actor.position handle = Clutter::Actor.new handle.background_color = Clutter::Color.new(:sky_blue_dark) handle.set_size(128, 128) handle.set_position(event_x - x, event_y - y) stage.add_child(handle) _action.drag_handle = handle _actor.save_easing_state do _actor.easing_mode = :linear _actor.opacity = 128 end drop_successful = true end action.signal_connect("drag-end") do |_action, _actor, event_x, event_y, modifiers| handle = _action.drag_handle printf("Drag ended at: %.0f, %.0f\n", event_x, event_y) _actor.save_easing_state do _actor.easing_mode = :linear _actor.opacity = 255 end handle.save_easing_state do if drop_successful handle.easing_mode = :linear handle.opacity = 0 else parent = _actor.parent parent.save_easing_state do parent.easing_mode = :linear parent.opacity = 255 end x_pos, y_pos = _actor.transformed_position handle.easing_mode = :ease_out_bounce handle.set_position(x_pos, y_pos) handle.opacity = 0 end end handle.signal_connect("transitions-completed") do |_actor| _actor.destroy end end drag.add_action(action) end parent = drag.parent if parent == target target.save_easing_state do target.easing_mode = :linear target.opacity = 255 end return end if parent and parent != stage parent.remove_child(drag) parent.save_easing_state do parent.easing_mode = :linear parent.opacity = 64 end end target.add_child(drag) target.save_easing_state do target.easing_mode = :linear target.opacity = 255 end end on_target_drop = lambda do |_action, actor, event_x, event_y| succeeded, actor_x, actor_y = actor.transform_stage_point(event_x, event_y) printf("Dropped at %.0f, %.0f (screen: %.0f, %.0f)\n", actor_x, actor_y, event_x, event_y) drop_successful = TRUE; add_drag_object.call(actor) end drop_action.signal_connect("drop", &on_target_drop) dummy = Clutter::Actor.new dummy.background_color = Clutter::Color.new(:orange_dark) dummy.set_size(640 - (2 * 10) - (2 * (TARGET_SIZE + 10)), TARGET_SIZE) dummy.add_constraint(Clutter::AlignConstraint.new(stage, :x_axis, 0.5)) dummy.add_constraint(Clutter::AlignConstraint.new(stage, :y_axis, 0.5)) dummy.reactive = true target2 = Clutter::Actor.new target2.background_color = Clutter::Color.new(:chameleon_light) target2.set_size(TARGET_SIZE, TARGET_SIZE) target2.opacity = 64 target2.add_constraint(Clutter::AlignConstraint.new(stage, :y_axis, 0.5)) target2.x = 640 - TARGET_SIZE - 10 target2.reactive = true target2.add_action_with_name("drop", Clutter::DropAction.new) drop_action = target2.get_action("drop") drop_action.signal_connect("over-in") do |_action, actor| on_target_over.call(_action, actor, true) end drop_action.signal_connect("over-out") do |_action, actor| on_target_over.call(_action, actor, false) end drop_action.signal_connect("drop", &on_target_drop) stage.add_child(target1) stage.add_child(dummy) stage.add_child(target2) add_drag_object.call(target1) stage.show Clutter.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/redhand.png����������������������������������������������������0000644�0001750�0001750�00000020072�12077252561�017700� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������������bKGD������ pHYs�� �� ����tIME 3x<,��IDATx]y|M~>( "HQV> Q)UU:hPzRJu]\PBiBEDD99Z9kwg=Z888888888888888888888888D),rU0H#ۜ#Tىm!8Ad' ` (�@9�cɂ 4$ p.w Y�) $m"!Eچ.�RT 3 49m0L)c&f=(cl+TRJRJ/e-JcPJ#VboL)}RYp'l0t0;]X Lfse(4VuC]e J)SDؐmC)N)-۸6?! [R:ֆ^l*xE%<c~|�8es J;jۆRM*mNnXŢ%Lcu'3~&<nam% d'_NMJWI<pf.'"u:'$CNAr L&?BH!$-LJy)\,Bל2qpWJ0BlɄ3gPK//60>#wo&&+b�}i)JFuZ ` aa+<\0N<5uWT�@m:t@P>M芋Qv~ 0Cpu٪EeB:8:A.BK-۸W�`v2ϖ-vDN M^KKݠz }=s&&u156v- l0Dھ4^^6O x1J~ζqwGOHر$$t !dBJSRpaLzγuktZ�Æ:3CMw?J:l:/^ m|^f=H3y6z…h9tlu1{Fm i"KXn*b)ANJ�we:\0AZ|ot7n<uJ;7ҟbY Lm=c:Lnm pPoM4*B, G<!$MҔl2?.D2͓kTTסCE؟=0}wO^_˟.m^z qK~GEkVţE ݽ[jܶ2VJrE֢E ��]/m6pv$Y� ?*iQ6r�@5O6Rg&Lƍ^I=cA{x *6Mp;oKܵkQzA~Y[WRӧFf,_J_Iy瑵x4tcRؗ,_޴|k՞?GJd/]j|j O?VPY}$z]&~}jx tBDPY+kڬ׶lAC~E{`F#B/u̴|"[:ԅtK)&8 A�>|c.Ńpv_ԀE;wZɢEۆR\ۺ6דE-ÑҔW2QmӺPq٦637lZCEΉ 0A�Wµz%"%lnb9/GDRKca+.bi9R4ټ.TuiY^@-<kQƂrl IKVbihpjQ%0J Xj;'R#̜ ~ @m!NM \Ap +W \Ap +W>s +W \ApuvApipU],L],s +Ws +W \Ap \Ap +W . TNJ^Z v]ލX[ S}=�P @􄛏. .AX�}yC+A8x cp +W vBJhPrWSXUgQaKvѣ;wX ׯa(;reRW֮qMouuq3V(ؼ`= @WRf<3gx RG>\s^O0Jqu2Ǐ󞼛ۥ!sB{ _c O2EA4h||  D3F6264^GqӮ5d ҿ!t Ovh֩uxm Z-A�[v)5@u:XX<E\+W@umi4TVi8(B�$& 11Rh4иC wx"Gr JKC4%5|Arڠ <Z>}֬m3A68!!d ̞ ]QdT?d1h4>C؜w#gX"ƍCsϡ>?׶l-[k(6rUwfwDz _}E?eP061Bj:bOfqqDj6jBG=^8䷻K qHX:ur=VawNkxic 4.Wx8]Ĥ$:>:|88)S xxpK8E˸1iՙH??͝>w,gXz}=̓Sw_.u+:&;w!߿]j!fL$&%eK>]ٳiɁ v'VD7ް+7C-͛ǹ pGϤ$9/D<qehw40憸3kVNcQp&-ZmyNt>OO\7O3)<Q~~HܴBD2O 1{wދ3<cgVKk;]>- Ɛ vI'ӵZ$Xx l ܯ|rⷄիp#$Vpr?>13XDA_3,l1nZ],Gw<,B|h'A@ŋ pTKۼ9by9s t,:k>z4lq ~I`hSvi<S]Qu,._F]v6 0Ԁ MH}|٪|:tol,{WDݝl$ :} f4BwCdgA}(ܶ 'N?k#"b`],ݺ!駑ĥBJlWeh,*յky3eegTu99]W֮_׮h+h#Z~4l$fAWZd.ZC!{2P4<Gz%xGE! ?_?s)޻ /Ʀedd183itk $ՃȘ?ƍS4.w!CPvjE. hRcu5Ne]\<Um'N1*HرՕOAm@z\9?L${cjB&ߕÞB3Jx1rWR~D.'mP^l!cnݪxѭFpNrgpibm'1 g@MFzGEkW 䡇-d~\ieɓnU-~+ ~ Qn̙`&CtVMFR2c{qNt)rW@]vb$$Xug#wdD`ފ+)A5aF\S^77],],B=p嫯`wN+LNV `^R^pWP7i`+ڕ,wX쁡¡;p6ٶ :u1Pbk*|t=*.F/( j ʸ'F#ʎqSl!x4A䚥ڶU4 Jn؝>T>J{o%5/t%GV._v0 u99RJDj rĀb }yWjxAkkjԔD< R)8NEco 6*)E�4NՁJJ# TA:Aj)j1$_1iR[gh2y<+lljF4XM6?||NΜ.K$HCa" VԢԫbWCHgEgQgUEa[#X vv_)KRPX[ =GZ HQTCcQ'(u[tŋ5O8|wX<UZ"o{W$2RREj32K߭UHO?XY5钟ue^ADh+)p4TUV脠ԩi!!ʉȭ �pB 5>>OV?XFwTCvZ/*eF~qDRJ*RSq7we/n&)VRE/ �A0Jk|ˡC[ 5xy)VdiJU]aQ/OwMQtY#0ŗK~ c�|Ʈ]3, ݖ-y"Ed%Q/j%o鸾cw< :#-[YG]vR]s7DԔ)h+vG�$~*+n a lwg^ $Um�D9zmx6VWO?aH}oL ۷\bfB>jƢϏ??!A oWD b@jU'h}m3֒O]i^3W.:.:i5rZScj LLD={9q7bBeˬZ\߱Ckޜ d/o.]$ULw 6oV=@hݹ-~&hat?xP_L ":H1c$W.grȦ߭w.?dq|cb{Yz[j)Q:<.Q1� hva,/[CUJCiJ ʏEcQ݉L4Cp<ݻJf4S92(1#!DA6j7mTÆ)zm 5 R_G}~>srTܚ5gVn׮FY_@ƍ>cJ! �Qjpx�ß~/)t8t}0TVި_D܂bjA?(ꋘy+v^۲ nwEd̟/;9BH-d<J Ji3#Z!&yuQ f)v_PhMe�BB cɔG)^vCGCy`bY@ӹh2M9 `!d!$R<MugRym9]YE;wQ-N)ν]s$'RJU �ꟐVZQp7PP9gGUvޣ'!dcoP"B-c)v|]5*+qajh# "룏l^JABPJB3VHQ֭NSy4ҦLQgBmf&Nw~t$J)OUS)϶6 11VhN\=KUxN }y+4ח/kHbɠRTD@O>zE7Ғ%uT**pbh4+~N~ [˟+9I,Nhd;SݔҖo}fƐ1o2,*SUׯctD3IVb5A*2Gʳ//$\)֜q~tlvFȑ]T$c�$qalYܤC a*V *OƩ瞃X:40�i'gh:B2%^Ba� Bڴie<Zk8'+Ji.s|/">#G1~<í}wъĬ"k�L򬩡#GYYA &0VW㷷FmN>"'L@W_l c Rڌr _ǯh((NO=N qV[Y2uJݳf[="}�t(!Drݚt CUlulqs"tpTcu5.})~K-R qfJM1\2E b.x3g>_~(N-CFG;MQ8Î\Ih}w$,Q fW$�Wr�N=쇤4h;q"^z -Z8(3*Ϝ%K\z�}w풲30!d1/!jQ̤I6I 6>^gǎ!{R8w܄n˗OJvA0)N3I^$Xò4%ƏYXZ?$"'NOt](TGiJ rWDّ# pG T f~+YSSqz8+*lVO"?8iUWnߎk?<΂ q&)7pIL5=�Xڬ,3W//48-~!<�VQףEߏw*-Q"1nO|72O5I҆r Ut%%8=a*S迧 zkWxGFB4h<}Ǐ)4.5XG}>62WUIYE ͮooxGF«MxiPh' `�`24>/ h((�3Ȗ 13!$@ﺶe .̞ cM M C e%K6 \`M`9O>~{"gO>28Ɨ qQ|MScAv'93f~e An"9H"h1E`^|09D" �4}w Uh>pqڍb  D^p'縺aO0*A$;~IW}_!_ 1ßŀ#G1nbpr&H!�kQڅQ}^| / ;!qj*o:M1ďMm}E򓒐Դeopxݿ<"O!3 7d IrɄ_~Aߢx^氹9s.gnsE2"/ cM Cю(=|bAVs"rD8EY]p"t8~%QԤDtvht^Y},!$ɡ r𪛱UgϢ*- 騹pOs;_Fѣل(#l�jףh((iny9Luuz}jh<= ot4~]u."p(ܤ&�X�+κs4B,8b )] !�mP�!_v,j ' AӽٗxsX�`r8,A?n#$�x.x1TSD99k !;n&\�yXG$KqfPJ#<+r]RRB�sUq dx|8AĹ_]0@;8BT3� !ܟ3)42�0&hJsXsWե?nf$� cs �6M Ncx3a"54+ rR SpքpRDsV����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/pan-action.rb��������������������������������������������������0000755�0001750�0001750�00000005521�12147676243�020155� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/pan-action.c. The # image file used in this sample code is copied from # clutter/tests/data/redhand.png. They are licensed under the terms # of the GNU Lesser General Public License, version 2.1 or (at your # option) later. # # Copyright (C) 2013 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 require "clutter" require "gdk_pixbuf2" stage = Clutter::Stage.new stage.name = "Pan Action" stage.user_resizable = true scroll = Clutter::Actor.new scroll.name = "scroll" scroll.add_constraint(Clutter::AlignConstraint.new(stage, :x_axis, 0)) scroll.add_constraint(Clutter::BindConstraint.new(stage, :size, 0)) content = Clutter::Actor.new content.set_size(720, 720) pixbuf = Gdk::Pixbuf.new(File.expand_path("redhand.png", File.dirname(__FILE__))) image = Clutter::Image.new image.set_data(pixbuf.pixels, pixbuf.has_alpha? ? :rgba_8888 : :rgb_888, pixbuf.width, pixbuf.height, pixbuf.rowstride) content.set_content_scaling_filters(:trilinear, :linear) content.content_gravity = :resize_aspect content.content = image scroll.add_child(content) pan_action = Clutter::PanAction.new pan_action.interpolate = true pan_action.signal_connect("pan") do |action, actor, interpolated_p| if interpolated_p delta_x, delta_y = action.interpolated_delta event_name = "INTERPOLATED" else delta_x, delta_y = action.get_motion_delta(0) event = action.get_last_event(0) event_name = event.class.name end puts("[#{event_name}] panning dx:#{delta_x} dy:#{delta_y}"); Clutter::Event::STOP end scroll.add_action(pan_action) scroll.reactive = true stage.add_child(scroll) info = Clutter::Text.new(nil, "Press <space> to reset the image position.") stage.add_child(info) info.set_position(12, 12) stage.signal_connect("destroy") do Clutter.main_quit end stage.signal_connect("key-press-event") do |actor, event| case event.key_symbol when Clutter::Keys::KEY_space scroll.save_easing_state do scroll.easing_duration = 1000 scroll.child_transform = nil end end Clutter::Event::STOP end stage.show Clutter.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/easing-modes.rb������������������������������������������������0000755�0001750�0001750�00000010340�12257552167�020472� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/easing-mode.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "optparse" require "clutter" duration = 1 parser = OptionParser.new parser.on("--duration=SECONDS", Integer, "Duration of the animation", "(#{duration})") do |_duration| duration = _duration end parser.parse! current_mode_index = 0 easing_modes = Clutter::AnimationMode.values.reject do |mode| mode == Clutter::AnimationMode::CUSTOM_MODE end help_text = lambda do format = <<-EOT.chomp <b>Easing mode: %s (%d of %d)</b> Left click to tween Middle click to jump Right click to change the easing mode EOT current_mode = easing_modes[current_mode_index] format % [current_mode.nick, current_mode_index, easing_modes.size] end stage = Clutter::Stage.new stage.title = "Easing Modes" stage.background_color = Clutter::Color.new(:sky_blue_light) stage.signal_connect("destroy") do Clutter.main_quit end main_stage = stage stage_width, stage_height = stage.size bouncer_width = 50 bouncer_height = 50 canvas = Clutter::Canvas.new canvas.signal_connect("draw") do |_canvas, cairo_context, width, height| cairo_context.operator = :clear cairo_context.paint cairo_context.operator = :over radius = [width, height].max cairo_context.arc(radius / 2, radius / 2, radius / 2, 0.0, 2.0 * Math::PI) bouncer_color = Clutter::Color.new(:scarlet_red_dark) pattern = Cairo::RadialPattern.new(radius / 2, radius / 2, 0, radius, radius, radius) pattern.add_color_stop_rgba(0, bouncer_color.red / 255.0, bouncer_color.green / 255.0, bouncer_color.blue / 255.0, bouncer_color.alpha / 255.0) pattern.add_color_stop_rgba(0.85, bouncer_color.red / 255.0, bouncer_color.green / 255.0, bouncer_color.blue / 255.0, 0.25); cairo_context.set_source(pattern) cairo_context.fill Clutter::Event::STOP end canvas.set_size(bouncer_width, bouncer_height) rectangle = Clutter::Actor.new rectangle.name = "bouncer" rectangle.set_size(bouncer_width, bouncer_height) rectangle.set_pivot_point(0.5, 0.5) rectangle.set_translation(bouncer_width / -2.0, bouncer_height / -2.0, 0.0) rectangle.reactive = true rectangle.content = canvas stage.add_child(rectangle) rectangle.set_position(stage_width / 2, stage_height / 2) label = Clutter::Text.new stage.add_child(label) label.markup = help_text.call label.line_alignment = :right label.add_constraint(Clutter::AlignConstraint.new(stage, :x_axis, 0.95)) label.add_constraint(Clutter::AlignConstraint.new(stage, :y_axis, 0.95)) easing_mode_label = label stage.signal_connect("button-press-event") do |actor, event| case event.button when Clutter::BUTTON_SECONDARY current_mode_index = (current_mode_index + 1) % easing_modes.size label.markup = help_text.call when Clutter::BUTTON_MIDDLE rectangle.set_position(event.x, event.y) when Clutter::BUTTON_PRIMARY current_mode = easing_modes[current_mode_index] rectangle.save_easing_state do rectangle.easing_mode = current_mode rectangle.easing_duration = duration * 1000 rectangle.set_position(event.x, event.y) end end Clutter::Event::STOP end stage.show Clutter.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/basic-actor.rb�������������������������������������������������0000755�0001750�0001750�00000006376�12147676243�020324� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/basic-actor.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2012 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 require "clutter" stage = Clutter::Stage.new stage.signal_connect("destroy") do |*args| Clutter.main_quit end vase = Clutter::Actor.new vase.name = "vase" vase.layout_manager = Clutter::BoxLayout.new vase.background_color = Clutter::Color.get_static(:sky_blue_light) vase.add_constraint(Clutter::AlignConstraint.new(stage, :both, 0.5)) stage.add_child(vase) SIZE = 128 flower = Clutter::Actor.new flower.name = "flower.1" flower.set_size(SIZE, SIZE) flower.margin_left = 12 flower.background_color = Clutter::Color.get_static(:red) flower.reactive = true vase.add_child(flower) toggled = true flower.signal_connect("button-press-event") do |actor, event| if toggled end_color = Clutter::Color.get_static(:blue) else end_color = Clutter::Color.get_static(:red) end actor.save_easing_state do actor.easing_duration = 500 actor.easing_mode = :linear actor.background_color = end_color end toggled = !toggled Clutter::Event::STOP end flower = Clutter::Actor.new flower.name = "flower.2" flower.set_size(SIZE, SIZE) flower.margin_top = 12 flower.margin_left = 6 flower.margin_right = 6 flower.margin_bottom = 12 flower.background_color = Clutter::Color.get_static(:yellow) flower.reactive = true vase.add_child(flower) on_crossing = lambda do |actor, event| if event.type == Clutter::EventType::ENTER zpos = -250.0 else zpos = 0.0 end actor.save_easing_state do actor.easing_duration = 500 actor.easing_mode = :ease_out_bounce actor.z_position = zpos end Clutter::Event::STOP end flower.signal_connect("enter-event", &on_crossing) flower.signal_connect("leave-event", &on_crossing) flower = Clutter::Actor.new flower.name = "flower.3" flower.set_size(SIZE, SIZE) flower.margin_right = 12 flower.background_color = Clutter::Color::get_static(:green) flower.set_pivot_point(0.5, 0.0) flower.reactive = true vase.add_child(flower); flower.signal_connect("button-press-event") do |actor, event| actor.save_easing_state do actor.easing_duration = 1000 actor.set_rotation_angle(:y_axis, 360.0) end id = actor.signal_connect("transition-stopped::rotation-angle-y") do actor.save_easing_state do actor.set_rotation_angle(:y_axis, 0.0) end actor.signal_handler_disconnect(id) end Clutter::Event::STOP end stage.show Clutter.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/canvas.rb������������������������������������������������������0000755�0001750�0001750�00000006534�12147676243�017404� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/canvas.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2012 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 require "clutter" stage = Clutter::Stage.new stage.title = "2D Clock" stage.user_resizable = true stage.background_color = Clutter::Color.get_static(:sky_blue_light) stage.set_size(300, 300) stage.show canvas = Clutter::Canvas.new canvas.set_size(300, 300) actor = Clutter::Actor.new actor.content = canvas actor.set_content_scaling_filters(:trilinear, :linear) stage.add_child(actor) actor.add_constraint(Clutter::BindConstraint.new(stage, :size, 0)) idle_resize_id = nil actor.signal_connect("allocation-changed") do |_actor, allocation, flags| idle_resize_id ||= Clutter::Threads.add_timeout(1000) do width, height = _actor.size _actor.content.set_size(width.ceil, height.ceil) idle_resize_id = nil GLib::Source::REMOVE end end stage.signal_connect("destroy") do Clutter.main_quit end canvas.signal_connect("draw") do |_canvas, cairo_context, width, height| now = Time.now seconds = now.sec * Math::PI / 30 minutes = now.min * Math::PI / 30 hours = now.hour * Math::PI / 6 cairo_context.save do cairo_context.operator = :clear cairo_context.paint end cairo_context.operator = :over cairo_context.scale(width, height) cairo_context.line_cap = :round cairo_context.line_width = 0.1 # the black rail that holds the seconds indicator cairo_context.set_source_clutter_color(Clutter::Color.get_static(:black)) cairo_context.translate(0.5, 0.5) cairo_context.arc(0, 0, 0.4, 0, Math::PI * 2) cairo_context.stroke # the seconds indicator color = Clutter::Color.get_static(:white) color.alpha = 128 cairo_context.set_source_clutter_color(color) cairo_context.move_to(0, 0) cairo_context.arc(Math.sin(seconds) * 0.4, -Math.cos(seconds) * 0.4, 0.05, 0, Math::PI * 2) cairo_context.fill # the minutes hand color = Clutter::Color.get_static(:chameleon_dark) color.alpha = 196 cairo_context.set_source_clutter_color(color) cairo_context.move_to(0, 0) cairo_context.line_to(Math.sin(minutes) * 0.4, -Math.cos(minutes) * 0.4) cairo_context.stroke # the hours hand cairo_context.move_to(0, 0) cairo_context.line_to(Math.sin(hours) * 0.2, -Math.cos(hours) * 0.2) cairo_context.stroke true end canvas.invalidate Clutter::Threads.add_timeout(100, 1000) do canvas.invalidate GLib::Source::CONTINUE end Clutter.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/scroll-actor.rb������������������������������������������������0000755�0001750�0001750�00000005453�12147676243�020534� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/scroll-actor.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "clutter" stage = Clutter::Stage.new stage.title = "Scroll Actor" stage.user_resizable = true stage.signal_connect("destroy") do Clutter.main_quit end selected_item_index = nil select_item_at_index = lambda do |scroll, index| menu = scroll.first_child if selected_item_index item = menu.get_child_at_index(selected_item_index) item.color = Clutter::Color.new(:white) end index = index % menu.n_children item = menu.get_child_at_index(index) succeeded, x, y = item.position scroll.save_easing_state do scroll.scroll_to_point(Clutter::Point.new(x, y)) end item.color = Clutter::Color.new(:sky_blue_light) selected_item_index = index end stage.signal_connect("key-press-event") do |actor, event| scroll = stage.first_child case event.key_symbol when Clutter::Keys::KEY_Up select_item_at_index.call(scroll, selected_item_index - 1) when Clutter::Keys::KEY_Down select_item_at_index.call(scroll, selected_item_index + 1) end Clutter::Event::STOP end scroll = Clutter::ScrollActor.new scroll.name = "scroll" scroll.set_position(0.0, 18.0) scroll.add_constraint(Clutter::AlignConstraint.new(stage, :x_axis, 0.5)) scroll.add_constraint(Clutter::BindConstraint.new(stage, :height, -36.0)) scroll.scroll_mode = :vertically layout_manager = Clutter::BoxLayout.new layout_manager.orientation = :vertical layout_manager.spacing = 12.0 menu = Clutter::Actor.new menu.layout_manager = layout_manager menu.background_color = Clutter::Color.new(:black) n_items = 11 n_items.times do |i| text = Clutter::Text.new text.font_name = "Sans Bold 24" text.text = "Option #{i + 1}" text.color = Clutter::Color.new(:white) text.margin_left = 12.0 text.margin_right = 12.0 menu.add_child(text) end scroll.add_child(menu) select_item_at_index.call(scroll, 0) stage.add_child(scroll) stage.show Clutter.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/constraints.rb�������������������������������������������������0000755�0001750�0001750�00000005706�12147676243�020500� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/constraints.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "clutter" stage = Clutter::Stage.new stage.name = "stage" stage.title = "Snap Constraint" stage.user_resizable = true stage.background_color = Clutter::Color.get_static(:aluminium_1) stage.signal_connect("destroy") do Clutter.main_quit end layer_a = Clutter::Actor.new layer_a.background_color = Clutter::Color.new(:scarlet_red) layer_a.name = "layerA" layer_a.set_size(100.0, 25.0) stage.add_child(layer_a) layer_a.add_constraint(Clutter::AlignConstraint.new(stage, :both, 0.5)) layer_b = Clutter::Actor.new layer_b.background_color = Clutter::Color.new(:butter_dark) layer_b.name = "layerB" stage.add_child(layer_b) layer_b.add_constraint(Clutter::BindConstraint.new(layer_a, :x, 0.0)) layer_b.add_constraint(Clutter::BindConstraint.new(layer_a, :width, 0.0)) layer_b.add_constraint(Clutter::SnapConstraint.new(layer_a, :top, :bottom, 10.0)) layer_b.add_constraint(Clutter::SnapConstraint.new(stage, :bottom, :bottom, -10.0)) layer_c = Clutter::Actor.new layer_c.background_color = Clutter::Color.new(:chameleon_light) layer_c.name = "layerC" stage.add_child(layer_c) layer_c.add_constraint(Clutter::BindConstraint.new(layer_a, :x, 0.0)) layer_c.add_constraint(Clutter::BindConstraint.new(layer_a, :width, 0.0)) layer_c.add_constraint(Clutter::SnapConstraint.new(layer_a, :bottom, :top, -10.0)) layer_c.add_constraint(Clutter::SnapConstraint.new(stage, :top, :top, 10.0)) stage.show Clutter.main ����������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/flow-layout.rb�������������������������������������������������0000755�0001750�0001750�00000006314�12147676243�020407� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/flow-layout.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2013 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 require "optparse" require "clutter" random_size_p = false n_rects = 20 vertical_p = false homogeneous_p = false x_spacing = 0 y_spacing = 0 fixed_size_p = false parser = OptionParser.new parser.on("--[no-]random-size", "Randomly size the rectangles", "(#{random_size_p})") do |boolean| random_size_p = boolean end parser.on("--n-rects=N", Integer, "Number of rectangles", "(#{n_rects})") do |n| n_rects = n end parser.on("--[no-]vertical", "Set vertical orientation", "(#{vertical_p})") do |boolean| vertical_p = boolean end parser.on("--[no-]homogeneous", "Whether the layout should be homogeneous", "(#{homogeneous_p})") do |boolean| homogeneous_p = boolean end parser.on("--x-spacing=PIXEL", Integer, "Horizontal spacing between elements", "(#{x_spacing})") do |pixel| x_spacing = pixel end parser.on("--y-spacing=PIXEL", Integer, "Vertical spacing between elements", "(#{y_spacing})") do |pixel| y_spacing = pixel end parser.on("--[no-]fixed-size", "Fix the layout size", "(#{fixed_size_p})") do |boolean| fixed_size_p = boolean end parser.parse! stage = Clutter::Stage.new stage.background_color = Clutter::Color.new(:sky_blue_light) stage.title = "Flow Layout" stage.user_resizable = true stage.signal_connect("destroy") do Clutter.main_quit end layout = Clutter::FlowLayout.new(vertical_p ? :vertical : :horizontal) layout.homogeneous = homogeneous_p layout.column_spacing = x_spacing layout.row_spacing = y_spacing box = Clutter::Actor.new box.layout_manager = layout box.background_color = Clutter::Color.new(:aluminium_2) stage.add_child(box) unless fixed_size_p box.add_constraint(Clutter::BindConstraint.new(stage, :size, 0.0)) end box.set_position(0, 0) box.name = "box" n_rects.times do |i| color = Clutter::Color.hls(360.0 / n_rects * i, 0.5, 0.8) rect = Clutter::Actor.new rect.background_color = color if random_size_p width = rand(50..100) height = rand(50..100) else width = height = 50.0 end rect.set_size(width, height) rect.name = "rect%02d" % i box.add_child(rect) end stage.show Clutter.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/image-content.rb�����������������������������������������������0000755�0001750�0001750�00000005100�12147676243�020647� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/image-content.c. The # image file used in this sample code is copied from # clutter/tests/data/redhand.png. They are licensed under the terms # of the GNU Lesser General Public License, version 2.1 or (at your # option) later. # # Copyright (C) 2013 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 require "clutter" require "gdk_pixbuf2" gravities = Clutter::ContentGravity.values current_gravity_index = gravities.size - 1 stage = Clutter::Stage.new stage.name = "Stage" stage.title = "Content Box" stage.user_resizable = true stage.signal_connect("destroy") do Clutter.main_quit end stage.show box = Clutter::Actor.new box.name = "Image" box.margin_top = 12 box.margin_right = 12 box.margin_bottom = 12 box.margin_left = 12 box.add_constraint(Clutter::BindConstraint.new(stage, :size, 0.0)) stage.add_child(box) pixbuf = Gdk::Pixbuf.new(File.expand_path("redhand.png", File.dirname(__FILE__))) image = Clutter::Image.new image.set_data(pixbuf.pixels, pixbuf.has_alpha? ? :rgba_8888 : :rgb_888, pixbuf.width, pixbuf.height, pixbuf.rowstride) box.set_content_scaling_filters(:trilinear, :linear) box.content_gravity = gravities[current_gravity_index] box.content = image text = Clutter::Text.new text.add_constraint(Clutter::AlignConstraint.new(stage, :both, 0.5)) stage.add_child(text) update_text = lambda do current_gravity = gravities[current_gravity_index] text.text = "Content gravity: #{current_gravity.nick}" end update_text.call action = Clutter::TapAction.new action.signal_connect("tap") do |_action, actor| current_gravity_index = (current_gravity_index + 1) % gravities.size actor.save_easing_state do actor.content_gravity = gravities[current_gravity_index] end update_text.call end box.reactive = true box.add_action(action) Clutter.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/rounded-rectangle.rb�������������������������������������������0000755�0001750�0001750�00000005361�12147676243�021530� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/rounded-rectangle.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # Copyright (C) 2012 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 require "clutter" stage = Clutter::Stage.new stage.title = "Rectangle with rounded corners" stage.background_color = Clutter::Color.new(:black) stage.set_size(500, 500) stage.show canvas = Clutter::Canvas.new canvas.set_size(300, 300) actor = Clutter::Actor.new actor.content = canvas actor.content_gravity = :center actor.set_content_scaling_filters(:trilinear, :linear) actor.set_pivot_point(0.5, 0.5) actor.add_constraint(Clutter::BindConstraint.new(stage, :size, 0.0)) stage.add_child(actor) transition = Clutter::PropertyTransition.new("rotation-angle-y") transition.from = 0.0 transition.to = 360.0 transition.duration = 2000 transition.repeat_count = -1 actor.add_transition("rotateActor", transition) stage.signal_connect("destroy") do Clutter.main_quit end canvas.signal_connect("draw") do |_canvas, cairo_context, surface_width, surface_height| x = 1.0 y = 1.0 width = surface_width - 2.0 height = surface_height - 2.0 aspect = 1.0 corner_radius = height / 20.0 radius = corner_radius / aspect degrees = Math::PI / 180.0 cairo_context.save do cairo_context.operator = :clear cairo_context.paint end cairo_context.new_sub_path cairo_context.arc(x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees) cairo_context.arc(x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees) cairo_context.arc(x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees) cairo_context.arc(x + radius, y + radius, radius, 180 * degrees, 270 * degrees) cairo_context.close_path cairo_context.set_source_rgb(0.5, 0.5, 1) cairo_context.fill Clutter::Event::STOP end canvas.invalidate Clutter.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/box-layout.rb��������������������������������������������������0000755�0001750�0001750�00000013022�12147676243�020222� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/box-layout.c. # The original header: # Copyright 2009 Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU Lesser General Public License, # version 2.1, as published by the Free Software Foundation. # # This program is distributed in the hope 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 program; if not, write to the Free Software Foundation, # Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. # Boston, MA 02111-1307, USA. # # Copyright (C) 2012 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, version 2.1, as published by the Free Software Foundation. # # 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 require "clutter" stage = Clutter::Stage.new stage.title = "Box Layout" stage.user_resizable = true layout = Clutter::BoxLayout.new layout.orientation = :vertical stage.layout_manager = layout box = Clutter::Actor.new box.background_color = Clutter::Color.get_static(:light_gray) box.x_expand = true box.y_expand = true layout = Clutter::BoxLayout.new box.layout_manager = layout stage.add_child(box) instructions_label = [ "Press v\t\342\236\236\tSwitch horizontal/vertical", "Press h\t\342\236\236\tToggle homogeneous", "Press p\t\342\236\236\tToggle pack start/end", "Press s\t\342\236\236\tIncrement spacing (up to 12px)", "Press +\t\342\236\236\tAdd a new actor", "Press a\t\342\236\236\tToggle animations", "Press q\t\342\236\236\tQuit" ].join("\n") instructions = Clutter::Text.new("Sans 12px", instructions_label) instructions.x_expand = true instructions.y_expand = false instructions.x_align = :start instructions.margin_top = 4 instructions.margin_left = 4 instructions.margin_bottom = 4 stage.add_child(instructions) add_actor = lambda do |_box, position| color = Clutter::Color.hls(rand * 360, 0.5, 0.5) layout = Clutter::BinLayout.new(:center, :center) rect = Clutter::Actor.new rect.layout_manager = layout rect.background_color = color rect.reactive = true rect.set_size(32, 64) rect.x_expand = true rect.y_expand = true rect.x_align = :center rect.y_align = :center text = Clutter::Text.new("Sans 8px", "") text.line_alignment = :center rect.add_child(text) rect.signal_connect("button-release-event") do |_rect, event| x_align = _rect.x_align y_align = _rect.y_align x_expand = _rect.x_expand? y_expand = _rect.y_expand? case event.button when Clutter::BUTTON_PRIMARY aligns = Clutter::ActorAlign.values if event.has_shift_modifier? y_align = aligns[(aligns.index(y_align) + 1) % aligns.size] else x_align = aligns[(aligns.index(x_align) + 1) % aligns.size] end when Clutter::BUTTON_SECONDARY if event.has_shift_modifier? y_expand = !y_expand else x_expand = !x_expand end end _rect.x_align = x_align _rect.y_align = y_align _rect.x_expand = x_expand _rect.y_expand = y_expand true end changed = lambda do |actor, pspec| x_align = actor.x_align y_align = actor.y_align x_expand = actor.x_expand? y_expand = actor.y_expand? label = ["#{x_expand},#{y_expand}", x_align.nick, y_align.nick].join("\n") end rect.signal_connect("notify::x-align", &changed) rect.signal_connect("notify::y-align", &changed) rect.signal_connect("notify::x-expand", &changed) rect.signal_connect("notify::y-expand", &changed) changed.call(rect, nil) _box.insert_child_at_index(rect, position) end 5.times do |i| add_actor.call(box, i) end stage.signal_connect("destroy") do Clutter.main_quit end stage.signal_connect("key-release-event") do |_stage, event| layout = box.layout_manager handled = true case event.key_symbol when Clutter::Keys::KEY_a iter = Clutter::ActorIter.new(box) iter.each do |child| duration = child.easing_duration if duration.zero? duration = 250 else duration = 0 end child.easing_duration = duration end when Clutter::Keys::KEY_v orientation = layout.orientation if orientation == Clutter::Orientation::HORIZONTAL orientation = :vertical else orientation = :horizontal end layout.orientation = orientation when Clutter::Keys::KEY_h layout.homogeneous = !layout.homogeneous? when Clutter::Keys::KEY_p layout.pack_start = !layout.pack_start? when Clutter::Keys::KEY_s spacing = layout.spacing if spacing > 12 spacing = 0 else spacing += 1 end layout.spacing = spacing when Clutter::Keys::KEY_plus add_actor.call(box, rand(box.n_children)) when Clutter::Keys::KEY_q Clutter.main_quit else handled = false end handled end stage.show Clutter.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/bin-layout.rb��������������������������������������������������0000755�0001750�0001750�00000013643�12147676243�020213� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/basic-actor.c. The # image file used in this sample code is copied from # clutter/tests/data/redhand.png. They are licensed under the terms # of the GNU Lesser General Public License, version 2.1 or (at your # option) later. # # Copyright (C) 2012 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 require "clutter" require "gdk_pixbuf2" stage = Clutter::Stage.new stage.title = "BinLayout" stage.background_color = Clutter::Color.get_static(:aluminium_2) stage.set_size(640, 480) stage.show stage.signal_connect("destroy") do Clutter.main_quit end layout = Clutter::BinLayout.new(:center, :center) box = Clutter::Actor.new box.layout_manager = layout box.add_constraint(Clutter::AlignConstraint.new(stage, :both, 0.5)) box.set_position(320, 240) box.reactive = true box.name = "box" stage.add_child(box) canvas = Clutter::Canvas.new canvas.signal_connect("draw") do |_canvas, cairo_context, width, height| puts("Painting at #{width}x#{height}") cairo_context.save do cairo_context.operator = :clear cairo_context.paint end bg_round_radius = 12 x = y = 0 cairo_context.move_to(bg_round_radius, y) cairo_context.line_to(width - bg_round_radius, y) cairo_context.curve_to(width, y, width, y, width, bg_round_radius) cairo_context.line_to(width, height - bg_round_radius) cairo_context.curve_to(width, height, width, height, width - bg_round_radius, height) cairo_context.line_to(bg_round_radius, height) cairo_context.curve_to(x, height, x, height, x, height - bg_round_radius) cairo_context.line_to(x, bg_round_radius) cairo_context.curve_to(x, y, x, y, bg_round_radius, y) cairo_context.close_path bg_color = Clutter::Color.new(0xcc, 0xcc, 0xcc, 0x99) cairo_context.set_source_clutter_color(bg_color) cairo_context.stroke x += 4 y += 4 width -= 4 height -= 4 cairo_context.move_to(bg_round_radius, y) cairo_context.line_to(width - bg_round_radius, y) cairo_context.curve_to(width, y, width, y, width, bg_round_radius) cairo_context.line_to(width, height - bg_round_radius) cairo_context.curve_to(width, height, width, height, width - bg_round_radius, height) cairo_context.line_to(bg_round_radius, height) cairo_context.curve_to(x, height, x, height, x, height - bg_round_radius) cairo_context.line_to(x, bg_round_radius) cairo_context.curve_to(x, y, x, y, bg_round_radius, y) cairo_context.close_path pattern = Cairo::LinearPattern.new(0, 0, 0, height) pattern.add_color_stop_rgba(1, 0.85, 0.85, 0.85, 1) pattern.add_color_stop_rgba(0.95, 1, 1, 1, 1) pattern.add_color_stop_rgba(0.05, 1, 1, 1, 1) pattern.add_color_stop_rgba(0, 0.85, 0.85, 0.85, 1) cairo_context.set_source(pattern) cairo_context.fill true end canvas.set_size(200, 200) bg = Clutter::Actor.new bg.name = "background" bg.set_size(200, 200) bg.content = canvas bg.x_expand = true bg.y_expand = true bg.x_align = :fill bg.y_align = :fill box.add_child(bg) box.signal_connect("transitions-completed") do |actor| canvas.set_size(actor.width, actor.height) end pixbuf = Gdk::Pixbuf.new(File.expand_path("redhand.png", File.dirname(__FILE__))) image = Clutter::Image.new image.set_data(pixbuf.pixels, pixbuf.has_alpha? ? :rgba_8888 : :rgb_888, pixbuf.width, pixbuf.height, pixbuf.rowstride) icon = Clutter::Actor.new icon.name = "icon" icon.set_size(196, 196) icon.x_expand = true icon.y_expand = true icon.x_align = :center icon.y_align = :center icon.content_gravity = :resize_aspect icon.set_content_scaling_filters(:trilinear, :linear) icon.content = image box.add_child(icon) color = Clutter::Color.new(rand(255), rand(255), rand(255), 224) emblem = Clutter::Actor.new emblem.name = "emblem" emblem.set_size(48, 48) emblem.background_color = color emblem.x_expand = true emblem.y_expand = true emblem.x_align = :end emblem.y_align = :end emblem.reactive = true emblem.opacity = 0 box.add_child(emblem) action = Clutter::ClickAction.new emblem.add_action(action) expanded_p = false action.signal_connect("clicked") do |_action, _emblem| box.save_easing_state do box.easing_mode = :ease_out_bounce box.easing_duration = 500 if expanded_p box.set_size(200, 200) else box.set_size(400, 400) end end expanded_p = !expanded_p end action.signal_connect("long-press") do |_action, _emblem, state| case state when Clutter::LongPressState::QUERY puts("*** long press: query ***") expanded_p when Clutter::LongPressState::CANCEL puts("*** long press: cancel ***") true when Clutter::LongPressState::ACTIVATE puts("*** long press: activate ***") true else true end end box.signal_connect("enter-event") do |_box, event| emblem.save_easing_state do emblem.easing_mode = :linear emblem.opacity = 255 end Clutter::Event::STOP end box.signal_connect("leave-event") do |_box, event| emblem.save_easing_state do emblem.easing_mode = :linear emblem.opacity = 0 end Clutter::Event::STOP end label = Clutter::Text.new label.name = "text" label.text = "A simple test" label.x_expand = true label.x_align = :center label.y_expand = true label.y_align = :start box.add_child(label) Clutter.main ���������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/sample/grid-layout.rb�������������������������������������������������0000755�0001750�0001750�00000015326�12147676243�020370� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter/examples/grid-layout.c. # The original header: # Copyright 2012 Bastian Winkler <buz@netbuz.org> # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU Lesser General Public License, # version 2.1, as published by the Free Software Foundation. # # This program is distributed in the hope 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 program; if not, write to the Free Software Foundation, # Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. # Boston, MA 02111-1307, USA. # # # Copyright (C) 2013 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, version 2.1, as published by the Free Software Foundation. # # 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 require "optparse" require "clutter" random_size_p = false random_align_p = false default_expand_p = true use_box_p = false vertical_p = false parser = OptionParser.new parser.on("--[no-]random-size", "Randomly size the rectangles", "(#{random_size_p})") do |boolean| random_size_p = boolean end parser.on("--[no-]random-align", "Randomly set the align values", "(#{random_align_p})") do |boolean| random_align_p = boolean end parser.on("--no-expand", "Don't expand all actors by default", "(#{default_expand_p})") do |boolean| default_expand_p = boolean end parser.on("--[no-]box", "Use the layout in a Clutter::BoxLayout style", "(#{use_box_p})") do |boolean| use_box_p = boolean end parser.on("--[no-]vertical", "Use a vertical orientation when used with --box", "(#{vertical_p})") do |boolean| vertical_p = boolean end parser.parse! stage = Clutter::Stage.new stage.user_resizable = true stage_layout = Clutter::BoxLayout.new stage_layout.orientation = :vertical stage.layout_manager = stage_layout grid_layout = Clutter::GridLayout.new if vertical_p grid_layout.orientation = :vertical end box = Clutter::Actor.new box.background_color = Clutter::Color.new(:light_gray) box.x_expand = true box.y_expand = true box.layout_manager = grid_layout stage_layout.pack(box, true, true, true, :center, :center) add_actor = lambda do |left, top, width, height| color = Clutter::Color.hls(rand(0.0...360.0), 0.5, 0.5) color.alpha = 255 layout = Clutter::BinLayout.new(:center, :center) rect = Clutter::Actor.new rect.layout_manager = layout rect.background_color = color rect.reactive = true if random_size_p rect.set_size(rand(40..80), rand(40..80)) else rect.set_size(60, 60) end rect.x_expand = default_expand_p rect.y_expand = default_expand_p unless default_expand_p rect.x_align = :center rect.y_align = :center end if random_align_p aligns = Clutter::ActorAlign.values rect.x_align = aligns[rand(aligns.size)] rect.y_align = aligns[rand(aligns.size)] end text = Clutter::Text.new("Sans 8px", "") text.line_alignment = :center rect.add_child(text) changed = lambda do |actor, pspec| layout = box.layout_manager meta = layout.get_child_meta(box, actor) label = <<-EOL.chomp attach: #{meta.left_attach},#{meta.top_attach} span: #{meta.width},#{meta.height} expand: #{actor.x_expand?},#{actor.y_expand?} align: #{actor.x_align.nick},#{actor.y_align.nick}" EOL text.text = label end rect.signal_connect("button-release-event") do |actor, event| x_align = actor.x_align y_align = actor.y_align x_expand_p = actor.x_expand? y_expand_p = actor.y_expand? processed = true aligns = Clutter::ActorAlign.values case event.button when Clutter::BUTTON_PRIMARY if event.has_shift_modifier? actor.x_expand = !actor.x_expand? else actor.x_align = aligns[(actor.x_align.to_i + 1) % aligns.size] end when Clutter::BUTTON_SECONDARY if event.has_shift_modifier? actor.y_expand = !actor.y_expand? else actor.y_align = aligns[(actor.y_align.to_i + 1) % aligns.size] end else processed = false end processed end rect.signal_connect("notify::x-expand", &changed) rect.signal_connect("notify::y-expand", &changed) rect.signal_connect("notify::x-align", &changed) rect.signal_connect("notify::y-align", &changed) layout = box.layout_manager if use_box_p box.add_child(rect) else layout.attach(rect, left, top, width, height) end changed.call(rect, nil) end add_actor.call(0, 0, 1, 1) add_actor.call(1, 0, 1, 1) add_actor.call(2, 0, 1, 1) add_actor.call(0, 1, 1, 1) add_actor.call(1, 1, 2, 1) add_actor.call(0, 2, 3, 1) add_actor.call(0, 3, 2, 2) add_actor.call(2, 3, 1, 1) add_actor.call(2, 4, 1, 1) instructions = Clutter::Text.new("Sans 12px", <<-EOI.chomp) Press r\t\342\236\236\tSwitch row homogeneous Press c\t\342\236\236\tSwitch column homogeneous Press s\t\342\236\236\tIncrement spacing (up to 12px) Press q\t\342\236\236\tQuit Left/right click\t\t\342\236\236\tChange actor align Shift left/right click\t\342\236\236\tChange actor expand EOI instructions.margin_top = 4 instructions.margin_left = 4 instructions.margin_bottom = 4 stage_layout.pack(instructions, false, true, false, :start, :center) stage.signal_connect("destroy") do Clutter.main_quit end stage.signal_connect("key-release-event") do |actor, event| layout = box.layout_manager processed = true case event.key_symbol when Clutter::Keys::KEY_c homogeneous_p = layout.column_homogeneous? layout.column_homogeneous = !homogeneous_p when Clutter::Keys::KEY_r homogeneous_p = layout.row_homogeneous? layout.row_homogeneous = !homogeneous_p when Clutter::Keys::KEY_s spacing = (layout.column_spacing + 1) % 12 layout.column_spacing = spacing layout.row_spacing = spacing when Clutter::Keys::KEY_q Clutter.main_quit else processed = false end processed end stage.show Clutter.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/patches/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�015735� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter/patches/json-glib-1.0.2-add-missing-config-h.diff���������������������0000644�0001750�0001750�00000001144�12416346617�024774� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������commit 415c75677544df6aa4929c851f44a412ea39b7b4 Author: Emmanuele Bassi <ebassi@gnome.org> Date: Fri Jul 25 09:10:52 2014 +0100 Include "config.h" in the enum types template Expands the symbol annotation correctly. --- json-glib/json-enum-types.c.in | 1 + 1 file changed, 1 insertion(+) diff --git a/json-glib/json-enum-types.c.in b/json-glib/json-enum-types.c.in index 8b82049..0e09075 100644 --- a/json-glib/json-enum-types.c.in +++ b/json-glib/json-enum-types.c.in @@ -1,4 +1,5 @@ /*** BEGIN file-header ***/ +#include "config.h" #include "json-enum-types.h" /*** END file-header ***/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/���������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�015575� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/test/����������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�016557� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/test/test_source_gutter_renderer.rb����������������������������0000644�0001750�0001750�00000002223�12416346617�024732� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestGutterRendererText < Test::Unit::TestCase def setup @renderer = GtkSource::GutterRendererText.new end def test_markup markup_text = "ruby" @renderer.markup = markup_text assert_equal(markup_text, @renderer.markup) end def test_text render_text = "gtksourceview" @renderer.text = render_text assert_equal(render_text, @renderer.text) end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/test/test_mark_attributes.rb�����������������������������������0000644�0001750�0001750�00000002044�12416346617�023353� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestMarkAttributes < Test::Unit::TestCase def setup @mark_attributes = GtkSource::MarkAttributes.new end def test_background @mark_attributes.background = Gdk::RGBA.new(1, 0, 0, 0) assert_equal("rgba(255,0,0,0)", @mark_attributes.background.to_s) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/test/test_source_language_manager.rb���������������������������0000644�0001750�0001750�00000003026�12416346617�025011� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestLanguageManager < Test::Unit::TestCase def setup @lang = GtkSource::LanguageManager.new @view = GtkSource::View.new end def test_language language = @lang.get_language("ruby") @view.buffer.language = language assert_equal(language, @view.buffer.language) highlight = true @view.buffer.highlight_syntax = highlight assert_true(@view.buffer.highlight_syntax?) @view.buffer.highlight_matching_brackets = highlight assert_true(@view.buffer.highlight_matching_brackets?) end def test_language_ids ids = @lang.language_ids assert_include(ids, "ruby") end def test_search_path custom_path = "/path/to/search" @lang.search_path = custom_path assert_equal([custom_path], @lang.search_path) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/test/run-test.rb�����������������������������������������������0000755�0001750�0001750�00000002523�12516434313�020672� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") gdk3_base = File.join(ruby_gnome2_base, "gdk3") gtk3_base = File.join(ruby_gnome2_base, "gtk3") gtk_source_view3_base = File.join(ruby_gnome2_base, "gtksourceview3") $LOAD_PATH.unshift(glib_base) require 'test/glib-test-init' dependencies = [ glib_base, atk_base, cairo_gobject_base, pango_base, gdk_pixbuf_base, gobject_introspection_base, gdk3_base, gtk3_base, gtk_source_view3_base, ] dependencies.each do |target| makefile = File.join(target, "Makefile") if File.exist?(makefile) and system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", File.basename(target))) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(gtk3_base, "test")) require 'gtk-test-utils' require 'gtksourceview3' exit Test::Unit::AutoRunner.run(true) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/test/test_source_view.rb���������������������������������������0000644�0001750�0001750�00000003240�12516434313�022474� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2011-2014 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 class TestSourceView < Test::Unit::TestCase def setup @view = GtkSource::View.new end def test_auto_indent @view.auto_indent = true assert_true(@view.auto_indent?) end def test_line_number @view.show_line_numbers = true assert_true(@view.show_line_numbers?) end def test_indent_width indent = 4 @view.indent_width = indent assert_equal(indent, @view.indent_width) end def test_insert_spaces_instead_of_tabs insert_spaces = true @view.insert_spaces_instead_of_tabs = insert_spaces assert_true(@view.insert_spaces_instead_of_tabs?) end def test_right_margin_position margin = 100 @view.right_margin_position = margin assert_equal(margin, @view.right_margin_position) end def test_show_right_margin show = true @view.show_right_margin = show assert_true(@view.show_right_margin?) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/extconf.rb�����������������������������������������������������0000644�0001750�0001750�00000002235�12516434313�017575� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "gtksourceview3" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/Rakefile�������������������������������������������������������0000644�0001750�0001750�00000003510�12516434313�017244� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2012-2013 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GtkSourceView3 is a Ruby binding of gtksourceview-3.x." package.description = "Ruby/GtkSourceView3 is a Ruby binding of gtksourceview-3.x." package.dependency.gem.runtime = ["gtk3"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", "gdk3", "gobject-introspection", ] package.windows.gobject_introspection_dependencies = [ "atk", "pango", "gdk_pixbuf2", "gdk3", ] package.external_packages = [ { :name => "gtksourceview", :download_site => :gnome, :label => "GtkSourceView", :version => "3.14.2", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :built_file => "bin/libgtksourceview-3.0-1.dll", }, } ] end package_task.define ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/README.md������������������������������������������������������0000644�0001750�0001750�00000001042�12257552170�017060� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/GtkSourceView3 Ruby/GtkSourceView3 is a Ruby binding of gtksourceview-3.x. ## Requirements * Ruby/GTK3 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [GtkSourceView](http://projects.gnome.org/gtksourceview/) 3.4.2 or later ## Install gem install gtksourceview3 ## License Copyright (c) 2008-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�016400� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/��������������������������������������������0000755�0001750�0001750�00000000000�12516434313�021364� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/gtksourceview3.def��������������������������0000644�0001750�0001750�00000000035�12516434313�025026� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������EXPORTS Init_gtksourceview3 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcebuffer.c�������������������������0000644�0001750�0001750�00000024512�12516434313�025260� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" /* Class: Gtk::SourceBuffer * Text buffer object for Gtk::SourceView. */ #define RG_TARGET_NAMESPACE cBuffer #define _SELF(self) (RVAL2GTKSOURCEBUFFER(self)) #define RVAL2ITER(self, position) rval2iter(self, position) #define RVAL2STARTITER(self, iter, out) \ rval2iter_with_default(&(self), &(iter), &(out), gtk_text_buffer_get_start_iter) #define RVAL2ENDITER(self, iter, out) \ rval2iter_with_default(&(self), &(iter), &(out), gtk_text_buffer_get_end_iter) static GtkTextIter * rval2iter(VALUE self, VALUE position) { if (!g_type_is_a(RVAL2GTYPE(position), GTK_TYPE_TEXT_ITER)) position = rb_funcall(self, rb_intern("get_iter_at"), 1, position); return RVAL2GTKTEXTITER(position); } static GtkTextIter * rval2iter_with_default(VALUE *self, VALUE *iter, GtkTextIter *out, void (*default_func)(GtkTextBuffer *, GtkTextIter *)) { if (NIL_P(*iter)) { default_func(RVAL2GTKTEXTBUFFER(*self), out); return out; } else { return RVAL2ITER(*self, *iter); } } /* * Class method: new(obj=nil) * obj: either a Gtk::TextTagTable, a Gtk::SourceLanguage, or nil. * * Creates a new source buffer. If a Gtk::SourceTagTable is provided, the * buffer will use it, otherwise it will create a new one. * * If a Gtk::SourceLanguage object is given, the buffer will be created * using highlightings patterns in this language. This is equivalent to * creating a new source buffer with the default tag table and then setting * the 'language' property. * * Returns: a newly created Gtk::SourceBuffer object. */ static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE val; rb_scan_args (argc, argv, "01", &val); if (NIL_P (val)) { G_INITIALIZE (self, gtk_source_buffer_new (NULL)); } else if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_TEXT_TAG_TABLE))) { G_INITIALIZE (self, gtk_source_buffer_new(RVAL2GTKTEXTTAGTABLE(val))); } else if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_SOURCE_TYPE_LANGUAGE))) { G_INITIALIZE (self, gtk_source_buffer_new_with_language(RVAL2GTKSOURCELANGUAGE(val))); } else { rb_raise (rb_eArgError, "invalid argument %s (expect nil, Gtk::TextTagTable or Gtk::SourceLanguage)", rb_class2name (CLASS_OF (val))); } return Qnil; } /* * Method: redo! * * Redoes the last undo operation. Use Gtk::SourceBuffer#can_redo? to check * whether a call to this function will have any effect. * * Returns: self. */ static VALUE rg_redo_bang(VALUE self) { gtk_source_buffer_redo (_SELF (self)); return self; } /* * Method: undo! * * Undoes the last user action which modified the buffer. * Use Gtk::SourceBuffer#can_undo? to check whether a call to this function * will have any effect. * * Actions are defined as groups of operations between a call to * Gtk::TextBuffer#begin_user_action and Gtk::TextBuffer#end_user_action, * or sequences of similar edits (inserts or deletes) on the same line. * * Returns: self. */ static VALUE rg_undo_bang(VALUE self) { gtk_source_buffer_undo (_SELF (self)); return self; } /* * Method: begin_not_undoable_action * Method: begin_not_undoable_action { ... } * * Marks the beginning of a not undoable action on the buffer, disabling the * undo manager. * * If a block is given, the block is called after marking the beginning * of a not undoable action on the buffer. * At the end of the block, marks the end of a not undoable action on the * buffer. When the last not undoable block is finished, the list of undo * actions is cleared and the undo manager is re-enabled. * * Returns: self */ static VALUE rg_begin_not_undoable_action(VALUE self) { gtk_source_buffer_begin_not_undoable_action (_SELF (self)); if (rb_block_given_p()) { VALUE block = rb_block_proc (); rb_funcall (block, rb_intern ("call"), 0); gtk_source_buffer_end_not_undoable_action (_SELF (self)); } return self; } /* * Method: end_not_undoable_action * * Marks the end of a not undoable action on the buffer. * When the last not undoable block is finished, the list of undo * actions is cleared and the undo manager is re-enabled. * * Returns: self */ static VALUE rg_end_not_undoable_action(VALUE self) { gtk_source_buffer_end_not_undoable_action (_SELF (self)); return self; } /* * Method: create_source_mark(name=nil, category, where) * name: the name of the mark. * type: a string defining the mark type. * where: a location to place the mark, as a Gtk::TreeIter object. * * Creates a mark in the buffer of the given type. A mark is semantically * very similar to a Gtk::TextMark, except it has a type which is used by the * Gtk::SourceView object displaying the buffer to show a pixmap on the left * margin, at the line the mark is in. Because of this, a mark is generally * associated to a line and not a character position. Marks are also * accessible through a position or range in the buffer. * * Marks are implemented using Gtk::TextMark, so all characteristics and * restrictions to marks apply to marks too. These includes life cycle issues * and "mark-set" and "mark-deleted" signal emissions. * * Like a Gtk::TextMark, a Gtk::SourceMark can be anonymous if the passed * name is nil. * * Marks always have left gravity and are moved to the beginning of the line * when the user deletes the line they were in. Also, if the user deletes a * region of text which contained lines with marks, those are deleted. * * Typical uses for a mark are bookmarks, breakpoints, current executing * instruction indication in a source file, etc.. * * Returns: a new Gtk::SourceMark object, owned by the buffer. */ static VALUE rg_create_source_mark(int argc, VALUE *argv, VALUE self) { VALUE name, category, where; if (argc == 2) rb_scan_args (argc, argv, "21", &where, &category, &name); else rb_scan_args (argc, argv, "30", &name, &category, &where); return GOBJ2RVAL (gtk_source_buffer_create_source_mark (_SELF (self), RVAL2CSTR (name), RVAL2CSTR_ACCEPT_SYMBOL (category), RVAL2ITER (self, where))); } static VALUE rg_get_source_marks_at_line(int argc, VALUE *argv, VALUE self) { VALUE line, category; rb_scan_args (argc, argv, "11", &line, &category); /* TODO: need free? */ return GOBJGSLIST2RVAL_FREE(gtk_source_buffer_get_source_marks_at_line(_SELF(self), NUM2INT(line), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)), g_slist_free, NULL); } static VALUE rg_get_source_marks_at_iter(int argc, VALUE *argv, VALUE self) { VALUE iter, category; rb_scan_args (argc, argv, "11", &iter, &category); /* TODO: need free? */ return GOBJGSLIST2RVAL_FREE(gtk_source_buffer_get_source_marks_at_iter(_SELF(self), RVAL2ITER(self, iter), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)), g_slist_free, NULL); } static VALUE rg_remove_source_marks(int argc, VALUE *argv, VALUE self) { VALUE start, end, category; GtkTextIter start_iter, end_iter; rb_scan_args (argc, argv, "03", &start, &end, &category); gtk_source_buffer_remove_source_marks (_SELF (self), RVAL2STARTITER(self, start, start_iter), RVAL2ENDITER(self, end, end_iter), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL (category)); return self; } static VALUE rg_forward_iter_to_source_mark(int argc, VALUE *argv, VALUE self) { VALUE iter, category; rb_scan_args (argc, argv, "11", &iter, &category); return CBOOL2RVAL (gtk_source_buffer_forward_iter_to_source_mark (_SELF (self), RVAL2ITER (self, iter), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL (category))); } static VALUE rg_backward_iter_to_source_mark(int argc, VALUE *argv, VALUE self) { VALUE iter, category; rb_scan_args (argc, argv, "11", &iter, &category); return CBOOL2RVAL (gtk_source_buffer_backward_iter_to_source_mark (_SELF (self), RVAL2ITER (self, iter), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL (category))); } static VALUE rg_ensure_highlight(VALUE self, VALUE start, VALUE end) { gtk_source_buffer_ensure_highlight (_SELF (self), RVAL2ITER (self, start), RVAL2ITER (self, end)); return self; } void Init_gtksource_buffer (VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_BUFFER, "Buffer", mGtkSource); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD_BANG(redo, 0); RG_DEF_METHOD_BANG(undo, 0); RG_DEF_METHOD(begin_not_undoable_action, 0); RG_DEF_METHOD(end_not_undoable_action, 0); RG_DEF_METHOD(create_source_mark, -1); RG_DEF_METHOD(get_source_marks_at_line, -1); RG_DEF_METHOD(get_source_marks_at_iter, -1); RG_DEF_METHOD(remove_source_marks, -1); RG_DEF_METHOD(forward_iter_to_source_mark, -1); RG_DEF_METHOD(backward_iter_to_source_mark, -1); RG_DEF_METHOD(ensure_highlight, 2); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourceprintcompositor.c����������������0000644�0001750�0001750�00000012662�12516434313�027265� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" /* Module: Gtk::SourcePrintCompositor */ #define RG_TARGET_NAMESPACE cPrintCompositor #define _SELF(self) (RVAL2GTKSOURCEPRINTCOMPOSITOR(self)) /* * Class method: new(buffer) * buffer: a Gtk::SourceBuffer or Gtk::SourceView object. * * Creates a new print compositor to print buffer. * * Returns: the new print compositor object. */ static VALUE rg_initialize(VALUE self, VALUE val) { if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_SOURCE_TYPE_BUFFER))) { G_INITIALIZE(self, gtk_source_print_compositor_new (RVAL2GTKSOURCEBUFFER(val))); } else if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_SOURCE_TYPE_VIEW))) { G_INITIALIZE(self, gtk_source_print_compositor_new_from_view (RVAL2GTKSOURCEVIEW(val))); } else { rb_raise (rb_eArgError, "invalid argument %s (expect Gtk::SourceBuffer or Gtk::SourceView)", rb_class2name (CLASS_OF (val))); } return Qnil; } static VALUE rg_get_top_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_top_margin(_SELF(self), RVAL2GTKUNIT (unit))); } static VALUE rg_set_top_margin(VALUE self, VALUE top, VALUE unit) { gtk_source_print_compositor_set_top_margin(_SELF(self), NUM2DBL(top), RVAL2GTKUNIT (unit)); return self; } static VALUE rg_get_bottom_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_bottom_margin(_SELF(self), RVAL2GTKUNIT (unit))); } static VALUE rg_set_bottom_margin(VALUE self, VALUE bottom, VALUE unit) { gtk_source_print_compositor_set_bottom_margin(_SELF(self), NUM2DBL(bottom), RVAL2GTKUNIT (unit)); return self; } static VALUE rg_get_left_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_left_margin(_SELF(self), RVAL2GTKUNIT (unit))); } static VALUE rg_set_left_margin(VALUE self, VALUE left, VALUE unit) { gtk_source_print_compositor_set_left_margin(_SELF(self), NUM2DBL(left), RVAL2GTKUNIT (unit)); return self; } static VALUE rg_get_right_margin(VALUE self, VALUE unit) { return DBL2NUM(gtk_source_print_compositor_get_right_margin(_SELF(self), RVAL2GTKUNIT (unit))); } static VALUE rg_set_right_margin(VALUE self, VALUE right, VALUE unit) { gtk_source_print_compositor_set_right_margin(_SELF(self), NUM2DBL(right), RVAL2GTKUNIT (unit)); return self; } static VALUE rg_set_header_format(VALUE self, VALUE separator, VALUE left, VALUE center, VALUE right) { gtk_source_print_compositor_set_header_format(_SELF(self), RVAL2CBOOL(separator), RVAL2CSTR(left), RVAL2CSTR(center), RVAL2CSTR(right)); return self; } static VALUE rg_set_footer_format(VALUE self, VALUE separator, VALUE left, VALUE center, VALUE right) { gtk_source_print_compositor_set_footer_format(_SELF(self), RVAL2CBOOL(separator), RVAL2CSTR(left), RVAL2CSTR(center), RVAL2CSTR(right)); return self; } static VALUE rg_paginate(VALUE self, VALUE context) { return CBOOL2RVAL (gtk_source_print_compositor_paginate (_SELF (self), RVAL2GTKPRINTCONTEXT(context))); } static VALUE rg_pagination_progress(VALUE self) { return DBL2NUM (gtk_source_print_compositor_get_pagination_progress (_SELF (self))); } static VALUE rg_draw_page(VALUE self, VALUE context, VALUE page_nr) { gtk_source_print_compositor_draw_page (_SELF (self), RVAL2GTKPRINTCONTEXT(context), NUM2INT (page_nr)); return self; } void Init_gtksource_printcompositor(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_PRINT_COMPOSITOR, "PrintCompositor", mGtkSource); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(get_top_margin, 1); RG_DEF_METHOD(set_top_margin, 2); RG_DEF_METHOD(get_bottom_margin, 1); RG_DEF_METHOD(set_bottom_margin, 2); RG_DEF_METHOD(get_left_margin, 1); RG_DEF_METHOD(set_left_margin, 2); RG_DEF_METHOD(get_right_margin, 1); RG_DEF_METHOD(set_right_margin, 2); RG_DEF_METHOD(set_header_format, 4); RG_DEF_METHOD(set_footer_format, 4); RG_DEF_METHOD(paginate, 1); RG_DEF_METHOD(pagination_progress, 0); RG_DEF_METHOD(draw_page, 2); } ������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcestyle.c��������������������������0000644�0001750�0001750�00000002464�12516434313�025151� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" /* Module: Gtk::SourceStyle */ #define RG_TARGET_NAMESPACE cStyle #define _SELF(self) (RVAL2GTKSOURCESTYLE(self)) static VALUE rg_copy(VALUE self) { return GOBJ2RVAL (gtk_source_style_copy (_SELF (self))); } void Init_gtksource_style (VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_STYLE, "Style", mGtkSource); RG_DEF_METHOD(copy, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/extconf.rb����������������������������������0000644�0001750�0001750�00000003617�12516434313�023366� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin extconf.rb for Ruby/GtkSourceView3 extension library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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+)\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 = "gtksourceview3" package_id = "gtksourceview-3.0" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ["glib2", "atk", "pango", "gdk_pixbuf2", "gtk3"].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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libgtksourceview-3.0-dev", :fedora => "gtksourceview3-devel", :homebrew => "gtksourceview3", :macports => "gtksourceview3") exit(false) end make_version_header("GTKSOURCEVIEW3", package_id, ".") create_pkg_config_file("Ruby/GtkSourceView3", package_id) $defs << "-DRUBY_GTKSOURCEVIEW3_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 �����������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/depend��������������������������������������0000644�0001750�0001750�00000000260�12516434313�022544� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gtksourceview3.pc $(pkgconfigdir); \ fi ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcestylescheme.c��������������������0000644�0001750�0001750�00000004075�12516434313�026336� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" /* Module: Gtk::SourceStyleScheme */ #define RG_TARGET_NAMESPACE cStyleScheme #define _SELF(self) (RVAL2GTKSOURCESTYLESCHEME(self)) /* Method: authors * * Returns: a list of authors for the given style scheme. */ static VALUE rg_authors(VALUE self) { VALUE ary; const gchar * const * authors = gtk_source_style_scheme_get_authors (_SELF (self)); if (!authors) return Qnil; ary = rb_ary_new(); while (*authors){ rb_ary_push(ary, CSTR2RVAL(*authors)); authors++; } return ary; } /* Method: get_style(style_id) * style_name: the name of a style. * * Gets the tag associated with the given style_name in the style scheme. * * Returns: Gtk::SourceStyle */ static VALUE rg_get_style(VALUE self, VALUE style_name) { return GOBJ2RVAL(gtk_source_style_scheme_get_style(_SELF(self), RVAL2CSTR(style_name))); } void Init_gtksource_stylescheme (VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_STYLE_SCHEME, "StyleScheme", mGtkSource); RG_DEF_METHOD(authors, 0); RG_DEF_METHOD(get_style, 1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourceview.c���������������������������0000644�0001750�0001750�00000005756�12516434313�024772� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" /* Class: Gtk::SourceView * A view on a source. */ #define RG_TARGET_NAMESPACE cView #define _SELF(self) (RVAL2GTKSOURCEVIEW(self)) /* * Class method: new(buffer=nil) * buffer: a Gtk::SourceBuffer object. * * Creates a new Gtk::SourceView. If buffer is not provided or nil, an empty * buffer will be created for you. Note that one buffer can be shared among * many widgets. * * Returns: a newly created Gtk::SourceView object. */ static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE buffer; GtkWidget *widget; rb_scan_args(argc, argv, "01", &buffer); if (NIL_P(buffer)) widget = gtk_source_view_new(); else widget = gtk_source_view_new_with_buffer(RVAL2GTKSOURCEBUFFER(buffer)); RBGTK_INITIALIZE(self, widget); return self; } static VALUE rg_get_gutter(VALUE self, VALUE window_type) { VALUE gutter; gutter = GOBJ2RVAL(gtk_source_view_get_gutter(_SELF(self), RVAL2GTKTEXTWINDOWTYPE(window_type))); G_CHILD_ADD(self, gutter); return gutter; } static VALUE rg_set_mark_attributes(VALUE self, VALUE category, VALUE attributes, VALUE priority) { gtk_source_view_set_mark_attributes(_SELF(self), RVAL2CSTR_ACCEPT_SYMBOL(category), RVAL2GTKSOURCEMARKATTRIBUTES(attributes), NUM2INT(priority)); return self; } void Init_gtksource_view (VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_VIEW, "View", mGtkSource); G_DEF_CLASS(GTK_SOURCE_TYPE_VIEW_GUTTER_POSITION, "GutterPosition", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(get_gutter, 1); RG_DEF_METHOD(set_mark_attributes, 3); G_DEF_CLASS(GTK_SOURCE_TYPE_SMART_HOME_END_TYPE, "SmartHomeEndType", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_SOURCE_TYPE_DRAW_SPACES_FLAGS, "DrawSpacesFlags", RG_TARGET_NAMESPACE); } ������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcestyleschememanager.c�������������0000644�0001750�0001750�00000007733�12516434313�027675� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" /* Class: Gtk::SourceStyleSchemeManager * A class to manage source style scheme. */ #define RG_TARGET_NAMESPACE cStyleSchemeManager #define _SELF(self) (RVAL2GTKSOURCESTYLESCHEMEMANAGER(self)) static VALUE rb_mGtkSource; /* Class method: new * Returns: a newly created Gtk::SourceStyleSchemeManager object. */ static VALUE rg_initialize(VALUE self) { G_INITIALIZE (self, gtk_source_style_scheme_manager_new ()); return Qnil; } /* Class method: default * * Gets the default style scheme manager. * * Returns: a Gtk::SourceStyleSchemeManager */ static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { GtkSourceStyleSchemeManager* sssm = gtk_source_style_scheme_manager_get_default(); GType gtype = G_TYPE_FROM_INSTANCE(sssm); gchar *gtypename = (gchar *) g_type_name (gtype); if (strncmp (gtypename, "GtkSource", 9) == 0) gtypename += 9; if (!rb_const_defined_at (rb_mGtkSource, rb_intern (gtypename))) G_DEF_CLASS (gtype, gtypename, rb_mGtkSource); return GOBJ2RVAL(sssm); } /* Method: append_search_path(path) * path: additional style scheme file directory path (string) * * Appends the style scheme files directory for the given style scheme manager. * * Returns: self. */ static VALUE rg_append_search_path(VALUE self, VALUE path) { gtk_source_style_scheme_manager_append_search_path (_SELF (self), RVAL2CSTR(path)); return self; } /* Method: prepend_search_path(path) * path: additional style scheme file directory path (string) * * Prepend the style scheme files directory for the given style scheme manager. * * Returns: self. */ static VALUE rg_prepend_search_path(VALUE self, VALUE path) { gtk_source_style_scheme_manager_prepend_search_path (_SELF (self), RVAL2CSTR(path)); return self; } /* * Method: scheme(scheme_id) * scheme_id: a style scheme id (as a string). * * Gets the Gtk::SourceStyleScheme which is associated with the given id * in the style scheme manager. * * Returns: a Gtk::SourceStyleScheme, or nil if there is no style scheme * associated with the given id. */ static VALUE rg_get_scheme(VALUE self, VALUE scheme_id) { return GOBJ2RVAL (gtk_source_style_scheme_manager_get_scheme (_SELF (self), RVAL2CSTR (scheme_id))); } /* * Method: force_rescan * * Forces all style schemes to be reloaded the next time the * Gtk::SourceStyleSchemeManager is accessed. * * Returns: self. */ static VALUE rg_force_rescan(VALUE self) { gtk_source_style_scheme_manager_force_rescan(_SELF (self)); return self; } void Init_gtksource_styleschememanager (VALUE mGtkSource) { rb_mGtkSource = mGtkSource; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_STYLE_SCHEME_MANAGER, "StyleSchemeManager", mGtkSource); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_search_path, 1); RG_DEF_METHOD(prepend_search_path, 1); RG_DEF_METHOD(get_scheme, 1); RG_DEF_METHOD(force_rescan, 0); RG_DEF_SMETHOD(default, 0); } �������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderer.c�����������������0000644�0001750�0001750�00000010144�12516434313�027044� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE cGutterRenderer #define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERER(self)) static VALUE rg_end(VALUE self) { gtk_source_gutter_renderer_end(_SELF(self)); return self; } static VALUE rg_begin(VALUE self, VALUE cr, VALUE background_area, VALUE cell_area, VALUE start, VALUE end) { gtk_source_gutter_renderer_begin(_SELF(self), RVAL2CRCONTEXT(cr), RVAL2GDKRECTANGLE(background_area), RVAL2GDKRECTANGLE(cell_area), RVAL2GTKTEXTITER(start), RVAL2GTKTEXTITER(end)); if (rb_block_given_p()) rb_ensure(rb_yield, self, rg_end, self); return self; } static VALUE rg_draw(VALUE self, VALUE cr, VALUE background_area, VALUE cell_area, VALUE start, VALUE end, VALUE state) { gtk_source_gutter_renderer_draw(_SELF(self), RVAL2CRCONTEXT(cr), RVAL2GDKRECTANGLE(background_area), RVAL2GDKRECTANGLE(cell_area), RVAL2GTKTEXTITER(start), RVAL2GTKTEXTITER(end), RVAL2GTKSOURCEGUTTERRENDERERSTATE(state)); return self; } static VALUE rg_alignment(VALUE self) { gfloat xalign, yalign; gtk_source_gutter_renderer_get_alignment(_SELF(self), &xalign, &yalign); return rb_ary_new3(2, xalign, yalign); } static VALUE rg_background(VALUE self) { GdkRGBA color; gboolean result; result = gtk_source_gutter_renderer_get_background(_SELF(self), &color); return result ? GDKRGBA2RVAL(&color) : Qnil; } static VALUE rg_padding(VALUE self) { gint xpad, ypad; gtk_source_gutter_renderer_get_padding(_SELF(self), &xpad, &ypad); return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad)); } static VALUE rg_queue_draw(VALUE self) { gtk_source_gutter_renderer_queue_draw(_SELF(self)); return self; } static VALUE rg_set_alignment(VALUE self, VALUE xalign, VALUE yalign) { gtk_source_gutter_renderer_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_set_background(VALUE self, VALUE color) { gtk_source_gutter_renderer_set_background(_SELF(self), RVAL2GDKRGBA(color)); return self; } static VALUE rg_set_padding(VALUE self, VALUE xpad, VALUE ypad) { gtk_source_gutter_renderer_set_padding(_SELF(self), NUM2INT(xpad), NUM2INT(ypad)); return self; } void Init_gtksource_gutterrenderer(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER, "GutterRenderer", mGtkSource); G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_ALIGNMENT_MODE, "AlignmentMode", RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE, "State", RG_TARGET_NAMESPACE); RG_DEF_METHOD(alignment, 0); RG_DEF_METHOD(background, 0); RG_DEF_METHOD(begin, 5); RG_DEF_METHOD(draw, 6); RG_DEF_METHOD(end, 0); RG_DEF_METHOD(padding, 0); RG_DEF_METHOD(queue_draw, 0); RG_DEF_METHOD(set_alignment, 2); RG_DEF_METHOD(set_background, 1); RG_DEF_METHOD(set_padding, 2); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrenderertext.c�������������0000644�0001750�0001750�00000002525�12516434313�027755� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE cGutterRendererText #define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERTEXT(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_source_gutter_renderer_text_new()); return Qnil; } void Init_gtksource_gutterrenderertext(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT, "GutterRendererText", mGtkSource); RG_DEF_METHOD(initialize, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcelanguagemanager.c����������������0000644�0001750�0001750�00000006704�12516434313�027130� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" /* Class: Gtk::SourceLanguageManager * A class to manage source language. */ #define RG_TARGET_NAMESPACE cLanguageManager #define _SELF(self) (RVAL2GTKSOURCELANGUAGEMANAGER(self)) static VALUE rb_mGtkSource; /* Class method: new * Returns: a newly created Gtk::SourceLanguageManager object. */ static VALUE rg_initialize(VALUE self) { G_INITIALIZE (self, gtk_source_language_manager_new ()); return Qnil; } /* Class method: default * * Gets the default language manager. * * Returns: a Gtk::SourceLanguageManager */ static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { GtkSourceLanguageManager* slm = gtk_source_language_manager_get_default(); GType gtype = G_TYPE_FROM_INSTANCE(slm); gchar *gtypename = (gchar *) g_type_name (gtype); if (strncmp (gtypename, "GtkSource", 9) == 0) gtypename += 9; if (!rb_const_defined_at (rb_mGtkSource, rb_intern (gtypename))) G_DEF_CLASS (gtype, gtypename, rb_mGtkSource); return GOBJ2RVAL(slm); } /* * Method: get_language(id) * id: a language id (as a string). * * Gets the Gtk::SourceLanguage which is associated with the given id * in the language manager. * * Returns: a Gtk::SourceLanguage, or nil if there is no language associated * with the given id. */ static VALUE rg_get_language(VALUE self, VALUE id) { return GOBJ2RVAL (gtk_source_language_manager_get_language (_SELF (self), RVAL2CSTR (id))); } /* * Method: guess_language(filename, content_type) * filename: a file name (as a string), or nil. * content_type: content type (as a string), or nil. * * Guesses the Gtk::SourceLanguage for the given file name and content type. * * Returns: a Gtk::SourceLanguage, or nil if there is no language associated * with the given filename or content_type. */ static VALUE rg_guess_language(VALUE self, VALUE filename, VALUE content_type) { return GOBJ2RVAL (gtk_source_language_manager_guess_language (_SELF (self), RVAL2CSTR_ACCEPT_NIL (filename), RVAL2CSTR_ACCEPT_NIL (content_type))); } void Init_gtksource_languagemanager (VALUE mGtkSource) { rb_mGtkSource = mGtkSource; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_LANGUAGE_MANAGER, "LanguageManager", mGtkSource); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_language, 1); RG_DEF_METHOD(guess_language, 2); RG_DEF_SMETHOD(default, 0); } ������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcelanguage.c�����������������������0000644�0001750�0001750�00000006272�12516434313�025575� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" /* Class: Gtk::SourceLanguage * Source language. */ #define RG_TARGET_NAMESPACE cLanguage #define _SELF(self) (RVAL2GTKSOURCELANGUAGE(self)) /* Method: get_metadata(name) * name: the metadata property name (string) * Returns: the localized metadata for the given name. */ static VALUE rg_get_metadata(VALUE self, VALUE name) { return CSTR2RVAL (gtk_source_language_get_metadata (_SELF (self), RVAL2CSTR(name))); } /* Method: mime_types * Returns: a list of mime types for the given language, as an array of strings. */ static VALUE rg_mime_types(VALUE self) { VALUE ary; char **types = gtk_source_language_get_mime_types (_SELF (self)); if (!types) return Qnil; ary = rb_ary_new(); while (*types){ rb_ary_push(ary, CSTR2RVAL(*types)); types++; } return ary; } /* Method: globs * Returns: a list of globs for the given language, as an array of strings. */ static VALUE rg_globs(VALUE self) { VALUE ary; char **globs = gtk_source_language_get_globs (_SELF (self)); if (!globs) return Qnil; ary = rb_ary_new(); while (*globs){ rb_ary_push(ary, CSTR2RVAL(*globs)); globs++; } return ary; } /* Method: get_style_name(style_id) * style_id: the style id (string) * Returns: the localized style name of the given id. */ static VALUE rg_get_style_name(VALUE self, VALUE style_id) { return CSTR2RVAL (gtk_source_language_get_style_name (_SELF (self), RVAL2CSTR(style_id))); } /* Method: style_id * Returns: the styles defined by the language. */ static VALUE rg_style_ids(VALUE self) { VALUE ary; gchar **ids = gtk_source_language_get_style_ids (_SELF (self)); if (!ids) return Qnil; ary = rb_ary_new(); while (*ids){ rb_ary_push(ary, CSTR2RVAL(*ids)); ids++; } return ary; } void Init_gtksource_language (VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_LANGUAGE, "Language", mGtkSource); RG_DEF_METHOD(get_metadata, 1); RG_DEF_METHOD(mime_types, 0); RG_DEF_METHOD(globs, 0); RG_DEF_METHOD(get_style_name, 1); RG_DEF_METHOD(style_ids, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourceundomanager.c��������������������0000644�0001750�0001750�00000004236�12516434313�026310� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE mUndoManager #define _SELF(self) (RVAL2GTKSOURCEUNDOMANAGER(self)) static VALUE rg_end_not_undoable_action(VALUE self) { gtk_source_undo_manager_end_not_undoable_action(_SELF(self)); return self; } static VALUE rg_begin_not_undoable_action(VALUE self) { gtk_source_undo_manager_begin_not_undoable_action(_SELF(self)); if (rb_block_given_p()) rb_ensure(rb_yield, self, rg_end_not_undoable_action, self); return self; } static VALUE rg_can_redo_p(VALUE self) { return CBOOL2RVAL(gtk_source_undo_manager_can_redo(_SELF(self))); } static VALUE rg_can_undo_p(VALUE self) { return CBOOL2RVAL(gtk_source_undo_manager_can_undo(_SELF(self))); } static VALUE rg_redo(VALUE self) { gtk_source_undo_manager_redo(_SELF(self)); return self; } static VALUE rg_undo(VALUE self) { gtk_source_undo_manager_undo(_SELF(self)); return self; } void Init_gtksource_undomanager(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_SOURCE_TYPE_UNDO_MANAGER, "UndoManager", mGtkSource); RG_DEF_METHOD(begin_not_undoable_action, 0); RG_DEF_METHOD_P(can_redo, 0); RG_DEF_METHOD_P(can_undo, 0); RG_DEF_METHOD(end_not_undoable_action, 0); RG_DEF_METHOD(redo, 0); RG_DEF_METHOD(undo, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksource.c�������������������������������0000644�0001750�0001750�00000004372�12516434313�024070� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE mGtkSource void Init_gtksourceview3 (void) { VALUE RG_TARGET_NAMESPACE = rb_define_module("GtkSource"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(GTKSOURCEVIEW3_MAJOR_VERSION), INT2FIX(GTKSOURCEVIEW3_MINOR_VERSION), INT2FIX(GTKSOURCEVIEW3_MICRO_VERSION))); Init_gtksource_view (RG_TARGET_NAMESPACE); Init_gtksource_buffer (RG_TARGET_NAMESPACE); Init_gtksource_language (RG_TARGET_NAMESPACE); Init_gtksource_languagemanager (RG_TARGET_NAMESPACE); Init_gtksource_mark (RG_TARGET_NAMESPACE); Init_gtksource_printcompositor (RG_TARGET_NAMESPACE); Init_gtksource_style (RG_TARGET_NAMESPACE); Init_gtksource_stylescheme (RG_TARGET_NAMESPACE); Init_gtksource_styleschememanager (RG_TARGET_NAMESPACE); Init_gtksource_gutter(RG_TARGET_NAMESPACE); Init_gtksource_gutterrenderer(RG_TARGET_NAMESPACE); Init_gtksource_gutterrendererpixbuf(RG_TARGET_NAMESPACE); Init_gtksource_gutterrenderertext(RG_TARGET_NAMESPACE); Init_gtksource_markattributes(RG_TARGET_NAMESPACE); Init_gtksource_undomanager(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourceview3private.h�������������������0000644�0001750�0001750�00000004506�12516434313�026445� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004,2005 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 */ #ifndef __RBGTKSOURCEVIEW3PRIVATE_H__ #define __RBGTKSOURCEVIEW3PRIVATE_H__ #include <gtksourceview/gtksource.h> #include <gtksourceview/gtksourceview-typebuiltins.h> #include <ruby.h> #include <rb_cairo.h> #include <rbgtk3.h> #include "rbgtksourceview3conversions.h" #include "rbgtksourceview3version.h" extern void Init_gtksourceview3(void); G_GNUC_INTERNAL void Init_gtksource_view (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_buffer (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_language (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_languagemanager (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_mark (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_printcompositor (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_style (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_stylescheme (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_styleschememanager (VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_gutter(VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_gutterrenderer(VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_gutterrendererpixbuf(VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_gutterrenderertext(VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_markattributes(VALUE mGtkSource); G_GNUC_INTERNAL void Init_gtksource_undomanager(VALUE mGtkSource); #endif /* __RBGTKSOURCEVIEW3PRIVATE_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcemark.c���������������������������0000644�0001750�0001750�00000004733�12516434313�024744� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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 "rbgtksourceview3private.h" /* Class: Gtk::SourceMark * A source mark. */ #define RG_TARGET_NAMESPACE cMark #define _SELF(self) (RVAL2GTKSOURCEMARK(self)) /* Class method: new(name, category) * name: mark name (string) * category: marker category (string) * * Returns: a newly created Gtk::SourceMark object. */ static VALUE rg_initialize(VALUE self, VALUE name, VALUE category) { G_INITIALIZE (self, gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR_ACCEPT_SYMBOL(category))); return Qnil; } /* Method: next(category=nil) * category: the category (string), or nil. * * Returns: the next Gtk::SourceMark after the mark. */ static VALUE rg_next(int argc, VALUE *argv, VALUE self) { VALUE category; rb_scan_args (argc, argv, "01", &category); return GOBJ2RVAL (gtk_source_mark_next (_SELF (self), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category))); } /* Method: prev(category=nil) * category: the category (string), or nil. * * Returns: the previous Gtk::SourceMark before the mark. */ static VALUE rg_prev(int argc, VALUE *argv, VALUE self) { VALUE category; rb_scan_args (argc, argv, "01", &category); return GOBJ2RVAL (gtk_source_mark_prev (_SELF (self), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category))); } void Init_gtksource_mark (VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_MARK, "Mark", mGtkSource); RG_DEF_METHOD(initialize, 2); RG_DEF_METHOD(next, -1); RG_DEF_METHOD(prev, -1); } �������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcemarkattributes.c�����������������0000644�0001750�0001750�00000004416�12516434313�027051� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE cMarkAttributes #define _SELF(self) (RVAL2GTKSOURCEMARKATTRIBUTES(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_source_mark_attributes_new()); return Qnil; } static VALUE rg_get_tooltip_markup(VALUE self, VALUE mark) { gchar *markup; markup = gtk_source_mark_attributes_get_tooltip_markup(_SELF(self), RVAL2GTKSOURCEMARK(mark)); return CSTR2RVAL_FREE(markup); } static VALUE rg_get_tooltip_text(VALUE self, VALUE mark) { gchar *text; text = gtk_source_mark_attributes_get_tooltip_text(_SELF(self), RVAL2GTKSOURCEMARK(mark)); return CSTR2RVAL_FREE(text); } static VALUE rg_render_icon(VALUE self, VALUE widget, VALUE size) { GdkPixbuf *icon; icon = gtk_source_mark_attributes_render_icon(_SELF(self), RVAL2GTKWIDGET(widget), NUM2INT(size)); return GOBJ2RVAL(icon); } void Init_gtksource_markattributes(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_MARK_ATTRIBUTES, "MarkAttributes", mGtkSource); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_tooltip_markup, 1); RG_DEF_METHOD(get_tooltip_text, 1); RG_DEF_METHOD(render_icon, 2); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourceview3conversions.h���������������0000644�0001750�0001750�00000005561�12516434313�027345� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ #ifndef __RBGTKSOURCEVIEW3CONVERSIONS_H__ #define __RBGTKSOURCEVIEW3CONVERSIONS_H__ #define RVAL2GTKSOURCEBUFFER(o) (GTK_SOURCE_BUFFER(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEGUTTER(o) (GTK_SOURCE_GUTTER(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEGUTTERRENDERER(o) (GTK_SOURCE_GUTTER_RENDERER(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEGUTTERRENDERERPIXBUF(o) (GTK_SOURCE_GUTTER_RENDERER_PIXBUF(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEGUTTERRENDERERTEXT(o) (GTK_SOURCE_GUTTER_RENDERER_TEXT(RVAL2GOBJ(o))) #define RVAL2GTKSOURCELANGUAGE(o) (GTK_SOURCE_LANGUAGE(RVAL2GOBJ(o))) #define RVAL2GTKSOURCELANGUAGEMANAGER(o) (GTK_SOURCE_LANGUAGE_MANAGER(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEMARK(o) (GTK_SOURCE_MARK(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEMARKATTRIBUTES(o) (GTK_SOURCE_MARK_ATTRIBUTES(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEPRINTCOMPOSITOR(o) (GTK_SOURCE_PRINT_COMPOSITOR(RVAL2GOBJ(o))) #define RVAL2GTKSOURCESTYLE(o) (GTK_SOURCE_STYLE(RVAL2GOBJ(o))) #define RVAL2GTKSOURCESTYLESCHEME(o) (GTK_SOURCE_STYLE_SCHEME(RVAL2GOBJ(o))) #define RVAL2GTKSOURCESTYLESCHEMEMANAGER(o) (GTK_SOURCE_STYLE_SCHEME_MANAGER(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEUNDOMANAGER(o) (GTK_SOURCE_UNDO_MANAGER(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEVIEW(o) (GTK_SOURCE_VIEW(RVAL2GOBJ(o))) #define RVAL2GTKSOURCEGUTTERRENDERERSTATE(o) (RVAL2GFLAGS(o, GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE)) #define GTKSOURCEGUTTERRENDERERSTATE2RVAL(o) (GFLAGS2RVAL(o, GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE)) /* For GDK3. They are temporary. They will be needless after Ruby/SourceView3 * is based on Ruby/GObjectIntrospection. */ #define RVAL2GDKRECTANGLE(o) ((GdkRectangle*)RVAL2BOXED(o, GDK_TYPE_RECTANGLE)) #define RVAL2GDKRGBA(o) ((GdkRGBA*)RVAL2BOXED(o, GDK_TYPE_RGBA)) #define GDKRGBA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RGBA)) #endif /* __RBGTKSOURCEVIEW3CONVERSIONS_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcegutterrendererpixbuf.c�����������0000644�0001750�0001750�00000002603�12516434313�030263� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE cGutterRendererPixbuf #define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERPIXBUF(self)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_source_gutter_renderer_pixbuf_new()); return Qnil; } void Init_gtksource_gutterrendererpixbuf(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF, "GutterRendererPixbuf", mGtkSource); RG_DEF_METHOD(initialize, 0); RG_REG_GLIBID_SETTER("stock-id"); } �����������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/ext/gtksourceview3/rbgtksourcegutter.c�������������������������0000644�0001750�0001750�00000004375�12516434313�025326� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgtksourceview3private.h" #define RG_TARGET_NAMESPACE cGutter #define _SELF(self) (RVAL2GTKSOURCEGUTTER(self)) static VALUE rg_window(VALUE self) { return GOBJ2RVAL(gtk_source_gutter_get_window(_SELF(self))); } static VALUE rg_insert(VALUE self, VALUE renderer, VALUE position) { gboolean result; result = gtk_source_gutter_insert(_SELF(self), RVAL2GTKSOURCEGUTTERRENDERER(renderer), NUM2INT(position)); G_CHILD_ADD(self, renderer); return CBOOL2RVAL(result); } static VALUE rg_queue_draw(VALUE self) { gtk_source_gutter_queue_draw(_SELF(self)); return self; } static VALUE rg_remove(VALUE self, VALUE renderer) { gtk_source_gutter_remove(_SELF(self), RVAL2GTKSOURCEGUTTERRENDERER(renderer)); G_CHILD_REMOVE(self, renderer); return self; } static VALUE rg_reorder(VALUE self, VALUE renderer, VALUE position) { gtk_source_gutter_reorder(_SELF(self), RVAL2GTKSOURCEGUTTERRENDERER(renderer), NUM2INT(position)); return self; } void Init_gtksource_gutter(VALUE mGtkSource) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER, "Gutter", mGtkSource); RG_DEF_METHOD(window, 0); RG_DEF_METHOD(insert, 2); RG_DEF_METHOD(queue_draw, 0); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(reorder, 2); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/COPYING.LIB����������������������������������������������������0000644�0001750�0001750�00000063642�12257552170�017257� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/lib/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�016346� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/lib/gtksourceview3.rb������������������������������������������0000644�0001750�0001750�00000000777�12516434313�021672� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin Copyright (c) 2008-2011 Ruby-GNOME2 Project Team This program is licensed under the same licence as Ruby-GNOME2. =end require 'gtk3' base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gtksourceview3.so" rescue LoadError require "gtksourceview3.so" end require 'gtksourceview3/deprecated' �ruby-gnome2-all-2.2.5/gtksourceview3/lib/gtksourceview3/��������������������������������������������0000755�0001750�0001750�00000000000�12516434313�021332� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/lib/gtksourceview3/deprecated.rb�������������������������������0000644�0001750�0001750�00000004641�12002536277�023766� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������module Gtk extend GLib::Deprecatable define_deprecated_const :SourceBuffer, 'GtkSource::Buffer' define_deprecated_const :SourceLanguage, 'GtkSource::Language' define_deprecated_const :SourceLanguageManager, 'GtkSource::LanguageManager' define_deprecated_const :SourceMark, 'GtkSource::Mark' define_deprecated_const :SourcePrintCompositor, 'GtkSource::PrintCompositor' define_deprecated_const :SourceStyle, 'GtkSource::Style' define_deprecated_const :SourceStyleScheme, 'GtkSource::StyleScheme' define_deprecated_const :SourceStyleSchemeManager, 'GtkSource::StyleSchemeManager' define_deprecated_const :SourceView, 'GtkSource::View' end module GtkSource class Buffer extend GLib::Deprecatable define_deprecated_method :not_undoable_action, :begin_not_undoable_action define_deprecated_method :non_undoable_action, :begin_not_undoable_action end class View extend GLib::Deprecatable define_deprecated_flags :DrawSpacesFlags, 'DRAW_SPACES' define_deprecated_enums :SmartHomeEndType, 'SMART_HOME_END' define_deprecated_const :BUILD_VERSION, 'GtkSource::BUILD_VERSION' define_deprecated_method :set_mark_category_background, :warn => "Use 'GtkSource::MarkAttributes#set_background'." do |_self, category, background| _self.get_mark_attributes(category).first.set_background(background) # TODO end define_deprecated_method :get_mark_category_background, :warn => "Use 'GtkSource::MarkAttributes#background'." do |_self, category| _self.get_mark_attributes(category).first.background # TODO end define_deprecated_method :set_mark_category_pixbuf, :warn => "Use 'GtkSource::MarkAttributes#set_pixbuf'." do |_self, category, pixbuf| _self.get_mark_attributes(category).first.set_pixbuf(pixbuf) # TODO end define_deprecated_method :get_mark_category_pixbuf, :warn => "Use 'GtkSource::MarkAttributes#pixbuf'." do |_self, category| _self.get_mark_attributes(category).first.pixbuf # TODO end define_deprecated_method :set_mark_category_priority, :warn => "Use '#{self}#set_mark_attributes'." do |_self, category, priority| attributes = _self.get_mark_attributes(category).first # TODO _self.set_mark_attributes(category, attributes, priority) end define_deprecated_method :get_mark_category_priority, :warn => "Use '#{self}#get_mark_attributes'." do |_self, category| _self.get_mark_attributes(category).last # TODO end end end �����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/sample/��������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�017061� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/sample/sourcelanguagemanager.rb��������������������������������0000755�0001750�0001750�00000000717�12516434313�023755� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin sourcelanguagesmanager.rb - Ruby/GtkSourceView3 sample script. Copyright (c) 2006-2014 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: sourcelanguagesmanager.rb,v 1.3 2007/06/03 02:11:07 mutoh Exp $ =end require "gtksourceview3" s = GtkSource::LanguageManager.new s.language_ids.each do |v| puts v end s.search_path.each do |v| puts v end puts s.get_language("html").name �������������������������������������������������ruby-gnome2-all-2.2.5/gtksourceview3/sample/test.rb�������������������������������������������������0000755�0001750�0001750�00000001464�12516434313�020375� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin test.rb - Ruby/GtkSourceView3 sample script. Copyright (c) 2006-2014 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: test.rb,v 1.4 2007/06/03 02:11:07 mutoh Exp $ =end require "gtksourceview3" window = Gtk::Window.new window.signal_connect("delete-event") {Gtk.main_quit} view = GtkSource::View.new window.add(Gtk::ScrolledWindow.new.add(view)) view.show_line_numbers = true view.insert_spaces_instead_of_tabs = true view.indent_width = 4 view.show_right_margin = true view.right_margin_position = 80 lang = GtkSource::LanguageManager.new.get_language("ruby") view.buffer.language = lang view.buffer.highlight_syntax = true view.buffer.highlight_matching_brackets = true window.set_default_size(450, 300) window.show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�013611� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/�������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�014572� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_spawn.rb������������������������������������������������������0000644�0001750�0001750�00000001445�11701304107�017302� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- require 'rbconfig' class TestGLibSpawn < Test::Unit::TestCase include GLibTestUtils def setup end def teardown end def test_async_keep_environment if File.exist?('/bin/true') assert_nothing_raised do GLib::Spawn.async(Dir.pwd, ['/bin/true'], nil, 0) end end end def test_async_clear_environment if RbConfig.respond_to?(:ruby) ruby = RbConfig.ruby else ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'] + RbConfig::CONFIG['EXEEXT']) end pid = GLib::Spawn.async(Dir.pwd, [ruby, '-e', 'exit 1 unless ENV.empty?'], [], GLib::Spawn::DO_NOT_REAP_CHILD) _, status = *Process.waitpid2(pid) assert status.success? end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_glib2.rb������������������������������������������������������0000755�0001750�0001750�00000007637�12121311640�017162� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# coding: binary require 'test/unit' require 'glib2' class TestGLib < Test::Unit::TestCase def test_version assert_kind_of(Array, GLib::VERSION) assert_equal(GLib::VERSION.length, 3) assert(GLib::VERSION.all?{|i| i.is_a? Integer }) assert_kind_of(Integer, GLib::MAJOR_VERSION) assert_kind_of(Integer, GLib::MINOR_VERSION) assert_kind_of(Integer, GLib::MICRO_VERSION) assert_kind_of(Array, GLib::BINDING_VERSION) assert_equal(GLib::BINDING_VERSION.length, 3) assert(GLib::BINDING_VERSION.all?{|i| i.is_a? Integer }) end def test_priority assert_kind_of(Integer, GLib::PRIORITY_HIGH) assert_kind_of(Integer, GLib::PRIORITY_DEFAULT) assert_kind_of(Integer, GLib::PRIORITY_HIGH_IDLE) assert_kind_of(Integer, GLib::PRIORITY_DEFAULT_IDLE) assert_kind_of(Integer, GLib::PRIORITY_LOW) end def test_int64 end def test_convert assert_kind_of(String, GLib.charset) sjis = "\202\261\202\361\202\311\202\277\202\315\220\242\212E" euc = "\244\263\244\363\244\313\244\301\244\317\300\244\263\246" utf8 = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257\344\270\226\347\225\214" assert_equal(GLib.convert(sjis, "UTF-8", "SHIFT_JIS"), utf8) assert_equal(GLib.convert(sjis, "EUC-JP", "SHIFT_JIS"), euc) assert_equal(GLib.convert(sjis, "SHIFT_JIS", "SHIFT_JIS"), sjis) assert_equal(GLib.convert(euc, "UTF-8", "EUC-JP"), utf8) assert_equal(GLib.convert(euc, "EUC-JP", "EUC-JP"), euc) assert_equal(GLib.convert(euc, "SHIFT_JIS", "EUC-JP"), sjis) assert_equal(GLib.convert(utf8, "UTF-8", "UTF-8"), utf8) assert_equal(GLib.convert(utf8, "EUC-JP", "UTF-8"), euc) assert_equal(GLib.convert(utf8, "SHIFT_JIS", "UTF-8"), sjis) # rb_define_module_function(mGLib, "locale_to_utf8", rbglib_m_locale_to_utf8, 1); # rb_define_module_function(mGLib, "locale_from_utf8", rbglib_m_locale_from_utf8, 1); # rb_define_module_function(mGLib, "filename_to_utf8", rbglib_m_filename_to_utf8, 1); # rb_define_module_function(mGLib, "filename_from_utf8", rbglib_m_filename_from_utf8, 1); # # rb_define_module_function(mGLib, "filename_to_uri", rbglib_m_filename_to_uri, -1); # rb_define_module_function(mGLib, "filename_from_uri", rbglib_m_filename_from_uri, 1); end def test_messages #rb_define_module_function(mGLog, "set_handler", rbglib_m_log_set_handler, 2); #rb_define_module_function(mGLog, "remove_handler", rbglib_m_log_remove_handler, 2); end def test_object assert_raises(GLib::NoPropertyError) { GLib::Object.property("foo") } assert_raises(GLib::NoSignalError) { GLib::Object.signal("foo") } end def test_interface_extend assert_raises(TypeError){ Object.__send__(:include, GLib::TypePlugin) } end def test_signal_has_handler_pending obj = GLib::Object.new signal_name = "notify" assert(!obj.signal_has_handler_pending?(signal_name)) h = obj.signal_connect(signal_name){} assert(obj.signal_has_handler_pending?(signal_name)) obj.signal_handler_block(h) { assert(obj.signal_has_handler_pending?(signal_name, true)) assert(!obj.signal_has_handler_pending?(signal_name, false)) } assert(obj.signal_has_handler_pending?(signal_name, false)) obj.signal_handler_disconnect(h) assert(!obj.signal_has_handler_pending?(signal_name)) obj = nil end def test_signal_handler_disconnect_and_gc obj = GLib::Object.new klass = Class.new 1000.times { a = klass.new id = obj.signal_connect("notify") { p a } obj.signal_handler_disconnect(id) } GC.start ary = [] ObjectSpace.each_object(klass) { |a| ary.push(a) } assert_operator(ary.size, :<, 1000) end def test_gtype assert_equal(GLib::Object.gtype, GLib::Type["GObject"]) assert_equal(GLib::Interface.gtype, GLib::Type["GInterface"]) obj = GLib::Object.new assert_equal(obj.gtype, GLib::Object.gtype) end end �������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_poll_fd.rb����������������������������������������������������0000644�0001750�0001750�00000001733�12124610262�017573� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGLibPollFD < Test::Unit::TestCase include GLibTestUtils def test_fd poll_fd = GLib::PollFD.new(0, GLib::IOChannel::IN, 0) assert_equal(0, poll_fd.fd) end end �������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_file_utils.rb�������������������������������������������������0000644�0001750�0001750�00000002501�12446160551�020315� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- class TestGLibFileUtils < Test::Unit::TestCase include GLibTestUtils def test_format_size_for_display only_glib_version(2, 16, 0) assert_equal("1.0 KB", GLib.format_size_for_display(1024)) assert_equal("10.0 KB", GLib.format_size_for_display(1024 * 10)) assert_equal("1.0 MB", GLib.format_size_for_display(1024 * 1024)) assert_equal("1.5 MB", GLib.format_size_for_display(1024 * 1024 * 1.5)) assert_equal("1.0 GB", GLib.format_size_for_display(1024 * 1024 * 1024)) end sub_test_case "#format_size" do def setup only_glib_version(2, 30, 0) end def test_kb assert_equal("1.0 kB", GLib.format_size(1000)) end def test_mb assert_equal("1.0 MB", GLib.format_size(1000 * 1000)) end def test_gb assert_equal("1.0 GB", GLib.format_size(1000 * 1000 * 1000)) end sub_test_case "flags" do sub_test_case ":iec_units" do def format_size(size) GLib.format_size(size, :flags => :iec_units) end def test_kib assert_equal("1.0 KiB", format_size(1024)) end def test_mib assert_equal("1.0 MiB", format_size(1024 * 1024)) end def test_gib assert_equal("1.0 GiB", format_size(1024 * 1024 * 1024)) end end end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_flags.rb������������������������������������������������������0000644�0001750�0001750�00000006726�11701304107�017255� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- require 'test/unit' require 'glib2' class TestFlags < Test::Unit::TestCase { '<=>' => [ [0b0000, 0.0, nil], [0b0000, 0b0000, 0], [0b0000, 0b0110, -1], [0b0000, 0b1111, -1], [0b0110, 0b0000, 1], [0b0110, 0b0011, nil], [0b0110, 0b0110, 0], [0b0110, 0b0111, -1], [0b0110, 0b1001, nil], [0b0110, 0b1100, nil], [0b0110, 0b1110, -1], [0b0110, 0b1111, -1], [0b1111, 0b0000, 1], [0b1111, 0b0110, 1], [0b1111, 0b1111, 0], ], '==' => [ [0b0000, 0.0, nil], [0b0000, 0b0000, true], [0b0000, 0b0110, false], [0b0000, 0b1111, false], [0b0110, 0b0000, false], [0b0110, 0b0011, false], [0b0110, 0b0110, true], [0b0110, 0b0111, false], [0b0110, 0b1001, false], [0b0110, 0b1100, false], [0b0110, 0b1110, false], [0b0110, 0b1111, false], [0b1111, 0b0000, false], [0b1111, 0b0110, false], [0b1111, 0b1111, true], ], '>=' => [ [0b0000, 0.0, nil], [0b0000, 0b0000, true], [0b0000, 0b0110, false], [0b0000, 0b1111, false], [0b0110, 0b0000, true], [0b0110, 0b0011, false], [0b0110, 0b0110, true], [0b0110, 0b0111, false], [0b0110, 0b1001, false], [0b0110, 0b1100, false], [0b0110, 0b1110, false], [0b0110, 0b1111, false], [0b1111, 0b0000, true], [0b1111, 0b0110, true], [0b1111, 0b1111, true], ], '<=' => [ [0b0000, 0.0, nil], [0b0000, 0b0000, true], [0b0000, 0b0110, true], [0b0000, 0b1111, true], [0b0110, 0b0000, false], [0b0110, 0b0011, false], [0b0110, 0b0110, true], [0b0110, 0b0111, true], [0b0110, 0b1001, false], [0b0110, 0b1100, false], [0b0110, 0b1110, true], [0b0110, 0b1111, true], [0b1111, 0b0000, false], [0b1111, 0b0110, false], [0b1111, 0b1111, true], ], '>' => [ [0b0000, 0.0, nil], [0b0000, 0b0000, false], [0b0000, 0b0110, false], [0b0000, 0b1111, false], [0b0110, 0b0000, true], [0b0110, 0b0011, false], [0b0110, 0b0110, false], [0b0110, 0b0111, false], [0b0110, 0b1001, false], [0b0110, 0b1100, false], [0b0110, 0b1110, false], [0b0110, 0b1111, false], [0b1111, 0b0000, true], [0b1111, 0b0110, true], [0b1111, 0b1111, false], ], '<' => [ [0b0000, 0.0, nil], [0b0000, 0b0000, false], [0b0000, 0b0110, true], [0b0000, 0b1111, true], [0b0110, 0b0000, false], [0b0110, 0b0011, false], [0b0110, 0b0110, false], [0b0110, 0b0111, true], [0b0110, 0b1001, false], [0b0110, 0b1100, false], [0b0110, 0b1110, true], [0b0110, 0b1111, true], [0b1111, 0b0000, false], [0b1111, 0b0110, false], [0b1111, 0b1111, false], ], }.each do |operator, values| values.each do |a, b, expected| a_format = a.is_a?(Float) ? "%f" : "0b%04b" b_format = b.is_a?(Float) ? "%f" : "0b%04b" label_format = "#{a_format} %s #{b_format} == %s" data((label_format % [a, operator, b, expected.inspect]), { :a => a, :operator => operator, :b => b, :expected => expected, }) end end def test_flags_compare(data) flags = GLib::KeyFile::Flags.new(data[:a]) assert_equal(data[:expected], flags.send(data[:operator], data[:b])) end end ������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_key_file.rb���������������������������������������������������0000644�0001750�0001750�00000002163�12307003726�017745� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- require 'tempfile' class TestGLibKeyFile < Test::Unit::TestCase include GLibTestUtils def test_load_from_dirs only_glib_version(2, 14, 0) key_file = GLib::KeyFile.new assert_raise(GLib::KeyFileError::NotFound) do key_file.load_from_dirs("non-existent") end temp = Tempfile.new("key-file") base_name = File.basename(temp.path) search_dirs = [File.dirname(temp.path)] assert_raise(GLib::KeyFileError::NotFound) do key_file.load_from_dirs("non-existent", search_dirs) end if GLib.check_version?(2, 31, 2) assert_equal(temp.path, key_file.load_from_dirs(base_name, search_dirs)) else assert_raise(GLib::KeyFileError::NotFound) do key_file.load_from_dirs(base_name, search_dirs) end end temp.puts(<<-EOK) [General] key = value EOK temp.close assert_equal(temp.path, key_file.load_from_dirs(base_name, search_dirs)) end def test_desktop_constants only_glib_version(2, 14, 0) assert_equal("Desktop Entry", GLib::KeyFile::DESKTOP_GROUP) assert_equal("URL", GLib::KeyFile::DESKTOP_KEY_URL) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_mkenums.rb����������������������������������������������������0000644�0001750�0001750�00000001434�11701304107�017627� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- require 'glib-mkenums' class TestGLibMkEnums < Test::Unit::TestCase def test_parse_flags source = <<-EOS G_MARKUP_COLLECT_INVALID, G_MARKUP_COLLECT_STRING, G_MARKUP_COLLECT_STRDUP, G_MARKUP_COLLECT_BOOLEAN, G_MARKUP_COLLECT_TRISTATE, G_MARKUP_COLLECT_OPTIONAL = (1 << 16) EOS enum = GLib::EnumDefinition.new("GMarkupCollectType", source, 'G_TYPE_') assert_equal([["G_MARKUP_COLLECT_INVALID", "invalid"], ["G_MARKUP_COLLECT_STRING", "string"], ["G_MARKUP_COLLECT_STRDUP", "strdup"], ["G_MARKUP_COLLECT_BOOLEAN", "boolean"], ["G_MARKUP_COLLECT_TRISTATE", "tristate"], ["G_MARKUP_COLLECT_OPTIONAL", "optional"]], enum.constants) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/run-test.rb��������������������������������������������������������0000755�0001750�0001750�00000000750�11701304107�016675� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby base = File.expand_path(File.join(File.dirname(__FILE__))) top = File.expand_path(File.join(base, "..")) $LOAD_PATH.unshift(top) require 'test/glib-test-init' if system("which make > /dev/null") system("cd #{top.dump} && make > /dev/null") or exit(1) end $LOAD_PATH.unshift(File.join(top, "ext", "glib2")) $LOAD_PATH.unshift(File.join(top, "lib")) $LOAD_PATH.unshift(base) require 'glib-test-utils' require 'glib2' exit Test::Unit::AutoRunner.run(true, base) ������������������������ruby-gnome2-all-2.2.5/glib2/test/test_enum.rb�������������������������������������������������������0000644�0001750�0001750�00000006511�11701304107�017115� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- require 'test/unit' require 'glib2' class TestEnum < Test::Unit::TestCase def test_enum_by_symbol original = [0x00c1].pack("U*") # A with acute assert_equal(GLib::UTF8.normalize(original, GLib::NormalizeMode::NFD), GLib::UTF8.normalize(original, :nfd)) assert_equal(GLib::UTF8.normalize(original, GLib::NormalizeMode::NFD), GLib::UTF8.normalize(original, :NFD)) assert_raise(TypeError) do GLib::UTF8.normalize(original, :unknown) end end def test_enum_by_string original = [0x00c1].pack("U*") # A with acute assert_equal(GLib::UTF8.normalize(original, GLib::NormalizeMode::NFD), GLib::UTF8.normalize(original, "nfd")) assert_equal(GLib::UTF8.normalize(original, GLib::NormalizeMode::NFD), GLib::UTF8.normalize(original, "NFD")) assert_raise(TypeError) do GLib::UTF8.normalize(original, "unknown") end end def test_flags_simple assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, :keep_comments) assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, :KEEP_COMMENTS) assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "keep_comments") assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "KEEP_COMMENTS") assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "keep COMMENTS") assert_raise(TypeError) do assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, :unknown) end assert_raise(TypeError) do assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "UNKNOWN") end end def test_flags_by_array assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS, [:keep_comments, :keep_translations]) assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS, [:keep_COMMENTS, "KEEP_TRANSLATIONS"]) assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS, ["keep_comments", "KEEP_translations"]) assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS, [:keep_comments, GLib::KeyFile::KEEP_TRANSLATIONS]) assert_raise(TypeError) do assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS, [:keep_comments, nil, :keep_translations]) end end def test_flags_or assert_equal(GLib::KeyFile::KEEP_COMMENTS, GLib::KeyFile::KEEP_COMMENTS | []) assert_equal(GLib::KeyFile::KEEP_COMMENTS | GLib::KeyFile::KEEP_TRANSLATIONS , GLib::KeyFile::KEEP_COMMENTS | [:keep_translations]) end private def assert_key_file_load(flags, convenience_flags) data = <<-EOD [SECTION] KEY=VALUE # comment KEY[ja]=値 EOD expected_key_file = GLib::KeyFile.new expected_key_file.load_from_data(data, flags) actual_key_file = GLib::KeyFile.new actual_key_file.load_from_data(data, convenience_flags) assert_equal(expected_key_file.get_value("SECTION", "KEY"), actual_key_file.get_value("SECTION", "KEY")) assert_equal(expected_key_file.to_data, actual_key_file.to_data) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_unicode.rb����������������������������������������������������0000664�0001750�0001750�00000027143�11740310343�017607� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- class TestGLibUnicode < Test::Unit::TestCase include GLibTestUtils def test_gunicode_type assert_nothing_raised do GLib::Unicode::CONTROL end end def test_gunicode_break_type assert_nothing_raised do GLib::Unicode::BREAK_MANDATORY end end def test_unichar_alnum? assert(GLib::UniChar.alnum?(unichar("a"))) assert(GLib::UniChar.alnum?(unichar("1"))) assert(!GLib::UniChar.alnum?(unichar("!"))) end def test_unichar_alpha? assert(GLib::UniChar.alpha?(unichar("a"))) assert(GLib::UniChar.alpha?(unichar("A"))) assert(!GLib::UniChar.alpha?(unichar("1"))) end def test_unichar_cntrl? assert(GLib::UniChar.cntrl?(unichar("\t"))) assert(!GLib::UniChar.cntrl?(unichar("\h"))) assert(!GLib::UniChar.cntrl?(unichar("a"))) assert(!GLib::UniChar.cntrl?(unichar("1"))) end def test_unichar_digit? assert(GLib::UniChar.digit?(unichar("1"))) assert(!GLib::UniChar.digit?(unichar("a"))) end def test_unichar_graph? assert(GLib::UniChar.graph?(unichar("a"))) assert(!GLib::UniChar.graph?(unichar(" "))) assert(!GLib::UniChar.graph?(unichar("\t"))) end def test_unichar_lower? assert(GLib::UniChar.lower?(unichar("a"))) assert(!GLib::UniChar.lower?(unichar("A"))) assert(!GLib::UniChar.lower?(unichar("1"))) end def test_unichar_print? assert(GLib::UniChar.print?(unichar("a"))) assert(GLib::UniChar.print?(unichar(" "))) assert(!GLib::UniChar.print?(unichar("\t"))) end def test_unichar_punct? assert(GLib::UniChar.punct?(unichar(","))) assert(GLib::UniChar.punct?(unichar("."))) assert(!GLib::UniChar.punct?(unichar("a"))) assert(!GLib::UniChar.punct?(unichar("\t"))) end def test_unichar_space? assert(GLib::UniChar.space?(unichar(" "))) assert(GLib::UniChar.space?(unichar("\t"))) assert(GLib::UniChar.space?(unichar("\r"))) assert(GLib::UniChar.space?(unichar("\n"))) assert(!GLib::UniChar.space?(unichar("a"))) end def test_unichar_upper? assert(GLib::UniChar.upper?(unichar("A"))) assert(!GLib::UniChar.upper?(unichar("a"))) assert(!GLib::UniChar.upper?(unichar("1"))) end def test_unichar_xdigit? assert(GLib::UniChar.xdigit?(unichar("1"))) assert(GLib::UniChar.xdigit?(unichar("a"))) assert(GLib::UniChar.xdigit?(unichar("A"))) assert(GLib::UniChar.xdigit?(unichar("F"))) assert(!GLib::UniChar.xdigit?(unichar("X"))) end def test_unichar_title? end def test_unichar_defined? end def test_unichar_wide? assert(GLib::UniChar.wide?(unichar("あ"))) assert(GLib::UniChar.wide?(unichar("A"))) assert(!GLib::UniChar.wide?(unichar("a"))) end def test_unichar_wide_cjk? only_glib_version(2, 12, 0) assert(GLib::UniChar.wide_cjk?(unichar("あ"))) assert(GLib::UniChar.wide_cjk?(0xD55C)) # HANGUL SYLLABLE HAN assert(!GLib::UniChar.wide_cjk?(unichar("a"))) end def test_unichar_to_upper assert_equal(unichar("A"), GLib::UniChar.to_upper(unichar("a"))) assert_equal(unichar("A"), GLib::UniChar.to_upper(unichar("A"))) assert_equal(unichar("*"), GLib::UniChar.to_title(unichar("*"))) end def test_unichar_to_lower assert_equal(unichar("a"), GLib::UniChar.to_lower(unichar("A"))) assert_equal(unichar("a"), GLib::UniChar.to_lower(unichar("a"))) assert_equal(unichar("*"), GLib::UniChar.to_title(unichar("*"))) end def test_unichar_to_title assert_equal(unichar("A"), GLib::UniChar.to_title(unichar("a"))) assert_equal(unichar("A"), GLib::UniChar.to_title(unichar("A"))) assert_equal(unichar("*"), GLib::UniChar.to_title(unichar("*"))) end def test_unichar_digit_value assert_equal(0, GLib::UniChar.digit_value(unichar("0"))) assert_equal(9, GLib::UniChar.digit_value(unichar("9"))) assert_equal(-1, GLib::UniChar.digit_value(unichar("a"))) end def test_unichar_xdigit_value assert_equal(0, GLib::UniChar.xdigit_value(unichar("0"))) assert_equal(9, GLib::UniChar.xdigit_value(unichar("9"))) assert_equal(10, GLib::UniChar.xdigit_value(unichar("a"))) assert_equal(15, GLib::UniChar.xdigit_value(unichar("F"))) assert_equal(-1, GLib::UniChar.xdigit_value(unichar("g"))) end def test_unichar_type assert_equal(GLib::Unicode::DECIMAL_NUMBER, GLib::UniChar.type(unichar("0"))) assert_equal(GLib::Unicode::LOWERCASE_LETTER, GLib::UniChar.type(unichar("a"))) assert_equal(GLib::Unicode::UPPERCASE_LETTER, GLib::UniChar.type(unichar("A"))) end def test_unichar_break_type assert_equal(GLib::Unicode::BREAK_HYPHEN, GLib::UniChar.break_type(unichar("-"))) assert_equal(GLib::Unicode::BREAK_NUMERIC, GLib::UniChar.break_type(unichar("0"))) end def test_unicode_canonical_ordering original = [unichar("a"), 0x0308, 0x0323, unichar("e"), 0x0304, 0x0301, 0x0323].pack("U*") expected = [unichar("a"), 0x0323, 0x0308, unichar("e"), 0x0323, 0x0304, 0x0301].pack("U*") assert_equal(utf8_to_utf32(expected), GLib::Unicode.canonical_ordering(utf8_to_utf32(original))) end def test_unicode_canonical_decomposition a_with_acute = 0x00E1 expected = [unichar("a"), 0x0301].pack("U*") assert_equal(utf8_to_utf32(expected), GLib::Unicode.canonical_decomposition(a_with_acute)) hiragana_ga = 0x304C hiragana_ka = 0x304B expected = [hiragana_ka, 0x3099].pack("U*") assert_equal(utf8_to_utf32(expected), GLib::Unicode.canonical_decomposition(hiragana_ga)) end def test_unichar_get_mirror_char assert_equal(unichar("("), GLib::UniChar.get_mirror_char(unichar(")"))) assert_equal(unichar(")"), GLib::UniChar.get_mirror_char(unichar("("))) assert_equal(unichar("x"), GLib::UniChar.get_mirror_char(unichar("x"))) end def test_unichar_get_script only_glib_version(2, 14, 0) assert_equal(GLib::Unicode::SCRIPT_HIRAGANA, GLib::UniChar.get_script(unichar("あ"))) end def test_utf8_get_char assert_equal(utf8_to_utf32("あ").unpack("L*")[0], GLib::UTF8.get_char("あ")) assert_equal(utf8_to_utf32("あ").unpack("L*")[0], GLib::UTF8.get_char("あ", true)) partial_input = "あ".unpack("c*")[0..-2].pack("c*") assert_equal(-2, GLib::UTF8.get_char(partial_input, true)) invalid_input = "あ".unpack("c*")[2..-1].pack("c*") assert_equal(-1, GLib::UTF8.get_char(invalid_input, true)) end def test_utf8_size assert_equal(1, GLib::UTF8.size("あ")) assert_equal(2, GLib::UTF8.size("あい")) end def test_utf8_reverse assert_equal("おえういあ", GLib::UTF8.reverse("あいうえお")) end def test_utf8_validate assert(GLib::UTF8.validate("あ")) assert(!GLib::UTF8.validate(binary("あ")[1..-1])) end def test_utf8_upcase assert_equal("ABCあいう", GLib::UTF8.upcase("aBcあいう")) end def test_utf8_downcase assert_equal("abcあいう", GLib::UTF8.downcase("aBcあいう")) end def test_utf8_casefold assert_equal(GLib::UTF8.casefold("AbCあいう"), GLib::UTF8.casefold("aBcあいう")) end def test_utf8_normalize original = [0x00c1].pack("U*") # A with acute nfd = [0x0041, 0x0301].pack("U*") assert_equal(nfd, GLib::UTF8.normalize(original, GLib::NormalizeMode::NFD)) nfc = [0x00c1].pack("U*") assert_equal(nfc, GLib::UTF8.normalize(original, GLib::NormalizeMode::NFC)) nfkd = [0x0041, 0x0301].pack("U*") assert_equal(nfkd, GLib::UTF8.normalize(original, GLib::NormalizeMode::NFKD)) nfkc = [0x00c1].pack("U*") assert_equal(nfkc, GLib::UTF8.normalize(original, GLib::NormalizeMode::NFKC)) end def test_utf8_collate only_glib_version(2, 16, 0) assert_operator(0, :>, GLib::UTF8.collate("あ", "い")) assert_operator(0, :<, GLib::UTF8.collate("い", "あ")) assert_equal(0, GLib::UTF8.collate("あ", "あ")) end def test_utf8_collate_key only_glib_version(2, 16, 0) assert_operator(0, :>, GLib::UTF8.collate_key("あ") <=> GLib::UTF8.collate_key("い")) assert_operator(0, :<, GLib::UTF8.collate_key("い") <=> GLib::UTF8.collate_key("あ")) assert_equal(0, GLib::UTF8.collate_key("あ") <=> GLib::UTF8.collate_key("あ")) end def test_utf8_collate_key_for_filename assert_equal(["event.c", "event.h", "eventgenerator.c"], ["event.c", "eventgenerator.c", "event.h"].sort_by do |f| GLib::UTF8.collate_key(f, true) end) assert_equal(["file1", "file5", "file10"], ["file1", "file10", "file5"].sort_by do |f| GLib::UTF8.collate_key(f, true) end) end def test_utf8_to_utf16 assert_equal(utf8_to_utf16("あいうえお"), GLib::UTF8.to_utf16("あいうえお")) end def test_utf8_to_ucs4 assert_equal(utf8_to_utf32("あいうえお"), GLib::UTF8.to_ucs4("あいうえお")) assert_raise(GLib::ConvertError) do GLib::UTF8.to_ucs4(binary("あいうえお")[1..-1]) end assert_nothing_raised do GLib::UTF8.to_ucs4(binary("あいうえお")[1..-1], true) end end def test_utf16_to_ucs4 assert_equal(utf8_to_utf32("あいうえお"), GLib::UTF16.to_ucs4(utf8_to_utf16("あいうえお"))) end def test_utf16_to_utf8 assert_equal("あいうえお", GLib::UTF16.to_utf8(utf8_to_utf16("あいうえお"))) end def test_ucs4_to_utf16 assert_equal(utf8_to_utf16("あいうえお"), GLib::UCS4.to_utf16(utf8_to_utf32("あいうえお"))) assert_raise(GLib::ConvertError) do GLib::UCS4.to_utf16(binary(utf8_to_utf32("あいうえお"))[1..-1]) end end def test_ucs4_to_utf8 assert_equal("あいうえお", GLib::UCS4.to_utf8(utf8_to_utf32("あいうえお"))) end def test_unichar_to_utf8 assert_equal("あ", GLib::UniChar.to_utf8(utf8_to_utf32("あ").unpack("L*")[0])) end def test_unichar_combining_class only_glib_version(2, 14, 0) assert_equal(0, GLib::UniChar.combining_class(unichar("a"))) assert_equal(230, GLib::UniChar.combining_class(unichar("́"))) end def test_unichar_mark? only_glib_version(2, 14, 0) assert(!GLib::UniChar.mark?(unichar("a"))) assert(!GLib::UniChar.mark?(0x200E)) # LEFT-TO-RIGHT MARK assert(GLib::UniChar.mark?(0x1DC3)) # COMBINING SUSPENSION MARK end def test_unichar_zero_width? only_glib_version(2, 14, 0) assert(!GLib::UniChar.zero_width?(unichar("a"))) assert(GLib::UniChar.zero_width?(0x200B)) # ZERO WIDTH SPACE end private def unichar(char) GLib::UTF8.get_char(char) end def utf8_to_utf32(string) if string.respond_to?(:encode) if little_endian? string.encode("UTF-32LE") else string.encode("UTF-32BE") end else require_uconv Uconv.u8tou4(string) end end def utf8_to_utf16(string) if string.respond_to?(:encode) if little_endian? string.encode("UTF-16LE") else string.encode("UTF-16BE") end else require_uconv Uconv.u8tou16(string) end end def require_uconv require 'uconv' rescue LoadError omit("Need uconv to run this test.") end def binary(string) if string.respond_to?(:force_encoding) string.force_encoding("ascii-8bit") end string end def little_endian? [1].pack("v") == [1].pack("S") end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_iochannel.rb��������������������������������������������������0000755�0001750�0001750�00000014545�11701304107�020122� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- require 'test/unit' require 'glib2' require 'tempfile' require 'nkf' $KCODE = "U" unless defined?(:Encoding) class TestGIOChannel < Test::Unit::TestCase def setup @content = "aaa\nbbb\nccc\nあああ\n" @sjis_content = NKF.nkf("-sW", @content) @file = Tempfile.new("glib2-content") @file.open @file.print(@content) @file.close @sjis_file = Tempfile.new("glib2-sjis-content") @sjis_file.open @sjis_file.print(@sjis_content) @sjis_file.close end def test_open write_test_file = Tempfile.new("glib2-write-test") io = GLib::IOChannel.open(@file.path) io.close io = GLib::IOChannel.open(@file.path, "r") assert_equal(@content, io.read) io.close io = GLib::IOChannel.open(write_test_file.path, "w") assert_raises(RuntimeError){ assert_equal(@content, io.read) } io.close GLib::IOChannel.open(@file.path) do |_io| assert_equal(@content, _io.read) end GLib::IOChannel.open(@file.path, "r") do |_io| assert_equal(@content, _io.read) end GLib::IOChannel.open(write_test_file.path, "w") do |_io| io = _io assert_raises(RuntimeError) do assert_equal(@content, io.read) end end assert_raises(GLib::IOChannelError) do io.close end assert_raises(GLib::FileError) do GLib::IOChannel.new("foo") end end def test_getc io = GLib::IOChannel.new(@file.path) ["a", "b", "c", "あ"].each do |v| 3.times do assert_equal(v.unpack("U")[0], io.getc) end assert_equal("\n".unpack("U")[0], io.getc) end assert_equal(nil, io.getc) io.close end def test_each_char text = @content.split(//u) io = GLib::IOChannel.new(@file.path) i = 0 io.each_char {|ch| assert_equal(text[i].unpack("U")[0], ch) i += 1 } io.close end def test_readchar io = GLib::IOChannel.new(@file.path) text = @content.split(//u) text.each do |v| assert_equal(v.unpack("U")[0], io.readchar) end assert_raises(EOFError) { io.readchar } io.close end def test_gets io = GLib::IOChannel.new(@file.path) assert_equal("aaa\n", io.gets) assert_equal("bbb\n", io.gets) assert_equal("ccc\n", io.gets) assert_equal("あああ\n", io.gets) assert_equal(nil, io.gets) io.close io = GLib::IOChannel.new(@file.path) assert_equal("aaa\nbbb\n", io.gets("bbb\n")) assert_equal("ccc\nあああ\n", io.gets("bbb\n")) assert_equal(nil, io.gets("bbb\n")) io.close end def test_readline io = GLib::IOChannel.new(@file.path) assert_equal("aaa\n", io.readline) assert_equal("bbb\n", io.readline) assert_equal("ccc\n", io.readline) assert_equal("あああ\n", io.readline) assert_raises(EOFError) { io.readline } io.close io = GLib::IOChannel.new(@file.path) assert_equal("aaa\nbbb\n", io.readline("bbb\n")) assert_equal("ccc\nあああ\n", io.readline("bbb\n")) assert_raises(EOFError) { io.readline("bbb\n") } io.close end def test_each_line lines = ["aaa\n", "bbb\n", "ccc\n", "あああ\n"] io = GLib::IOChannel.new(@file.path) i = 0 io.each {|line| assert_equal(lines[i], line) i += 1 } io.close io = GLib::IOChannel.new(@file.path) assert_raises(RuntimeError) { io.each {|line| raise "test" } } io.close io = GLib::IOChannel.new(@file.path) i = 0 io.each_line {|line| assert_equal(lines[i], line) i += 1 } io.close #Test for Enumerable GLib::IOChannel.open(@file.path) do |_io| io = _io io.each_with_index do |line, _i| assert_equal(lines[_i], line) end end assert_raises(ArgumentError) do io.each end end def test_read io = GLib::IOChannel.new(@file.path) assert_equal(@content, io.read) io.close io = GLib::IOChannel.new(@file.path) assert_equal(@content, io.read(100)) io.close io = GLib::IOChannel.new(@file.path) assert_equal("aaa\nbbb\n", io.read(8)) assert_equal("ccc\n", io.read(4)) assert_equal("あああ\n", io.read(10)) assert_equal("", io.read(10)) assert_equal("", io.read(10)) io.close end def test_seek text = @content io = GLib::IOChannel.new(@file.path) io.seek(5) assert_equal(text.unpack("U*")[5], io.getc) io.seek(6, GLib::IOChannel::SEEK_SET) assert_equal(text.unpack("U*")[6], io.getc) io.seek(1, GLib::IOChannel::SEEK_CUR) assert_equal(text.unpack("U*")[8], io.getc) io.pos = 0 assert_equal(text.unpack("U*")[0], io.getc) io.set_pos(2) assert_equal(text.unpack("U*")[2], io.getc) io.close end def test_write write_test_file = Tempfile.new("glib2-write-test") io = GLib::IOChannel.new(write_test_file.path, "w") io.write("a\n") io.write("あいう\n") io.printf("a%sa\n", "a") io.print("a", 100, "a\n") io.puts("b", 200, "b") io.putc("c") io.putc("c".unpack("U")[0]) io.putc("cc".unpack("U")[0]) io.putc("あ".unpack("U")[0]) io.putc("あ") io.putc("あい") #Ignore 2nd char io.putc("aあ") #Ignore 2nd char io.close # check them io = GLib::IOChannel.new(write_test_file.path, "r") assert_equal("a\n", io.gets) assert_equal("あいう\n", io.gets) assert_equal("aaa\n", io.gets) assert_equal("a100a\n", io.gets) assert_equal("b\n", io.gets) assert_equal("200\n", io.gets) assert_equal("b\n", io.gets) assert_equal("c".unpack("U")[0], io.getc) assert_equal("c".unpack("U")[0], io.getc) assert_equal("c".unpack("U")[0], io.getc) assert_equal("あ".unpack("U")[0], io.getc) assert_equal("あ".unpack("U")[0], io.getc) assert_equal("あ".unpack("U")[0], io.getc) assert_equal("a".unpack("U")[0], io.getc) io.close end def test_encoding io = GLib::IOChannel.new(@file.path) assert_equal("UTF-8", io.encoding) io.encoding = "Shift_JIS" assert_equal("Shift_JIS", io.encoding) assert_raises(GLib::ConvertError) { io.read } io.close io = GLib::IOChannel.new(@sjis_file.path) io.encoding = "Shift_JIS" assert_equal("Shift_JIS", io.encoding) assert_equal(@content, io.read) io.close end def test_error assert_raises(GLib::FileError) { # No such file or directory GLib::IOChannel.new("foo") } end end �����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_value.rb������������������������������������������������������0000644�0001750�0001750�00000002117�12516434313�017273� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGLibValue < Test::Unit::TestCase include GLibTestUtils def test_type value = GLib::Value.new(GLib::Type::UINT, 29) assert_equal(GLib::Type::UINT, value.type) end def test_value value = GLib::Value.new(GLib::Type::UINT, 29) assert_equal(29, value.value) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_timeout.rb����������������������������������������������������0000644�0001750�0001750�00000001235�11701304107�017635� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- class TestGLibTimeout < Test::Unit::TestCase include GLibTestUtils def setup @id = nil end def teardown GLib::Source.remove(@id) if @id end def test_timeout_add_priority priority = GLib::PRIORITY_HIGH @id = GLib::Timeout.add(10, priority) source = GLib::MainContext.default.find_source(@id) assert_equal(priority, source.priority) end def test_timeout_add_seconds_priority only_glib_version(2, 14, 0) priority = GLib::PRIORITY_HIGH @id = GLib::Timeout.add_seconds(10, priority) source = GLib::MainContext.default.find_source(@id) assert_equal(priority, source.priority) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_signal.rb�����������������������������������������������������0000644�0001750�0001750�00000001204�11701304107�017420� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- class TestSignal < Test::Unit::TestCase def test_signal_flags assert_const_defined(GLib, :SignalFlags) assert_kind_of(GLib::SignalFlags, GLib::Signal::RUN_FIRST) assert_equal(GLib::SignalFlags::MASK, GLib::Signal::FLAGS_MASK) end def test_connect_flags assert_const_defined(GLib, :ConnectFlags) assert_kind_of(GLib::ConnectFlags, GLib::Signal::CONNECT_AFTER) end def test_signal_match_type assert_const_defined(GLib, :SignalMatchType) assert_kind_of(GLib::SignalMatchType, GLib::Signal::MATCH_ID) assert_equal(GLib::SignalMatchType::MASK, GLib::Signal::MATCH_MASK) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_source.rb�����������������������������������������������������0000644�0001750�0001750�00000003355�12446160551�017466� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGLibSource < Test::Unit::TestCase include GLibTestUtils def test_time context = GLib::MainContext.default source = GLib::Idle.source_new id = source.attach(context) begin time = source.time assert_operator(0, :<, time) ensure GLib::Source.remove(id) end end def test_destroy context = GLib::MainContext.new source = GLib::Idle.source_new id = source.attach(context) assert_not_nil(context.find_source(id)) source.destroy assert_nil(context.find_source(id)) end def test_name only_glib_version(2, 26, 0) source = GLib::Idle.source_new assert_nil(source.name) source_name = "glib source" source.name = source_name assert_equal(source_name, source.name) end def test_ready_time only_glib_version(2, 36, 0) source = GLib::Idle.source_new ready_time = 5 source.ready_time = 5 assert_equal(ready_time, source.ready_time) end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/glib-test-init.rb��������������������������������������������������0000644�0001750�0001750�00000000110�11701304107�017732� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������$VERBOSE = true require "rubygems" gem 'test-unit' require 'test/unit' ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_win32.rb������������������������������������������������������0000644�0001750�0001750�00000000457�11701304107�017116� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- class TestGLibWin32 < Test::Unit::TestCase include GLibTestUtils def test_get_package_install_directory_of_module only_win32 only_glib_version(2, 16, 0) assert_equal("FIXME", GLib::Win32.get_package_installation_directory_of_module) end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/glib-test-utils.rb�������������������������������������������������0000644�0001750�0001750�00000000435�11701304107�020141� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������module GLibTestUtils private def only_glib_version(major, minor, micro) unless GLib.check_version?(major, minor, micro) omit("Require GLib >= #{major}.#{minor}.#{micro}") end end def only_win32 omit("Only for Win32 platform") unless GLib.os_win32? end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/test/test_utils.rb������������������������������������������������������0000644�0001750�0001750�00000001504�11701304107�017306� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- class TestGLibUtils < Test::Unit::TestCase include GLibTestUtils def test_user_cache_dir only_glib_version(2, 6, 0) assert_kind_of(String, GLib.user_cache_dir) end def test_user_data_dir only_glib_version(2, 6, 0) assert_kind_of(String, GLib.user_data_dir) end def test_user_config_dir only_glib_version(2, 6, 0) assert_kind_of(String, GLib.user_config_dir) end def test_system_data_dirs only_glib_version(2, 6, 0) assert_kind_of(Array, GLib.system_data_dirs) end def test_system_config_dirs only_glib_version(2, 6, 0) assert_kind_of(Array, GLib.system_config_dirs) end def test_get_user_special_dir only_glib_version(2, 14, 0) assert_nothing_raised do GLib.get_user_special_dir(GLib::UserDirectory::DESKTOP) end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/extconf.rb��������������������������������������������������������������0000755�0001750�0001750�00000002224�11701304107�015601� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "glib2" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/Rakefile����������������������������������������������������������������0000644�0001750�0001750�00000010265�12446176112�015266� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- $LOAD_PATH.unshift("./lib") require 'gnome2/rake/package-task' bin_dir = nil include_dir = nil glib2_include_dir = nil libffi_lib_dir = nil build_host = nil package_task = GNOME2::Rake::PackageTask.new do |package| bin_dir = (package.windows.absolute_binary_dir + "bin").to_s include_dir = (package.windows.absolute_binary_dir + "include").to_s glib2_include_dir = File.join(include_dir, "glib-2.0") libffi_lib_dir = (package.windows.absolute_binary_dir + "lib").to_s build_host = package.windows.build_host package.summary = "Ruby/GLib2 is a Ruby binding of GLib-2.x." package.description = "Ruby/GLib2 is a Ruby binding of GLib-2.x." package.dependency.gem.runtime = [["pkg-config", ">= 0"]] package.dependency.gem.development = [["test-unit", ">= 2"]] package.windows.packages = [] package.windows.dependencies = [] package.external_packages = [ { :name => "libiconv", :download_site => :gnu, :label => "libiconv", :version => "1.14", :windows => { :built_file => "bin/libiconv-2.dll", }, }, { :name => "gettext", :download_site => :gnu, :label => "gettext-runtime", :version => "0.19.2", :base_dir_in_package => "gettext-runtime", :windows => { :built_file => "bin/libintl-8.dll", }, }, { :name => "libffi", :download_base_url => "ftp://sourceware.org/pub/libffi", :label => "libffi", :version => "3.2.1", :windows => { :built_file => "bin/libffi-6.dll", }, }, { :name => "glib", :download_site => :gnome, :label => "GLib", :version => "2.42.1", :compression_method => "xz", :windows => { :need_autoreconf => true, :patches => [ "glib-2.38.2-add-missing-exeext.diff", ], :built_file => "bin/libglib-2.0-0.dll", }, }, { :name => "gmp", :download_base_url => "ftp://ftp.gmplib.org/pub/gmp-6.0.0", :label => "GNU MP", :version => "6.0.0", :compression_method => "xz", :windows => { :configure_args => [ "--disable-static", "--enable-shared", ], :built_file => "bin/libgmp-10.dll", }, }, { :name => "nettle", :download_base_url => "http://www.lysator.liu.se/~nisse/archive", :label => "Nettle", :version => "2.7.1", :windows => { :configure_args => [], :built_file => "bin/libnettle-4-7.dll", }, }, { :name => "gnutls", :download_base_url => "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2", :label => "GnuTLS", :version => "3.2.21", :compression_method => "xz", :windows => { :configure_args => [ "--disable-cxx", ], :use_cc_environment_variable => false, :patches => [ ], :built_file => "bin/libgnutls-28.dll", }, }, { :name => "glib-networking", :download_site => :gnome, :label => "glib-networking", :version => "2.42.1", :compression_method => "xz", :windows => { :configure_args => [ "--without-libproxy", "--without-gnome-proxy", "--without-ca-certificates", ], :built_file => "lib/gio/modules/libgiognutls.dll", }, }, ] package.cross_compiling do |spec| if /mingw|mswin/ =~ spec.platform.to_s spec.add_runtime_dependency("cairo", ">= 1.12.8") end end end package_task.define namespace :windows do namespace :glib do pkg_config_dir = package_task.windows.absolute_binary_dir + "lib/pkgconfig" pc_path = pkg_config_dir + "glib-2.0.pc" patched_path = pkg_config_dir + "patched" file patched_path.to_s do original_pc = pc_path.read new_pc = original_pc.gsub(/^Cflags:/) do |matched| "#{matched} -I${includedir}" end pc_path.open("w") do |pc_file| pc_file.write(new_pc) end touch(patched_path) end desc "Add include path for libintl.h" task :cross => patched_path.to_s end namespace :builder do task :after => "windows:glib:cross" end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/TODO��������������������������������������������������������������������0000644�0001750�0001750�00000000154�11701304107�014273� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������* GIO support * inspect include readable properties. * make log message handler set by Ruby/GLib removable. ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014403� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�015407� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_value.c������������������������������������������������0000644�0001750�0001750�00000025665�12516434313�020235� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" /**********************************************************************/ #define RG_TARGET_NAMESPACE rbgobj_cValue #define _SELF(self) RVAL2GVALUE(self) static ID id_to_s; static GQuark qRValueToGValueFunc; static GQuark qGValueToRValueFunc; void rbgobj_register_r2g_func(GType gtype, RValueToGValueFunc func) { g_type_set_qdata(gtype, qRValueToGValueFunc, func); } void rbgobj_register_g2r_func(GType gtype, GValueToRValueFunc func) { g_type_set_qdata(gtype, qGValueToRValueFunc, func); } /**********************************************************************/ VALUE rbgobj_gvalue_to_rvalue(const GValue* value) { GType type, fundamental_type; VALUE rvalue; if (!value) return Qnil; type = G_VALUE_TYPE(value); if (rbgobj_convert_gvalue2rvalue(type, value, &rvalue)) return rvalue; fundamental_type = G_TYPE_FUNDAMENTAL(type); switch (fundamental_type) { case G_TYPE_NONE: return Qnil; case G_TYPE_CHAR: return CHR2FIX(g_value_get_char(value)); case G_TYPE_UCHAR: return INT2FIX(g_value_get_uchar(value)); case G_TYPE_BOOLEAN: return CBOOL2RVAL(g_value_get_boolean(value)); case G_TYPE_INT: return INT2NUM(g_value_get_int(value)); case G_TYPE_UINT: return UINT2NUM(g_value_get_uint(value)); case G_TYPE_LONG: return LONG2NUM(g_value_get_long(value)); case G_TYPE_ULONG: return ULONG2NUM(g_value_get_ulong(value)); case G_TYPE_INT64: return rbglib_int64_to_num(g_value_get_int64(value)); case G_TYPE_UINT64: return rbglib_uint64_to_num(g_value_get_uint64(value)); case G_TYPE_FLOAT: return rb_float_new(g_value_get_float(value)); case G_TYPE_DOUBLE: return rb_float_new(g_value_get_double(value)); case G_TYPE_STRING: return CSTR2RVAL(g_value_get_string(value)); case G_TYPE_ENUM: return rbgobj_make_enum(g_value_get_enum(value), type); case G_TYPE_FLAGS: return rbgobj_make_flags(g_value_get_flags(value), type); case G_TYPE_OBJECT: case G_TYPE_INTERFACE: { GObject* gobj = g_value_get_object(value); return gobj ? GOBJ2RVAL(gobj) : Qnil; } case G_TYPE_PARAM: { GParamSpec* pspec = g_value_get_param(value); return pspec ? rbgobj_ruby_object_from_instance(pspec) : Qnil; } case G_TYPE_POINTER: { gpointer ptr = g_value_get_pointer(value); if (!ptr) return Qnil; else return rbgobj_ptr_new(type, ptr); } case G_TYPE_BOXED: { GType gtype; for (gtype = type; gtype != G_TYPE_INVALID; gtype = g_type_parent(gtype)) { GValueToRValueFunc func = g_type_get_qdata(gtype, qGValueToRValueFunc); if (!func) continue; return func(value); } } default: if (!rbgobj_convert_gvalue2rvalue(fundamental_type, value, &rvalue)) { GValueToRValueFunc func; func = g_type_get_qdata(type, qGValueToRValueFunc); if (!func) { g_warning("rbgobj_gvalue_to_rvalue: unsupported type: %s\n", g_type_name(type)); } else { rvalue = func(value); } } return rvalue; } } static VALUE rbgobj_gvalue_to_rvalue_unset_body(VALUE value) { return GVAL2RVAL((GValue *)value); } static VALUE rbgobj_gvalue_to_rvalue_unset_ensure(VALUE value) { g_value_unset((GValue *)value); return Qnil; } VALUE rbgobj_gvalue_to_rvalue_unset(GValue *value) { return rb_ensure(rbgobj_gvalue_to_rvalue_unset_body, (VALUE)value, rbgobj_gvalue_to_rvalue_unset_ensure, (VALUE)value); } void rbgobj_initialize_gvalue(GValue *result, VALUE value) { GType type; type = rbgobj_convert_rvalue2gtype(value); if (type == 0) { switch (TYPE(value)) { case T_NONE: case T_NIL: type = G_TYPE_NONE; break; case T_FLOAT: type = G_TYPE_DOUBLE; break; case T_STRING: case T_SYMBOL: type = G_TYPE_STRING; break; case T_FIXNUM: type = G_TYPE_INT; break; case T_BIGNUM: type = G_TYPE_INT64; break; case T_TRUE: case T_FALSE: type = G_TYPE_BOOLEAN; break; default: if (RVAL2CBOOL(rb_obj_is_kind_of(value, rbgobj_cEnum))) { type = G_TYPE_ENUM; } else if (RVAL2CBOOL(rb_obj_is_kind_of(value, rbgobj_cFlags))) { type = G_TYPE_FLAGS; } else if (RVAL2CBOOL(rb_obj_is_kind_of(value, rbgobj_cBoxed))) { type = G_TYPE_BOXED; } else if (RVAL2CBOOL(rb_obj_is_kind_of(value, rbgobj_cParam))) { type = G_TYPE_PARAM; } else if (RVAL2CBOOL(rb_obj_is_kind_of(value, rbgobj_cObject))) { type = G_TYPE_OBJECT; } else if (RVAL2CBOOL(rb_obj_is_kind_of(value, rbgobj_mInterface))) { /* should use rbgobj_mMetaInterface? */ type = G_TYPE_INTERFACE; } else { VALUE inspected_value; inspected_value = rb_funcall(value, rb_intern("inspect"), 0); rb_raise(rb_eArgError, "unsupported value type: %s", RSTRING_PTR(inspected_value)); } break; } } g_value_init(result, type); rbgobj_rvalue_to_gvalue(value, result); } void rbgobj_rvalue_to_gvalue(VALUE val, GValue* result) { GType type, fundamental_type; type = G_VALUE_TYPE(result); if (rbgobj_convert_rvalue2gvalue(type, val, result)) return; fundamental_type = G_TYPE_FUNDAMENTAL(type); switch (fundamental_type) { case G_TYPE_NONE: return; case G_TYPE_CHAR: g_value_set_char(result, NUM2INT(val)); return; case G_TYPE_UCHAR: g_value_set_uchar(result, NUM2UINT(val)); return; case G_TYPE_BOOLEAN: g_value_set_boolean(result, RVAL2CBOOL(val)); return; case G_TYPE_INT: g_value_set_int(result, NUM2INT(val)); return; case G_TYPE_UINT: g_value_set_uint(result, NUM2UINT(val)); return; case G_TYPE_LONG: g_value_set_long(result, NUM2LONG(val)); return; case G_TYPE_ULONG: g_value_set_ulong(result, NUM2ULONG(val)); return; case G_TYPE_INT64: g_value_set_int64(result, rbglib_num_to_int64(val)); return; case G_TYPE_UINT64: g_value_set_uint64(result, rbglib_num_to_uint64(val)); return; case G_TYPE_ENUM: g_value_set_enum(result, rbgobj_get_enum(val, G_VALUE_TYPE(result))); return; case G_TYPE_FLAGS: g_value_set_flags(result, rbgobj_get_flags(val, G_VALUE_TYPE(result))); return; case G_TYPE_FLOAT: g_value_set_float(result, NUM2DBL(val)); return; case G_TYPE_DOUBLE: g_value_set_double(result, NUM2DBL(val)); return; case G_TYPE_STRING: { if (SYMBOL_P(val)) val = rb_funcall(val, id_to_s, 0); g_value_set_string(result, RVAL2CSTR_ACCEPT_NIL(val)); return; } case G_TYPE_OBJECT: case G_TYPE_INTERFACE: g_value_set_object(result, NIL_P(val) ? NULL : RVAL2GOBJ(val)); return; case G_TYPE_PARAM: g_value_set_param(result, NIL_P(val) ? NULL : RVAL2GOBJ(val)); return; case G_TYPE_POINTER: g_value_set_pointer(result, NIL_P(val) ? NULL : rbgobj_ptr2cptr(val)); return; case G_TYPE_BOXED: { GType gtype; for (gtype = type; gtype != G_TYPE_INVALID; gtype = g_type_parent(gtype)) { RValueToGValueFunc func = g_type_get_qdata(gtype, qRValueToGValueFunc); if (!func) continue; func(val, result); return; } } default: if (!rbgobj_convert_rvalue2gvalue(fundamental_type, val, result)) { RValueToGValueFunc func = g_type_get_qdata(type, qRValueToGValueFunc); if (!func){ g_warning("rbgobj_rvalue_to_gvalue: unsupported type: %s\n", g_type_name(type)); } else { func(val, result); } } } } /**********************************************************************/ void rbgobj_gc_mark_gvalue(GValue* value) { GType gtype = G_VALUE_TYPE(value); /* FIXME */ if (G_TYPE_FUNDAMENTAL(gtype) == G_TYPE_OBJECT) rbgobj_gc_mark_instance(g_value_get_object(value)); } /**********************************************************************/ static VALUE rg_initialize(VALUE self, VALUE rb_gtype, VALUE rb_value) { GValue value = G_VALUE_INIT; g_value_init(&value, NUM2INT(rb_to_int(rb_gtype))); rbgobj_rvalue_to_gvalue(rb_value, &value); G_INITIALIZE(self, g_boxed_copy(G_TYPE_VALUE, &value)); g_value_unset(&value); return Qnil; } static VALUE rg_type(VALUE self) { GValue *value; value = _SELF(self); return rbgobj_gtype_new(value->g_type); } static VALUE rg_value(VALUE self) { GValue *value; value = _SELF(self); return GVAL2RVAL(value); } static VALUE rg_to_s(VALUE self) { GValue *value; gchar *string_value; value = _SELF(self); string_value = g_strdup_value_contents(value); return CSTR2RVAL_FREE(string_value); } void Init_gobject_gvalue(void) { VALUE RG_TARGET_NAMESPACE; id_to_s = rb_intern("to_s"); qRValueToGValueFunc = g_quark_from_static_string("__ruby_r2g_func__"); qGValueToRValueFunc = g_quark_from_static_string("__ruby_g2r_func__"); RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_VALUE, "Value", mGLib); RG_DEF_METHOD(initialize, 2); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(value, 0); RG_DEF_METHOD(to_s, 0); } ���������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/ruby-glib2.pc�������������������������������������������������0000644�0001750�0001750�00000000156�12446173027�017722� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Name: Ruby/GLib2 Description: Ruby bindings for GLib Type, Object, Parameter and Signal Library Version: 2.2.4������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglibdeprecated.c��������������������������������������������0000644�0001750�0001750�00000003160�11701304107�021030� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" static VALUE rbg_filename_gslist_to_array_free_body(VALUE list) { VALUE ary = rb_ary_new(); GSList *p; for (p = (GSList *)list; p != NULL; p = g_slist_next(p)) rb_ary_push(ary, CSTRFILENAME2RVAL(p->data)); return ary; } static VALUE rbg_filename_gslist_to_array_free_ensure(VALUE val) { GSList *list = (GSList *)val; GSList *p; for (p = list; p != NULL; p = g_slist_next(p)) g_free((gchar *)p->data); g_slist_free(list); return Qnil; } VALUE rbg_filename_gslist_to_array_free(GSList *list) { return rb_ensure(rbg_filename_gslist_to_array_free_body, (VALUE)list, rbg_filename_gslist_to_array_free_ensure, (VALUE)list); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_win32.c������������������������������������������������0000644�0001750�0001750�00000006330�12257552167�020055� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #ifdef G_OS_WIN32 #define RG_TARGET_NAMESPACE mWin32 static VALUE rg_s_error_message(VALUE self, VALUE error) { return CSTR2RVAL_FREE(g_win32_error_message(NUM2INT(error))); } static VALUE rg_s_locale(VALUE self) { return CSTR2RVAL_FREE(g_win32_getlocale()); } static VALUE rbglib_m_win32_locale_deprecated(VALUE self) { rb_warn("GLib.win32_locale() is deprecated. Use GLib::Win32.locale instead"); return rg_s_locale(self); } static VALUE rg_s_version(VALUE self) { return UINT2NUM(g_win32_get_windows_version()); } static VALUE rg_s_locale_filename_from_utf8(VALUE self, VALUE utf8_filename) { return CSTR2RVAL_FREE(g_win32_locale_filename_from_utf8(RVAL2CSTR(utf8_filename))); } static VALUE rbglib_m_win32_locale_filename_from_utf8_deprecated(VALUE self, VALUE utf8_filename) { rb_warn("GLib.win32_locale_filename_from_utf8() is deprecated. Use GLib::Win32.locale_filename_from_utf8 instead"); return rg_s_locale_filename_from_utf8(self, utf8_filename); } # if GLIB_CHECK_VERSION(2, 16, 0) static VALUE rg_s_get_package_installation_directory_of_module(int argc, VALUE *argv, VALUE self) { VALUE rb_module; gchar *directory; gpointer hmodule; rb_scan_args(argc, argv, "01", &rb_module); if (NIL_P(rb_module)) hmodule = NULL; else hmodule = GINT_TO_POINTER(NUM2INT(rb_module)); directory = g_win32_get_package_installation_directory_of_module(hmodule); return CSTR2RVAL_FREE(directory); } # endif #endif void Init_glib_win32(void) { #ifdef G_OS_WIN32 /* glib/gwin32.h */ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Win32"); RG_DEF_SMETHOD(error_message, 1); RG_DEF_SMETHOD(locale, 0); RG_DEF_SMETHOD(version, 0); /* Deprecated */ rbg_define_singleton_method(mGLib, "win32_locale", rbglib_m_win32_locale_deprecated, 0); RG_DEF_SMETHOD(locale_filename_from_utf8, 1); /* Deprecated */ rbg_define_singleton_method(mGLib, "win32_locale_filename_from_utf8", rbglib_m_win32_locale_filename_from_utf8_deprecated, 1); # if GLIB_CHECK_VERSION(2, 16, 0) RG_DEF_SMETHOD(get_package_installation_directory_of_module, -1); # endif #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutildeprecated.h�������������������������������������������0000644�0001750�0001750�00000005464�11701304107�021255� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ #ifndef __RBGUTILDEPRECATED_H__ #define __RBGUTILDEPRECATED_H__ G_BEGIN_DECLS #define G_DEF_SETTER(klass, name) \ rb_funcall(klass, rbgutil_id_module_eval, 1, rb_str_new2( \ "def " name "=(val); set_" name "(val); val; end\n")) #define G_DEF_SETTERS(klass) rbgutil_def_setters(klass) #define GLIST2ARY(list) (rbgutil_glist2ary(list)) #define GLIST2ARY_FREE(list) (rbgutil_glist2ary_and_free(list)) #define GLIST2ARYF(list) (GLIST2ARY_FREE(list)) #define GLIST2ARY2(list, gtype) (rbgutil_glist2ary_boxed(list, gtype)) #define GLIST2ARY2F(list, gtype) (rbgutil_glist2ary_boxed_and_free(list, gtype)) #define GLIST2ARY_STR(list) (rbgutil_glist2ary_string(list)) #define GLIST2ARY_STR_FREE(list) (rbgutil_glist2ary_string_and_free(list)) #define GSLIST2ARY(list) (rbgutil_gslist2ary(list)) #define GSLIST2ARY_FREE(list) (rbgutil_gslist2ary_and_free(list)) #define GSLIST2ARYF(list) (GSLIST2ARY_FREE(list)) #define GSLIST2ARY2(list, gtype) (rbgutil_gslist2ary_boxed(list, gtype)) #define GSLIST2ARY2F(list, gtype) (rbgutil_gslist2ary_boxed_and_free(list, gtype)) #define G_SET_SYMBOL_PROPERTY(gtype, name) \ rbgobj_register_property_getter(gtype, name, rbgutil_sym_g2r_func) #define G_BLOCK_PROC rb_block_proc extern VALUE rbgutil_glist2ary(const GList *list); extern VALUE rbgutil_glist2ary_and_free(GList* list); extern VALUE rbgutil_glist2ary_boxed(const GList *list, GType gtype); extern VALUE rbgutil_glist2ary_boxed_and_free(GList *list, GType gtype); extern VALUE rbgutil_glist2ary_string(const GList *list); extern VALUE rbgutil_glist2ary_string_and_free(GList *list); extern VALUE rbgutil_gslist2ary(const GSList *list); extern VALUE rbgutil_gslist2ary_and_free(GSList *list); extern VALUE rbgutil_gslist2ary_boxed(const GSList *list, GType gtype); extern VALUE rbgutil_gslist2ary_boxed_and_free(GSList *list, GType gtype); G_END_DECLS #endif /* __RBGUTILDEPRECATED_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/extconf.rb����������������������������������������������������0000644�0001750�0001750�00000005137�12516434373�017421� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin extconf.rb for Ruby/GLib extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path mkmf_gnome2_dir = base_dir + 'lib' $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s) module_name = "glib2" package_id = "gobject-2.0" require 'mkmf-gnome2' setup_windows(module_name, base_dir) unless required_pkg_config_package([package_id, 2, 12, 0], :debian => "libglib2.0-dev", :redhat => "glib2-devel", :homebrew => "glib", :macports => "glib2") exit(false) end PKGConfig.have_package('gthread-2.0') have_header("unistd.h") have_header("io.h") glib_header = "glib.h" have_func("g_spawn_close_pid", glib_header) have_func("g_thread_init", glib_header) have_func("g_main_depth", glib_header) have_func("g_listenv", glib_header) ruby_header = "ruby.h" have_func("rb_check_array_type", ruby_header) have_func("rb_check_hash_type", ruby_header) have_func("rb_exec_recursive", ruby_header) have_func("rb_errinfo", ruby_header) have_func("rb_sourcefile", ruby_header) have_func("rb_sourceline", ruby_header) have_func("ruby_set_current_source", ruby_header) have_func("rb_thread_call_without_gvl", ruby_header) have_func("ruby_native_thread_p", ruby_header) have_func("rb_thread_call_with_gvl", ruby_header) have_func("rb_str_new_cstr", ruby_header) have_func("rb_gc_register_mark_object", ruby_header) have_func("rb_exc_new_str", ruby_header) have_var("curr_thread", [ruby_header, "node.h"]) have_var("rb_curr_thread", [ruby_header, "node.h"]) create_pkg_config_file("Ruby/GLib2", package_id) enum_types_prefix = "glib-enum-types" include_paths = PKGConfig.cflags_only_I("glib-2.0") ignore_headers = [ "giochannel.h", "gmain.h", "gscanner.h", ] unless (/mingw|cygwin|mswin/ === RUBY_PLATFORM) ignore_headers << "gwin32.h" end headers = include_paths.split.inject([]) do |result, path| result + Dir.glob(File.join(path.sub(/^-I/, ""), "glib", "*.h")) end.reject do |file| ignore_headers.include?(File.basename(file)) end include_paths = PKGConfig.cflags_only_I("gobject-2.0") headers = include_paths.split.inject(headers) do |result, path| result + Dir.glob(File.join(path.sub(/^-I/, ""), "gobject", "gsignal.h")) end glib_mkenums(enum_types_prefix, headers, "G_TYPE_", ["glib-object.h"]) $defs << "-DRUBY_GLIB2_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 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_mainloop.c���������������������������������������������0000644�0001750�0001750�00000006174�12416346617�020735� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 "rbgprivate.h" /*****************************************/ #if !GLIB_CHECK_VERSION(2,30,0) GType g_main_loop_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GMainLoop", (GBoxedCopyFunc)g_main_loop_ref, (GBoxedFreeFunc)g_main_loop_unref); return our_type; } #endif /*****************************************/ #define RG_TARGET_NAMESPACE cMainLoop #define _SELF(s) ((GMainLoop*)RVAL2BOXED(s, G_TYPE_MAIN_LOOP)) /*****************************************/ static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE context, is_running; GMainLoop *loop; GMainContext *main_context = NULL; rb_scan_args(argc, argv, "02", &context, &is_running); if (!NIL_P(context)) main_context = RVAL2BOXED(context, G_TYPE_MAIN_CONTEXT); loop = g_main_loop_new(main_context, RVAL2CBOOL(is_running)); G_INITIALIZE(self, loop); return Qnil; } static gboolean quit_loop(gpointer user_data) { GMainLoop *loop = user_data; g_main_loop_quit(loop); return G_SOURCE_REMOVE; } static VALUE rg_run(VALUE self) { GMainLoop *loop; GSource *interrupt_source; loop = _SELF(self); interrupt_source = rbg_interrupt_source_new(); g_source_set_callback(interrupt_source, quit_loop, loop, NULL); g_source_attach(interrupt_source, g_main_loop_get_context(loop)); g_main_loop_run(loop); g_source_destroy(interrupt_source); g_source_unref(interrupt_source); rb_thread_check_ints(); return self; } static VALUE rg_quit(VALUE self) { g_main_loop_quit(_SELF(self)); return Qnil; } static VALUE rg_running_p(VALUE self) { return CBOOL2RVAL(g_main_loop_is_running(_SELF(self))); } static VALUE rg_context(VALUE self) { return BOXED2RVAL(g_main_loop_get_context(_SELF(self)), G_TYPE_MAIN_CONTEXT); } void Init_glib_main_loop(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_LOOP, "MainLoop", mGLib); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(run, 0); RG_DEF_METHOD(quit, 0); RG_DEF_METHOD_P(running, 0); RG_DEF_METHOD(context, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_convert.c����������������������������������������������0000644�0001750�0001750�00000011370�12446160551�020567� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team * Copyright (C) 2006 Sjoerd Simons, 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 "rbgobject.h" #include "rbgprivate.h" static GHashTable *tables, *class_to_g_type_map; static void rg_convert_table_free(gpointer data) { RGConvertTable *table = data; if (table->notify) { table->notify(table->user_data); } g_free(table); } void Init_gobject_convert(void) { /* TODO: unref the below tables on exit. */ tables = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, rg_convert_table_free); class_to_g_type_map = g_hash_table_new(g_direct_hash, g_direct_equal); } void rbgobj_convert_define(const RGConvertTable *table) { RGConvertTable *copied_table; copied_table = g_memdup(table, sizeof(RGConvertTable)); g_hash_table_insert(tables, GUINT_TO_POINTER(copied_table->type), copied_table); if (copied_table->klass != Qfalse && !NIL_P(copied_table->klass)) { g_hash_table_insert(class_to_g_type_map, GUINT_TO_POINTER(copied_table->klass), GUINT_TO_POINTER(copied_table->type)); } } RGConvertTable * rbgobj_convert_lookup(GType type) { return g_hash_table_lookup(tables, GUINT_TO_POINTER(type)); } gboolean rbgobj_convert_has_type(GType type) { return rbgobj_convert_lookup(type) != NULL; } gboolean rbgobj_convert_get_superclass(GType type, VALUE *result) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->get_superclass) { *result = table->get_superclass(table->user_data); return TRUE; } return FALSE; } gboolean rbgobj_convert_type_init_hook(GType type, VALUE klass) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->type_init_hook) { table->type_init_hook(klass, table->user_data); return TRUE; } return FALSE; } gboolean rbgobj_convert_rvalue2gvalue(GType type, VALUE value, GValue *result) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->rvalue2gvalue) { table->rvalue2gvalue(value, result, table->user_data); return TRUE; } return FALSE; } gboolean rbgobj_convert_gvalue2rvalue(GType type, const GValue *value, VALUE *result) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->gvalue2rvalue) { *result = table->gvalue2rvalue(value, table->user_data); return TRUE; } return FALSE; } GType rbgobj_convert_rvalue2gtype(VALUE value) { VALUE klass; gpointer result; klass = rb_class_of(value); result = g_hash_table_lookup(class_to_g_type_map, GUINT_TO_POINTER(klass)); return GPOINTER_TO_UINT(result); } gboolean rbgobj_convert_initialize(GType type, VALUE obj, gpointer cobj) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->initialize) { table->initialize(obj, cobj, table->user_data); return TRUE; } return FALSE; } gboolean rbgobj_convert_robj2instance(GType type, VALUE obj, gpointer *result) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->robj2instance) { *result = table->robj2instance(obj, table->user_data); return TRUE; } return FALSE; } gboolean rbgobj_convert_instance2robj(GType type, gpointer instance, VALUE *result) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->instance2robj) { *result = table->instance2robj(instance, table->user_data); return TRUE; } return FALSE; } gboolean rbgobj_convert_unref(GType type, gpointer instance) { RGConvertTable *table; table = rbgobj_convert_lookup(type); if (table && table->unref) { table->unref(instance, table->user_data); return TRUE; } return FALSE; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_spawn.c������������������������������������������������0000664�0001750�0001750�00000016274�11740310343�020235� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Masao Mutoh * Copyright (C) 2004 Kazuhiro NISHIYAMA * * 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mSpawn static ID id_call; static ID id_new; static void child_setup(gpointer func) { if (! NIL_P(func)){ rb_funcall((VALUE)func, id_call, 0); } } static VALUE rg_s_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags) { GError *err = NULL; gboolean ret; GPid 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 = g_spawn_async_with_pipes(RVAL2CSTR_ACCEPT_NIL(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((gint)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_s_async(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags) { GError *err = NULL; gboolean ret; GPid 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 = g_spawn_async(RVAL2CSTR_ACCEPT_NIL(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((int)child_pid); } static VALUE rg_s_sync(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags) { GError *err = NULL; gboolean ret; VALUE func = Qnil; gchar** gargv; gchar** genvp; gchar *standard_output = NULL, *standard_error = NULL; gint exit_status; VALUE std_out, std_err; if (rb_block_given_p()) { func = rb_block_proc(); G_RELATIVE(self, func); } gargv = (gchar **)RVAL2STRV(argv); genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp); ret = g_spawn_sync(RVAL2CSTR_ACCEPT_NIL(working_directory), gargv, genvp, NUM2INT(flags), (GSpawnChildSetupFunc)child_setup, (gpointer)func, &standard_output, &standard_error, &exit_status, &err); g_free(gargv); g_free(genvp); if (!ret) RAISE_GERROR(err); if (standard_output) { std_out = CSTR2RVAL(standard_output); g_free(standard_output); } else { std_out = Qnil; standard_output = NULL; } if (standard_error) { std_err = CSTR2RVAL(standard_error); g_free(standard_error); standard_error = NULL; } else { std_err = Qnil; } if (! ret) RAISE_GERROR(err); return rb_ary_new3(3, std_out, std_err, INT2FIX(exit_status)); } static VALUE rg_s_command_line_sync(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; const gchar *command_line; gchar *standard_output = NULL, *standard_error = NULL; gint exit_status; VALUE std_out, std_err; gboolean ret; command_line = RVAL2CSTR(str); ret = g_spawn_command_line_sync(command_line, &standard_output, &standard_error, &exit_status, &err); if (standard_output) { std_out = CSTR2RVAL(standard_output); g_free(standard_output); } else { std_out = Qnil; standard_output = NULL; } if (standard_error) { std_err = CSTR2RVAL(standard_error); g_free(standard_error); standard_error = NULL; } else { std_err = Qnil; } if (! ret) RAISE_GERROR(err); return rb_ary_new3(3, std_out, std_err, INT2FIX(exit_status)); } static VALUE rg_s_command_line_async(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; const gchar *command_line; VALUE ret; command_line = StringValuePtr(str); ret = CBOOL2RVAL(g_spawn_command_line_async(command_line, &err)); if (err != NULL) RAISE_GERROR(err); return ret; } #ifdef HAVE_G_SPAWN_CLOSE_PID #define RVAL2GPID(value) ((GPid)NUM2INT(pid)) static VALUE rg_s_close_pid(G_GNUC_UNUSED VALUE self, VALUE pid) { g_spawn_close_pid(RVAL2GPID(pid)); return Qnil; } #endif void Init_glib_spawn(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Spawn"); id_call = rb_intern("call"); id_new = rb_intern("new"); /* glib/gspawn.h */ RG_DEF_SMETHOD(async_with_pipes, 4); RG_DEF_SMETHOD(async, 4); RG_DEF_SMETHOD(sync, 4); RG_DEF_SMETHOD(command_line_sync, 1); RG_DEF_SMETHOD(command_line_async, 1); #ifdef HAVE_G_SPAWN_CLOSE_PID RG_DEF_SMETHOD(close_pid, 1); #endif rb_define_const(RG_TARGET_NAMESPACE, "LEAVE_DESCRIPTORS_OPEN", INT2NUM(G_SPAWN_LEAVE_DESCRIPTORS_OPEN)); rb_define_const(RG_TARGET_NAMESPACE, "DO_NOT_REAP_CHILD", INT2NUM(G_SPAWN_DO_NOT_REAP_CHILD)); rb_define_const(RG_TARGET_NAMESPACE, "SEARCH_PATH", INT2NUM(G_SPAWN_SEARCH_PATH)); rb_define_const(RG_TARGET_NAMESPACE, "STDOUT_TO_DEV_NULL", INT2NUM(G_SPAWN_STDOUT_TO_DEV_NULL)); rb_define_const(RG_TARGET_NAMESPACE, "STDERR_TO_DEV_NULL", INT2NUM(G_SPAWN_STDERR_TO_DEV_NULL)); rb_define_const(RG_TARGET_NAMESPACE, "CHILD_INHERITS_STDIN", INT2NUM(G_SPAWN_CHILD_INHERITS_STDIN)); rb_define_const(RG_TARGET_NAMESPACE, "FILE_AND_ARGV_ZERO", INT2NUM(G_SPAWN_FILE_AND_ARGV_ZERO)); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/depend��������������������������������������������������������0000644�0001750�0001750�00000001313�12064346475�016603� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rbglib.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbglibdeprecated.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbglib2conversions.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgutil.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgutil_list.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgutildeprecated.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgobject.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgcompat.h $(RUBYARCHDIR) $(INSTALL_DATA) glib-enum-types.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-glib2.pc $(pkgconfigdir); \ fi ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_unicode.c����������������������������������������������0000664�0001750�0001750�00000005511�11740310343�020523� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mUnicode static VALUE rbglib_m_charset(G_GNUC_UNUSED VALUE self) { const char *charset; g_get_charset(&charset); return CSTR2RVAL(charset); } static VALUE rg_s_canonical_ordering(G_GNUC_UNUSED VALUE self, VALUE rb_ucs4) { VALUE normalized_ucs4; gchar *original_str; gunichar *ucs4; gint len; original_str = StringValuePtr(rb_ucs4); len = RSTRING_LEN(rb_ucs4); ucs4 = g_memdup(original_str, len); g_unicode_canonical_ordering(ucs4, len); normalized_ucs4 = CSTR2RVAL_LEN_UCS4((const char *)ucs4, len); g_free(ucs4); return normalized_ucs4; } static VALUE rg_s_canonical_decomposition(G_GNUC_UNUSED VALUE self, VALUE unichar) { VALUE normalized_ucs4; gunichar *ucs4; gsize len; ucs4 = g_unicode_canonical_decomposition(NUM2UINT(unichar), &len); normalized_ucs4 = CSTR2RVAL_LEN_UCS4((const char *)ucs4, len * sizeof(gunichar)); g_free(ucs4); return normalized_ucs4; } void Init_glib_unicode(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Unicode"); /* GUnicodeType */ G_DEF_CLASS(G_TYPE_UNICODE_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_UNICODE_TYPE, "G_UNICODE_"); /* GUnicodeBreakType */ G_DEF_CLASS(G_TYPE_UNICODE_BREAK_TYPE, "BreakType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_UNICODE_BREAK_TYPE, "G_UNICODE_"); #if GLIB_CHECK_VERSION(2,14,0) /* GUnicodeScript */ G_DEF_CLASS(G_TYPE_UNICODE_SCRIPT, "Script", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_UNICODE_SCRIPT, "G_UNICODE_"); #endif G_DEF_CLASS(G_TYPE_NORMALIZE_MODE, "NormalizeMode", mGLib); rbg_define_singleton_method(mGLib, "charset", rbglib_m_charset, 0); RG_DEF_SMETHOD(canonical_ordering, 1); RG_DEF_SMETHOD(canonical_decomposition, 1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_pollfd.c�����������������������������������������������0000644�0001750�0001750�00000005262�12124610262�020356� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" /*****************************************/ static GPollFD* pollfd_copy(const GPollFD* pollfd) { GPollFD* new_pollfd; g_return_val_if_fail (pollfd != NULL, NULL); new_pollfd = g_new(GPollFD, 1); *new_pollfd = *pollfd; return new_pollfd; } GType g_poll_fd_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GPollFD", (GBoxedCopyFunc)pollfd_copy, (GBoxedFreeFunc)g_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cPollFD #define _SELF(s) ((GPollFD*)RVAL2BOXED(s, G_TYPE_POLL_FD)) static VALUE rg_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents) { GPollFD gfd; gfd.fd = NUM2INT(fd); gfd.events = NUM2INT(events); gfd.revents = NUM2INT(revents); G_INITIALIZE(self, g_boxed_copy(G_TYPE_POLL_FD, &gfd)); return Qnil; } static VALUE rg_set_fd(VALUE self, VALUE fd) { _SELF(self)->fd = fd; return self; } static VALUE rg_fd(VALUE self) { return INT2NUM(_SELF(self)->fd); } static VALUE rg_set_events(VALUE self, VALUE events) { _SELF(self)->events = events; return self; } static VALUE rg_events(VALUE self) { return INT2NUM(_SELF(self)->events); } static VALUE rg_set_revents(VALUE self, VALUE revents) { _SELF(self)->revents = revents; return self; } static VALUE rg_revents(VALUE self) { return INT2NUM(_SELF(self)->revents); } void Init_glib_poll_fd(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_POLL_FD, "PollFD", mGLib); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(set_fd, 1); RG_DEF_METHOD(fd, 0); RG_DEF_METHOD(set_events, 1); RG_DEF_METHOD(events, 0); RG_DEF_METHOD(set_revents, 1); RG_DEF_METHOD(revents, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_strv.c�������������������������������������������������0000644�0001750�0001750�00000002561�12257552167�020117� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" static VALUE strv_to_ruby(const GValue *from) { return STRV2RVAL((const gchar **)g_value_get_boxed(from)); } static void strv_from_ruby(VALUE from, GValue *to) { const gchar **strings = RVAL2STRV(from); g_value_set_boxed(to, strings); g_free(strings); } void Init_gobject_gstrv(void) { /* GStrv is treated as Array */ rbgobj_register_g2r_func(G_TYPE_STRV, strv_to_ruby); rbgobj_register_r2g_func(G_TYPE_STRV, strv_from_ruby); } �����������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutil.c�����������������������������������������������������0000644�0001750�0001750�00000011074�12516434313�017231� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 "rbgprivate.h" ID rbgutil_id_module_eval; static ID id_add_one_arg_setter; static ID id_set_property; static ID id_to_a; static ID id_allocate; static ID id_equal; void rbg_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc) { rb_define_method(klass, name, func, argc); if ((argc != 1) || strncmp(name, "set_", 4)) return; name += 4; rb_funcall(klass, rbgutil_id_module_eval, 1, CSTR2RVAL_FREE(g_strdup_printf("def %s=(val); set_%s(val); val; end\n", name, name))); } void rbg_define_singleton_method(VALUE obj, const char *name, VALUE (*func)(ANYARGS), int argc) { rb_define_singleton_method(obj, name, func, argc); if ((argc != 1) || strncmp(name, "set_", 4)) return; name += 4; rb_funcall(obj, rbgutil_id_module_eval, 1, CSTR2RVAL_FREE(g_strdup_printf("def self.%s=(val); set_%s(val); val; end\n", name, name))); } void rbgutil_set_properties(VALUE self, VALUE hash) { int i; VALUE ary; GObject* obj; Check_Type(hash, RUBY_T_HASH); ary = rb_funcall(hash, id_to_a, 0); obj = RVAL2GOBJ(self); g_object_freeze_notify(obj); for (i = 0; i < RARRAY_LEN(ary); i++) { rb_funcall(self, id_set_property, 2, RARRAY_PTR(RARRAY_PTR(ary)[i])[0], RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); } g_object_thaw_notify(obj); } VALUE rbgutil_def_setters(VALUE klass) { return rb_funcall(mGLib, id_add_one_arg_setter, 1, klass); } void rbgutil_glibid_r2g_func(VALUE from, GValue* to) { VALUE buffer; g_value_set_string(to, RVAL2GLIBID(from, buffer)); } VALUE rbgutil_sym_g2r_func(const GValue *from) { const gchar *str = g_value_get_string(from); return str ? ID2SYM(rb_intern(str)) : Qnil; } VALUE rbgutil_generic_s_gtype(VALUE klass) { return rbgobj_gtype_new(CLASS2GTYPE(klass)); } VALUE rbgutil_generic_gtype(VALUE self) { return generic_s_gtype(CLASS_OF(self)); } VALUE rbgutil_string_set_utf8_encoding(VALUE string) { #ifdef HAVE_RUBY_ENCODING_H if (!NIL_P(string)) rb_enc_associate(string, rb_utf8_encoding()); #endif return string; } gboolean rbgutil_key_equal(VALUE rb_key, const char *key) { switch (TYPE(rb_key)) { case RUBY_T_STRING: return RVAL2CBOOL(rb_funcall(rb_key, id_equal, 1, rb_str_new_cstr(key))); break; case RUBY_T_SYMBOL: return SYM2ID(rb_key) == rb_intern(key); break; default: return FALSE; break; } } static gboolean rbg_interrupt_prepare (G_GNUC_UNUSED GSource *soruce, G_GNUC_UNUSED gint *timouet) { return rb_thread_interrupted(rb_thread_current()); } static gboolean rbg_interrupt_check (G_GNUC_UNUSED GSource *soruce) { return rb_thread_interrupted(rb_thread_current()); } static gboolean rbg_interrupt_dispatch (G_GNUC_UNUSED GSource *soruce, GSourceFunc callback, gpointer user_data) { if (callback) { return callback(user_data); } else { return G_SOURCE_REMOVE; } } static GSourceFuncs rbg_interrupt_funcs = { rbg_interrupt_prepare, rbg_interrupt_check, rbg_interrupt_dispatch, NULL }; GSource * rbg_interrupt_source_new(void) { return g_source_new(&rbg_interrupt_funcs, sizeof(GSource)); } void Init_gutil(void) { rbgutil_id_module_eval = rb_intern("module_eval"); id_set_property = rb_intern("set_property"); id_to_a = rb_intern("to_a"); id_add_one_arg_setter = rb_intern("__add_one_arg_setter"); id_allocate = rb_intern("allocate"); id_equal = rb_intern("=="); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_bookmarkfile.c�����������������������������������������0000644�0001750�0001750�00000036415�12257552167�021567� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgprivate.h" /************************************************/ static GBookmarkFile* bookmarkfile_copy(const GBookmarkFile* file) { /* GBookmarkFile* new_file; g_return_val_if_fail (file != NULL, NULL); new_file = g_key_file_new(); *new_file = (GBookmarkFile*)*file; return new_file; */ return (GBookmarkFile*)file; } static GType g_bookmark_file_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static("GBookmarkFile", (GBoxedCopyFunc)bookmarkfile_copy, (GBoxedFreeFunc)g_bookmark_file_free); return our_type; } /************************************************/ #define G_TYPE_BOOKMARK_FILE (g_bookmark_file_get_type()) #define RG_TARGET_NAMESPACE cBookmarkFile #define _SELF(self) ((GBookmarkFile*)(RVAL2BOXED(self, G_TYPE_BOOKMARK_FILE))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, g_bookmark_file_new()); return Qnil; } static VALUE rg_load_from_file(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); GError* error = NULL; gboolean ret = g_bookmark_file_load_from_file(_SELF(self), filename, &error); g_free(filename); if (!ret) RAISE_GERROR(error); return self; } static VALUE rg_load_from_data(VALUE self, VALUE data) { GError *error = NULL; StringValue(data); if (!g_bookmark_file_load_from_data(_SELF(self), RSTRING_PTR(data), RSTRING_LEN(data), &error)) RAISE_GERROR(error); return Qnil; } static VALUE rg_load_from_data_dirs(VALUE self, VALUE file) { GError* error = NULL; gboolean ret; gchar* full_path; ret = g_bookmark_file_load_from_data_dirs(_SELF(self), RVAL2CSTR(file), &full_path, &error); if (! ret) RAISE_GERROR(error); return full_path ? CSTR2RVAL(full_path) : Qnil; } static VALUE rg_to_data(VALUE self) { GError* error = NULL; gchar* data = g_bookmark_file_to_data(_SELF(self), NULL, &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(data); } static VALUE rg_to_file(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); GError* error = NULL; gboolean ret = g_bookmark_file_to_file(_SELF(self), filename, &error); g_free(filename); if (!ret) RAISE_GERROR(error); return self; } static VALUE rg_has_item_p(VALUE self, VALUE uri) { return CBOOL2RVAL(g_bookmark_file_has_item(_SELF(self), RVAL2CSTR(uri))); } static VALUE rg_has_group_p(VALUE self, VALUE uri, VALUE group) { GError* error = NULL; return CBOOL2RVAL(g_bookmark_file_has_group(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(group), &error)); } static VALUE rg_has_application_p(VALUE self, VALUE uri, VALUE name) { GError* error = NULL; return CBOOL2RVAL(g_bookmark_file_has_application(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(name), &error)); } static VALUE rg_size(VALUE self) { return INT2NUM(g_bookmark_file_get_size(_SELF(self))); } static VALUE rg_uris(VALUE self) { return STRV2RVAL_FREE(g_bookmark_file_get_uris(_SELF(self), NULL)); } static VALUE rg_get_title(VALUE self, VALUE uri) { GError *error = NULL; gchar* ret = g_bookmark_file_get_title(_SELF(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_get_description(VALUE self, VALUE uri) { GError *error = NULL; gchar* ret = g_bookmark_file_get_description(_SELF(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_get_mime_type(VALUE self, VALUE uri) { GError *error = NULL; gchar* ret = g_bookmark_file_get_mime_type(_SELF(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_private_p(VALUE self, VALUE uri) { GError *error = NULL; gboolean ret = g_bookmark_file_get_is_private(_SELF(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(ret); } static VALUE rg_get_icon(VALUE self, VALUE uri) { gchar* href; gchar* mime_type; GError *error = NULL; gboolean ret = g_bookmark_file_get_icon(_SELF(self), RVAL2CSTR(uri), &href, &mime_type, &error); if (!ret){ if (error) RAISE_GERROR(error); return Qnil; } return rb_assoc_new(CSTR2RVAL_FREE(href), CSTR2RVAL_FREE(mime_type)); } static VALUE rg_get_added(VALUE self, VALUE uri) { GError *error = NULL; time_t ret = g_bookmark_file_get_added(_SELF(self), RVAL2CSTR(uri), &error); if (!ret) RAISE_GERROR(error); return rb_time_new(ret, 0); } static VALUE rg_get_modified(VALUE self, VALUE uri) { GError *error = NULL; time_t ret = g_bookmark_file_get_modified(_SELF(self), RVAL2CSTR(uri), &error); if (!ret) RAISE_GERROR(error); return rb_time_new(ret, 0); } static VALUE rg_get_visited(VALUE self, VALUE uri) { GError *error = NULL; time_t ret = g_bookmark_file_get_visited(_SELF(self), RVAL2CSTR(uri), &error); if (!ret) RAISE_GERROR(error); return rb_time_new(ret, 0); } static VALUE rg_get_groups(VALUE self, VALUE uri) { gsize length; VALUE ary; gsize i; GError* error = NULL; gchar** ret = g_bookmark_file_get_groups(_SELF(self), RVAL2CSTR(uri), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(ret[i])); } g_strfreev(ret); return ary; } static VALUE rg_get_applications(VALUE self, VALUE uri) { gsize length; VALUE ary; gsize i; GError* error = NULL; gchar** ret = g_bookmark_file_get_applications(_SELF(self), RVAL2CSTR(uri), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(ret[i])); } g_strfreev(ret); return ary; } static VALUE rg_get_app_info(VALUE self, VALUE uri, VALUE name) { gchar* exec; guint count; time_t stamp; GError* error = NULL; gboolean ret = g_bookmark_file_get_app_info(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(name), &exec, &count, &stamp, &error); if (!ret) RAISE_GERROR(error); return rb_ary_new3(3, CSTR2RVAL(exec), UINT2NUM(count), rb_time_new(stamp, 0)); } static VALUE rg_set_title(VALUE self, VALUE uri, VALUE title) { g_bookmark_file_set_title(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(title)); return self; } static VALUE rg_set_description(VALUE self, VALUE uri, VALUE description) { g_bookmark_file_set_description(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(description)); return self; } static VALUE rg_set_mime_type(VALUE self, VALUE uri, VALUE mime_type) { g_bookmark_file_set_mime_type(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(mime_type)); return self; } static VALUE rg_set_private(VALUE self, VALUE uri, VALUE is_private) { g_bookmark_file_set_is_private(_SELF(self), RVAL2CSTR(uri), RVAL2CBOOL(is_private)); return self; } static VALUE rg_set_icon(VALUE self, VALUE uri, VALUE href, VALUE mime_type) { g_bookmark_file_set_icon(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(href), RVAL2CSTR(mime_type)); return self; } static VALUE rg_set_added(VALUE self, VALUE uri, VALUE time) { g_bookmark_file_set_added(_SELF(self), RVAL2CSTR(uri), (time_t)NUM2LONG(rb_Integer(time))); return self; } static VALUE rg_set_groups(VALUE self, VALUE rburi, VALUE rbgroups) { GBookmarkFile *bookmark = _SELF(self); const gchar *uri = RVAL2CSTR(rburi); long n; const gchar **groups = RVAL2STRS(rbgroups, n); g_bookmark_file_set_groups(bookmark, uri, groups, n); g_free(groups); return self; } static VALUE rg_set_modified(VALUE self, VALUE uri, VALUE time) { g_bookmark_file_set_modified(_SELF(self), RVAL2CSTR(uri), (time_t)NUM2LONG(rb_Integer(time))); return self; } static VALUE rg_set_visited(VALUE self, VALUE uri, VALUE time) { g_bookmark_file_set_visited(_SELF(self), RVAL2CSTR(uri), (time_t)NUM2LONG(rb_Integer(time))); return self; } static VALUE rg_set_app_info(VALUE self, VALUE uri, VALUE name, VALUE exec, VALUE count, VALUE stamp) { GError* error = NULL; gboolean ret = g_bookmark_file_set_app_info(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(name), RVAL2CSTR(exec), NUM2INT(count), (time_t)NUM2LONG(rb_Integer(stamp)), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_add_group(VALUE self, VALUE uri, VALUE group) { g_bookmark_file_add_group(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(group)); return self; } static VALUE rg_add_application(VALUE self, VALUE uri, VALUE name, VALUE exec) { g_bookmark_file_add_application(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(name), RVAL2CSTR(exec)); return self; } static VALUE rg_remove_group(VALUE self, VALUE uri, VALUE group) { GError* error = NULL; gboolean ret = g_bookmark_file_remove_group(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(group), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_remove_application(VALUE self, VALUE uri, VALUE name) { GError *error = NULL; gboolean ret = g_bookmark_file_remove_application(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(name), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_remove_item(VALUE self, VALUE uri) { GError *error = NULL; gboolean ret = g_bookmark_file_remove_item(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_move_item(VALUE self, VALUE old_uri, VALUE new_uri) { GError *error = NULL; gboolean ret = g_bookmark_file_move_item(_SELF(self), RVAL2CSTR(old_uri), RVAL2CSTR(new_uri), &error); if (! ret) RAISE_GERROR(error); return self; } void Init_glib_bookmark_file(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BOOKMARK_FILE, "BookmarkFile", mGLib); G_DEF_ERROR(G_BOOKMARK_FILE_ERROR, "BookmarkFileError", mGLib, rb_eRuntimeError, G_TYPE_BOOKMARK_FILE_ERROR); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(load_from_file, 1); RG_DEF_METHOD(load_from_data, 1); RG_DEF_METHOD(load_from_data_dirs, 1); RG_DEF_METHOD(to_data, 0); RG_DEF_METHOD(to_file, 1); RG_DEF_METHOD_P(has_item, 1); RG_DEF_METHOD_P(has_group, 2); RG_DEF_METHOD_P(has_application, 2); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(get_title, 1); RG_DEF_METHOD(get_description, 1); RG_DEF_METHOD(get_mime_type, 1); RG_DEF_METHOD_P(private, 1); RG_DEF_METHOD(get_icon, 1); RG_DEF_METHOD(get_added, 1); RG_DEF_METHOD(get_modified, 1); RG_DEF_METHOD(get_visited, 1); RG_DEF_METHOD(get_groups, 1); RG_DEF_METHOD(get_applications, 1); RG_DEF_METHOD(get_app_info, 2); RG_DEF_METHOD(set_title, 2); RG_DEF_METHOD(set_description, 2); RG_DEF_METHOD(set_mime_type, 2); RG_DEF_METHOD(set_private, 2); RG_DEF_METHOD(set_icon, 3); RG_DEF_METHOD(set_added, 2); RG_DEF_METHOD(set_groups, 2); RG_DEF_METHOD(set_modified, 2); RG_DEF_METHOD(set_visited, 2); RG_DEF_METHOD(set_app_info, 5); RG_DEF_METHOD(add_group, 2); RG_DEF_METHOD(add_application, 3); RG_DEF_METHOD(remove_group, 2); RG_DEF_METHOD(remove_application, 2); RG_DEF_METHOD(remove_item, 1); RG_DEF_METHOD(move_item, 2); }���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib.h������������������������������������������������������0000644�0001750�0001750�00000017453�12516434313�017036� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 Ruby-GNOME2 Project Team * Copyright (C) 2002-2005 Ruby-GNOME2 Project * Copyright (C) 2002,2003 Masahiro Sakai * * 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 <glib-object.h> #include "ruby.h" #include "rbglibdeprecated.h" #include "rbglib2conversions.h" #ifndef __RBGLIB_H__ #define __RBGLIB_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define RBGLIB_MAJOR_VERSION 2 #define RBGLIB_MINOR_VERSION 2 #define RBGLIB_MICRO_VERSION 5 #ifndef RSTRING_PTR # define RSTRING_PTR(s) (RSTRING(s)->ptr) # define RSTRING_LEN(s) (RSTRING(s)->len) #endif #ifndef RARRAY_PTR # define RARRAY_PTR(s) (RARRAY(s)->ptr) # define RARRAY_LEN(s) (RARRAY(s)->len) #endif #ifndef DBL2NUM # define DBL2NUM(v) (rb_float_new(v)) #endif #ifndef RBASIC_CLASS # define RBASIC_CLASS(obj) (RBASIC(obj)->klass) #endif #ifndef G_SOURCE_REMOVE # define G_SOURCE_REMOVE FALSE #endif #ifndef G_SOURCE_CONTINUE # define G_SOURCE_CONTINUE TRUE #endif #define RBG_INSPECT(object) (rbg_rval_inspect(object)) #define RVAL2CSTR(v) (rbg_rval2cstr(&(v))) #define RVAL2CSTR_ACCEPT_NIL(v) (rbg_rval2cstr_accept_nil(&(v))) #define RVAL2CSTR2(v) (RVAL2CSTR_ACCEPT_NIL(v)) #define RVAL2CSTR_ACCEPT_SYMBOL(v) (rbg_rval2cstr_accept_symbol(&(v))) #define RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(v) (rbg_rval2cstr_accept_symbol_accept_nil(&(v))) #define RVAL2GLIBID(v, buf) (rbg_rval2glibid(&(v), &(buf), FALSE)) #define RVAL2GLIBID_ACCEPT_NIL(v, buf) (rbg_rval2glibid(&(v), &(buf), TRUE)) #define CSTR2RVAL(s) (rbg_cstr2rval(s)) #define CSTR2RVAL_LEN(s, l) (rbg_cstr2rval_len(s, l)) #define CSTR2RVAL_LEN_FREE(s, l) (rbg_cstr2rval_len_free(s, l)) #define CSTR2RVAL_ENC(s, e) (rbg_cstr2rval_with_encoding(s, e)) #define CSTR2RVAL_LEN_ENC(s, l, e) (rbg_cstr2rval_len_with_encoding(s, l, e)) #define CSTR2RVAL_FREE(s) (rbg_cstr2rval_free(s)) #define CSTR2RVAL2(s) (CSTR2RVAL_FREE(s)) #if G_BYTE_ORDER == G_LITTLE_ENDIAN # define CSTR2RVAL_LEN_UCS4(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-32LE")) # define CSTR2RVAL_LEN_UTF16(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-16LE")) #else # define CSTR2RVAL_LEN_UCS4(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-32BE")) # define CSTR2RVAL_LEN_UTF16(s, l) (CSTR2RVAL_LEN_ENC(s, l, "UTF-16BE")) #endif #define RVAL2CSTRFILENAME(v) (rbg_filename_from_ruby(v)) #define CSTRFILENAME2RVAL(s) (rbg_filename_to_ruby(s)) #define CSTRFILENAME2RVAL_FREE(s) (rbg_filename_to_ruby_free(s)) #define RVAL2STRS(ary, n) rbg_rval2strv(&(ary), &(n)) #define RVAL2STRS_ACCEPT_NIL(ary, n) rbg_rval2strv_accept_nil(&(ary), &(n)) #define RVAL2STRV(ary) rbg_rval2strv(&(ary), NULL) #define RVAL2STRV_ACCEPT_NIL(ary) rbg_rval2strv_accept_nil(&(ary), NULL) #define RVAL2STRS_DUP(ary, n) rbg_rval2strv_dup(&(ary), &(n)) #define RVAL2STRS_DUP_ACCEPT_NIL(ary, n) rbg_rval2strv_dup_accept_nil(&(ary), &(n)) #define RVAL2STRV_DUP(ary) rbg_rval2strv_dup(&(ary), NULL) #define RVAL2STRV_DUP_ACCEPT_NIL(ary) rbg_rval2strv_dup_accept_nil(&(ary), NULL) #define STRV2RVAL(strings) rbg_strv2rval(strings) #define STRV2RVAL_FREE(strings) rbg_strv2rval_free(strings) #define RVAL2GBOOLEANS(ary, n) rbg_rval2gbooleans(&(ary), &(n)) #define RVAL2GINTS(ary, n) rbg_rval2gints(&(ary), &(n)) #define RVAL2GINT8S(ary, n) rbg_rval2gint8s(&(ary), &(n)) #define RVAL2GUINT8S(ary, n) rbg_rval2guint8s(&(ary), &(n)) #define RVAL2GUINT16S(ary, n) rbg_rval2guint16s(&(ary), &(n)) #define RVAL2GUINT32S(ary, n) rbg_rval2guint32s(&(ary), &(n)) #define RVAL2GDOUBLES(ary, n) rbg_rval2gdoubles(&(ary), &(n)) #define GINTS2RVAL(ary, n) rbg_gints2rval(ary, n) #define GINTS2RVAL_FREE(ary, n) rbg_gints2rval(ary, n) #define CBOOL2RVAL(b) ((b) ? Qtrue : Qfalse) #define RVAL2CBOOL(b) (RTEST(b)) #define GERROR2RVAL(error) (rbgerr_gerror2exception(error)) #define RG_RAISE_ERROR(error) rb_exc_raise(GERROR2RVAL(error)) #define RAISE_GERROR(error) RG_RAISE_ERROR(error) /* deprecated */ #define G_DEF_ERROR(domain, name, module, parent, gtype) \ rbgerr_define_gerror(domain, name, module, parent, gtype) #define G_DEF_ERROR2(domain, name, module, parent) \ rbgerr_define_gerror(domain, name, module, parent, G_TYPE_INVALID) #if defined(G_PLATFORM_WIN32) && !defined(RUBY_GLIB2_STATIC_COMPILATION) # ifdef RUBY_GLIB2_COMPILATION # define RUBY_GLIB2_VAR __declspec(dllexport) # else # define RUBY_GLIB2_VAR extern __declspec(dllimport) # endif #else # define RUBY_GLIB2_VAR extern #endif RUBY_GLIB2_VAR VALUE mGLib; extern const gchar *rbg_rval_inspect(VALUE object); extern gchar* rbg_string_value_ptr(volatile VALUE* ptr); /* no longer used */ extern const gchar *rbg_rval2cstr(VALUE *str); extern const gchar *rbg_rval2cstr_accept_nil(VALUE *str); extern const gchar *rbg_rval2cstr_accept_symbol(volatile VALUE *value); extern const gchar *rbg_rval2cstr_accept_symbol_accept_nil(volatile VALUE *value); extern const gchar *rbg_rval2glibid(volatile VALUE *value, volatile VALUE *buf, gboolean accept_nil); extern VALUE rbg_cstr2rval(const gchar* str); extern VALUE rbg_cstr2rval_len(const gchar* str, gsize len); extern VALUE rbg_cstr2rval_len_free(gchar *str, gsize len); extern VALUE rbg_cstr2rval_with_encoding(const gchar* str, const gchar *encoding); extern VALUE rbg_cstr2rval_len_with_encoding(const gchar* str, gsize len, const gchar *encoding); extern VALUE rbg_cstr2rval_free(gchar *str); /* just for backward compatibility. */ extern VALUE rbg_cstr2rval_with_free(gchar *str); VALUE rbg_filename_to_ruby(const gchar *filename); extern VALUE rbg_filename_to_ruby_free(gchar *filename); extern gchar *rbg_filename_from_ruby(VALUE filename); const gchar **rbg_rval2strv(volatile VALUE *value, long *n); const gchar **rbg_rval2strv_accept_nil(volatile VALUE *value, long *n); gchar **rbg_rval2strv_dup(volatile VALUE *value, long *n); gchar **rbg_rval2strv_dup_accept_nil(volatile VALUE *value, long *n); VALUE rbg_strv2rval(const gchar **strings); VALUE rbg_strv2rval_free(gchar **strings); gboolean *rbg_rval2gbooleans(volatile VALUE *value, long *n); gint *rbg_rval2gints(volatile VALUE *value, long *n); gint8 *rbg_rval2gint8s(volatile VALUE *value, long *n); guint8 *rbg_rval2guint8s(volatile VALUE *value, long *n); guint16 *rbg_rval2guint16s(volatile VALUE *value, long *n); guint32 *rbg_rval2guint32s(volatile VALUE *value, long *n); gdouble *rbg_rval2gdoubles(volatile VALUE *value, long *n); VALUE rbg_gints2rval(const gint *gints, long n); VALUE rbg_gints2rval_free(gint *gints, long n); extern VALUE rbg_to_array(VALUE object); extern VALUE rbg_to_hash(VALUE object); extern VALUE rbg_check_array_type(VALUE object); extern VALUE rbg_check_hash_type(VALUE object); extern void rbg_scan_options(VALUE options, ...); /* rbgerror.h */ extern VALUE rbgerr_gerror2exception(GError *error); extern VALUE rbgerr_define_gerror(GQuark domain, const gchar* name, VALUE module, VALUE parent, GType gtype); extern VALUE rbglib_int64_to_num(guint64 val); extern VALUE rbglib_uint64_to_num(guint64 val); extern gint64 rbglib_num_to_int64(VALUE val); extern guint64 rbglib_num_to_uint64(VALUE val); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __RBGLIB_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_fileutils.c��������������������������������������������0000644�0001750�0001750�00000012442�12446160551�021104� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE cFileError /* Use Ruby standard libraries. enum GFileTest; GFileError g_file_error_from_errno (gint err_no); gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error); gboolean g_file_test (const gchar *filename, GFileTest test); gint g_mkstemp (gchar *tmpl); gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error); gchar* g_file_read_link (const gchar *filename, GError **error); struct GDir; GDir* g_dir_open (const gchar *path, guint flags, GError **error); G_CONST_RETURN gchar* g_dir_read_name (GDir *dir); void g_dir_rewind (GDir *dir); void g_dir_close (GDir *dir); */ #if GLIB_CHECK_VERSION(2, 16, 0) static VALUE rbglib_m_format_size_for_display(G_GNUC_UNUSED VALUE self, VALUE size) { return CSTR2RVAL_FREE(g_format_size_for_display(NUM2INT(size))); } #endif #if GLIB_CHECK_VERSION(2, 30, 0) static VALUE rbglib_m_format_size(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE rb_size, rb_options; rb_scan_args(argc, argv, "11", &rb_size, &rb_options); if (NIL_P(rb_options)) { return CSTR2RVAL_FREE(g_format_size(NUM2UINT(rb_size))); } else { VALUE rb_flags; rbg_scan_options(rb_options, "flags", &rb_flags, NULL); return CSTR2RVAL_FREE(g_format_size_full(NUM2UINT(rb_size), RVAL2GFORMATSIZEFLAGS(rb_flags))); } } #endif void Init_glib_fileutils(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_FILE_ERROR, "FileError", mGLib, rb_eIOError); rb_define_const(RG_TARGET_NAMESPACE, "EXIST", INT2NUM(G_FILE_ERROR_EXIST)); rb_define_const(RG_TARGET_NAMESPACE, "ISDIR", INT2NUM(G_FILE_ERROR_ISDIR)); rb_define_const(RG_TARGET_NAMESPACE, "ACCES", INT2NUM(G_FILE_ERROR_ACCES)); rb_define_const(RG_TARGET_NAMESPACE, "NAMETOOLONG", INT2NUM(G_FILE_ERROR_NAMETOOLONG)); rb_define_const(RG_TARGET_NAMESPACE, "NOENT", INT2NUM(G_FILE_ERROR_NOENT)); rb_define_const(RG_TARGET_NAMESPACE, "NOTDIR", INT2NUM(G_FILE_ERROR_NOTDIR)); rb_define_const(RG_TARGET_NAMESPACE, "NXIO", INT2NUM(G_FILE_ERROR_NXIO)); rb_define_const(RG_TARGET_NAMESPACE, "NODEV", INT2NUM(G_FILE_ERROR_NODEV)); rb_define_const(RG_TARGET_NAMESPACE, "ROFS", INT2NUM(G_FILE_ERROR_ROFS)); rb_define_const(RG_TARGET_NAMESPACE, "TXTBSY", INT2NUM(G_FILE_ERROR_TXTBSY)); rb_define_const(RG_TARGET_NAMESPACE, "FAULT", INT2NUM(G_FILE_ERROR_FAULT)); rb_define_const(RG_TARGET_NAMESPACE, "LOOP", INT2NUM(G_FILE_ERROR_LOOP)); rb_define_const(RG_TARGET_NAMESPACE, "NOSPC", INT2NUM(G_FILE_ERROR_NOSPC)); rb_define_const(RG_TARGET_NAMESPACE, "NOMEM", INT2NUM(G_FILE_ERROR_NOMEM)); rb_define_const(RG_TARGET_NAMESPACE, "MFILE", INT2NUM(G_FILE_ERROR_MFILE)); rb_define_const(RG_TARGET_NAMESPACE, "NFILE", INT2NUM(G_FILE_ERROR_NFILE)); rb_define_const(RG_TARGET_NAMESPACE, "BADF", INT2NUM(G_FILE_ERROR_BADF)); rb_define_const(RG_TARGET_NAMESPACE, "INVAL", INT2NUM(G_FILE_ERROR_INVAL)); rb_define_const(RG_TARGET_NAMESPACE, "PIPE", INT2NUM(G_FILE_ERROR_PIPE)); rb_define_const(RG_TARGET_NAMESPACE, "AGAIN", INT2NUM(G_FILE_ERROR_AGAIN)); rb_define_const(RG_TARGET_NAMESPACE, "INTR", INT2NUM(G_FILE_ERROR_INTR)); rb_define_const(RG_TARGET_NAMESPACE, "IO", INT2NUM(G_FILE_ERROR_IO)); rb_define_const(RG_TARGET_NAMESPACE, "PERM", INT2NUM(G_FILE_ERROR_PERM)); rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_FILE_ERROR_FAILED)); #if GLIB_CHECK_VERSION(2, 16, 0) rbg_define_singleton_method(mGLib, "format_size_for_display", rbglib_m_format_size_for_display, 1); #endif #if GLIB_CHECK_VERSION(2, 30, 0) rbg_define_singleton_method(mGLib, "format_size", rbglib_m_format_size, -1); #endif } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib.c������������������������������������������������������0000644�0001750�0001750�00000067275�12516434313�017040� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 <locale.h> #include "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mGLib static ID id_inspect; VALUE RG_TARGET_NAMESPACE; const gchar * rbg_rval2cstr(VALUE *str) { StringValue(*str); #ifdef HAVE_RUBY_ENCODING_H if (rb_enc_get(*str) != rb_utf8_encoding()) *str = rb_str_export_to_enc(*str, rb_utf8_encoding()); #endif return RSTRING_PTR(*str); } const gchar * rbg_rval_inspect(VALUE object) { VALUE inspected = rb_funcall(object, id_inspect, 0); return RVAL2CSTR(inspected); } char * rbg_string_value_ptr(volatile VALUE *ptr) { return rb_string_value_ptr(ptr); } const gchar * rbg_rval2cstr_accept_nil(VALUE *str) { return NIL_P(*str) ? NULL : RVAL2CSTR(*str); } /* TODO: How do we deal with encodings? */ const gchar * rbg_rval2cstr_accept_symbol(volatile VALUE *value) { if (!SYMBOL_P(*value)) return rbg_rval2cstr((VALUE *)value); return rb_id2name(SYM2ID(*value)); } const gchar * rbg_rval2cstr_accept_symbol_accept_nil(volatile VALUE *value) { return NIL_P(*value) ? NULL : rbg_rval2cstr_accept_symbol(value); } const gchar * rbg_rval2glibid(volatile VALUE *value, volatile VALUE *buf, gboolean accept_nil) { gchar *id, *p; if (accept_nil && NIL_P(*value)) return NULL; if (SYMBOL_P(*value)) { *buf = rb_String(*value); } else { StringValue(*value); *buf = rb_str_dup(*value); } RB_GC_GUARD(*buf); id = RSTRING_PTR(*buf); for (p = id; *p; p++) if (*p == '_') *p = '-'; return id; } VALUE rbg_cstr2rval(const gchar *str) { return str != NULL ? CSTR2RVAL_LEN(str, strlen(str)) : Qnil; } VALUE rbg_cstr2rval_len(const gchar *str, gsize len) { if (str == NULL) return Qnil; #ifdef HAVE_RUBY_ENCODING_H return rb_external_str_new_with_enc(str, len, rb_utf8_encoding()); #else return rb_str_new(str, len); #endif } struct rbg_cstr2rval_len_free_args { gchar *str; gsize len; }; static VALUE rbg_cstr2rval_len_free_body(VALUE value) { struct rbg_cstr2rval_len_free_args *args = (struct rbg_cstr2rval_len_free_args *)value; return CSTR2RVAL_LEN(args->str, args->len); } static VALUE rbg_cstr2rval_len_free_ensure(VALUE str) { g_free((gchar *)str); return Qnil; } VALUE rbg_cstr2rval_len_free(gchar *str, gsize len) { struct rbg_cstr2rval_len_free_args args = { str, len }; return str != NULL ? rb_ensure(rbg_cstr2rval_len_free_body, (VALUE)&args, rbg_cstr2rval_len_free_ensure, (VALUE)str) : Qnil; } VALUE rbg_cstr2rval_with_encoding(const gchar *str, const gchar *encoding) { return str != NULL ? CSTR2RVAL_LEN_ENC(str, strlen(str), encoding) : Qnil; } #ifdef HAVE_RUBY_ENCODING_H VALUE rbg_cstr2rval_len_with_encoding(const gchar *str, gsize len, const gchar *encoding) { if (str == NULL) return Qnil; return rb_external_str_new_with_enc(str, len, encoding != NULL ? rb_enc_find(encoding) : rb_utf8_encoding()); } #else VALUE rbg_cstr2rval_len_with_encoding(const gchar *str, gsize len, G_GNUC_UNUSED const gchar *encoding) { if (str == NULL) return Qnil; return rb_str_new(str, len); } #endif static VALUE rbg_cstr2rval_free_body(VALUE str) { return CSTR2RVAL((const gchar *)str); } static VALUE rbg_cstr2rval_free_ensure(VALUE str) { g_free((gchar *)str); return Qnil; } VALUE rbg_cstr2rval_free(gchar *str) { return str != NULL? rb_ensure(rbg_cstr2rval_free_body, (VALUE)str, rbg_cstr2rval_free_ensure, (VALUE)str) : Qnil; } /* just for backward compatibility. */ VALUE rbg_cstr2rval_with_free(gchar *str) { return rbg_cstr2rval_free(str); } #ifdef HAVE_RUBY_ENCODING_H static rb_encoding *filename_encoding_if_not_utf8; #endif #ifdef HAVE_RUBY_ENCODING_H static VALUE rbg_filename_to_ruby_body(VALUE filename) { const gchar *filename_utf8 = (const gchar *)filename; VALUE rb_filename; rb_filename = rb_external_str_new_with_enc(filename_utf8, strlen(filename_utf8), rb_utf8_encoding()); /* if needed, change encoding of Ruby String to filename encoding, so that upcoming File operations will work properly */ return filename_encoding_if_not_utf8 != NULL ? rb_str_export_to_enc(rb_filename, filename_encoding_if_not_utf8) : rb_filename; } static VALUE rbg_filename_to_ruby_ensure(VALUE filename) { g_free((gchar *)filename); return Qnil; } #endif VALUE rbg_filename_to_ruby(const gchar *filename) { #ifdef HAVE_RUBY_ENCODING_H gchar *filename_utf8; gsize written; GError *error = NULL; if (filename == NULL) return Qnil; if (filename_encoding_if_not_utf8 == NULL) return CSTR2RVAL(filename); filename_utf8 = g_filename_to_utf8(filename, -1, NULL, &written, &error); if (error != NULL) RAISE_GERROR(error); return rb_ensure(rbg_filename_to_ruby_body, (VALUE)filename_utf8, rbg_filename_to_ruby_ensure, (VALUE)filename_utf8); #else return CSTR2RVAL(filename); #endif } VALUE rbg_filename_to_ruby_free(gchar *filename) { #ifdef HAVE_RUBY_ENCODING_H gchar *filename_utf8; gsize written; if (filename == NULL) return Qnil; /* convert filename to UTF-8 if needed */ if (filename_encoding_if_not_utf8 != NULL) { GError *error = NULL; filename_utf8 = g_filename_to_utf8(filename, -1, NULL, &written, &error); g_free(filename); if (error != NULL) RAISE_GERROR(error); } else { filename_utf8 = filename; } return rb_ensure(rbg_filename_to_ruby_body, (VALUE)filename_utf8, rbg_filename_to_ruby_ensure, (VALUE)filename_utf8); #else return CSTR2RVAL_FREE(filename); #endif } gchar * rbg_filename_from_ruby(VALUE filename) { #ifdef HAVE_RUBY_ENCODING_H gchar *retval; gsize written; GError *error = NULL; /* if needed, change encoding of Ruby String to UTF-8 */ StringValue(filename); if (rb_enc_get(filename) != rb_utf8_encoding()) filename = rb_str_export_to_enc(filename, rb_utf8_encoding()); /* convert it to filename encoding if needed */ if (filename_encoding_if_not_utf8 == NULL) return g_strdup(RSTRING_PTR(filename)); retval = g_filename_from_utf8(RSTRING_PTR(filename), -1, NULL, &written, &error); if (error != NULL) RAISE_GERROR(error); return retval; #else return g_strdup(RVAL2CSTR(filename)); #endif } struct rval2strv_args { VALUE ary; long n; const gchar **result; }; static VALUE rbg_rval2strv_body(VALUE value) { long i; struct rval2strv_args *args = (struct rval2strv_args *)value; for (i = 0; i < args->n; i++) args->result[i] = RVAL2CSTR(RARRAY_PTR(args->ary)[i]); args->result[args->n] = NULL; return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2strv_rescue(VALUE value) { g_free(((struct rval2strv_args *)value)->result); rb_exc_raise(rb_errinfo()); } const gchar ** rbg_rval2strv(volatile VALUE *value, long *n) { struct rval2strv_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(const gchar *, args.n + 1); rb_rescue(rbg_rval2strv_body, (VALUE)&args, rbg_rval2strv_rescue, (VALUE)&args); if (n != NULL) *n = args.n; return args.result; } const gchar ** rbg_rval2strv_accept_nil(volatile VALUE *value, long *n) { if (!NIL_P(*value)) return rbg_rval2strv(value, n); if (n != NULL) *n = 0; return NULL; } struct rval2strv_dup_args { VALUE ary; long n; gchar **result; }; static VALUE rbg_rval2strv_dup_body(VALUE value) { long i; struct rval2strv_dup_args *args = (struct rval2strv_dup_args *)value; for (i = 0; i < args->n; i++) args->result[i] = g_strdup(RVAL2CSTR(RARRAY_PTR(args->ary)[i])); args->result[args->n] = NULL; return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2strv_dup_rescue(VALUE value) { g_free(((struct rval2strv_dup_args *)value)->result); rb_exc_raise(rb_errinfo()); } gchar ** rbg_rval2strv_dup(volatile VALUE *value, long *n) { struct rval2strv_dup_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(gchar *, args.n + 1); rb_rescue(rbg_rval2strv_dup_body, (VALUE)&args, rbg_rval2strv_dup_rescue, (VALUE)&args); if (n != NULL) *n = args.n; return args.result; } gchar ** rbg_rval2strv_dup_accept_nil(volatile VALUE *value, long *n) { if (!NIL_P(*value)) rbg_rval2strv_dup(value, n); if (n != NULL) *n = 0; return NULL; } VALUE rbg_strv2rval(const gchar **strings) { VALUE ary; const gchar **p; if (strings == NULL) return Qnil; ary = rb_ary_new(); for (p = strings; *p != NULL; p++) rb_ary_push(ary, CSTR2RVAL(*p)); return ary; } static VALUE rbg_strv2rval_free_body(VALUE strings) { return STRV2RVAL((const gchar **)strings); } static VALUE rbg_strv2rval_free_ensure(VALUE strings) { g_strfreev((gchar **)strings); return Qnil; } VALUE rbg_strv2rval_free(gchar **strings) { return rb_ensure(rbg_strv2rval_free_body, (VALUE)strings, rbg_strv2rval_free_ensure, (VALUE)strings); } struct rbg_rval2gbooleans_args { VALUE ary; long n; gboolean *result; }; static VALUE rbg_rval2gbooleans_body(VALUE value) { long i; struct rbg_rval2gbooleans_args *args = (struct rbg_rval2gbooleans_args *)value; for (i = 0; i < args->n; i++) args->result[i] = RVAL2CBOOL(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2gbooleans_rescue(VALUE value) { g_free(((struct rbg_rval2gbooleans_args *)value)->result); rb_exc_raise(rb_errinfo()); } gboolean * rbg_rval2gbooleans(volatile VALUE *value, long *n) { struct rbg_rval2gbooleans_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(gboolean, args.n + 1); rb_rescue(rbg_rval2gbooleans_body, (VALUE)&args, rbg_rval2gbooleans_rescue, (VALUE)&args); *n = args.n; return args.result; } struct rbg_rval2gints_args { VALUE ary; long n; gint *result; }; static VALUE rbg_rval2gints_body(VALUE value) { long i; struct rbg_rval2gints_args *args = (struct rbg_rval2gints_args *)value; for (i = 0; i < args->n; i++) args->result[i] = NUM2INT(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2gints_rescue(VALUE value) { g_free(((struct rbg_rval2gints_args *)value)->result); rb_exc_raise(rb_errinfo()); } gint * rbg_rval2gints(volatile VALUE *value, long *n) { struct rbg_rval2gints_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(gint, args.n + 1); rb_rescue(rbg_rval2gints_body, (VALUE)&args, rbg_rval2gints_rescue, (VALUE)&args); *n = args.n; return args.result; } struct rbg_rval2gint8s_args { VALUE ary; long n; gint8 *result; }; static VALUE rbg_rval2gint8s_body(VALUE value) { long i; struct rbg_rval2gint8s_args *args = (struct rbg_rval2gint8s_args *)value; for (i = 0; i < args->n; i++) args->result[i] = NUM2CHR(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2gint8s_rescue(VALUE value) { g_free(((struct rbg_rval2gint8s_args *)value)->result); rb_exc_raise(rb_errinfo()); } gint8 * rbg_rval2gint8s(volatile VALUE *value, long *n) { struct rbg_rval2gint8s_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(gint8, args.n + 1); rb_rescue(rbg_rval2gint8s_body, (VALUE)&args, rbg_rval2gint8s_rescue, (VALUE)&args); *n = args.n; return args.result; } struct rbg_rval2guint8s_args { VALUE ary; long n; guint8 *result; }; static VALUE rbg_rval2guint8s_body(VALUE value) { long i; struct rbg_rval2guint8s_args *args = (struct rbg_rval2guint8s_args *)value; for (i = 0; i < args->n; i++) args->result[i] = NUM2UINT(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2guint8s_rescue(VALUE value) { g_free(((struct rbg_rval2guint8s_args *)value)->result); rb_exc_raise(rb_errinfo()); } guint8 * rbg_rval2guint8s(volatile VALUE *value, long *n) { struct rbg_rval2guint8s_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(guint8, args.n + 1); rb_rescue(rbg_rval2guint8s_body, (VALUE)&args, rbg_rval2guint8s_rescue, (VALUE)&args); *n = args.n; return args.result; } struct rbg_rval2guint16s_args { VALUE ary; long n; guint16 *result; }; static VALUE rbg_rval2guint16s_body(VALUE value) { long i; struct rbg_rval2guint16s_args *args = (struct rbg_rval2guint16s_args *)value; for (i = 0; i < args->n; i++) args->result[i] = NUM2UINT(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2guint16s_rescue(VALUE value) { g_free(((struct rbg_rval2guint16s_args *)value)->result); rb_exc_raise(rb_errinfo()); } guint16 * rbg_rval2guint16s(volatile VALUE *value, long *n) { struct rbg_rval2guint16s_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(guint16, args.n + 1); rb_rescue(rbg_rval2guint16s_body, (VALUE)&args, rbg_rval2guint16s_rescue, (VALUE)&args); *n = args.n; return args.result; } struct rbg_rval2guint32s_args { VALUE ary; long n; guint32 *result; }; static VALUE rbg_rval2guint32s_body(VALUE value) { long i; struct rbg_rval2guint32s_args *args = (struct rbg_rval2guint32s_args *)value; for (i = 0; i < args->n; i++) args->result[i] = NUM2UINT(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2guint32s_rescue(VALUE value) { g_free(((struct rbg_rval2guint32s_args *)value)->result); rb_exc_raise(rb_errinfo()); } guint32 * rbg_rval2guint32s(volatile VALUE *value, long *n) { struct rbg_rval2guint32s_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(guint32, args.n + 1); rb_rescue(rbg_rval2guint32s_body, (VALUE)&args, rbg_rval2guint32s_rescue, (VALUE)&args); *n = args.n; return args.result; } struct rbg_rval2gdoubles_args { VALUE ary; long n; gdouble *result; }; static VALUE rbg_rval2gdoubles_body(VALUE value) { long i; struct rbg_rval2gdoubles_args *args = (struct rbg_rval2gdoubles_args *)value; for (i = 0; i < args->n; i++) args->result[i] = NUM2DBL(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2gdoubles_rescue(VALUE value) { g_free(((struct rbg_rval2gdoubles_args *)value)->result); rb_exc_raise(rb_errinfo()); } gdouble * rbg_rval2gdoubles(volatile VALUE *value, long *n) { struct rbg_rval2gdoubles_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(gdouble, args.n + 1); rb_rescue(rbg_rval2gdoubles_body, (VALUE)&args, rbg_rval2gdoubles_rescue, (VALUE)&args); *n = args.n; return args.result; } VALUE rbg_gints2rval(const gint *gints, long n) { long i; VALUE ary = rb_ary_new(); for (i = 0; i < n; i++) rb_ary_push(ary, INT2NUM(gints[i])); return ary; } struct rbg_gints2rval_free_args { gint *gints; long n; }; static VALUE rbg_gints2rval_free_body(VALUE value) { struct rbg_gints2rval_free_args *args = (struct rbg_gints2rval_free_args *)value; return rbg_gints2rval(args->gints, args->n); } static VALUE rbg_gints2rval_free_ensure(VALUE value) { g_free(((struct rbg_gints2rval_free_args *)value)->gints); return Qnil; } VALUE rbg_gints2rval_free(gint *gints, long n) { struct rbg_gints2rval_free_args args = { gints, n }; return rb_ensure(rbg_gints2rval_free_body, (VALUE)&args, rbg_gints2rval_free_ensure, (VALUE)&args); } const gchar * rbg_inspect (VALUE object) { VALUE inspected; inspected = rb_funcall(object, rb_intern("inspect"), 0); return StringValueCStr(inspected); } VALUE rbg_to_array (VALUE object) { return rb_convert_type(object, RUBY_T_ARRAY, "Array", "to_ary"); } VALUE rbg_to_hash (VALUE object) { return rb_convert_type(object, RUBY_T_HASH, "Hash", "to_hash"); } VALUE rbg_check_array_type (VALUE object) { #ifdef HAVE_RB_CHECK_ARRAY_TYPE return rb_check_array_type(object); #else return rb_check_convert_type(object, RUBY_T_ARRAY, "Array", "to_ary"); #endif } VALUE rbg_check_hash_type (VALUE object) { #ifdef HAVE_RB_CHECK_HASH_TYPE return rb_check_hash_type(object); #else return rb_check_convert_type(object, RUBY_T_HASH, "Hash", "to_hash"); #endif } void rbg_scan_options (VALUE options, ...) { VALUE original_options = options; VALUE available_keys; const char *key; VALUE *value; va_list args; options = rbg_check_hash_type(options); if (NIL_P(options)) { options = rb_hash_new(); } else if (options == original_options) { options = rb_funcall(options, rb_intern("dup"), 0); } available_keys = rb_ary_new(); va_start(args, options); key = va_arg(args, const char *); while (key) { VALUE rb_key; value = va_arg(args, VALUE *); rb_key = ID2SYM(rb_intern(key)); rb_ary_push(available_keys, rb_key); *value = rb_funcall(options, rb_intern("delete"), 1, rb_key); key = va_arg(args, const char *); } va_end(args); if (RVAL2CBOOL(rb_funcall(options, rb_intern("empty?"), 0))) return; rb_raise(rb_eArgError, "unexpected key(s) exist: %s: available keys: %s", rbg_inspect(rb_funcall(options, rb_intern("keys"), 0)), rbg_inspect(available_keys)); } #if 0 /* 2004-04-15 Commented out by Masao. These functions replace g_malloc/g_realloc/g_free of GLib. When g_malloc is called and the memory area can not reserved, rb_gc() will be called. It makes Ruby-GNOME2 uses memory efficiently. But rb_gc() does not work under multithread. So they occur "cross-thread violation". */ static gpointer my_malloc(gsize n_bytes) { /* Should we rescue NoMemoryError? */ return ruby_xmalloc(n_bytes); } static gpointer my_realloc(gpointer mem, gsize n_bytes) { /* Should we rescue NoMemoryError? */ return ruby_xrealloc(mem, n_bytes); } static void my_free(gpointer mem) { return ruby_xfree(mem); } static void Init_mem() { GMemVTable mem_table = { my_malloc, my_realloc, my_free, NULL, NULL, NULL, }; g_mem_set_vtable(&mem_table); } #endif static VALUE rg_s_os_win32_p(G_GNUC_UNUSED VALUE self) { #ifdef G_OS_WIN32 return Qtrue; #else return Qfalse; #endif } static VALUE rg_s_os_beos_p(G_GNUC_UNUSED VALUE self) { #ifdef G_OS_BEOS return Qtrue; #else return Qfalse; #endif } static VALUE rg_s_os_unix_p(G_GNUC_UNUSED VALUE self) { #ifdef G_OS_UNIX return Qtrue; #else return Qfalse; #endif } extern void Init_glib2(void); void Init_glib2(void) { #ifdef HAVE_RUBY_ENCODING_H const gchar **filename_charsets; #endif id_inspect = rb_intern("inspect"); RG_TARGET_NAMESPACE = rb_define_module("GLib"); setlocale (LC_CTYPE, ""); #ifdef LC_MESSAGES setlocale (LC_MESSAGES, ""); #endif /* Version Information */ rb_define_const(RG_TARGET_NAMESPACE, "VERSION", rb_ary_new3(3, INT2FIX(glib_major_version), INT2FIX(glib_minor_version), INT2FIX(glib_micro_version))); rb_define_const(RG_TARGET_NAMESPACE, "MAJOR_VERSION", INT2FIX(glib_major_version)); rb_define_const(RG_TARGET_NAMESPACE, "MINOR_VERSION", INT2FIX(glib_minor_version)); rb_define_const(RG_TARGET_NAMESPACE, "MICRO_VERSION", INT2FIX(glib_micro_version)); rb_define_const(RG_TARGET_NAMESPACE, "INTERFACE_AGE", INT2FIX(glib_interface_age)); rb_define_const(RG_TARGET_NAMESPACE, "BINARY_AGE", INT2FIX(glib_binary_age)); rb_define_const(RG_TARGET_NAMESPACE, "BINDING_VERSION", rb_ary_new3(3, INT2FIX(RBGLIB_MAJOR_VERSION), INT2FIX(RBGLIB_MINOR_VERSION), INT2FIX(RBGLIB_MICRO_VERSION))); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(GLIB_MAJOR_VERSION), INT2FIX(GLIB_MINOR_VERSION), INT2FIX(GLIB_MICRO_VERSION))); /* Limits of Basic Types */ rb_define_const(RG_TARGET_NAMESPACE, "MININT", INT2FIX(G_MININT)); rb_define_const(RG_TARGET_NAMESPACE, "MAXINT", INT2NUM(G_MAXINT)); rb_define_const(RG_TARGET_NAMESPACE, "MAXUINT", UINT2NUM(G_MAXUINT)); rb_define_const(RG_TARGET_NAMESPACE, "MINSHORT", INT2FIX(G_MINSHORT)); rb_define_const(RG_TARGET_NAMESPACE, "MAXSHORT", INT2FIX(G_MAXSHORT)); rb_define_const(RG_TARGET_NAMESPACE, "MAXUSHORT", UINT2NUM(G_MAXUSHORT)); rb_define_const(RG_TARGET_NAMESPACE, "MINLONG", INT2FIX(G_MINLONG)); rb_define_const(RG_TARGET_NAMESPACE, "MAXLONG", INT2NUM(G_MAXLONG)); rb_define_const(RG_TARGET_NAMESPACE, "MAXULONG", UINT2NUM(G_MAXULONG)); rb_define_const(RG_TARGET_NAMESPACE, "MININT8", INT2FIX(G_MININT8)); rb_define_const(RG_TARGET_NAMESPACE, "MAXINT8", INT2FIX(G_MAXINT8)); rb_define_const(RG_TARGET_NAMESPACE, "MAXUINT8", UINT2NUM(G_MAXUINT8)); rb_define_const(RG_TARGET_NAMESPACE, "MININT16", INT2FIX(G_MININT16)); rb_define_const(RG_TARGET_NAMESPACE, "MAXINT16", INT2FIX(G_MAXINT16)); rb_define_const(RG_TARGET_NAMESPACE, "MAXUINT16", UINT2NUM(G_MAXUINT16)); rb_define_const(RG_TARGET_NAMESPACE, "MININT32", INT2FIX(G_MININT32)); rb_define_const(RG_TARGET_NAMESPACE, "MAXINT32", INT2NUM(G_MAXINT32)); rb_define_const(RG_TARGET_NAMESPACE, "MAXUINT32", UINT2NUM(G_MAXUINT32)); rb_define_const(RG_TARGET_NAMESPACE, "MININT64", INT2FIX(G_MININT64)); rb_define_const(RG_TARGET_NAMESPACE, "MAXINT64", LL2NUM(G_MAXINT64)); rb_define_const(RG_TARGET_NAMESPACE, "MAXUINT64", ULL2NUM(G_MAXUINT64)); rb_define_const(RG_TARGET_NAMESPACE, "MAXSIZE", UINT2NUM(G_MAXSIZE)); rb_define_const(RG_TARGET_NAMESPACE, "MINFLOAT", INT2FIX(G_MINFLOAT)); rb_define_const(RG_TARGET_NAMESPACE, "MAXFLOAT", DBL2NUM(G_MAXFLOAT)); rb_define_const(RG_TARGET_NAMESPACE, "MINDOUBLE", INT2FIX(G_MINDOUBLE)); rb_define_const(RG_TARGET_NAMESPACE, "MAXDOUBLE", DBL2NUM(G_MAXDOUBLE)); /* Standard Macros */ RG_DEF_SMETHOD_P(os_win32, 0); RG_DEF_SMETHOD_P(os_beos, 0); RG_DEF_SMETHOD_P(os_unix, 0); rb_define_const(RG_TARGET_NAMESPACE, "DIR_SEPARATOR", CSTR2RVAL(G_DIR_SEPARATOR_S)); rb_define_const(RG_TARGET_NAMESPACE, "SEARCHPATH_SEPARATOR", CSTR2RVAL(G_SEARCHPATH_SEPARATOR_S)); /* discover and store glib filename encoding */ #ifdef HAVE_RUBY_ENCODING_H if (g_get_filename_charsets(&filename_charsets) || filename_charsets == NULL || filename_charsets[0] == NULL || !strcmp(filename_charsets[0], "UTF-8") || rb_enc_find(filename_charsets[0]) == rb_enc_find("ASCII-8BIT")) { /* set to NULL, mean do not perform transcoding, either filename encoding is unknown, UTF-8, or unsupported */ filename_encoding_if_not_utf8 = NULL; } else { filename_encoding_if_not_utf8 = rb_enc_find(filename_charsets[0]); } #endif /* Don't implement them. #define G_DIR_SEPARATOR_S #define G_IS_DIR_SEPARATOR (c) #define G_SEARCHPATH_SEPARATOR #define TRUE #define FALSE #define NULL #define MIN (a, b) #define MAX (a, b) #define ABS (a) #define CLAMP (x, low, high) #define G_STRUCT_MEMBER (member_type, struct_p, struct_offset) #define G_STRUCT_MEMBER_P (struct_p, struct_offset) #define G_STRUCT_OFFSET (struct_type, member) #define G_MEM_ALIGN #define G_CONST_RETURN */ /* Numerical Definitions */ /* Don't implement them. #define G_IEEE754_FLOAT_BIAS #define G_IEEE754_DOUBLE_BIAS union GFloatIEEE754; union GDoubleIEEE754; */ rb_define_const(RG_TARGET_NAMESPACE, "E", CSTR2RVAL(G_STRINGIFY(G_E))); rb_define_const(RG_TARGET_NAMESPACE, "LN2", CSTR2RVAL(G_STRINGIFY(G_LN2))); rb_define_const(RG_TARGET_NAMESPACE, "LN10", CSTR2RVAL(G_STRINGIFY(G_LN10))); rb_define_const(RG_TARGET_NAMESPACE, "PI", CSTR2RVAL(G_STRINGIFY(G_PI))); rb_define_const(RG_TARGET_NAMESPACE, "PI_2", CSTR2RVAL(G_STRINGIFY(G_PI_2))); rb_define_const(RG_TARGET_NAMESPACE, "PI_4", CSTR2RVAL(G_STRINGIFY(G_PI_4))); rb_define_const(RG_TARGET_NAMESPACE, "SQRT2", CSTR2RVAL(G_STRINGIFY(G_SQRT2))); rb_define_const(RG_TARGET_NAMESPACE, "LOG_2_BASE_10", CSTR2RVAL(G_STRINGIFY(G_LOG_2_BASE_10))); /* From "The Main Event Loop" */ rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_HIGH", INT2FIX(G_PRIORITY_HIGH)); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_DEFAULT", INT2FIX(G_PRIORITY_DEFAULT)); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_HIGH_IDLE", INT2FIX(G_PRIORITY_HIGH_IDLE)); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_DEFAULT_IDLE", INT2FIX(G_PRIORITY_DEFAULT_IDLE)); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_LOW", INT2FIX(G_PRIORITY_LOW)); /* Init_mem(); */ Init_gutil(); Init_gutil_callback(); Init_glib_gettext(); Init_glib_int64(); Init_glib_error(); Init_glib_threads(); Init_glib_convert(); Init_glib_messages(); Init_glib_fileutils(); Init_glib_i18n(); Init_glib_win32(); Init_gobject(); /* Require GBoxed/GObject */ Init_glib_utils(); Init_glib_spawn(); Init_glib_spawnerror(); Init_glib_main_loop(); Init_glib_source(); Init_glib_main_context(); Init_glib_poll_fd(); Init_glib_io_constants(); Init_glib_io_channel(); Init_glib_io_channelerror(); Init_glib_io_channel_win32_socket(); Init_glib_shell(); Init_glib_shellerror(); Init_glib_timer(); Init_glib_unicode(); Init_glib_utf8(); Init_glib_utf16(); Init_glib_ucs4(); Init_glib_unichar(); Init_glib_keyfile(); Init_glib_bookmark_file(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_object.c�����������������������������������������������0000644�0001750�0001750�00000057722�12416346617�020376� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 Masahiro Sakai * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE rbgobj_cObject VALUE RG_TARGET_NAMESPACE; static VALUE eNoPropertyError; static GQuark RUBY_GOBJECT_OBJ_KEY; /* deperecated */ void rbgobj_add_abstract_but_create_instance_class(G_GNUC_UNUSED GType gtype) { } static void weak_notify(gpointer data, G_GNUC_UNUSED GObject *where_the_object_was) { gobj_holder *holder = data; rbgobj_instance_call_cinfo_free(holder->gobj); rbgobj_invalidate_relatives(holder->self); holder->destroyed = TRUE; g_object_unref(holder->gobj); holder->gobj = NULL; } static void holder_mark(gobj_holder *holder) { if (holder->gobj && !holder->destroyed) rbgobj_instance_call_cinfo_mark(holder->gobj); } static void holder_unref(gobj_holder *holder) { if (holder->gobj) { if (!holder->destroyed) { g_object_set_qdata(holder->gobj, RUBY_GOBJECT_OBJ_KEY, NULL); g_object_weak_unref(holder->gobj, (GWeakNotify)weak_notify, holder); weak_notify(holder, holder->gobj); } holder->gobj = NULL; } } static void holder_free(gobj_holder *holder) { holder_unref(holder); xfree(holder); } static VALUE gobj_s_allocate(VALUE klass) { gobj_holder* holder; VALUE result; result = Data_Make_Struct(klass, gobj_holder, holder_mark, holder_free, holder); holder->self = result; holder->gobj = NULL; holder->cinfo = NULL; holder->destroyed = FALSE; return result; } /* deprecated */ VALUE rbgobj_create_object(VALUE klass) { return gobj_s_allocate(klass); } void rbgobj_gobject_initialize(VALUE obj, gpointer cobj) { gobj_holder* holder = g_object_get_qdata((GObject*)cobj, RUBY_GOBJECT_OBJ_KEY); if (holder) rb_raise(rb_eRuntimeError, "ruby wrapper for this GObject* already exists."); Data_Get_Struct(obj, gobj_holder, holder); holder->cinfo = RVAL2CINFO(obj); holder->gobj = (GObject*)cobj; holder->destroyed = FALSE; g_object_set_qdata((GObject*)cobj, RUBY_GOBJECT_OBJ_KEY, (gpointer)holder); g_object_weak_ref((GObject*)cobj, (GWeakNotify)weak_notify, holder); { GType t1 = G_TYPE_FROM_INSTANCE(cobj); GType t2 = CLASS2GTYPE(CLASS_OF(obj)); if (t1 != t2) { if (!g_type_is_a(t1, t2)) rb_raise(rb_eTypeError, "%s is not subtype of %s", g_type_name(t1), g_type_name(t2)); } } } VALUE rbgobj_get_ruby_object_from_gobject(GObject* gobj, gboolean alloc) { gobj_holder *holder; holder = g_object_get_qdata(gobj, RUBY_GOBJECT_OBJ_KEY); if (holder) { return holder->self; } else if (alloc) { VALUE obj; obj = gobj_s_allocate(GTYPE2CLASS(G_OBJECT_TYPE(gobj))); gobj = g_object_ref(gobj); rbgobj_gobject_initialize(obj, (gpointer)gobj); return obj; } else { return Qnil; } } GObject* rbgobj_get_gobject(VALUE obj) { gobj_holder* holder; if (!RVAL2CBOOL(rb_obj_is_kind_of(obj, GTYPE2CLASS(G_TYPE_OBJECT)))) rb_raise(rb_eTypeError, "not a GLib::Object"); Data_Get_Struct(obj, gobj_holder, holder); if (holder->destroyed) rb_raise(rb_eTypeError, "destroyed GLib::Object"); if (!holder->gobj) rb_raise(rb_eTypeError, "uninitialize GLib::Object"); return holder->gobj; } void rbgobj_init_object_class(VALUE klass) { rbgobj_define_property_accessors(klass); } /**********************************************************************/ static gboolean is_gtkobject(GObject *gobj) { static GType gtype_gtkobject = G_TYPE_INVALID; if (!gtype_gtkobject) gtype_gtkobject = g_type_from_name("GtkObject"); return gtype_gtkobject && g_type_is_a(G_OBJECT_TYPE(gobj), gtype_gtkobject); } static void gobj_mark(gpointer ptr) { GObject* gobj = ptr; guint n_properties; GParamSpec** properties; GValue gval = G_VALUE_INIT; guint i; properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(gobj), &n_properties); for (i = 0; i < n_properties; i++) { GParamSpec* pspec = properties[i]; GType value_type = G_PARAM_SPEC_VALUE_TYPE(pspec); if (G_TYPE_FUNDAMENTAL(value_type) != G_TYPE_OBJECT) continue; if (!(pspec->flags & G_PARAM_READABLE)) continue; /* FIXME: exclude types that doesn't have identity. */ { g_value_init(&gval, value_type); g_object_get_property(gobj, pspec->name, &gval); rbgobj_gc_mark_gvalue(&gval); g_value_unset(&gval); } } g_free(properties); } static VALUE rg_s_new_bang(int argc, VALUE *argv, VALUE self) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(self); VALUE params_hash; GObject* gobj; VALUE result; rb_scan_args(argc, argv, "01", ¶ms_hash); if (!NIL_P(params_hash)) Check_Type(params_hash, RUBY_T_HASH); if (cinfo->klass != self) rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self)); gobj = rbgobj_gobject_new(cinfo->gtype, params_hash); result = GOBJ2RVAL(gobj); // XXX: Ughhhhh if (is_gtkobject(gobj)){ // We can't call gtk_object_sink() here. // But hopefully someone will call it in the future. //gtk_object_sink(gobj); } else { g_object_unref(gobj); } return result; } struct param_setup_arg { GObjectClass* gclass; GParameter* params; guint param_size; VALUE params_hash; guint index; }; static VALUE _params_setup(VALUE arg, struct param_setup_arg *param_setup_arg) { guint index; VALUE name, val; GParamSpec* pspec; index = param_setup_arg->index; if (index >= param_setup_arg->param_size) rb_raise(rb_eArgError, "too many parameters"); name = rb_ary_entry(arg, 0); val = rb_ary_entry(arg, 1); if (SYMBOL_P(name)) param_setup_arg->params[index].name = rb_id2name(SYM2ID(name)); else param_setup_arg->params[index].name = StringValuePtr(name); pspec = g_object_class_find_property( param_setup_arg->gclass, param_setup_arg->params[index].name); if (!pspec) rb_raise(rb_eArgError, "No such property: %s", param_setup_arg->params[index].name); g_value_init(&(param_setup_arg->params[index].value), G_PARAM_SPEC_VALUE_TYPE(pspec)); rbgobj_rvalue_to_gvalue(val, &(param_setup_arg->params[index].value)); param_setup_arg->index++; return Qnil; } static VALUE gobj_new_body(struct param_setup_arg* arg) { rb_iterate(rb_each, (VALUE)arg->params_hash, _params_setup, (VALUE)arg); return (VALUE)g_object_newv(G_TYPE_FROM_CLASS(arg->gclass), arg->param_size, arg->params); } static VALUE gobj_new_ensure(struct param_setup_arg* arg) { guint i; g_type_class_unref(arg->gclass); for (i = 0; i < arg->param_size; i++) { if (G_IS_VALUE(&arg->params[i].value)) g_value_unset(&arg->params[i].value); } return Qnil; } GObject* rbgobj_gobject_new(GType gtype, VALUE params_hash) { GObject* result; if (!g_type_is_a(gtype, G_TYPE_OBJECT)) rb_raise(rb_eArgError, "type \"%s\" is not descendant of GObject", g_type_name(gtype)); if (NIL_P(params_hash)) { result = g_object_newv(gtype, 0, NULL); } else { size_t param_size; struct param_setup_arg arg; param_size = NUM2INT(rb_funcall(params_hash, rb_intern("length"), 0)); arg.param_size = param_size; arg.gclass = G_OBJECT_CLASS(g_type_class_ref(gtype)); arg.params = ALLOCA_N(GParameter, param_size); memset(arg.params, 0, sizeof(GParameter) * param_size); arg.params_hash = params_hash; arg.index = 0; result = (GObject*)rb_ensure(&gobj_new_body, (VALUE)&arg, &gobj_new_ensure, (VALUE)&arg); } if (!result) rb_raise(rb_eRuntimeError, "g_object_newv failed"); return result; } static VALUE rg_s_install_property(int argc, VALUE* argv, VALUE self) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(self); gpointer gclass; GParamSpec* pspec; VALUE pspec_obj, prop_id; if (cinfo->klass != self) rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self)); rb_scan_args(argc, argv, "11", &pspec_obj, &prop_id); pspec = G_PARAM_SPEC(RVAL2GOBJ(pspec_obj)); gclass = g_type_class_ref(cinfo->gtype); g_object_class_install_property(gclass, NIL_P(prop_id) ? 1 : NUM2UINT(prop_id), pspec); g_type_class_unref(gclass); /* FIXME: define accessor methods */ return Qnil; } static VALUE gobj_s_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 = StringValuePtr(property_name); oclass = g_type_class_ref(CLASS2GTYPE(self)); prop = g_object_class_find_property(oclass, name); if (!prop){ g_type_class_unref(oclass); rb_raise(eNoPropertyError, "No such property: %s", name); } result = GOBJ2RVAL(prop); g_type_class_unref(oclass); return result; } static VALUE gobj_s_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 = g_object_class_list_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, rb_str_new2(props[i]->name)); } g_free(props); g_type_class_unref(oclass); return ary; } static VALUE type_to_prop_setter_table; static VALUE type_to_prop_getter_table; void rbgobj_register_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 = g_object_class_find_property(oclass, name); rb_hash_aset(table, CSTR2RVAL(g_param_spec_get_name(pspec)), Data_Wrap_Struct(rb_cData, NULL, NULL, func)); g_type_class_unref(oclass); } void rbgobj_register_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 = g_object_class_find_property(oclass, name); rb_hash_aset(table, CSTR2RVAL(g_param_spec_get_name(pspec)), Data_Wrap_Struct(rb_cData, NULL, NULL, func)); g_type_class_unref(oclass); } static VALUE rg_set_property(VALUE self, VALUE prop_name, VALUE val) { GParamSpec* pspec; const char* name; if (SYMBOL_P(prop_name)) name = rb_id2name(SYM2ID(prop_name)); else name = StringValuePtr(prop_name); pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name); if (!pspec) rb_raise(eNoPropertyError, "No such property: %s", name); else { // FIXME: use rb_ensure to call g_value_unset() 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, CSTR2RVAL(g_param_spec_get_name(pspec))); if (!NIL_P(obj)) Data_Get_Struct(obj, void, setter); } } if (setter) { setter(val, &gval); } else { rbgobj_rvalue_to_gvalue(val, &gval); } g_object_set_property(RVAL2GOBJ(self), name, &gval); g_value_unset(&gval); G_CHILD_SET(self, rb_intern(name), val); return self; } } static VALUE rg_get_property(VALUE self, VALUE prop_name) { GParamSpec* pspec; const char* name; if (SYMBOL_P(prop_name)) name = rb_id2name(SYM2ID(prop_name)); else name = StringValuePtr(prop_name); pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name); if (!pspec) rb_raise(eNoPropertyError, "No such property: %s", name); else { // FIXME: use rb_ensure to call g_value_unset() 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, CSTR2RVAL(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)); g_object_get_property(RVAL2GOBJ(self), name, &gval); ret = getter ? getter(&gval) : GVAL2RVAL(&gval); g_value_unset(&gval); G_CHILD_SET(self, rb_intern(name), ret); return ret; } } static VALUE rg_thaw_notify(VALUE self); static VALUE rg_freeze_notify(VALUE self) { g_object_freeze_notify(RVAL2GOBJ(self)); if (rb_block_given_p()) { return rb_ensure(rb_yield, self, rg_thaw_notify, self); } return self; } static VALUE rg_notify(VALUE self, VALUE property_name) { g_object_notify(RVAL2GOBJ(self), StringValuePtr(property_name)); return self; } static VALUE rg_thaw_notify(VALUE self) { g_object_thaw_notify(RVAL2GOBJ(self)); return self; } static VALUE rg_destroyed_p(VALUE self) { gobj_holder* holder; if (!RVAL2CBOOL(rb_obj_is_kind_of(self, GTYPE2CLASS(G_TYPE_OBJECT)))) rb_raise(rb_eTypeError, "not a GLib::Object"); Data_Get_Struct(self, gobj_holder, holder); return CBOOL2RVAL(holder->destroyed); } static VALUE rg_inspect(VALUE self) { gobj_holder* holder; const char *class_name; char *s; VALUE result; Data_Get_Struct(self, gobj_holder, holder); class_name = rb_class2name(CLASS_OF(self)); if (!holder->destroyed) s = g_strdup_printf("#<%s:%p ptr=%p>", class_name, (void *)self, holder->gobj); else s = g_strdup_printf("#<%s:%p destroyed>", class_name, (void *)self); result = rb_str_new2(s); g_free(s); return result; } static VALUE rg_unref(VALUE self) { gobj_holder* holder; Data_Get_Struct(self, gobj_holder, holder); if (holder->destroyed) rb_raise(rb_eTypeError, "destroyed GLib::Object"); if (!holder->gobj) rb_raise(rb_eTypeError, "uninitialize GLib::Object"); holder_unref(holder); return self; } static VALUE rg_type_name(VALUE self) { return CSTR2RVAL(G_OBJECT_TYPE_NAME(RVAL2GOBJ(self))); } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GType gtype; VALUE params_hash; GObject* gobj; gtype = CLASS2GTYPE(CLASS_OF(self)); if (G_TYPE_IS_ABSTRACT(gtype)) { rb_raise(rb_eTypeError, "initializing abstract class: %s", RBG_INSPECT(CLASS_OF(self))); } rb_scan_args(argc, argv, "01", ¶ms_hash); if (!NIL_P(params_hash)) Check_Type(params_hash, RUBY_T_HASH); gobj = rbgobj_gobject_new(RVAL2GTYPE(self), params_hash); if (is_gtkobject(gobj)){ gobj = g_object_ref(gobj); // We can't call gtk_object_sink() here. // But hopefully someone will call it in the future. //gtk_object_sink(gobj); } G_INITIALIZE(self, gobj); return Qnil; } static VALUE gobj_ref_count(VALUE self) { gobj_holder* holder; Data_Get_Struct(self, gobj_holder, holder); return INT2NUM(holder->gobj ? holder->gobj->ref_count : 0); } /**********************************************************************/ static VALUE proc_mod_eval; static GQuark q_ruby_setter; static GQuark q_ruby_getter; // 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 class_init_func(gpointer g_class_, G_GNUC_UNUSED gpointer class_data) { GObjectClass* g_class = G_OBJECT_CLASS(g_class_); g_class->set_property = set_prop_func; g_class->get_property = get_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); { 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 = rbgobj_lookup_class(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: Why new? g_type_register_static() doesn’t retain a copy, so * this should be allocated on the stack. */ 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, RubyGObjectHookModule); if (! (cinfo->flags & RBGOBJ_DEFINED_BY_RUBY)) { rbg_define_method(m, "initialize", rg_initialize, -1); } rb_include_module(self, m); } return Qnil; } } /**********************************************************************/ void Init_gobject_gobject(void) { RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(G_TYPE_OBJECT, "Object", mGLib, gobj_mark, NULL); #ifdef G_TYPE_INITIALLY_UNOWNED G_DEF_CLASS(G_TYPE_INITIALLY_UNOWNED, "InitiallyUnowned", mGLib); #endif RUBY_GOBJECT_OBJ_KEY = g_quark_from_static_string("__ruby_gobject_object__"); rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))gobj_s_allocate); RG_DEF_SMETHOD_BANG(new, -1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "property", &gobj_s_property, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "properties", &gobj_s_properties, -1); RG_DEF_SMETHOD(install_property, -1); q_ruby_getter = g_quark_from_static_string("__ruby_getter"); q_ruby_setter = g_quark_from_static_string("__ruby_setter"); RG_DEF_METHOD(set_property, 2); RG_DEF_METHOD(get_property, 1); RG_DEF_METHOD(freeze_notify, 0); rb_undef_method(RG_TARGET_NAMESPACE, "notify"); RG_DEF_METHOD(notify, 1); RG_DEF_METHOD(thaw_notify, 0); RG_DEF_METHOD_P(destroyed, 0); RG_DEF_METHOD(initialize, -1); rbg_define_method(RG_TARGET_NAMESPACE, "ref_count", gobj_ref_count, 0); /* for debugging */ RG_DEF_METHOD(unref, 0); RG_DEF_METHOD(inspect, 0); RG_DEF_METHOD(type_name, 0); eNoPropertyError = rb_define_class_under(mGLib, "NoPropertyError", rb_eNameError); 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(); /* subclass */ 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)}"); } ����������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_unichar.c����������������������������������������������0000644�0001750�0001750�00000014237�12257552167�020551� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mUniChar #define DEF_IS_UNICHAR(name) \ static VALUE \ rbglib_m_unichar_is ## name(G_GNUC_UNUSED VALUE self, VALUE unichar) \ { \ return CBOOL2RVAL(g_unichar_is ## name(NUM2UINT(unichar))); \ } DEF_IS_UNICHAR(alnum) DEF_IS_UNICHAR(alpha) DEF_IS_UNICHAR(cntrl) DEF_IS_UNICHAR(digit) DEF_IS_UNICHAR(graph) DEF_IS_UNICHAR(lower) DEF_IS_UNICHAR(print) DEF_IS_UNICHAR(punct) DEF_IS_UNICHAR(space) DEF_IS_UNICHAR(upper) DEF_IS_UNICHAR(xdigit) DEF_IS_UNICHAR(title) DEF_IS_UNICHAR(defined) DEF_IS_UNICHAR(wide) DEF_IS_UNICHAR(wide_cjk) #undef DEF_IS_UNICHAR static VALUE rg_s_to_upper(G_GNUC_UNUSED VALUE self, VALUE unichar) { return UINT2NUM(g_unichar_toupper(NUM2UINT(unichar))); } static VALUE rg_s_to_lower(G_GNUC_UNUSED VALUE self, VALUE unichar) { return UINT2NUM(g_unichar_tolower(NUM2UINT(unichar))); } static VALUE rg_s_to_title(G_GNUC_UNUSED VALUE self, VALUE unichar) { return UINT2NUM(g_unichar_totitle(NUM2UINT(unichar))); } static VALUE rg_s_digit_value(G_GNUC_UNUSED VALUE self, VALUE unichar) { return INT2NUM(g_unichar_digit_value(NUM2UINT(unichar))); } static VALUE rg_s_xdigit_value(G_GNUC_UNUSED VALUE self, VALUE unichar) { return INT2NUM(g_unichar_xdigit_value(NUM2UINT(unichar))); } static VALUE rg_s_type(G_GNUC_UNUSED VALUE self, VALUE unichar) { return GENUM2RVAL(g_unichar_type(NUM2UINT(unichar)), G_TYPE_UNICODE_TYPE); } static VALUE rg_s_break_type(G_GNUC_UNUSED VALUE self, VALUE unichar) { return GENUM2RVAL(g_unichar_break_type(NUM2UINT(unichar)), G_TYPE_UNICODE_BREAK_TYPE); } static VALUE rg_s_get_mirror_char(G_GNUC_UNUSED VALUE self, VALUE unichar) { gunichar mirrored_char; if (g_unichar_get_mirror_char(NUM2UINT(unichar), &mirrored_char)) { return UINT2NUM(mirrored_char); } else { return unichar; } } #if GLIB_CHECK_VERSION(2,14,0) static VALUE rg_s_combining_class(G_GNUC_UNUSED VALUE self, VALUE unichar) { return INT2NUM(g_unichar_combining_class(NUM2UINT(unichar))); } static VALUE rg_s_get_script(G_GNUC_UNUSED VALUE self, VALUE unichar) { return GENUM2RVAL(g_unichar_get_script(NUM2UINT(unichar)), G_TYPE_UNICODE_SCRIPT); } static VALUE rg_s_mark_p(G_GNUC_UNUSED VALUE self, VALUE unichar) { return CBOOL2RVAL(g_unichar_ismark(NUM2UINT(unichar))); } static VALUE rg_s_zero_width_p(G_GNUC_UNUSED VALUE self, VALUE unichar) { return CBOOL2RVAL(g_unichar_iszerowidth(NUM2UINT(unichar))); } #endif static VALUE rg_s_to_utf8(G_GNUC_UNUSED VALUE self, VALUE unichar) { gchar utf8[6]; gint len; len = g_unichar_to_utf8(NUM2UINT(unichar), utf8); return CSTR2RVAL_LEN(utf8, len); } void Init_glib_unichar(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "UniChar"); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "alnum?", rbglib_m_unichar_isalnum, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "alpha?", rbglib_m_unichar_isalpha, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "cntrl?", rbglib_m_unichar_iscntrl, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "digit?", rbglib_m_unichar_isdigit, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "graph?", rbglib_m_unichar_isgraph, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "lower?", rbglib_m_unichar_islower, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "print?", rbglib_m_unichar_isprint, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "punct?", rbglib_m_unichar_ispunct, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "space?", rbglib_m_unichar_isspace, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "upper?", rbglib_m_unichar_isupper, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "xdigit?", rbglib_m_unichar_isxdigit, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "title?", rbglib_m_unichar_istitle, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "defined?", rbglib_m_unichar_isdefined, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "wide?", rbglib_m_unichar_iswide, 1); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "wide_cjk?", rbglib_m_unichar_iswide_cjk, 1); RG_DEF_SMETHOD(to_upper, 1); RG_DEF_SMETHOD(to_lower, 1); RG_DEF_SMETHOD(to_title, 1); RG_DEF_SMETHOD(digit_value, 1); RG_DEF_SMETHOD(xdigit_value, 1); RG_DEF_SMETHOD(type, 1); RG_DEF_SMETHOD(break_type, 1); RG_DEF_SMETHOD(get_mirror_char, 1); #if GLIB_CHECK_VERSION(2,14,0) RG_DEF_SMETHOD(combining_class, 1); RG_DEF_SMETHOD(get_script, 1); RG_DEF_SMETHOD_P(mark, 1); RG_DEF_SMETHOD_P(zero_width, 1); #endif RG_DEF_SMETHOD(to_utf8, 1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_valuearray.c�������������������������������������������0000644�0001750�0001750�00000005207�11701304107�021252� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 Sjoerd Simons * * 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 "rbgprivate.h" static VALUE value_array_to_ruby(const GValue *from) { VALUE ary; guint i; GValueArray *array = (GValueArray *)g_value_get_boxed(from); if (array == NULL) return Qnil; ary = rb_ary_new(); for (i = 0; i < array->n_values; i++) rb_ary_push(ary, GVAL2RVAL(g_value_array_get_nth(array, i))); return ary; } struct value_array_from_ruby_args { VALUE ary; long n; GValueArray *result; }; static VALUE value_array_from_ruby_body(VALUE value) { long i; struct value_array_from_ruby_args *args = (struct value_array_from_ruby_args *)value; for (i = 0; i < args->n; i++) { GValue v = G_VALUE_INIT; g_value_init(&v, RVAL2GTYPE(RARRAY_PTR(args->ary)[i])); rbgobj_rvalue_to_gvalue(RARRAY_PTR(args->ary)[i], &v); g_value_array_append(args->result, &v); } return Qnil; } static G_GNUC_NORETURN VALUE value_array_from_ruby_rescue(VALUE value) { g_value_array_free(((struct value_array_from_ruby_args *)value)->result); rb_exc_raise(rb_errinfo()); } static void value_array_from_ruby(const VALUE from, GValue *to) { struct value_array_from_ruby_args args; if (NIL_P(from)) { g_value_set_boxed(to, NULL); return; } args.ary = rb_ary_to_ary(from); args.n = RARRAY_LEN(args.ary); args.result = g_value_array_new(args.n); rb_rescue(value_array_from_ruby_body, (VALUE)&args, value_array_from_ruby_rescue, (VALUE)&args); g_value_set_boxed(to, args.result); } void Init_gobject_value_array(void) { /* ValueArray is treated as Array */ rbgobj_register_g2r_func(G_TYPE_VALUE_ARRAY, value_array_to_ruby); rbgobj_register_r2g_func(G_TYPE_VALUE_ARRAY, value_array_from_ruby); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_typemodule.c�������������������������������������������0000644�0001750�0001750�00000004321�11701304107�021262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cTypeModule static VALUE rg_use(VALUE self) { return CBOOL2RVAL(g_type_module_use(G_TYPE_MODULE(RVAL2GOBJ(self)))); } static VALUE rg_unuse(VALUE self) { g_type_module_unuse(G_TYPE_MODULE(RVAL2GOBJ(self))); return self; } static VALUE rg_name(VALUE self) { return rb_str_new2(G_TYPE_MODULE(RVAL2GOBJ(self))->name); } static VALUE rg_operator_set_name(VALUE self, VALUE name) { g_type_module_set_name(G_TYPE_MODULE(RVAL2GOBJ(self)), StringValuePtr(name)); return name; } #if 0 GType g_type_module_register_type (GTypeModule *module, GType parent_type, const gchar *type_name, const GTypeInfo *type_info, GTypeFlags flags); void g_type_module_add_interface (GTypeModule *module, GType instance_type, GType interface_type, const GInterfaceInfo *interface_info); #endif void Init_gobject_gtypemodule(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TYPE_MODULE, "TypeModule", mGLib); RG_DEF_METHOD(use, 0); RG_DEF_METHOD(unuse, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD_OPERATOR("name=", set_name, 1); }���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_gettext.c����������������������������������������������0000644�0001750�0001750�00000003035�12257552167�020576� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 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 "rbgprivate.h" #include "rbglib.h" #include <libintl.h> #define RG_TARGET_NAMESPACE mGetText static VALUE rg_s_bindtextdomain(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE domain_name; VALUE directory; const char *current_directory = NULL; rb_scan_args(argc, argv, "11", &domain_name, &directory); current_directory = bindtextdomain(RVAL2CSTR(domain_name), RVAL2CSTR_ACCEPT_NIL(directory)); return CSTR2RVAL(current_directory); } void Init_glib_gettext(void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "GetText"); RG_DEF_SMETHOD(bindtextdomain, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglibdeprecated.h��������������������������������������������0000644�0001750�0001750�00000002324�11701304107�021036� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002-2005 Ruby-GNOME2 Project * Copyright (C) 2002,2003 Masahiro Sakai * * 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 __RBGLIBDEPRECATED_H__ #define __RBGLIBDEPRECATED_H__ G_BEGIN_DECLS #define CSTRFILENAMEARRAY2RVAL_FREE(s) (rbg_filename_gslist_to_array_free(s)) extern VALUE rbg_filename_gslist_to_array_free(GSList *list); G_END_DECLS #endif /* __RBGLIBDEPRECATED_H__ */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_int64.c������������������������������������������������0000644�0001750�0001750�00000010041�11701304107�020027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003 Masahiro Sakai * Copyright (C) 2002 Masahiro Sakai * Kenichi Komiya * * 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 "rbgprivate.h" static ID id_and; static ID id_rshift; static ID id_lshift; static ID id_lt; static ID id_plus; static ID id_uminus; static ID id_abs; static VALUE max_PRUint32; typedef guint64 PRUint64; typedef gint64 PRInt64; #define LL_ZERO G_GINT64_CONSTANT(0) #define LL_UI2L(lhs,rhs) ((lhs)=(rhs)) #define LL_L2UI(lhs,rhs) ((lhs)=(guint32)(rhs)) #define LL_SHL(lhs,v1,v2) ((lhs)=(v1)<<(v2)) #define LL_SHR(lhs,v1,v2) ((lhs)=(v1)>>(v2)) #define LL_ADD(lhs,v1,v2) ((lhs)=(v1)+(v2)) #define LL_NEG(lhs,rhs) ((lhs)=-(rhs)) #define LL_CMP(v1,op,v2) ((v1) op (v2)) /**********************************************************************/ /* following is ripped from rbXPCOM-0.0.3 http://www.ruby-lang.org/en/raa-list.rhtml?name=rbXPCOM Copyright (C) 2001 Kenichi Komiya <kom@mail1.accsnet.ne.jp> */ static PRUint64 RubyTo64BitInt(VALUE aRuby) { VALUE bitMask = max_PRUint32; VALUE lo = rb_funcall(aRuby, id_and, 1, bitMask); VALUE hi = rb_funcall(aRuby, id_rshift, 1, INT2FIX(32)); PRUint64 result, hi64, lo64; LL_UI2L(hi64, NUM2UINT(hi)); LL_UI2L(lo64, NUM2UINT(lo)); LL_SHL(result, hi64, 32); LL_ADD(result, result, lo64); return result; } static inline PRUint64 RubyToPRUint64(VALUE aRuby) { return RubyTo64BitInt(aRuby); } static PRInt64 RubyToPRInt64(VALUE aRuby) { if(RVAL2CBOOL(rb_funcall(aRuby, id_lt, 1, INT2FIX(0)))) { VALUE absRuby = rb_funcall(aRuby, id_abs, 0); PRInt64 result; LL_NEG(result, RubyTo64BitInt(absRuby)); return result; } else return (PRInt64)RubyTo64BitInt(aRuby); } static VALUE RubyFrom64BitInt(PRUint64 aNative) { PRUint64 lo64, hi64; LL_L2UI(lo64, aNative); LL_SHR(hi64, aNative, 32); { VALUE lo = UINT2NUM(lo64); VALUE hi = UINT2NUM(hi64); VALUE hiRuby = rb_funcall(hi, id_lshift, 1, INT2FIX(32)); return rb_funcall(hiRuby, id_plus, 1, lo); } } static inline VALUE PRUint64ToRuby(PRUint64 aNative) { return RubyFrom64BitInt(aNative); } static VALUE PRInt64ToRuby(PRInt64 aNative) { if(LL_CMP(aNative, <, LL_ZERO)) { PRUint64 abs64; LL_NEG(abs64, aNative); return rb_funcall(RubyFrom64BitInt(abs64), id_uminus, 0); } else return RubyFrom64BitInt((PRUint64)aNative); } /* end of ripping */ /**********************************************************************/ VALUE rbglib_int64_to_num(guint64 val) { return PRInt64ToRuby(val); } VALUE rbglib_uint64_to_num(guint64 val) { return PRUint64ToRuby(val); } gint64 rbglib_num_to_int64(VALUE val) { return RubyToPRInt64(val); } guint64 rbglib_num_to_uint64(VALUE val) { return RubyToPRUint64(val); } /**********************************************************************/ void Init_glib_int64(void) { id_and = rb_intern("&"); id_rshift = rb_intern(">>"); id_lshift = rb_intern("<<"); id_lt = rb_intern("<"); id_plus = rb_intern("+"); id_uminus = rb_intern("-@"); id_abs = rb_intern("abs"); rb_global_variable(&max_PRUint32); max_PRUint32 = UINT2NUM(0xffffffffL); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_iochannel_win32_socket.c�������������������������������0000644�0001750�0001750�00000003172�11704226436�023437� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #ifdef G_OS_WIN32 #define RG_TARGET_NAMESPACE cIOChannelWin32Socket static VALUE rg_initialize(VALUE self, VALUE socket) { GIOChannel *io = NULL; int fd; rb_secure(4); /* TODO: support IO object */ fd = NUM2INT(socket); io = g_io_channel_win32_new_socket(rb_w32_get_osfhandle(fd)); G_INITIALIZE(self, io); return Qnil; } #endif void Init_glib_io_channel_win32_socket(void) { #ifdef G_OS_WIN32 /* GIOWin32Channel */ VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "IOChannelWin32Socket", rb_const_get(mGLib, rb_intern("IOChannel"))); RG_DEF_METHOD(initialize, 1); #endif } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_utf16.c������������������������������������������������0000664�0001750�0001750�00000004220�11740310343�020036� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mUTF16 static VALUE rg_s_to_ucs4(G_GNUC_UNUSED VALUE self, VALUE rb_utf16) { VALUE result; gunichar *ucs4; gunichar2 *utf16; glong len, items_written; GError *error = NULL; utf16 = (gunichar2 *)StringValueCStr(rb_utf16); len = RSTRING_LEN(rb_utf16) / sizeof(*utf16); ucs4 = g_utf16_to_ucs4(utf16, len, NULL, &items_written, &error); if (error) RAISE_GERROR(error); result = CSTR2RVAL_LEN_UCS4((char *)ucs4, items_written * sizeof(*ucs4)); g_free(ucs4); return result; } static VALUE rg_s_to_utf8(G_GNUC_UNUSED VALUE self, VALUE rb_utf16) { VALUE result; gchar *utf8; gunichar2 *utf16; glong len, items_written; GError *error = NULL; utf16 = (gunichar2 *)StringValueCStr(rb_utf16); len = RSTRING_LEN(rb_utf16) / sizeof(*utf16); utf8 = g_utf16_to_utf8(utf16, len, NULL, &items_written, &error); if (error) RAISE_GERROR(error); result = CSTR2RVAL_LEN(utf8, items_written * sizeof(*utf8)); g_free(utf8); return result; } void Init_glib_utf16(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "UTF16"); RG_DEF_SMETHOD(to_ucs4, 1); RG_DEF_SMETHOD(to_utf8, 1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_signal.c�����������������������������������������������0000664�0001750�0001750�00000071074�11740310343�020365� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cSignal static VALUE RG_TARGET_NAMESPACE; VALUE rbgobj_signal_wrap(guint sig_id); #define default_handler_method_prefix "signal_do_" /**********************************************************************/ static VALUE signal_func_table; void rbgobj_set_signal_func(VALUE klass, const gchar *sig_name, GValToRValSignalFunc func) { VALUE obj = Data_Wrap_Struct(rb_cData, NULL, NULL, func); guint signal_id = g_signal_lookup(sig_name, CLASS2GTYPE(klass)); rb_hash_aset(signal_func_table, UINT2NUM(signal_id), obj); } GValToRValSignalFunc rbgobj_get_signal_func(guint signal_id) { GValToRValSignalFunc func = NULL; VALUE func_obj = rb_hash_aref(signal_func_table, UINT2NUM(signal_id)); if (!NIL_P(func_obj)) Data_Get_Struct(func_obj, void, func); return func; } /**********************************************************************/ static VALUE eNoSignalError; // FIXME: use rb_protect static gboolean accumulator_func(G_GNUC_UNUSED GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer data) { VALUE proc = (VALUE)data; VALUE val = GVAL2RVAL(return_accu); VALUE new = GVAL2RVAL(handler_return); VALUE hint = Qnil; // FIXME VALUE tmp; gboolean continue_emission = TRUE; tmp = rb_funcall(proc, rb_intern("call"), 3, hint, val, new); /* FIXME */ if (TYPE(tmp) == T_ARRAY) { continue_emission = RVAL2CBOOL(rb_ary_entry(tmp, 0)); val = rb_ary_entry(tmp, 1); } else { val = tmp; } rbgobj_rvalue_to_gvalue(val, return_accu); return continue_emission; } struct rval2gtypes_args { VALUE ary; long n; GType *result; }; static VALUE rbg_rval2gtypes_body(VALUE value) { long i; struct rval2gtypes_args *args = (struct rval2gtypes_args *)value; for (i = 0; i < args->n; i++) args->result[i] = rbgobj_gtype_get(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rbg_rval2gtypes_rescue(VALUE value) { g_free(((struct rval2gtypes_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GType * rbg_rval2gtypes(volatile VALUE *value, long *n) { struct rval2gtypes_args args; args.ary = *value = rb_ary_dup(rb_ary_to_ary(*value)); args.n = RARRAY_LEN(args.ary); args.result = g_new(GType, args.n + 1); rb_rescue(rbg_rval2gtypes_body, (VALUE)&args, rbg_rval2gtypes_rescue, (VALUE)&args); if (n != NULL) *n = args.n; return args.result; } static GType * rbg_rval2gtypes_accept_nil(volatile VALUE *value, long *n) { if (!NIL_P(*value)) return rbg_rval2gtypes(value, n); if (n != NULL) *n = 0; return NULL; } #define RVAL2GTYPES(value, n) rbg_rval2gtypes(&(value), &(n)) #define RVAL2GTYPES_ACCEPT_NIL(value, n) rbg_rval2gtypes_accept_nil(&(value), &(n)) static VALUE gobj_s_signal_new(int argc, VALUE* argv, VALUE self) { const RGObjClassInfo *cinfo = rbgobj_lookup_class(self); VALUE rbsignal_name, rbsignal_flags, accumulator, rbreturn_type, params; const gchar *signal_name; GSignalFlags signal_flags; GClosure *class_closure; GType return_type; GType *param_types; long n_params; guint signal; rb_scan_args(argc, argv, "4*", &rbsignal_name, &rbsignal_flags, &accumulator, &rbreturn_type, ¶ms); if (cinfo->klass != self) rb_raise(rb_eTypeError, "not a registered class: %s", rb_class2name(self)); if (SYMBOL_P(rbsignal_name)) rbsignal_name = rb_str_new2(rb_id2name(SYM2ID(rbsignal_name))); signal_name = RVAL2CSTR(rbsignal_name); signal_flags = NUM2INT(rbsignal_flags); { VALUE factory; VALUE proc; ID method_id; method_id = rb_to_id(rb_str_concat(rb_str_new2(default_handler_method_prefix), rbsignal_name)); factory = rb_eval_string( "lambda{|klass, id|\n" " lambda{|instance,*args|\n" " klass.instance_method(id).bind(instance).call(*args)\n" " }\n" "}\n"); proc = rb_funcall(factory, rb_intern("call"), 2, self, ID2SYM(method_id)); class_closure = g_rclosure_new(proc, Qnil, NULL); /* TODO: Should this be done even if something below it fails? */ g_rclosure_attach(class_closure, self); } return_type = rbgobj_gtype_get(rbreturn_type); param_types = RVAL2GTYPES_ACCEPT_NIL(params, n_params); signal = g_signal_newv(signal_name, cinfo->gtype, signal_flags, class_closure, NIL_P(accumulator) ? NULL : accumulator_func, NIL_P(accumulator) ? NULL : (gpointer)accumulator, NULL, /* c_marshaller */ return_type, n_params, param_types); g_free(param_types); if (!signal) rb_raise(rb_eRuntimeError, "g_signal_newv failed"); if (!NIL_P(accumulator)) G_RELATIVE(self, accumulator); /* FIXME */ return rbgobj_signal_wrap(signal); } static void _signal_list(VALUE result, GType gtype) { guint n_ids, i; guint* ids = g_signal_list_ids(gtype, &n_ids); for (i = 0; i < n_ids; i++) rb_ary_push(result, rb_str_new2(g_signal_name(ids[i]))); g_free(ids); } static VALUE gobj_s_signals(int argc, VALUE* argv, VALUE self) { GType gtype; VALUE inherited_too, result; if (rb_scan_args(argc, argv, "01", &inherited_too) == 0) inherited_too = Qtrue; gtype = CLASS2GTYPE(self); result = rb_ary_new(); if (RVAL2CBOOL(inherited_too)){ guint n_interfaces, i; GType* interfaces = g_type_interfaces(gtype, &n_interfaces); for (i = 0; i < n_interfaces; i++) _signal_list(result, interfaces[i]); g_free(interfaces); for (; gtype; gtype = g_type_parent(gtype)) _signal_list(result, gtype); } else if (GTYPE2CLASS(gtype) == self) { _signal_list(result, gtype); } return result; } static VALUE gobj_s_signal(VALUE self, VALUE name) { const char* sig_name; guint sig_id; if (SYMBOL_P(name)) sig_name = rb_id2name(SYM2ID(name)); else sig_name = StringValuePtr(name); sig_id = g_signal_lookup(sig_name, CLASS2GTYPE(self)); if (!sig_id) rb_raise(eNoSignalError, "no such signal: %s", sig_name); return rbgobj_signal_wrap(sig_id); } static VALUE gobj_sig_has_handler_pending(int argc, VALUE *argv, VALUE self) { VALUE sig, may_be_blocked; const char* sig_name; guint signal_id; GQuark detail; rb_scan_args(argc, argv, "11", &sig, &may_be_blocked); if (SYMBOL_P(sig)) sig_name = rb_id2name(SYM2ID(sig)); else sig_name = StringValuePtr(sig); if (!g_signal_parse_name(sig_name, CLASS2GTYPE(CLASS_OF(self)), &signal_id, &detail, TRUE)) rb_raise(eNoSignalError, "no such signal: %s", sig_name); return CBOOL2RVAL(g_signal_has_handler_pending(RVAL2GOBJ(self), signal_id, detail, RVAL2CBOOL(may_be_blocked))); } static VALUE gobj_sig_connect_impl(gboolean after, int argc, VALUE *argv, VALUE self) { VALUE sig, rest; gulong handler_id; GClosure* rclosure; const char* sig_name; guint signal_id; GQuark detail; VALUE func; GObject *g_object; gchar *tag; rb_scan_args(argc, argv, "1*", &sig, &rest); if (NIL_P(rest)) rest = rb_ary_new(); if (SYMBOL_P(sig)) sig_name = rb_id2name(SYM2ID(sig)); else sig_name = StringValuePtr(sig); if (!g_signal_parse_name(sig_name, CLASS2GTYPE(CLASS_OF(self)), &signal_id, &detail, TRUE)) rb_raise(eNoSignalError, "no such signal: %s", sig_name); func = rb_block_proc(); rclosure = g_rclosure_new(func, rest, rbgobj_get_signal_func(signal_id)); g_rclosure_attach((GClosure *)rclosure, self); g_object = RVAL2GOBJ(self); tag = g_strdup_printf("%s::%s", G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(g_object)), sig_name); g_rclosure_set_tag((GClosure *)rclosure, tag); g_free(tag); handler_id = g_signal_connect_closure_by_id(g_object, signal_id, detail, rclosure, after); return ULONG2NUM(handler_id); } static VALUE gobj_sig_connect(int argc, VALUE *argv, VALUE self) { return gobj_sig_connect_impl(FALSE, argc, argv, self); } static VALUE gobj_sig_connect_after(int argc, VALUE *argv, VALUE self) { return gobj_sig_connect_impl(TRUE, argc, argv, self); } #if 0 static VALUE gobj_sig_get_invocation_hint(VALUE self) { GSignalInvocationHint* hint; hint = g_signal_get_invocation_hint(RVAL2GOBJ(self)); return rb_ary_new3(3, rbgobj_signal_wrap(hint->signal_id), hint->detail ? rb_str_new2(g_quark_to_string(hint->detail)) : Qnil, INT2NUM(hint->run_type)); } #endif struct emit_arg { VALUE self; VALUE args; GSignalQuery query; GQuark detail; GValueArray* instance_and_params; }; static VALUE emit_body(struct emit_arg* arg) { GValue param = G_VALUE_INIT; g_value_init(¶m, G_TYPE_FROM_INSTANCE(RVAL2GOBJ(arg->self))); rbgobj_rvalue_to_gvalue(arg->self, ¶m); g_value_array_append(arg->instance_and_params, ¶m); g_value_unset(¶m); { guint i; for (i = 0; i < arg->query.n_params; i++){ GType gtype = arg->query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE; g_value_init(¶m, gtype); rbgobj_rvalue_to_gvalue(rb_ary_entry(arg->args, i), ¶m); g_value_array_append(arg->instance_and_params, ¶m); g_value_unset(¶m); } } { gboolean use_ret = (arg->query.return_type != G_TYPE_NONE); GValue return_value = G_VALUE_INIT; if (use_ret) g_value_init(&return_value, arg->query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE); g_signal_emitv(arg->instance_and_params->values, arg->query.signal_id, arg->detail, (use_ret) ? &return_value : NULL); if (use_ret) { VALUE ret = GVAL2RVAL(&return_value); g_value_unset(&return_value); return ret; } else { return Qnil; } } } static VALUE emit_ensure(struct emit_arg* arg) { g_value_array_free(arg->instance_and_params); return Qnil; } static VALUE gobj_sig_emit(int argc, VALUE *argv, VALUE self) { VALUE sig; const char* sig_name; guint signal_id; struct emit_arg arg; rb_scan_args(argc, argv, "1*", &sig, &arg.args); if (SYMBOL_P(sig)) sig_name = rb_id2name(SYM2ID(sig)); else sig_name = StringValuePtr(sig); if (!g_signal_parse_name(sig_name, CLASS2GTYPE(CLASS_OF(self)), &signal_id, &arg.detail, FALSE)) rb_raise(eNoSignalError, "invalid signal \"%s\"", sig_name); g_signal_query(signal_id, &arg.query); if (arg.query.n_params != (guint)RARRAY_LEN(arg.args)) rb_raise(rb_eArgError, "wrong number of arguments(%ld for %d)", RARRAY_LEN(arg.args) + 1, arg.query.n_params + 1); arg.self = self; arg.instance_and_params = g_value_array_new(1 + arg.query.n_params); return rb_ensure(emit_body, (VALUE)&arg, emit_ensure, (VALUE)&arg); } static VALUE gobj_sig_emit_stop(VALUE self, VALUE sig) { gpointer instance = RVAL2GOBJ(self); const char* sig_name; guint signal_id; GQuark detail; if (SYMBOL_P(sig)) sig_name = rb_id2name(SYM2ID(sig)); else sig_name = StringValuePtr(sig); if (!g_signal_parse_name(sig_name, CLASS2GTYPE(CLASS_OF(self)), &signal_id, &detail, FALSE)) rb_raise(eNoSignalError, "invalid signal \"%s\"", sig_name); g_signal_stop_emission(instance, signal_id, detail); return self; } static VALUE gobj_sig_handler_unblock(VALUE self, VALUE id); static VALUE _sig_handler_block_ensure(VALUE arg) { VALUE self = RARRAY_PTR(arg)[0]; VALUE id = RARRAY_PTR(arg)[1]; gobj_sig_handler_unblock(self, id); return Qnil; } static VALUE gobj_sig_handler_block(VALUE self, VALUE id) { g_signal_handler_block(RVAL2GOBJ(self), NUM2ULONG(id)); if (rb_block_given_p()) rb_ensure(rb_yield, self, _sig_handler_block_ensure, rb_ary_new3(2, self, id)); return self; } static VALUE gobj_sig_handler_unblock(VALUE self, VALUE id) { g_signal_handler_unblock(RVAL2GOBJ(self), NUM2ULONG(id)); return self; } static VALUE gobj_sig_handler_disconnect(VALUE self, VALUE id) { g_signal_handler_disconnect(RVAL2GOBJ(self), NUM2ULONG(id)); return self; } static VALUE gobj_sig_handler_is_connected(VALUE self, VALUE id) { return CBOOL2RVAL(g_signal_handler_is_connected(RVAL2GOBJ(self), NUM2ULONG(id))); } #if 0 gulong g_signal_handler_find (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); guint g_signal_handlers_block_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); guint g_signal_handlers_unblock_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); guint g_signal_handlers_disconnect_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); #endif static VALUE chain_from_overridden_body(struct emit_arg* arg) { g_value_init(arg->instance_and_params->values, G_TYPE_FROM_INSTANCE(RVAL2GOBJ(arg->self))); rbgobj_rvalue_to_gvalue(arg->self, arg->instance_and_params->values); { GValue* params = arg->instance_and_params->values + 1; guint i; for (i = 0; i < arg->query.n_params; i++) { GType gtype = arg->query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE; g_value_init(params + i, gtype); rbgobj_rvalue_to_gvalue(rb_ary_entry(arg->args, i), params + i); } } { gboolean use_ret = (arg->query.return_type != G_TYPE_NONE); GValue return_value = G_VALUE_INIT; if (use_ret) g_value_init(&return_value, arg->query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE); g_signal_chain_from_overridden(arg->instance_and_params->values, (use_ret) ? &return_value : NULL); if (use_ret) { VALUE ret = GVAL2RVAL(&return_value); g_value_unset(&return_value); return ret; } else { return Qnil; } } } static VALUE gobj_sig_chain_from_overridden(int argc, VALUE *argv, VALUE self) { struct emit_arg arg; { GSignalInvocationHint* hint; hint = g_signal_get_invocation_hint(RVAL2GOBJ(self)); if (!hint) rb_raise(rb_eRuntimeError, "can't get signal invocation hint"); g_signal_query(hint->signal_id, &arg.query); } if (arg.query.n_params != (guint)argc) rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)", argc, arg.query.n_params); arg.self = self; arg.args = rb_ary_new4(argc, argv); arg.instance_and_params = g_value_array_new(1 + argc); return rb_ensure(chain_from_overridden_body, (VALUE)&arg, emit_ensure, (VALUE)&arg); } static VALUE gobj_s_method_added(VALUE klass, VALUE id) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(klass); const char* name = rb_id2name(SYM2ID(id)); const int prefix_len = strlen(default_handler_method_prefix); guint signal_id; if (cinfo->klass != klass) return Qnil; if (strncmp(default_handler_method_prefix, name, prefix_len)) return Qnil; signal_id = g_signal_lookup(name + prefix_len, cinfo->gtype); if (!signal_id) return Qnil; { GSignalQuery query; g_signal_query(signal_id, &query); if (query.itype == cinfo->gtype) return Qnil; } { VALUE f = rb_eval_string( "lambda{|klass, id|\n" " lambda{|instance,*args|\n" " klass.instance_method(id).bind(instance).call(*args)\n" " }\n" "}\n"); VALUE proc = rb_funcall(f, rb_intern("call"), 2, klass, id); GClosure* rclosure = g_rclosure_new(proc, Qnil, rbgobj_get_signal_func(signal_id)); g_rclosure_attach((GClosure *)rclosure, klass); g_signal_override_class_closure(signal_id, cinfo->gtype, rclosure); } { VALUE mod = rb_define_module_under(klass, RubyGObjectHookModule); rb_include_module(klass, mod); rbg_define_method(mod, name, gobj_sig_chain_from_overridden, -1); } return Qnil; } /**********************************************************************/ VALUE rbgobj_signal_wrap(guint sig_id) { VALUE result; GSignalQuery* query; result = Data_Make_Struct(RG_TARGET_NAMESPACE, GSignalQuery, NULL, free, query); g_signal_query(sig_id, query); return result; } static VALUE rg_id(VALUE self) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); return UINT2NUM(query->signal_id); } static VALUE rg_name(VALUE self) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); return rb_str_new2(query->signal_name); } static VALUE rg_itype(VALUE self) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); return rbgobj_gtype_new(query->itype); } static VALUE rg_owner(VALUE self) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); return GTYPE2CLASS(query->itype); } static VALUE rg_return_type(VALUE self) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); return rbgobj_gtype_new(query->return_type); } static VALUE rg_flags(VALUE self) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); return UINT2NUM(query->signal_flags); } static VALUE rg_param_types(VALUE self) { GSignalQuery* query; VALUE result; guint i; Data_Get_Struct(self, GSignalQuery, query); result = rb_ary_new2(query->n_params); for (i = 0; i < query->n_params; i++) rb_ary_store(result, i, rbgobj_gtype_new(query->param_types[i])); return result; } static VALUE rg_inspect(VALUE self) { GSignalQuery* query; gchar* s; VALUE result, v; Data_Get_Struct(self, GSignalQuery, query); v = rb_inspect(GTYPE2CLASS(query->itype)); s = g_strdup_printf("#<%s: %s#%s>", rb_class2name(CLASS_OF(self)), StringValuePtr(v), query->signal_name); result = rb_str_new2(s); g_free(s); return result; } #define query_is_flag(flag) \ static VALUE \ query_is_##flag(VALUE self) \ { \ GSignalQuery* query; \ Data_Get_Struct(self, GSignalQuery, query); \ return CBOOL2RVAL(query->signal_flags & flag); \ } query_is_flag(G_SIGNAL_RUN_FIRST) query_is_flag(G_SIGNAL_RUN_LAST) query_is_flag(G_SIGNAL_RUN_CLEANUP) query_is_flag(G_SIGNAL_NO_RECURSE) query_is_flag(G_SIGNAL_DETAILED) query_is_flag(G_SIGNAL_ACTION) query_is_flag(G_SIGNAL_NO_HOOKS) static gboolean hook_func(GSignalInvocationHint* ihint, guint n_param_values, const GValue* param_values, gpointer data) { GClosure* closure = data; GValue ret_val =G_VALUE_INIT; gboolean ret; g_value_init(&ret_val, G_TYPE_BOOLEAN); g_closure_invoke(closure, &ret_val, n_param_values, param_values, ihint); ret = g_value_get_boolean(&ret_val); g_value_unset(&ret_val); return ret; } static gulong g_signal_add_emission_hook_closure (guint signal_id, GQuark detail, GClosure* closure) { guint hook_id; g_closure_ref(closure); g_closure_sink(closure); hook_id = g_signal_add_emission_hook(signal_id, detail, &hook_func, closure, (GDestroyNotify)&g_closure_unref); return hook_id; } static VALUE rg_add_emission_hook(int argc, VALUE* argv, VALUE self) { GSignalQuery* query; VALUE proc; guint hook_id; GQuark detail = 0; GClosure* closure; Data_Get_Struct(self, GSignalQuery, query); if (query->signal_flags & G_SIGNAL_DETAILED) { VALUE detail_obj; if (rb_scan_args(argc, argv, "01&", &detail_obj, &proc) == 1) { if (SYMBOL_P(detail_obj)) detail = g_quark_from_string(rb_id2name(SYM2ID(detail_obj))); else detail = g_quark_from_string(StringValuePtr(detail_obj)); } } else { rb_scan_args(argc, argv, "00&", &proc); } closure = g_rclosure_new(proc, Qnil, rbgobj_get_signal_func(query->signal_id)); g_rclosure_attach(closure, self); hook_id = g_signal_add_emission_hook_closure(query->signal_id, detail, closure); return ULONG2NUM(hook_id); } static VALUE rg_remove_emission_hook(VALUE self, VALUE hook_id) { GSignalQuery* query; Data_Get_Struct(self, GSignalQuery, query); g_signal_remove_emission_hook(query->signal_id, NUM2ULONG(hook_id)); return Qnil; } /**********************************************************************/ void rbgobj_define_action_methods(VALUE klass) { GType gtype = CLASS2GTYPE(klass); GString* source; guint n_ids; guint* ids; guint i; if (gtype == G_TYPE_INTERFACE) return; ids = g_signal_list_ids(gtype, &n_ids); if (n_ids == 0) return; source = g_string_new(NULL); for (i = 0; i < n_ids; i++){ GSignalQuery query; g_signal_query(ids[i], &query); if (query.signal_flags & G_SIGNAL_ACTION) { gchar* method_name = g_strdup(query.signal_name); gchar* p; GString* args; guint j; for (p = method_name; *p; p++) if (*p == '-') *p = '_'; args = g_string_new(NULL); for (j = 0; j < query.n_params; j++) g_string_append_printf(args, ",x%d", j); g_string_append_printf( source, "def %s(%s)\n signal_emit('%s'%s)\nend\n", method_name, (query.n_params > 0) ? args->str + 1 : "", // Skip initial ',' query.signal_name, args->str); g_free(method_name); g_string_free(args, TRUE); } } if (source->len > 0) rb_funcall(klass, rb_intern("module_eval"), 1, rb_str_new2(source->str)); g_string_free(source, TRUE); } /**********************************************************************/ void Init_gobject_gsignal(void) { VALUE cSignalFlags, cSignalMatchType; RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "Signal", rb_cData); RG_DEF_METHOD(id, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(itype, 0); RG_DEF_METHOD(owner, 0); RG_DEF_METHOD(return_type, 0); RG_DEF_METHOD(param_types, 0); RG_DEF_METHOD(inspect, 0); RG_DEF_METHOD(add_emission_hook, -1); RG_DEF_METHOD(remove_emission_hook, 1); /* GSignalFlags */ cSignalFlags = G_DEF_CLASS(G_TYPE_SIGNAL_FLAGS, "SignalFlags", mGLib); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SIGNAL_FLAGS, "G_SIGNAL_"); rb_define_const(cSignalFlags, "MASK", INT2NUM(G_SIGNAL_FLAGS_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "FLAGS_MASK", INT2NUM(G_SIGNAL_FLAGS_MASK)); rbg_define_method(RG_TARGET_NAMESPACE, "run_first?", query_is_G_SIGNAL_RUN_FIRST, 0); rbg_define_method(RG_TARGET_NAMESPACE, "run_last?", query_is_G_SIGNAL_RUN_LAST, 0); rbg_define_method(RG_TARGET_NAMESPACE, "run_cleanup?", query_is_G_SIGNAL_RUN_CLEANUP, 0); rbg_define_method(RG_TARGET_NAMESPACE, "no_recurse?", query_is_G_SIGNAL_NO_RECURSE, 0); rbg_define_method(RG_TARGET_NAMESPACE, "detailed?", query_is_G_SIGNAL_DETAILED, 0); rbg_define_method(RG_TARGET_NAMESPACE, "action?", query_is_G_SIGNAL_ACTION, 0); rbg_define_method(RG_TARGET_NAMESPACE, "no_hooks?", query_is_G_SIGNAL_NO_HOOKS, 0); /* GConnectFlags */ G_DEF_CLASS(G_TYPE_CONNECT_FLAGS, "ConnectFlags", mGLib); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_CONNECT_FLAGS, "G_"); /* GSignalMatchType */ cSignalMatchType = G_DEF_CLASS(G_TYPE_SIGNAL_MATCH_TYPE, "SignalMatchType", mGLib); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SIGNAL_MATCH_TYPE, "G_SIGNAL_"); rb_define_const(cSignalMatchType, "MASK", INT2NUM(G_SIGNAL_MATCH_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "MATCH_MASK", INT2NUM(G_SIGNAL_MATCH_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_STATIC_SCOPE", INT2FIX(G_SIGNAL_TYPE_STATIC_SCOPE)); eNoSignalError = rb_define_class_under(mGLib, "NoSignalError", rb_eNameError); signal_func_table = rb_hash_new(); rb_global_variable(&signal_func_table); rbg_define_method(mMetaInterface, "signal_new", gobj_s_signal_new, -1); rbg_define_method(mMetaInterface, "signals", gobj_s_signals, -1); rbg_define_method(mMetaInterface, "signal", gobj_s_signal, 1); rbg_define_method(cInstantiatable, "signal_has_handler_pending?", gobj_sig_has_handler_pending, -1); rbg_define_method(cInstantiatable, "signal_connect", gobj_sig_connect, -1); rbg_define_method(cInstantiatable, "signal_connect_after", gobj_sig_connect_after, -1); #if 0 rbg_define_method(cInstantiatable, "signal_invocation_hint", gobj_sig_get_invocation_hint, 0); #endif rbg_define_method(cInstantiatable, "signal_emit", gobj_sig_emit, -1); rbg_define_method(cInstantiatable, "signal_emit_stop", gobj_sig_emit_stop, 1); rbg_define_method(cInstantiatable, "signal_handler_block", gobj_sig_handler_block, 1); rbg_define_method(cInstantiatable, "signal_handler_unblock", gobj_sig_handler_unblock, 1); rbg_define_method(cInstantiatable, "signal_handler_disconnect", gobj_sig_handler_disconnect, 1); rbg_define_method(cInstantiatable, "signal_handler_is_connected?", gobj_sig_handler_is_connected, 1); rbg_define_singleton_method(cInstantiatable, "method_added", gobj_s_method_added, 1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_source.c�����������������������������������������������0000644�0001750�0001750�00000013475�12446160551�020413� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 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 "rbgprivate.h" static ID id_call; /*****************************************/ #if !GLIB_CHECK_VERSION(2,30,0) static void source_free(GSource *source) { g_source_unref(source); g_source_destroy(source); } GType g_source_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GSource", (GBoxedCopyFunc)g_source_ref, (GBoxedFreeFunc)source_free); return our_type; } #endif /*****************************************/ #define RG_TARGET_NAMESPACE cSource #define _SELF(s) ((GSource*)RVAL2BOXED(s, G_TYPE_SOURCE)) /* GSource* g_source_new (GSourceFuncs *source_funcs, guint struct_size); */ static VALUE rg_attach(int argc, VALUE *argv, VALUE self) { VALUE context; rb_scan_args(argc, argv, "01", &context); return UINT2NUM(g_source_attach(_SELF(self), RVAL2BOXED(context, G_TYPE_MAIN_CONTEXT))); } static VALUE rg_destroy(VALUE self) { g_source_destroy(_SELF(self)); return self; } static VALUE rg_destroyed_p(VALUE self) { return CBOOL2RVAL(g_source_is_destroyed(_SELF(self))); } static VALUE rg_set_priority(VALUE self, VALUE priority) { g_source_set_priority(_SELF(self), NUM2INT(priority)); return self; } static VALUE rg_priority(VALUE self) { return INT2NUM(g_source_get_priority(_SELF(self))); } static VALUE rg_set_can_recurse(VALUE self, VALUE can_recurse) { g_source_set_can_recurse(_SELF(self), RVAL2CBOOL(can_recurse)); return self; } static VALUE rg_can_recurse_p(VALUE self) { return CBOOL2RVAL(g_source_get_can_recurse(_SELF(self))); } static VALUE rg_id(VALUE self) { return UINT2NUM(g_source_get_id(_SELF(self))); } #if GLIB_CHECK_VERSION(2, 26, 0) static VALUE rg_name(VALUE self) { return CSTR2RVAL(g_source_get_name(_SELF(self))); } static VALUE rg_set_name(VALUE self, VALUE name) { g_source_set_name(_SELF(self), RVAL2CSTR(name)); return self; } #endif static VALUE rg_context(VALUE self) { GMainContext* context = g_source_get_context(_SELF(self)); return BOXED2RVAL(context, G_TYPE_MAIN_CONTEXT); } static gboolean source_func(gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 0)); } static VALUE rg_set_callback(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); g_source_set_callback(_SELF(self), (GSourceFunc)source_func, (gpointer)func, (GDestroyNotify)NULL); return self; } /* void g_source_set_callback_indirect (GSource *source, gpointer callback_data, GSourceCallbackFuncs *callback_funcs); */ #if GLIB_CHECK_VERSION(2, 36, 0) static VALUE rg_ready_time(VALUE self) { gint64 ready_time; ready_time = g_source_get_ready_time(_SELF(self)); return LL2NUM(ready_time); } static VALUE rg_set_ready_time(VALUE self, VALUE ready_time) { g_source_set_ready_time(_SELF(self), NUM2LL(ready_time)); return self; } #endif static VALUE rg_add_poll(VALUE self, VALUE fd) { g_source_add_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD)); return self; } static VALUE rg_remove_poll(VALUE self, VALUE fd) { g_source_remove_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD)); return self; } #if GLIB_CHECK_VERSION(2, 28, 0) static VALUE rg_time(VALUE self) { gint64 time; time = g_source_get_time(_SELF(self)); return LL2NUM(time); } #endif /* How can I implement them ? gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs, gpointer user_data); gboolean g_source_remove_by_user_data (gpointer user_data); */ void Init_glib_source(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOURCE, "Source", mGLib); id_call = rb_intern("call"); rb_define_const(RG_TARGET_NAMESPACE, "REMOVE", CBOOL2RVAL(G_SOURCE_REMOVE)); rb_define_const(RG_TARGET_NAMESPACE, "CONTINUE", CBOOL2RVAL(G_SOURCE_CONTINUE)); RG_DEF_METHOD(attach, -1); RG_DEF_METHOD(destroy, 0); RG_DEF_METHOD_P(destroyed, 0); RG_DEF_METHOD(set_priority, 1); RG_DEF_METHOD(priority, 0); RG_DEF_METHOD(set_can_recurse, 1); RG_DEF_METHOD_P(can_recurse, 0); RG_DEF_METHOD(id, 0); #if GLIB_CHECK_VERSION(2, 26, 0) RG_DEF_METHOD(name, 0); RG_REPLACE_SET_PROPERTY(name, 1); #endif RG_DEF_METHOD(context, 0); RG_DEF_METHOD(set_callback, 0); #if GLIB_CHECK_VERSION(2, 36, 0) RG_DEF_METHOD(ready_time, 0); RG_REPLACE_SET_PROPERTY(ready_time, 1); #endif RG_DEF_METHOD(add_poll, 1); RG_DEF_METHOD(remove_poll, 1); #if GLIB_CHECK_VERSION(2, 28, 0) RG_DEF_METHOD(time, 0); #endif /* GLib::Source.remove is moved to rbglib_maincontext.c */ } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/glib2.def�����������������������������������������������������0000644�0001750�0001750�00000007111�12516434313�017071� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������EXPORTS Init_glib2 mGLib DATA rbgobj_cType DATA rbgobj_id_children DATA rbgobj_add_relative rbgobj_invalidate_relatives rbgobj_add_relative_removable rbgobj_get_relative_removable rbgobj_remove_relative rbgobj_remove_relative_all rbgobj_define_class rbgobj_define_class_dynamic rbgobj_register_mark_func rbgobj_register_free_func rbgobj_instance_from_ruby_object rbgobj_ruby_object_from_instance rbgobj_ruby_object_from_instance2 rbgobj_ruby_object_from_instance_with_unref rbgobj_instance_unref rbgobj_get_ruby_object_from_gobject rbgobj_create_object rbgobj_gobject_new rbgobj_gobject_initialize rbgobj_boxed_create rbgobj_boxed_get rbgobj_boxed_get_default rbgobj_boxed_not_copy_obj rbgobj_boxed_unown rbgobj_make_boxed rbgobj_make_boxed_raw rbgobj_make_boxed_default rbgobj_add_abstract_but_create_instance_class rbgobj_gtype_get rbgobj_gtype_new rbgobj_gvalue_to_rvalue rbgobj_gvalue_to_rvalue_unset rbgobj_rvalue_to_gvalue rbgobj_initialize_gvalue rbgobj_initialize_object rbgobj_lookup_class rbgobj_lookup_class_by_gtype rbgobj_gtype_to_ruby_class rbgobj_ptr2cptr rbgobj_ptr_new rbgobj_make_enum rbgobj_get_enum rbgobj_make_flags rbgobj_get_flags rbgobj_register_g2r_func rbgobj_register_r2g_func rbgobj_register_class rbgobj_register_property_getter rbgobj_register_property_setter rbgobj_set_signal_func rbgobj_get_signal_func rbgobj_add_constants rbgobj_constant_remap rbgobj_signal_wrap g_rclosure_new g_rclosure_attach g_rclosure_set_tag rbgobj_ruby_value_get_type g_value_get_ruby_value g_value_set_ruby_value g_key_file_get_type rbg_rval_inspect rbg_string_value_ptr rbg_rval2cstr rbg_rval2cstr_accept_nil rbg_rval2cstr_accept_symbol rbg_rval2cstr_accept_symbol_accept_nil rbg_rval2glibid rbg_cstr2rval rbg_cstr2rval_len rbg_cstr2rval_len_free rbg_cstr2rval_with_encoding rbg_cstr2rval_len_with_encoding rbg_cstr2rval_free rbg_cstr2rval_with_free rbg_filename_to_ruby rbg_filename_to_ruby_free rbg_filename_from_ruby rbg_filename_gslist_to_array_free rbg_rval2strv rbg_rval2strv_accept_nil rbg_rval2strv_dup rbg_rval2strv_dup_accept_nil rbg_strv2rval rbg_strv2rval_free rbg_rval2gbooleans rbg_rval2gints rbg_rval2gint8s rbg_rval2guint8s rbg_rval2guint16s rbg_rval2guint32s rbg_rval2gdoubles rbg_gints2rval rbg_gints2rval_free rbg_glist2rval rbg_gslist2rval rbg_glist2rval_with_type rbg_gslist2rval_with_type rbg_define_method rbg_define_singleton_method rbg_to_array rbg_to_hash rbg_check_array_type rbg_check_hash_type rbg_scan_options rbg_inspect rbg_interrupt_source_new rbgutil_id_module_eval DATA rbgutil_def_setters rbgutil_glist2ary rbgutil_glist2ary_boxed rbgutil_glist2ary_string rbgutil_glist2ary_and_free rbgutil_glist2ary_boxed_and_free rbgutil_glist2ary_string_and_free rbgutil_gslist2ary rbgutil_gslist2ary_boxed rbgutil_gslist2ary_and_free rbgutil_gslist2ary_boxed_and_free rbgutil_set_properties rbgutil_glibid_r2g_func rbgutil_sym_g2r_func rbgutil_protect rbgutil_invoke_callback rbgutil_start_callback_dispatch_thread rbgutil_stop_callback_dispatch_thread rbgutil_string_set_utf8_encoding rbgutil_key_equal rbgerr_define_gerror rbgerr_gerror2exception rbgobj_convert_define rbgobj_gc_mark_gvalue rbgobj_gc_mark_instance rbglib_num_to_uint64 rbglib_uint64_to_num rbglib_num_to_int64 rbglib_int64_to_num g_source_get_type g_connect_flags_get_type g_poll_fd_get_type g_signal_flags_get_type �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/glib-enum-types.h���������������������������������������������0000644�0001750�0001750�00000014152�12446173027�020613� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Generated by glib-mkenums.rb ($Id$) */ #ifndef __GLIB_ENUM_TYPES_H__ #define __GLIB_ENUM_TYPES_H__ #include <glib-object.h> G_BEGIN_DECLS /* enumerations from "/usr/include/glib-2.0/glib/gvariant.h" */ GType g_variant_class_get_type (void); #define G_TYPE_VARIANT_CLASS (g_variant_class_get_type()) GType g_variant_parse_error_get_type (void); #define G_TYPE_VARIANT_PARSE_ERROR (g_variant_parse_error_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gspawn.h" */ GType g_spawn_error_get_type (void); #define G_TYPE_SPAWN_ERROR (g_spawn_error_get_type()) GType g_spawn_flags_get_type (void); #define G_TYPE_SPAWN_FLAGS (g_spawn_flags_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gkeyfile.h" */ GType g_key_file_error_get_type (void); #define G_TYPE_KEY_FILE_ERROR (g_key_file_error_get_type()) GType g_key_file_flags_get_type (void); #define G_TYPE_KEY_FILE_FLAGS (g_key_file_flags_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gnode.h" */ GType g_traverse_flags_get_type (void); #define G_TYPE_TRAVERSE_FLAGS (g_traverse_flags_get_type()) GType g_traverse_type_get_type (void); #define G_TYPE_TRAVERSE_TYPE (g_traverse_type_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gshell.h" */ GType g_shell_error_get_type (void); #define G_TYPE_SHELL_ERROR (g_shell_error_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gslice.h" */ GType g_slice_config_get_type (void); #define G_TYPE_SLICE_CONFIG (g_slice_config_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gregex.h" */ GType g_regex_error_get_type (void); #define G_TYPE_REGEX_ERROR (g_regex_error_get_type()) GType g_regex_compile_flags_get_type (void); #define G_TYPE_REGEX_COMPILE_FLAGS (g_regex_compile_flags_get_type()) GType g_regex_match_flags_get_type (void); #define G_TYPE_REGEX_MATCH_FLAGS (g_regex_match_flags_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gmarkup.h" */ GType g_markup_error_get_type (void); #define G_TYPE_MARKUP_ERROR (g_markup_error_get_type()) GType g_markup_parse_flags_get_type (void); #define G_TYPE_MARKUP_PARSE_FLAGS (g_markup_parse_flags_get_type()) GType g_markup_collect_type_get_type (void); #define G_TYPE_MARKUP_COLLECT_TYPE (g_markup_collect_type_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gtestutils.h" */ GType g_test_trap_flags_get_type (void); #define G_TYPE_TEST_TRAP_FLAGS (g_test_trap_flags_get_type()) GType g_test_subprocess_flags_get_type (void); #define G_TYPE_TEST_SUBPROCESS_FLAGS (g_test_subprocess_flags_get_type()) GType g_test_log_type_get_type (void); #define G_TYPE_TEST_LOG_TYPE (g_test_log_type_get_type()) GType g_test_file_type_get_type (void); #define G_TYPE_TEST_FILE_TYPE (g_test_file_type_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gfileutils.h" */ GType g_file_error_get_type (void); #define G_TYPE_FILE_ERROR (g_file_error_get_type()) GType g_file_test_get_type (void); #define G_TYPE_FILE_TEST (g_file_test_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gtimezone.h" */ GType g_time_type_get_type (void); #define G_TYPE_TIME_TYPE (g_time_type_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gdate.h" */ GType g_date_dm_y_get_type (void); #define G_TYPE_DATE_DM_Y (g_date_dm_y_get_type()) GType g_date_weekday_get_type (void); #define G_TYPE_DATE_WEEKDAY (g_date_weekday_get_type()) GType g_date_month_get_type (void); #define G_TYPE_DATE_MONTH (g_date_month_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gunicode.h" */ GType g_unicode_type_get_type (void); #define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type()) GType g_unicode_break_type_get_type (void); #define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type()) GType g_unicode_script_get_type (void); #define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type()) GType g_normalize_mode_get_type (void); #define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/ghook.h" */ GType g_hook_flag_mask_get_type (void); #define G_TYPE_HOOK_FLAG_MASK (g_hook_flag_mask_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gthread.h" */ GType g_thread_error_get_type (void); #define G_TYPE_THREAD_ERROR (g_thread_error_get_type()) GType g_once_status_get_type (void); #define G_TYPE_ONCE_STATUS (g_once_status_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gstrfuncs.h" */ GType g_ascii_type_get_type (void); #define G_TYPE_ASCII_TYPE (g_ascii_type_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gmessages.h" */ GType g_log_level_flags_get_type (void); #define G_TYPE_LOG_LEVEL_FLAGS (g_log_level_flags_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gchecksum.h" */ GType g_checksum_type_get_type (void); #define G_TYPE_CHECKSUM_TYPE (g_checksum_type_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gutils.h" */ GType g_user_directory_get_type (void); #define G_TYPE_USER_DIRECTORY (g_user_directory_get_type()) GType g_format_size_flags_get_type (void); #define G_TYPE_FORMAT_SIZE_FLAGS (g_format_size_flags_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/goption.h" */ GType g_option_flags_get_type (void); #define G_TYPE_OPTION_FLAGS (g_option_flags_get_type()) GType g_option_arg_get_type (void); #define G_TYPE_OPTION_ARG (g_option_arg_get_type()) GType g_option_error_get_type (void); #define G_TYPE_OPTION_ERROR (g_option_error_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gconvert.h" */ GType g_convert_error_get_type (void); #define G_TYPE_CONVERT_ERROR (g_convert_error_get_type()) /* enumerations from "/usr/include/glib-2.0/glib/gbookmarkfile.h" */ GType g_bookmark_file_error_get_type (void); #define G_TYPE_BOOKMARK_FILE_ERROR (g_bookmark_file_error_get_type()) /* enumerations from "/usr/include/glib-2.0/gobject/gsignal.h" */ GType g_signal_flags_get_type (void); #define G_TYPE_SIGNAL_FLAGS (g_signal_flags_get_type()) GType g_connect_flags_get_type (void); #define G_TYPE_CONNECT_FLAGS (g_connect_flags_get_type()) GType g_signal_match_type_get_type (void); #define G_TYPE_SIGNAL_MATCH_TYPE (g_signal_match_type_get_type()) G_END_DECLS #endif /* __GLIB_ENUM_TYPES_H__ */ /* Generated data ends here */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_error.c������������������������������������������������0000644�0001750�0001750�00000011662�12307003726�020234� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #include <ctype.h> static ID id_code; static ID id_domain; static ID id_code_classes; static VALUE gerror_table; static VALUE generic_error; static VALUE error_info; VALUE rbgerr_gerror2exception(GError *error) { VALUE exc = Qnil; VALUE exception_klass = Qnil; if (!error) { return rb_exc_new2(rb_eRuntimeError, "GError parameter doesn't have a value."); } exception_klass = rb_hash_aref(gerror_table, UINT2NUM(error->domain)); if (NIL_P(exception_klass)) { exception_klass = generic_error; } else { VALUE code_class = Qnil; VALUE code_classes; code_classes = rb_ivar_get(exception_klass, id_code_classes); if (!NIL_P(code_classes)) { code_class = rb_hash_aref(code_classes, INT2NUM(error->code)); } if (!NIL_P(code_class)) { exception_klass = code_class; } } exc = rb_exc_new_str(exception_klass, CSTR2RVAL(error->message)); rb_ivar_set(exc, id_domain, CSTR2RVAL(g_quark_to_string(error->domain))); rb_ivar_set(exc, id_code, INT2NUM(error->code)); g_error_free(error); return exc; } static gchar * nick_to_constant_name(const gchar *nick) { GString *constant_name; const gchar *current; constant_name = g_string_new(NULL); for (current = nick; *current; current++) { if (*current == '-') { g_string_append_c(constant_name, '_'); } else { g_string_append_c(constant_name, g_ascii_toupper(*current)); } } return g_string_free(constant_name, FALSE); } static gchar * nick_to_class_name(const gchar *nick) { GString *class_name; const gchar *current; gboolean to_upper = TRUE; class_name = g_string_new(NULL); for (current = nick; *current; current++) { if (to_upper) { g_string_append_c(class_name, g_ascii_toupper(*current)); to_upper = FALSE; } else if (*current == '-') { to_upper = TRUE; } else { g_string_append_c(class_name, *current); } } return g_string_free(class_name, FALSE); } VALUE rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE parent, GType gtype) { VALUE error_class; VALUE code_classes; error_class = rb_define_class_under(module, name, parent); rb_include_module(error_class, error_info); rb_hash_aset(gerror_table, UINT2NUM(domain), error_class); code_classes = rb_hash_new(); rb_ivar_set(error_class, id_code_classes, code_classes); if (gtype != G_TYPE_INVALID) { GEnumClass* gclass = g_type_class_ref(gtype); guint i; for (i = 0; i < gclass->n_values; i++) { VALUE code_class; GEnumValue* entry = &(gclass->values[i]); gchar *code_constant_name; gchar *code_class_name; code_constant_name = nick_to_constant_name(entry->value_nick); rbgobj_define_const(error_class, code_constant_name, INT2NUM(entry->value)); g_free(code_constant_name); code_class_name = nick_to_class_name(entry->value_nick); code_class = rb_define_class_under(error_class, code_class_name, error_class); g_free(code_class_name); rb_hash_aset(code_classes, INT2NUM(entry->value), code_class); } g_type_class_unref(gclass); } return error_class; } void Init_glib_error(void) { id_code = rb_intern("@code"); id_domain = rb_intern("@domain"); id_code_classes = rb_intern("@code_classes"); gerror_table = rb_hash_new(); rb_global_variable(&gerror_table); error_info = rb_define_module_under(mGLib, "ErrorInfo"); rb_define_attr(error_info, "code", TRUE, FALSE); rb_define_attr(error_info, "domain", TRUE, FALSE); generic_error = rb_define_class_under(mGLib, "Error", rb_eRuntimeError); rb_include_module(generic_error, error_info); } ������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_closure.c����������������������������������������������0000644�0001750�0001750�00000022100�12126557022�020552� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 2002-2006 Ruby-GNOME2 Project * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cClosure static ID id_call, id_closures; static gboolean rclosure_initialized = FALSE; #define TAG_SIZE 64 typedef struct _GRClosure GRClosure; struct _GRClosure { GClosure closure; VALUE callback; VALUE extra_args; VALUE rb_holder; gint count; GList *objects; GValToRValSignalFunc g2r_func; gchar tag[TAG_SIZE]; }; static VALUE rclosure_default_g2r_func(guint num, const GValue *values) { guint i; VALUE args = rb_ary_new2(num); for (i = 0; i < num; i++) rb_ary_store(args, i, GVAL2RVAL(&values[i])); return args; } struct marshal_arg { GClosure* closure; GValue* return_value; guint n_param_values; const GValue* param_values; gpointer invocation_hint; gpointer marshal_data; }; static int rclosure_alive_p(GRClosure *rclosure) { return (rclosure->count > 0 && !NIL_P(rclosure->rb_holder)); } static VALUE rclosure_marshal_do(VALUE arg_) { struct marshal_arg *arg; GRClosure* rclosure; GValue* return_value; guint n_param_values; const GValue* param_values; /* gpointer invocation_hint;*/ /* gpointer marshal_data; */ VALUE ret = Qnil; VALUE args; GValToRValSignalFunc func; arg = (struct marshal_arg*)arg_; rclosure = (GRClosure *)(arg->closure); return_value = arg->return_value; n_param_values = arg->n_param_values; param_values = arg->param_values; /* invocation_hint = arg->invocation_hint; */ /* marshal_data = arg->marshal_data; */ if (rclosure->g2r_func){ func = (GValToRValSignalFunc)rclosure->g2r_func; } else { func = (GValToRValSignalFunc)rclosure_default_g2r_func; } args = (*func)(n_param_values, param_values); if (rclosure_alive_p(rclosure)) { VALUE callback, extra_args; callback = rclosure->callback; extra_args = rclosure->extra_args; if (!NIL_P(extra_args)) { args = rb_ary_concat(args, extra_args); } ret = rb_apply(callback, id_call, args); } else { rb_warn("GRClosure invoking callback: already destroyed: %s", rclosure->tag[0] ? rclosure->tag : "(anonymous)"); } if (return_value && G_VALUE_TYPE(return_value)) rbgobj_rvalue_to_gvalue(ret, return_value); return Qnil; } static void rclosure_marshal(GClosure* closure, GValue* return_value, guint n_param_values, const GValue* param_values, gpointer invocation_hint, gpointer marshal_data) { struct marshal_arg arg; if (!rclosure_initialized) { g_closure_invalidate(closure); return; } arg.closure = closure; arg.return_value = return_value; arg.n_param_values = n_param_values; arg.param_values = param_values; arg.invocation_hint = invocation_hint; arg.marshal_data = marshal_data; G_PROTECT_CALLBACK(rclosure_marshal_do, &arg); } static void rclosure_weak_notify(gpointer data, GObject* where_the_object_was); static void rclosure_unref(GRClosure *rclosure) { rclosure->count--; if (!rclosure_alive_p(rclosure)) { GList *next; for (next = rclosure->objects; next; next = next->next) { GObject *object = G_OBJECT(next->data); g_object_weak_unref(object, rclosure_weak_notify, rclosure); } g_list_free(rclosure->objects); rclosure->objects = NULL; if (!NIL_P(rclosure->rb_holder)) { DATA_PTR(rclosure->rb_holder) = NULL; rclosure->rb_holder = Qnil; } } } static void rclosure_invalidate(G_GNUC_UNUSED gpointer data, GClosure *closure) { GRClosure *rclosure = (GRClosure*)closure; if (rclosure->count > 0) { GList *next; rclosure->count = 1; for (next = rclosure->objects; next; next = next->next) { GObject *object = G_OBJECT(next->data); VALUE obj = rbgobj_ruby_object_from_instance2(object, FALSE); if (!NIL_P(rclosure->rb_holder) && !NIL_P(obj)) G_REMOVE_RELATIVE(obj, id_closures, rclosure->rb_holder); } rclosure_unref(rclosure); } } static void gr_closure_holder_mark(GRClosure *rclosure) { if (!rclosure) return; rb_gc_mark(rclosure->callback); rb_gc_mark(rclosure->extra_args); } static void gr_closure_holder_free(GRClosure *rclosure) { if (!rclosure) return; if (rclosure->count > 0) { rclosure->count = 1; /* No need to remove us from the relatives hash of our objects, as * those aren't alive anymore anyway */ rclosure_unref(rclosure); } } GClosure* g_rclosure_new(VALUE callback_proc, VALUE extra_args, GValToRValSignalFunc g2r_func) { GRClosure* closure; closure = (GRClosure*)g_closure_new_simple(sizeof(GRClosure), NULL); closure->count = 1; closure->g2r_func = g2r_func; closure->objects = NULL; closure->callback = callback_proc; closure->extra_args = extra_args; closure->rb_holder = Data_Wrap_Struct(rb_cData, gr_closure_holder_mark, gr_closure_holder_free, closure); closure->tag[0] = '\0'; g_closure_set_marshal((GClosure*)closure, &rclosure_marshal); g_closure_add_invalidate_notifier((GClosure*)closure, NULL, &rclosure_invalidate); return (GClosure*)closure; } static void rclosure_weak_notify(gpointer data, GObject* where_the_object_was) { GRClosure *rclosure = data; if (rclosure_alive_p(rclosure)) { rclosure->objects = g_list_remove(rclosure->objects, where_the_object_was); rclosure_unref(rclosure); } } void g_rclosure_attach(GClosure *closure, VALUE object) { static VALUE mGLibObject = (VALUE)NULL; GRClosure *rclosure = (GRClosure *)closure; G_RELATIVE2(object, Qnil, id_closures, rclosure->rb_holder); if (!mGLibObject) { mGLibObject = rb_const_get(mGLib, rb_intern("Object")); } if (rb_obj_is_kind_of(object, mGLibObject)) { GObject *gobject; gobject = RVAL2GOBJ(object); rclosure->count++; g_object_weak_ref(gobject, rclosure_weak_notify, rclosure); rclosure->objects = g_list_prepend(rclosure->objects, gobject); } } void g_rclosure_set_tag(GClosure *closure, const gchar *tag) { GRClosure *rclosure = (GRClosure *)closure; if (tag) { strncpy(rclosure->tag, tag, TAG_SIZE); rclosure->tag[TAG_SIZE - 1] = '\0'; } else { rclosure->tag[0] = '\0'; } } static void rclosure_end_proc(G_GNUC_UNUSED VALUE _) { rclosure_initialized = FALSE; } static void init_rclosure(void) { id_call = rb_intern("call"); id_closures = rb_intern("closures"); rclosure_initialized = TRUE; rb_set_end_proc(rclosure_end_proc, Qnil); } /**********************************************************************/ static VALUE rg_initialize(VALUE self) { GClosure* closure = g_rclosure_new(rb_block_proc(), Qnil, NULL); G_INITIALIZE(self, closure); g_closure_sink(closure); return self; } static VALUE rg_in_marshal_p(VALUE self) { GClosure* closure = RVAL2BOXED(self, G_TYPE_CLOSURE); return CBOOL2RVAL(closure->in_marshal); } static VALUE rg_invalid_p(VALUE self) { GClosure* closure = RVAL2BOXED(self, G_TYPE_CLOSURE); return CBOOL2RVAL(closure->is_invalid); } static VALUE rg_invalidate(VALUE self) { GClosure* closure = RVAL2BOXED(self, G_TYPE_CLOSURE); g_closure_invalidate(closure); return self; } /**********************************************************************/ void Init_gobject_gclosure(void) { VALUE RG_TARGET_NAMESPACE; init_rclosure(); RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_CLOSURE, "Closure", mGLib); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD_P(in_marshal, 0); RG_DEF_METHOD_P(invalid, 0); RG_DEF_METHOD(invalidate, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_ucs4.c�������������������������������������������������0000664�0001750�0001750�00000004224�11740310343�017753� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mUCS4 static VALUE rg_s_to_utf16(G_GNUC_UNUSED VALUE self, VALUE rb_ucs4) { VALUE result; gunichar *ucs4; gunichar2 *utf16; glong len, items_written; GError *error = NULL; ucs4 = (gunichar *)StringValuePtr(rb_ucs4); len = RSTRING_LEN(rb_ucs4) / sizeof(*ucs4); utf16 = g_ucs4_to_utf16(ucs4, len, NULL, &items_written, &error); if (error) RAISE_GERROR(error); result = CSTR2RVAL_LEN_UTF16((char *)utf16, items_written * sizeof(*utf16)); g_free(utf16); return result; } static VALUE rg_s_to_utf8(G_GNUC_UNUSED VALUE self, VALUE rb_ucs4) { VALUE result; gunichar *ucs4; gchar *utf8; glong len, items_written; GError *error = NULL; ucs4 = (gunichar *)StringValuePtr(rb_ucs4); len = RSTRING_LEN(rb_ucs4) / sizeof(*ucs4); utf8 = g_ucs4_to_utf8(ucs4, len, NULL, &items_written, &error); if (error) RAISE_GERROR(error); result = CSTR2RVAL_LEN(utf8, items_written); g_free(utf8); return result; } void Init_glib_ucs4(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "UCS4"); RG_DEF_SMETHOD(to_utf16, 1); RG_DEF_SMETHOD(to_utf8, 1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_threads.c����������������������������������������������0000644�0001750�0001750�00000003070�12446160551�020533� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cThread static VALUE RG_TARGET_NAMESPACE; static VALUE rg_s_init(VALUE self) { #ifdef HAVE_G_THREAD_INIT #if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2, 32, 0) g_thread_init(NULL); #endif #endif return self; } static VALUE rg_s_supported_p(G_GNUC_UNUSED VALUE self) { #ifdef HAVE_G_THREAD_INIT #ifdef G_THREADS_ENABLED return CBOOL2RVAL(g_thread_supported()); #else return Qfalse; #endif #else return Qfalse; #endif } void Init_glib_threads(void) { RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "Thread", rb_cObject); RG_DEF_SMETHOD(init, 0); RG_DEF_SMETHOD_P(supported, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_param.c������������������������������������������������0000664�0001750�0001750�00000024600�11740310343�020201� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE rbgobj_cParam VALUE RG_TARGET_NAMESPACE; static GQuark qparamspec; static VALUE pspec_s_allocate(VALUE klass); typedef struct { GParamSpec* instance; const RGObjClassInfo* cinfo; } pspec_holder; static void pspec_mark(pspec_holder *holder) { if (holder->instance) rbgobj_instance_call_cinfo_mark(holder->instance); } static void pspec_free(pspec_holder *holder) { if (holder->instance){ rbgobj_instance_call_cinfo_free(holder->instance); g_param_spec_set_qdata(holder->instance, qparamspec, NULL); g_param_spec_unref(holder->instance); } free(holder); } GParamSpec* rbgobj_get_param_spec(VALUE obj) { pspec_holder* holder; Data_Get_Struct(obj, pspec_holder, holder); return G_PARAM_SPEC(holder->instance); } void rbgobj_param_spec_initialize(VALUE self, GParamSpec *pspec) { pspec_holder* holder; Data_Get_Struct(self, pspec_holder, holder); pspec = g_param_spec_ref(pspec); g_param_spec_sink(pspec); holder->instance = pspec; holder->cinfo = GTYPE2CINFO(G_PARAM_SPEC_TYPE(pspec)); g_param_spec_set_qdata(pspec, qparamspec, (gpointer)self); } VALUE rbgobj_get_ruby_object_from_param_spec(GParamSpec* pspec, gboolean alloc) { gpointer data = g_param_spec_get_qdata(pspec, qparamspec); if (data) return (VALUE)data; else if (alloc) { VALUE result = pspec_s_allocate(GTYPE2CLASS(G_PARAM_SPEC_TYPE(pspec))); rbgobj_param_spec_initialize(result, pspec); return result; } else return Qnil; } /**********************************************************************/ static VALUE pspec_s_allocate(VALUE klass) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(klass); if (G_TYPE_IS_ABSTRACT(cinfo->gtype)) rb_raise(rb_eTypeError, "abstract class"); { pspec_holder* holder; VALUE result; result = Data_Make_Struct(klass, pspec_holder, pspec_mark, pspec_free, holder); holder->instance = NULL; holder->cinfo = NULL; return result; } } static VALUE rg_inspect(VALUE self) { GParamSpec* pspec = rbgobj_get_param_spec(self); VALUE v = rb_inspect(GTYPE2CLASS(pspec->owner_type)); gchar* str = g_strdup_printf("#<%s: %s#%s>", rb_class2name(CLASS_OF(self)), StringValuePtr(v), g_param_spec_get_name(pspec)); VALUE result = rb_str_new2(str); g_free(str); return result; } static VALUE rg_name(VALUE self) { return rb_str_new2(g_param_spec_get_name(rbgobj_get_param_spec(self))); } static VALUE rg_nick(VALUE self) { const gchar* str = g_param_spec_get_nick(rbgobj_get_param_spec(self)); return str ? rb_str_new2(str) : Qnil; } static VALUE rg_blurb(VALUE self) { const gchar* str = g_param_spec_get_blurb(rbgobj_get_param_spec(self)); return str ? rb_str_new2(str) : Qnil; } static VALUE rg_flags(VALUE self) { return INT2NUM(rbgobj_get_param_spec(self)->flags); } static VALUE rg_value_type(VALUE self) { return rbgobj_gtype_new(G_PARAM_SPEC_VALUE_TYPE(rbgobj_get_param_spec(self))); } static VALUE rg_owner_type(VALUE self) { return rbgobj_gtype_new(rbgobj_get_param_spec(self)->owner_type); } static VALUE rg_owner(VALUE self) { return GTYPE2CLASS(rbgobj_get_param_spec(self)->owner_type); } static VALUE rg_value_default(VALUE self) { GValue tmp = G_VALUE_INIT; VALUE result; g_value_init(&tmp, G_PARAM_SPEC_VALUE_TYPE(rbgobj_get_param_spec(self))); g_param_value_set_default(rbgobj_get_param_spec(self), &tmp); result = rbgobj_gvalue_to_rvalue(&tmp); g_value_unset(&tmp); return result; } #if 0 static VALUE rg_value_defaults_p(VALUE self, VALUE val) { GValue tmp = {0,}; gboolean result; /* FIXME: use rb_ensure to ensure following g_value_unset() call*/ g_value_init(&tmp, G_PARAM_SPEC_VALUE_TYPE(rbgobj_get_param_spec(self))); rbgobj_rvalue_to_gvalue(val, &tmp); result = g_param_value_defaults(rbgobj_get_param_spec(self), &tmp); g_value_unset(&tmp); return CBOOL2RVAL(result); } #endif struct validate_arg{ GParamSpec* pspec; GValue* value; VALUE obj; }; static VALUE value_validate_body(struct validate_arg* arg) { VALUE ret; gboolean b; rbgobj_rvalue_to_gvalue(arg->obj, arg->value); b = g_param_value_validate(arg->pspec, arg->value); ret = rbgobj_gvalue_to_rvalue(arg->value); return rb_ary_new3(2, CBOOL2RVAL(b), ret); } static VALUE value_validate_ensure(struct validate_arg* arg) { g_value_unset(arg->value); return Qnil; } static VALUE rg_value_validate(VALUE self, VALUE obj) { struct validate_arg arg; GValue value = G_VALUE_INIT; arg.pspec = rbgobj_get_param_spec(self); arg.value = &value; arg.obj = obj; g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(arg.pspec)); return rb_ensure(value_validate_body, (VALUE)&arg, value_validate_ensure, (VALUE)&arg); } static VALUE rg_value_convert(int argc, VALUE* argv, VALUE self) { GParamSpec* pspec = rbgobj_get_param_spec(self); VALUE src, strict_validation; VALUE src_type; VALUE result = Qnil; GValue src_value = G_VALUE_INIT; GValue dest_value = G_VALUE_INIT; gboolean b; rb_scan_args(argc, argv, "21", &src, &src_type, &strict_validation); /* FIXME: use rb_ensure to ensure following g_value_unset() call*/ g_value_init(&src_value, rbgobj_gtype_get(src_type)); g_value_init(&dest_value, G_PARAM_SPEC_VALUE_TYPE(pspec)); rbgobj_rvalue_to_gvalue(src, &src_value); b = g_param_value_convert(rbgobj_get_param_spec(self), &src_value, &dest_value, RVAL2CBOOL(strict_validation)); if (b) result = rbgobj_gvalue_to_rvalue(&dest_value); g_value_unset(&src_value); g_value_unset(&dest_value); if (b) return result; else rb_raise(rb_eTypeError, "can't convert"); } static VALUE rg_value_compare(VALUE self, VALUE a, VALUE b) { GParamSpec* pspec = rbgobj_get_param_spec(self); GType type = G_PARAM_SPEC_VALUE_TYPE(pspec); GValue v1 = G_VALUE_INIT; GValue v2 = G_VALUE_INIT; gint result; g_value_init(&v1, type); g_value_init(&v2, type); /* FIXME: use rb_ensure to ensure following g_value_unset() call*/ rbgobj_rvalue_to_gvalue(a, &v1); rbgobj_rvalue_to_gvalue(b, &v2); result = g_param_values_cmp(pspec, &v1, &v2); g_value_unset(&v1); g_value_unset(&v2); return INT2NUM(result); } static VALUE rg_ref_count(VALUE self) { return INT2NUM(G_PARAM_SPEC(rbgobj_get_param_spec(self))->ref_count); } #define param_is_flag(flag) \ static VALUE \ param_is_##flag(VALUE self) \ { \ GParamSpec* pspec = G_PARAM_SPEC(rbgobj_get_param_spec(self)); \ return CBOOL2RVAL(pspec->flags & flag); \ } param_is_flag(G_PARAM_READABLE) param_is_flag(G_PARAM_WRITABLE) param_is_flag(G_PARAM_CONSTRUCT) param_is_flag(G_PARAM_CONSTRUCT_ONLY) param_is_flag(G_PARAM_LAX_VALIDATION) param_is_flag(G_PARAM_PRIVATE) param_is_flag(G_PARAM_READWRITE) /**********************************************************************/ void Init_gobject_gparam(void) { qparamspec = g_quark_from_static_string("__ruby_gobject_param_spec__"); RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_PARAM, "Param", mGLib); /* GParamFlags */ rb_define_const(RG_TARGET_NAMESPACE, "READABLE", INT2FIX(G_PARAM_READABLE)); rb_define_const(RG_TARGET_NAMESPACE, "WRITABLE", INT2FIX(G_PARAM_WRITABLE)); rb_define_const(RG_TARGET_NAMESPACE, "CONSTRUCT", INT2FIX(G_PARAM_CONSTRUCT)); rb_define_const(RG_TARGET_NAMESPACE, "CONSTRUCT_ONLY", INT2FIX(G_PARAM_CONSTRUCT_ONLY)); rb_define_const(RG_TARGET_NAMESPACE, "LAX_VALIDATION", INT2FIX(G_PARAM_LAX_VALIDATION)); rb_define_const(RG_TARGET_NAMESPACE, "PRIVATE", INT2FIX(G_PARAM_PRIVATE)); rb_define_const(RG_TARGET_NAMESPACE, "READWRITE", INT2FIX(G_PARAM_READWRITE)); rb_define_const(RG_TARGET_NAMESPACE, "MASK", INT2FIX(G_PARAM_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "USER_SHIFT", INT2FIX(G_PARAM_USER_SHIFT)); rb_define_alloc_func(RG_TARGET_NAMESPACE, pspec_s_allocate); RG_DEF_METHOD(inspect, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(nick, 0); RG_DEF_METHOD(blurb, 0); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(value_type, 0); RG_DEF_METHOD(owner_type, 0); RG_DEF_METHOD(owner, 0); RG_DEF_METHOD(value_default, 0); RG_DEF_ALIAS("default", "value_default"); // FIXME: better name #if 0 RG_DEF_METHOD_P(value_defaults, 1); #endif RG_DEF_METHOD(value_validate, 1); RG_DEF_METHOD(value_convert, -1); RG_DEF_METHOD(value_compare, 2); /* for debugging */ RG_DEF_METHOD(ref_count, 0); rbg_define_method(RG_TARGET_NAMESPACE, "readable?", param_is_G_PARAM_READABLE, 0); rbg_define_method(RG_TARGET_NAMESPACE, "writable?", param_is_G_PARAM_WRITABLE, 0); rbg_define_method(RG_TARGET_NAMESPACE, "construct?", param_is_G_PARAM_CONSTRUCT, 0); rbg_define_method(RG_TARGET_NAMESPACE, "construct_only?", param_is_G_PARAM_CONSTRUCT_ONLY, 0); rbg_define_method(RG_TARGET_NAMESPACE, "lax_validation?", param_is_G_PARAM_LAX_VALIDATION, 0); rbg_define_method(RG_TARGET_NAMESPACE, "private?", param_is_G_PARAM_PRIVATE, 0); rbg_define_method(RG_TARGET_NAMESPACE, "readwrite?", param_is_G_PARAM_READWRITE, 0); } ��������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutil_list.h������������������������������������������������0000644�0001750�0001750�00000007753�12516434313�020302� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ #ifndef __RBGUTIL_LIST_H__ #define __RBGUTIL_LIST_H__ G_BEGIN_DECLS #define CSTRGLIST2RVAL(list) \ CSTRGLIST2RVAL_FREE(list, NULL, NULL) #define CSTRGLIST2RVAL_FREE(list, free_list, free_elem) \ rbg_glist2rval(list, (RBGRValueFunc)rbg_cstr2rval, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define CSTRGSLIST2RVAL(list) \ CSTRGSLIST2RVAL_FREE(list, NULL, NULL) #define CSTRGSLIST2RVAL_FREE(list, free_list, free_elem) \ rbg_gslist2rval(list, (RBGRValueFunc)rbg_cstr2rval, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define FILENAMEGLIST2RVAL(list) \ FILENAMEGLIST2RVAL_FREE(list, NULL, NULL) #define FILENAMEGLIST2RVAL_FREE(list, free_list, free_elem) \ rbg_glist2rval(list, (RBGRValueFunc)rbg_filename_to_ruby, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define FILENAMEGSLIST2RVAL(list) \ FILENAMEGSLIST2RVAL_FREE(list, NULL, NULL) #define FILENAMEGSLIST2RVAL_FREE(list, free_list, free_elem) \ rbg_gslist2rval(list, (RBGRValueFunc)rbg_filename_to_ruby, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define GOBJGLIST2RVAL(list) \ GOBJGLIST2RVAL_FREE(list, NULL, NULL) #define GOBJGLIST2RVAL_FREE(list, free_list, free_elem) \ rbg_glist2rval(list, (RBGRValueFunc)rbgobj_ruby_object_from_instance, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define GOBJGSLIST2RVAL(list) \ GOBJGSLIST2RVAL_FREE(list, NULL, NULL) #define GOBJGSLIST2RVAL_FREE(list, free_list, free_elem) \ rbg_gslist2rval(list, (RBGRValueFunc)rbgobj_ruby_object_from_instance, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define BOXEDGLIST2RVAL(list, gtype) \ BOXEDGLIST2RVAL_FREE(list, gtype, NULL, NULL) #define BOXEDGLIST2RVAL_FREE(list, gtype, free_list, free_elem) \ rbg_glist2rval_with_type(list, (RBGRValueFuncWithType)rbgobj_make_boxed, gtype, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) #define BOXEDGSLIST2RVAL(list, gtype) \ BOXEDGSLIST2RVAL_FREE(list, gtype, NULL, NULL) #define BOXEDGSLIST2RVAL_FREE(list, gtype, free_list, free_elem) \ rbg_gslist2rval_with_type(list, (RBGRValueFuncWithType)rbgobj_make_boxed, gtype, \ (GFreeFunc)free_list, (GFreeFunc)free_elem) typedef VALUE (*RBGRValueFunc)(gpointer obj); typedef VALUE (*RBGRValueFuncWithType)(gpointer obj, GType gtype); extern VALUE rbg_glist2rval(GList *const list, RBGRValueFunc conv, GFreeFunc free_list, GFreeFunc free_elem); extern VALUE rbg_gslist2rval(GSList *const list, RBGRValueFunc conv, GFreeFunc free_list, GFreeFunc free_elem); extern VALUE rbg_glist2rval_with_type(GList *const list, RBGRValueFuncWithType conv, GType gtype, GFreeFunc free_list, GFreeFunc free_elem); extern VALUE rbg_gslist2rval_with_type(GSList *const list, RBGRValueFuncWithType conv, GType gtype, GFreeFunc free_list, GFreeFunc free_elem); G_END_DECLS #endif /* __RBGUTIL_LIST_H__ */ ���������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgprivate.h��������������������������������������������������0000644�0001750�0001750�00000015343�12516434313�017736� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 2007 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 __RBGPRIVATE_H__ #define __RBGPRIVATE_H__ #include "rbgobject.h" #include "glib-enum-types.h" #ifndef HAVE_RB_ERRINFO # define rb_errinfo() (ruby_errinfo) #endif #ifndef HAVE_RB_STR_NEW_CSTR # define rb_str_new_cstr(c_string) rb_str_new2(c_string) #endif #ifndef HAVE_RB_EXC_NEW_STR # define rb_exc_new_str(klass, message) rb_exc_new3(klass, message) #endif #ifndef G_VALUE_INIT # define G_VALUE_INIT { 0, { { 0 } } } #endif G_BEGIN_DECLS typedef struct { VALUE self; GObject* gobj; const RGObjClassInfo* cinfo; gboolean destroyed; } gobj_holder; typedef struct { gpointer boxed; gboolean own; GType type; } boxed_holder; G_GNUC_INTERNAL extern GStaticPrivate rg_polling_key; extern VALUE rbgobj_cEnum; extern VALUE rbgobj_cFlags; extern VALUE rbgobj_cBoxed; extern VALUE rbgobj_cParam; extern VALUE rbgobj_mInterface; extern VALUE rbgobj_cObject; extern VALUE rbgobj_cInstantiatable; extern VALUE rbgobj_mMetaInterface; #define cInstantiatable rbgobj_cInstantiatable #define mMetaInterface rbgobj_mMetaInterface extern void rbgobj_define_property_accessors(VALUE klass); extern void rbgobj_define_action_methods(VALUE klass); extern void rbgobj_param_spec_initialize(VALUE self, GParamSpec* pspec); extern void rbgobj_boxed_initialize(VALUE obj, gpointer boxed); extern GParamSpec* rbgobj_get_param_spec(VALUE obj); extern GObject* rbgobj_get_gobject(VALUE obj); extern VALUE rbgobj_get_ruby_object_from_param_spec(GParamSpec* pspec, gboolean alloc); extern void rbgobj_init_object_class(VALUE klass); extern void rbgobj_init_flags_class(VALUE klass); extern void rbgobj_init_enum_class(VALUE klass); extern void rbgobj_init_interface(VALUE interf); /* FIXME: should have better name */ extern void rbgobj_instance_call_cinfo_mark(gpointer instance); extern void rbgobj_instance_call_cinfo_free(gpointer instance); VALUE rbgutil_generic_s_gtype(VALUE klass); VALUE rbgutil_generic_gtype(VALUE self); #define generic_s_gtype rbgutil_generic_s_gtype #define generic_gtype rbgutil_generic_gtype extern gboolean rbgobj_convert_has_type(GType type); extern RGConvertTable *rbgobj_convert_lookup(GType type); extern gboolean rbgobj_convert_get_superclass(GType type, VALUE *result); extern gboolean rbgobj_convert_type_init_hook(GType type, VALUE klass); extern gboolean rbgobj_convert_gvalue2rvalue(GType type, const GValue *value, VALUE *result); extern gboolean rbgobj_convert_rvalue2gvalue(GType type, VALUE val, GValue *result); extern GType rbgobj_convert_rvalue2gtype(VALUE val); extern gboolean rbgobj_convert_initialize(GType type, VALUE obj, gpointer cobj); extern gboolean rbgobj_convert_robj2instance(GType type, VALUE obj, gpointer *result); extern gboolean rbgobj_convert_instance2robj(GType type, gpointer instance, VALUE *result); extern gboolean rbgobj_convert_unref(GType type, gpointer instance); #define RubyGObjectHookModule "RubyGObjectHook__" G_GNUC_INTERNAL VALUE rg_enum_resolve_value(VALUE klass, VALUE nick); G_GNUC_INTERNAL void rg_enum_add_constants(VALUE mod, GType enum_type, const gchar *strip_prefix); G_GNUC_INTERNAL void rg_flags_add_constants(VALUE mod, GType flags_type, const gchar *strip_prefix); G_GNUC_INTERNAL char *rg_obj_constant_lookup(const char *name); G_GNUC_INTERNAL void Init_gutil(void); G_GNUC_INTERNAL void Init_gutil_callback(void); G_GNUC_INTERNAL void Init_glib_gettext(void); G_GNUC_INTERNAL void Init_glib_int64(void); G_GNUC_INTERNAL void Init_glib_error(void); G_GNUC_INTERNAL void Init_glib_threads(void); G_GNUC_INTERNAL void Init_glib_convert(void); G_GNUC_INTERNAL void Init_glib_messages(void); G_GNUC_INTERNAL void Init_glib_spawn(void); G_GNUC_INTERNAL void Init_glib_spawnerror(void); G_GNUC_INTERNAL void Init_glib_fileutils(void); G_GNUC_INTERNAL void Init_glib_utils(void); G_GNUC_INTERNAL void Init_glib_i18n(void); G_GNUC_INTERNAL void Init_glib_win32(void); G_GNUC_INTERNAL void Init_gobject(void); G_GNUC_INTERNAL void Init_glib_main_loop(void); G_GNUC_INTERNAL void Init_glib_main_context(void); G_GNUC_INTERNAL void Init_glib_source(void); G_GNUC_INTERNAL void Init_glib_poll_fd(void); G_GNUC_INTERNAL void Init_glib_io_constants(void); G_GNUC_INTERNAL void Init_glib_io_channel(void); G_GNUC_INTERNAL void Init_glib_io_channelerror(void); G_GNUC_INTERNAL void Init_glib_io_channel_win32_socket(void); G_GNUC_INTERNAL void Init_glib_shell(void); G_GNUC_INTERNAL void Init_glib_shellerror(void); G_GNUC_INTERNAL void Init_glib_timer(void); G_GNUC_INTERNAL void Init_glib_unicode(void); G_GNUC_INTERNAL void Init_glib_utf8(void); G_GNUC_INTERNAL void Init_glib_utf16(void); G_GNUC_INTERNAL void Init_glib_ucs4(void); G_GNUC_INTERNAL void Init_glib_unichar(void); G_GNUC_INTERNAL void Init_glib_keyfile(void); G_GNUC_INTERNAL void Init_glib_bookmark_file(void); G_GNUC_INTERNAL void Init_gobject_convert(void); G_GNUC_INTERNAL void Init_gobject_gtype(void); G_GNUC_INTERNAL void Init_gobject_typeinterface(void); G_GNUC_INTERNAL void Init_gobject_typeinstance(void); G_GNUC_INTERNAL void Init_gobject_gvalue(void); G_GNUC_INTERNAL void Init_gobject_gvaluetypes(void); G_GNUC_INTERNAL void Init_gobject_gboxed(void); G_GNUC_INTERNAL void Init_gobject_gstrv(void); G_GNUC_INTERNAL void Init_gobject_value_array(void); G_GNUC_INTERNAL void Init_gobject_genumflags(void); G_GNUC_INTERNAL void Init_gobject_genums(void); G_GNUC_INTERNAL void Init_gobject_gflags(void); G_GNUC_INTERNAL void Init_gobject_gparam(void); G_GNUC_INTERNAL void Init_gobject_gparamspecs(void); G_GNUC_INTERNAL void Init_gobject_gclosure(void); G_GNUC_INTERNAL void Init_gobject_gobject(void); G_GNUC_INTERNAL void Init_gobject_gsignal(void); G_GNUC_INTERNAL void Init_gobject_gtypeplugin(void); G_GNUC_INTERNAL void Init_gobject_gtypemodule(void); G_END_DECLS #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_shell.c������������������������������������������������0000664�0001750�0001750�00000003464�11740310343�020211� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE mShell static VALUE rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE command_line) { gint argc; gchar **argv; GError *error = NULL; if (!g_shell_parse_argv(RVAL2CSTR(command_line), &argc, &argv, &error)) RAISE_GERROR(error); return STRV2RVAL_FREE(argv); } static VALUE rg_s_quote(G_GNUC_UNUSED VALUE self, VALUE unquoted_string) { return CSTR2RVAL_FREE(g_shell_quote(RVAL2CSTR(unquoted_string))); } static VALUE rg_s_unquote(G_GNUC_UNUSED VALUE self, VALUE quoted_string) { GError *error = NULL; gchar *str = g_shell_unquote(RVAL2CSTR(quoted_string), &error); if (str == NULL) RAISE_GERROR(error); return CSTR2RVAL_FREE(str); } void Init_glib_shell(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Shell"); RG_DEF_SMETHOD(parse, 1); RG_DEF_SMETHOD(quote, 1); RG_DEF_SMETHOD(unquote, 1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/glib-enum-types.c���������������������������������������������0000644�0001750�0001750�00000162664�12446173027�020622� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Generated by glib-mkenums.rb ($Id$) */ #include "glib-enum-types.h" #include <glib-object.h> /* enumerations from "/usr/include/glib-2.0/glib/gvariant.h" */ GType g_variant_class_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_VARIANT_CLASS_BOOLEAN, "G_VARIANT_CLASS_BOOLEAN", "boolean" }, { G_VARIANT_CLASS_BYTE, "G_VARIANT_CLASS_BYTE", "byte" }, { G_VARIANT_CLASS_INT16, "G_VARIANT_CLASS_INT16", "int16" }, { G_VARIANT_CLASS_UINT16, "G_VARIANT_CLASS_UINT16", "uint16" }, { G_VARIANT_CLASS_INT32, "G_VARIANT_CLASS_INT32", "int32" }, { G_VARIANT_CLASS_UINT32, "G_VARIANT_CLASS_UINT32", "uint32" }, { G_VARIANT_CLASS_INT64, "G_VARIANT_CLASS_INT64", "int64" }, { G_VARIANT_CLASS_UINT64, "G_VARIANT_CLASS_UINT64", "uint64" }, { G_VARIANT_CLASS_HANDLE, "G_VARIANT_CLASS_HANDLE", "handle" }, { G_VARIANT_CLASS_DOUBLE, "G_VARIANT_CLASS_DOUBLE", "double" }, { G_VARIANT_CLASS_STRING, "G_VARIANT_CLASS_STRING", "string" }, { G_VARIANT_CLASS_OBJECT_PATH, "G_VARIANT_CLASS_OBJECT_PATH", "object-path" }, { G_VARIANT_CLASS_SIGNATURE, "G_VARIANT_CLASS_SIGNATURE", "signature" }, { G_VARIANT_CLASS_VARIANT, "G_VARIANT_CLASS_VARIANT", "variant" }, { G_VARIANT_CLASS_MAYBE, "G_VARIANT_CLASS_MAYBE", "maybe" }, { G_VARIANT_CLASS_ARRAY, "G_VARIANT_CLASS_ARRAY", "array" }, { G_VARIANT_CLASS_TUPLE, "G_VARIANT_CLASS_TUPLE", "tuple" }, { G_VARIANT_CLASS_DICT_ENTRY, "G_VARIANT_CLASS_DICT_ENTRY", "dict-entry" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GVariantClass", values); } return etype; } GType g_variant_parse_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_VARIANT_PARSE_ERROR_FAILED, "G_VARIANT_PARSE_ERROR_FAILED", "failed" }, { G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED, "G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED", "basic-type-expected" }, { G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE, "G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE", "cannot-infer-type" }, { G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED, "G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED", "definite-type-expected" }, { G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END, "G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END", "input-not-at-end" }, { G_VARIANT_PARSE_ERROR_INVALID_CHARACTER, "G_VARIANT_PARSE_ERROR_INVALID_CHARACTER", "invalid-character" }, { G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING, "G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING", "invalid-format-string" }, { G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH, "G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH", "invalid-object-path" }, { G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE, "G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE", "invalid-signature" }, { G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING, "G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING", "invalid-type-string" }, { G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE, "G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE", "no-common-type" }, { G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE, "G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE", "number-out-of-range" }, { G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG, "G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG", "number-too-big" }, { G_VARIANT_PARSE_ERROR_TYPE_ERROR, "G_VARIANT_PARSE_ERROR_TYPE_ERROR", "type-error" }, { G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN, "G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN", "unexpected-token" }, { G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD, "G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD", "unknown-keyword" }, { G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT, "G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT", "unterminated-string-constant" }, { G_VARIANT_PARSE_ERROR_VALUE_EXPECTED, "G_VARIANT_PARSE_ERROR_VALUE_EXPECTED", "value-expected" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GVariantParseError", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gspawn.h" */ GType g_spawn_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_SPAWN_ERROR_FORK, "G_SPAWN_ERROR_FORK", "fork" }, { G_SPAWN_ERROR_READ, "G_SPAWN_ERROR_READ", "read" }, { G_SPAWN_ERROR_CHDIR, "G_SPAWN_ERROR_CHDIR", "chdir" }, { G_SPAWN_ERROR_ACCES, "G_SPAWN_ERROR_ACCES", "acces" }, { G_SPAWN_ERROR_PERM, "G_SPAWN_ERROR_PERM", "perm" }, { G_SPAWN_ERROR_TOO_BIG, "G_SPAWN_ERROR_TOO_BIG", "too-big" }, { G_SPAWN_ERROR_2BIG, "G_SPAWN_ERROR_2BIG", "2big" }, { G_SPAWN_ERROR_NOEXEC, "G_SPAWN_ERROR_NOEXEC", "noexec" }, { G_SPAWN_ERROR_NAMETOOLONG, "G_SPAWN_ERROR_NAMETOOLONG", "nametoolong" }, { G_SPAWN_ERROR_NOENT, "G_SPAWN_ERROR_NOENT", "noent" }, { G_SPAWN_ERROR_NOMEM, "G_SPAWN_ERROR_NOMEM", "nomem" }, { G_SPAWN_ERROR_NOTDIR, "G_SPAWN_ERROR_NOTDIR", "notdir" }, { G_SPAWN_ERROR_LOOP, "G_SPAWN_ERROR_LOOP", "loop" }, { G_SPAWN_ERROR_TXTBUSY, "G_SPAWN_ERROR_TXTBUSY", "txtbusy" }, { G_SPAWN_ERROR_IO, "G_SPAWN_ERROR_IO", "io" }, { G_SPAWN_ERROR_NFILE, "G_SPAWN_ERROR_NFILE", "nfile" }, { G_SPAWN_ERROR_MFILE, "G_SPAWN_ERROR_MFILE", "mfile" }, { G_SPAWN_ERROR_INVAL, "G_SPAWN_ERROR_INVAL", "inval" }, { G_SPAWN_ERROR_ISDIR, "G_SPAWN_ERROR_ISDIR", "isdir" }, { G_SPAWN_ERROR_LIBBAD, "G_SPAWN_ERROR_LIBBAD", "libbad" }, { G_SPAWN_ERROR_FAILED, "G_SPAWN_ERROR_FAILED", "failed" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GSpawnError", values); } return etype; } GType g_spawn_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_SPAWN_DEFAULT, "G_SPAWN_DEFAULT", "default" }, { G_SPAWN_LEAVE_DESCRIPTORS_OPEN, "G_SPAWN_LEAVE_DESCRIPTORS_OPEN", "leave-descriptors-open" }, { G_SPAWN_DO_NOT_REAP_CHILD, "G_SPAWN_DO_NOT_REAP_CHILD", "do-not-reap-child" }, { G_SPAWN_SEARCH_PATH, "G_SPAWN_SEARCH_PATH", "search-path" }, { G_SPAWN_STDOUT_TO_DEV_NULL, "G_SPAWN_STDOUT_TO_DEV_NULL", "stdout-to-dev-null" }, { G_SPAWN_STDERR_TO_DEV_NULL, "G_SPAWN_STDERR_TO_DEV_NULL", "stderr-to-dev-null" }, { G_SPAWN_CHILD_INHERITS_STDIN, "G_SPAWN_CHILD_INHERITS_STDIN", "child-inherits-stdin" }, { G_SPAWN_FILE_AND_ARGV_ZERO, "G_SPAWN_FILE_AND_ARGV_ZERO", "file-and-argv-zero" }, { G_SPAWN_SEARCH_PATH_FROM_ENVP, "G_SPAWN_SEARCH_PATH_FROM_ENVP", "search-path-from-envp" }, { G_SPAWN_CLOEXEC_PIPES, "G_SPAWN_CLOEXEC_PIPES", "cloexec-pipes" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GSpawnFlags", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gkeyfile.h" */ GType g_key_file_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_KEY_FILE_ERROR_UNKNOWN_ENCODING, "G_KEY_FILE_ERROR_UNKNOWN_ENCODING", "unknown-encoding" }, { G_KEY_FILE_ERROR_PARSE, "G_KEY_FILE_ERROR_PARSE", "parse" }, { G_KEY_FILE_ERROR_NOT_FOUND, "G_KEY_FILE_ERROR_NOT_FOUND", "not-found" }, { G_KEY_FILE_ERROR_KEY_NOT_FOUND, "G_KEY_FILE_ERROR_KEY_NOT_FOUND", "key-not-found" }, { G_KEY_FILE_ERROR_GROUP_NOT_FOUND, "G_KEY_FILE_ERROR_GROUP_NOT_FOUND", "group-not-found" }, { G_KEY_FILE_ERROR_INVALID_VALUE, "G_KEY_FILE_ERROR_INVALID_VALUE", "invalid-value" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GKeyFileError", values); } return etype; } GType g_key_file_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_KEY_FILE_NONE, "G_KEY_FILE_NONE", "none" }, { G_KEY_FILE_KEEP_COMMENTS, "G_KEY_FILE_KEEP_COMMENTS", "keep-comments" }, { G_KEY_FILE_KEEP_TRANSLATIONS, "G_KEY_FILE_KEEP_TRANSLATIONS", "keep-translations" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GKeyFileFlags", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gnode.h" */ GType g_traverse_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_TRAVERSE_LEAVES, "G_TRAVERSE_LEAVES", "leaves" }, { G_TRAVERSE_NON_LEAVES, "G_TRAVERSE_NON_LEAVES", "non-leaves" }, { G_TRAVERSE_ALL, "G_TRAVERSE_ALL", "all" }, { G_TRAVERSE_MASK, "G_TRAVERSE_MASK", "mask" }, { G_TRAVERSE_LEAFS, "G_TRAVERSE_LEAFS", "leafs" }, { G_TRAVERSE_NON_LEAFS, "G_TRAVERSE_NON_LEAFS", "non-leafs" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GTraverseFlags", values); } return etype; } GType g_traverse_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_IN_ORDER, "G_IN_ORDER", "in-order" }, { G_PRE_ORDER, "G_PRE_ORDER", "pre-order" }, { G_POST_ORDER, "G_POST_ORDER", "post-order" }, { G_LEVEL_ORDER, "G_LEVEL_ORDER", "level-order" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GTraverseType", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gshell.h" */ GType g_shell_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_SHELL_ERROR_BAD_QUOTING, "G_SHELL_ERROR_BAD_QUOTING", "bad-quoting" }, { G_SHELL_ERROR_EMPTY_STRING, "G_SHELL_ERROR_EMPTY_STRING", "empty-string" }, { G_SHELL_ERROR_FAILED, "G_SHELL_ERROR_FAILED", "failed" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GShellError", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gslice.h" */ GType g_slice_config_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_SLICE_CONFIG_ALWAYS_MALLOC, "G_SLICE_CONFIG_ALWAYS_MALLOC", "always-malloc" }, { G_SLICE_CONFIG_BYPASS_MAGAZINES, "G_SLICE_CONFIG_BYPASS_MAGAZINES", "bypass-magazines" }, { G_SLICE_CONFIG_WORKING_SET_MSECS, "G_SLICE_CONFIG_WORKING_SET_MSECS", "working-set-msecs" }, { G_SLICE_CONFIG_COLOR_INCREMENT, "G_SLICE_CONFIG_COLOR_INCREMENT", "color-increment" }, { G_SLICE_CONFIG_CHUNK_SIZES, "G_SLICE_CONFIG_CHUNK_SIZES", "chunk-sizes" }, { G_SLICE_CONFIG_CONTENTION_COUNTER, "G_SLICE_CONFIG_CONTENTION_COUNTER", "contention-counter" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GSliceConfig", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gregex.h" */ GType g_regex_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_REGEX_ERROR_COMPILE, "G_REGEX_ERROR_COMPILE", "compile" }, { G_REGEX_ERROR_OPTIMIZE, "G_REGEX_ERROR_OPTIMIZE", "optimize" }, { G_REGEX_ERROR_REPLACE, "G_REGEX_ERROR_REPLACE", "replace" }, { G_REGEX_ERROR_MATCH, "G_REGEX_ERROR_MATCH", "match" }, { G_REGEX_ERROR_INTERNAL, "G_REGEX_ERROR_INTERNAL", "internal" }, { G_REGEX_ERROR_STRAY_BACKSLASH, "G_REGEX_ERROR_STRAY_BACKSLASH", "stray-backslash" }, { G_REGEX_ERROR_MISSING_CONTROL_CHAR, "G_REGEX_ERROR_MISSING_CONTROL_CHAR", "missing-control-char" }, { G_REGEX_ERROR_UNRECOGNIZED_ESCAPE, "G_REGEX_ERROR_UNRECOGNIZED_ESCAPE", "unrecognized-escape" }, { G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER, "G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER", "quantifiers-out-of-order" }, { G_REGEX_ERROR_QUANTIFIER_TOO_BIG, "G_REGEX_ERROR_QUANTIFIER_TOO_BIG", "quantifier-too-big" }, { G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS, "G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS", "unterminated-character-class" }, { G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS, "G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS", "invalid-escape-in-character-class" }, { G_REGEX_ERROR_RANGE_OUT_OF_ORDER, "G_REGEX_ERROR_RANGE_OUT_OF_ORDER", "range-out-of-order" }, { G_REGEX_ERROR_NOTHING_TO_REPEAT, "G_REGEX_ERROR_NOTHING_TO_REPEAT", "nothing-to-repeat" }, { G_REGEX_ERROR_UNRECOGNIZED_CHARACTER, "G_REGEX_ERROR_UNRECOGNIZED_CHARACTER", "unrecognized-character" }, { G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS, "G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS", "posix-named-class-outside-class" }, { G_REGEX_ERROR_UNMATCHED_PARENTHESIS, "G_REGEX_ERROR_UNMATCHED_PARENTHESIS", "unmatched-parenthesis" }, { G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE, "G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE", "inexistent-subpattern-reference" }, { G_REGEX_ERROR_UNTERMINATED_COMMENT, "G_REGEX_ERROR_UNTERMINATED_COMMENT", "unterminated-comment" }, { G_REGEX_ERROR_EXPRESSION_TOO_LARGE, "G_REGEX_ERROR_EXPRESSION_TOO_LARGE", "expression-too-large" }, { G_REGEX_ERROR_MEMORY_ERROR, "G_REGEX_ERROR_MEMORY_ERROR", "memory-error" }, { G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND, "G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND", "variable-length-lookbehind" }, { G_REGEX_ERROR_MALFORMED_CONDITION, "G_REGEX_ERROR_MALFORMED_CONDITION", "malformed-condition" }, { G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES, "G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES", "too-many-conditional-branches" }, { G_REGEX_ERROR_ASSERTION_EXPECTED, "G_REGEX_ERROR_ASSERTION_EXPECTED", "assertion-expected" }, { G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME, "G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME", "unknown-posix-class-name" }, { G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED, "G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED", "posix-collating-elements-not-supported" }, { G_REGEX_ERROR_HEX_CODE_TOO_LARGE, "G_REGEX_ERROR_HEX_CODE_TOO_LARGE", "hex-code-too-large" }, { G_REGEX_ERROR_INVALID_CONDITION, "G_REGEX_ERROR_INVALID_CONDITION", "invalid-condition" }, { G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND, "G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND", "single-byte-match-in-lookbehind" }, { G_REGEX_ERROR_INFINITE_LOOP, "G_REGEX_ERROR_INFINITE_LOOP", "infinite-loop" }, { G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR, "G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR", "missing-subpattern-name-terminator" }, { G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME, "G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME", "duplicate-subpattern-name" }, { G_REGEX_ERROR_MALFORMED_PROPERTY, "G_REGEX_ERROR_MALFORMED_PROPERTY", "malformed-property" }, { G_REGEX_ERROR_UNKNOWN_PROPERTY, "G_REGEX_ERROR_UNKNOWN_PROPERTY", "unknown-property" }, { G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG, "G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG", "subpattern-name-too-long" }, { G_REGEX_ERROR_TOO_MANY_SUBPATTERNS, "G_REGEX_ERROR_TOO_MANY_SUBPATTERNS", "too-many-subpatterns" }, { G_REGEX_ERROR_INVALID_OCTAL_VALUE, "G_REGEX_ERROR_INVALID_OCTAL_VALUE", "invalid-octal-value" }, { G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE, "G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE", "too-many-branches-in-define" }, { G_REGEX_ERROR_DEFINE_REPETION, "G_REGEX_ERROR_DEFINE_REPETION", "define-repetion" }, { G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS, "G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS", "inconsistent-newline-options" }, { G_REGEX_ERROR_MISSING_BACK_REFERENCE, "G_REGEX_ERROR_MISSING_BACK_REFERENCE", "missing-back-reference" }, { G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE, "G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE", "invalid-relative-reference" }, { G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN, "G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN", "backtracking-control-verb-argument-forbidden" }, { G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB, "G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB", "unknown-backtracking-control-verb" }, { G_REGEX_ERROR_NUMBER_TOO_BIG, "G_REGEX_ERROR_NUMBER_TOO_BIG", "number-too-big" }, { G_REGEX_ERROR_MISSING_SUBPATTERN_NAME, "G_REGEX_ERROR_MISSING_SUBPATTERN_NAME", "missing-subpattern-name" }, { G_REGEX_ERROR_MISSING_DIGIT, "G_REGEX_ERROR_MISSING_DIGIT", "missing-digit" }, { G_REGEX_ERROR_INVALID_DATA_CHARACTER, "G_REGEX_ERROR_INVALID_DATA_CHARACTER", "invalid-data-character" }, { G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME, "G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME", "extra-subpattern-name" }, { G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED, "G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED", "backtracking-control-verb-argument-required" }, { G_REGEX_ERROR_INVALID_CONTROL_CHAR, "G_REGEX_ERROR_INVALID_CONTROL_CHAR", "invalid-control-char" }, { G_REGEX_ERROR_MISSING_NAME, "G_REGEX_ERROR_MISSING_NAME", "missing-name" }, { G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS, "G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS", "not-supported-in-class" }, { G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES, "G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES", "too-many-forward-references" }, { G_REGEX_ERROR_NAME_TOO_LONG, "G_REGEX_ERROR_NAME_TOO_LONG", "name-too-long" }, { G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE, "G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE", "character-value-too-large" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GRegexError", values); } return etype; } GType g_regex_compile_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_REGEX_CASELESS, "G_REGEX_CASELESS", "caseless" }, { G_REGEX_MULTILINE, "G_REGEX_MULTILINE", "multiline" }, { G_REGEX_DOTALL, "G_REGEX_DOTALL", "dotall" }, { G_REGEX_EXTENDED, "G_REGEX_EXTENDED", "extended" }, { G_REGEX_ANCHORED, "G_REGEX_ANCHORED", "anchored" }, { G_REGEX_DOLLAR_ENDONLY, "G_REGEX_DOLLAR_ENDONLY", "dollar-endonly" }, { G_REGEX_UNGREEDY, "G_REGEX_UNGREEDY", "ungreedy" }, { G_REGEX_RAW, "G_REGEX_RAW", "raw" }, { G_REGEX_NO_AUTO_CAPTURE, "G_REGEX_NO_AUTO_CAPTURE", "no-auto-capture" }, { G_REGEX_OPTIMIZE, "G_REGEX_OPTIMIZE", "optimize" }, { G_REGEX_FIRSTLINE, "G_REGEX_FIRSTLINE", "firstline" }, { G_REGEX_DUPNAMES, "G_REGEX_DUPNAMES", "dupnames" }, { G_REGEX_NEWLINE_CR, "G_REGEX_NEWLINE_CR", "newline-cr" }, { G_REGEX_NEWLINE_LF, "G_REGEX_NEWLINE_LF", "newline-lf" }, { G_REGEX_NEWLINE_CRLF, "G_REGEX_NEWLINE_CRLF", "newline-crlf" }, { G_REGEX_NEWLINE_ANYCRLF, "G_REGEX_NEWLINE_ANYCRLF", "newline-anycrlf" }, { G_REGEX_BSR_ANYCRLF, "G_REGEX_BSR_ANYCRLF", "bsr-anycrlf" }, { G_REGEX_JAVASCRIPT_COMPAT, "G_REGEX_JAVASCRIPT_COMPAT", "javascript-compat" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GRegexCompileFlags", values); } return etype; } GType g_regex_match_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_REGEX_MATCH_ANCHORED, "G_REGEX_MATCH_ANCHORED", "anchored" }, { G_REGEX_MATCH_NOTBOL, "G_REGEX_MATCH_NOTBOL", "notbol" }, { G_REGEX_MATCH_NOTEOL, "G_REGEX_MATCH_NOTEOL", "noteol" }, { G_REGEX_MATCH_NOTEMPTY, "G_REGEX_MATCH_NOTEMPTY", "notempty" }, { G_REGEX_MATCH_PARTIAL, "G_REGEX_MATCH_PARTIAL", "partial" }, { G_REGEX_MATCH_NEWLINE_CR, "G_REGEX_MATCH_NEWLINE_CR", "newline-cr" }, { G_REGEX_MATCH_NEWLINE_LF, "G_REGEX_MATCH_NEWLINE_LF", "newline-lf" }, { G_REGEX_MATCH_NEWLINE_CRLF, "G_REGEX_MATCH_NEWLINE_CRLF", "newline-crlf" }, { G_REGEX_MATCH_NEWLINE_ANY, "G_REGEX_MATCH_NEWLINE_ANY", "newline-any" }, { G_REGEX_MATCH_NEWLINE_ANYCRLF, "G_REGEX_MATCH_NEWLINE_ANYCRLF", "newline-anycrlf" }, { G_REGEX_MATCH_BSR_ANYCRLF, "G_REGEX_MATCH_BSR_ANYCRLF", "bsr-anycrlf" }, { G_REGEX_MATCH_BSR_ANY, "G_REGEX_MATCH_BSR_ANY", "bsr-any" }, { G_REGEX_MATCH_PARTIAL_SOFT, "G_REGEX_MATCH_PARTIAL_SOFT", "partial-soft" }, { G_REGEX_MATCH_PARTIAL_HARD, "G_REGEX_MATCH_PARTIAL_HARD", "partial-hard" }, { G_REGEX_MATCH_NOTEMPTY_ATSTART, "G_REGEX_MATCH_NOTEMPTY_ATSTART", "notempty-atstart" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GRegexMatchFlags", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gmarkup.h" */ GType g_markup_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_MARKUP_ERROR_BAD_UTF8, "G_MARKUP_ERROR_BAD_UTF8", "bad-utf8" }, { G_MARKUP_ERROR_EMPTY, "G_MARKUP_ERROR_EMPTY", "empty" }, { G_MARKUP_ERROR_PARSE, "G_MARKUP_ERROR_PARSE", "parse" }, { G_MARKUP_ERROR_UNKNOWN_ELEMENT, "G_MARKUP_ERROR_UNKNOWN_ELEMENT", "unknown-element" }, { G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, "G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE", "unknown-attribute" }, { G_MARKUP_ERROR_INVALID_CONTENT, "G_MARKUP_ERROR_INVALID_CONTENT", "invalid-content" }, { G_MARKUP_ERROR_MISSING_ATTRIBUTE, "G_MARKUP_ERROR_MISSING_ATTRIBUTE", "missing-attribute" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GMarkupError", values); } return etype; } GType g_markup_parse_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG, "G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG", "do-not-use-this-unsupported-flag" }, { G_MARKUP_TREAT_CDATA_AS_TEXT, "G_MARKUP_TREAT_CDATA_AS_TEXT", "treat-cdata-as-text" }, { G_MARKUP_PREFIX_ERROR_POSITION, "G_MARKUP_PREFIX_ERROR_POSITION", "prefix-error-position" }, { G_MARKUP_IGNORE_QUALIFIED, "G_MARKUP_IGNORE_QUALIFIED", "ignore-qualified" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GMarkupParseFlags", values); } return etype; } GType g_markup_collect_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_MARKUP_COLLECT_INVALID, "G_MARKUP_COLLECT_INVALID", "invalid" }, { G_MARKUP_COLLECT_STRING, "G_MARKUP_COLLECT_STRING", "string" }, { G_MARKUP_COLLECT_STRDUP, "G_MARKUP_COLLECT_STRDUP", "strdup" }, { G_MARKUP_COLLECT_BOOLEAN, "G_MARKUP_COLLECT_BOOLEAN", "boolean" }, { G_MARKUP_COLLECT_TRISTATE, "G_MARKUP_COLLECT_TRISTATE", "tristate" }, { G_MARKUP_COLLECT_OPTIONAL, "G_MARKUP_COLLECT_OPTIONAL", "optional" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GMarkupCollectType", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gtestutils.h" */ GType g_test_trap_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_TEST_TRAP_SILENCE_STDOUT, "G_TEST_TRAP_SILENCE_STDOUT", "silence-stdout" }, { G_TEST_TRAP_SILENCE_STDERR, "G_TEST_TRAP_SILENCE_STDERR", "silence-stderr" }, { G_TEST_TRAP_INHERIT_STDIN, "G_TEST_TRAP_INHERIT_STDIN", "inherit-stdin" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GTestTrapFlags", values); } return etype; } GType g_test_subprocess_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_TEST_SUBPROCESS_INHERIT_STDIN, "G_TEST_SUBPROCESS_INHERIT_STDIN", "in" }, { G_TEST_SUBPROCESS_INHERIT_STDOUT, "G_TEST_SUBPROCESS_INHERIT_STDOUT", "out" }, { G_TEST_SUBPROCESS_INHERIT_STDERR, "G_TEST_SUBPROCESS_INHERIT_STDERR", "err" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GTestSubprocessFlags", values); } return etype; } GType g_test_log_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_TEST_LOG_NONE, "G_TEST_LOG_NONE", "none" }, { G_TEST_LOG_ERROR, "G_TEST_LOG_ERROR", "error" }, { G_TEST_LOG_START_BINARY, "G_TEST_LOG_START_BINARY", "start-binary" }, { G_TEST_LOG_LIST_CASE, "G_TEST_LOG_LIST_CASE", "list-case" }, { G_TEST_LOG_SKIP_CASE, "G_TEST_LOG_SKIP_CASE", "skip-case" }, { G_TEST_LOG_START_CASE, "G_TEST_LOG_START_CASE", "start-case" }, { G_TEST_LOG_STOP_CASE, "G_TEST_LOG_STOP_CASE", "stop-case" }, { G_TEST_LOG_MIN_RESULT, "G_TEST_LOG_MIN_RESULT", "min-result" }, { G_TEST_LOG_MAX_RESULT, "G_TEST_LOG_MAX_RESULT", "max-result" }, { G_TEST_LOG_MESSAGE, "G_TEST_LOG_MESSAGE", "message" }, { G_TEST_LOG_START_SUITE, "G_TEST_LOG_START_SUITE", "start-suite" }, { G_TEST_LOG_STOP_SUITE, "G_TEST_LOG_STOP_SUITE", "stop-suite" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GTestLogType", values); } return etype; } GType g_test_file_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_TEST_DIST, "G_TEST_DIST", "dist" }, { G_TEST_BUILT, "G_TEST_BUILT", "built" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GTestFileType", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gfileutils.h" */ GType g_file_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_FILE_ERROR_EXIST, "G_FILE_ERROR_EXIST", "exist" }, { G_FILE_ERROR_ISDIR, "G_FILE_ERROR_ISDIR", "isdir" }, { G_FILE_ERROR_ACCES, "G_FILE_ERROR_ACCES", "acces" }, { G_FILE_ERROR_NAMETOOLONG, "G_FILE_ERROR_NAMETOOLONG", "nametoolong" }, { G_FILE_ERROR_NOENT, "G_FILE_ERROR_NOENT", "noent" }, { G_FILE_ERROR_NOTDIR, "G_FILE_ERROR_NOTDIR", "notdir" }, { G_FILE_ERROR_NXIO, "G_FILE_ERROR_NXIO", "nxio" }, { G_FILE_ERROR_NODEV, "G_FILE_ERROR_NODEV", "nodev" }, { G_FILE_ERROR_ROFS, "G_FILE_ERROR_ROFS", "rofs" }, { G_FILE_ERROR_TXTBSY, "G_FILE_ERROR_TXTBSY", "txtbsy" }, { G_FILE_ERROR_FAULT, "G_FILE_ERROR_FAULT", "fault" }, { G_FILE_ERROR_LOOP, "G_FILE_ERROR_LOOP", "loop" }, { G_FILE_ERROR_NOSPC, "G_FILE_ERROR_NOSPC", "nospc" }, { G_FILE_ERROR_NOMEM, "G_FILE_ERROR_NOMEM", "nomem" }, { G_FILE_ERROR_MFILE, "G_FILE_ERROR_MFILE", "mfile" }, { G_FILE_ERROR_NFILE, "G_FILE_ERROR_NFILE", "nfile" }, { G_FILE_ERROR_BADF, "G_FILE_ERROR_BADF", "badf" }, { G_FILE_ERROR_INVAL, "G_FILE_ERROR_INVAL", "inval" }, { G_FILE_ERROR_PIPE, "G_FILE_ERROR_PIPE", "pipe" }, { G_FILE_ERROR_AGAIN, "G_FILE_ERROR_AGAIN", "again" }, { G_FILE_ERROR_INTR, "G_FILE_ERROR_INTR", "intr" }, { G_FILE_ERROR_IO, "G_FILE_ERROR_IO", "io" }, { G_FILE_ERROR_PERM, "G_FILE_ERROR_PERM", "perm" }, { G_FILE_ERROR_NOSYS, "G_FILE_ERROR_NOSYS", "nosys" }, { G_FILE_ERROR_FAILED, "G_FILE_ERROR_FAILED", "failed" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GFileError", values); } return etype; } GType g_file_test_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_FILE_TEST_IS_REGULAR, "G_FILE_TEST_IS_REGULAR", "is-regular" }, { G_FILE_TEST_IS_SYMLINK, "G_FILE_TEST_IS_SYMLINK", "is-symlink" }, { G_FILE_TEST_IS_DIR, "G_FILE_TEST_IS_DIR", "is-dir" }, { G_FILE_TEST_IS_EXECUTABLE, "G_FILE_TEST_IS_EXECUTABLE", "is-executable" }, { G_FILE_TEST_EXISTS, "G_FILE_TEST_EXISTS", "exists" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GFileTest", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gtimezone.h" */ GType g_time_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_TIME_TYPE_STANDARD, "G_TIME_TYPE_STANDARD", "standard" }, { G_TIME_TYPE_DAYLIGHT, "G_TIME_TYPE_DAYLIGHT", "daylight" }, { G_TIME_TYPE_UNIVERSAL, "G_TIME_TYPE_UNIVERSAL", "universal" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GTimeType", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gdate.h" */ GType g_date_dm_y_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_DATE_DAY, "G_DATE_DAY", "day" }, { G_DATE_MONTH, "G_DATE_MONTH", "month" }, { G_DATE_YEAR, "G_DATE_YEAR", "year" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GDateDMY", values); } return etype; } GType g_date_weekday_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_DATE_BAD_WEEKDAY, "G_DATE_BAD_WEEKDAY", "bad-weekday" }, { G_DATE_MONDAY, "G_DATE_MONDAY", "monday" }, { G_DATE_TUESDAY, "G_DATE_TUESDAY", "tuesday" }, { G_DATE_WEDNESDAY, "G_DATE_WEDNESDAY", "wednesday" }, { G_DATE_THURSDAY, "G_DATE_THURSDAY", "thursday" }, { G_DATE_FRIDAY, "G_DATE_FRIDAY", "friday" }, { G_DATE_SATURDAY, "G_DATE_SATURDAY", "saturday" }, { G_DATE_SUNDAY, "G_DATE_SUNDAY", "sunday" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GDateWeekday", values); } return etype; } GType g_date_month_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_DATE_BAD_MONTH, "G_DATE_BAD_MONTH", "bad-month" }, { G_DATE_JANUARY, "G_DATE_JANUARY", "january" }, { G_DATE_FEBRUARY, "G_DATE_FEBRUARY", "february" }, { G_DATE_MARCH, "G_DATE_MARCH", "march" }, { G_DATE_APRIL, "G_DATE_APRIL", "april" }, { G_DATE_MAY, "G_DATE_MAY", "may" }, { G_DATE_JUNE, "G_DATE_JUNE", "june" }, { G_DATE_JULY, "G_DATE_JULY", "july" }, { G_DATE_AUGUST, "G_DATE_AUGUST", "august" }, { G_DATE_SEPTEMBER, "G_DATE_SEPTEMBER", "september" }, { G_DATE_OCTOBER, "G_DATE_OCTOBER", "october" }, { G_DATE_NOVEMBER, "G_DATE_NOVEMBER", "november" }, { G_DATE_DECEMBER, "G_DATE_DECEMBER", "december" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GDateMonth", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gunicode.h" */ GType g_unicode_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_UNICODE_CONTROL, "G_UNICODE_CONTROL", "control" }, { G_UNICODE_FORMAT, "G_UNICODE_FORMAT", "format" }, { G_UNICODE_UNASSIGNED, "G_UNICODE_UNASSIGNED", "unassigned" }, { G_UNICODE_PRIVATE_USE, "G_UNICODE_PRIVATE_USE", "private-use" }, { G_UNICODE_SURROGATE, "G_UNICODE_SURROGATE", "surrogate" }, { G_UNICODE_LOWERCASE_LETTER, "G_UNICODE_LOWERCASE_LETTER", "lowercase-letter" }, { G_UNICODE_MODIFIER_LETTER, "G_UNICODE_MODIFIER_LETTER", "modifier-letter" }, { G_UNICODE_OTHER_LETTER, "G_UNICODE_OTHER_LETTER", "other-letter" }, { G_UNICODE_TITLECASE_LETTER, "G_UNICODE_TITLECASE_LETTER", "titlecase-letter" }, { G_UNICODE_UPPERCASE_LETTER, "G_UNICODE_UPPERCASE_LETTER", "uppercase-letter" }, { G_UNICODE_SPACING_MARK, "G_UNICODE_SPACING_MARK", "spacing-mark" }, { G_UNICODE_ENCLOSING_MARK, "G_UNICODE_ENCLOSING_MARK", "enclosing-mark" }, { G_UNICODE_NON_SPACING_MARK, "G_UNICODE_NON_SPACING_MARK", "non-spacing-mark" }, { G_UNICODE_DECIMAL_NUMBER, "G_UNICODE_DECIMAL_NUMBER", "decimal-number" }, { G_UNICODE_LETTER_NUMBER, "G_UNICODE_LETTER_NUMBER", "letter-number" }, { G_UNICODE_OTHER_NUMBER, "G_UNICODE_OTHER_NUMBER", "other-number" }, { G_UNICODE_CONNECT_PUNCTUATION, "G_UNICODE_CONNECT_PUNCTUATION", "connect-punctuation" }, { G_UNICODE_DASH_PUNCTUATION, "G_UNICODE_DASH_PUNCTUATION", "dash-punctuation" }, { G_UNICODE_CLOSE_PUNCTUATION, "G_UNICODE_CLOSE_PUNCTUATION", "close-punctuation" }, { G_UNICODE_FINAL_PUNCTUATION, "G_UNICODE_FINAL_PUNCTUATION", "final-punctuation" }, { G_UNICODE_INITIAL_PUNCTUATION, "G_UNICODE_INITIAL_PUNCTUATION", "initial-punctuation" }, { G_UNICODE_OTHER_PUNCTUATION, "G_UNICODE_OTHER_PUNCTUATION", "other-punctuation" }, { G_UNICODE_OPEN_PUNCTUATION, "G_UNICODE_OPEN_PUNCTUATION", "open-punctuation" }, { G_UNICODE_CURRENCY_SYMBOL, "G_UNICODE_CURRENCY_SYMBOL", "currency-symbol" }, { G_UNICODE_MODIFIER_SYMBOL, "G_UNICODE_MODIFIER_SYMBOL", "modifier-symbol" }, { G_UNICODE_MATH_SYMBOL, "G_UNICODE_MATH_SYMBOL", "math-symbol" }, { G_UNICODE_OTHER_SYMBOL, "G_UNICODE_OTHER_SYMBOL", "other-symbol" }, { G_UNICODE_LINE_SEPARATOR, "G_UNICODE_LINE_SEPARATOR", "line-separator" }, { G_UNICODE_PARAGRAPH_SEPARATOR, "G_UNICODE_PARAGRAPH_SEPARATOR", "paragraph-separator" }, { G_UNICODE_SPACE_SEPARATOR, "G_UNICODE_SPACE_SEPARATOR", "space-separator" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GUnicodeType", values); } return etype; } GType g_unicode_break_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_UNICODE_BREAK_MANDATORY, "G_UNICODE_BREAK_MANDATORY", "mandatory" }, { G_UNICODE_BREAK_CARRIAGE_RETURN, "G_UNICODE_BREAK_CARRIAGE_RETURN", "carriage-return" }, { G_UNICODE_BREAK_LINE_FEED, "G_UNICODE_BREAK_LINE_FEED", "line-feed" }, { G_UNICODE_BREAK_COMBINING_MARK, "G_UNICODE_BREAK_COMBINING_MARK", "combining-mark" }, { G_UNICODE_BREAK_SURROGATE, "G_UNICODE_BREAK_SURROGATE", "surrogate" }, { G_UNICODE_BREAK_ZERO_WIDTH_SPACE, "G_UNICODE_BREAK_ZERO_WIDTH_SPACE", "zero-width-space" }, { G_UNICODE_BREAK_INSEPARABLE, "G_UNICODE_BREAK_INSEPARABLE", "inseparable" }, { G_UNICODE_BREAK_NON_BREAKING_GLUE, "G_UNICODE_BREAK_NON_BREAKING_GLUE", "non-breaking-glue" }, { G_UNICODE_BREAK_CONTINGENT, "G_UNICODE_BREAK_CONTINGENT", "contingent" }, { G_UNICODE_BREAK_SPACE, "G_UNICODE_BREAK_SPACE", "space" }, { G_UNICODE_BREAK_AFTER, "G_UNICODE_BREAK_AFTER", "after" }, { G_UNICODE_BREAK_BEFORE, "G_UNICODE_BREAK_BEFORE", "before" }, { G_UNICODE_BREAK_BEFORE_AND_AFTER, "G_UNICODE_BREAK_BEFORE_AND_AFTER", "before-and-after" }, { G_UNICODE_BREAK_HYPHEN, "G_UNICODE_BREAK_HYPHEN", "hyphen" }, { G_UNICODE_BREAK_NON_STARTER, "G_UNICODE_BREAK_NON_STARTER", "non-starter" }, { G_UNICODE_BREAK_OPEN_PUNCTUATION, "G_UNICODE_BREAK_OPEN_PUNCTUATION", "open-punctuation" }, { G_UNICODE_BREAK_CLOSE_PUNCTUATION, "G_UNICODE_BREAK_CLOSE_PUNCTUATION", "close-punctuation" }, { G_UNICODE_BREAK_QUOTATION, "G_UNICODE_BREAK_QUOTATION", "quotation" }, { G_UNICODE_BREAK_EXCLAMATION, "G_UNICODE_BREAK_EXCLAMATION", "exclamation" }, { G_UNICODE_BREAK_IDEOGRAPHIC, "G_UNICODE_BREAK_IDEOGRAPHIC", "ideographic" }, { G_UNICODE_BREAK_NUMERIC, "G_UNICODE_BREAK_NUMERIC", "numeric" }, { G_UNICODE_BREAK_INFIX_SEPARATOR, "G_UNICODE_BREAK_INFIX_SEPARATOR", "infix-separator" }, { G_UNICODE_BREAK_SYMBOL, "G_UNICODE_BREAK_SYMBOL", "symbol" }, { G_UNICODE_BREAK_ALPHABETIC, "G_UNICODE_BREAK_ALPHABETIC", "alphabetic" }, { G_UNICODE_BREAK_PREFIX, "G_UNICODE_BREAK_PREFIX", "prefix" }, { G_UNICODE_BREAK_POSTFIX, "G_UNICODE_BREAK_POSTFIX", "postfix" }, { G_UNICODE_BREAK_COMPLEX_CONTEXT, "G_UNICODE_BREAK_COMPLEX_CONTEXT", "complex-context" }, { G_UNICODE_BREAK_AMBIGUOUS, "G_UNICODE_BREAK_AMBIGUOUS", "ambiguous" }, { G_UNICODE_BREAK_UNKNOWN, "G_UNICODE_BREAK_UNKNOWN", "unknown" }, { G_UNICODE_BREAK_NEXT_LINE, "G_UNICODE_BREAK_NEXT_LINE", "next-line" }, { G_UNICODE_BREAK_WORD_JOINER, "G_UNICODE_BREAK_WORD_JOINER", "word-joiner" }, { G_UNICODE_BREAK_HANGUL_L_JAMO, "G_UNICODE_BREAK_HANGUL_L_JAMO", "hangul-l-jamo" }, { G_UNICODE_BREAK_HANGUL_V_JAMO, "G_UNICODE_BREAK_HANGUL_V_JAMO", "hangul-v-jamo" }, { G_UNICODE_BREAK_HANGUL_T_JAMO, "G_UNICODE_BREAK_HANGUL_T_JAMO", "hangul-t-jamo" }, { G_UNICODE_BREAK_HANGUL_LV_SYLLABLE, "G_UNICODE_BREAK_HANGUL_LV_SYLLABLE", "hangul-lv-syllable" }, { G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE, "G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE", "hangul-lvt-syllable" }, { G_UNICODE_BREAK_CLOSE_PARANTHESIS, "G_UNICODE_BREAK_CLOSE_PARANTHESIS", "close-paranthesis" }, { G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER, "G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER", "conditional-japanese-starter" }, { G_UNICODE_BREAK_HEBREW_LETTER, "G_UNICODE_BREAK_HEBREW_LETTER", "hebrew-letter" }, { G_UNICODE_BREAK_REGIONAL_INDICATOR, "G_UNICODE_BREAK_REGIONAL_INDICATOR", "regional-indicator" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GUnicodeBreakType", values); } return etype; } GType g_unicode_script_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_UNICODE_SCRIPT_INVALID_CODE, "G_UNICODE_SCRIPT_INVALID_CODE", "invalid-code" }, { G_UNICODE_SCRIPT_COMMON, "G_UNICODE_SCRIPT_COMMON", "common" }, { G_UNICODE_SCRIPT_INHERITED, "G_UNICODE_SCRIPT_INHERITED", "inherited" }, { G_UNICODE_SCRIPT_ARABIC, "G_UNICODE_SCRIPT_ARABIC", "arabic" }, { G_UNICODE_SCRIPT_ARMENIAN, "G_UNICODE_SCRIPT_ARMENIAN", "armenian" }, { G_UNICODE_SCRIPT_BENGALI, "G_UNICODE_SCRIPT_BENGALI", "bengali" }, { G_UNICODE_SCRIPT_BOPOMOFO, "G_UNICODE_SCRIPT_BOPOMOFO", "bopomofo" }, { G_UNICODE_SCRIPT_CHEROKEE, "G_UNICODE_SCRIPT_CHEROKEE", "cherokee" }, { G_UNICODE_SCRIPT_COPTIC, "G_UNICODE_SCRIPT_COPTIC", "coptic" }, { G_UNICODE_SCRIPT_CYRILLIC, "G_UNICODE_SCRIPT_CYRILLIC", "cyrillic" }, { G_UNICODE_SCRIPT_DESERET, "G_UNICODE_SCRIPT_DESERET", "deseret" }, { G_UNICODE_SCRIPT_DEVANAGARI, "G_UNICODE_SCRIPT_DEVANAGARI", "devanagari" }, { G_UNICODE_SCRIPT_ETHIOPIC, "G_UNICODE_SCRIPT_ETHIOPIC", "ethiopic" }, { G_UNICODE_SCRIPT_GEORGIAN, "G_UNICODE_SCRIPT_GEORGIAN", "georgian" }, { G_UNICODE_SCRIPT_GOTHIC, "G_UNICODE_SCRIPT_GOTHIC", "gothic" }, { G_UNICODE_SCRIPT_GREEK, "G_UNICODE_SCRIPT_GREEK", "greek" }, { G_UNICODE_SCRIPT_GUJARATI, "G_UNICODE_SCRIPT_GUJARATI", "gujarati" }, { G_UNICODE_SCRIPT_GURMUKHI, "G_UNICODE_SCRIPT_GURMUKHI", "gurmukhi" }, { G_UNICODE_SCRIPT_HAN, "G_UNICODE_SCRIPT_HAN", "han" }, { G_UNICODE_SCRIPT_HANGUL, "G_UNICODE_SCRIPT_HANGUL", "hangul" }, { G_UNICODE_SCRIPT_HEBREW, "G_UNICODE_SCRIPT_HEBREW", "hebrew" }, { G_UNICODE_SCRIPT_HIRAGANA, "G_UNICODE_SCRIPT_HIRAGANA", "hiragana" }, { G_UNICODE_SCRIPT_KANNADA, "G_UNICODE_SCRIPT_KANNADA", "kannada" }, { G_UNICODE_SCRIPT_KATAKANA, "G_UNICODE_SCRIPT_KATAKANA", "katakana" }, { G_UNICODE_SCRIPT_KHMER, "G_UNICODE_SCRIPT_KHMER", "khmer" }, { G_UNICODE_SCRIPT_LAO, "G_UNICODE_SCRIPT_LAO", "lao" }, { G_UNICODE_SCRIPT_LATIN, "G_UNICODE_SCRIPT_LATIN", "latin" }, { G_UNICODE_SCRIPT_MALAYALAM, "G_UNICODE_SCRIPT_MALAYALAM", "malayalam" }, { G_UNICODE_SCRIPT_MONGOLIAN, "G_UNICODE_SCRIPT_MONGOLIAN", "mongolian" }, { G_UNICODE_SCRIPT_MYANMAR, "G_UNICODE_SCRIPT_MYANMAR", "myanmar" }, { G_UNICODE_SCRIPT_OGHAM, "G_UNICODE_SCRIPT_OGHAM", "ogham" }, { G_UNICODE_SCRIPT_OLD_ITALIC, "G_UNICODE_SCRIPT_OLD_ITALIC", "old-italic" }, { G_UNICODE_SCRIPT_ORIYA, "G_UNICODE_SCRIPT_ORIYA", "oriya" }, { G_UNICODE_SCRIPT_RUNIC, "G_UNICODE_SCRIPT_RUNIC", "runic" }, { G_UNICODE_SCRIPT_SINHALA, "G_UNICODE_SCRIPT_SINHALA", "sinhala" }, { G_UNICODE_SCRIPT_SYRIAC, "G_UNICODE_SCRIPT_SYRIAC", "syriac" }, { G_UNICODE_SCRIPT_TAMIL, "G_UNICODE_SCRIPT_TAMIL", "tamil" }, { G_UNICODE_SCRIPT_TELUGU, "G_UNICODE_SCRIPT_TELUGU", "telugu" }, { G_UNICODE_SCRIPT_THAANA, "G_UNICODE_SCRIPT_THAANA", "thaana" }, { G_UNICODE_SCRIPT_THAI, "G_UNICODE_SCRIPT_THAI", "thai" }, { G_UNICODE_SCRIPT_TIBETAN, "G_UNICODE_SCRIPT_TIBETAN", "tibetan" }, { G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, "G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL", "canadian-aboriginal" }, { G_UNICODE_SCRIPT_YI, "G_UNICODE_SCRIPT_YI", "yi" }, { G_UNICODE_SCRIPT_TAGALOG, "G_UNICODE_SCRIPT_TAGALOG", "tagalog" }, { G_UNICODE_SCRIPT_HANUNOO, "G_UNICODE_SCRIPT_HANUNOO", "hanunoo" }, { G_UNICODE_SCRIPT_BUHID, "G_UNICODE_SCRIPT_BUHID", "buhid" }, { G_UNICODE_SCRIPT_TAGBANWA, "G_UNICODE_SCRIPT_TAGBANWA", "tagbanwa" }, { G_UNICODE_SCRIPT_BRAILLE, "G_UNICODE_SCRIPT_BRAILLE", "braille" }, { G_UNICODE_SCRIPT_CYPRIOT, "G_UNICODE_SCRIPT_CYPRIOT", "cypriot" }, { G_UNICODE_SCRIPT_LIMBU, "G_UNICODE_SCRIPT_LIMBU", "limbu" }, { G_UNICODE_SCRIPT_OSMANYA, "G_UNICODE_SCRIPT_OSMANYA", "osmanya" }, { G_UNICODE_SCRIPT_SHAVIAN, "G_UNICODE_SCRIPT_SHAVIAN", "shavian" }, { G_UNICODE_SCRIPT_LINEAR_B, "G_UNICODE_SCRIPT_LINEAR_B", "linear-b" }, { G_UNICODE_SCRIPT_TAI_LE, "G_UNICODE_SCRIPT_TAI_LE", "tai-le" }, { G_UNICODE_SCRIPT_UGARITIC, "G_UNICODE_SCRIPT_UGARITIC", "ugaritic" }, { G_UNICODE_SCRIPT_NEW_TAI_LUE, "G_UNICODE_SCRIPT_NEW_TAI_LUE", "new-tai-lue" }, { G_UNICODE_SCRIPT_BUGINESE, "G_UNICODE_SCRIPT_BUGINESE", "buginese" }, { G_UNICODE_SCRIPT_GLAGOLITIC, "G_UNICODE_SCRIPT_GLAGOLITIC", "glagolitic" }, { G_UNICODE_SCRIPT_TIFINAGH, "G_UNICODE_SCRIPT_TIFINAGH", "tifinagh" }, { G_UNICODE_SCRIPT_SYLOTI_NAGRI, "G_UNICODE_SCRIPT_SYLOTI_NAGRI", "syloti-nagri" }, { G_UNICODE_SCRIPT_OLD_PERSIAN, "G_UNICODE_SCRIPT_OLD_PERSIAN", "old-persian" }, { G_UNICODE_SCRIPT_KHAROSHTHI, "G_UNICODE_SCRIPT_KHAROSHTHI", "kharoshthi" }, { G_UNICODE_SCRIPT_UNKNOWN, "G_UNICODE_SCRIPT_UNKNOWN", "unknown" }, { G_UNICODE_SCRIPT_BALINESE, "G_UNICODE_SCRIPT_BALINESE", "balinese" }, { G_UNICODE_SCRIPT_CUNEIFORM, "G_UNICODE_SCRIPT_CUNEIFORM", "cuneiform" }, { G_UNICODE_SCRIPT_PHOENICIAN, "G_UNICODE_SCRIPT_PHOENICIAN", "phoenician" }, { G_UNICODE_SCRIPT_PHAGS_PA, "G_UNICODE_SCRIPT_PHAGS_PA", "phags-pa" }, { G_UNICODE_SCRIPT_NKO, "G_UNICODE_SCRIPT_NKO", "nko" }, { G_UNICODE_SCRIPT_KAYAH_LI, "G_UNICODE_SCRIPT_KAYAH_LI", "kayah-li" }, { G_UNICODE_SCRIPT_LEPCHA, "G_UNICODE_SCRIPT_LEPCHA", "lepcha" }, { G_UNICODE_SCRIPT_REJANG, "G_UNICODE_SCRIPT_REJANG", "rejang" }, { G_UNICODE_SCRIPT_SUNDANESE, "G_UNICODE_SCRIPT_SUNDANESE", "sundanese" }, { G_UNICODE_SCRIPT_SAURASHTRA, "G_UNICODE_SCRIPT_SAURASHTRA", "saurashtra" }, { G_UNICODE_SCRIPT_CHAM, "G_UNICODE_SCRIPT_CHAM", "cham" }, { G_UNICODE_SCRIPT_OL_CHIKI, "G_UNICODE_SCRIPT_OL_CHIKI", "ol-chiki" }, { G_UNICODE_SCRIPT_VAI, "G_UNICODE_SCRIPT_VAI", "vai" }, { G_UNICODE_SCRIPT_CARIAN, "G_UNICODE_SCRIPT_CARIAN", "carian" }, { G_UNICODE_SCRIPT_LYCIAN, "G_UNICODE_SCRIPT_LYCIAN", "lycian" }, { G_UNICODE_SCRIPT_LYDIAN, "G_UNICODE_SCRIPT_LYDIAN", "lydian" }, { G_UNICODE_SCRIPT_AVESTAN, "G_UNICODE_SCRIPT_AVESTAN", "avestan" }, { G_UNICODE_SCRIPT_BAMUM, "G_UNICODE_SCRIPT_BAMUM", "bamum" }, { G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, "G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS", "egyptian-hieroglyphs" }, { G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, "G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC", "imperial-aramaic" }, { G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, "G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI", "inscriptional-pahlavi" }, { G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, "G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN", "inscriptional-parthian" }, { G_UNICODE_SCRIPT_JAVANESE, "G_UNICODE_SCRIPT_JAVANESE", "javanese" }, { G_UNICODE_SCRIPT_KAITHI, "G_UNICODE_SCRIPT_KAITHI", "kaithi" }, { G_UNICODE_SCRIPT_LISU, "G_UNICODE_SCRIPT_LISU", "lisu" }, { G_UNICODE_SCRIPT_MEETEI_MAYEK, "G_UNICODE_SCRIPT_MEETEI_MAYEK", "meetei-mayek" }, { G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, "G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN", "old-south-arabian" }, { G_UNICODE_SCRIPT_OLD_TURKIC, "G_UNICODE_SCRIPT_OLD_TURKIC", "old-turkic" }, { G_UNICODE_SCRIPT_SAMARITAN, "G_UNICODE_SCRIPT_SAMARITAN", "samaritan" }, { G_UNICODE_SCRIPT_TAI_THAM, "G_UNICODE_SCRIPT_TAI_THAM", "tai-tham" }, { G_UNICODE_SCRIPT_TAI_VIET, "G_UNICODE_SCRIPT_TAI_VIET", "tai-viet" }, { G_UNICODE_SCRIPT_BATAK, "G_UNICODE_SCRIPT_BATAK", "batak" }, { G_UNICODE_SCRIPT_BRAHMI, "G_UNICODE_SCRIPT_BRAHMI", "brahmi" }, { G_UNICODE_SCRIPT_MANDAIC, "G_UNICODE_SCRIPT_MANDAIC", "mandaic" }, { G_UNICODE_SCRIPT_CHAKMA, "G_UNICODE_SCRIPT_CHAKMA", "chakma" }, { G_UNICODE_SCRIPT_MEROITIC_CURSIVE, "G_UNICODE_SCRIPT_MEROITIC_CURSIVE", "meroitic-cursive" }, { G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, "G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS", "meroitic-hieroglyphs" }, { G_UNICODE_SCRIPT_MIAO, "G_UNICODE_SCRIPT_MIAO", "miao" }, { G_UNICODE_SCRIPT_SHARADA, "G_UNICODE_SCRIPT_SHARADA", "sharada" }, { G_UNICODE_SCRIPT_SORA_SOMPENG, "G_UNICODE_SCRIPT_SORA_SOMPENG", "sora-sompeng" }, { G_UNICODE_SCRIPT_TAKRI, "G_UNICODE_SCRIPT_TAKRI", "takri" }, { G_UNICODE_SCRIPT_BASSA_VAH, "G_UNICODE_SCRIPT_BASSA_VAH", "bassa-vah" }, { G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, "G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN", "caucasian-albanian" }, { G_UNICODE_SCRIPT_DUPLOYAN, "G_UNICODE_SCRIPT_DUPLOYAN", "duployan" }, { G_UNICODE_SCRIPT_ELBASAN, "G_UNICODE_SCRIPT_ELBASAN", "elbasan" }, { G_UNICODE_SCRIPT_GRANTHA, "G_UNICODE_SCRIPT_GRANTHA", "grantha" }, { G_UNICODE_SCRIPT_KHOJKI, "G_UNICODE_SCRIPT_KHOJKI", "khojki" }, { G_UNICODE_SCRIPT_KHUDAWADI, "G_UNICODE_SCRIPT_KHUDAWADI", "khudawadi" }, { G_UNICODE_SCRIPT_LINEAR_A, "G_UNICODE_SCRIPT_LINEAR_A", "linear-a" }, { G_UNICODE_SCRIPT_MAHAJANI, "G_UNICODE_SCRIPT_MAHAJANI", "mahajani" }, { G_UNICODE_SCRIPT_MANICHAEAN, "G_UNICODE_SCRIPT_MANICHAEAN", "manichaean" }, { G_UNICODE_SCRIPT_MENDE_KIKAKUI, "G_UNICODE_SCRIPT_MENDE_KIKAKUI", "mende-kikakui" }, { G_UNICODE_SCRIPT_MODI, "G_UNICODE_SCRIPT_MODI", "modi" }, { G_UNICODE_SCRIPT_MRO, "G_UNICODE_SCRIPT_MRO", "mro" }, { G_UNICODE_SCRIPT_NABATAEAN, "G_UNICODE_SCRIPT_NABATAEAN", "nabataean" }, { G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, "G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN", "old-north-arabian" }, { G_UNICODE_SCRIPT_OLD_PERMIC, "G_UNICODE_SCRIPT_OLD_PERMIC", "old-permic" }, { G_UNICODE_SCRIPT_PAHAWH_HMONG, "G_UNICODE_SCRIPT_PAHAWH_HMONG", "pahawh-hmong" }, { G_UNICODE_SCRIPT_PALMYRENE, "G_UNICODE_SCRIPT_PALMYRENE", "palmyrene" }, { G_UNICODE_SCRIPT_PAU_CIN_HAU, "G_UNICODE_SCRIPT_PAU_CIN_HAU", "pau-cin-hau" }, { G_UNICODE_SCRIPT_PSALTER_PAHLAVI, "G_UNICODE_SCRIPT_PSALTER_PAHLAVI", "psalter-pahlavi" }, { G_UNICODE_SCRIPT_SIDDHAM, "G_UNICODE_SCRIPT_SIDDHAM", "siddham" }, { G_UNICODE_SCRIPT_TIRHUTA, "G_UNICODE_SCRIPT_TIRHUTA", "tirhuta" }, { G_UNICODE_SCRIPT_WARANG_CITI, "G_UNICODE_SCRIPT_WARANG_CITI", "warang-citi" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GUnicodeScript", values); } return etype; } GType g_normalize_mode_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_NORMALIZE_DEFAULT, "G_NORMALIZE_DEFAULT", "default" }, { G_NORMALIZE_NFD, "G_NORMALIZE_NFD", "nfd" }, { G_NORMALIZE_DEFAULT_COMPOSE, "G_NORMALIZE_DEFAULT_COMPOSE", "default-compose" }, { G_NORMALIZE_NFC, "G_NORMALIZE_NFC", "nfc" }, { G_NORMALIZE_ALL, "G_NORMALIZE_ALL", "all" }, { G_NORMALIZE_NFKD, "G_NORMALIZE_NFKD", "nfkd" }, { G_NORMALIZE_ALL_COMPOSE, "G_NORMALIZE_ALL_COMPOSE", "all-compose" }, { G_NORMALIZE_NFKC, "G_NORMALIZE_NFKC", "nfkc" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GNormalizeMode", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/ghook.h" */ GType g_hook_flag_mask_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_HOOK_FLAG_ACTIVE, "G_HOOK_FLAG_ACTIVE", "active" }, { G_HOOK_FLAG_IN_CALL, "G_HOOK_FLAG_IN_CALL", "in-call" }, { G_HOOK_FLAG_MASK, "G_HOOK_FLAG_MASK", "mask" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GHookFlagMask", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gthread.h" */ GType g_thread_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_THREAD_ERROR_AGAIN, "G_THREAD_ERROR_AGAIN", "again" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GThreadError", values); } return etype; } GType g_once_status_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_ONCE_STATUS_NOTCALLED, "G_ONCE_STATUS_NOTCALLED", "notcalled" }, { G_ONCE_STATUS_PROGRESS, "G_ONCE_STATUS_PROGRESS", "progress" }, { G_ONCE_STATUS_READY, "G_ONCE_STATUS_READY", "ready" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GOnceStatus", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gstrfuncs.h" */ GType g_ascii_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_ASCII_ALNUM, "G_ASCII_ALNUM", "alnum" }, { G_ASCII_ALPHA, "G_ASCII_ALPHA", "alpha" }, { G_ASCII_CNTRL, "G_ASCII_CNTRL", "cntrl" }, { G_ASCII_DIGIT, "G_ASCII_DIGIT", "digit" }, { G_ASCII_GRAPH, "G_ASCII_GRAPH", "graph" }, { G_ASCII_LOWER, "G_ASCII_LOWER", "lower" }, { G_ASCII_PRINT, "G_ASCII_PRINT", "print" }, { G_ASCII_PUNCT, "G_ASCII_PUNCT", "punct" }, { G_ASCII_SPACE, "G_ASCII_SPACE", "space" }, { G_ASCII_UPPER, "G_ASCII_UPPER", "upper" }, { G_ASCII_XDIGIT, "G_ASCII_XDIGIT", "xdigit" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GAsciiType", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gmessages.h" */ GType g_log_level_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_LOG_FLAG_RECURSION, "G_LOG_FLAG_RECURSION", "flag-recursion" }, { G_LOG_FLAG_FATAL, "G_LOG_FLAG_FATAL", "flag-fatal" }, { G_LOG_LEVEL_ERROR, "G_LOG_LEVEL_ERROR", "level-error" }, { G_LOG_LEVEL_CRITICAL, "G_LOG_LEVEL_CRITICAL", "level-critical" }, { G_LOG_LEVEL_WARNING, "G_LOG_LEVEL_WARNING", "level-warning" }, { G_LOG_LEVEL_MESSAGE, "G_LOG_LEVEL_MESSAGE", "level-message" }, { G_LOG_LEVEL_INFO, "G_LOG_LEVEL_INFO", "level-info" }, { G_LOG_LEVEL_DEBUG, "G_LOG_LEVEL_DEBUG", "level-debug" }, { G_LOG_LEVEL_MASK, "G_LOG_LEVEL_MASK", "level-mask" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GLogLevelFlags", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gchecksum.h" */ GType g_checksum_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_CHECKSUM_MD5, "G_CHECKSUM_MD5", "md5" }, { G_CHECKSUM_SHA1, "G_CHECKSUM_SHA1", "sha1" }, { G_CHECKSUM_SHA256, "G_CHECKSUM_SHA256", "sha256" }, { G_CHECKSUM_SHA512, "G_CHECKSUM_SHA512", "sha512" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GChecksumType", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gutils.h" */ GType g_user_directory_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_USER_DIRECTORY_DESKTOP, "G_USER_DIRECTORY_DESKTOP", "directory-desktop" }, { G_USER_DIRECTORY_DOCUMENTS, "G_USER_DIRECTORY_DOCUMENTS", "directory-documents" }, { G_USER_DIRECTORY_DOWNLOAD, "G_USER_DIRECTORY_DOWNLOAD", "directory-download" }, { G_USER_DIRECTORY_MUSIC, "G_USER_DIRECTORY_MUSIC", "directory-music" }, { G_USER_DIRECTORY_PICTURES, "G_USER_DIRECTORY_PICTURES", "directory-pictures" }, { G_USER_DIRECTORY_PUBLIC_SHARE, "G_USER_DIRECTORY_PUBLIC_SHARE", "directory-public-share" }, { G_USER_DIRECTORY_TEMPLATES, "G_USER_DIRECTORY_TEMPLATES", "directory-templates" }, { G_USER_DIRECTORY_VIDEOS, "G_USER_DIRECTORY_VIDEOS", "directory-videos" }, { G_USER_N_DIRECTORIES, "G_USER_N_DIRECTORIES", "n-directories" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GUserDirectory", values); } return etype; } GType g_format_size_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_FORMAT_SIZE_DEFAULT, "G_FORMAT_SIZE_DEFAULT", "default" }, { G_FORMAT_SIZE_LONG_FORMAT, "G_FORMAT_SIZE_LONG_FORMAT", "long-format" }, { G_FORMAT_SIZE_IEC_UNITS, "G_FORMAT_SIZE_IEC_UNITS", "iec-units" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GFormatSizeFlags", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/goption.h" */ GType g_option_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_OPTION_FLAG_NONE, "G_OPTION_FLAG_NONE", "none" }, { G_OPTION_FLAG_HIDDEN, "G_OPTION_FLAG_HIDDEN", "hidden" }, { G_OPTION_FLAG_IN_MAIN, "G_OPTION_FLAG_IN_MAIN", "in-main" }, { G_OPTION_FLAG_REVERSE, "G_OPTION_FLAG_REVERSE", "reverse" }, { G_OPTION_FLAG_NO_ARG, "G_OPTION_FLAG_NO_ARG", "no-arg" }, { G_OPTION_FLAG_FILENAME, "G_OPTION_FLAG_FILENAME", "filename" }, { G_OPTION_FLAG_OPTIONAL_ARG, "G_OPTION_FLAG_OPTIONAL_ARG", "optional-arg" }, { G_OPTION_FLAG_NOALIAS, "G_OPTION_FLAG_NOALIAS", "noalias" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GOptionFlags", values); } return etype; } GType g_option_arg_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_OPTION_ARG_NONE, "G_OPTION_ARG_NONE", "none" }, { G_OPTION_ARG_STRING, "G_OPTION_ARG_STRING", "string" }, { G_OPTION_ARG_INT, "G_OPTION_ARG_INT", "int" }, { G_OPTION_ARG_CALLBACK, "G_OPTION_ARG_CALLBACK", "callback" }, { G_OPTION_ARG_FILENAME, "G_OPTION_ARG_FILENAME", "filename" }, { G_OPTION_ARG_STRING_ARRAY, "G_OPTION_ARG_STRING_ARRAY", "string-array" }, { G_OPTION_ARG_FILENAME_ARRAY, "G_OPTION_ARG_FILENAME_ARRAY", "filename-array" }, { G_OPTION_ARG_DOUBLE, "G_OPTION_ARG_DOUBLE", "double" }, { G_OPTION_ARG_INT64, "G_OPTION_ARG_INT64", "int64" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GOptionArg", values); } return etype; } GType g_option_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_OPTION_ERROR_UNKNOWN_OPTION, "G_OPTION_ERROR_UNKNOWN_OPTION", "unknown-option" }, { G_OPTION_ERROR_BAD_VALUE, "G_OPTION_ERROR_BAD_VALUE", "bad-value" }, { G_OPTION_ERROR_FAILED, "G_OPTION_ERROR_FAILED", "failed" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GOptionError", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gconvert.h" */ GType g_convert_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_CONVERT_ERROR_NO_CONVERSION, "G_CONVERT_ERROR_NO_CONVERSION", "no-conversion" }, { G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "G_CONVERT_ERROR_ILLEGAL_SEQUENCE", "illegal-sequence" }, { G_CONVERT_ERROR_FAILED, "G_CONVERT_ERROR_FAILED", "failed" }, { G_CONVERT_ERROR_PARTIAL_INPUT, "G_CONVERT_ERROR_PARTIAL_INPUT", "partial-input" }, { G_CONVERT_ERROR_BAD_URI, "G_CONVERT_ERROR_BAD_URI", "bad-uri" }, { G_CONVERT_ERROR_NOT_ABSOLUTE_PATH, "G_CONVERT_ERROR_NOT_ABSOLUTE_PATH", "not-absolute-path" }, { G_CONVERT_ERROR_NO_MEMORY, "G_CONVERT_ERROR_NO_MEMORY", "no-memory" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GConvertError", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/glib/gbookmarkfile.h" */ GType g_bookmark_file_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_BOOKMARK_FILE_ERROR_INVALID_URI, "G_BOOKMARK_FILE_ERROR_INVALID_URI", "invalid-uri" }, { G_BOOKMARK_FILE_ERROR_INVALID_VALUE, "G_BOOKMARK_FILE_ERROR_INVALID_VALUE", "invalid-value" }, { G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED, "G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED", "app-not-registered" }, { G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND, "G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND", "uri-not-found" }, { G_BOOKMARK_FILE_ERROR_READ, "G_BOOKMARK_FILE_ERROR_READ", "read" }, { G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING, "G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING", "unknown-encoding" }, { G_BOOKMARK_FILE_ERROR_WRITE, "G_BOOKMARK_FILE_ERROR_WRITE", "write" }, { G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND, "G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND", "file-not-found" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GBookmarkFileError", values); } return etype; } /* enumerations from "/usr/include/glib-2.0/gobject/gsignal.h" */ GType g_signal_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_SIGNAL_RUN_FIRST, "G_SIGNAL_RUN_FIRST", "run-first" }, { G_SIGNAL_RUN_LAST, "G_SIGNAL_RUN_LAST", "run-last" }, { G_SIGNAL_RUN_CLEANUP, "G_SIGNAL_RUN_CLEANUP", "run-cleanup" }, { G_SIGNAL_NO_RECURSE, "G_SIGNAL_NO_RECURSE", "no-recurse" }, { G_SIGNAL_DETAILED, "G_SIGNAL_DETAILED", "detailed" }, { G_SIGNAL_ACTION, "G_SIGNAL_ACTION", "action" }, { G_SIGNAL_NO_HOOKS, "G_SIGNAL_NO_HOOKS", "no-hooks" }, { G_SIGNAL_MUST_COLLECT, "G_SIGNAL_MUST_COLLECT", "must-collect" }, { G_SIGNAL_DEPRECATED, "G_SIGNAL_DEPRECATED", "deprecated" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GSignalFlags", values); } return etype; } GType g_connect_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_CONNECT_AFTER, "G_CONNECT_AFTER", "after" }, { G_CONNECT_SWAPPED, "G_CONNECT_SWAPPED", "swapped" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GConnectFlags", values); } return etype; } GType g_signal_match_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_SIGNAL_MATCH_ID, "G_SIGNAL_MATCH_ID", "id" }, { G_SIGNAL_MATCH_DETAIL, "G_SIGNAL_MATCH_DETAIL", "detail" }, { G_SIGNAL_MATCH_CLOSURE, "G_SIGNAL_MATCH_CLOSURE", "closure" }, { G_SIGNAL_MATCH_FUNC, "G_SIGNAL_MATCH_FUNC", "func" }, { G_SIGNAL_MATCH_DATA, "G_SIGNAL_MATCH_DATA", "data" }, { G_SIGNAL_MATCH_UNBLOCKED, "G_SIGNAL_MATCH_UNBLOCKED", "unblocked" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GSignalMatchType", values); } return etype; } /* Generated data ends here */ ����������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_type.c�������������������������������������������������0000644�0001750�0001750�00000056767�12516434313�020111� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2013 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE rbgobj_cType /**********************************************************************/ /* Type Mapping */ #ifndef rb_cMutex static VALUE rb_cMutex; #endif static VALUE lookup_class_mutex; static ID id_new; static ID id_superclass; static ID id_lock; static ID id_unlock; static GHashTable *gtype_to_cinfo; static VALUE klass_to_cinfo; static GHashTable* dynamic_gtype_list; typedef struct { const gchar* name; VALUE module; RGMarkFunc mark; RGFreeFunc free; int flags; /* RGObjClassFlag */ } RGObjClassInfoDynamic; typedef struct { VALUE parent; GType gtype; gboolean create_class; } RGObjClassByGtypeData; static void cinfo_mark(RGObjClassInfo* cinfo) { rb_gc_mark(cinfo->klass); } const RGObjClassInfo * rbgobj_lookup_class(VALUE klass) { VALUE data = rb_hash_aref(klass_to_cinfo, klass); if (!NIL_P(data)){ RGObjClassInfo* cinfo; Data_Get_Struct(data, RGObjClassInfo, cinfo); return cinfo; } if (TYPE(klass) == T_CLASS) { VALUE super; super = rb_funcall(klass, id_superclass, 0); return rbgobj_lookup_class(super); } rb_raise(rb_eRuntimeError, "can't get gobject class information"); } static const RGObjClassInfo *rbgobj_lookup_class_by_gtype_without_lock(GType gtype, VALUE parent, gboolean create_class); static VALUE get_superclass(GType gtype) { VALUE super_class; if (rbgobj_convert_get_superclass(gtype, &super_class)) return super_class; switch (gtype) { case G_TYPE_PARAM: case G_TYPE_OBJECT: return cInstantiatable; case G_TYPE_BOXED: return rb_cObject; case G_TYPE_POINTER: return rb_cData; case G_TYPE_ENUM: case G_TYPE_FLAGS: return rb_cObject; default: { GType parent_type; parent_type = g_type_parent(gtype); if (parent_type == G_TYPE_INVALID) { return cInstantiatable; } else { const RGObjClassInfo *cinfo_super; cinfo_super = rbgobj_lookup_class_by_gtype_without_lock(parent_type, Qnil, TRUE); return cinfo_super->klass; } } } } static const RGObjClassInfo * rbgobj_lookup_class_by_gtype_without_lock(GType gtype, VALUE parent, gboolean create_class) { GType fundamental_type; RGObjClassInfo* cinfo; RGObjClassInfoDynamic* cinfod; void* gclass = NULL; VALUE c; if (gtype == G_TYPE_INVALID) return NULL; cinfo = g_hash_table_lookup(gtype_to_cinfo, GUINT_TO_POINTER(gtype)); if (cinfo) return cinfo; if (!create_class) return NULL; c = Data_Make_Struct(rb_cData, RGObjClassInfo, cinfo_mark, NULL, cinfo); cinfo->gtype = gtype; cinfo->mark = NULL; cinfo->free = NULL; cinfo->flags = 0; fundamental_type = G_TYPE_FUNDAMENTAL(gtype); switch (fundamental_type){ case G_TYPE_POINTER: case G_TYPE_BOXED: case G_TYPE_PARAM: case G_TYPE_OBJECT: case G_TYPE_ENUM: case G_TYPE_FLAGS: if (NIL_P(parent)) parent = get_superclass(gtype); cinfo->klass = rb_funcall(rb_cClass, id_new, 1, parent); break; case G_TYPE_INTERFACE: cinfo->klass = rb_module_new(); break; default: if (NIL_P(parent)) parent = get_superclass(gtype); if (NIL_P(parent)) { fprintf(stderr, "%s: %s's fundamental type %s isn't supported\n", "rbgobj_lookup_class_by_gtype", g_type_name(gtype), g_type_name(fundamental_type)); return NULL; } cinfo->klass = rb_funcall(rb_cClass, id_new, 1, parent); } cinfod = (RGObjClassInfoDynamic *)g_hash_table_lookup(dynamic_gtype_list, g_type_name(gtype)); if (cinfod){ cinfo->mark = cinfod->mark; cinfo->free = cinfod->free; rb_define_const(cinfod->module, cinfod->name, cinfo->klass); } rb_hash_aset(klass_to_cinfo, cinfo->klass, c); g_hash_table_insert(gtype_to_cinfo, GUINT_TO_POINTER(gtype), cinfo); if (G_TYPE_IS_CLASSED(gtype)) gclass = g_type_class_ref(gtype); if (G_TYPE_IS_INSTANTIATABLE(gtype) || G_TYPE_IS_INTERFACE(gtype)) rbgobj_define_action_methods(cinfo->klass); if (G_TYPE_IS_INSTANTIATABLE(gtype)){ GType* interfaces = NULL; guint n_interfaces = 0; guint i; interfaces = g_type_interfaces(gtype, &n_interfaces); for (i = 0; i < n_interfaces; i++){ const RGObjClassInfo *iface_cinfo; iface_cinfo = rbgobj_lookup_class_by_gtype_without_lock(interfaces[i], Qnil, TRUE); rb_include_module(cinfo->klass, iface_cinfo->klass); } g_free(interfaces); } if (!rbgobj_convert_type_init_hook(gtype, cinfo->klass)) { switch (fundamental_type) { case G_TYPE_OBJECT: rbgobj_init_object_class(cinfo->klass); break; case G_TYPE_ENUM: rbgobj_init_enum_class(cinfo->klass); break; case G_TYPE_FLAGS: rbgobj_init_flags_class(cinfo->klass); break; case G_TYPE_INTERFACE: rbgobj_init_interface(cinfo->klass); break; default: rbgobj_convert_type_init_hook(fundamental_type, cinfo->klass); break; } } if (gclass) g_type_class_unref(gclass); return cinfo; } static VALUE rbgobj_lookup_class_by_gtype_body(VALUE data) { RGObjClassByGtypeData *cdata = (RGObjClassByGtypeData *)data; const RGObjClassInfo *cinfo; cinfo = rbgobj_lookup_class_by_gtype_without_lock(cdata->gtype, cdata->parent, cdata->create_class); return (VALUE)cinfo; } static VALUE rbgobj_lookup_class_by_gtype_ensure(G_GNUC_UNUSED VALUE data) { rb_funcall(lookup_class_mutex, id_unlock, 0); return Qundef; } const RGObjClassInfo * rbgobj_lookup_class_by_gtype(GType gtype, VALUE parent) { return rbgobj_lookup_class_by_gtype_full(gtype, parent, TRUE); } const RGObjClassInfo * rbgobj_lookup_class_by_gtype_full(GType gtype, VALUE parent, gboolean create_class) { const RGObjClassInfo *info; RGObjClassByGtypeData data; info = rbgobj_lookup_class_by_gtype_without_lock(gtype, parent, FALSE); if (info) { return info; } if (!create_class) { return NULL; } data.gtype = gtype; data.parent = parent; data.create_class = create_class; rb_funcall(lookup_class_mutex, id_lock, 0); return (RGObjClassInfo *)rb_ensure(rbgobj_lookup_class_by_gtype_body, (VALUE)&data, rbgobj_lookup_class_by_gtype_ensure, (VALUE)&data); } VALUE rbgobj_gtype_to_ruby_class(GType gtype) { const RGObjClassInfo *cinfo; cinfo = GTYPE2CINFO(gtype); return cinfo ? cinfo->klass : Qnil; } VALUE rbgobj_define_class(GType gtype, const gchar *name, VALUE module, RGMarkFunc mark, RGFreeFunc free, VALUE parent) { RGObjClassInfo* cinfo; if (gtype == 0) rb_bug("rbgobj_define_class: Invalid gtype [%s]\n", name); cinfo = (RGObjClassInfo*)rbgobj_lookup_class_by_gtype(gtype, parent); cinfo->mark = mark; cinfo->free = free; rb_define_const(module, name, cinfo->klass); return cinfo->klass; } void rbgobj_register_mark_func(GType gtype, RGMarkFunc mark) { RGObjClassInfo *cinfo; cinfo = (RGObjClassInfo *)rbgobj_lookup_class_by_gtype_full(gtype, Qnil, FALSE); if (!cinfo) { rb_raise(rb_eArgError, "rbgobj_register_free_func(): no class is defined: <%s>", g_type_name(gtype)); } cinfo->mark = mark; } void rbgobj_register_free_func(GType gtype, RGFreeFunc free) { RGObjClassInfo *cinfo; cinfo = (RGObjClassInfo *)rbgobj_lookup_class_by_gtype_full(gtype, Qnil, FALSE); if (!cinfo) { rb_raise(rb_eArgError, "rbgobj_register_free_func(): no class is defined: <%s>", g_type_name(gtype)); } cinfo->free = free; } VALUE rbgobj_define_class_dynamic(const gchar *gtype_name, const gchar *name, VALUE module, RGMarkFunc mark, RGFreeFunc free) { RGObjClassInfoDynamic* cinfo; cinfo = (RGObjClassInfoDynamic*)g_new(RGObjClassInfoDynamic, 1); cinfo->name = name; cinfo->module = module; cinfo->mark = mark; cinfo->free = free; g_hash_table_insert(dynamic_gtype_list, (void*)gtype_name, (void*)cinfo); return Qnil; } void rbgobj_register_class(VALUE klass, GType gtype, gboolean klass2gtype, gboolean gtype2klass) { RGObjClassInfo* cinfo = NULL; VALUE c = Qnil; if (klass2gtype) c = Data_Make_Struct(rb_cData, RGObjClassInfo, cinfo_mark, NULL, cinfo); if (gtype2klass && !cinfo) cinfo = g_new(RGObjClassInfo, 1); if (cinfo) { cinfo->klass = klass; cinfo->gtype = gtype; cinfo->mark = NULL; cinfo->free = NULL; cinfo->flags = 0; } if (klass2gtype) rb_hash_aset(klass_to_cinfo, cinfo->klass, c); if (gtype2klass) g_hash_table_insert(gtype_to_cinfo, GUINT_TO_POINTER(gtype), cinfo); } #define _register_fundamental_klass_to_gtype(klass, gtype) \ rbgobj_register_class(klass, gtype, TRUE, FALSE) #define _register_fundamental_gtype_to_klass(gtype,klass) \ rbgobj_register_class(klass, gtype, FALSE, TRUE) static void init_typemap(void) { id_new = rb_intern("new"); id_superclass = rb_intern("superclass"); gtype_to_cinfo = g_hash_table_new(g_direct_hash, g_direct_equal); rb_global_variable(&klass_to_cinfo); klass_to_cinfo = rb_hash_new(); _register_fundamental_klass_to_gtype(rb_cFixnum, G_TYPE_LONG); _register_fundamental_klass_to_gtype(rb_cFloat, G_TYPE_DOUBLE); _register_fundamental_klass_to_gtype(rb_cInteger, G_TYPE_LONG); _register_fundamental_klass_to_gtype(rb_cString, G_TYPE_STRING); _register_fundamental_klass_to_gtype(rb_cSymbol, G_TYPE_STRING); _register_fundamental_klass_to_gtype(Qnil, G_TYPE_NONE); _register_fundamental_klass_to_gtype(rb_cNilClass, G_TYPE_NONE); _register_fundamental_klass_to_gtype(rb_cTrueClass, G_TYPE_BOOLEAN); _register_fundamental_klass_to_gtype(rb_cFalseClass, G_TYPE_BOOLEAN); _register_fundamental_klass_to_gtype(Qtrue, G_TYPE_BOOLEAN); _register_fundamental_klass_to_gtype(Qfalse, G_TYPE_BOOLEAN); _register_fundamental_klass_to_gtype(rb_cObject, RBGOBJ_TYPE_RUBY_VALUE); _register_fundamental_gtype_to_klass(G_TYPE_UINT, rb_cInteger); _register_fundamental_gtype_to_klass(G_TYPE_FLOAT, rb_cFloat); _register_fundamental_gtype_to_klass(G_TYPE_DOUBLE, rb_cFloat); _register_fundamental_gtype_to_klass(G_TYPE_INT64, rb_cInteger); _register_fundamental_gtype_to_klass(G_TYPE_UINT64, rb_cInteger); _register_fundamental_gtype_to_klass(G_TYPE_INT, rb_cInteger); _register_fundamental_gtype_to_klass(G_TYPE_LONG, rb_cInteger); _register_fundamental_gtype_to_klass(G_TYPE_CHAR, rb_cFixnum); _register_fundamental_gtype_to_klass(G_TYPE_UCHAR, rb_cFixnum); _register_fundamental_gtype_to_klass(G_TYPE_STRING, rb_cString); _register_fundamental_gtype_to_klass(G_TYPE_ULONG, rb_cInteger); _register_fundamental_gtype_to_klass(G_TYPE_NONE, rb_cNilClass); _register_fundamental_gtype_to_klass(G_TYPE_BOOLEAN, rb_cTrueClass); } /**********************************************************************/ /* GLib::Type */ VALUE RG_TARGET_NAMESPACE; static ID id_gtype; VALUE rbgobj_gtype_new(GType gtype) { VALUE result = rb_obj_alloc(RG_TARGET_NAMESPACE); VALUE arg = ULONG2NUM(gtype); rb_obj_call_init(result, 1, &arg); return result; } GType rbgobj_gtype_get(VALUE self) { if (RVAL2CBOOL(rb_obj_is_kind_of(self, RG_TARGET_NAMESPACE))) { return NUM2ULONG(rb_ivar_get(self, id_gtype)); } else { return CLASS2GTYPE(self); } rb_raise(rb_eTypeError, "Not a GLib::Type"); } static VALUE rg_initialize(VALUE self, VALUE type) { GType gtype; if (RVAL2CBOOL(rb_obj_is_kind_of(type, rb_cInteger))) { gtype = NUM2ULONG(type); if (!g_type_name(gtype)) gtype = G_TYPE_INVALID; } else { gtype = g_type_from_name(StringValuePtr(type)); } if (G_TYPE_INVALID == gtype) rb_raise(rb_eArgError, "invalid type"); rb_ivar_set(self, id_gtype, ULONG2NUM(gtype)); return Qnil; } static VALUE rg_inspect(VALUE self) { GType gtype = rbgobj_gtype_get(self); gchar* str; VALUE result; str = g_strdup_printf("GLib::Type[\"%s\"]", g_type_name(gtype)); result = rb_str_new2(str); g_free(str); return result; } static VALUE rg_operator_type_compare(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_obj_is_kind_of(other, RG_TARGET_NAMESPACE))) return Qnil; else { GType a = rbgobj_gtype_get(self); GType b = rbgobj_gtype_get(other); if (a==b) return INT2FIX(0); else if (g_type_is_a(a,b)) return INT2FIX(-1); else if (g_type_is_a(b,a)) return INT2FIX(1); else return Qnil; } } static VALUE rg_operator_type_eq(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_obj_is_kind_of(other, RG_TARGET_NAMESPACE))) return Qnil; else { GType a = rbgobj_gtype_get(self); GType b = rbgobj_gtype_get(other); return CBOOL2RVAL(a == b); } } static VALUE rg_operator_type_lt_eq(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_obj_is_kind_of(other, RG_TARGET_NAMESPACE))) return Qnil; else { GType a = rbgobj_gtype_get(self); GType b = rbgobj_gtype_get(other); return CBOOL2RVAL(g_type_is_a(a, b)); } } static VALUE rg_operator_type_gt_eq(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_obj_is_kind_of(other, RG_TARGET_NAMESPACE))) return Qnil; else { GType a = rbgobj_gtype_get(self); GType b = rbgobj_gtype_get(other); return CBOOL2RVAL(g_type_is_a(b, a)); } } static VALUE rg_operator_type_lt(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_obj_is_kind_of(other, RG_TARGET_NAMESPACE))) return Qnil; else { GType a = rbgobj_gtype_get(self); GType b = rbgobj_gtype_get(other); return CBOOL2RVAL(g_type_is_a(a, b) && a != b); } } static VALUE rg_operator_type_gt(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_obj_is_kind_of(other, RG_TARGET_NAMESPACE))) return Qnil; else { GType a = rbgobj_gtype_get(self); GType b = rbgobj_gtype_get(other); return CBOOL2RVAL(g_type_is_a(b, a) && a != b); } } static VALUE rg_hash(VALUE self) { return rb_ivar_get(self, id_gtype); } static VALUE rg_to_class(VALUE self) { return GTYPE2CLASS(rbgobj_gtype_get(self)); } static VALUE rg_fundamental(VALUE self) { return rbgobj_gtype_new(G_TYPE_FUNDAMENTAL(rbgobj_gtype_get(self))); } static VALUE rg_fundamental_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_FUNDAMENTAL(rbgobj_gtype_get(self))); } static VALUE rg_derived_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_DERIVED(rbgobj_gtype_get(self))); } static VALUE rg_interface_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_INTERFACE(rbgobj_gtype_get(self))); } static VALUE rg_classed_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_CLASSED(rbgobj_gtype_get(self))); } static VALUE rg_instantiatable_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_INSTANTIATABLE(rbgobj_gtype_get(self))); } static VALUE rg_derivable_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_DERIVABLE(rbgobj_gtype_get(self))); } static VALUE rg_deep_derivable_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_DEEP_DERIVABLE(rbgobj_gtype_get(self))); } static VALUE rg_abstract_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_ABSTRACT(rbgobj_gtype_get(self))); } static VALUE rg_value_abstract_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_VALUE_ABSTRACT(rbgobj_gtype_get(self))); } static VALUE rg_value_type_p(VALUE self) { return CBOOL2RVAL(G_TYPE_IS_VALUE_TYPE(rbgobj_gtype_get(self))); } static VALUE rg_has_value_table(VALUE self) { return CBOOL2RVAL(G_TYPE_HAS_VALUE_TABLE(rbgobj_gtype_get(self))); } static VALUE rg_name(VALUE self) { return rb_str_new2(g_type_name(rbgobj_gtype_get(self))); } static VALUE rg_parent(VALUE self) { GType parent = g_type_parent(rbgobj_gtype_get(self)); return parent ? rbgobj_gtype_new(parent) : Qnil; } static VALUE rg_depth(VALUE self) { return UINT2NUM(g_type_depth(rbgobj_gtype_get(self))); } static VALUE rg_next_base(VALUE leaf_type, VALUE root_type) { GType ret = g_type_next_base(rbgobj_gtype_get(leaf_type), rbgobj_gtype_get(root_type)); return ret ? rbgobj_gtype_new(ret) : Qnil; } static VALUE rg_type_is_a_p(VALUE self, VALUE is_a_type) { return CBOOL2RVAL(g_type_is_a(rbgobj_gtype_get(self), rbgobj_gtype_get(is_a_type))); } #if 0 gpointer g_type_class_ref (GType type); gpointer g_type_class_peek (GType type); void g_type_class_unref (gpointer g_class); gpointer g_type_class_peek_parent (gpointer g_class); gpointer g_type_interface_peek (gpointer instance_class, GType iface_type); gpointer g_type_interface_peek_parent (gpointer g_iface); #endif static VALUE rg_children(VALUE self) { guint n_children; GType* types; VALUE result; guint i; types = g_type_children(rbgobj_gtype_get(self), &n_children); result = rb_ary_new2(n_children); for (i = 0; i < n_children; i++) rb_ary_store(result, i, rbgobj_gtype_new(types[i])); g_free(types); return result; } static VALUE rg_interfaces(VALUE self) { guint n_interfaces; GType* types; VALUE result; guint i; types = g_type_interfaces(rbgobj_gtype_get(self), &n_interfaces); result = rb_ary_new2(n_interfaces); for (i = 0; i < n_interfaces; i++) rb_ary_store(result, i, rbgobj_gtype_new(types[i])); g_free(types); return result; } static VALUE rg_class_size(VALUE self) { GTypeQuery query; g_type_query(rbgobj_gtype_get(self), &query); return UINT2NUM(query.class_size); } static VALUE rg_instance_size(VALUE self) { GTypeQuery query; g_type_query(rbgobj_gtype_get(self), &query); return UINT2NUM(query.instance_size); } static inline void _def_fundamental_type(VALUE ary, GType gtype, const char* name) { VALUE c = rbgobj_gtype_new(gtype); rb_define_const(RG_TARGET_NAMESPACE, name, c); rb_ary_push(ary, c); } /**********************************************************************/ void Init_gobject_gtype(void) { #if !GLIB_CHECK_VERSION(2, 35, 1) g_type_init(); #endif init_typemap(); /* type */ #ifndef rb_cMutex rb_cMutex = rb_const_get(rb_cObject, rb_intern("Mutex")); #endif id_lock = rb_intern("lock"); id_unlock = rb_intern("unlock"); lookup_class_mutex = rb_funcall(rb_cMutex, id_new, 0); rb_iv_set(mGLib, "lookup_class_mutex", lookup_class_mutex); dynamic_gtype_list = g_hash_table_new(g_str_hash, g_str_equal); id_gtype = rb_intern("__gobject_gtype__"); RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "Type", rb_cObject); rb_define_alias(CLASS_OF(RG_TARGET_NAMESPACE), "[]", "new"); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(inspect, 0); RG_DEF_METHOD_OPERATOR("<=>", type_compare, 1); RG_DEF_METHOD_OPERATOR("==", type_eq, 1); RG_DEF_METHOD_OPERATOR("<=", type_lt_eq, 1); RG_DEF_METHOD_OPERATOR(">=", type_gt_eq, 1); RG_DEF_METHOD_OPERATOR("<", type_lt, 1); RG_DEF_METHOD_OPERATOR(">", type_gt, 1); RG_DEF_ALIAS("eql?", "=="); RG_DEF_METHOD(hash, 0); RG_DEF_ALIAS("to_i", "hash"); RG_DEF_ALIAS("to_int", "hash"); RG_DEF_METHOD(to_class, 0); RG_DEF_METHOD(fundamental, 0); RG_DEF_METHOD_P(fundamental, 0); RG_DEF_METHOD_P(derived, 0); RG_DEF_METHOD_P(interface, 0); RG_DEF_METHOD_P(classed, 0); RG_DEF_METHOD_P(instantiatable, 0); RG_DEF_METHOD_P(derivable, 0); RG_DEF_METHOD_P(deep_derivable, 0); RG_DEF_METHOD_P(abstract, 0); RG_DEF_METHOD_P(value_abstract, 0); RG_DEF_METHOD_P(value_type, 0); RG_DEF_METHOD(has_value_table, 0); RG_DEF_METHOD(name, 0); RG_DEF_ALIAS("to_s", "name"); RG_DEF_METHOD(parent, 0); RG_DEF_METHOD(depth, 0); RG_DEF_METHOD(next_base, 1); RG_DEF_METHOD_P(type_is_a, 1); RG_DEF_METHOD(children, 0); RG_DEF_METHOD(interfaces, 0); RG_DEF_METHOD(class_size, 0); RG_DEF_METHOD(instance_size, 0); { VALUE ary = rb_ary_new(); rb_define_const(RG_TARGET_NAMESPACE, "FUNDAMENTAL_MAX", INT2FIX(G_TYPE_FUNDAMENTAL_MAX)); _def_fundamental_type(ary, G_TYPE_NONE, "NONE"); _def_fundamental_type(ary, G_TYPE_INTERFACE, "INTERFACE"); _def_fundamental_type(ary, G_TYPE_CHAR, "CHAR"); _def_fundamental_type(ary, G_TYPE_UCHAR, "UCHAR"); _def_fundamental_type(ary, G_TYPE_BOOLEAN, "BOOLEAN"); _def_fundamental_type(ary, G_TYPE_INT, "INT"); _def_fundamental_type(ary, G_TYPE_UINT, "UINT"); _def_fundamental_type(ary, G_TYPE_LONG, "LONG"); _def_fundamental_type(ary, G_TYPE_ULONG, "ULONG"); _def_fundamental_type(ary, G_TYPE_INT64, "INT64"); _def_fundamental_type(ary, G_TYPE_UINT64, "UINT64"); _def_fundamental_type(ary, G_TYPE_ENUM, "ENUM"); _def_fundamental_type(ary, G_TYPE_FLAGS, "FLAGS"); _def_fundamental_type(ary, G_TYPE_FLOAT, "FLOAT"); _def_fundamental_type(ary, G_TYPE_DOUBLE, "DOUBLE"); _def_fundamental_type(ary, G_TYPE_STRING, "STRING"); _def_fundamental_type(ary, G_TYPE_POINTER, "POINTER"); _def_fundamental_type(ary, G_TYPE_BOXED, "BOXED"); _def_fundamental_type(ary, G_TYPE_PARAM, "PARAM"); _def_fundamental_type(ary, G_TYPE_OBJECT, "OBJECT"); rb_define_const(RG_TARGET_NAMESPACE, "FUNDAMENTAL_TYPES", ary); /* FIXME: better name */ } } ���������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_iochannel.c��������������������������������������������0000644�0001750�0001750�00000052252�12142464343�021046� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" static ID id_call; static ID id_puts; static ID id_unpack; static VALUE default_rs; #define RG_TARGET_NAMESPACE cIOChannel #define _SELF(s) ((GIOChannel*)RVAL2BOXED(s, G_TYPE_IO_CHANNEL)) static void ioc_error(GIOStatus status, GError *err) { if (err != NULL) RAISE_GERROR(err); if (status == G_IO_STATUS_EOF){ rb_raise(rb_eEOFError, "End of file reached"); } else if (status == G_IO_STATUS_AGAIN){ rb_raise(rb_eRuntimeError, "G_IO_STATUS_AGAIN"); } else if (status == G_IO_STATUS_NORMAL){ /* Do nothing */ } else { rb_raise(rb_eRuntimeError, "An error occured. status = %d\n", status); } } static VALUE rg_initialize(gint argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GIOChannel* io = NULL; rb_secure(4); rb_scan_args(argc, argv, "11", &arg1, &arg2); if (TYPE(arg1) != T_STRING){ gint fd; if (TYPE(arg1) == T_FIXNUM){ fd = NUM2INT(arg1); } else { fd = NUM2INT(rb_funcall(arg1, rb_intern("to_i"), 0)); } #ifdef G_OS_UNIX io = g_io_channel_unix_new(fd); #elif defined(G_OS_WIN32) io = g_io_channel_win32_new_fd(fd); #else rb_raise(rb_eRuntimeError, "GLib::IOChannel.new(fd) is supported on UNIX environment only"); #endif } else { GError* err = NULL; io = g_io_channel_new_file(RVAL2CSTR(arg1), NIL_P(arg2) ? "r" : RVAL2CSTR(arg2), &err); if (err != NULL) RAISE_GERROR(err); } G_INITIALIZE(self, io); return Qnil; } static VALUE ioc_close(VALUE self) { GError* err = NULL; GIOStatus status = g_io_channel_shutdown(_SELF(self), TRUE, &err); ioc_error(status, err); return self; } static VALUE rg_s_open(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE arg1, arg2; VALUE rio; GIOChannel* io = NULL; rb_scan_args(argc, argv, "11", &arg1, &arg2); if (TYPE(arg1) == T_FIXNUM){ #ifdef G_OS_UNIX io = g_io_channel_unix_new(NUM2INT(arg1)); #elif defined(G_OS_WIN32) io = g_io_channel_win32_new_fd(NUM2INT(arg1)); #else rb_raise(rb_eRuntimeError, "GLib::IOChannel.new(fd) is supported on " "UNIX and Windows environment only"); #endif } else { GError* err = NULL; io = g_io_channel_new_file(RVAL2CSTR(arg1), NIL_P(arg2) ? "r" : RVAL2CSTR(arg2), &err); if (err != NULL) RAISE_GERROR(err); } rio = BOXED2RVAL(io, G_TYPE_IO_CHANNEL); if (rb_block_given_p()) { return rb_ensure(rb_yield, rio, ioc_close, rio); } return rio; } static VALUE rg_fileno(VALUE self) { #ifdef G_OS_UNIX return INT2NUM(g_io_channel_unix_get_fd(_SELF(self))); #elif defined(G_OS_WIN32) return INT2NUM(g_io_channel_win32_get_fd(_SELF(self))); #else rb_warn("GLib::IOChannel#fd is supported on " "UNIX and Windows environment only."); return Qnil; #endif } /* Don't need this void g_io_channel_init (GIOChannel *channel); */ static VALUE rg_read(gint argc, VALUE *argv, VALUE self) { VALUE rbcount; gsize count; gchar *buffer; gsize bytes_read; GIOChannel *channel = _SELF(self); GError *error = NULL; GIOStatus status; rb_scan_args(argc, argv, "01", &rbcount); if (NIL_P(rbcount)) { status = g_io_channel_read_to_end(channel, &buffer, &bytes_read, &error); ioc_error(status, error); return buffer != NULL ? CSTR2RVAL_LEN_FREE(buffer, bytes_read) : CSTR2RVAL(""); } count = NUM2UINT(rbcount); buffer = g_new(gchar, count); memset(buffer, '\0', count); status = g_io_channel_read_chars(channel, buffer, count, &bytes_read, &error); if (status == G_IO_STATUS_NORMAL) return CSTR2RVAL_LEN_FREE(buffer, bytes_read); else if (status == G_IO_STATUS_EOF) return CSTR2RVAL(""); ioc_error(status, error); /* Not reached. */ return Qnil; } static VALUE rg_readchar(VALUE self) { gunichar thechar; GError* err = NULL; GIOStatus status = g_io_channel_read_unichar(_SELF(self), &thechar, &err); ioc_error(status, err); return UINT2NUM(thechar); } static VALUE rg_getc(VALUE self) { gunichar thechar; GError* err = NULL; VALUE ret; GIOStatus status = g_io_channel_read_unichar(_SELF(self), &thechar, &err); if (status == G_IO_STATUS_EOF){ ret = Qnil; } else { ioc_error(status, err); ret = UINT2NUM(thechar); } return ret; } static VALUE rg_each_char(VALUE self) { if (!rb_block_given_p()) { rb_raise(rb_eArgError, "called without a block"); } while (TRUE){ gunichar thechar; GError* err = NULL; GIOStatus status = g_io_channel_read_unichar(_SELF(self), &thechar, &err); if (status == G_IO_STATUS_EOF){ break; } else { ioc_error(status, err); rb_yield(UINT2NUM(thechar)); } } return self; } static VALUE rg_readline(gint argc, VALUE *argv, VALUE self) { gchar* str; VALUE line_term, ret; GIOStatus status; GError* err = NULL; const gchar* old_line_term = NULL; gint old_line_term_len; rb_scan_args(argc, argv, "01", &line_term); if (! NIL_P(line_term)){ StringValue(line_term); old_line_term = g_io_channel_get_line_term(_SELF(self), &old_line_term_len); g_io_channel_set_line_term(_SELF(self), RVAL2CSTR(line_term), RSTRING_LEN(line_term)); } status = g_io_channel_read_line(_SELF(self), &str, NULL, NULL, &err); if (! NIL_P(line_term)){ g_io_channel_set_line_term(_SELF(self), old_line_term, old_line_term_len); } ioc_error(status, err); ret = str ? CSTR2RVAL(str) : CSTR2RVAL(""); g_free(str); return ret; } static VALUE rg_gets(gint argc, VALUE *argv, VALUE self) { gchar* str; VALUE line_term, ret; GIOStatus status; GError* err = NULL; const gchar* old_line_term = NULL; gint old_line_term_len; rb_scan_args(argc, argv, "01", &line_term); if (! NIL_P(line_term)){ StringValue(line_term); old_line_term = g_io_channel_get_line_term(_SELF(self), &old_line_term_len); g_io_channel_set_line_term(_SELF(self), RVAL2CSTR(line_term), RSTRING_LEN(line_term)); } status = g_io_channel_read_line(_SELF(self), &str, NULL, NULL, &err); if (! NIL_P(line_term)){ g_io_channel_set_line_term(_SELF(self), old_line_term, old_line_term_len); } if (status == G_IO_STATUS_EOF){ ret = Qnil; } else { ioc_error(status, err); ret = str ? CSTR2RVAL(str) : CSTR2RVAL(""); } g_free(str); return ret; } /* Internal use only */ static VALUE ioc_set_line_term(VALUE args) { VALUE self = RARRAY_PTR(args)[0]; VALUE doit = RARRAY_PTR(args)[1]; VALUE line_term = RARRAY_PTR(args)[2]; if (doit == Qtrue){ StringValue(line_term); g_io_channel_set_line_term(_SELF(self), RVAL2CSTR(line_term), RSTRING_LEN(line_term)); } return self; } static VALUE rg_each(gint argc, VALUE *argv, VALUE self) { gchar* str; VALUE line_term; GIOStatus status; GError* err = NULL; GIOChannel *channel; const gchar* old_line_term = NULL; gint old_line_term_len; if (!rb_block_given_p()) { rb_raise(rb_eArgError, "called without a block"); } rb_scan_args(argc, argv, "01", &line_term); channel = _SELF(self); if (!NIL_P(line_term)) { StringValue(line_term); old_line_term = g_io_channel_get_line_term(channel, &old_line_term_len); g_io_channel_set_line_term(channel, RVAL2CSTR(line_term), RSTRING_LEN(line_term)); } while (TRUE) { status = g_io_channel_read_line(channel, &str, NULL, NULL, &err); if (status == G_IO_STATUS_EOF) { break; } else { VALUE rstr; ioc_error(status, err); if (str) { rstr = CSTR2RVAL(str); } else { rstr = CSTR2RVAL(""); } g_free(str); rb_ensure(rb_yield, rstr, ioc_set_line_term, rb_ary_new3(3, self, NIL_P(line_term) ? Qfalse : Qtrue, CSTR2RVAL(old_line_term))); } } return self; } /* Don't need this. GIOStatus g_io_channel_read_line_string (GIOChannel *channel, GString *buffer, gsize *terminator_pos, GError **error); */ /* Use GLib::IOChannel#read instead. static VALUE ioc_read_to_end(VALUE self) { gchar* str; gsize length; VALUE ret; GError* err = NULL; GIOStatus status = g_io_channel_read_to_end(_SELF(self), &str, &length, &err); ioc_error(status, err); ret = str ? rb_str_new(str, length) : CSTR2RVAL(""); g_free(str); return ret; } */ static VALUE rg_write(VALUE self, VALUE buf) { gssize count; gsize bytes_written; GIOStatus status; GError* err = NULL; rb_secure(4); buf = rb_obj_as_string(buf); StringValue(buf); count = RSTRING_LEN(buf); status = g_io_channel_write_chars(_SELF(self), RVAL2CSTR(buf), count, &bytes_written, &err); ioc_error(status, err); return UINT2NUM(bytes_written); } static VALUE rg_putc(VALUE self, VALUE thechar) { GError* err = NULL; GIOStatus status; gunichar unichar; rb_secure(4); if (TYPE(thechar) == T_FIXNUM) { unichar = NUM2UINT(thechar); } else { VALUE ary = rb_funcall(thechar, id_unpack, 1, CSTR2RVAL("U")); unichar = NUM2UINT(RARRAY_PTR(ary)[0]); } status = g_io_channel_write_unichar(_SELF(self), unichar, &err); ioc_error(status, err); return self; } static VALUE rg_flush(VALUE self) { GError* err = NULL; GIOStatus status = g_io_channel_flush(_SELF(self), &err); ioc_error(status, err); return self; } static VALUE rg_seek(gint argc, VALUE *argv, VALUE self) { VALUE ofs, type; GIOStatus status; GError* err = NULL; GSeekType gtype = G_SEEK_SET; rb_scan_args(argc, argv, "11", &ofs, &type); if (!NIL_P(type)) gtype = NUM2INT(type); status = g_io_channel_seek_position(_SELF(self), NUM2INT(ofs), gtype, &err); ioc_error(status, err); return self; } static VALUE rg_set_pos(VALUE self, VALUE pos) { GError* err = NULL; GIOStatus status = g_io_channel_seek_position(_SELF(self), NUM2INT(pos), G_SEEK_SET, &err); ioc_error(status, err); return self; } static VALUE rg_close(gint argc, VALUE *argv, VALUE self) { VALUE flush; GError* err = NULL; gboolean gflush = TRUE; GIOStatus status; rb_scan_args(argc, argv, "01", &flush); if (!NIL_P(flush)){ gflush = RVAL2CBOOL(flush); } status = g_io_channel_shutdown(_SELF(self), gflush, &err); ioc_error(status, err); return self; } static VALUE rg_create_watch(VALUE self, VALUE condition) { return BOXED2RVAL(g_io_create_watch(_SELF(self), NUM2INT(condition)), G_TYPE_SOURCE); } static gboolean io_func(GIOChannel *source, GIOCondition condition, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2, BOXED2RVAL(source, G_TYPE_IO_CHANNEL), INT2NUM(condition))); } static VALUE rg_add_watch(VALUE self, VALUE condition) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); return UINT2NUM(g_io_add_watch(_SELF(self), NUM2INT(condition), (GIOFunc)io_func, (gpointer)func)); } /* Don't need this guint g_io_add_watch_full (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify); */ static VALUE rg_buffer_size(VALUE self) { return UINT2NUM(g_io_channel_get_buffer_size(_SELF(self))); } static VALUE rg_set_buffer_size(VALUE self, VALUE buffer_size) { g_io_channel_set_buffer_size(_SELF(self), NUM2UINT(buffer_size)); return self; } static VALUE rg_buffer_condition(VALUE self) { return INT2NUM(g_io_channel_get_buffer_condition(_SELF(self))); } static VALUE rg_flags(VALUE self) { return INT2NUM(g_io_channel_get_flags(_SELF(self))); } static VALUE rg_set_flags(VALUE self, VALUE flags) { GError* err = NULL; GIOStatus status = g_io_channel_set_flags(_SELF(self), NUM2INT(flags), &err); ioc_error(status, err); return self; } /* Use them with GLib::IOChannel#gets, #readline, #readlines static VALUE ioc_get_line_term(VALUE self) { gint length; const gchar* ret = g_io_channel_get_line_term(_SELF(self), &length); if (ret) { if (length < 0) { return CSTR2RVAL(ret); } else { return rb_str_new(ret, length); } } return Qnil; } static VALUE ioc_set_line_term(VALUE self, VALUE line_term) { StringValue(line_term); g_io_channel_set_line_term(_SELF(self), RVAL2CSTR(line_term), RSTRING_LEN(line_term)); return self; } */ static VALUE rg_buffered(VALUE self) { return CBOOL2RVAL(g_io_channel_get_buffered(_SELF(self))); } static VALUE rg_set_buffered(VALUE self, VALUE buffered) { g_io_channel_set_buffered(_SELF(self), RVAL2CBOOL(buffered)); return self; } static VALUE rg_encoding(VALUE self) { return CSTR2RVAL(g_io_channel_get_encoding(_SELF(self))); } static VALUE rg_set_encoding(VALUE self, VALUE encoding) { GError* err = NULL; GIOStatus status; status = g_io_channel_set_encoding(_SELF(self), RVAL2CSTR_ACCEPT_NIL(encoding), &err); ioc_error(status, err); return self; } /* Don't we need them ? gboolean g_io_channel_get_close_on_unref (GIOChannel *channel); void g_io_channel_set_close_on_unref (GIOChannel *channel, gboolean do_close); */ /* Deprecated GIOError g_io_channel_read (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read); enum GIOError; GIOError g_io_channel_write (GIOChannel *channel, const gchar *buf, gsize count, gsize *bytes_written); GIOError g_io_channel_seek (GIOChannel *channel, gint64 offset, GSeekType type); void g_io_channel_close (GIOChannel *channel); */ /* * Stolen some convenient methods from io.c */ static VALUE rg_printf(int argc, VALUE *argv, VALUE self) { rg_write(self, rb_f_sprintf(argc, argv)); return Qnil; } static VALUE ioc_puts_ary(VALUE ary, VALUE out, int recur) { VALUE tmp; long i; for (i=0; i<RARRAY_LEN(ary); i++) { tmp = RARRAY_PTR(ary)[i]; if (recur) { tmp = rb_str_new2("[...]"); } rb_funcall(out, id_puts, 1, tmp); } return Qnil; } static VALUE rg_puts(int argc, VALUE *argv, VALUE self) { int i; VALUE line; /* if no argument given, print newline. */ if (argc == 0) { rg_write(self, default_rs); return Qnil; } for (i=0; i<argc; i++) { if (NIL_P(argv[i])) { line = rb_str_new2("nil"); } else { line = rbg_check_array_type(argv[i]); if (!NIL_P(line)) { #ifdef HAVE_RB_EXEC_RECURSIVE rb_exec_recursive(ioc_puts_ary, line, self); #else rb_protect_inspect(ioc_puts_ary, line, self); #endif continue; } line = rb_obj_as_string(argv[i]); } rg_write(self, line); if (RSTRING_LEN(line) == 0 || RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') { rg_write(self, default_rs); } } return Qnil; } static VALUE rg_print(int argc, VALUE *argv, VALUE out) { int i; VALUE line; VALUE output_field_separator; /* if no argument given, print `$_' */ if (argc == 0) { argc = 1; line = rb_lastline_get(); argv = &line; } output_field_separator = rb_gv_get("$,"); for (i=0; i<argc; i++) { if (!NIL_P(output_field_separator) && i>0) { rg_write(out, output_field_separator); } switch (TYPE(argv[i])) { case T_NIL: rg_write(out, rb_str_new2("nil")); break; default: rg_write(out, argv[i]); break; } } if (!NIL_P(output_field_separator)) { rg_write(out, output_field_separator); } return Qnil; } void Init_glib_io_channel(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_IO_CHANNEL, "IOChannel", mGLib); rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); id_call = rb_intern("call"); id_puts = rb_intern("puts"); id_unpack = rb_intern("unpack"); default_rs = rb_str_new_cstr("\n"); #ifdef HAVE_RB_GC_REGISTER_MARK_OBJECT rb_gc_register_mark_object(default_rs); #else rb_global_variable(&default_rs); #endif RG_DEF_METHOD(initialize, -1); RG_DEF_SMETHOD(open, -1); RG_DEF_METHOD(fileno, 0); RG_DEF_ALIAS("to_i", "fileno"); RG_DEF_METHOD(read, -1); RG_DEF_METHOD(readchar, 0); RG_DEF_METHOD(getc, 0); RG_DEF_METHOD(readline, -1); RG_DEF_METHOD(gets, -1); RG_DEF_METHOD(each, -1); RG_DEF_ALIAS("each_line", "each"); RG_DEF_METHOD(each_char, 0); RG_DEF_METHOD(write, 1); RG_DEF_METHOD(printf, -1); RG_DEF_METHOD(print, -1); RG_DEF_METHOD(puts, -1); RG_DEF_METHOD(putc, 1); RG_DEF_METHOD(flush, 0); RG_DEF_METHOD(seek, -1); RG_DEF_METHOD(set_pos, 1); RG_DEF_METHOD(close, -1); RG_DEF_METHOD(create_watch, 1); RG_DEF_METHOD(add_watch, 1); RG_DEF_METHOD(buffer_size, 0); RG_DEF_METHOD(set_buffer_size, 1); RG_DEF_METHOD(buffer_condition, 0); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(set_flags, 1); RG_DEF_METHOD(buffered, 0); RG_DEF_METHOD(set_buffered, 1); RG_DEF_METHOD(encoding, 0); RG_DEF_METHOD(set_encoding, 1); /* GSeekType */ rb_define_const(RG_TARGET_NAMESPACE, "SEEK_CUR", INT2NUM(G_SEEK_CUR)); rb_define_const(RG_TARGET_NAMESPACE, "SEEK_SET", INT2NUM(G_SEEK_SET)); rb_define_const(RG_TARGET_NAMESPACE, "SEEK_END", INT2NUM(G_SEEK_END)); /* GIOStatus */ rb_define_const(RG_TARGET_NAMESPACE, "STATUS_ERROR", INT2NUM(G_IO_STATUS_ERROR)); rb_define_const(RG_TARGET_NAMESPACE, "STATUS_NORMAL", INT2NUM(G_IO_STATUS_NORMAL)); rb_define_const(RG_TARGET_NAMESPACE, "STATUS_EOF", INT2NUM(G_IO_STATUS_EOF)); rb_define_const(RG_TARGET_NAMESPACE, "STATUS_AGAIN", INT2NUM(G_IO_STATUS_AGAIN)); /* GIOCondition */ /* Deprecated. Just for bacakward compatibility. Use * GLib::IOCondition::* instead. */ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_IO_CONDITION, "G_IO_"); /* GIOFlags */ rb_define_const(RG_TARGET_NAMESPACE, "FLAG_APPEND", INT2NUM(G_IO_FLAG_APPEND)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_NONBLOCK", INT2NUM(G_IO_FLAG_NONBLOCK)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_READABLE", INT2NUM(G_IO_FLAG_IS_READABLE)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_WRITEABLE", INT2NUM(G_IO_FLAG_IS_WRITEABLE)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_IS_SEEKABLE", INT2NUM(G_IO_FLAG_IS_SEEKABLE)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_MASK", INT2NUM(G_IO_FLAG_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_GET_MASK", INT2NUM(G_IO_FLAG_GET_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_SET_MASK", INT2NUM(G_IO_FLAG_SET_MASK)); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_typeinstance.c�����������������������������������������0000644�0001750�0001750�00000007157�11701304107�021613� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cInstantiatable VALUE RG_TARGET_NAMESPACE; typedef void (*ClassInfoCallbackFunc) (gpointer instance, const RGObjClassInfo *class_info, gpointer user_data); static G_GNUC_NORETURN VALUE instantiatable_s_allocate(G_GNUC_UNUSED VALUE klass) { rb_raise(rb_eTypeError, "abstract class"); } static VALUE rg_gtype(VALUE self) { return rbgobj_gtype_new(G_TYPE_FROM_INSTANCE(rbgobj_instance_from_ruby_object(self))); } static G_GNUC_NORETURN VALUE rg_clone(VALUE self) { rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(self))); } /**********************************************************************/ static void each_cinfo(gpointer instance, ClassInfoCallbackFunc func, gpointer user_data) { const GType gtype = G_TYPE_FROM_INSTANCE(instance); GType* interfaces; guint n_interfaces = 0; interfaces = g_type_interfaces(gtype, &n_interfaces); { guint i; for (i = 0; i < n_interfaces; i++) { const RGObjClassInfo *info; info = GTYPE2CINFO_NO_CREATE(interfaces[i]); if (info) func(instance, info, user_data); } } g_free(interfaces); { GType type; for (type = gtype; type != G_TYPE_INVALID; type = g_type_parent(type)) { const RGObjClassInfo *info; info = GTYPE2CINFO_NO_CREATE(type); if (info) func(instance, info, user_data); } } } static void call_cinfo_free(gpointer instance, const RGObjClassInfo *cinfo, G_GNUC_UNUSED gpointer user_data) { if (cinfo->free) cinfo->free(instance); } static void call_cinfo_mark(gpointer instance, const RGObjClassInfo *cinfo, G_GNUC_UNUSED gpointer user_data) { if (cinfo->mark) cinfo->mark(instance); } void rbgobj_instance_call_cinfo_mark(gpointer instance) { each_cinfo(instance, call_cinfo_mark, NULL); } void rbgobj_instance_call_cinfo_free(gpointer instance) { each_cinfo(instance, call_cinfo_free, NULL); } void rbgobj_gc_mark_instance(gpointer instance) { VALUE obj = rbgobj_ruby_object_from_instance2(instance, FALSE); rb_gc_mark(obj); } /**********************************************************************/ void Init_gobject_typeinstance(void) { /* should be renamed to GLib::Instance? */ RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "Instantiatable", rb_cObject); rb_extend_object(RG_TARGET_NAMESPACE, mMetaInterface); rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))instantiatable_s_allocate); RG_DEF_METHOD(gtype, 0); RG_DEF_METHOD(clone, 0); }�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_spawnerror.c�������������������������������������������0000644�0001750�0001750�00000005377�11701304107�021305� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Masao Mutoh * Copyright (C) 2004 Kazuhiro NISHIYAMA * * 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE cSpawnError void Init_glib_spawnerror(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_SPAWN_ERROR, "SpawnError", mGLib, rb_eIOError); rb_define_const(RG_TARGET_NAMESPACE, "FORK", INT2NUM(G_SPAWN_ERROR_FORK)); rb_define_const(RG_TARGET_NAMESPACE, "READ", INT2NUM(G_SPAWN_ERROR_READ)); rb_define_const(RG_TARGET_NAMESPACE, "CHDIR", INT2NUM(G_SPAWN_ERROR_CHDIR)); rb_define_const(RG_TARGET_NAMESPACE, "EACCES", INT2NUM(G_SPAWN_ERROR_ACCES)); rb_define_const(RG_TARGET_NAMESPACE, "EPERM", INT2NUM(G_SPAWN_ERROR_PERM)); rb_define_const(RG_TARGET_NAMESPACE, "E2BIG", INT2NUM(G_SPAWN_ERROR_2BIG)); rb_define_const(RG_TARGET_NAMESPACE, "ENOEXEC", INT2NUM(G_SPAWN_ERROR_NOEXEC)); rb_define_const(RG_TARGET_NAMESPACE, "ENAMETOOLONG", INT2NUM(G_SPAWN_ERROR_NAMETOOLONG)); rb_define_const(RG_TARGET_NAMESPACE, "ENOENT", INT2NUM(G_SPAWN_ERROR_NOENT)); rb_define_const(RG_TARGET_NAMESPACE, "ENOMEM", INT2NUM(G_SPAWN_ERROR_NOMEM)); rb_define_const(RG_TARGET_NAMESPACE, "ENOTDIR", INT2NUM(G_SPAWN_ERROR_NOTDIR)); rb_define_const(RG_TARGET_NAMESPACE, "ELOOP", INT2NUM(G_SPAWN_ERROR_LOOP)); rb_define_const(RG_TARGET_NAMESPACE, "ETXTBUSY", INT2NUM(G_SPAWN_ERROR_TXTBUSY)); rb_define_const(RG_TARGET_NAMESPACE, "EIO", INT2NUM(G_SPAWN_ERROR_IO)); rb_define_const(RG_TARGET_NAMESPACE, "ENFILE", INT2NUM(G_SPAWN_ERROR_NFILE)); rb_define_const(RG_TARGET_NAMESPACE, "EMFILE", INT2NUM(G_SPAWN_ERROR_MFILE)); rb_define_const(RG_TARGET_NAMESPACE, "EINVAL", INT2NUM(G_SPAWN_ERROR_INVAL)); rb_define_const(RG_TARGET_NAMESPACE, "EISDIR", INT2NUM(G_SPAWN_ERROR_ISDIR)); rb_define_const(RG_TARGET_NAMESPACE, "ELIBBAD", INT2NUM(G_SPAWN_ERROR_LIBBAD)); rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_SPAWN_ERROR_FAILED)); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobject.c���������������������������������������������������0000644�0001750�0001750�00000025400�12257552167�017532� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002,2003 Masahiro Sakai * 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 "ruby.h" #include "rbgprivate.h" #include <ctype.h> #include "rbgprivate.h" static ID id_relatives; static ID id_delete; static ID id_module_eval; ID rbgobj_id_children; /**********************************************************************/ void rbgobj_initialize_object(VALUE obj, gpointer cobj) { GType type; GType parent_type; if (!cobj) rb_raise(rb_eRuntimeError, "failed to initialize"); type = RVAL2GTYPE(obj); for (parent_type = type; parent_type != G_TYPE_INVALID; parent_type = g_type_parent(parent_type)) { if (rbgobj_convert_initialize(parent_type, obj, cobj)) return; } type = G_TYPE_FUNDAMENTAL(type); switch (type){ case G_TYPE_OBJECT: rbgobj_gobject_initialize(obj, cobj); break; case G_TYPE_PARAM: rbgobj_param_spec_initialize(obj, cobj); break; case G_TYPE_BOXED: rbgobj_boxed_initialize(obj, cobj); break; default: rbgobj_convert_initialize(type, obj, cobj); break; } } gpointer rbgobj_instance_from_ruby_object(VALUE obj) { GType type; GType fundamental_type; if (NIL_P(obj)) return NULL; type = RVAL2GTYPE(obj); if (rbgobj_convert_has_type(type)) { gpointer instance; if (rbgobj_convert_robj2instance(type, obj, &instance)) return instance; } fundamental_type = G_TYPE_FUNDAMENTAL(type); switch (fundamental_type) { case G_TYPE_OBJECT: return rbgobj_get_gobject(obj); case G_TYPE_BOXED: return rbgobj_boxed_get(obj, type); case G_TYPE_PARAM: return rbgobj_get_param_spec(obj); default: { gpointer instance; if (!rbgobj_convert_robj2instance(fundamental_type, obj, &instance)) { rb_raise(rb_eTypeError, "%s isn't supported", rb_class2name(CLASS_OF(obj))); } return instance; } } } VALUE rbgobj_ruby_object_from_instance(gpointer instance) { return rbgobj_ruby_object_from_instance2(instance, TRUE); } VALUE rbgobj_ruby_object_from_instance2(gpointer instance, gboolean alloc) { VALUE object; GType type; if (!instance) return Qnil; type = G_TYPE_FROM_INSTANCE(instance); if (alloc) { GType parent_type; for (parent_type = type; parent_type != G_TYPE_INVALID; parent_type = g_type_parent(parent_type)) { if (rbgobj_convert_instance2robj(parent_type, instance, &object)) return object; } } switch (G_TYPE_FUNDAMENTAL(type)) { case G_TYPE_OBJECT: return rbgobj_get_ruby_object_from_gobject(instance, alloc); case G_TYPE_PARAM: return rbgobj_get_ruby_object_from_param_spec(instance, alloc); default: if (alloc) { rb_raise(rb_eTypeError, "%s isn't supported", g_type_name(type)); } else { return Qnil; } } } void rbgobj_instance_unref(gpointer instance) { GType type; type = G_TYPE_FROM_INSTANCE(instance); if (!rbgobj_convert_unref(type, instance)) { type = G_TYPE_FUNDAMENTAL(type); switch (type) { case G_TYPE_OBJECT: g_object_unref(instance); break; default: rbgobj_convert_unref(type, instance); break; } } } VALUE rbgobj_ruby_object_from_instance_with_unref(gpointer instance) { VALUE result = rbgobj_ruby_object_from_instance(instance); if (!NIL_P(result)) { rbgobj_instance_unref(instance); } return result; } /**********************************************************************/ void rbgobj_add_relative(VALUE obj, VALUE relative) { VALUE hash = Qnil; if (RVAL2CBOOL(rb_ivar_defined(obj, id_relatives))) hash = rb_ivar_get(obj, id_relatives); if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) { hash = rb_hash_new(); rb_ivar_set(obj, id_relatives, hash); } rb_hash_aset(hash, relative, Qnil); } void rbgobj_invalidate_relatives(VALUE obj) { if (RVAL2CBOOL(rb_ivar_defined(obj, id_relatives))) rb_ivar_set(obj, id_relatives, Qnil); if (RVAL2CBOOL(rb_ivar_defined(obj, rbgobj_id_children))) rb_ivar_set(obj, rbgobj_id_children, Qnil); } void rbgobj_add_relative_removable(VALUE obj, VALUE relative, ID obj_ivar_id, VALUE hash_key) { VALUE hash = Qnil; if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id))) hash = rb_ivar_get(obj, obj_ivar_id); if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) { hash = rb_hash_new(); rb_ivar_set(obj, obj_ivar_id, hash); } rb_hash_aset(hash, hash_key, relative); } VALUE rbgobj_get_relative_removable(VALUE obj, ID obj_ivar_id, VALUE hash_key) { VALUE hash = Qnil; if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id))) hash = rb_ivar_get(obj, obj_ivar_id); if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) { return Qnil; } return rb_hash_aref(hash, hash_key); } void rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE hash_key) { VALUE hash = Qnil; if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id))) hash = rb_ivar_get(obj, obj_ivar_id); if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) { /* should not happen. */ } else { rb_funcall(hash, id_delete, 1, hash_key); } } void rbgobj_remove_relative_all(VALUE obj, ID obj_ivar_id) { rb_ivar_set(obj, obj_ivar_id, Qnil); } /**********************************************************************/ static GHashTable* prop_exclude_list; #define IS_FLAG(bitmask, flag) (((bitmask) & (flag)) == (flag)) void rbgobj_define_property_accessors(VALUE klass) { GType gtype; GParamSpec** pspecs = NULL; guint i; GString* source; guint n_properties = 0; gtype = CLASS2GTYPE(klass); if (G_TYPE_IS_INTERFACE(gtype)){ gpointer iface = g_type_default_interface_ref(gtype); pspecs = g_object_interface_list_properties(iface, &n_properties); g_type_default_interface_unref(iface); } else { GObjectClass* oclass = G_OBJECT_CLASS(g_type_class_ref(gtype)); pspecs = g_object_class_list_properties(oclass, &n_properties); g_type_class_unref(oclass); } if (n_properties == 0) return; source = g_string_new(NULL); for (i = 0; i < n_properties; i++){ GParamSpec* pspec = pspecs[i]; char* buf; char* prop_name; char* p; if (pspec->owner_type != gtype) continue; buf = g_strdup(pspec->name); for (p = buf; *p; p++) if (*p == '-') *p = '_'; if (!strncmp(buf, "is_", 3)) prop_name = buf + 3; else prop_name = buf; if (g_hash_table_lookup(prop_exclude_list, prop_name)){ g_free(buf); continue; } if (pspec->flags & G_PARAM_READABLE){ g_string_append_printf( source, "def %s%s; get_property('%s'); end\n", prop_name, (G_PARAM_SPEC_VALUE_TYPE(pspec) == G_TYPE_BOOLEAN) ? "?" : "", pspec->name); } if (IS_FLAG(pspec->flags, G_PARAM_WRITABLE) && !IS_FLAG(pspec->flags, G_PARAM_CONSTRUCT_ONLY)){ g_string_append_printf(source, "def set_%s(val); set_property('%s', val); end\n", prop_name, pspec->name); #ifdef HAVE_NODE_ATTRASGN g_string_append_printf(source, "alias %s= set_%s\n", prop_name, prop_name); #else g_string_append_printf(source, "def %s=(val); set_property('%s', val); val; end\n", prop_name, pspec->name); #endif } g_free(buf); } if (source->len > 0) rb_funcall(klass, id_module_eval, 1, rb_str_new2(source->str)); g_string_free(source, TRUE); } /**********************************************************************/ void Init_gobject(void) { /* Not defined properties. They are already used as methods of Object */ prop_exclude_list = g_hash_table_new(g_str_hash, g_str_equal); g_hash_table_insert(prop_exclude_list, (gpointer)"class", (gpointer)"class"); g_hash_table_insert(prop_exclude_list, (gpointer)"clone", (gpointer)"clone"); g_hash_table_insert(prop_exclude_list, (gpointer)"dup", (gpointer)"dup"); g_hash_table_insert(prop_exclude_list, (gpointer)"extend", (gpointer)"extend"); g_hash_table_insert(prop_exclude_list, (gpointer)"freeze", (gpointer)"freeze"); g_hash_table_insert(prop_exclude_list, (gpointer)"hash", (gpointer)"hash"); g_hash_table_insert(prop_exclude_list, (gpointer)"method", (gpointer)"method"); g_hash_table_insert(prop_exclude_list, (gpointer)"methods", (gpointer)"methods"); g_hash_table_insert(prop_exclude_list, (gpointer)"object_id", (gpointer)"object_id"); g_hash_table_insert(prop_exclude_list, (gpointer)"taint", (gpointer)"taint"); g_hash_table_insert(prop_exclude_list, (gpointer)"untaint", (gpointer)"untaint"); /* IDs */ id_relatives = rb_intern("__relatives__"); id_delete = rb_intern("delete"); id_module_eval = rb_intern("module_eval"); rbgobj_id_children = rb_intern("__stored_children__"); Init_gobject_convert(); Init_gobject_gtype(); Init_gobject_typeinterface(); Init_gobject_typeinstance(); Init_gobject_gvalue(); Init_gobject_gvaluetypes(); Init_gobject_gboxed(); Init_gobject_gstrv(); Init_gobject_value_array(); Init_gobject_genumflags(); Init_gobject_gparam(); Init_gobject_gparamspecs(); Init_gobject_gclosure(); Init_gobject_gobject(); Init_gobject_gsignal(); Init_gobject_gtypeplugin(); Init_gobject_gtypemodule(); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib2conversions.h������������������������������������������0000644�0001750�0001750�00000006413�12446160551�021405� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ #ifndef __GLIB2CONVERSIONS_H__ #define __GLIB2CONVERSIONS_H__ #define RVAL2GPARAMSPEC(o) (G_PARAM_SPEC(RVAL2GOBJ(o))) #define RVAL2GCLOSURE(o) ((GClosure*)RVAL2BOXED(o, G_TYPE_CLOSURE)) #define GCLOSURE2RVAL(o) (BOXED2RVAL(o, G_TYPE_CLOSURE)) #define RVAL2GIOCHANNEL(o) ((GIOChannel*)RVAL2BOXED(o, G_TYPE_IO_CHANNEL)) #define GIOCHANNEL2RVAL(o) (BOXED2RVAL(o, G_TYPE_IO_CHANNEL)) #define RVAL2GKEYFILE(o) ((GKeyFile*)RVAL2BOXED(o, G_TYPE_KEY_FILE)) #define GKEYFILE2RVAL(o) (BOXED2RVAL(o, G_TYPE_KEY_FILE)) #define RVAL2GMAINCONTEXT(o) ((GMainContext*)RVAL2BOXED(o, G_TYPE_MAIN_CONTEXT)) #define GMAINCONTEXT2RVAL(o) (BOXED2RVAL(o, G_TYPE_MAIN_CONTEXT)) #define RVAL2GMAINLOOP(o) ((GMainLoop*)RVAL2BOXED(o, G_TYPE_MAIN_LOOP)) #define GMAINLOOP2RVAL(o) (BOXED2RVAL(o, G_TYPE_MAIN_LOOP)) #define RVAL2GPOLLFD(o) ((GPollFD*)RVAL2BOXED(o, G_TYPE_POLL_FD)) #define GPOLLFD2RVAL(o) (BOXED2RVAL(o, G_TYPE_POLL_FD)) #define RVAL2GSOURCE(o) ((GSource*)RVAL2BOXED(o, G_TYPE_SOURCE)) #define GSOURCE2RVAL(o) (BOXED2RVAL(o, G_TYPE_SOURCE)) #define RVAL2GTIMER(o) ((GTimer*)RVAL2BOXED(o, G_TYPE_TIMER)) #define GTIMER2RVAL(o) (BOXED2RVAL(o, G_TYPE_TIMER)) #define RVAL2GVALUE(o) ((GValue*)RVAL2BOXED(o, G_TYPE_VALUE)) #define GVALUE2RVAL(o) (BOXED2RVAL(o, G_TYPE_VALUE)) #define RVAL2GIOCONDITION(o) (RVAL2GFLAGS(o, G_TYPE_IO_CONDITION)) #define GIOCONDITION2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_IO_CONDITION)) #define RVAL2GNORMALIZEMODE(o) (RVAL2GENUM(o, G_TYPE_NORMALIZE_MODE)) #define GNORMALIZEMODE2RVAL(o) (GENUM2RVAL(o, G_TYPE_NORMALIZE_MODE)) #define RVAL2GCONNECTFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_CONNECT_FLAGS)) #define GCONNECTFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_CONNECT_FLAGS)) #define RVAL2GKEYFILEFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_KEY_FILE_FLAGS)) #define GKEYFILEFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_KEY_FILE_FLAGS)) #define RVAL2GFORMATSIZEFLAGS(o) (RVAL2GFLAGS(o, G_TYPE_FORMAT_SIZE_FLAGS)) #define GFORMATSIZEFLAGS2RVAL(o) (GFLAGS2RVAL(o, G_TYPE_FORMAT_SIZE_FLAGS)) #endif /* __GLIB2CONVERSIONS_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_paramspecs.c�������������������������������������������0000664�0001750�0001750�00000031235�11740310343�021241� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define DEF_NUMERIC_PSPEC_METHODS_FUNC(pspec_type, typename, from_ruby, to_ruby, pspec_cast) \ static VALUE \ typename##_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, \ VALUE minimum, VALUE maximum, VALUE default_value, \ VALUE flags) \ { \ GParamSpec* pspec; \ pspec = g_param_spec_##typename(StringValuePtr(name), \ StringValuePtr(nick), \ StringValuePtr(blurb), \ from_ruby(minimum), \ from_ruby(maximum), \ from_ruby(default_value), \ NUM2UINT(flags)); \ rbgobj_param_spec_initialize(self, pspec); \ return Qnil; \ } \ \ static VALUE \ typename##_minimum(VALUE self) \ { \ return to_ruby(pspec_cast(RVAL2GOBJ(self))->minimum); \ } \ \ static VALUE \ typename##_maximum(VALUE self) \ { \ return to_ruby(pspec_cast(RVAL2GOBJ(self))->maximum); \ } \ \ static VALUE \ typename##_range(VALUE self) \ { \ pspec_type* pspec = pspec_cast(RVAL2GOBJ(self)); \ return rb_range_new(pspec->minimum, pspec->maximum, 0); \ } DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecChar, char, NUM2INT, INT2FIX, G_PARAM_SPEC_CHAR) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecUChar, uchar, NUM2UINT, INT2FIX, G_PARAM_SPEC_UCHAR) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecInt, int, NUM2INT, INT2NUM, G_PARAM_SPEC_INT) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecUInt, uint, NUM2UINT, UINT2NUM, G_PARAM_SPEC_UINT) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecLong, long, NUM2LONG, INT2NUM, G_PARAM_SPEC_LONG) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecULong, ulong, NUM2ULONG, UINT2NUM, G_PARAM_SPEC_ULONG) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecInt64, int64, rbglib_num_to_int64, rbglib_int64_to_num, G_PARAM_SPEC_INT64) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecUInt64, uint64, rbglib_num_to_uint64, rbglib_uint64_to_num, G_PARAM_SPEC_UINT64) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecFloat, float, NUM2DBL, rb_float_new, G_PARAM_SPEC_FLOAT) DEF_NUMERIC_PSPEC_METHODS_FUNC(GParamSpecDouble, double, NUM2DBL, rb_float_new, G_PARAM_SPEC_DOUBLE) static VALUE float_epsilon(VALUE self) { return rb_float_new(G_PARAM_SPEC_FLOAT(RVAL2GOBJ(self))->epsilon); } static VALUE double_epsilon(VALUE self) { return rb_float_new(G_PARAM_SPEC_DOUBLE(RVAL2GOBJ(self))->epsilon); } static VALUE boolean_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE default_value, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_boolean(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), RVAL2CBOOL(default_value), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE unichar_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE default_value, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_unichar(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), NUM2UINT(default_value), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE enum_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE enum_type, VALUE default_value, VALUE flags) { GParamSpec* pspec; GType gtype = rbgobj_gtype_get(enum_type); pspec = g_param_spec_enum(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), gtype, RVAL2GENUM(default_value, gtype), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE flags_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE flags_type, VALUE default_value, VALUE flags) { GParamSpec* pspec; GType gtype = rbgobj_gtype_get(flags_type); pspec = g_param_spec_flags(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), gtype, RVAL2GFLAGS(default_value, gtype), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE string_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE default_value, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_string(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), NIL_P(default_value) ? NULL : StringValuePtr(default_value), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE param_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE param_type, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_param(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), rbgobj_gtype_get(param_type), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE boxed_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE boxed_type, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_boxed(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), rbgobj_gtype_get(boxed_type), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE pointer_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_pointer(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE value_array_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE element_spec, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_value_array(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), RVAL2GOBJ(element_spec), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } static VALUE object_initialize(VALUE self, VALUE name, VALUE nick, VALUE blurb, VALUE object_type, VALUE flags) { GParamSpec* pspec; pspec = g_param_spec_object(StringValuePtr(name), StringValuePtr(nick), StringValuePtr(blurb), rbgobj_gtype_get(object_type), NUM2UINT(flags)); rbgobj_param_spec_initialize(self, pspec); return Qnil; } void Init_gobject_gparamspecs(void) { VALUE cParamSpec = GTYPE2CLASS(G_TYPE_PARAM); VALUE c; #define DEF_NUMERIC_PSPEC_METHODS(c, typename) \ G_STMT_START {\ rbg_define_method(c, "initialize", typename##_initialize, 7); \ rbg_define_method(c, "minimum", typename##_minimum, 0); \ rbg_define_method(c, "maximum", typename##_maximum, 0); \ rbg_define_method(c, "range", typename##_range, 0); \ } G_STMT_END #if 0 rbg_define_method(c, "default_value", typename##_default_value, 0); \ rb_define_alias(c, "default", "default_value"); \ #endif c = G_DEF_CLASS(G_TYPE_PARAM_CHAR, "Char", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, char); c = G_DEF_CLASS(G_TYPE_PARAM_UCHAR, "UChar", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, uchar); c = G_DEF_CLASS(G_TYPE_PARAM_INT, "Int", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, int); c = G_DEF_CLASS(G_TYPE_PARAM_UINT, "UInt", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, uint); c = G_DEF_CLASS(G_TYPE_PARAM_LONG, "Long", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, long); c = G_DEF_CLASS(G_TYPE_PARAM_ULONG, "ULong", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, ulong); c = G_DEF_CLASS(G_TYPE_PARAM_INT64, "Int64", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, int64); c = G_DEF_CLASS(G_TYPE_PARAM_UINT64, "UInt64", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, uint64); c = G_DEF_CLASS(G_TYPE_PARAM_FLOAT, "Float", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, float); rbg_define_method(c, "epsilon", float_epsilon, 0); c = G_DEF_CLASS(G_TYPE_PARAM_DOUBLE, "Double", cParamSpec); DEF_NUMERIC_PSPEC_METHODS(c, double); rbg_define_method(c, "epsilon", double_epsilon, 0); c = G_DEF_CLASS(G_TYPE_PARAM_BOOLEAN, "Boolean", cParamSpec); rbg_define_method(c, "initialize", boolean_initialize, 5); c = G_DEF_CLASS(G_TYPE_PARAM_UNICHAR, "UniChar", cParamSpec); rbg_define_method(c, "initialize", unichar_initialize, 5); c = G_DEF_CLASS(G_TYPE_PARAM_ENUM, "Enum", cParamSpec); rbg_define_method(c, "initialize", enum_initialize, 6); c = G_DEF_CLASS(G_TYPE_PARAM_FLAGS, "Flags", cParamSpec); rbg_define_method(c, "initialize", flags_initialize, 6); c = G_DEF_CLASS(G_TYPE_PARAM_STRING, "String", cParamSpec); rbg_define_method(c, "initialize", string_initialize, 5); c = G_DEF_CLASS(G_TYPE_PARAM_PARAM, "Param", cParamSpec); rbg_define_method(c, "initialize", param_initialize, 5); c = G_DEF_CLASS(G_TYPE_PARAM_BOXED, "Boxed", cParamSpec); rbg_define_method(c, "initialize", boxed_initialize, 5); c = G_DEF_CLASS(G_TYPE_PARAM_POINTER, "Pointer", cParamSpec); rbg_define_method(c, "initialize", pointer_initialize, 4); c = G_DEF_CLASS(G_TYPE_PARAM_VALUE_ARRAY, "ValueArray", cParamSpec); rbg_define_method(c, "initialize", value_array_initialize, 5); c = G_DEF_CLASS(G_TYPE_PARAM_OBJECT, "Object", cParamSpec); rbg_define_method(c, "initialize", object_initialize, 5); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobject.h���������������������������������������������������0000644�0001750�0001750�00000030147�12516434313�017531� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002,2003 Masahiro Sakai * * 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 __RBGOBJECT_H__ #define __RBGOBJECT_H__ #include <glib-object.h> #include "ruby.h" #include "rbglib.h" #include "rbgutil.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* macros */ #define G_INITIALIZE(obj, cobj)\ (rbgobj_initialize_object(obj, (gpointer)cobj)) #define G_DEF_CLASS(gtype, name, module)\ (rbgobj_define_class(gtype, name, module, 0, 0, Qnil)) #define G_DEF_CLASS_WITH_GC_FUNC(gtype, name, module, mark, free) \ (rbgobj_define_class(gtype, name, module, mark, free, Qnil)) #define G_DEF_CLASS2(gtype, name, module, mark, free) \ G_DEF_CLASS_WITH_GC_FUNC(gtype, name, module, mark, free) #define G_DEF_CLASS3(gtype_name, name, module)\ (rbgobj_define_class_dynamic(gtype_name, name, module, 0, 0)) #define G_DEF_CLASS_WITH_PARENT(gtype, name, module, parent) \ (rbgobj_define_class(gtype, name, module, 0, 0, parent)) #define G_DEF_CLASS4(gtype, name, module, parent) \ G_DEF_CLASS_WITH_PARENT(gtype, name, module, parent) #define G_DEF_INTERFACE(gtype, name, module)\ (rbgobj_define_class(gtype, name, module, 0, 0, Qnil)) #define G_DEF_INTERFACE2(gtype, name, module, mark, free)\ (rbgobj_define_class(gtype, name, module, mark, free, Qnil)) #define RG_DEF_CONVERSION(table) (rbgobj_convert_define(table)) #define G_RELATIVE(obj, rel) (rbgobj_add_relative(obj, rel)) /* G_RELATIVE2 is useless now. Try G_CHILD_ADD/REMOVE first. */ #define G_RELATIVE2(obj, rel, id, hash_key)\ (rbgobj_add_relative_removable(obj, rel, id, hash_key)) #define G_GET_RELATIVE(obj, id, hash_key)\ (rbgobj_get_relative_removable(obj, id, hash_key)) #define G_REMOVE_RELATIVE(obj, id, hash_key)\ (rbgobj_remove_relative(obj, id, hash_key)) RUBY_GLIB2_VAR ID rbgobj_id_children; #define G_CHILD_SET(self, id, child) (rb_ivar_set(self, id, child)) #define G_CHILD_UNSET(self, id) (rb_ivar_set(self, id, Qnil)) /* G_CHILD_ADD is same as G_RELATIVE, but the macro name is more obviously to use than G_RELATIVE, and also support "remove" operation with the key which is the object itself. */ #define G_CHILD_ADD(self, child) \ (rbgobj_add_relative_removable(self, Qnil, rbgobj_id_children, child)) #define G_CHILD_REMOVE(self, child) \ (rbgobj_remove_relative(self, rbgobj_id_children, child)) #define G_CHILD_REMOVE_ALL(self) \ (rbgobj_remove_relative_all(self, rbgobj_id_children)) #define G_DEF_SIGNAL_FUNC(klass, sig_name, func)\ (rbgobj_set_signal_func(klass, sig_name, func)) #define CLASS2CINFO(klass) (rbgobj_lookup_class(klass)) #define GTYPE2CINFO(gtype) (rbgobj_lookup_class_by_gtype(gtype, Qnil)) #define GTYPE2CINFO_NO_CREATE(gtype) (rbgobj_lookup_class_by_gtype_full(gtype, Qnil, FALSE)) #define RVAL2CINFO(obj) (rbgobj_lookup_class(CLASS_OF(obj))) #define GTYPE2CLASS(gtype) (rbgobj_gtype_to_ruby_class(gtype)) #define CLASS2GTYPE(klass) (rbgobj_lookup_class(klass)->gtype) #define RVAL2GTYPE(obj) (CLASS2GTYPE(CLASS_OF(obj))) #define RVAL2GOBJ(obj) (rbgobj_instance_from_ruby_object(obj)) #define GOBJ2RVAL(gobj) (rbgobj_ruby_object_from_instance(gobj)) #define GOBJ2RVAL_UNREF(gobj) (rbgobj_ruby_object_from_instance_with_unref(gobj)) #define GOBJ2RVALU(gobj) GOBJ2RVAL_UNREF(gobj) #define GVAL2RVAL(v) (rbgobj_gvalue_to_rvalue(v)) #define GVAL2RVAL_UNSET(v) (rbgobj_gvalue_to_rvalue(v)) #define RVAL2BOXED(obj, gtype) (rbgobj_boxed_get(obj, gtype)) #define BOXED2RVAL(cobj, gtype) (rbgobj_make_boxed(cobj, gtype)) #define RVAL2GENUM(obj, gtype) (rbgobj_get_enum(obj, gtype)) #define RVAL2GFLAGS(obj, gtype) (rbgobj_get_flags(obj, gtype)) #define GENUM2RVAL(n, gtype) (rbgobj_make_enum(n, gtype)) #define GFLAGS2RVAL(n, gtype) (rbgobj_make_flags(n, gtype)) #define RVAL2GPTR(object) (rbgobj_ptr2cptr(object)) #define GPTR2RVAL(ptr, gtype) (rbgobj_ptr_new(gtype, ptr)) #define G_DEF_CONSTANTS(mod, type, strip_prefix) \ rbgobj_add_constants(mod, type, strip_prefix) #define G_RENAME_CONSTANT(orig, alt) \ rbgobj_constant_remap(orig, alt) #define G_RENAME_NICK(orig, alt) \ rbgobj_constant_remap(orig, alt) typedef enum { RBGOBJ_ABSTRACT_BUT_CREATABLE = 1 << 0, /* deprecated */ RBGOBJ_BOXED_NOT_COPY = 1 << 1, RBGOBJ_DEFINED_BY_RUBY = 1 << 2, } RGObjClassFlag; typedef void (*RGMarkFunc)(gpointer object); typedef void (*RGFreeFunc)(gpointer object); typedef struct { VALUE klass; GType gtype; RGMarkFunc mark; RGFreeFunc free; int flags; /* RGObjClassFlag */ } RGObjClassInfo; /* rbgobject.c */ extern void rbgobj_initialize_object(VALUE obj, gpointer cobj); extern gpointer rbgobj_instance_from_ruby_object(VALUE obj); extern VALUE rbgobj_ruby_object_from_instance(gpointer instance); extern VALUE rbgobj_ruby_object_from_instance2(gpointer instance, gboolean alloc); extern VALUE rbgobj_ruby_object_from_instance_with_unref(gpointer instance); extern void rbgobj_instance_unref(gpointer instance); extern void rbgobj_add_relative(VALUE obj, VALUE relative); extern void rbgobj_invalidate_relatives(VALUE obj); extern void rbgobj_add_relative_removable(VALUE obj, VALUE relative, ID obj_ivar_id, VALUE hash_key); extern VALUE rbgobj_get_relative_removable(VALUE obj, ID obj_ivar_id, VALUE hash_key); extern void rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE hash_key); extern void rbgobj_remove_relative_all(VALUE obj, ID obj_ivar_id); extern GObject* rbgobj_gobject_new(GType type, VALUE params_hash); extern VALUE rbgobj_create_object(VALUE klass); /* deprecated */ extern VALUE rbgobj_get_ruby_object_from_gobject(GObject* gobj, gboolean alloc); /* For Ruby/Gstreamer */ extern void rbgobj_gobject_initialize(VALUE obj, gpointer cobj); /* deprecated */ extern void rbgobj_add_abstract_but_create_instance_class(GType gtype); /* rbgobj_typeinstance.c */ extern void rbgobj_gc_mark_instance(gpointer instance); /* rbgobj_type.c */ extern const RGObjClassInfo *rbgobj_lookup_class(VALUE klass); extern const RGObjClassInfo *rbgobj_lookup_class_by_gtype(GType gtype, VALUE parent); extern const RGObjClassInfo *rbgobj_lookup_class_by_gtype_full(GType gtype, VALUE parent, gboolean create_object); extern VALUE rbgobj_gtype_to_ruby_class(GType gtype); extern VALUE rbgobj_define_class(GType gtype, const gchar* name, VALUE module, RGMarkFunc mark, RGFreeFunc free, VALUE parent); extern VALUE rbgobj_define_class_dynamic(const gchar* gtype_name, const gchar* name, VALUE module, RGMarkFunc mark, RGFreeFunc free); extern void rbgobj_register_class(VALUE klass, GType gtype, gboolean klass2gtype, gboolean gtype2klass); extern void rbgobj_register_mark_func(GType gtype, RGMarkFunc mark); extern void rbgobj_register_free_func(GType gtype, RGFreeFunc free); extern VALUE rbgobj_cType; extern VALUE rbgobj_gtype_new(GType gtype); extern GType rbgobj_gtype_get(VALUE obj); /* rbgobj_signal.c */ typedef VALUE (*GValToRValSignalFunc)(guint num,const GValue* values); extern void rbgobj_set_signal_func(VALUE klass, const gchar *sig_name, GValToRValSignalFunc func); extern GValToRValSignalFunc rbgobj_get_signal_func(guint signal_id); extern VALUE rbgobj_signal_wrap(guint sig_id); /* rbgobj_closure.c */ extern GClosure* g_rclosure_new(VALUE callback_proc, VALUE extra_args, GValToRValSignalFunc func); extern void g_rclosure_attach(GClosure *closure, VALUE object); extern void g_rclosure_set_tag(GClosure *closure, const gchar *tag); /* rbgobj_value.c */ extern VALUE rbgobj_gvalue_to_rvalue(const GValue* value); extern VALUE rbgobj_gvalue_to_rvalue_unset(GValue *value); extern void rbgobj_rvalue_to_gvalue(VALUE val, GValue* result); extern void rbgobj_initialize_gvalue(GValue *result, VALUE value); typedef void (*RValueToGValueFunc)(VALUE from, GValue* to); typedef VALUE (*GValueToRValueFunc)(const GValue* from); extern void rbgobj_register_r2g_func(GType gtype, RValueToGValueFunc func); extern void rbgobj_register_g2r_func(GType gtype, GValueToRValueFunc func); extern void rbgobj_gc_mark_gvalue(GValue* value); /* rbgobj_valuetypes.c */ extern VALUE rbgobj_ptr_new(GType type, gpointer ptr); extern gpointer rbgobj_ptr2cptr(VALUE ptr); #define RBGOBJ_TYPE_RUBY_VALUE (rbgobj_ruby_value_get_type()) extern GType rbgobj_ruby_value_get_type(void); extern VALUE g_value_get_ruby_value(const GValue* value); extern void g_value_set_ruby_value(GValue* value, VALUE ruby); /* rbgobj_object.c */ extern void rbgobj_register_property_setter(GType gtype, const char* prop_name, RValueToGValueFunc func); extern void rbgobj_register_property_getter(GType gtype, const char* prop_name, GValueToRValueFunc func); /* rbgobj_boxed.c */ extern VALUE rbgobj_boxed_create(VALUE klass); /* deprecated */ extern gpointer rbgobj_boxed_get(VALUE obj, GType gtype); extern gpointer rbgobj_boxed_get_default(VALUE obj, GType gtype); extern VALUE rbgobj_make_boxed(gpointer data, GType gtype); extern VALUE rbgobj_make_boxed_raw(gpointer p, GType gtype, VALUE klass, gint flags); extern VALUE rbgobj_make_boxed_default(gpointer data, GType gtype); extern void rbgobj_boxed_not_copy_obj(GType gtype); extern void rbgobj_boxed_unown(VALUE boxed); /* rbgobj_enums.c */ extern void rbgobj_constant_remap(const char *original, const char *replacement); extern void rbgobj_add_constants(VALUE mod, GType type, const gchar *strip_prefix); extern VALUE rbgobj_make_enum(gint n, GType gtype); extern gint rbgobj_get_enum(VALUE obj, GType gtype); extern VALUE rbgobj_make_flags(guint n, GType gtype); extern guint rbgobj_get_flags(VALUE obj, GType gtype); extern void rbgobj_define_const(VALUE mod, const char *name, VALUE value); /* rbglib_mainloop.c */ #if !GLIB_CHECK_VERSION(2,30,0) #define G_TYPE_MAIN_LOOP (g_main_loop_get_type()) extern GType g_main_loop_get_type(void); #endif /* rbglib_maincontext.c */ #if !GLIB_CHECK_VERSION(2,30,0) #define G_TYPE_MAIN_CONTEXT (g_main_context_get_type()) #define G_TYPE_SOURCE (g_source_get_type()) extern GType g_main_context_get_type(void); extern GType g_source_get_type(void); #endif #define G_TYPE_POLL_FD (g_poll_fd_get_type()) extern GType g_poll_fd_get_type(void); /* rbglib_keyfile.c */ #if !GLIB_CHECK_VERSION(2,31,2) #define G_TYPE_KEY_FILE (g_key_file_get_type()) extern GType g_key_file_get_type(void); #endif /* rbgobj_convert.c */ typedef struct { GType type; VALUE klass; gpointer user_data; GDestroyNotify notify; VALUE (*get_superclass)(gpointer user_data); void (*type_init_hook)(VALUE klass, gpointer user_data); void (*rvalue2gvalue)(VALUE value, GValue *result, gpointer user_data); VALUE (*gvalue2rvalue)(const GValue *value, gpointer user_data); void (*initialize)(VALUE rb_instance, gpointer insntance, gpointer user_data); gpointer (*robj2instance)(VALUE rb_instance, gpointer user_data); VALUE (*instance2robj)(gpointer instance, gpointer user_data); void (*unref)(gpointer instance, gpointer user_data); } RGConvertTable; extern void rbgobj_convert_define(const RGConvertTable *table); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __RBGOBJECT_H__ */ #include "rbgcompat.h" �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_flags.c������������������������������������������������0000644�0001750�0001750�00000032236�12516434313�020205� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004-2006 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #include <ctype.h> #define RG_TARGET_NAMESPACE rbgobj_cFlags VALUE RG_TARGET_NAMESPACE; static ID id_new; static ID id_module_eval; static ID id_or; /**********************************************************************/ static VALUE resolve_flags_value(VALUE klass, VALUE nick_or_nicks) { int i, len; VALUE flags_value; if (!RVAL2CBOOL(rb_obj_is_kind_of(nick_or_nicks, rb_cArray))) return rg_enum_resolve_value(klass, nick_or_nicks); len = RARRAY_LEN(nick_or_nicks); flags_value = rb_funcall(klass, id_new, 0); for (i = 0; i < len; i++) { VALUE value; value = rg_enum_resolve_value(klass, RARRAY_PTR(nick_or_nicks)[i]); if (NIL_P(value)) return Qnil; flags_value = rb_funcall(flags_value, id_or, 1, value); } return flags_value; } void rg_flags_add_constants(VALUE mod, GType flags_type, const gchar *strip_prefix) { GFlagsClass *gclass; guint i; int prefix_len = strlen(strip_prefix); gclass = G_FLAGS_CLASS(g_type_class_ref(flags_type)); for (i = 0; i < gclass->n_values; i++) { const GFlagsValue* value = &gclass->values[i]; if (strncmp(value->value_name, strip_prefix, prefix_len)) { g_warning("\"%s\" doesn't have prefix \"%s\"", value->value_name, strip_prefix); } else { const char* name = value->value_name + prefix_len; rbgobj_define_const(mod, name, rbgobj_make_flags(value->value, flags_type)); } } g_type_class_unref(gclass); } /**********************************************************************/ typedef struct { GFlagsClass* gclass; guint value; GFlagsValue* info; } flags_holder; static void flags_free(flags_holder* p) { g_type_class_unref(p->gclass); free(p); } static flags_holder* flags_get_holder(VALUE obj) { flags_holder* p; Data_Get_Struct(obj, flags_holder, p); return p; } static VALUE make_flags(guint n, VALUE klass) { return rb_funcall(klass, id_new, 1, UINT2NUM(n)); } VALUE rbgobj_make_flags(guint n, GType gtype) { return make_flags(n, GTYPE2CLASS(gtype)); } guint rbgobj_get_flags(VALUE obj, GType gtype) { VALUE klass; if (!g_type_is_a(gtype, G_TYPE_FLAGS)) rb_raise(rb_eTypeError, "%s is not a %s", g_type_name(gtype), g_type_name(G_TYPE_FLAGS)); /* for compatibility */ if (rb_obj_is_kind_of(obj, rb_cInteger)) obj = rbgobj_make_flags(NUM2UINT(obj), gtype); klass = GTYPE2CLASS(gtype); if (!rb_obj_is_kind_of(obj, klass)) { VALUE flags_value = Qnil; flags_value = resolve_flags_value(klass, obj); if (!NIL_P(flags_value)) obj = flags_value; } if (rb_obj_is_kind_of(obj, klass)) return flags_get_holder(obj)->value; else rb_raise(rb_eTypeError, "not a %s: %s", rb_class2name(klass), RBG_INSPECT(obj)); } /**********************************************************************/ void rbgobj_init_flags_class(VALUE klass) { GFlagsClass* gclass = g_type_class_ref(CLASS2GTYPE(klass)); GString* source = g_string_new(NULL); guint i; for (i = 0; i < gclass->n_values; i++) { GFlagsValue* entry = &(gclass->values[i]); gchar* nick; gchar* p; gchar* replace_nick; replace_nick = rg_obj_constant_lookup(entry->value_nick); if (replace_nick){ nick = g_strdup(replace_nick); } else { nick = g_strdup(entry->value_nick); } for (p = nick; *p; p++) if (*p == '-' || *p == ' ') *p = '_'; else *p = tolower(*p); g_string_append_printf( source, "def %s%s?; self >= self.class.new(%d); end\n", g_ascii_isdigit(nick[0]) ? "_" : "", nick, entry->value); for (p = nick; *p; p++) *p = g_ascii_toupper(*p); #if 0 { ID id = rb_intern(nick); if (rb_is_const_id(id)) { rb_define_const(klass, nick, make_flags(entry->value, klass)); } } #else { rbgobj_define_const(klass, nick, make_flags(entry->value, klass)); } #endif g_free(nick); } rb_funcall(klass, id_module_eval, 1, rb_str_new2(source->str)); g_string_free(source, TRUE); g_type_class_unref(gclass); } static VALUE rg_s_mask(VALUE klass) { GFlagsClass* gclass = g_type_class_ref(CLASS2GTYPE(klass)); VALUE result = UINT2NUM(gclass->mask); g_type_class_unref(gclass); return result; } static VALUE rg_s_values(VALUE klass) { GFlagsClass *gclass; VALUE result; guint i; gclass = g_type_class_ref(CLASS2GTYPE(klass)); result = rb_ary_new(); for (i = 0; i < gclass->n_values; i++) { GFlagsValue *p = &(gclass->values[i]); rb_ary_push(result, make_flags(p->value, klass)); } g_type_class_unref(gclass); return result; } static VALUE flags_s_allocate(VALUE self) { GType gtype = CLASS2GTYPE(self); if (G_TYPE_IS_ABSTRACT(gtype)) { rb_raise(rb_eTypeError, "abstract class"); } else { flags_holder* p; VALUE result = Data_Make_Struct(self, flags_holder, NULL, flags_free, p); p->gclass = g_type_class_ref(gtype); p->value = 0; p->info = NULL; return result; } } static VALUE rg_initialize(int argc, VALUE* argv, VALUE self) { flags_holder* p = flags_get_holder(self); VALUE arg; rb_scan_args(argc, argv, "01", &arg); if (argc == 0) { p->value = 0; } else { if (rb_respond_to(arg, rb_intern("to_str"))) { const char* str = StringValuePtr(arg); p->info = g_flags_get_value_by_name(p->gclass, str); if (!p->info) p->info = g_flags_get_value_by_nick(p->gclass, str); if (!p->info) rb_raise(rb_eArgError, "invalid argument"); p->value = p->info->value; } else { p->value = NUM2UINT(arg); } } if (!p->info) { guint i; for (i = 0; i < p->gclass->n_values; i++){ GFlagsValue* val = &(p->gclass->values[i]); if (val->value == p->value){ p->info = val; break; } } } return Qnil; } static VALUE rg_to_i(VALUE self) { flags_holder* p = flags_get_holder(self); return UINT2NUM(p->value); } static VALUE rg_name(VALUE self) { flags_holder* p = flags_get_holder(self); return p->info ? rb_str_new2(p->info->value_name) : Qnil; } static VALUE rg_nick(VALUE self) { flags_holder* p = flags_get_holder(self); return p->info ? rb_str_new2(p->info->value_nick) : Qnil; } #define FLAGS_COMP_EQUAL 0 #define FLAGS_COMP_GREATER 1 #define FLAGS_COMP_LESS -1 #define FLAGS_COMP_ELSE -2 #define FLAGS_COMP_INCOMPARABLE -3 static gint flags_compare(VALUE self, VALUE rhs) { flags_holder* p = flags_get_holder(self); GType gtype = G_TYPE_FROM_CLASS(p->gclass); VALUE klass = GTYPE2CLASS(gtype); guint rhs_val; if (!rb_obj_is_kind_of(rhs, rb_cInteger)) { rhs = resolve_flags_value(klass, rhs); if (CLASS_OF(rhs) != CLASS_OF(self)) return FLAGS_COMP_INCOMPARABLE; } rhs_val = rbgobj_get_flags(rhs, gtype); if (p->value == rhs_val) return FLAGS_COMP_EQUAL; else if ((p->value & rhs_val) == rhs_val) return FLAGS_COMP_GREATER; else if ((p->value & rhs_val) == p->value) return FLAGS_COMP_LESS; else return FLAGS_COMP_ELSE; } static VALUE rg_operator_flags_compare(VALUE self, VALUE rhs) { gint ret = flags_compare(self, rhs); switch (ret) { case FLAGS_COMP_EQUAL: case FLAGS_COMP_GREATER: case FLAGS_COMP_LESS: return INT2FIX(ret); default: return Qnil; } } static VALUE rg_operator_flags_eqv(VALUE self, VALUE rhs) { gint ret = flags_compare(self, rhs); if (ret == FLAGS_COMP_INCOMPARABLE) return Qnil; return CBOOL2RVAL(ret == FLAGS_COMP_EQUAL); } static VALUE rg_operator_flags_gt_eq(VALUE self, VALUE rhs) { gint ret = flags_compare(self, rhs); if (ret == FLAGS_COMP_INCOMPARABLE) return Qnil; return CBOOL2RVAL(ret == FLAGS_COMP_GREATER || ret == FLAGS_COMP_EQUAL); } static VALUE rg_operator_flags_lt_eq(VALUE self, VALUE rhs) { gint ret = flags_compare(self, rhs); if (ret == FLAGS_COMP_INCOMPARABLE) return Qnil; return CBOOL2RVAL(ret == FLAGS_COMP_LESS || ret == FLAGS_COMP_EQUAL); } static VALUE rg_operator_flags_gt(VALUE self, VALUE rhs) { gint ret = flags_compare(self, rhs); if (ret == FLAGS_COMP_INCOMPARABLE) return Qnil; return CBOOL2RVAL(ret == FLAGS_COMP_GREATER); } static VALUE rg_operator_flags_lt(VALUE self, VALUE rhs) { gint ret = flags_compare(self, rhs); if (ret == FLAGS_COMP_INCOMPARABLE) return Qnil; return CBOOL2RVAL(ret == FLAGS_COMP_LESS); } static VALUE rg_operator_flags_not(VALUE self, G_GNUC_UNUSED VALUE rhs) { flags_holder* p = flags_get_holder(self); return rbgobj_make_flags((~ p->value) & p->gclass->mask, G_TYPE_FROM_CLASS(p->gclass)); } #define LIFT_BINARY_OP(funcname, op) \ static VALUE \ funcname(VALUE self, VALUE rhs) \ { \ flags_holder* p = flags_get_holder(self); \ GType gtype = G_TYPE_FROM_CLASS(p->gclass); \ return rbgobj_make_flags(p->value op rbgobj_get_flags(rhs, gtype), \ gtype); \ } LIFT_BINARY_OP(flags_and, &) LIFT_BINARY_OP(flags_or, |) LIFT_BINARY_OP(flags_xor, ^) static VALUE rg_operator_flags_minus(VALUE self, VALUE rhs) { flags_holder* p = flags_get_holder(self); GType gtype = G_TYPE_FROM_CLASS(p->gclass); return rbgobj_make_flags(p->value & ~rbgobj_get_flags(rhs, gtype), gtype); } static VALUE rg_empty_p(VALUE self) { flags_holder* p = flags_get_holder(self); return CBOOL2RVAL(p->value == 0); } static VALUE rg_hash(VALUE self) { flags_holder* p = flags_get_holder(self); return UINT2NUM(p->value ^ G_TYPE_FROM_CLASS(p->gclass)); } static VALUE rg_coerce(VALUE self, VALUE other) { flags_holder *holder; GType gtype; if (rb_obj_is_kind_of(other, rb_cInteger)) rb_raise(rb_eTypeError, "can't coerce"); holder = flags_get_holder(self); gtype = G_TYPE_FROM_CLASS(holder->gclass); other = rbgobj_make_flags(NUM2UINT(other), gtype); return rb_ary_new3(2, other, self); } static VALUE rg_nonzero_p(VALUE self) { flags_holder* p = flags_get_holder(self); return CBOOL2RVAL(p->value != 0); } /**********************************************************************/ void Init_gobject_gflags(void) { id_module_eval = rb_intern("module_eval"); id_new = rb_intern("new"); id_or = rb_intern("|"); RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_FLAGS, "Flags", mGLib); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0); rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_gtype, 0); RG_DEF_SMETHOD(mask, 0); RG_DEF_SMETHOD(values, 0); rb_define_alloc_func(RG_TARGET_NAMESPACE, flags_s_allocate); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(to_i, 0); RG_DEF_ALIAS("to_int", "to_i"); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(nick, 0); /* rbg_define_method(RG_TARGET_NAMESPACE, "inspect", flags_inspect, 0); */ RG_DEF_METHOD_OPERATOR("<=>", flags_compare, 1); RG_DEF_METHOD_OPERATOR("==", flags_eqv, 1); RG_DEF_METHOD_OPERATOR(">=", flags_gt_eq, 1); RG_DEF_METHOD_OPERATOR("<=", flags_lt_eq, 1); RG_DEF_METHOD_OPERATOR(">", flags_gt, 1); RG_DEF_METHOD_OPERATOR("<", flags_lt, 1); RG_DEF_METHOD_OPERATOR("~", flags_not, 0); rbg_define_method(RG_TARGET_NAMESPACE, "&", flags_and, 1); rbg_define_method(RG_TARGET_NAMESPACE, "|", flags_or, 1); rbg_define_method(RG_TARGET_NAMESPACE, "^", flags_xor, 1); RG_DEF_METHOD_OPERATOR("-", flags_minus, 1); RG_DEF_METHOD_P(empty, 0); RG_DEF_METHOD(hash, 0); RG_DEF_ALIAS("eql?", "=="); /* for compatibility */ RG_DEF_METHOD(coerce, 1); RG_DEF_ALIAS("zero?", "empty?"); RG_DEF_METHOD_P(nonzero, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_enums.c������������������������������������������������0000664�0001750�0001750�00000023266�11740310343�020237� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004-2006 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #include <ctype.h> #define RG_TARGET_NAMESPACE rbgobj_cEnum VALUE RG_TARGET_NAMESPACE; static ID id_new; static ID id_to_s; /**********************************************************************/ static gchar * nick_to_const_name(const gchar *nick) { gchar *const_name; gchar *p; if (!nick) return NULL; const_name = g_strdup(nick); for (p = const_name; *p; p++) { if (*p == '-' || *p == ' ') *p = '_'; else *p = g_ascii_toupper(*p); } return const_name; } VALUE rg_enum_resolve_value(VALUE klass, VALUE nick) { VALUE value = Qnil; gchar *const_nick; ID const_nick_id; if (RVAL2CBOOL(rb_obj_is_kind_of(nick, klass))) return nick; nick = rb_funcall(nick, id_to_s, 0); const_nick = nick_to_const_name(RVAL2CSTR(nick)); const_nick_id = rb_intern(const_nick); if (rb_const_defined(klass, const_nick_id)) { value = rb_const_get(klass, const_nick_id); } g_free(const_nick); return value; } void rg_enum_add_constants(VALUE mod, GType enum_type, const gchar *strip_prefix) { GEnumClass *gclass; guint i; int prefix_len = strlen(strip_prefix); gclass = G_ENUM_CLASS(g_type_class_ref(enum_type)); for (i = 0; i < gclass->n_values; i++) { const GEnumValue* value = &gclass->values[i]; if (strncmp(value->value_name, strip_prefix, prefix_len)) { g_warning("\"%s\" doesn't have prefix \"%s\"", value->value_name, strip_prefix); } else { const char* name = value->value_name + prefix_len; rbgobj_define_const(mod, name, rbgobj_make_enum(value->value, enum_type)); } } g_type_class_unref(gclass); } /**********************************************************************/ typedef struct { GEnumClass* gclass; gint value; GEnumValue* info; } enum_holder; static void enum_free(enum_holder* p) { g_type_class_unref(p->gclass); free(p); } static enum_holder* enum_get_holder(VALUE obj) { enum_holder* p; Data_Get_Struct(obj, enum_holder, p); return p; } static VALUE make_enum(gint n, VALUE klass) { return rb_funcall(klass, id_new, 1, INT2NUM(n)); } VALUE rbgobj_make_enum(gint n, GType gtype) { return make_enum(n, GTYPE2CLASS(gtype)); } gint rbgobj_get_enum(VALUE obj, GType gtype) { VALUE klass; if (!g_type_is_a(gtype, G_TYPE_ENUM)) rb_raise(rb_eTypeError, "%s is not a %s: %s", g_type_name(gtype), g_type_name(G_TYPE_ENUM), RBG_INSPECT(obj)); /* for compatibility */ if (rb_obj_is_kind_of(obj, rb_cInteger)) obj = rbgobj_make_enum(NUM2INT(obj), gtype); klass = GTYPE2CLASS(gtype); if (!rb_obj_is_kind_of(obj, klass)) { VALUE enum_value; enum_value = rg_enum_resolve_value(klass, obj); if (!NIL_P(enum_value)) obj = enum_value; } if (rb_obj_is_kind_of(obj, klass)) return enum_get_holder(obj)->value; else rb_raise(rb_eTypeError, "not a %s: %s", rb_class2name(klass), RBG_INSPECT(obj)); } /**********************************************************************/ void rbgobj_init_enum_class(VALUE klass) { GEnumClass* gclass = g_type_class_ref(CLASS2GTYPE(klass)); guint i; for (i = 0; i < gclass->n_values; i++) { GEnumValue* entry = &(gclass->values[i]); gchar *const_nick_name; const_nick_name = nick_to_const_name(entry->value_nick); #if 0 { ID id = rb_intern(const_nick_name); if (rb_is_const_id(id)) { VALUE value; value = make_enum(entry->value, klass); rb_define_const(klass, const_nick_name, value); } } #else { if (const_nick_name) { VALUE value; value = make_enum(entry->value, klass); rbgobj_define_const(klass, const_nick_name, value); } } #endif g_free(const_nick_name); } g_type_class_unref(gclass); } static VALUE rg_s_range(VALUE self) { GEnumClass* gclass = g_type_class_ref(CLASS2GTYPE(self)); VALUE result = rb_range_new(INT2NUM(gclass->minimum), INT2NUM(gclass->maximum), FALSE); g_type_class_unref(gclass); return result; } struct enum_s_values_body_args { GEnumClass *gclass; VALUE self; }; static VALUE enum_s_values_body(VALUE value) { struct enum_s_values_body_args *args = (struct enum_s_values_body_args *)value; VALUE result = rb_ary_new(); guint i; for (i = 0; i < args->gclass->n_values; i++) rb_ary_push(result, make_enum(args->gclass->values[i].value, args->self)); return result; } static VALUE enum_s_values_ensure(VALUE gclass) { g_type_class_unref((GEnumClass *)gclass); return Qnil; } static VALUE rg_s_values(VALUE self) { struct enum_s_values_body_args args = { g_type_class_ref(CLASS2GTYPE(self)), self }; return rb_ensure(enum_s_values_body, (VALUE)&args, enum_s_values_ensure, (VALUE)args.gclass); } static VALUE enum_s_allocate(VALUE self) { GType gtype = CLASS2GTYPE(self); if (G_TYPE_IS_ABSTRACT(gtype)) { rb_raise(rb_eTypeError, "abstract class"); } else { enum_holder* p; VALUE result = Data_Make_Struct(self, enum_holder, NULL, enum_free, p); p->gclass = g_type_class_ref(gtype); p->info = NULL; return result; } } static VALUE rg_initialize(VALUE self, VALUE arg) { enum_holder* p = enum_get_holder(self); if (rb_respond_to(arg, rb_intern("to_str"))) { const char* str = StringValuePtr(arg); p->info = g_enum_get_value_by_name(p->gclass, str); if (! p->info) p->info = g_enum_get_value_by_nick(p->gclass, str); if (! p->info) rb_raise(rb_eArgError, "invalid argument"); } else { p->value = NUM2INT(arg); p->info = g_enum_get_value(p->gclass, p->value); } return Qnil; } static VALUE rg_to_i(VALUE self) { enum_holder* p = enum_get_holder(self); return INT2NUM(p->value); } static VALUE rg_name(VALUE self) { enum_holder* p = enum_get_holder(self); return p->info ? rb_str_new2(p->info->value_name) : Qnil; } static VALUE rg_nick(VALUE self) { enum_holder* p = enum_get_holder(self); return p->info ? rb_str_new2(p->info->value_nick) : Qnil; } static VALUE rg_inspect(VALUE self) { const char* cname = rb_class2name(CLASS_OF(self)); enum_holder* p = enum_get_holder(self); gchar* str; VALUE result; if (p->info) str = g_strdup_printf("#<%s %s>", cname, p->info->value_nick); else str = g_strdup_printf("#<%s %d>", cname, p->value); result = rb_str_new2(str); g_free(str); return result; } static VALUE rg_operator_enum_eqv(VALUE self, VALUE rhs) { enum_holder* p = enum_get_holder(self); GType gtype = G_TYPE_FROM_CLASS(p->gclass); VALUE klass = GTYPE2CLASS(gtype); if (!rb_obj_is_kind_of(rhs, rb_cInteger)) { rhs = rg_enum_resolve_value(klass, rhs); if (CLASS_OF(rhs) != CLASS_OF(self)) return Qnil; } return CBOOL2RVAL(rbgobj_get_enum(self, gtype) == rbgobj_get_enum(rhs, gtype)); } static VALUE rg_hash(VALUE self) { enum_holder* p = enum_get_holder(self); return UINT2NUM(p->value ^ G_TYPE_FROM_CLASS(p->gclass)); } static VALUE rg_coerce(VALUE self, VALUE other) { enum_holder *holder; GType gtype; if (!rb_obj_is_kind_of(other, rb_cInteger)) rb_raise(rb_eTypeError, "can't coerce"); holder = enum_get_holder(self); gtype = G_TYPE_FROM_CLASS(holder->gclass); other = rbgobj_make_enum(NUM2INT(other), gtype); return rb_ary_new3(2, other, self); } /**********************************************************************/ void Init_gobject_genums(void) { id_new = rb_intern("new"); id_to_s = rb_intern("to_s"); RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_ENUM, "Enum", mGLib); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0); rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_gtype, 0); RG_DEF_SMETHOD(range, 0); RG_DEF_SMETHOD(values, 0); rb_define_alloc_func(RG_TARGET_NAMESPACE, enum_s_allocate); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(to_i, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(nick, 0); RG_DEF_METHOD(inspect, 0); RG_DEF_METHOD_OPERATOR("==", enum_eqv, 1); RG_DEF_METHOD(hash, 0); RG_DEF_ALIAS("eql?", "=="); /* for compatibility */ RG_DEF_METHOD(coerce, 1); RG_DEF_ALIAS("to_int", "to_i"); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutildeprecated.c�������������������������������������������0000644�0001750�0001750�00000013152�11701304107�021241� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" VALUE rbgutil_glist2ary(const GList *const list) { VALUE ary; const GList *i; ary = rb_ary_new(); for (i = list; i != NULL; i = i->next) rb_ary_push(ary, GOBJ2RVAL(i->data)); return ary; } static VALUE rbgutil_glist2ary_and_free_body(VALUE data) { VALUE ary; GList *i; ary = rb_ary_new(); for (i = (GList *)data; i != NULL; i = i->next) rb_ary_push(ary, GOBJ2RVAL(i->data)); return ary; } static VALUE rbgutil_glist2ary_and_free_ensure(VALUE data) { g_list_free((GList *)data); return Qnil; } VALUE rbgutil_glist2ary_and_free(GList *const list) { return rb_ensure(rbgutil_glist2ary_and_free_body, (VALUE)list, rbgutil_glist2ary_and_free_ensure, (VALUE)list); } VALUE rbgutil_glist2ary_boxed(const GList *const list, GType gtype) { VALUE ary; const GList *i; ary = rb_ary_new(); for (i = list; i != NULL; i = i->next) rb_ary_push(ary, BOXED2RVAL(i->data, gtype)); return ary; } struct rbgutil_glist2ary_boxed_and_free_data { GList *const list; GType gtype; }; static VALUE rbgutil_glist2ary_boxed_and_free_body(VALUE data) { struct rbgutil_glist2ary_boxed_and_free_data *real; VALUE ary; GList *i; real = (struct rbgutil_glist2ary_boxed_and_free_data *)data; ary = rb_ary_new(); for (i = real->list; i != NULL; i = i->next) rb_ary_push(ary, BOXED2RVAL(i->data, real->gtype)); return ary; } static VALUE rbgutil_glist2ary_boxed_and_free_ensure(VALUE data) { g_list_free(((struct rbgutil_glist2ary_boxed_and_free_data *)data)->list); return Qnil; } VALUE rbgutil_glist2ary_boxed_and_free(GList *const list, GType gtype) { struct rbgutil_glist2ary_boxed_and_free_data data = { list, gtype }; return rb_ensure(rbgutil_glist2ary_boxed_and_free_body, (VALUE)&data, rbgutil_glist2ary_boxed_and_free_ensure, (VALUE)&data); } VALUE rbgutil_glist2ary_string(const GList *const list) { VALUE ary; const GList *i; ary = rb_ary_new(); for (i = list; i != NULL; i = i->next) rb_ary_push(ary, CSTR2RVAL(i->data)); return ary; } static VALUE rbgutil_glist2ary_string_and_free_body(VALUE data) { VALUE ary; GList *i; ary = rb_ary_new(); for (i = (GList *)data; i != NULL; i = i->next) rb_ary_push(ary, CSTR2RVAL(i->data)); return ary; } static VALUE rbgutil_glist2ary_string_and_free_ensure(VALUE data) { GList *i; for (i = (GList *)data; i != NULL; i = i->next) g_free(i->data); g_list_free((GList *)data); return Qnil; } VALUE rbgutil_glist2ary_string_and_free(GList *const list) { return rb_ensure(rbgutil_glist2ary_string_and_free_body, (VALUE)list, rbgutil_glist2ary_string_and_free_ensure, (VALUE)list); } VALUE rbgutil_gslist2ary(const GSList *const list) { VALUE ary; const GSList *i; ary = rb_ary_new(); for (i = list; i != NULL; i = i->next) rb_ary_push(ary, GOBJ2RVAL(i->data)); return ary; } static VALUE rbgutil_gslist2ary_and_free_body(VALUE data) { VALUE ary; GSList *i; ary = rb_ary_new(); for (i = (GSList *)data; i != NULL; i = i->next) rb_ary_push(ary, GOBJ2RVAL(i->data)); return ary; } static VALUE rbgutil_gslist2ary_and_free_ensure(VALUE data) { g_slist_free((GSList *)data); return Qnil; } VALUE rbgutil_gslist2ary_and_free(GSList *const list) { return rb_ensure(rbgutil_gslist2ary_and_free_body, (VALUE)list, rbgutil_gslist2ary_and_free_ensure, (VALUE)list); } VALUE rbgutil_gslist2ary_boxed(const GSList *const list, GType gtype) { VALUE ary; const GSList *i; ary = rb_ary_new(); for (i = list; i != NULL; i = i->next) rb_ary_push(ary, BOXED2RVAL(i->data, gtype)); return ary; } struct rbgutil_gslist2ary_boxed_and_free_data { GSList *const list; GType gtype; }; static VALUE rbgutil_gslist2ary_boxed_and_free_body(VALUE data) { struct rbgutil_gslist2ary_boxed_and_free_data *real; VALUE ary; GSList *i; real = (struct rbgutil_gslist2ary_boxed_and_free_data *)data; ary = rb_ary_new(); for (i = real->list; i != NULL; i = i->next) rb_ary_push(ary, BOXED2RVAL(i->data, real->gtype)); return ary; } static VALUE rbgutil_gslist2ary_boxed_and_free_ensure(VALUE data) { g_slist_free(((struct rbgutil_gslist2ary_boxed_and_free_data *)data)->list); return Qnil; } VALUE rbgutil_gslist2ary_boxed_and_free(GSList *const list, GType gtype) { struct rbgutil_gslist2ary_boxed_and_free_data data = { list, gtype }; return rb_ensure(rbgutil_gslist2ary_boxed_and_free_body, (VALUE)&data, rbgutil_gslist2ary_boxed_and_free_ensure, (VALUE)&data); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_iochannelerror.c���������������������������������������0000644�0001750�0001750�00000004064�11701304107�022105� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cIOChannelError static VALUE rg_s_from_errno(G_GNUC_UNUSED VALUE self, VALUE errno_) { return INT2NUM(g_io_channel_error_from_errno(NUM2INT(errno_))); } void Init_glib_io_channelerror(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_IO_CHANNEL_ERROR, "IOChannelError", mGLib, rb_eIOError); /* GIOChannelError */ RG_DEF_SMETHOD(from_errno, 1); rb_define_const(RG_TARGET_NAMESPACE, "FBIG", INT2NUM(G_IO_CHANNEL_ERROR_FBIG)); rb_define_const(RG_TARGET_NAMESPACE, "INVAL", INT2NUM(G_IO_CHANNEL_ERROR_INVAL)); rb_define_const(RG_TARGET_NAMESPACE, "IO", INT2NUM(G_IO_CHANNEL_ERROR_IO)); rb_define_const(RG_TARGET_NAMESPACE, "ISDIR", INT2NUM(G_IO_CHANNEL_ERROR_ISDIR)); rb_define_const(RG_TARGET_NAMESPACE, "NOSPC", INT2NUM(G_IO_CHANNEL_ERROR_NOSPC)); rb_define_const(RG_TARGET_NAMESPACE, "NXIO", INT2NUM(G_IO_CHANNEL_ERROR_NXIO)); rb_define_const(RG_TARGET_NAMESPACE, "OVERFLOW", INT2NUM(G_IO_CHANNEL_ERROR_OVERFLOW)); rb_define_const(RG_TARGET_NAMESPACE, "PIPE", INT2NUM(G_IO_CHANNEL_ERROR_PIPE)); rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(G_IO_CHANNEL_ERROR_FAILED)); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_messages.c���������������������������������������������0000664�0001750�0001750�00000011647�11740310343�020713� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #ifndef HAVE_RB_SOURCEFILE #define rb_sourcefile() (ruby_sourcefile) #endif #ifndef HAVE_RB_SOURCELINE #define rb_sourceline() (ruby_sourceline) #endif #define RG_TARGET_NAMESPACE mLog static VALUE rbglib_log_handler_procs; static gboolean log_canceled; static const gchar * logmessage(GLogLevelFlags level) { if (level & G_LOG_LEVEL_ERROR){ return "ERROR"; } else if (level & G_LOG_LEVEL_CRITICAL){ return "CRITICAL"; } else if (level & G_LOG_LEVEL_WARNING){ return "WARNING"; } else if (level & G_LOG_LEVEL_MESSAGE){ return "MESSAGE"; } else if (level & G_LOG_LEVEL_INFO){ return "INFO"; } else if (level & G_LOG_LEVEL_DEBUG){ return "DEBUG"; } return "UNKNOWN"; } static void rbglib_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { if (! log_canceled){ #ifdef HAVE_RUBY_SET_CURRENT_SOURCE ruby_set_current_source(); #endif g_printerr("%s: line %d\n", rb_sourcefile(), rb_sourceline()); g_printerr(" %s-%s **:%s\n", log_domain, logmessage(log_level), message); } else { g_log_default_handler(log_domain, log_level, message, user_data); } } /* Use Internal only */ static VALUE rg_s_cancel_handler(G_GNUC_UNUSED VALUE self) { log_canceled = TRUE; return Qnil; } static VALUE rg_s_set_handler(VALUE self, VALUE domain, VALUE levels) { guint handler_id = g_log_set_handler(RVAL2CSTR_ACCEPT_NIL(domain), NUM2INT(levels), (GLogFunc)rbglib_log_handler, (gpointer)self); return UINT2NUM(handler_id); } static VALUE rg_s_remove_handler(VALUE self, VALUE domain, VALUE handler_id) { g_log_remove_handler(RVAL2CSTR_ACCEPT_NIL(domain), NUM2UINT(handler_id)); G_REMOVE_RELATIVE(self, handler_id, rbglib_log_handler_procs); return Qnil; } static VALUE rg_s_set_always_fatal(G_GNUC_UNUSED VALUE self, VALUE fatal_mask) { return INT2NUM(g_log_set_always_fatal(NUM2INT(fatal_mask))); } static VALUE rg_s_set_fatal_mask(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE fatal_mask) { return INT2NUM(g_log_set_fatal_mask(RVAL2CSTR_ACCEPT_NIL(domain), NUM2INT(fatal_mask))); } static VALUE rg_s_log(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE level, VALUE str) { g_log(RVAL2CSTR_ACCEPT_NIL(domain), NUM2INT(level), "%s", RVAL2CSTR(str)); return Qnil; } void Init_glib_messages(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Log"); log_canceled = FALSE; rb_global_variable(&rbglib_log_handler_procs); rbglib_log_handler_procs = rb_hash_new(); RG_DEF_SMETHOD(set_handler, 2); RG_DEF_SMETHOD(remove_handler, 2); RG_DEF_SMETHOD(cancel_handler, 0); RG_DEF_SMETHOD(set_always_fatal, 1); RG_DEF_SMETHOD(set_fatal_mask, 2); RG_DEF_SMETHOD(log, 3); rb_define_const(RG_TARGET_NAMESPACE, "FATAL_MASK", INT2NUM(G_LOG_FATAL_MASK)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_USER_SHIFT", INT2NUM(G_LOG_LEVEL_USER_SHIFT)); /* GLogLevelFlags */ rb_define_const(RG_TARGET_NAMESPACE, "FLAG_RECURSION", INT2NUM(G_LOG_FLAG_RECURSION)); rb_define_const(RG_TARGET_NAMESPACE, "FLAG_FATAL", INT2NUM(G_LOG_FLAG_FATAL)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_ERROR", INT2NUM(G_LOG_LEVEL_ERROR)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_CRITICAL", INT2NUM(G_LOG_LEVEL_CRITICAL)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_WARNING", INT2NUM(G_LOG_LEVEL_WARNING)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_MESSAGE", INT2NUM(G_LOG_LEVEL_MESSAGE)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_INFO", INT2NUM(G_LOG_LEVEL_INFO)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_DEBUG", INT2NUM(G_LOG_LEVEL_DEBUG)); rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_MASK", INT2NUM(G_LOG_LEVEL_MASK)); } �����������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_utils.c������������������������������������������������0000644�0001750�0001750�00000021561�12446160551�020246� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Ruby-GNOME2 Project Team * Copyright (C) 2004 Pascal Terjan * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE mGLib static VALUE rg_s_application_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_application_name()); } static VALUE rg_s_set_application_name(VALUE self, VALUE application_name) { g_set_prgname(RVAL2CSTR_ACCEPT_NIL(application_name)); return self; } static VALUE rg_s_prgname(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_prgname()); } static VALUE rg_s_set_prgname(VALUE self, VALUE prgname) { g_set_prgname(RVAL2CSTR_ACCEPT_NIL(prgname)); return self; } static VALUE rg_s_getenv(G_GNUC_UNUSED VALUE self, VALUE variable) { return CSTR2RVAL(g_getenv(RVAL2CSTR(variable))); } static VALUE rg_s_setenv(G_GNUC_UNUSED VALUE self, VALUE variable, VALUE value, VALUE overwrite) { return CBOOL2RVAL(g_setenv(RVAL2CSTR(variable), RVAL2CSTR_ACCEPT_NIL(value), RVAL2CBOOL(overwrite))); } static VALUE rg_s_unsetenv(VALUE self, VALUE variable) { g_unsetenv(RVAL2CSTR(variable)); return self; } #ifdef HAVE_G_LISTENV static VALUE rg_s_listenv(G_GNUC_UNUSED VALUE self) { gchar** c_list; gchar** c_var; VALUE r_list = rb_ary_new(); c_list = g_listenv(); c_var = c_list; while(*c_var) { rb_ary_push(r_list, CSTR2RVAL(*(c_var++))); } g_strfreev(c_list); return r_list; } #endif static VALUE rg_s_host_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_host_name()); } static VALUE rg_s_user_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_user_name()); } static VALUE rg_s_real_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_real_name()); } static VALUE rg_s_user_cache_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_user_cache_dir()); } static VALUE rg_s_user_data_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_user_data_dir()); } static VALUE rg_s_user_config_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_user_config_dir()); } static VALUE rg_s_system_data_dirs(G_GNUC_UNUSED VALUE self) { return STRV2RVAL((const gchar **)g_get_system_data_dirs()); } static VALUE rg_s_system_config_dirs(G_GNUC_UNUSED VALUE self) { return STRV2RVAL((const gchar **)g_get_system_config_dirs()); } #if GLIB_CHECK_VERSION(2, 14, 0) static VALUE rg_s_get_user_special_dir(G_GNUC_UNUSED VALUE self, VALUE directory) { return CSTR2RVAL(g_get_user_special_dir(RVAL2GENUM(directory, G_TYPE_USER_DIRECTORY))); } #endif static VALUE rg_s_home_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_home_dir()); } static VALUE rg_s_tmp_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(g_get_tmp_dir()); } static VALUE rg_s_current_dir(G_GNUC_UNUSED VALUE self) { gchar* dir = g_get_current_dir(); VALUE ret = CSTR2RVAL(dir); g_free(dir); return ret; } static VALUE rg_s_path_is_absolute_p(G_GNUC_UNUSED VALUE self, VALUE fname) { return CBOOL2RVAL(g_path_is_absolute(RVAL2CSTR(fname))); } static VALUE rg_s_path_skip_root(G_GNUC_UNUSED VALUE self, VALUE fname) { return CSTR2RVAL(g_path_skip_root(RVAL2CSTR(fname))); } static VALUE rg_s_path_get_basename(G_GNUC_UNUSED VALUE self, VALUE fname) { return CSTR2RVAL(g_path_get_basename(RVAL2CSTR(fname))); } static VALUE rg_s_path_get_dirname(G_GNUC_UNUSED VALUE self, VALUE fname) { return CSTR2RVAL(g_path_get_dirname(RVAL2CSTR(fname))); } /* Use File.join() gchar* g_build_filename (const gchar *first_element, ...); gchar* g_build_filenamev (gchar **args); gchar* g_build_path (const gchar *separator, const gchar *first_element, ...); gchar* g_build_pathv (const gchar *separator, gchar **args); */ static VALUE rg_s_find_program_in_path(G_GNUC_UNUSED VALUE self, VALUE program) { gchar* path = g_find_program_in_path(RVAL2CSTR(program)); VALUE ret = CSTR2RVAL(path); g_free(path); return ret; } static VALUE rg_s_bit_nth_lsf(G_GNUC_UNUSED VALUE self, VALUE mask, VALUE nth_bit) { return INT2NUM(g_bit_nth_lsf(NUM2ULONG(mask), NUM2INT(nth_bit))); } static VALUE rg_s_bit_nth_msf(G_GNUC_UNUSED VALUE self, VALUE mask, VALUE nth_bit) { return INT2NUM(g_bit_nth_msf(NUM2ULONG(mask), NUM2INT(nth_bit))); } static VALUE rg_s_bit_storage(G_GNUC_UNUSED VALUE self, VALUE number) { return UINT2NUM(g_bit_storage(NUM2ULONG(number))); } static VALUE rg_s_spaced_primes_closest(G_GNUC_UNUSED VALUE self, VALUE num) { return UINT2NUM(g_spaced_primes_closest(NUM2UINT(num))); } /* Use at_exit of ruby instead. void g_atexit (GVoidFunc func); */ static VALUE rg_s_parse_debug_string(G_GNUC_UNUSED VALUE self, VALUE string, VALUE keys) { gint i, nkeys; VALUE ary; GDebugKey* gkeys; Check_Type(keys, RUBY_T_HASH); ary = rb_funcall(keys, rb_intern("to_a"), 0); nkeys = RARRAY_LEN(ary); gkeys = ALLOCA_N(GDebugKey, nkeys); for (i = 0; i < nkeys; i++) { gkeys[i].key = RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]); gkeys[i].value = NUM2UINT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); } return UINT2NUM(g_parse_debug_string(RVAL2CSTR(string), gkeys, nkeys)); } /* void (*GVoidFunc) (void); void (*GFreeFunc) (gpointer data); Don't need them. void g_qsort_with_data (gconstpointer pbase, gint total_elems, gsize size, GCompareDataFunc compare_func, gpointer user_data); void g_nullify_pointer (gpointer *nullify_location); */ static VALUE rg_s_check_version_p(G_GNUC_UNUSED VALUE self, VALUE major, VALUE minor, VALUE micro) { return CBOOL2RVAL(glib_major_version > NUM2UINT(major) || (glib_major_version == NUM2UINT(major) && glib_minor_version > NUM2UINT(minor)) || (glib_major_version == NUM2UINT(major) && glib_minor_version == NUM2UINT(minor) && glib_micro_version >= NUM2UINT(micro))); } void Init_glib_utils(void) { /* glib/gutils.h */ #if GLIB_CHECK_VERSION(2, 14, 0) G_DEF_CLASS(G_TYPE_USER_DIRECTORY, "UserDirectory", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_USER_DIRECTORY, "G_"); #endif #if GLIB_CHECK_VERSION(2, 30, 0) G_DEF_CLASS(G_TYPE_FORMAT_SIZE_FLAGS, "FormatSizeFlags", RG_TARGET_NAMESPACE); #endif RG_DEF_SMETHOD(application_name, 0); RG_DEF_SMETHOD(set_application_name, 1); RG_DEF_SMETHOD(prgname, 0); RG_DEF_SMETHOD(set_prgname, 1); RG_DEF_SMETHOD(getenv, 1); RG_DEF_SMETHOD(setenv, 2); RG_DEF_SMETHOD(unsetenv, 1); #ifdef HAVE_G_LISTENV RG_DEF_SMETHOD(listenv, 0); #endif RG_DEF_SMETHOD(host_name, 0); RG_DEF_SMETHOD(user_name, 0); RG_DEF_SMETHOD(real_name, 0); RG_DEF_SMETHOD(user_cache_dir, 0); RG_DEF_SMETHOD(user_data_dir, 0); RG_DEF_SMETHOD(user_config_dir, 0); RG_DEF_SMETHOD(system_data_dirs, 0); RG_DEF_SMETHOD(system_config_dirs, 0); #if GLIB_CHECK_VERSION(2, 14, 0) RG_DEF_SMETHOD(get_user_special_dir, 1); #endif RG_DEF_SMETHOD(home_dir, 0); RG_DEF_SMETHOD(tmp_dir, 0); RG_DEF_SMETHOD(current_dir, 0); RG_DEF_SMETHOD_P(path_is_absolute, 1); RG_DEF_SMETHOD(path_skip_root, 1); RG_DEF_SMETHOD(path_get_basename, 1); RG_DEF_SMETHOD(path_get_dirname, 1); RG_DEF_SMETHOD(find_program_in_path, 1); RG_DEF_SMETHOD(bit_nth_lsf, 2); RG_DEF_SMETHOD(bit_nth_msf, 2); RG_DEF_SMETHOD(bit_storage, 1); RG_DEF_SMETHOD(spaced_primes_closest, 1); RG_DEF_SMETHOD(parse_debug_string, 2); RG_DEF_SMETHOD_P(check_version, 3); } �����������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_typeinterface.c����������������������������������������0000644�0001750�0001750�00000011267�12257552167�021766� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE mMetaInterface VALUE rbgobj_mInterface; VALUE RG_TARGET_NAMESPACE; static VALUE rg_append_features(G_GNUC_UNUSED VALUE self, VALUE klass) { if (!rb_obj_is_kind_of(klass, cInstantiatable)) rb_raise(rb_eTypeError, "Not a subclass of GLib::Instantiatable"); return rb_call_super(1, &klass); } static VALUE rg_install_property(VALUE self, VALUE pspec_obj) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(self); gpointer ginterface; GParamSpec* pspec; if (cinfo->klass != self) rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self)); pspec = G_PARAM_SPEC(RVAL2GOBJ(pspec_obj)); ginterface = g_type_default_interface_ref(cinfo->gtype); g_object_interface_install_property(ginterface, pspec); g_type_default_interface_unref(ginterface); /* FIXME: define accessor methods */ return Qnil; } static VALUE rg_property(VALUE self, VALUE property_name) { gpointer ginterface; const char* name; GParamSpec* prop; VALUE result; GType gtype = CLASS2GTYPE(self); if (SYMBOL_P(property_name)) name = rb_id2name(SYM2ID(property_name)); else name = StringValuePtr(property_name); if (!G_TYPE_IS_INTERFACE(gtype)) rb_raise(rb_eTypeError, "%s isn't interface module", rb_class2name(self)); /* XXX: g_type_default_interface_ref(G_TYPE_INTERFACE) causes SEGV. */ if (gtype == G_TYPE_INTERFACE) { rb_raise(rb_const_get(mGLib, rb_intern("NoPropertyError")), "No such property: %s", name); } ginterface = g_type_default_interface_ref(gtype); prop = g_object_interface_find_property(ginterface, name); if (!prop){ g_type_default_interface_unref(ginterface); rb_raise(rb_const_get(mGLib, rb_intern("NoPropertyError")), "No such property: %s", name); } result = GOBJ2RVAL(prop); g_type_default_interface_unref(ginterface); return result; } static VALUE rg_properties(int argc, VALUE* argv, VALUE self) { guint n_properties; GParamSpec** props; VALUE inherited_too; VALUE ary = rb_ary_new(); guint i; gpointer ginterface; GType gtype = CLASS2GTYPE(self); if (rb_scan_args(argc, argv, "01", &inherited_too) == 0) inherited_too = Qtrue; if (!G_TYPE_IS_INTERFACE(gtype)) rb_raise(rb_eTypeError, "%s isn't interface module", rb_class2name(self)); /* XXX: g_type_default_interface_ref(G_TYPE_INTERFACE) causes SEGV. */ if (gtype == G_TYPE_INTERFACE) return ary; ginterface = g_type_default_interface_ref(gtype); props = g_object_interface_list_properties(ginterface, &n_properties); for (i = 0; i < n_properties; i++){ if (RVAL2CBOOL(inherited_too) || GTYPE2CLASS(props[i]->owner_type) == self) rb_ary_push(ary, rb_str_new2(props[i]->name)); } g_free(props); g_type_default_interface_unref(ginterface); return ary; } void rbgobj_init_interface(VALUE interf) { static VALUE rb_mGLibInterface = Qnil; rb_extend_object(interf, RG_TARGET_NAMESPACE); if (CLASS2GTYPE(interf) == G_TYPE_INTERFACE) { rb_mGLibInterface = interf; } else { rb_extend_object(interf, rb_mGLibInterface); rb_include_module(interf, rb_mGLibInterface); rbgobj_define_property_accessors(interf); } } void Init_gobject_typeinterface(void) { RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "MetaInterface"); rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0); RG_DEF_METHOD(append_features, 1); RG_DEF_METHOD(install_property, 1); RG_DEF_METHOD(property, 1); RG_DEF_METHOD(properties, -1); rbgobj_mInterface = G_DEF_INTERFACE(G_TYPE_INTERFACE, "Interface", mGLib); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutil.h�����������������������������������������������������0000644�0001750�0001750�00000012327�12416346617�017250� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 */ #ifndef __RBGUTIL_H__ #define __RBGUTIL_H__ #include <glib-object.h> #include "ruby.h" #ifdef HAVE_RUBY_ENCODING_H # include <ruby/encoding.h> #endif #include "rbglib.h" #include "rbgutil_list.h" #include "rbgutildeprecated.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define RG_DEF_MODFUNC(method, argc) \ rb_define_module_function(RG_TARGET_NAMESPACE, #method, rg_m_ ## method, argc) #define RG_DEF_MODFUNC_P(method, argc) \ rb_define_module_function(RG_TARGET_NAMESPACE, #method"?", rg_m_ ## method ## _p, argc) #define RG_DEF_MODFUNC_OPERATOR(ope, func, argc) \ rb_define_module_function(RG_TARGET_NAMESPACE, ope, rg_m_operator_ ## func, argc) #define RG_DEF_SMETHOD(method, argc) \ rbg_define_singleton_method(RG_TARGET_NAMESPACE, #method, rg_s_ ## method, argc) #define RG_DEF_SMETHOD_P(method, argc) \ rb_define_singleton_method(RG_TARGET_NAMESPACE, #method"?", rg_s_ ## method ## _p, argc) #define RG_DEF_SMETHOD_BANG(method, argc) \ rb_define_singleton_method(RG_TARGET_NAMESPACE, #method"!", rg_s_ ## method ## _bang, argc) #define RG_DEF_SMETHOD_OPERATOR(ope, func, argc) \ rb_define_singleton_method(RG_TARGET_NAMESPACE, ope, rg_s_operator_ ## func, argc) #define RG_DEF_METHOD(method, argc) \ rbg_define_method(RG_TARGET_NAMESPACE, #method, rg_ ## method, argc) #define RG_DEF_METHOD_P(method, argc) \ rb_define_method(RG_TARGET_NAMESPACE, #method"?", rg_ ## method ## _p, argc) #define RG_DEF_METHOD_BANG(method, argc) \ rb_define_method(RG_TARGET_NAMESPACE, #method"!", rg_ ## method ## _bang, argc) #define RG_DEF_METHOD_OPERATOR(ope, func, argc) \ rb_define_method(RG_TARGET_NAMESPACE, ope, rg_operator_ ## func, argc) #define RG_DEF_ATTR(attr, read, write, ex) \ rb_attr(RG_TARGET_NAMESPACE, rb_intern(attr), read, write, ex) #define RG_DEF_ALIAS(new, old) rb_define_alias(RG_TARGET_NAMESPACE, new, old) #define RG_REG_GLIBID_SETTER(name) \ rbgobj_register_property_setter(CLASS2GTYPE(RG_TARGET_NAMESPACE), name, rbgutil_glibid_r2g_func) #define RG_REG_SYMBOL_GETTER(name) \ rbgobj_register_property_getter(CLASS2GTYPE(RG_TARGET_NAMESPACE), name, rbgutil_sym_g2r_func) #define RG_REPLACE_SET_PROPERTY(name, args) \ G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, #name, rg_set_ ## name, args) #define RG_REPLACE_GET_PROPERTY(name, args) \ G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, #name, rg_get_ ## name, args) #define RG_REPLACE_ACTION(name, args) \ G_REPLACE_ACTION(RG_TARGET_NAMESPACE, #name, rg_ ## name, args) #define G_REPLACE_SET_PROPERTY(klass, name, function, args) \ rb_undef_method(klass, "set_" name); \ rb_undef_method(klass, name "="); \ rbg_define_method(klass, "set_" name, function, args) #define G_REPLACE_GET_PROPERTY(klass, name, function, args) \ rb_undef_method(klass, name); \ rb_define_method(klass, name, function, args) #define G_REPLACE_ACTION(klass, name, function, args) \ rb_undef_method(klass, name); \ rb_define_method(klass, name, function, args) #define G_SET_PROPERTIES(self, hash) (rbgutil_set_properties(self, hash)) #define G_PROTECT_CALLBACK(func, data) (rbgutil_invoke_callback((VALUE(*)(VALUE))func, (VALUE)data)) #define RBG_STRING_SET_UTF8_ENCODING(string) \ (rbgutil_string_set_utf8_encoding(string)) extern void rbg_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc); extern void rbg_define_singleton_method(VALUE obj, const char *name, VALUE (*func)(ANYARGS), int argc); extern VALUE rbgutil_def_setters(VALUE klass); extern void rbgutil_set_properties(VALUE self, VALUE hash); extern VALUE rbgutil_protect(VALUE (*proc) (VALUE), VALUE data); extern VALUE rbgutil_invoke_callback(VALUE (*func)(VALUE), VALUE arg); extern void rbgutil_start_callback_dispatch_thread(void); extern void rbgutil_stop_callback_dispatch_thread(void); extern VALUE rbgutil_string_set_utf8_encoding(VALUE string); extern gboolean rbgutil_key_equal(VALUE rb_string, const char *key); extern const gchar *rbg_inspect(VALUE object); extern GSource *rbg_interrupt_source_new(void); /*< protected >*/ RUBY_GLIB2_VAR ID rbgutil_id_module_eval; extern void rbgutil_glibid_r2g_func(VALUE from, GValue* to); extern VALUE rbgutil_sym_g2r_func(const GValue *from); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __RBGUTIL_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_maincontext.c������������������������������������������0000644�0001750�0001750�00000035620�12423063747�021444� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 "rbgprivate.h" GStaticPrivate rg_polling_key = G_STATIC_PRIVATE_INIT; /* static ID id_poll_func; */ static ID id_call; static VALUE mGLibSource; static ID id__callbacks__; static GHashTable *callbacks_table; typedef struct _callback_info_t { VALUE callback; guint id; } callback_info_t; /*****************************************/ static GPollFunc default_poll_func; typedef struct _PollInfo { GPollFD *ufds; guint nfsd; gint timeout; gint result; } PollInfo; static VALUE rg_poll_in_blocking(void *data) { PollInfo *info = data; info->result = default_poll_func(info->ufds, info->nfsd, info->timeout); return Qnil; } static gint rg_poll(GPollFD *ufds, guint nfsd, gint timeout) { PollInfo info; info.ufds = ufds; info.nfsd = nfsd; info.timeout = timeout; info.result = 0; g_static_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE), NULL); #ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL rb_thread_call_without_gvl(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL); #else rb_thread_blocking_region(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL); #endif g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL); return info.result; } static VALUE ruby_source_set_priority (G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE priority) { return Qnil; } static void restore_poll_func(G_GNUC_UNUSED VALUE data) { if (g_main_context_get_poll_func(NULL) == (GPollFunc)rg_poll) { g_main_context_set_poll_func(NULL, default_poll_func); } } static VALUE source_remove(G_GNUC_UNUSED VALUE self, VALUE tag) { VALUE callback; callback = G_GET_RELATIVE(mGLibSource, id__callbacks__, tag); G_REMOVE_RELATIVE(mGLibSource, id__callbacks__, tag); g_hash_table_remove(callbacks_table, (gpointer)callback); return CBOOL2RVAL(g_source_remove(NUM2UINT(tag))); } static VALUE source_current_source(G_GNUC_UNUSED VALUE self) { return BOXED2RVAL(g_main_current_source, G_TYPE_SOURCE); } static gboolean invoke_source_func(gpointer data) { callback_info_t *info = (callback_info_t *)data; gboolean ret; ret = RVAL2CBOOL(rb_funcall(info->callback, id_call, 0)); if (!ret) G_REMOVE_RELATIVE(mGLibSource, id__callbacks__, UINT2NUM(info->id)); return ret; } /*****************************************/ #if !GLIB_CHECK_VERSION(2,30,0) GType g_main_context_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GMainContext", (GBoxedCopyFunc)g_main_context_ref, (GBoxedFreeFunc)g_main_context_unref); return our_type; } #endif /*****************************************/ #define RG_TARGET_NAMESPACE cMainContext #define _SELF(s) ((GMainContext*)RVAL2BOXED(s, G_TYPE_MAIN_CONTEXT)) static VALUE rg_initialize(VALUE self) { GMainContext *context; context = g_main_context_new(); g_main_context_set_poll_func(context, rg_poll); G_INITIALIZE(self, context); return Qnil; } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return BOXED2RVAL(g_main_context_default(), G_TYPE_MAIN_CONTEXT); } static VALUE rg_iteration(VALUE self, VALUE may_block) { return CBOOL2RVAL(g_main_context_iteration(_SELF(self), RVAL2CBOOL(may_block))); } static VALUE rg_pending_p(VALUE self) { return CBOOL2RVAL(g_main_context_pending(_SELF(self))); } static VALUE rg_find_source(VALUE self, VALUE source_id) { GSource* src = g_main_context_find_source_by_id(_SELF(self), NUM2UINT(source_id)); return BOXED2RVAL(src, G_TYPE_SOURCE); } /* GSource* g_main_context_find_source_by_user_data (GMainContext *context, gpointer user_data); GSource* g_main_context_find_source_by_funcs_user_data (GMainContext *context, GSourceFuncs *funcs, gpointer user_data); */ static VALUE rg_wakeup(VALUE self) { g_main_context_wakeup(_SELF(self)); return self; } static VALUE rg_acquire(VALUE self) { return CBOOL2RVAL(g_main_context_acquire(_SELF(self))); } static VALUE rg_release(VALUE self) { g_main_context_release(_SELF(self)); return self; } static VALUE rg_owner_p(VALUE self) { return CBOOL2RVAL(g_main_context_is_owner(_SELF(self))); } /* gboolean g_main_context_wait (GMainContext *context, GCond *cond, GMutex *mutex); */ static VALUE rg_prepare(VALUE self) { gint priority; gboolean ret = g_main_context_prepare(_SELF(self), &priority); return rb_assoc_new(CBOOL2RVAL(ret), INT2NUM(priority)); } struct mc_query_body_args { gint timeout_; GPollFD *fds; gint n_fds; }; static VALUE mc_query_body(VALUE value) { struct mc_query_body_args *args = (struct mc_query_body_args *)value; gint i; VALUE ary = rb_ary_new(); for (i = 0; i < args->n_fds; i++) rb_ary_push(ary, BOXED2RVAL(&args->fds[i], G_TYPE_POLL_FD)); return rb_assoc_new(INT2NUM(args->timeout_), ary); } static VALUE mc_query_ensure(VALUE value) { g_free((GPollFD *)value); return Qnil; } #define QUERY_DEFAULT_FDS 100 static VALUE rg_query(VALUE self, VALUE rbmax_priority) { GMainContext *context = _SELF(self); gint max_priority = NUM2INT(rbmax_priority); gint timeout_; GPollFD *fds; gint n_fds; struct mc_query_body_args args; fds = g_new(GPollFD, QUERY_DEFAULT_FDS); n_fds = g_main_context_query(context, max_priority, &timeout_, fds, QUERY_DEFAULT_FDS); if (n_fds > QUERY_DEFAULT_FDS) { g_free(fds); fds = g_new(GPollFD, n_fds); g_main_context_query(context, max_priority, &timeout_, fds, n_fds); } args.timeout_ = timeout_; args.fds = fds; args.n_fds = n_fds; return rb_ensure(mc_query_body, (VALUE)&args, mc_query_ensure, (VALUE)fds); } /* How can I implement this? static VALUE rg_check(VALUE self, VALUE max_priority) { gint i, timeout_; VALUE ary; GPollFD* fds; gint ret, n_fds; fds = g_new (GPollFD, 10); n_fds = g_main_context_query(_SELF(self), NUM2INT(max_priority), &timeout_, fds, 10); printf("n_fds = %d\n", n_fds); g_free(fds); fds = g_new (GPollFD, n_fds); ret = g_main_context_check(_SELF(self), NUM2INT(max_priority), fds, n_fds); printf("ret = %d\n", ret); ary = rb_ary_new(); for (i = 0; i < ret; i++) rb_ary_push(ary, BOXED2RVAL(&fds[i], G_TYPE_POLL_FD)); g_free(fds); return ary; } */ static VALUE rg_dispatch(VALUE self) { g_main_context_dispatch(_SELF(self)); return self; } /* How can I get "self" or something like it as key .... static gint poll_func(GPollFD *ufds, guint nfsd, gint timeout_) { VALUE func = rb_ivar_get(self, id_poll_func); if (NIL_P(func)) return -1; return INT2NUM(rb_funcall(func, 3, BOXED2RVAL(ufds, G_TYPE_POLL_FD), UINT2NUM(nfsd), INT2NUM(timeout_))); } static VALUE rg_set_poll_func(VALUE self) { rb_ivar_set(self, id_poll_func, rb_block_proc()); g_main_context_set_poll_func(_SELF(self), (GPollFunc)poll_func); return self; } */ /* GPollFunc g_main_context_get_poll_func (GMainContext *context); */ static VALUE rg_add_poll(VALUE self, VALUE fd, VALUE priority) { g_main_context_add_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD), NUM2INT(priority)); return self; } static VALUE rg_remove_poll(VALUE self, VALUE fd) { g_main_context_remove_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD)); return self; } #ifdef HAVE_G_MAIN_DEPTH static VALUE rg_s_depth(G_GNUC_UNUSED VALUE self) { return INT2NUM(g_main_depth()); } #endif static VALUE timeout_source_new(G_GNUC_UNUSED VALUE self, VALUE interval) { return BOXED2RVAL(g_timeout_source_new(NUM2UINT(interval)), G_TYPE_SOURCE); } #if GLIB_CHECK_VERSION(2,14,0) static VALUE timeout_source_new_seconds(G_GNUC_UNUSED VALUE self, VALUE interval) { return BOXED2RVAL(g_timeout_source_new_seconds(NUM2UINT(interval)), G_TYPE_SOURCE); } #endif static VALUE timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE interval, rb_priority, func, rb_id; gint priority; callback_info_t *info; guint id; rb_scan_args(argc, argv, "11&", &interval, &rb_priority, &func); priority = NIL_P(rb_priority) ? G_PRIORITY_DEFAULT : NUM2INT(rb_priority); info = ALLOC(callback_info_t); info->callback = func; id = g_timeout_add_full(priority, NUM2UINT(interval), (GSourceFunc)invoke_source_func, (gpointer)info, g_free); info->id = id; rb_id = UINT2NUM(id); G_RELATIVE2(mGLibSource, func, id__callbacks__, rb_id); g_hash_table_insert(callbacks_table, (gpointer)func, info); return rb_id; } #if GLIB_CHECK_VERSION(2,14,0) static VALUE timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE interval, rb_priority, func, rb_id; gint priority; callback_info_t *info; guint id; rb_scan_args(argc, argv, "11&", &interval, &rb_priority, &func); priority = NIL_P(rb_priority) ? G_PRIORITY_DEFAULT : NUM2INT(rb_priority); info = ALLOC(callback_info_t); info->callback = func; id = g_timeout_add_seconds_full(priority, NUM2UINT(interval), (GSourceFunc)invoke_source_func, (gpointer)info, g_free); info->id = id; rb_id = UINT2NUM(id); G_RELATIVE2(mGLibSource, func, id__callbacks__, rb_id); g_hash_table_insert(callbacks_table, (gpointer)func, info); return rb_id; } #endif static VALUE idle_source_new(G_GNUC_UNUSED VALUE self) { return BOXED2RVAL(g_idle_source_new(), G_TYPE_SOURCE); } static VALUE idle_add(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE arg1, arg2, func, rb_id; callback_info_t *info; guint id; gint priority = G_PRIORITY_DEFAULT_IDLE; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (RVAL2CBOOL(rb_obj_is_kind_of(arg1, rb_cProc))) { func = arg1; } else if (RVAL2CBOOL(rb_obj_is_kind_of(arg1, rb_cInteger))) { priority = NUM2INT(arg1); func = rb_block_proc(); } else { func = rb_block_proc(); } info = ALLOC(callback_info_t); info->callback = func; id = g_idle_add_full(priority, (GSourceFunc)invoke_source_func, (gpointer)info, g_free); info->id = id; rb_id = UINT2NUM(id); G_RELATIVE2(mGLibSource, func, id__callbacks__, rb_id); g_hash_table_insert(callbacks_table, (gpointer)func, info); return rb_id; } static VALUE idle_remove(G_GNUC_UNUSED VALUE self, VALUE func) { callback_info_t *info; info = g_hash_table_lookup(callbacks_table, (gpointer)func); G_REMOVE_RELATIVE(mGLibSource, id__callbacks__, UINT2NUM(info->id)); g_hash_table_remove(callbacks_table, (gpointer)func); return CBOOL2RVAL(g_idle_remove_by_data((gpointer)info)); } static VALUE child_watch_source_new(G_GNUC_UNUSED VALUE self, VALUE pid) { return BOXED2RVAL(g_child_watch_source_new((GPid)NUM2INT(pid)), G_TYPE_SOURCE); } static void child_watch_func(GPid pid, gint status, gpointer func) { rb_funcall((VALUE)func, id_call, 2, INT2NUM((long)pid), INT2NUM(status)); } static VALUE child_watch_add(VALUE self, VALUE pid) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); return UINT2NUM(g_child_watch_add((GPid)NUM2INT(pid), (GChildWatchFunc)child_watch_func, (gpointer)func)); } void Init_glib_main_context(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_CONTEXT, "MainContext", mGLib); VALUE timeout = rb_define_module_under(mGLib, "Timeout"); VALUE idle = rb_define_module_under(mGLib, "Idle"); VALUE child_watch = rb_define_module_under(mGLib, "ChildWatch"); id_call = rb_intern("call"); id__callbacks__ = rb_intern("__callbacks__"); callbacks_table = g_hash_table_new(NULL, NULL); rbg_define_singleton_method(mGLib, "set_ruby_thread_priority", ruby_source_set_priority, 1); mGLibSource = rb_const_get(mGLib, rb_intern("Source")); rbg_define_singleton_method(mGLibSource, "remove", source_remove, 1); rbg_define_singleton_method(mGLibSource, "current", source_current_source, 0); /* id_poll_func = rb_intern("__poll_func__"); */ RG_DEF_METHOD(initialize, 0); RG_DEF_SMETHOD(default, 0); RG_DEF_METHOD(iteration, 1); RG_DEF_METHOD_P(pending, 0); RG_DEF_METHOD(find_source, 1); RG_DEF_METHOD(wakeup, 0); RG_DEF_METHOD(acquire, 0); RG_DEF_METHOD(release, 0); RG_DEF_METHOD_P(owner, 0); RG_DEF_METHOD(prepare, 0); RG_DEF_METHOD(query, 1); /* RG_DEF_METHOD(check, 1); */ RG_DEF_METHOD(dispatch, 0); /* RG_DEF_METHOD(set_poll_func, 0); */ RG_DEF_METHOD(add_poll, 2); RG_DEF_METHOD(remove_poll, 1); #ifdef HAVE_G_MAIN_DEPTH RG_DEF_SMETHOD(depth, 0); #endif rbg_define_singleton_method(timeout, "source_new", timeout_source_new, 1); #if GLIB_CHECK_VERSION(2,14,0) rbg_define_singleton_method(timeout, "source_new_seconds", timeout_source_new_seconds, 1); #endif rbg_define_singleton_method(timeout, "add", timeout_add, -1); #if GLIB_CHECK_VERSION(2,14,0) rbg_define_singleton_method(timeout, "add_seconds", timeout_add_seconds, -1); #endif rbg_define_singleton_method(idle, "source_new", idle_source_new, 0); rbg_define_singleton_method(idle, "add", idle_add, -1); rbg_define_singleton_method(idle, "remove", idle_remove, 1); rbg_define_singleton_method(child_watch, "source_new", child_watch_source_new, 1); rbg_define_singleton_method(child_watch, "add", child_watch_add, 1); default_poll_func = g_main_context_get_poll_func(NULL); g_main_context_set_poll_func(NULL, rg_poll); rb_set_end_proc(restore_poll_func, Qnil); } ����������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_convert.c����������������������������������������������0000664�0001750�0001750�00000012520�11740310343�020553� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2009 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 KUBO Takehiro * * 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mGLib static VALUE rg_s_convert(G_GNUC_UNUSED VALUE self, VALUE str, VALUE to, VALUE from) { GError *err = NULL; gchar* ret; gsize written; VALUE s = Qnil; StringValue(str); ret = g_convert(RSTRING_PTR(str), RSTRING_LEN(str), StringValuePtr(to), StringValuePtr(from), NULL, &written, &err); if (err != NULL) RAISE_GERROR(err); s = rb_str_new(ret, written); g_free(ret); return s; } static VALUE rg_s_locale_to_utf8(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; VALUE s = Qnil; gchar* ret; gsize written; StringValue(str); ret = g_locale_to_utf8(RSTRING_PTR(str), RSTRING_LEN(str), NULL, &written, &err); if (err != NULL) RAISE_GERROR(err); s = rb_str_new(ret, written); g_free(ret); return s; } static VALUE rg_s_locale_from_utf8(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; VALUE s = Qnil; gchar* ret; gsize written; StringValue(str); ret = g_locale_from_utf8(RSTRING_PTR(str), RSTRING_LEN(str), NULL, &written, &err); if (err != NULL) RAISE_GERROR(err); s = rb_str_new(ret, written); g_free(ret); return s; } static VALUE rg_s_filename_to_utf8(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; VALUE s = Qnil; gchar* ret; gsize written; StringValue(str); ret = g_filename_to_utf8(RSTRING_PTR(str), RSTRING_LEN(str), NULL, &written, &err); if (err != NULL) RAISE_GERROR(err); s = rb_str_new(ret, written); g_free(ret); return s; } static VALUE rg_s_filename_from_utf8(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; VALUE s = Qnil; gchar* ret; gsize written; StringValue(str); ret = g_filename_from_utf8(RSTRING_PTR(str), RSTRING_LEN(str), NULL, &written, &err); if (err != NULL) RAISE_GERROR(err); s = rb_str_new(ret, written); g_free(ret); return s; } static VALUE rg_s_filename_to_uri(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE filename, hostname, s; GError *err = NULL; gchar* ret; rb_scan_args(argc, argv, "11", &filename, &hostname); ret = g_filename_to_uri(StringValuePtr(filename), NIL_P(hostname) ? NULL : StringValuePtr(hostname), &err); if (err) RAISE_GERROR(err); s = rb_str_new2(ret); g_free(ret); return s; } static VALUE rg_s_filename_from_uri(G_GNUC_UNUSED VALUE self, VALUE str) { GError *err = NULL; VALUE s; gchar* filename; char* hostname; filename = g_filename_from_uri(StringValuePtr(str), &hostname, &err); if (err) RAISE_GERROR(err); s = rb_ary_new3(2, rb_str_new2(filename), hostname ? rb_str_new2(hostname) : Qnil); g_free(filename); g_free(hostname); return s; } static VALUE rg_s_utf8_validate(G_GNUC_UNUSED VALUE self, VALUE str) { rb_warning("GLib.utf8_validate is deprecated. Use GLib::UTF8.validate instead."); StringValue(str); return CBOOL2RVAL(g_utf8_validate(RSTRING_PTR(str), RSTRING_LEN(str), NULL)); } void Init_glib_convert(void) { VALUE cCharError = G_DEF_ERROR2(G_CONVERT_ERROR, "ConvertError", RG_TARGET_NAMESPACE, rb_eIOError); rb_define_const(cCharError, "NO_CONVERSION", INT2NUM(G_CONVERT_ERROR_NO_CONVERSION)); rb_define_const(cCharError, "ILLEGAL_SEQUENCE", INT2NUM(G_CONVERT_ERROR_ILLEGAL_SEQUENCE)); rb_define_const(cCharError, "FAILED", INT2NUM(G_CONVERT_ERROR_FAILED)); rb_define_const(cCharError, "PARTIAL_INPUT", INT2NUM(G_CONVERT_ERROR_PARTIAL_INPUT)); rb_define_const(cCharError, "BAD_URI", INT2NUM(G_CONVERT_ERROR_BAD_URI)); rb_define_const(cCharError, "NOT_ABSOLUTE_PATH", INT2NUM(G_CONVERT_ERROR_NOT_ABSOLUTE_PATH)); /* glib/gunicode.h */ /* just for backward compatibility. Use GLib::UTF8.validate instead. */ RG_DEF_SMETHOD(utf8_validate, 1); /* glib/gconvert.h */ RG_DEF_SMETHOD(convert, 3); RG_DEF_SMETHOD(locale_to_utf8, 1); RG_DEF_SMETHOD(locale_from_utf8, 1); RG_DEF_SMETHOD(filename_to_utf8, 1); RG_DEF_SMETHOD(filename_from_utf8, 1); RG_DEF_SMETHOD(filename_to_uri, -1); RG_DEF_SMETHOD(filename_from_uri, 1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutil_list.c������������������������������������������������0000644�0001750�0001750�00000011530�12516434313�020261� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" struct list2rval_args { gpointer list; RBGRValueFunc conv; GFreeFunc free_list; GFreeFunc free_elem; }; struct list2rval_with_type_args { struct list2rval_args args; RBGRValueFuncWithType conv_with_type; GType gtype; }; static VALUE glist2rval_body(VALUE data) { struct list2rval_args *args = (struct list2rval_args *)data; RBGRValueFunc conv = args->conv; GList *node; VALUE ary; ary = rb_ary_new(); if (conv) for (node = args->list; node; node = g_list_next(node)) rb_ary_push(ary, conv(node->data)); return ary; } static VALUE gslist2rval_body(VALUE data) { struct list2rval_args *args = (struct list2rval_args *)data; RBGRValueFunc conv = args->conv; GSList *node; VALUE ary; ary = rb_ary_new(); if (conv) for (node = args->list; node; node = g_slist_next(node)) rb_ary_push(ary, conv(node->data)); return ary; } static VALUE glist2rval_with_type_body(VALUE data) { struct list2rval_with_type_args *args_with_type = (struct list2rval_with_type_args *)data; struct list2rval_args *args = (struct list2rval_args *)data; RBGRValueFuncWithType conv = args_with_type->conv_with_type; GType gtype = args_with_type->gtype; GList *node; VALUE ary; ary = rb_ary_new(); if (conv) for (node = args->list; node; node = g_list_next(node)) rb_ary_push(ary, conv(node->data, gtype)); return ary; } static VALUE gslist2rval_with_type_body(VALUE data) { struct list2rval_with_type_args *args_with_type = (struct list2rval_with_type_args *)data; struct list2rval_args *args = (struct list2rval_args *)data; RBGRValueFuncWithType conv = args_with_type->conv_with_type; GType gtype = args_with_type->gtype; GSList *node; VALUE ary; ary = rb_ary_new(); if (conv) for (node = args->list; node; node = g_slist_next(node)) rb_ary_push(ary, conv(node->data, gtype)); return ary; } static VALUE glist2rval_ensure(VALUE data) { struct list2rval_args *args = (struct list2rval_args *)data; GList *node; if (args->free_elem) for (node = args->list; node; node = g_list_next(node)) args->free_elem(node->data); if (args->free_list) args->free_list(args->list); return Qnil; } static VALUE gslist2rval_ensure(VALUE data) { struct list2rval_args *args = (struct list2rval_args *)data; GSList *node; if (args->free_elem) for (node = args->list; node; node = g_slist_next(node)) args->free_elem(node->data); if (args->free_list) args->free_list(args->list); return Qnil; } VALUE rbg_glist2rval(GList *const list, RBGRValueFunc conv, GFreeFunc free_list, GFreeFunc free_elem) { struct list2rval_args args = {list, conv, free_list, free_elem}; return rb_ensure(glist2rval_body, (VALUE)&args, glist2rval_ensure, (VALUE)&args); } VALUE rbg_gslist2rval(GSList *const list, RBGRValueFunc conv, GFreeFunc free_list, GFreeFunc free_elem) { struct list2rval_args args = {list, conv, free_list, free_elem}; return rb_ensure(gslist2rval_body, (VALUE)&args, gslist2rval_ensure, (VALUE)&args); } VALUE rbg_glist2rval_with_type(GList *const list, RBGRValueFuncWithType conv, GType gtype, GFreeFunc free_list, GFreeFunc free_elem) { struct list2rval_with_type_args args = {{list, NULL, free_list, free_elem}, conv, gtype}; return rb_ensure(glist2rval_with_type_body, (VALUE)&args, glist2rval_ensure, (VALUE)&args); } VALUE rbg_gslist2rval_with_type(GSList *const list, RBGRValueFuncWithType conv, GType gtype, GFreeFunc free_list, GFreeFunc free_elem) { struct list2rval_with_type_args args = {{list, NULL, free_list, free_elem}, conv, gtype}; return rb_ensure(gslist2rval_with_type_body, (VALUE)&args, gslist2rval_ensure, (VALUE)&args); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_enumflags.c��������������������������������������������0000644�0001750�0001750�00000005532�11701304107�021061� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004-2006 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #include <ctype.h> typedef struct { char *original; char *replacement; } constant_map; static GSList *rbgobj_cmap = NULL; static gint rbgobj_constant_find(constant_map *a, char *name) { return strcmp(a->original, name); } void rbgobj_constant_remap(const char *original, const char *replacement) { constant_map *map = g_new(constant_map,1); map->original = g_strdup(original); map->replacement = g_strdup(replacement); rbgobj_cmap = g_slist_append(rbgobj_cmap, map); } char * rg_obj_constant_lookup(const char *name) { GSList *p = rbgobj_cmap; p = g_slist_find_custom(rbgobj_cmap, name, (GCompareFunc)rbgobj_constant_find); if (p) { char *replacement; constant_map *map; map = (constant_map *)p->data; rbgobj_cmap = g_slist_delete_link(rbgobj_cmap, p); replacement = map->replacement; g_free(map->original); g_free(map); return replacement; } return NULL; } void rbgobj_define_const(VALUE mod, const char *name, VALUE value) { if (name[0] >= 'A' && name[0] <= 'Z') { rb_define_const(mod, name, value); } else { char *new_name = rg_obj_constant_lookup(name); if (new_name) { rb_define_const(mod, new_name, value); g_free(new_name); } else { rb_warn("Invalid constant name '%s' - skipped", name); } } } void rbgobj_add_constants(VALUE mod, GType type, const gchar *strip_prefix) { if (G_TYPE_IS_ENUM(type)) { rg_enum_add_constants(mod, type, strip_prefix); } else if (G_TYPE_IS_FLAGS(type)) { rg_flags_add_constants(mod, type, strip_prefix); } else { g_warning("`%s' is not an enum/flags type", g_type_name(type)); } } void Init_gobject_genumflags(void) { Init_gobject_genums(); Init_gobject_gflags(); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_utf8.c�������������������������������������������������0000644�0001750�0001750�00000014672�12257552167�020011� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #define RG_TARGET_NAMESPACE mUTF8 static VALUE rg_s_get_char(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE utf8, validate; gunichar result; rb_scan_args(argc, argv, "11", &utf8, &validate); if (RVAL2CBOOL(validate)) { StringValue(utf8); result = g_utf8_get_char_validated(RSTRING_PTR(utf8), RSTRING_LEN(utf8)); if (result == (gunichar)-1) { return INT2NUM(-1); } else if (result == (gunichar)-2) { return INT2NUM(-2); } } else { result = g_utf8_get_char(StringValueCStr(utf8)); } return UINT2NUM(result); } static VALUE rg_s_size(G_GNUC_UNUSED VALUE self, VALUE rb_utf8) { gchar *utf8; utf8 = StringValueCStr(rb_utf8); return INT2NUM(g_utf8_strlen(utf8, RSTRING_LEN(rb_utf8))); } static VALUE rg_s_reverse(G_GNUC_UNUSED VALUE self, VALUE rb_utf8) { VALUE result; gchar *utf8, *reversed_utf8; utf8 = StringValueCStr(rb_utf8); reversed_utf8 = g_utf8_strreverse(utf8, RSTRING_LEN(rb_utf8)); result = CSTR2RVAL(reversed_utf8); g_free(reversed_utf8); return result; } static VALUE rg_s_validate(G_GNUC_UNUSED VALUE self, VALUE str) { StringValue(str); return CBOOL2RVAL(g_utf8_validate(RSTRING_PTR(str), RSTRING_LEN(str), NULL)); } static VALUE rg_s_upcase(G_GNUC_UNUSED VALUE self, VALUE rb_utf8) { VALUE result; gchar *utf8, *upcased_utf8; utf8 = StringValueCStr(rb_utf8); upcased_utf8 = g_utf8_strup(utf8, RSTRING_LEN(rb_utf8)); result = CSTR2RVAL(upcased_utf8); g_free(upcased_utf8); return result; } static VALUE rg_s_downcase(G_GNUC_UNUSED VALUE self, VALUE rb_utf8) { VALUE result; gchar *utf8, *downcased_utf8; utf8 = StringValueCStr(rb_utf8); downcased_utf8 = g_utf8_strdown(utf8, RSTRING_LEN(rb_utf8)); result = CSTR2RVAL(downcased_utf8); g_free(downcased_utf8); return result; } static VALUE rg_s_casefold(G_GNUC_UNUSED VALUE self, VALUE rb_utf8) { VALUE result; gchar *utf8, *casefolded_utf8; utf8 = StringValueCStr(rb_utf8); casefolded_utf8 = g_utf8_casefold(utf8, RSTRING_LEN(rb_utf8)); result = CSTR2RVAL(casefolded_utf8); g_free(casefolded_utf8); return result; } static VALUE rg_s_normalize(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE rb_utf8, rb_mode, result; gchar *utf8, *normalized_utf8; GNormalizeMode mode = G_NORMALIZE_DEFAULT; rb_scan_args(argc, argv, "11", &rb_utf8, &rb_mode); if (!NIL_P(rb_mode)) mode = RVAL2GENUM(rb_mode, G_TYPE_NORMALIZE_MODE); utf8 = StringValueCStr(rb_utf8); normalized_utf8 = g_utf8_normalize(utf8, RSTRING_LEN(rb_utf8), mode); result = CSTR2RVAL(normalized_utf8); g_free(normalized_utf8); return result; } static VALUE rg_s_collate(G_GNUC_UNUSED VALUE self, VALUE utf8a, VALUE utf8b) { return INT2NUM(g_utf8_collate(StringValueCStr(utf8a), StringValueCStr(utf8b))); } static VALUE rg_s_collate_key(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE result, rb_utf8, for_filename; gchar *key, *utf8; gssize len; rb_scan_args(argc, argv, "11", &rb_utf8, &for_filename); utf8 = StringValueCStr(rb_utf8); len = RSTRING_LEN(rb_utf8); if (RVAL2CBOOL(for_filename)) key = g_utf8_collate_key_for_filename(utf8, len); else key = g_utf8_collate_key(utf8, len); result = CSTR2RVAL(key); g_free(key); return result; } static VALUE rg_s_to_utf16(G_GNUC_UNUSED VALUE self, VALUE rb_utf8) { VALUE result; gchar *utf8; gunichar2 *utf16; glong len, items_written; GError *error = NULL; utf8 = StringValueCStr(rb_utf8); len = RSTRING_LEN(rb_utf8); utf16 = g_utf8_to_utf16(utf8, len, NULL, &items_written, &error); if (error) RAISE_GERROR(error); result = CSTR2RVAL_LEN_UTF16((char *)utf16, items_written * sizeof(*utf16)); g_free(utf16); return result; } static VALUE rg_s_to_ucs4(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE result, rb_utf8, is_fast; gchar *utf8; gunichar *ucs4; glong len, items_written; rb_scan_args(argc, argv, "11", &rb_utf8, &is_fast); utf8 = StringValueCStr(rb_utf8); len = RSTRING_LEN(rb_utf8); if (RVAL2CBOOL(is_fast)) { ucs4 = g_utf8_to_ucs4_fast(utf8, len, &items_written); } else { GError *error = NULL; ucs4 = g_utf8_to_ucs4(utf8, len, NULL, &items_written, &error); if (error) RAISE_GERROR(error); } result = CSTR2RVAL_LEN_UCS4((char *)ucs4, items_written * sizeof(*ucs4)); g_free(ucs4); return result; } void Init_glib_utf8(void) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "UTF8"); /* Not implemented. g_utf8_next_char */ RG_DEF_SMETHOD(get_char, -1); /* Not implemented. g_utf8_offset_to_pointer g_utf8_pointer_to_offset g_utf8_prev_char g_utf8_find_next_char g_utf8_find_prev_char g_utf8_prev_char */ RG_DEF_SMETHOD(size, 1); /* Not implemented. g_utf8_strncpy g_utf8_strrchr */ RG_DEF_SMETHOD(reverse, 1); RG_DEF_SMETHOD(validate, 1); RG_DEF_SMETHOD(upcase, 1); RG_DEF_SMETHOD(downcase, 1); RG_DEF_SMETHOD(casefold, 1); RG_DEF_SMETHOD(normalize, -1); RG_DEF_SMETHOD(collate, 2); RG_DEF_SMETHOD(collate_key, -1); RG_DEF_SMETHOD(to_utf16, 1); RG_DEF_SMETHOD(to_ucs4, -1); } ����������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_timer.c������������������������������������������������0000644�0001750�0001750�00000005545�12257552167�020242� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #ifdef G_OS_WIN32 #include <windows.h> #endif /*****************************************/ /* This is stolen from gtimer.c of glib-2.6.2. */ struct _GTimer { #ifdef G_OS_WIN32 DWORD start; DWORD end; #else /* !G_OS_WIN32 */ struct timeval start; struct timeval end; #endif /* !G_OS_WIN32 */ guint active : 1; }; static GTimer* timer_copy(GTimer *timer) { GTimer* new_timer; g_return_val_if_fail (timer != NULL, NULL); new_timer = g_new(struct _GTimer, 1); *new_timer = *timer; return new_timer; } static GType g_timer_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GTimer", (GBoxedCopyFunc)timer_copy, (GBoxedFreeFunc)g_timer_destroy); return our_type; } /*****************************************/ #define G_TYPE_TIMER (g_timer_get_type()) #define RG_TARGET_NAMESPACE cTimer #define _SELF(s) ((GTimer*)RVAL2BOXED(s, G_TYPE_TIMER)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, g_timer_new()); return Qnil; } static VALUE rg_start(VALUE self) { g_timer_start(_SELF(self)); return self; } static VALUE rg_stop(VALUE self) { g_timer_stop(_SELF(self)); return self; } static VALUE rg_continue(VALUE self) { g_timer_continue(_SELF(self)); return self; } static VALUE rg_elapsed(VALUE self) { gulong microseconds; gdouble ret = g_timer_elapsed(_SELF(self), µseconds); return rb_assoc_new(rb_float_new(ret), ULONG2NUM(microseconds)); } static VALUE rg_reset(VALUE self) { g_timer_reset(_SELF(self)); return self; } void Init_glib_timer(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIMER, "Timer", mGLib); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(start, 0); RG_DEF_METHOD(stop, 0); RG_DEF_METHOD(continue, 0); RG_DEF_METHOD(elapsed, 0); RG_DEF_METHOD(reset, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/Makefile������������������������������������������������������0000644�0001750�0001750�00000027620�12446173027�017065� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� SHELL = /bin/sh # V=0 quiet, V=1 verbose. other values don't work. V = 0 Q1 = $(V:1=) Q = $(Q1:0=@) ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### srcdir = /home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 topdir = /usr/include/ruby-2.1.0 hdrdir = $(topdir) arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0 PATH_SEPARATOR = : VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby prefix = $(DESTDIR)/usr rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME) rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME) rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) exec_prefix = $(prefix) vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME) vendorhdrdir = $(rubyhdrdir)/vendor_ruby sitehdrdir = $(rubyhdrdir)/site_ruby rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version) vendorlibdir = $(vendordir)/$(ruby_version) vendordir = $(rubylibprefix)/vendor_ruby sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby sitelibdir = $(sitedir)/$(ruby_version) sitedir = $(DESTDIR)/usr/local/lib/site_ruby rubyarchdir = $(rubyarchprefix)/$(ruby_version) rubylibdir = $(rubylibprefix)/$(ruby_version) sitearchincludedir = $(includedir)/$(sitearch) archincludedir = $(includedir)/$(arch) sitearchlibdir = $(libdir)/$(sitearch) archlibdir = $(libdir)/$(arch) ridir = $(datarootdir)/$(RI_BASE_NAME) mandir = $(prefix)/share/man localedir = $(datarootdir)/locale libdir = $(exec_prefix)/lib psdir = $(docdir) pdfdir = $(docdir) dvidir = $(docdir) htmldir = $(docdir) infodir = $(prefix)/share/info docdir = $(datarootdir)/doc/$(PACKAGE) oldincludedir = $(DESTDIR)/usr/include includedir = $(prefix)/include localstatedir = $(DESTDIR)/var sharedstatedir = $(prefix)/com sysconfdir = $(DESTDIR)/etc datadir = $(datarootdir) datarootdir = $(prefix)/share libexecdir = $(prefix)/lib/ruby2.1 sbindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/bin archdir = $(rubyarchdir) CC = gcc CXX = g++ LIBRUBY = $(LIBRUBY_SO) LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static empty = OUTFLAG = -o $(empty) COUTFLAG = -o $(empty) RUBY_EXTCONF_H = cflags = $(optflags) $(debugflags) $(warnflags) optflags = -O3 -fno-fast-math debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration CCDLFLAGS = -fPIC CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $(ARCH_FLAG) INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I$(vendorarchdir) DEFS = CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DHAVE_UNISTD_H -DHAVE_G_SPAWN_CLOSE_PID -DHAVE_G_THREAD_INIT -DHAVE_G_MAIN_DEPTH -DHAVE_G_LISTENV -DHAVE_RB_CHECK_ARRAY_TYPE -DHAVE_RB_CHECK_HASH_TYPE -DHAVE_RB_EXEC_RECURSIVE -DHAVE_RB_ERRINFO -DHAVE_RB_SOURCEFILE -DHAVE_RB_SOURCELINE -DHAVE_RB_THREAD_CALL_WITHOUT_GVL -DHAVE_RUBY_NATIVE_THREAD_P -DHAVE_RB_THREAD_CALL_WITH_GVL -DHAVE_RB_STR_NEW_CSTR -DHAVE_RB_GC_REGISTER_MARK_OBJECT -DHAVE_RB_EXC_NEW_STR -DRUBY_GLIB2_COMPILATION -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags) CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG) ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -pthread dldflags = ARCH_FLAG = DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) LDSHARED = $(CC) -shared LDSHAREDXX = $(CXX) -shared AR = ar EXEEXT = RUBY_INSTALL_NAME = ruby2.1 RUBY_SO_NAME = ruby-2.1 RUBYW_INSTALL_NAME = RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) RUBYW_BASE_NAME = rubyw RUBY_BASE_NAME = ruby arch = x86_64-linux-gnu sitearch = $(arch) ruby_version = 2.1.0 ruby = $(bindir)/ruby2.1 RUBY = $(ruby) ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h RM = rm -f RM_RF = $(RUBY) -run -e rm -- -rf RMDIRS = rmdir --ignore-fail-on-non-empty -p MAKEDIRS = /bin/mkdir -p INSTALL = /usr/bin/install -c INSTALL_PROG = $(INSTALL) -m 0755 INSTALL_DATA = $(INSTALL) -m 644 COPY = cp TOUCH = exit > #### End of system configuration section. #### preload = libpath = . $(archlibdir) LIBPATH = -L. -L$(archlibdir) DEFFILE = CLEANFILES = mkmf.log DISTCLEANFILES = ruby-glib2.pc glib-enum-types.h glib-enum-types.c DISTCLEANDIRS = extout = extout_prefix = target_prefix = LOCAL_LIBS = LIBS = $(LIBRUBYARG_SHARED) -lgobject-2.0 -lglib-2.0 -lgthread-2.0 -lglib-2.0 -lpthread -lgmp -ldl -lcrypt -lm -lc ORIG_SRCS = rbgobj_value.c rbglibdeprecated.c rbglib_win32.c rbglib_mainloop.c rbgobj_convert.c rbglib_spawn.c rbglib_unicode.c rbglib_pollfd.c rbgobj_strv.c rbgutil.c rbglib_bookmarkfile.c rbglib_fileutils.c rbglib.c rbgobj_object.c rbglib_unichar.c rbgobj_valuearray.c rbgobj_typemodule.c rbglib_gettext.c rbglib_int64.c rbglib_iochannel_win32_socket.c rbglib_utf16.c rbgobj_signal.c rbglib_source.c rbglib_error.c rbgobj_closure.c rbglib_ucs4.c rbglib_threads.c rbgobj_param.c rbglib_shell.c glib-enum-types.c rbgobj_type.c rbglib_iochannel.c rbgobj_typeinstance.c rbglib_spawnerror.c rbgobject.c rbgobj_paramspecs.c rbgobj_flags.c rbgobj_enums.c rbgutildeprecated.c rbglib_iochannelerror.c rbglib_messages.c rbglib_utils.c rbgobj_typeinterface.c rbglib_maincontext.c rbglib_convert.c rbgutil_list.c rbgobj_enumflags.c rbglib_utf8.c rbglib_timer.c rbglib_i18n.c rbgutil_callback.c rbglib_keyfile.c rbgobj_typeplugin.c rbglib_io_constants.c rbglib_shellerror.c rbgobj_boxed.c rbgobj_valuetypes.c SRCS = $(ORIG_SRCS) rbgobj_value.c rbglibdeprecated.c rbglib_win32.c rbglib_mainloop.c rbgobj_convert.c rbglib_spawn.c rbglib_unicode.c rbglib_pollfd.c rbgobj_strv.c rbgutil.c rbglib_bookmarkfile.c rbglib_fileutils.c rbglib.c rbgobj_object.c rbglib_unichar.c rbgobj_valuearray.c rbgobj_typemodule.c rbglib_gettext.c rbglib_int64.c rbglib_iochannel_win32_socket.c rbglib_utf16.c rbgobj_signal.c rbglib_source.c rbglib_error.c rbgobj_closure.c rbglib_ucs4.c rbglib_threads.c rbgobj_param.c rbglib_shell.c glib-enum-types.c rbgobj_type.c rbglib_iochannel.c rbgobj_typeinstance.c rbglib_spawnerror.c rbgobject.c rbgobj_paramspecs.c rbgobj_flags.c rbgobj_enums.c rbgutildeprecated.c rbglib_iochannelerror.c rbglib_messages.c rbglib_utils.c rbgobj_typeinterface.c rbglib_maincontext.c rbglib_convert.c rbgutil_list.c rbgobj_enumflags.c rbglib_utf8.c rbglib_timer.c rbglib_i18n.c rbgutil_callback.c rbglib_keyfile.c rbgobj_typeplugin.c rbglib_io_constants.c rbglib_shellerror.c rbgobj_boxed.c rbgobj_valuetypes.c OBJS = rbgobj_value.o rbglibdeprecated.o rbglib_win32.o rbglib_mainloop.o rbgobj_convert.o rbglib_spawn.o rbglib_unicode.o rbglib_pollfd.o rbgobj_strv.o rbgutil.o rbglib_bookmarkfile.o rbglib_fileutils.o rbglib.o rbgobj_object.o rbglib_unichar.o rbgobj_valuearray.o rbgobj_typemodule.o rbglib_gettext.o rbglib_int64.o rbglib_iochannel_win32_socket.o rbglib_utf16.o rbgobj_signal.o rbglib_source.o rbglib_error.o rbgobj_closure.o rbglib_ucs4.o rbglib_threads.o rbgobj_param.o rbglib_shell.o glib-enum-types.o rbgobj_type.o rbglib_iochannel.o rbgobj_typeinstance.o rbglib_spawnerror.o rbgobject.o rbgobj_paramspecs.o rbgobj_flags.o rbgobj_enums.o rbgutildeprecated.o rbglib_iochannelerror.o rbglib_messages.o rbglib_utils.o rbgobj_typeinterface.o rbglib_maincontext.o rbglib_convert.o rbgutil_list.o rbgobj_enumflags.o rbglib_utf8.o rbglib_timer.o rbglib_i18n.o rbgutil_callback.o rbglib_keyfile.o rbgobj_typeplugin.o rbglib_io_constants.o rbglib_shellerror.o rbgobj_boxed.o rbgobj_valuetypes.o HDRS = $(srcdir)/rbgutildeprecated.h $(srcdir)/rbglib.h $(srcdir)/rbglibdeprecated.h $(srcdir)/glib-enum-types.h $(srcdir)/rbgutil_list.h $(srcdir)/rbgprivate.h $(srcdir)/rbglib2conversions.h $(srcdir)/rbgobject.h $(srcdir)/rbgutil.h $(srcdir)/rbgcompat.h TARGET = glib2 TARGET_NAME = glib2 TARGET_ENTRY = Init_$(TARGET_NAME) DLLIB = $(TARGET).so EXTSTATIC = STATIC_LIB = TIMESTAMP_DIR = . BINDIR = $(bindir) RUBYCOMMONDIR = $(sitedir)$(target_prefix) RUBYLIBDIR = $(sitelibdir)$(target_prefix) RUBYARCHDIR = $(sitearchdir)$(target_prefix) HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) TARGET_SO = $(DLLIB) CLEANLIBS = $(TARGET).so CLEANOBJS = *.o *.bak all: $(DLLIB) static: $(STATIC_LIB) .PHONY: all install static install-so install-rb .PHONY: clean clean-so clean-static clean-rb clean-static:: clean-rb-default:: clean-rb:: clean-so:: clean: clean-so clean-static clean-rb-default clean-rb -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time distclean-rb-default:: distclean-rb:: distclean-so:: distclean-static:: distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true realclean: distclean install: install-so install-rb install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR) clean-static:: -$(Q)$(RM) $(STATIC_LIB) install-rb: pre-install-rb install-rb-default install-rb-default: pre-install-rb-default pre-install-rb: Makefile pre-install-rb-default: Makefile pre-install-rb-default: $(ECHO) installing default glib2 libraries $(TIMESTAMP_DIR)/.RUBYARCHDIR.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR) $(Q) $(TOUCH) $@ site-install: site-install-so site-install-rb site-install-so: install-so site-install-rb: install-rb .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o .cc.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .mm.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .cxx.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .cpp.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .C.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .c.o: $(ECHO) compiling $(<) $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< .m.o: $(ECHO) compiling $(<) $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< $(DLLIB): $(OBJS) Makefile $(ECHO) linking shared-object $(DLLIB) -$(Q)$(RM) $(@) $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) ### install-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rbglib.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbglibdeprecated.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbglib2conversions.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgutil.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgutil_list.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgutildeprecated.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgobject.h $(RUBYARCHDIR) $(INSTALL_DATA) $(srcdir)/rbgcompat.h $(RUBYARCHDIR) $(INSTALL_DATA) glib-enum-types.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-glib2.pc $(pkgconfigdir); \ fi ����������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_i18n.c�������������������������������������������������0000644�0001750�0001750�00000002332�12257552167�017670� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2006 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 "rbgprivate.h" #include "rbglib.h" #undef _ #include <glib/gi18n.h> #define RG_TARGET_NAMESPACE mGLib static VALUE rg_s_language_names(G_GNUC_UNUSED VALUE self) { return STRV2RVAL((const gchar **)g_get_language_names()); } void Init_glib_i18n(void) { /* glib/gi18n.h */ RG_DEF_SMETHOD(language_names, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgutil_callback.c��������������������������������������������0000644�0001750�0001750�00000017275�12416346617�021066� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2007 Ruby-GNOME2 Project * * 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 "rbgprivate.h" #ifdef G_OS_WIN32 # ifdef HAVE_IO_H # include <io.h> # define pipe(phandles) _pipe(phandles, 128, _O_BINARY) # endif #else # ifdef HAVE_UNISTD_H # include <unistd.h> # endif #endif #include <fcntl.h> #include <errno.h> #ifndef HAVE_RUBY_NATIVE_THREAD_P # define ruby_native_thread_p() is_ruby_native_thread() #endif static VALUE rbgutil_eGLibCallbackNotInitializedError; static ID id_exit_application; /**********************************************************************/ VALUE rbgutil_protect(VALUE (*func) (VALUE), VALUE data) { int state = 0; VALUE ret = rb_protect(func, data, &state); VALUE e = rb_errinfo(); if (state && !NIL_P(e)) rb_funcall(mGLib, id_exit_application, 2, e, INT2NUM(EXIT_FAILURE)); return ret; } /**********************************************************************/ #ifdef HAVE_NATIVETHREAD typedef struct _CallbackRequest { VALUE (*function)(VALUE); VALUE argument; VALUE result; GMutex *done_mutex; GCond *done_cond; } CallbackRequest; static GMutex *callback_dispatch_thread_mutex = NULL; static GAsyncQueue *callback_request_queue = NULL; static ID id_callback_dispatch_thread; static gint callback_pipe_fds[2] = {-1, -1}; #define CALLBACK_PIPE_READY_MESSAGE "R" #define CALLBACK_PIPE_READY_MESSAGE_SIZE 1 static VALUE exec_callback(VALUE data) { CallbackRequest *request = (CallbackRequest *)data; return request->function(request->argument); } static VALUE process_request(CallbackRequest *request) { g_mutex_lock(request->done_mutex); request->result = rbgutil_protect(exec_callback, (VALUE)request); g_cond_signal(request->done_cond); g_mutex_unlock(request->done_mutex); return Qnil; } static VALUE mainloop(void) { for (;;) { CallbackRequest *request; gchar ready_message_buffer[CALLBACK_PIPE_READY_MESSAGE_SIZE]; rb_thread_wait_fd(callback_pipe_fds[0]); if (read(callback_pipe_fds[0], ready_message_buffer, CALLBACK_PIPE_READY_MESSAGE_SIZE ) != CALLBACK_PIPE_READY_MESSAGE_SIZE || strncmp(ready_message_buffer, CALLBACK_PIPE_READY_MESSAGE, CALLBACK_PIPE_READY_MESSAGE_SIZE) != 0) { g_error("failed to read valid callback dispatcher message"); continue; } request = g_async_queue_pop(callback_request_queue); if (!request) break; rb_thread_create(process_request, request); } close(callback_pipe_fds[0]); callback_pipe_fds[0] = -1; close(callback_pipe_fds[1]); callback_pipe_fds[1] = -1; return Qnil; } static void queue_callback_request(CallbackRequest *request) { ssize_t written; g_async_queue_push(callback_request_queue, request); written = write(callback_pipe_fds[1], CALLBACK_PIPE_READY_MESSAGE, CALLBACK_PIPE_READY_MESSAGE_SIZE); if (written != CALLBACK_PIPE_READY_MESSAGE_SIZE) { rb_warn("couldn't write all callback pipe ready message: " "message-size: %d, written: %" G_GSSIZE_FORMAT, CALLBACK_PIPE_READY_MESSAGE_SIZE, written); } } static VALUE invoke_callback_in_ruby_thread(VALUE (*func)(VALUE), VALUE arg) { CallbackRequest request; g_mutex_lock(callback_dispatch_thread_mutex); if (callback_pipe_fds[0] == -1) { g_error("Please call rbgutil_start_callback_dispatch_thread() " "to dispatch a callback from non-ruby thread before " "callbacks are requested from non-ruby thread."); g_mutex_unlock(callback_dispatch_thread_mutex); return Qnil; } request.function = func; request.argument = arg; request.result = Qnil; request.done_mutex = g_mutex_new(); request.done_cond = g_cond_new(); g_mutex_lock(request.done_mutex); queue_callback_request(&request); g_mutex_unlock(callback_dispatch_thread_mutex); g_cond_wait(request.done_cond, request.done_mutex); g_mutex_unlock(request.done_mutex); g_cond_free(request.done_cond); g_mutex_free(request.done_mutex); return request.result; } #ifdef HAVE_RB_THREAD_CALL_WITH_GVL extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1); static void * invoke_callback_with_gvl(void *arg) { CallbackRequest *req = (CallbackRequest*)arg; return (void *)rbgutil_protect(req->function, req->argument); } #endif #endif /**********************************************************************/ VALUE rbgutil_invoke_callback(VALUE (*func)(VALUE), VALUE arg) { #ifdef HAVE_NATIVETHREAD if (ruby_native_thread_p()) { if (!GPOINTER_TO_INT(g_static_private_get(&rg_polling_key))) { return rbgutil_protect(func, arg); } # ifdef HAVE_RB_THREAD_CALL_WITH_GVL { CallbackRequest req; req.function = func; req.argument = arg; return (VALUE)rb_thread_call_with_gvl(invoke_callback_with_gvl, &req); } # endif } else { return invoke_callback_in_ruby_thread(func, arg); } #endif return rbgutil_protect(func, arg); } /**********************************************************************/ void rbgutil_start_callback_dispatch_thread(void) { #ifdef HAVE_NATIVETHREAD VALUE callback_dispatch_thread; g_mutex_lock(callback_dispatch_thread_mutex); callback_dispatch_thread = rb_ivar_get(mGLib, id_callback_dispatch_thread); if (NIL_P(callback_dispatch_thread)) { if (pipe(callback_pipe_fds) == -1) rb_sys_fail("pipe()"); callback_dispatch_thread = rb_thread_create(mainloop, NULL); rb_ivar_set(mGLib, id_callback_dispatch_thread, callback_dispatch_thread); } g_mutex_unlock(callback_dispatch_thread_mutex); #endif } void rbgutil_stop_callback_dispatch_thread(void) { #ifdef HAVE_NATIVETHREAD VALUE callback_dispatch_thread; g_mutex_lock(callback_dispatch_thread_mutex); callback_dispatch_thread = rb_ivar_get(mGLib, id_callback_dispatch_thread); if (!NIL_P(callback_dispatch_thread)) { queue_callback_request(NULL); rb_ivar_set(mGLib, id_callback_dispatch_thread, Qnil); } g_mutex_unlock(callback_dispatch_thread_mutex); #endif } void Init_gutil_callback(void) { id_exit_application = rb_intern("exit_application"); rbgutil_eGLibCallbackNotInitializedError = rb_define_class_under(mGLib, "CallbackNotInitializedError", rb_eRuntimeError); #ifdef HAVE_NATIVETHREAD if (!g_thread_supported()) g_thread_init(NULL); id_callback_dispatch_thread = rb_intern("callback_dispatch_thread"); rb_ivar_set(mGLib, id_callback_dispatch_thread, Qnil); callback_request_queue = g_async_queue_new(); callback_dispatch_thread_mutex = g_mutex_new(); #endif } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_keyfile.c����������������������������������������������0000644�0001750�0001750�00000054774�12257552167�020562� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 "rbgprivate.h" #if !GLIB_CHECK_VERSION(2,31,2) /************************************************/ static GKeyFile* keyfile_copy(const GKeyFile* keyfile) { // GKeyFile* new_keyfile; g_return_val_if_fail (keyfile != NULL, NULL); /* new_keyfile = g_key_file_new(); *new_keyfile = (GKeyFile*)*keyfile; return new_keyfile; */ return (GKeyFile*)keyfile; } GType g_key_file_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static("GKeyFile", (GBoxedCopyFunc)keyfile_copy, (GBoxedFreeFunc)g_key_file_free); return our_type; } /************************************************/ #endif #define RG_TARGET_NAMESPACE cKeyFile #define _SELF(self) ((GKeyFile*)(RVAL2BOXED(self, G_TYPE_KEY_FILE))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, g_key_file_new()); return Qnil; } static VALUE rg_set_list_separator(VALUE self, VALUE sep) { g_key_file_set_list_separator(_SELF(self), NUM2INT(sep)); return self; } static VALUE rg_load_from_file(int argc, VALUE *argv, VALUE self) { VALUE file, flags; GError* error = NULL; gboolean ret; GKeyFileFlags gflags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS; rb_scan_args(argc, argv, "11", &file, &flags); if (!NIL_P(flags)){ gflags = RVAL2GFLAGS(flags, G_TYPE_KEY_FILE_FLAGS); } ret = g_key_file_load_from_file(_SELF(self), RVAL2CSTR(file), gflags, &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_load_from_data(int argc, VALUE *argv, VALUE self) { VALUE data, flags; GError* error = NULL; gboolean ret; GKeyFileFlags gflags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS; rb_scan_args(argc, argv, "11", &data, &flags); if (!NIL_P(flags)){ gflags = RVAL2GFLAGS(flags, G_TYPE_KEY_FILE_FLAGS); } StringValue(data); ret = g_key_file_load_from_data(_SELF(self), (const gchar*)RVAL2CSTR(data), (gsize)RSTRING_LEN(data), gflags, &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_load_from_data_dirs(int argc, VALUE *argv, VALUE self) { VALUE file, flags; GError* error = NULL; gboolean ret; gchar* full_path; GKeyFileFlags gflags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS; rb_scan_args(argc, argv, "11", &file, &flags); if (!NIL_P(flags)){ gflags = RVAL2GFLAGS(flags, G_TYPE_KEY_FILE_FLAGS); } StringValue(file); ret = g_key_file_load_from_data_dirs(_SELF(self), (const gchar*)RVAL2CSTR(file), &full_path, gflags, &error); if (! ret) RAISE_GERROR(error); return full_path ? CSTR2RVAL(full_path) : Qnil; } #if GLIB_CHECK_VERSION(2, 14, 0) static VALUE rg_load_from_dirs(int argc, VALUE *argv, VALUE self) { VALUE rb_file, rb_search_dirs, rb_flags; GError* error = NULL; gboolean success; const gchar *file; const gchar **search_dirs; gchar* full_path; GKeyFileFlags flags; rb_scan_args(argc, argv, "12", &rb_file, &rb_search_dirs, &rb_flags); file = RVAL2CSTR(rb_file); search_dirs = RVAL2STRV_ACCEPT_NIL(rb_search_dirs); flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS; if (!NIL_P(rb_flags)) flags = RVAL2GFLAGS(rb_flags, G_TYPE_KEY_FILE_FLAGS); if (search_dirs != NULL) success = g_key_file_load_from_dirs(_SELF(self), file, search_dirs, &full_path, flags, &error); else success = g_key_file_load_from_data_dirs(_SELF(self), file, &full_path, flags, &error); g_free(search_dirs); if (!success) RAISE_GERROR(error); return CSTR2RVAL(full_path); } #endif static VALUE rg_to_data(VALUE self) { GError* error = NULL; gchar* data = g_key_file_to_data(_SELF(self), NULL, &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(data); } static VALUE rg_start_group(VALUE self) { return CSTR2RVAL(g_key_file_get_start_group(_SELF(self))); } static VALUE rg_groups(VALUE self) { return STRV2RVAL_FREE(g_key_file_get_groups(_SELF(self), NULL)); } static VALUE rg_get_keys(VALUE self, VALUE group_name) { GError *error = NULL; gchar **keys = g_key_file_get_keys(_SELF(self), RVAL2CSTR(group_name), NULL, &error); if (error != NULL) RAISE_GERROR(error); return STRV2RVAL_FREE(keys); } static VALUE rg_has_group_p(VALUE self, VALUE group_name) { return CBOOL2RVAL(g_key_file_has_group(_SELF(self), (const gchar*)RVAL2CSTR(group_name))); } static VALUE rg_has_key_p(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gboolean ret = g_key_file_has_key(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(ret); } static VALUE rg_get_value(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gchar* ret = g_key_file_get_value(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_get_string(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gchar* ret = g_key_file_get_string(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_get_locale_string(int argc, VALUE *argv, VALUE self) { VALUE group_name, key, locale; GError* error = NULL; gchar* ret; rb_scan_args(argc, argv, "21", &group_name, &key, &locale); ret = g_key_file_get_locale_string(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), (const gchar*)RVAL2CSTR_ACCEPT_NIL(locale), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_get_boolean(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gboolean ret = g_key_file_get_boolean(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(ret); } static VALUE rg_get_integer(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gint ret = g_key_file_get_integer(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return INT2NUM(ret); } static VALUE rg_get_double(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gdouble ret = g_key_file_get_double(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return rb_float_new(ret); } static VALUE rg_get_string_list(VALUE self, VALUE group_name, VALUE key) { VALUE ary; gsize i; gsize length; GError* error = NULL; gchar** ret = g_key_file_get_string_list(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(ret[i])); } g_strfreev(ret); return ary; } static VALUE rg_get_locale_string_list(int argc, VALUE *argv, VALUE self) { VALUE group_name, key, locale; GError* error = NULL; VALUE ary; gsize i; gsize length; gchar** ret; rb_scan_args(argc, argv, "21", &group_name, &key, &locale); ret = g_key_file_get_locale_string_list(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), (const gchar*)RVAL2CSTR_ACCEPT_NIL(locale), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(ret[i])); } g_strfreev(ret); return ary; } static VALUE rg_get_boolean_list(VALUE self, VALUE group_name, VALUE key) { VALUE ary; gsize i; gsize length; GError* error = NULL; gboolean* ret = g_key_file_get_boolean_list(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CBOOL2RVAL(ret[i])); } return ary; } static VALUE rg_get_integer_list(VALUE self, VALUE group_name, VALUE key) { VALUE ary; gsize i; gsize length; GError* error = NULL; gint* ret = g_key_file_get_integer_list(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, INT2NUM(ret[i])); } return ary; } static VALUE rg_get_double_list(VALUE self, VALUE group_name, VALUE key) { VALUE ary; gsize i; gsize length; GError* error = NULL; gdouble* ret = g_key_file_get_double_list(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &length, &error); if (error) RAISE_GERROR(error); ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, rb_float_new(ret[i])); } return ary; } static VALUE rg_get_comment(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; gchar* ret = g_key_file_get_comment(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(ret); } static VALUE rg_set_value(VALUE self, VALUE group_name, VALUE key, VALUE value) { g_key_file_set_value(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), (const gchar*)RVAL2CSTR(value)); return self; } static VALUE rg_set_string(VALUE self, VALUE group_name, VALUE key, VALUE string) { g_key_file_set_string(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), (const gchar*)RVAL2CSTR(string)); return self; } static VALUE rg_set_locale_string(VALUE self, VALUE group_name, VALUE key, VALUE locale, VALUE locale_string) { g_key_file_set_locale_string(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), (const gchar*)RVAL2CSTR(locale), (const gchar*)RVAL2CSTR(locale_string)); return self; } static VALUE rg_set_boolean(VALUE self, VALUE group_name, VALUE key, VALUE value) { g_key_file_set_boolean(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), RVAL2CBOOL(value)); return self; } static VALUE rg_set_integer(VALUE self, VALUE group_name, VALUE key, VALUE value) { g_key_file_set_integer(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), NUM2INT(value)); return self; } static VALUE rg_set_double(VALUE self, VALUE group_name, VALUE key, VALUE value) { g_key_file_set_double(_SELF(self), (const gchar*)RVAL2CSTR(group_name), (const gchar*)RVAL2CSTR(key), NUM2DBL(value)); return self; } static VALUE rg_set_string_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rblist) { GKeyFile *key_file = _SELF(self); const gchar *group_name = RVAL2CSTR(rbgroup_name); const gchar *key = RVAL2CSTR(rbkey); long n; const gchar **list = RVAL2STRS(rblist, n); g_key_file_set_string_list(key_file, group_name, key, list, n); g_free(list); return self; } static VALUE rg_set_locale_string_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rblocale, VALUE rblist) { GKeyFile *key_file = _SELF(self); const gchar *group_name = RVAL2CSTR(rbgroup_name); const gchar *key = RVAL2CSTR(rbkey); const gchar *locale = RVAL2CSTR(rblocale); long n; const gchar **list = RVAL2STRS(rblist, n); g_key_file_set_locale_string_list(key_file, group_name, key, locale, list, n); g_free(list); return self; } static VALUE rg_set_boolean_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rblist) { GKeyFile *key_file = _SELF(self); const gchar *group_name = RVAL2CSTR(rbgroup_name); const gchar *key = RVAL2CSTR(rbkey); long n; gboolean *list = RVAL2GBOOLEANS(rblist, n); g_key_file_set_boolean_list(key_file, group_name, key, list, n); g_free(list); return self; } static VALUE rg_set_integer_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rblist) { GKeyFile *key_file = _SELF(self); const gchar *group_name = RVAL2CSTR(rbgroup_name); const gchar *key = RVAL2CSTR(rbkey); long n; gint *list = RVAL2GINTS(rblist, n); g_key_file_set_integer_list(key_file, group_name, key, list, n); g_free(list); return self; } static VALUE rg_set_double_list(VALUE self, VALUE rbgroup_name, VALUE rbkey, VALUE rblist) { GKeyFile *key_file = _SELF(self); const gchar *group_name = RVAL2CSTR(rbgroup_name); const gchar *key = RVAL2CSTR(rbkey); long n; gdouble *list = RVAL2GDOUBLES(rblist, n); g_key_file_set_double_list(key_file, group_name, key, list, n); return self; } static VALUE rg_set_comment(VALUE self, VALUE group_name, VALUE key, VALUE comment) { GError* error = NULL; g_key_file_set_comment(_SELF(self), RVAL2CSTR(group_name), RVAL2CSTR_ACCEPT_NIL(key), RVAL2CSTR(comment), &error); if (error != NULL) RAISE_GERROR(error); return self; } static VALUE rg_remove_group(VALUE self, VALUE group_name) { GError* error = NULL; g_key_file_remove_group(_SELF(self), RVAL2CSTR(group_name), &error); if (error != NULL) RAISE_GERROR(error); return self; } static VALUE rg_remove_key(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; g_key_file_remove_key(_SELF(self), RVAL2CSTR(group_name), RVAL2CSTR(key), &error); if (error != NULL) RAISE_GERROR(error); return self; } static VALUE rg_remove_comment(VALUE self, VALUE group_name, VALUE key) { GError* error = NULL; g_key_file_remove_comment(_SELF(self), RVAL2CSTR(group_name), RVAL2CSTR(key), &error); if (error != NULL) RAISE_GERROR(error); return self; } void Init_glib_keyfile(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_KEY_FILE, "KeyFile", mGLib); G_DEF_ERROR(G_KEY_FILE_ERROR, "KeyFileError", mGLib, rb_eRuntimeError, G_TYPE_KEY_FILE_ERROR); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_list_separator, 1); RG_DEF_METHOD(load_from_file, -1); RG_DEF_METHOD(load_from_data, -1); RG_DEF_METHOD(load_from_data_dirs, -1); #if GLIB_CHECK_VERSION(2, 14, 0) RG_DEF_METHOD(load_from_dirs, -1); #endif RG_DEF_METHOD(to_data, 0); RG_DEF_METHOD(start_group, 0); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD(get_keys, 1); RG_DEF_METHOD_P(has_group, 1); RG_DEF_METHOD_P(has_key, 2); RG_DEF_METHOD(get_value, 2); RG_DEF_METHOD(get_string, 2); RG_DEF_METHOD(get_locale_string, -1); RG_DEF_METHOD(get_boolean, 2); RG_DEF_METHOD(get_integer, 2); RG_DEF_METHOD(get_double, 2); RG_DEF_METHOD(get_string_list, 2); RG_DEF_METHOD(get_locale_string_list, -1); RG_DEF_METHOD(get_boolean_list, 2); RG_DEF_METHOD(get_integer_list, 2); RG_DEF_METHOD(get_double_list, 2); RG_DEF_METHOD(get_comment, 2); RG_DEF_METHOD(set_value, 3); RG_DEF_METHOD(set_string, 3); RG_DEF_METHOD(set_locale_string, 4); RG_DEF_METHOD(set_boolean, 3); RG_DEF_METHOD(set_integer, 3); RG_DEF_METHOD(set_double, 3); RG_DEF_METHOD(set_string_list, 3); RG_DEF_METHOD(set_locale_string_list, 4); RG_DEF_METHOD(set_boolean_list, 3); RG_DEF_METHOD(set_integer_list, 3); RG_DEF_METHOD(set_double_list, 3); RG_DEF_METHOD(set_comment, 3); RG_DEF_METHOD(remove_group, 1); RG_DEF_METHOD(remove_key, 2); RG_DEF_METHOD(remove_comment, 2); /* GKeyFileFlags */ G_DEF_CLASS(G_TYPE_KEY_FILE_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_KEY_FILE_FLAGS, "G_KEY_FILE_"); #if GLIB_CHECK_VERSION(2, 14, 0) /* Defines for handling freedesktop.org Desktop files */ rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_GROUP", CSTR2RVAL(G_KEY_FILE_DESKTOP_GROUP)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_TYPE", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_TYPE)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_VERSION", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_VERSION)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_NAME", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_NAME)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_GENERIC_NAME", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_NO_DISPLAY", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_COMMENT", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_COMMENT)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_ICON", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_ICON)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_HIDDEN", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_HIDDEN)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_ONLY_SHOW_IN", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_NOT_SHOW_IN", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_TRY_EXEC", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_TRY_EXEC)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_EXEC", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_EXEC)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_PATH", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_PATH)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_TERMINAL", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_TERMINAL)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_MIME_TYPE", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_MIME_TYPE)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_CATEGORIES", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_CATEGORIES)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_STARTUP_NOTIFY", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_STARTUP_WM_CLASS", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_KEY_URL", CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_URL)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_TYPE_APPLICATION", CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_APPLICATION)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_TYPE_LINK", CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_LINK)); rb_define_const(RG_TARGET_NAMESPACE, "DESKTOP_TYPE_DIRECTORY", CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_DIRECTORY)); #endif } ����ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_typeplugin.c�������������������������������������������0000644�0001750�0001750�00000003511�11701304107�021273� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE mTypePlugin static VALUE rg_use(VALUE self) { g_type_plugin_use(G_TYPE_PLUGIN(RVAL2GOBJ(self))); return self; } static VALUE rg_unuse(VALUE self) { g_type_plugin_unuse(G_TYPE_PLUGIN(RVAL2GOBJ(self))); return self; } #if 0 void g_type_plugin_complete_type_info (GTypePlugin *plugin, GType g_type, GTypeInfo *info, GTypeValueTable *value_table); void g_type_plugin_complete_interface_info (GTypePlugin *plugin, GType interface_type, GType instance_type, GInterfaceInfo *info); #endif void Init_gobject_gtypeplugin(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(G_TYPE_TYPE_PLUGIN, "TypePlugin", mGLib); RG_DEF_METHOD(use, 0); RG_DEF_METHOD(unuse, 0); }���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgcompat.h���������������������������������������������������0000644�0001750�0001750�00000001757�12077252561�017560� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2007 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 __RBGCOMPAT_H__ #define __RBGCOMPAT_H__ G_BEGIN_DECLS G_END_DECLS #endif �����������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_io_constants.c�����������������������������������������0000644�0001750�0001750�00000002067�12002536277�021611� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2012 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 "rbgprivate.h" void Init_glib_io_constants(void) { VALUE RG_TARGET_NAMESPACE = mGLib; /* GIOCondition */ G_DEF_CLASS(G_TYPE_IO_CONDITION, "IOCondition", RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbglib_shellerror.c�������������������������������������������0000644�0001750�0001750�00000002550�11701304107�021252� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE cShellError void Init_glib_shellerror(void) { VALUE RG_TARGET_NAMESPACE = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError", mGLib, rb_eRuntimeError); rb_define_const(RG_TARGET_NAMESPACE, "BAD_QUOTING", INT2FIX(G_SHELL_ERROR_BAD_QUOTING)); rb_define_const(RG_TARGET_NAMESPACE, "EMPTY_STRING", INT2FIX(G_SHELL_ERROR_EMPTY_STRING)); rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2FIX(G_SHELL_ERROR_FAILED)); } ��������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_boxed.c������������������������������������������������0000644�0001750�0001750�00000016211�12416346617�020215� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #define RG_TARGET_NAMESPACE rbgobj_cBoxed VALUE RG_TARGET_NAMESPACE; static void boxed_mark(boxed_holder *holder) { const RGObjClassInfo *cinfo; cinfo = GTYPE2CINFO_NO_CREATE(holder->type); if (cinfo && cinfo->mark) cinfo->mark(holder->boxed); } static void boxed_free(boxed_holder *holder) { const RGObjClassInfo *cinfo; cinfo = GTYPE2CINFO_NO_CREATE(holder->type); if (cinfo && cinfo->free) cinfo->free(holder->boxed); if (holder->own && holder->boxed) g_boxed_free(holder->type, holder->boxed); xfree(holder); } /**********************************************************************/ static VALUE rbgobj_boxed_s_allocate(VALUE klass) { const RGObjClassInfo *cinfo = rbgobj_lookup_class(klass); boxed_holder *holder; VALUE result; if (cinfo->gtype == G_TYPE_BOXED) rb_raise(rb_eTypeError, "abstract class"); result = Data_Make_Struct(klass, boxed_holder, boxed_mark, boxed_free, holder); holder->type = cinfo->gtype; holder->boxed = NULL; holder->own = FALSE; return result; } static VALUE rg_initialize(VALUE self) { VALUE rb_class; rb_class = CLASS_OF(self); if (RVAL2CBOOL(rb_ivar_defined(rb_class, rb_intern("@size")))) { const RGObjClassInfo *cinfo; gpointer instance; gsize instance_size; cinfo = rbgobj_lookup_class(rb_class); instance_size = NUM2UINT(rb_iv_get(rb_class, "@size")); instance = alloca(instance_size); memset(instance, 0, instance_size); G_INITIALIZE(self, g_boxed_copy(cinfo->gtype, instance)); } else { rb_raise(rb_eTypeError, "can't initialize %s", rb_class2name(rb_class)); } return Qnil; } static VALUE rg_inspect(VALUE self) { boxed_holder *holder; gchar *s; VALUE result; Data_Get_Struct(self, boxed_holder, holder); s = g_strdup_printf("#<%s:%p ptr=%p own=%s>", rb_class2name(CLASS_OF(self)), (void *)self, holder->boxed, holder->own ? "true" : "false"); result = rb_str_new2(s); g_free(s); return result; } static VALUE rg_initialize_copy(VALUE self, VALUE orig) { boxed_holder *holder1; boxed_holder *holder2; if (self == orig) return self; if (!rb_obj_is_instance_of(orig, rb_obj_class(self))) { rb_raise(rb_eTypeError, "wrong argument class"); } Data_Get_Struct(self, boxed_holder, holder1); Data_Get_Struct(orig, boxed_holder, holder2); holder1->boxed = g_boxed_copy(holder2->type, holder2->boxed); holder1->own = TRUE; if (!holder1->boxed) rb_raise(rb_eRuntimeError, "g_boxed_copy() failed"); return self; } /* deprecated */ VALUE rbgobj_boxed_create(VALUE klass) { return rbgobj_boxed_s_allocate(klass); } /**********************************************************************/ void rbgobj_boxed_initialize(VALUE obj, gpointer boxed) { boxed_holder *holder; Data_Get_Struct(obj, boxed_holder, holder); holder->boxed = boxed; holder->own = TRUE; } gpointer rbgobj_boxed_get_default(VALUE obj, GType gtype) { boxed_holder *holder; if (!RVAL2CBOOL(rb_obj_is_kind_of(obj, GTYPE2CLASS(gtype)))) rb_raise(rb_eArgError, "invalid argument %s (expect %s)", rb_class2name(CLASS_OF(obj)), rb_class2name(GTYPE2CLASS(gtype))); Data_Get_Struct(obj, boxed_holder, holder); if (!holder->boxed) rb_raise(rb_eArgError, "uninitialize %s", rb_class2name(CLASS_OF(obj))); return holder->boxed; } gpointer rbgobj_boxed_get(VALUE obj, GType gtype) { gpointer boxed = NULL; if (NIL_P(obj)) return NULL; if (rbgobj_convert_robj2instance(gtype, obj, &boxed)) { return boxed; } return rbgobj_boxed_get_default(obj, gtype); } VALUE rbgobj_make_boxed_raw(gpointer p, GType gtype, VALUE klass, gint flags) { VALUE result; boxed_holder *holder; result = rbgobj_boxed_s_allocate(klass); Data_Get_Struct(result, boxed_holder, holder); if (flags & RBGOBJ_BOXED_NOT_COPY) { holder->boxed = p; holder->own = FALSE; } else { holder->boxed = g_boxed_copy(gtype, p); holder->own = TRUE; } return result; } VALUE rbgobj_make_boxed_default(gpointer p, GType gtype) { const RGObjClassInfo *cinfo; cinfo = GTYPE2CINFO(gtype); return rbgobj_make_boxed_raw(p, gtype, cinfo->klass, cinfo->flags); } VALUE rbgobj_make_boxed(gpointer p, GType gtype) { VALUE result; if (!p) return Qnil; if (rbgobj_convert_instance2robj(gtype, p, &result)) { return result; } return rbgobj_make_boxed_default(p, gtype); } void rbgobj_boxed_not_copy_obj(GType gtype) { RGObjClassInfo *cinfo = (RGObjClassInfo *)GTYPE2CINFO(gtype); cinfo->flags |= RBGOBJ_BOXED_NOT_COPY; } void rbgobj_boxed_unown(VALUE boxed) { boxed_holder *holder; Data_Get_Struct(boxed, boxed_holder, holder); if (!holder->own) { rb_raise(rb_eArgError, "The boxed is already unowned: %p", boxed); } holder->own = FALSE; } /**********************************************************************/ static VALUE boxed_to_ruby(const GValue *from) { gpointer boxed; boxed = g_value_get_boxed(from); return rbgobj_make_boxed(boxed, G_VALUE_TYPE(from)); } static void boxed_from_ruby(VALUE from, GValue *to) { gpointer boxed; boxed = rbgobj_boxed_get(from, G_VALUE_TYPE(to)); g_value_set_boxed(to, boxed); } /**********************************************************************/ void Init_gobject_gboxed(void) { RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_BOXED, "Boxed", mGLib); rbgobj_register_g2r_func(G_TYPE_BOXED, boxed_to_ruby); rbgobj_register_r2g_func(G_TYPE_BOXED, boxed_from_ruby); rb_define_alloc_func(RG_TARGET_NAMESPACE, (VALUE(*)_((VALUE)))rbgobj_boxed_s_allocate); rbg_define_singleton_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0); rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_gtype, 0); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(inspect, 0); RG_DEF_METHOD(initialize_copy, 1); RG_DEF_ALIAS("copy", "dup"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/ext/glib2/rbgobj_valuetypes.c�������������������������������������������0000644�0001750�0001750�00000014267�12102213526�021306� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 "rbgprivate.h" #include "rbgobject.h" VALUE rbgobj_ptr_new(GType type, gpointer ptr) { return Data_Wrap_Struct(GTYPE2CLASS(type), NULL, NULL, ptr); } gpointer rbgobj_ptr2cptr(VALUE ptr) { gpointer dest; if (rb_obj_is_kind_of(ptr, GTYPE2CLASS(G_TYPE_POINTER))){ Data_Get_Struct(ptr, void, dest); } else if (rb_obj_is_kind_of(ptr, rb_cObject)){ dest = (gpointer)ptr; } else{ rb_raise(rb_eTypeError, "not a pointer object"); } return dest; } static VALUE ptr_s_gtype(VALUE klass) { return rbgobj_gtype_new(rbgobj_lookup_class(klass)->gtype); } static VALUE ptr_gtype(VALUE self) { return ptr_s_gtype(CLASS_OF(self)); } static void Init_gtype_pointer(void) { VALUE cPtr = G_DEF_CLASS(G_TYPE_POINTER, "Pointer", mGLib); rbg_define_singleton_method(cPtr, "gtype", ptr_s_gtype, 1); rbg_define_method(cPtr, "gtype", ptr_gtype, 1); } /**********************************************************************/ static GHashTable* boxed_ruby_value_table; static VALUE boxed_ruby_value_table_wrapper; typedef struct { VALUE obj; guint ref_count; } boxed_ruby_value_counter; static void boxed_ruby_value_counter_mark(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) { boxed_ruby_value_counter* counter = value; if (counter->ref_count) rb_gc_mark(counter->obj); } static void boxed_ruby_value_table_mark(GHashTable* table) { g_hash_table_foreach(table, boxed_ruby_value_counter_mark, NULL); } static VALUE boxed_ruby_value_ref(VALUE val) { if (!SPECIAL_CONST_P(val)){ boxed_ruby_value_counter* counter; counter = g_hash_table_lookup(boxed_ruby_value_table, (gpointer)val); if (!counter){ counter = g_new(boxed_ruby_value_counter, 1); counter->obj = val; counter->ref_count = 1; g_hash_table_insert(boxed_ruby_value_table, (gpointer)val, counter); } else { counter->ref_count += 1; } } return val; } static void boxed_ruby_value_unref(VALUE val) { if (!SPECIAL_CONST_P(val)){ boxed_ruby_value_counter* counter; counter = g_hash_table_lookup(boxed_ruby_value_table, (gpointer)val); counter->ref_count -= 1; if (!counter->ref_count) g_hash_table_remove(boxed_ruby_value_table, (gpointer)val); } } struct transform_arg { const GValue *src_value; GValue *dest_value; }; static VALUE value_transform_ruby_any_impl(VALUE arg_) { struct transform_arg* arg = (struct transform_arg*)arg_; rbgobj_rvalue_to_gvalue(g_value_get_ruby_value(arg->src_value), arg->dest_value); return Qnil; } static void value_transform_ruby_any(const GValue *src_value, GValue *dest_value) { int state; struct transform_arg arg; arg.src_value = src_value; arg.dest_value = dest_value; rb_protect(&value_transform_ruby_any_impl, (VALUE)&arg, &state); } static void value_transform_any_ruby(const GValue *src_value, GValue *dest_value) { g_value_set_ruby_value(dest_value, GVAL2RVAL(src_value)); } GType rbgobj_ruby_value_get_type(void) { static GType our_type = 0; if (!our_type){ const GType table[] = { G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_INT64, G_TYPE_UINT64, G_TYPE_ENUM, G_TYPE_FLAGS, G_TYPE_FLOAT, G_TYPE_DOUBLE, G_TYPE_STRING, G_TYPE_POINTER, //G_TYPE_BOXED, G_TYPE_PARAM, G_TYPE_OBJECT, }; size_t i; our_type = g_boxed_type_register_static( "VALUE", (GBoxedCopyFunc)boxed_ruby_value_ref, (GBoxedFreeFunc)boxed_ruby_value_unref); for (i = 0; i < sizeof(table)/sizeof(table[0]); i++){ g_value_register_transform_func(table[i], our_type, value_transform_any_ruby); } g_value_register_transform_func(our_type, G_TYPE_BOOLEAN, value_transform_ruby_any); } return our_type; } VALUE g_value_get_ruby_value(const GValue* value) { return (VALUE)g_value_get_boxed(value); } void g_value_set_ruby_value(GValue* value, VALUE ruby) { g_value_set_boxed(value, (gconstpointer)ruby); } static void ruby_value_r2g(VALUE from, GValue* to) { g_value_set_ruby_value(to, from); } static void Init_boxed_ruby_value(void) { boxed_ruby_value_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); boxed_ruby_value_table_wrapper = Data_Wrap_Struct(rb_cData, boxed_ruby_value_table_mark, NULL, boxed_ruby_value_table); rb_global_variable(&boxed_ruby_value_table_wrapper); rbgobj_register_g2r_func(RBGOBJ_TYPE_RUBY_VALUE, g_value_get_ruby_value); rbgobj_register_r2g_func(RBGOBJ_TYPE_RUBY_VALUE, ruby_value_r2g); } /**********************************************************************/ void Init_gobject_gvaluetypes(void) { Init_gtype_pointer(); Init_boxed_ruby_value(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/COPYING.LIB�������������������������������������������������������������0000644�0001750�0001750�00000063642�12257552167�015300� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�014357� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2-raketask.rb��������������������������������������������������0000644�0001750�0001750�00000000337�12137115064�017701� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright(C) 2013 Ruby-GNOME2 Project. # # This program is licenced under the same license of Ruby-GNOME2. # Just for backward compatibility. require "gnome2/rake/package-task" GNOME2Package = GNOME2::Rake::PackageTask �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/mkmf-gnome2.rb������������������������������������������������������0000644�0001750�0001750�00000042747�12516434313�017043� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # mkmf-gnome2.rb # # Extended mkmf for Ruby-GNOME2 and Ruby/GLib based libraries. # # Copyright(C) 2003-2013 Ruby-GNOME2 Project. # # This program is licenced under the same # license of Ruby-GNOME2. # require 'English' require 'mkmf' require 'pkg-config' require 'glib-mkenums' $CFLAGS += " #{ENV['CFLAGS']}" if ENV['CFLAGS'] def gcc? CONFIG["GCC"] == "yes" end def disable_optimization_build_flag(flags) if gcc? flags.gsub(/(^|\s)?-O\d(\s|$)?/, '\\1-O0\\2') else flags end end def enable_debug_build_flag(flags) if gcc? debug_option_pattern = /(^|\s)?-g\d?(\s|$)?/ if debug_option_pattern =~ flags flags.gsub(debug_option_pattern, '\\1-g3\\2') else flags + " -g3" end else flags end end checking_for(checking_message("--enable-debug-build option")) do enable_debug_build = enable_config("debug-build", false) if enable_debug_build $CFLAGS = disable_optimization_build_flag($CFLAGS) $CFLAGS = enable_debug_build_flag($CFLAGS) CONFIG["CXXFLAGS"] = disable_optimization_build_flag(CONFIG["CXXFLAGS"]) CONFIG["CXXFLAGS"] = enable_debug_build_flag(CONFIG["CXXFLAGS"]) end enable_debug_build end def try_compiler_option(opt, &block) checking_for "#{opt} option to compiler" do if try_compile '', opt + " -Werror", &block $CFLAGS += " #{opt}" true else false end end end try_compiler_option '-Wall' try_compiler_option '-Waggregate-return' try_compiler_option '-Wcast-align' # NOTE: Generates way too many false positives. # try_compiler_option '-Wconversion' try_compiler_option '-Wextra' try_compiler_option '-Wformat=2' try_compiler_option '-Winit-self' # NOTE: This generates warnings for functions defined in ruby.h. # try_compiler_option '-Winline' try_compiler_option '-Wlarger-than-65500' try_compiler_option '-Wmissing-declarations' try_compiler_option '-Wmissing-format-attribute' try_compiler_option '-Wmissing-include-dirs' try_compiler_option '-Wmissing-noreturn' try_compiler_option '-Wmissing-prototypes' try_compiler_option '-Wnested-externs' try_compiler_option '-Wold-style-definition' try_compiler_option '-Wpacked' try_compiler_option '-Wp,-D_FORTIFY_SOURCE=2' try_compiler_option '-Wpointer-arith' # NOTE: ruby.h and intern.h have too many of these. # try_compiler_option '-Wredundant-decls' # NOTE: Complains about index, for example. # try_compiler_option '-Wshadow' try_compiler_option '-Wswitch-default' try_compiler_option '-Wswitch-enum' try_compiler_option '-Wundef' # NOTE: Incredible amounts of false positives. #try_compiler_option '-Wunreachable-code' try_compiler_option '-Wout-of-line-declaration' try_compiler_option '-Wunsafe-loop-optimizations' try_compiler_option '-Wwrite-strings' if /-Wl,--no-undefined/ =~ $LDFLAGS.to_s $LDFLAGS.gsub!(/-Wl,--no-undefined/, '') end include_path = nil if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM include_path = (ENV['GTK_BASEPATH'] + "\\INCLUDE").gsub("\\", "/") # $hdrdir += " -I#{include_path} " $CFLAGS += " -I#{include_path} " end def setup_windows(target_name, base_dir=nil) checking_for(checking_message("Windows")) do case RUBY_PLATFORM when /cygwin|mingw|mswin/ import_library_name = "libruby-#{target_name}.a" $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}" $cleanfiles << import_library_name base_dir ||= Pathname($0).dirname.parent.parent.expand_path base_dir = Pathname(base_dir) if base_dir.is_a?(String) binary_base_dir = base_dir + "vendor" + "local" if binary_base_dir.exist? $CFLAGS += " -I#{binary_base_dir}/include" pkg_config_dir = binary_base_dir + "lib" + "pkgconfig" PKGConfig.add_path(pkg_config_dir.to_s) end true else false end end end # For backward compatibility def setup_win32(*args, &block) setup_windows(*args, &block) end def find_gem_spec(package) begin require 'rubygems' if Gem::Specification.respond_to?(:find_by_name) Gem::Specification.find_by_name(package) else Gem.source_index.find_name(package).last end rescue LoadError nil end end #add_depend_package("glib2", "ext/glib2", "/...../ruby-gnome2") def add_depend_package(target_name, target_srcdir, top_srcdir, options={}) gem_spec = find_gem_spec(target_name) if gem_spec target_source_dir = File.join(gem_spec.full_gem_path, "ext/#{target_name}") target_build_dir = target_source_dir add_depend_package_path(target_name, target_source_dir, target_build_dir) end [top_srcdir, File.join(top_srcdir, target_name), $configure_args['--topdir'], File.join($configure_args['--topdir'], target_name)].each do |topdir| topdir = File.expand_path(topdir) target_source_dir_full_path = File.join(topdir, target_srcdir) top_build_dir = options[:top_build_dir] || topdir target_build_dir = options[:target_build_dir] || target_srcdir target_build_dir_full_path = File.join(top_build_dir, target_build_dir) unless File.exist?(target_build_dir_full_path) target_build_dir_full_path = File.join(top_build_dir, target_srcdir) end unless File.exist?(target_build_dir_full_path) target_build_dir_full_path = File.join(topdir, target_build_dir) end unless File.exist?(target_build_dir_full_path) target_build_dir_full_path = File.join(topdir, target_srcdir) end add_depend_package_path(target_name, target_source_dir_full_path, target_build_dir_full_path) end end def add_depend_package_path(target_name, target_source_dir, target_build_dir) if File.exist?(target_source_dir) $INCFLAGS = "-I#{target_source_dir} #{$INCFLAGS}" end case RUBY_PLATFORM when /cygwin|mingw|mswin/ target_base_dir = Pathname.new(target_source_dir).parent.parent target_binary_base_dir = target_base_dir + "vendor" + "local" if target_binary_base_dir.exist? $INCFLAGS = "-I#{target_binary_base_dir}/include #{$INCFLAGS}" target_pkg_config_dir = target_binary_base_dir + "lib" + "pkgconfig" PKGConfig.add_path(target_pkg_config_dir.to_s) end end return unless File.exist?(target_build_dir) if target_source_dir != target_build_dir $INCFLAGS = "-I#{target_build_dir} #{$INCFLAGS}" end case RUBY_PLATFORM when /cygwin|mingw|mswin/ library_base_name = "ruby-#{target_name.gsub(/-/, '_')}" case RUBY_PLATFORM when /cygwin|mingw/ $LDFLAGS << " -L#{target_build_dir}" $libs << " -l#{library_base_name}" when /mswin/ $DLDFLAGS << " /libpath:#{target_build_dir}" $libs << " lib#{library_base_name}.lib" end end end def add_distcleanfile(file) $distcleanfiles ||= [] $distcleanfiles << file end def create_pkg_config_file(package_name, c_package, version=nil, pc_file_name=nil) pc_file_name ||= "#{package_name.downcase.sub(/\//, '-')}.pc" version ||= ruby_gnome2_version || PKGConfig.modversion(c_package) puts "creating #{pc_file_name}" File.open(pc_file_name, 'w') do |pc_file| if package_name.nil? c_module_name = PKGConfig.name(c_package) package_name = "Ruby/#{c_module_name}" if c_module_name end pc_file.puts("Name: #{package_name}") if package_name description = PKGConfig.description(c_package) pc_file.puts("Description: Ruby bindings for #{description}") if description pc_file.printf("Version: #{version}") end add_distcleanfile(pc_file_name) end def ruby_gnome2_version(glib_source_directory=nil) glib_source_directory ||= File.join(File.dirname(__FILE__), "..", "ext", "glib2") rbglib_h = File.join(glib_source_directory, "rbglib.h") return nil unless File.exist?(rbglib_h) version = nil File.open(rbglib_h) do |h_file| version_info = {} h_file.each_line do |line| case line when /\A#define RBGLIB_(MAJOR|MINOR|MICRO)_VERSION\s+(\d+)/ version_info[$1] = $2 end end version_info = [version_info["MAJOR"], version_info["MINOR"], version_info["MICRO"]].compact version = version_info.join(".") if version_info.size == 3 end version end def ensure_objs return unless $objs.nil? source_dir = '$(srcdir)' RbConfig.expand(source_dir) pattern = "*.{#{SRC_EXT.join(',')}}" srcs = Dir[File.join(source_dir, pattern)] srcs |= Dir[File.join(".", pattern)] $objs = srcs.collect do |f| File.basename(f, ".*") + ".o" end.uniq end def create_makefile_at_srcdir(pkg_name, srcdir, defs = nil) base_dir = File.basename(Dir.pwd) last_common_index = srcdir.rindex(base_dir) if last_common_index builddir = srcdir[(last_common_index + base_dir.size + 1)..-1] end builddir ||= "." FileUtils.mkdir_p(builddir) Dir.chdir(builddir) do yield if block_given? $defs << defs if defs ensure_objs create_makefile(pkg_name, srcdir) end end def run_make_in_sub_dirs_command(command, sub_dirs) if /mswin/ =~ RUBY_PLATFORM sub_dirs.collect do |dir| <<-EOM.chmop @cd #{dir} @nmake -nologo DESTDIR=$(DESTDIR) #{command} @cd .. EOM end.join("\n") else sub_dirs.collect do |dir| "\t@cd #{dir}; $(MAKE) #{command}" end.join("\n") end end def create_top_makefile(sub_dirs=["src"]) File.open("Makefile", "w") do |makefile| makefile.print(<<-EOM) all: #{run_make_in_sub_dirs_command("all", sub_dirs)} install: #{run_make_in_sub_dirs_command("install", sub_dirs)} site-install: #{run_make_in_sub_dirs_command("site-install", sub_dirs)} clean: #{run_make_in_sub_dirs_command("clean", sub_dirs)} EOM if /mswin/ =~ RUBY_PLATFORM makefile.print(<<-EOM) @if exist extconf.h del extconf.h @if exist conftest.* del conftest.* @if exist *.lib del *.lib @if exist *~ del *~ @if exist mkmf.log del mkmf.log EOM else makefile.print(<<-EOM) distclean: clean #{run_make_in_sub_dirs_command("distclean", sub_dirs)} @rm -f Makefile extconf.h conftest.* @rm -f core *~ mkmf.log EOM end end end # This is used for the library which doesn't support version info. def make_version_header(app_name, pkgname, dir = "src") version = PKGConfig.modversion(pkgname).split(/\./) (0..2).each do |v| version[v] = "0" unless version[v] if /\A(\d+)/ =~ version[v] number = $1 tag = $POSTMATCH unless tag.empty? version[v] = number version[3] = tag end end end filename = "rb#{app_name.downcase}version.h" puts "creating #{filename}" add_distcleanfile(filename) FileUtils.mkdir_p(dir) out = File.open(File.join(dir, filename), "w") version_definitions = [] ["MAJOR", "MINOR", "MICRO", "TAG"].each_with_index do |type, i| _version = version[i] next if _version.nil? version_definitions << "#define #{app_name}_#{type}_VERSION (#{_version})" end out.print %Q[/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /************************************************ #{filename} - This file was generated by mkmf-gnome2.rb. ************************************************/ #ifndef __RB#{app_name}_VERSION_H__ #define __RB#{app_name}_VERSION_H__ #{version_definitions.join("\n")} #define #{app_name}_CHECK_VERSION(major,minor,micro) \\ (#{app_name}_MAJOR_VERSION > (major) || \\ (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION > (minor)) || \\ (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION == (minor) && \\ #{app_name}_MICRO_VERSION >= (micro))) #endif /* __RB#{app_name}_VERSION_H__ */ ] out.close end def check_ruby_func #Other options ruby_header = "ruby.h" have_func("rb_define_alloc_func", ruby_header) # for ruby-1.8 have_func("rb_block_proc", ruby_header) # for ruby-1.8 STDOUT.print("checking for new allocation framework... ") # for ruby-1.7 if Object.respond_to? :allocate STDOUT.print "yes\n" $defs << "-DHAVE_OBJECT_ALLOCATE" else STDOUT.print "no\n" end STDOUT.print("checking for attribute assignment... ") # for ruby-1.7 STDOUT.flush if defined? try_compile and try_compile <<SRC #include "ruby.h" #include "node.h" int node_attrasgn = (int)NODE_ATTRASGN; SRC STDOUT.print "yes\n" $defs << "-DHAVE_NODE_ATTRASGN" else STDOUT.print "no\n" end end def add_obj(name) ensure_objs $objs << name unless $objs.index(name) end def glib_mkenums(prefix, files, g_type_prefix, include_files, options={}) add_distcleanfile(prefix + ".h") add_distcleanfile(prefix + ".c") GLib::MkEnums.create(prefix, files, g_type_prefix, include_files, options) add_obj("#{prefix}.o") end def check_cairo(options={}) is_windows = (/mingw|cygwin|mswin/ === RUBY_PLATFORM) rcairo_source_dir = options[:rcairo_source_dir] if rcairo_source_dir.nil? suffix = nil if is_windows case RUBY_PLATFORM when /\Ax86-mingw/ suffix = "win32" when /\Ax64-mingw/ suffix = "win64" end end rcairo_source_base_dir = "rcairo" rcairo_source_base_dir << ".#{suffix}" if suffix top_dir = options[:top_dir] if top_dir rcairo_source_dir = File.join(top_dir, "..", rcairo_source_base_dir) end end if rcairo_source_dir and !File.exist?(rcairo_source_dir) rcairo_source_dir = nil end if rcairo_source_dir.nil? cairo_gem_spec = find_gem_spec("cairo") rcairo_source_dir = cairo_gem_spec.full_gem_path if cairo_gem_spec end unless rcairo_source_dir.nil? if is_windows options = {} build_dir = "tmp/#{RUBY_PLATFORM}/cairo/#{RUBY_VERSION}" if File.exist?(File.join(rcairo_source_dir, build_dir)) options[:target_build_dir] = build_dir end add_depend_package("cairo", "ext/cairo", rcairo_source_dir, options) $defs << "-DRUBY_CAIRO_PLATFORM_WIN32" end $CFLAGS += " -I#{rcairo_source_dir}/ext/cairo" end PKGConfig.have_package('cairo') and have_header('rb_cairo.h') end def package_platform if File.exist?("/etc/debian_version") :debian elsif File.exist?("/etc/fedora-release") :fedora elsif File.exist?("/etc/redhat-release") :redhat elsif File.exist?("/etc/SuSE-release") :suse elsif find_executable("brew") :homebrew elsif find_executable("port") :macports else :unknown end end def super_user? Process.uid.zero? end def normalize_native_package_info(native_package_info) native_package_info ||= {} native_package_info = native_package_info.dup native_package_info[:fedora] ||= native_package_info[:redhat] native_package_info[:suse] ||= native_package_info[:fedora] native_package_info end def install_missing_native_package(native_package_info) platform = package_platform native_package_info = normalize_native_package_info(native_package_info) package = native_package_info[platform] return false if package.nil? package_name, *options = package package_command_line = [package_name, *options].join(" ") need_super_user_priviledge = true case platform when :debian install_command = "apt-get install -V -y #{package_command_line}" when :fedora, :redhat install_command = "yum install -y #{package_command_line}" when :suse install_command = "zypper --non-interactive install #{package_command_line}" when :homebrew need_super_user_priviledge = false install_command = "brew install #{package_command_line}" when :macports install_command = "port install -y #{package_command_line}" else return false end have_priviledge = (not need_super_user_priviledge or super_user?) unless have_priviledge sudo = find_executable("sudo") end installing_message = "installing '#{package_name}' native package... " message("%s", installing_message) failed_to_get_super_user_priviledge = false if have_priviledge succeeded = xsystem(install_command) else if sudo prompt = "[sudo] password for %u to install <#{package_name}>: " sudo_options = "-p #{Shellwords.escape(prompt)}" install_command = "#{sudo} #{sudo_options} #{install_command}" succeeded = xsystem(install_command) else succeeded = false failed_to_get_super_user_priviledge = true end end if failed_to_get_super_user_priviledge result_message = "require super user privilege" else result_message = succeeded ? "succeeded" : "failed" end Logging.postpone do "#{installing_message}#{result_message}\n" end message("#{result_message}\n") error_message = nil unless succeeded if failed_to_get_super_user_priviledge error_message = <<-EOM '#{package_name}' native package is required. run the following command as super user to install required native package: \# #{install_command} EOM else error_message = <<-EOM failed to run '#{install_command}'. EOM end end if error_message message("%s", error_message) Logging.message("%s", error_message) end Logging.message("--------------------\n\n") succeeded end def required_pkg_config_package(package_info, native_package_info=nil) if package_info.is_a?(Array) required_package_info = package_info else required_package_info = [package_info] end return true if PKGConfig.have_package(*required_package_info) native_package_info ||= {} return false unless install_missing_native_package(native_package_info) PKGConfig.have_package(*required_package_info) end add_include_path = Proc.new do |dir_variable| value = RbConfig::CONFIG[dir_variable] if value and File.exist?(value) $INCFLAGS << " -I$(#{dir_variable}) " end end add_include_path.call("sitearchdir") add_include_path.call("vendorarchdir") check_ruby_func if /mingw/ =~ RUBY_PLATFORM $ruby.gsub!('\\', '/') end �������������������������ruby-gnome2-all-2.2.5/glib2/lib/glib-mkenums.rb�����������������������������������������������������0000644�0001750�0001750�00000014312�12126557022�017301� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # glib-mkenums.rb # # C language enum description generation library like as glib-mkenums tool. # # Copyright(C) 2006-2013 Ruby-GNOME2 Project. # # This program is licenced under the same license of Ruby-GNOME2. # module GLib class EnumDefinition attr_accessor :EnumName, :enum_name, :ENUM_NAME, :ENUM_SHORT attr_accessor :type, :Type attr_accessor :g_type_prefix, :prefix attr_reader :constants def initialize(name, const_lines, g_type_prefix, options={}) @options = options || {} @EnumName = name @g_type_prefix = g_type_prefix @constants = [] @enum_name = to_snail_case(@EnumName) @ENUM_NAME = @enum_name.upcase @ENUM_SHORT = @ENUM_NAME.sub(/^#{@g_type_prefix.sub(/_TYPE.*$/, "")}/, "").sub(/^_/, "") parse_const_lines(const_lines) end def parse_const_lines(const_lines) if @options[:force_flags] or /<</ =~ const_lines @type = "flags" @Type = "Flags" else @type = "enum" @Type = "Enum" end constants = [] const_lines.scan(/^\s*([^\s,]*).*\n/) do |name| constants << name[0] unless name[0] =~ /(^[\/\*]|^#|^$)/ end @prefix = extract_prefix(constants) constants.each do |name| @constants << [name, name.sub(/#{@prefix}/, "").gsub(/_/, "-").downcase] end end def extract_prefix(ary) return [] if ary == nil a = ary[0].split(//) if ary.size == 1 @ENUM_NAME + "_" else ary[1..-1].each do |b| b = b.split(//) l = [a.length, b.length].min a = a[0, (0...l).find{|i| a[i] != b[i] } || l] end a.join('') end end def create_c constants = "\n" + @constants.collect{|name, nick| %Q[ { #{name}, "#{name}", "#{nick}" },\n] }.join + %Q[ { 0, NULL, NULL }] ret = <<-CREATE_C GType #{@enum_name}_get_type (void) { static GType etype = 0; if (etype == 0) { static const G#{@Type}Value values[] = {#{constants} }; etype = g_#{@type}_register_static ("#{@EnumName}", values); } return etype; } CREATE_C ret end def create_h %Q[ GType #{@enum_name}_get_type (void); #define #{@g_type_prefix}#{@ENUM_SHORT} (#{@enum_name}_get_type())] end private def to_snail_case(name) prefix_processed_name = name.sub(/^[A-Z]/) do |prefix| prefix.downcase end snail_cased_name = prefix_processed_name.gsub(/[A-Z]+/) do |upper_case| down_case = upper_case.downcase if down_case.size == 1 "_#{down_case}" else "_#{down_case[0..-2]}_#{down_case[-1..-1]}" end end snail_cased_name.sub(/(^_|_$)/, "") end def self.parse(data, g_type_prefix, options={}) options ||= {} enums = [] data.force_encoding("utf-8") if data.respond_to?(:force_encoding) data.scan(/^\s*typedef\s+enum\s*(\/\*<\s*flags\s*>\*\/)?\s* \{?\s*(.*?) \}\s*(\w+);/mx) do |force_flags, constants, name| enum_options = {} enum_options[:force_flags] = !force_flags.nil? force_flags_patterns = [(options[:force_flags] || [])].flatten if force_flags_patterns.any? {|pattern| pattern === name} enum_options[:force_flags] = true end enum = new(name, constants, g_type_prefix, enum_options) enums << enum end enums end end class MkEnums # Create target_filename.c and target_filename.h from files # with g_type_prefix and include_files. # * target_filename: the target file name. This creates #{target_filename.c} and #{target_filename.h}. # * files: header files to parse # * g_type_prefix: the gtype prefix such as GTK_TYPE_ # * include_files: define #include <file> lines into target_filename.c def self.create(target_filename, files, g_type_prefix, include_files, options) puts "creating #{target_filename}.c" mkenums = MkEnums.new(target_filename, files, g_type_prefix, include_files, options) open("#{target_filename}.c", "w") do |out| out.write(mkenums.create_c) end puts "creating #{target_filename}.h" open("#{target_filename}.h", "w") do |out| out.write(mkenums.create_h) end end # Initialize GLib::MkEnums # # * target_filename: the target file name. This creates #{target_filename.c} and #{target_filename.h}. # * files: header files to parse # * g_type_prefix: the gtype prefix such as GTK_TYPE_ # * include_files: define #include <file> lines into target_filename.c def initialize(target_filename, files, g_type_prefix, include_files, options) @target_filename = target_filename @include_files = include_files @targets = [] files.each do |path| data = "" File.open(path) do |i| data = i.read end @targets << [path, EnumDefinition.parse(data, g_type_prefix, options)] end end def create_enums(meth) # :nodoc: ret = "" @targets.each do |target| if target[1].size > 0 ret << %Q[\n\n/* enumerations from "#{target[0]}" */] target[1].each{|enum| ret << enum.__send__(meth) } end end ret end # Create a C source as a String. def create_c ret = "\n/* Generated by glib-mkenums.rb ($Id$) */ \n\n" ret << %Q[#include "#{@target_filename}.h"\n] @include_files.each do |file| ret << "#include <#{file}>\n" end ret << "\n" ret << create_enums(:create_c) ret << "\n\n/* Generated data ends here */\n\n" ret end # Create a C header as a String. def create_h header = "#{@target_filename}.h" const = "__#{File.basename(header).upcase.gsub(/-|\./, '_')}__" ret = "\n/* Generated by glib-mkenums.rb ($Id$) */ \n\n" ret << "#ifndef #{const}\n" ret << "#define #{const}\n\n" ret << "#include <glib-object.h>\n\n" ret << "G_BEGIN_DECLS" ret << create_enums(:create_h) ret << "\n\nG_END_DECLS\n\n" ret << "#endif /* #{const} */\n" ret << "\n/* Generated data ends here */\n\n" ret end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/�������������������������������������������������������������0000755�0001750�0001750�00000000000�12137115064�015546� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/��������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�016472� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/native-binary-build-task.rb�����������������������������0000644�0001750�0001750�00000010372�12516434313�023627� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013 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 require "rake" module GNOME2 module Rake class NativeBinaryBuildTask include ::Rake::DSL def initialize(package) @package = package end def define namespace :native do namespace :builder do task :before define_build_tasks build_tasks = build_packages.collect do |package| "native:builder:build:#{package.name}" end task :build => build_tasks task :after end desc "Build binaries for build environment" task :build => [ "native:builder:before", "native:builder:build", "native:builder:after", ] end end private def define_build_tasks namespace :build do build_packages.each do |package| namespace package.name do download_task = "source:downloader:download:#{package.name}" built_file = package.native.built_file if built_file built_file = dist_dir + built_file file built_file.to_s do ::Rake::Task[download_task].invoke build_package_task_body(package) end task :build => built_file.to_s else task :build => [download_task] do build_patckage_task_body(package) end end end desc "Build #{package.label} and install it into #{dist_dir}." task package.name => "native:builder:build:#{package.name}:build" end end end def build_package_task_body(package) package_tmp_dir = @package.tmp_dir + "native" + package.name rm_rf(package_tmp_dir) mkdir_p(package_tmp_dir) tar_full_path = @package.download_dir + package.archive_base_name Dir.chdir(package_tmp_dir.to_s) do sh("tar", "xf", tar_full_path.to_s) or exit(false) end package_dir_path = package_tmp_dir + package.base_name + package.base_dir_in_package Dir.chdir(package_dir_path.to_s) do package.native.patches.each do |patch| sh("patch -p1 < #{@package.patches_dir}/#{patch}") end sh("./autogen.sh") if package.native.need_autogen? sh("autoreconf --install") if package.native.need_autoreconf? sh("./configure", "PKG_CONFIG_PATH=#{pkg_config_path}", "--prefix=#{dist_dir}", *package.native.configure_args) or exit(false) env = [] env << "PKG_CONFIG_PATH=#{pkg_config_path}" common_make_args = [] common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas" build_make_args = common_make_args.dup install_make_args = common_make_args.dup if package.native.build_concurrently? make_n_jobs = ENV["MAKE_N_JOBS"] build_make_args << "-j#{make_n_jobs}" if make_n_jobs end sh("env", *env, "nice", "make", *build_make_args) or exit(false) sh("env", *env, "make", "install", *install_make_args) or exit(false) end end def build_packages @package.external_packages.select do |package| package.native.build? end end def dist_dir @package.native.absolute_binary_dir end def pkg_config_path dist_dir + "lib/pkgconfig" end end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/windows-binary-download-task.rb�������������������������0000644�0001750�0001750�00000012171�12446160551�024544� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright(C) 2010-2012 Ruby-GNOME2 Project. # # This program is licenced under the same license of Ruby-GNOME2. require 'open-uri' require 'rubygems' require 'mechanize' class GNOME2WindowsBinaryDownloadTask include Rake::DSL URL_BASE = "http://ftp.gnome.org/pub/gnome/binaries" def initialize(package) @package = package define end private def define namespace :windows do namespace :downloader do task :before download_tasks = [] namespace :download do directory dist_dir.to_s task :prepare => [dist_dir.to_s] packages.each do |package| desc "download #{package}" task package => [:prepare] do download_package(package) end download_tasks << package end dependencies.each do |dependency| name, version = dependency desc "download #{name}" task name => [:prepare] do download_dependency(dependency) end download_tasks << name end end download_tasks = download_tasks.collect do |task| "windows:downloader:download:#{task}" end desc "download Windows binaries into #{dist_dir}" task :download => download_tasks task :after end desc "download Windows binaries" task :download => ["windows:downloader:before", "windows:downloader:download", "windows:downloader:after"] end end def dist_dir @package.windows.absolute_binary_dir end def packages @package.windows.packages end def dependencies @package.windows.dependencies end def build_architecture_suffix @package.windows.build_architecture_suffix end def download_package(package) suffix = build_architecture_suffix version_page_url = "#{URL_BASE}/#{suffix}/#{package}" version_page = agent.get(version_page_url) latest_version_link = version_page.links.sort_by do |link| if /\A(\d+\.\d+)\/\z/ =~ link.href $1.split(/\./).collect {|component| component.to_i} else [-1] end end.last escaped_package = Regexp.escape(package) latest_version_page = latest_version_link.click latest_version = latest_version_page.links.collect do |link| case link.href when /#{escaped_package}_([\d\.\-]+)_#{suffix}\.zip\z/, /#{escaped_package}-([\d\.\-]+)-#{suffix}\.zip\z/, # old /#{escaped_package}-([\d\.\-]+)\.zip\z/ # old version = $1 normalized_version = version.split(/[\.\-]/).collect do |component| component.to_i end [normalized_version, version] else [[-1], nil] end end.sort_by do |normalized_version, version| normalized_version end.last[1] if latest_version.nil? raise "can't find package: <#{package}>:<#{version_page_url}>" end escaped_latest_version = Regexp.escape(latest_version) latest_version_page.links.each do |link| case link.href when /#{escaped_package}(?:-dev)?_#{escaped_latest_version}_#{suffix}\.zip\z/, /#{escaped_package}(?:-dev)?-#{escaped_latest_version}-#{suffix}\.zip\z/, # old /#{escaped_package}(?:-dev)?-#{escaped_latest_version}\.zip\z/ # old click_zip_link(link) end end end def download_dependency(dependency) suffix = build_architecture_suffix dependency_version = "any" dependency_version_re = /[\d\.\-]+/ if dependency.is_a?(Array) dependency, dependency_version = dependency dependency_version_re = /#{Regexp.escape(dependency_version)}/ end escaped_dependency = Regexp.escape(dependency) dependencies_url = "#{URL_BASE}/dependencies" dependencies_page = agent.get(dependencies_url) latest_version = dependencies_page.links.collect do |link| case link.href when /\A#{escaped_dependency}_(#{dependency_version_re})_#{suffix}\.zip\z/ version = $1 [version.split(/[\.\-]/).collect {|component| component.to_i}, version] else [[-1], nil] end end.sort_by do |normalized_version, version| normalized_version end.last[1] if latest_version.nil? message = "can't find dependency package: " + "<#{dependency}>(#{dependency_version}):<#{dependencies_url}>" raise message end escaped_latest_version = Regexp.escape(latest_version) dependencies_page.links.each do |link| case link.href when /\A#{escaped_dependency}(?:-dev)?_#{escaped_latest_version}_#{suffix}\.zip\z/ click_zip_link(link) end end end private def agent @agent ||= Mechanize.new end def click_zip_link(link) zip = link.click Dir.chdir(dist_dir) do open(zip.filename, "wb") do |file| file.print(zip.body) end system("unzip", "-o", zip.filename) Dir.glob("lib/pkgconfig/*.pc") do |pc_path| pc = File.read(pc_path) pc = pc.gsub(/\Aprefix=.+$/) {"prefix=#{dist_dir}"} File.open(pc_path, "w") do |pc_file| pc_file.print(pc) end end end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/windows-binary-build-task.rb����������������������������0000644�0001750�0001750�00000021364�12446160551�024040� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright(C) 2012 Ruby-GNOME2 Project. # # This program is licenced under the same license of Ruby-GNOME2. require "open-uri" require "pathname" class GNOME2WindowsBinaryBuildTask include Rake::DSL def initialize(package) @package = package define end private def define namespace :windows do namespace :builder do task :before define_build_tasks build_tasks = build_packages.collect do |package| "windows:builder:build:#{package.name}" end task :build => build_tasks task :after end desc "Build Windows binaries" task :build => ["windows:builder:before", "windows:builder:build", "windows:builder:after"] end end def define_build_tasks namespace :build do prepare_task_names = [] namespace :prepare do prepare_task_names << "pkg_config" task :pkg_config do depended_packages = @package.windows.build_dependencies use_packages = [@package.name] + depended_packages pkg_config_path = use_packages.collect do |package| "../#{package}/#{@package.windows.relative_binary_dir}/lib/pkgconfig" end ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path| File.expand_path(path) end.join(":") ENV["PKG_CONFIG_LIBDIR"] = rcairo_windows_pkgconfig_path end prepare_task_names << "pkg_config_for_build" task :pkg_config_for_build do # XXX: Is it needless? # ENV["PKG_CONFIG_FOR_BUILD"] = "env - pkg-config" end end full_prepare_task_names = prepare_task_names.collect do |name| "windows:builder:build:prepare:#{name}" end task :prepare => full_prepare_task_names build_packages.each do |package| namespace package.name do task :before download_task = "source:downloader:download:#{package.name}" built_file = package.windows.built_file if built_file built_file = dist_dir + built_file file built_file.to_s do Rake::Task["windows:builder:build:prepare"].invoke Rake::Task[download_task].invoke build_package_task_body(package) end task :build => built_file.to_s else task :build => [:prepare, download_task] do build_package_task_body(package) end end task :after end prefix = "windows:builder:build:#{package.name}" desc "Build #{package.label} and install it into #{dist_dir}." task package.name => [ "#{prefix}:before", "#{prefix}:build", "#{prefix}:after", ] end end end def build_package_task_body(package) package_tmp_dir = @package.tmp_dir + "windows" + package.name rm_rf(package_tmp_dir) mkdir_p(package_tmp_dir) tar_full_path = @package.download_dir + package.archive_base_name Dir.chdir(package_tmp_dir.to_s) do sh("tar", "xf", tar_full_path.to_s) end package_dir_path = package_tmp_dir + package.base_name + package.base_dir_in_package Dir.chdir(package_dir_path.to_s) do package.windows.patches.each do |patch| sh("patch -p1 < #{@package.patches_dir}/#{patch}") end if File.exist?("configure") configure(package) else cmake(package) end common_make_args = [] common_make_args << "MAKE=make" common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas" if package.windows.use_cc_environment_variable? common_make_args << cc_env(package) end add_gobject_introspection_make_args(common_make_args) build_make_args = common_make_args.dup install_make_args = common_make_args.dup if package.windows.build_concurrently? make_n_jobs = ENV["MAKE_N_JOBS"] build_make_args << "-j#{make_n_jobs}" if make_n_jobs end ENV["GREP_OPTIONS"] = "--text" sh("nice", "make", *build_make_args) or exit(false) sh("make", "install", *install_make_args) or exit(false) package_license_dir = license_dir + package.name mkdir_p(package_license_dir) package_license_files = ["AUTHORS", "COPYING", "COPYING.LIB"] package_license_files = package_license_files.reject do |file| not File.exist?(file) end cp(package_license_files, package_license_dir) bundled_packages = package.bundled_packages bundled_packages.each do |bundled_package| bundled_package_license_dir = license_dir + bundled_package[:name] mkdir_p(bundled_package_license_dir) license_files = bundled_package[:license_files].collect do |file| File.join(bundled_package[:path], file) end cp(license_files, bundled_package_license_dir) end end end def configure(package) sh("./autogen.sh") if package.windows.need_autogen? sh("autoreconf --install") if package.windows.need_autoreconf? sh("./configure", cc_env(package), "CPPFLAGS=#{cppflags(package)}", "LDFLAGS=#{ldflags(package)}", "--prefix=#{dist_dir}", "--host=#{@package.windows.build_host}", *package.windows.configure_args) or exit(false) end def cmake(package) toolchain_cmake_path = "toolchain.cmake" File.open(toolchain_cmake_path, "w") do |toolchain| toolchain.puts(<<-CMAKE) SET(CMAKE_SYSTEM_NAME Windows) SET(MSVC_CXX_ARCHITECTURE_ID #{@package.windows.build_architecture}) SET(CMAKE_SYSTEM_PROCESSOR #{@package.windows.build_architecture}) SET(CMAKE_C_COMPILER #{@package.windows.build_host}-gcc) SET(CMAKE_CXX_COMPILER #{@package.windows.build_host}-g++) SET(CMAKE_RC_COMPILER #{@package.windows.build_host}-windres) SET(CMAKE_FIND_ROOT_PATH #{cmake_root_paths.join(" ")}) CMAKE end sh("cmake", ".", "-DCMAKE_TOOLCHAIN_FILE=#{toolchain_cmake_path}", *package.windows.cmake_args) or exit(false) end def cc_env(package) "CC=#{cc(package)}" end def build_packages packages = @package.external_packages.select do |package| package.windows.build? end # For backward compatibility packages + @package.windows.build_packages end def dist_dir @package.windows.absolute_binary_dir end def license_dir dist_dir + "share" + "license" end def glib2_binary_base_dir @package.glib2_root_dir + "vendor" + "local" end def glib2_include_path "#{glib2_binary_base_dir}/include" end def glib2_lib_path "#{glib2_binary_base_dir}/lib" end def rcairo_windows_dir suffix = @package.windows.build_architecture_suffix @package.project_root_dir.parent + "rcairo.#{suffix}" end def rcairo_windows_binary_base_dir rcairo_windows_dir + "vendor" + "local" end def rcairo_windows_pkgconfig_path "#{rcairo_windows_binary_base_dir}/lib/pkgconfig" end def rcairo_windows_include_path "#{rcairo_windows_binary_base_dir}/include" end def rcairo_windows_lib_path "#{rcairo_windows_binary_base_dir}/lib" end def cc(package) cc_command_line = [ "#{@package.windows.build_host}-gcc", *package.windows.cc_args, ] cc_command_line.compact.join(" ") end def cppflags(package) include_paths = package.windows.include_paths if @package.windows.build_dependencies.include?("glib2") include_paths += [glib2_include_path] end include_paths += [ rcairo_windows_include_path, dist_dir + 'include', ] cppflags = include_paths.collect do |path| "-I#{path}" end cppflags.join(" ") end def ldflags(package) library_paths = package.windows.library_paths if @package.windows.build_dependencies.include?("glib2") library_paths += [glib2_lib_path] end library_paths += [ rcairo_windows_lib_path, dist_dir + 'lib', ] ldflags = library_paths.collect do |path| "-L#{path}" end ldflags.join(" ") end def cmake_root_paths paths = [ "/usr/#{@package.windows.build_host}", rcairo_windows_binary_base_dir.to_path, ] @package.windows.build_dependencies.each do |package| paths << "#{@package.project_root_dir}/#{package}/vendor/local" end paths end def add_gobject_introspection_make_args(common_make_args) unless @package.windows.build_dependencies.include?("gobject-introspection") return end dependencies = [ "gobject-introspection", @package.name, ] dependencies += @package.windows.gobject_introspection_dependencies data_dirs = dependencies.collect do |package| "#{@package.project_root_dir}/#{package}/vendor/local/share" end common_make_args << "XDG_DATA_DIRS=#{data_dirs.join(File::PATH_SEPARATOR)}" end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/package-task.rb�����������������������������������������0000644�0001750�0001750�00000017776�12446177513�021404� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# coding: utf-8 # Copyright(C) 2011-2014 Ruby-GNOME2 Project. # # This program is licenced under the same license of Ruby-GNOME2. require "find" require "pathname" require "rubygems" require "rubygems/package_task" require "rake/extensiontask" require "gnome2/rake/package" require "gnome2/rake/external-package" require "gnome2/rake/source-download-task" require "gnome2/rake/native-binary-build-task" require "gnome2/rake/windows-binary-download-task" require "gnome2/rake/windows-binary-build-task" module GNOME2 module Rake class PackageTask include ::Rake::DSL attr_accessor :name, :summary, :description, :author, :email, :homepage, :required_ruby_version, :post_install_message attr_reader :root_dir def initialize initialize_variables initialize_configurations file, line, method = caller[1].scan(/^(.*):(\d+)(?::.*`(.*)')?\Z/).first @package = Package.new(File.dirname(file)) @packages = FileList["#{@package.root_dir.parent}/*"].map{|f| File.directory?(f) ? File.basename(f) : nil}.compact @name = @package.name @cross_compiling_hooks = [] yield(self) if block_given? end def cross_compiling(&block) @cross_compiling_hooks << block end def define task :default => :build define_spec define_source_tasks define_native_tasks define_windows_tasks define_package_tasks end # Deprecated. Use #define instead. def define_tasks define end def ruby_gnome2_package?(name) @packages.include?(name) end def dependency @dependency_configuration end def package @package end def windows @package.windows end def native @package.native end def version ENV["VERSION"] || guess_version end def guess_version versions = {} File.open("#{@package.glib2_root_dir}/ext/glib2/rbglib.h") do |rbglib_h| rbglib_h.each_line do |line| if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line versions[$1.downcase] = $2.to_i end end end ["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".") end def external_packages=(packages) @package.external_packages = packages end private def initialize_variables @summary = "" @description = "" @author = "The Ruby-GNOME2 Project Team" @email = "ruby-gnome2-devel-en@lists.sourceforge.net" @homepage = "http://ruby-gnome2.sourceforge.jp/" @external_packages = [] end def initialize_configurations @dependency_configuration = DependencyConfiguration.new(self) end def cross_platform "#{windows.build_architecture}-mingw32" end def define_spec @spec = Gem::Specification.new do |s| s.name = @name s.summary = @summary s.description = @description s.author = @author s.email = @email s.homepage = @homepage s.licenses = ["LGPLv2.1 or later"] s.version = version extensions = FileList["ext/#{@name}/extconf.rb"] extensions.existing! s.extensions = extensions s.require_paths = ["lib"] files = FileList["ChangeLog", "README", "Rakefile", "extconf.rb", "lib/**/*.rb", "ext/**/depend", "ext/**/*.{c,h,def,rb}", "{sample,test}/**/*"] files.existing! s.files = files s.required_ruby_version = @required_ruby_version || ">= 1.9.3" s.post_install_message = @post_install_message @dependency_configuration.apply(s) end end def define_source_tasks define_source_download_tasks end def define_source_download_tasks task = SourceDownloadTask.new(@package) task.define end def define_native_tasks define_native_build_tasks end def define_native_build_tasks task = NativeBinaryBuildTask.new(@package) task.define end def define_windows_tasks define_windows_extension_task define_windows_download_task define_windows_build_task end def so_base_name @name.gsub(/-/, "_") end def define_windows_extension_task ::Rake::ExtensionTask.new(so_base_name, @spec) do |ext| ext.cross_platform = cross_platform ext.ext_dir = "ext/#{@name}" ext.cross_compile = true ext.cross_compiling do |spec| if /mingw|mswin/ =~ spec.platform.to_s windows_binary_dir = @package.windows.relative_binary_dir windows_files = [] if windows_binary_dir.exist? Find.find(windows_binary_dir.to_s) do |path| next unless File.file?(path) next if /\.zip\z/ =~ path windows_files << path end end spec.files += windows_files stage_path = "#{ext.tmp_dir}/#{ext.cross_platform}/stage" windows_files.each do |windows_file| stage_windows_file = "#{stage_path}/#{windows_file}" stage_windows_binary_dir = File.dirname(stage_windows_file) directory stage_windows_binary_dir stage_windows_file_dependencies = [ stage_windows_binary_dir, windows_file, ] file stage_windows_file => stage_windows_file_dependencies do cp windows_file, stage_windows_file end end end @cross_compiling_hooks.each do |hook| hook.call(spec) end end end extconf_rb = "ext/#{@name}/extconf.rb" unless File.exist?(extconf_rb) native_task_name = "native:#{@name}:#{cross_platform}" if ::Rake::Task.task_defined?(native_task_name) ::Rake::Task[native_task_name].prerequisites.clear end end end def define_windows_download_task GNOME2WindowsBinaryDownloadTask.new(@package) end def define_windows_build_task GNOME2WindowsBinaryBuildTask.new(@package) end def define_package_tasks Gem::PackageTask.new(@spec) do |pkg| end end class DependencyConfiguration attr_accessor :platform, :ruby def initialize(package) @package = package @platform = Gem::Platform::RUBY @gem_configuration = GemConfiguration.new(@package) end def gem @gem_configuration end def apply(spec) spec.platform = @platform @gem_configuration.apply(spec) end class GemConfiguration attr_accessor :runtime, :development def initialize(package) @package = package @runtime = [] @development = [] end def apply(spec) @runtime.each do |dependency| spec.add_runtime_dependency(*append_version(dependency)) end @development.each do |dependency| spec.add_development_dependency(*append_version(dependency)) end end def append_version(dependency) name, *ver = dependency.is_a?(Array) ? dependency : [dependency] ver << "= #{@package.version}" if @package.ruby_gnome2_package?(name) [name, *ver] end end end end end end ��ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/external-package.rb�������������������������������������0000644�0001750�0001750�00000014135�12416346617�022246� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013 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 module GNOME2 module Rake class ExternalPackage < Struct.new(:name, :base_name, :archive_base_name, :label, :version, :download_site, :download_base_url, :compression_method, :base_dir_in_package, :windows, :native, :patches, :need_autogen, :need_autoreconf, :build_concurrently, :bundled_packages) def initialize(properties) super() properties.each do |key, value| send("#{key}=", value) end end def compression_method super || "gz" end def base_name super || "#{name}-#{version}" end def archive_base_name super || "#{base_name}.tar.#{compression_method}" end def archive_url "#{download_base_url}/#{archive_base_name}" end def download_base_url super || download_site_base_url end def patches super || [] end def need_autogen? need_autogen end def need_autoreconf? need_autoreconf end def base_dir_in_package super || "." end def windows super || WindowsConfiguration.new({}) end def windows=(properties) super(WindowsConfiguration.new(properties)) end def native super || NativeConfiguration.new({}) end def native=(properties) super(NativeConfiguration.new(properties)) end def bundled_packages super || [] end private def download_site_base_url case download_site when :gnome base_url = "http://ftp.gnome.org/pub/gnome/sources" release_series = version.gsub(/\A(\d+\.\d+)(?:[^\d].*)?\z/, '\1') base_url << "/#{name}/#{release_series}" when :gnu base_url = "http://ftp.gnu.org/pub/gnu/#{name}" else base_url = nil end base_url end class WindowsConfiguration < Struct.new(:build, :include_paths, :library_paths, :configure_args, :cmake_args, :cc_args, :patches, :built_file, :need_autogen, :need_autoreconf, :build_concurrently, :use_cc_environment_variable) def initialize(properties) super() properties.each do |key, value| send("#{key}=", value) end end def build? build.nil? ? true : build end def include_paths super || [] end def library_paths super || [] end def configure_args super || [] end def cmake_args super || [] end def cc_args super || [] end def patches super || [] end def built_file super || nil end def need_autogen? need_autogen.nil? ? false : need_autogen end def need_autoreconf? need_autoreconf.nil? ? false : need_autoreconf end def build_concurrently? build_concurrently.nil? ? true : build_concurrently end def use_cc_environment_variable? use_cc_environment_variable.nil? ? true : use_cc_environment_variable end end class NativeConfiguration < Struct.new(:build, :configure_args, :patches, :built_file, :need_autogen, :need_autoreconf, :build_concurrently) def initialize(properties) super() properties.each do |key, value| send("#{key}=", value) end end def build? build.nil? ? false : build end def configure_args super || [] end def patches super || [] end def built_file super || nil end def need_autogen? need_autogen.nil? ? false : need_autogen end def need_autoreconf? need_autoreconf.nil? ? false : need_autoreconf end def build_concurrently? build_concurrently.nil? ? true : build_concurrently end end end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/source-download-task.rb���������������������������������0000644�0001750�0001750�00000005074�12257552167�023104� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013 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 require "open-uri" require "pathname" require "rake" module GNOME2 module Rake class SourceDownloadTask include ::Rake::DSL def initialize(package) @package = package end def define namespace :source do namespace :downloader do task :before define_download_tasks download_tasks = @package.external_packages.collect do |package| "source:downloader:download:#{package.name}" end task :download => download_tasks task :after end desc "Dowanload sources" task :download => [ "source:downloader:before", "source:downloader:download", "source:downloader:after", ] end end def define_download_tasks namespace :download do @package.external_packages.each do |package| download_dir = @package.download_dir tar_full_path = download_dir + package.archive_base_name task :before task :after desc "Download #{package.label} into #{download_dir}." # task package[:name] => [:before, tar_full_path.to_s, :after] task package[:name] => tar_full_path.to_s directory_path = tar_full_path.dirname directory directory_path.to_s file tar_full_path.to_s => directory_path.to_s do archive_url = package.archive_url rake_output_message "Downloading... #{archive_url}" open(archive_url) do |downloaded_tar| tar_full_path.open("wb") do |tar_file| tar_file.print(downloaded_tar.read) end end end end end end end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/gnome2/rake/package.rb����������������������������������������������0000644�0001750�0001750�00000010305�12446160551�020413� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013-2014 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 require "pathname" module GNOME2 module Rake class Package attr_reader :name attr_reader :root_dir attr_reader :windows attr_reader :native attr_writer :external_packages def initialize(root_dir) @root_dir = Pathname.new(root_dir).expand_path @name = @root_dir.basename.to_s @windows = WindowsConfiguration.new @native = NativeConfiguration.new @external_packages = [] end def project_root_dir @root_dir.parent end def glib2_root_dir project_root_dir + "glib2" end def tmp_dir @root_dir + "tmp" end def download_dir tmp_dir + "download" end def patches_dir @root_dir + "patches" end def external_packages @external_packages.collect do |package| ExternalPackage.new(package) end end class WindowsConfiguration < Struct.new(:packages, :dependencies, :build_dependencies, :gobject_introspection_dependencies, :build_packages, :build_host) attr_reader :relative_binary_dir, :absolute_binary_dir def initialize super @relative_binary_dir = Pathname.new("vendor/local") @absolute_binary_dir = @relative_binary_dir.expand_path end def packages super || [] end def dependencies super || [] end def build_dependencies super || [] end def gobject_introspection_dependencies super || [] end def build_packages (super || []).collect do |package| package = package.dup package[:windows] = { :include_paths => package.delete(:include_paths), :library_paths => package.delete(:library_paths), :configure_args => package.delete(:configure_args), :patches => package.delete(:patches), :need_autogen => package.delete(:need_autogen), :need_autoreconf => package.delete(:need_autoreconf), } ExternalPackage.new(package) end end def build_host super || guess_build_host end def guess_build_host ENV["RUBY_GNOME2_BUILD_HOST"] || guess_build_host_from_architecture || "i686-w64-mingw32" end def guess_build_host_from_architecture case build_architecture when "x86" "i686-w64-mingw32" when "x64" "x86_64-w64-mingw32" else nil end end def build_architecture ENV["RUBY_GNOME2_BUILD_ARCHITECTURE"] || "x86" end def build_architecture_suffix case build_architecture when "x86" "win32" when "x64" "win64" end end end class NativeConfiguration attr_reader :relative_binary_dir, :absolute_binary_dir def initialize @relative_binary_dir = Pathname.new("tmp/native/local") @absolute_binary_dir = @relative_binary_dir.expand_path end end end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/glib2/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015360� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/glib2/deprecatable.rb�����������������������������������������������0000644�0001750�0001750�00000012503�12516434313�020321� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������module GLib module Deprecatable unless respond_to?(:define_singleton_method) def define_singleton_method(name, &block) singleton_class = class << self; self; end singleton_class.__send__(:define_method, name, &block) end end @@deprecated_const = {} def define_deprecated_const(deprecated_const, new_const = {}) @@deprecated_const[self] ||= {} @@deprecated_const[self][deprecated_const.to_sym] = new_const end def define_deprecated_enums(enums, prefix = nil) enums = module_eval(enums.to_s) rescue return enums.constants.each do |const| deprecated_const = prefix ? "#{prefix}_#{const}" : const new_const = [enums, const].join('::') define_deprecated_const(deprecated_const, new_const) end end alias :define_deprecated_flags :define_deprecated_enums def define_deprecated_singleton_method(deprecated_method, new_method = {}, &block) __define_deprecated_method__(:singleton, deprecated_method, new_method, &block) end def define_deprecated_method(deprecated_method, new_method = {}, &block) __define_deprecated_method__(:instance, deprecated_method, new_method, &block) end def define_deprecated_method_by_hash_args(deprecated_method, old_args, new_args, req_argc = 0, &block) klass = self alias_name = "__deprecatable_#{deprecated_method}__" alias_method alias_name, deprecated_method private alias_name define_method(deprecated_method) do |*margs, &mblock| if (margs.size == req_argc) || (margs.size == (req_argc + 1) && margs.last.is_a?(Hash)) else margs = block.call(self, *margs, &mblock) msg = "#{caller[0]}: '#{klass}##{deprecated_method}(#{old_args})' style has been deprecated." warn "#{msg} Use '#{klass}##{deprecated_method}(#{new_args})' style." end __send__(alias_name, *margs, &mblock) end end @@deprecated_signal = {} def define_deprecated_signal(deprecated_signal, new_signal = {}) @@deprecated_signal[self] ||= {} @@deprecated_signal[self][deprecated_signal.to_s.gsub('_', '-').to_sym] = new_signal end def self.extended(class_or_module) GLib::Instantiatable.class_eval do %w(signal_connect signal_connect_after).each do |connect_method| alias_name = "__deprecatable_#{connect_method}__" next if private_method_defined?(alias_name) alias_method alias_name, connect_method private alias_name define_method(connect_method) do |signal, *margs, &mblock| signal = signal.to_s.gsub('_', '-').to_sym signals = @@deprecated_signal[self] if new_signal = (signals || {})[signal] msg = "#{caller[0]}: '#{signal}' signal has been deprecated." case new_signal when String, Symbol warn "#{msg} Use '#{new_signal}' signal." signal = new_signal when Hash if new_signal[:raise] raise DeprecatedError.new("#{msg} #{new_signal[:raise]}") elsif new_signal[:warn] warn "#{msg} #{new_signal[:warn]}" else warn "#{msg} Don't use this signal anymore." end return end end __send__(alias_name, signal, *margs, &mblock) end end end end private def const_missing(deprecated_const) new_const = (@@deprecated_const[self] || {})[deprecated_const.to_sym] if new_const.nil? return super end msg = "#{caller[0]}: '#{[name, deprecated_const].join('::')}' has been deprecated." case new_const when String, Symbol new_const_val = constant_get(new_const) case new_const_val when GLib::Enum, GLib::Flags alt = " or ':#{new_const_val.nick.gsub('-', '_')}'" end warn "#{msg} Use '#{new_const}'#{alt}." return const_set(deprecated_const, new_const_val) when Hash if new_const[:raise] raise DeprecatedError.new("#{msg} #{new_const[:raise]}") elsif new_const[:warn] warn "#{msg} #{new_const[:warn]}" else warn "#{msg} Don't use this constant anymore." end return else super end end def constant_get(const) const.split('::').inject(Object){|r, c| r.const_get(c)} end def __define_deprecated_method__(type, deprecated_method, new_method = {}, &block) def_method = type == :singleton ? :define_singleton_method : :define_method sep = type == :singleton ? '.' : '#' klass = self __send__(def_method, deprecated_method) do |*margs, &mblock| msg = "#{caller[0]}: '#{klass}#{sep}#{deprecated_method}' has been deprecated." case new_method when String, Symbol warn "#{msg} Use '#{klass}#{sep}#{new_method}'." __send__(new_method, *margs, &mblock) when Hash if new_method[:raise] raise DeprecatedError.new("#{msg} #{new_method[:raise]}") elsif new_method[:warn] warn "#{msg} #{new_method[:warn]}" block.call(self, *margs, &mblock) if block end end end end end class DeprecatedError < RuntimeError end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/lib/glib2.rb������������������������������������������������������������0000644�0001750�0001750�00000012744�12257552167�015727� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # glib2.rb # Copyright(C) 2005-2010 Ruby-GNOME2 Project. # # This program is licenced under the same license of Ruby-GNOME2. require 'pathname' require 'English' require 'thread' require 'glib2/deprecatable' module GLib module_function def check_binding_version?(major, minor, micro) BINDING_VERSION[0] > major || (BINDING_VERSION[0] == major && BINDING_VERSION[1] > minor) || (BINDING_VERSION[0] == major && BINDING_VERSION[1] == minor && BINDING_VERSION[2] >= micro) end def exit_application(exception, status) msg = exception.message || exception.to_s msg = exception.class.to_s if msg == "" backtrace = exception.backtrace $stderr.puts backtrace.shift + ": #{msg}" backtrace.each do |v| $stderr.puts "\t from #{v}" end exit(status) end def __add_one_arg_setter(klass) # for Instance methods. method_names = klass.instance_methods(false) method_names.each do |method_name| next if /\Aset_/ !~ method_name property_name = $POSTMATCH next if klass.method_defined?("#{property_name}=") next if klass.instance_method(method_name).arity != 1 begin klass.module_eval("def #{property_name}=(val); set_#{property_name}(val); val; end\n") rescue SyntaxError if $DEBUG $stderr.puts "Couldn't create #{klass}\##{property_name}=(v)." end end end # for Class methods/Module functions. if klass.method(:methods).arity == -1 method_names = klass.methods(false) else method_names = klass.methods end singleton_klass = (class << klass; self; end) method_names.each do |method_name| next if /\Aset_/ !~ method_name property_name = $POSTMATCH next if singleton_klass.method_defined?("#{property_name}=") next if klass.method(method_name).arity != 1 begin klass.module_eval("def self.#{property_name}=(val); set_#{property_name}(val); val; end\n") rescue SyntaxError if $DEBUG $stderr.puts "Couldn't create #{klass}.#{property_name}=(v)." end end end end def prepend_path_to_environment_variable(path, environment_name) path = Pathname(path) unless path.is_a?(Pathname) if path.exist? separator = ::File::PATH_SEPARATOR paths = (ENV[environment_name] || '').split(/#{Regexp.escape(separator)}/) dir = path.to_s dir = dir.gsub(/\//, ::File::ALT_SEPARATOR) if ::File::ALT_SEPARATOR unless paths.include?(dir) paths = [dir] + paths ENV[environment_name] = paths.join(separator) end end end def prepend_dll_path(path) prepend_path_to_environment_variable(path, "PATH") end end base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" if vendor_dir.exist? require "cairo" end GLib.prepend_dll_path(vendor_dir + "bin") begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/glib2.so" rescue LoadError require 'glib2.so' end module GLib class Type def decendants [self] + children.map{|t| t.decendants }.flatten end def ancestors # ([self] + interfaces + (parent ? parent.ancestors : [])).reverse.uniq.reverse [self] + (parent ? parent.ancestors : []) end end class Enum def _dump(limit) Marshal.dump(to_i, limit) end def self._load(obj) new(Marshal.load(obj)) end end class Flags def _dump(limit) Marshal.dump(to_i, limit) end def self._load(obj) new(Marshal.load(obj)) end # FIXME def inspect values = self.class.values if values.find{|x| x == self } body = nick else a = values.select{|x| self >= x } a = a.reject{|x| a.find{|y| y > x } } body = a.empty? ? '{}' : a.map{|x| x.nick }.join('|') end format('#<%s %s>', self.class.inspect, body) end end module Log DOMAIN = "Ruby/GLib" LEVELS = { LEVEL_ERROR => "ERROR", LEVEL_CRITICAL => "CRITICAL", LEVEL_WARNING => "WARNING", LEVEL_MESSAGE => "MESSAGE", LEVEL_INFO => "INFO", LEVEL_DEBUG => "DEBUG" } module_function def error(str) log(DOMAIN, LEVEL_ERROR, caller(1)[0] << ": " << str) end def message(str) log(DOMAIN, LEVEL_MESSAGE, caller(1)[0] << ": " << str) end def critical(str) log(DOMAIN, LEVEL_CRITICAL, caller(1)[0] << ": " << str) end def warning(str) log(DOMAIN, LEVEL_WARNING, caller(1)[0] << ": " << str) end def set_log_domain(domain) level = GLib::Log::LEVEL_MASK if $DEBUG level = 255 elsif $VERBOSE level = 127 end GLib::Log.set_handler(domain, level) end end if const_defined?(:UserDirectory) class UserDirectory constants.each do |name| if /\ADIRECTORY_/ =~ name const_set($POSTMATCH, const_get(name)) end end end end LOG_DOMAIN = "GLib" class Object LOG_DOMAIN = "GLib-GObject" end class Thread LOG_DOMAIN = "GThread" end module Module LOG_DOMAIN = "GModule" end end GLib::Log.set_log_domain(nil) GLib::Log.set_log_domain(GLib::LOG_DOMAIN) GLib::Log.set_log_domain(GLib::Object::LOG_DOMAIN) GLib::Log.set_log_domain(GLib::Thread::LOG_DOMAIN) GLib::Log.set_log_domain(GLib::Module::LOG_DOMAIN) =begin Don't we need this? ObjectSpace.define_finalizer(GLib) { GLib::Log.cancel_handler puts "GLib::Log.cancel_handler was called." if $DEBUG } =end ����������������������������ruby-gnome2-all-2.2.5/glib2/README������������������������������������������������������������������0000644�0001750�0001750�00000001440�12257552167�014504� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Ruby/GLib2 ========== Ruby/GLib2 is a Ruby binding of GLib-2.12.x. Requirements ------------ Ruby >= 1.9.x: http://www.ruby-lang.org/ pkg-config.rb: http://github.com/rcairo/pkg-config GLib >= 2.12.x: http://www.gtk.org/ Install (RubyGems) ------------------ % sudo gem install glib2 Windows: > gem install glib2 --platform x86-mingw32 Install (traditional) --------------------- Install ruby-1.9.x or later, pkg-config.rb and GLib-2.12.x. % ruby extconf.rb % make % sudo make install Copying ------- Copyright (c) 2002-2010 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/�����������������������������������������������������������������0000755�0001750�0001750�00000000000�12126557022�015074� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/type-register.rb�������������������������������������������������0000755�0001750�0001750�00000005152�11701304107�020222� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin type-register.rb - Sample for GLib::Object You also need Ruby/GTK. Copyright (C) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 14:31:22 $ $Id: type-register.rb,v 1.9 2006/06/17 14:31:22 mutoh Exp $ =end require 'gtk2' class MyButton < Gtk::Button type_register def initialize(label = nil) # XXX: # When type_register() is used. # super is equivalent to GLib::Object#initialize. super("label" => label) @fuga = 0 end # override existing default handler of "clicked" signal. def signal_do_clicked(*args) puts "MyButton#signal_do_clicked enter" #p caller super puts "MyButton#signal_do_clicked leave" end # define new signal "hoge" signal_new("hoge", # name GLib::Signal::RUN_FIRST, # flags nil, # accumulator (XXX: not supported yet) nil, # return type (void == nil) Integer, Integer # parameter types ) # define default handler of "hoge" signal def signal_do_hoge(a, b) puts "MyButton#signal_do_hoge enter" #p caller puts "MyButton#signal_do_hoge leave" end # define new property "fuga" install_property(GLib::Param::Int.new("fuga", # name "Fuga", # nick "fuga hoge", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE | GLib::Param::WRITABLE)) # implementation of the property "fuga" def fuga puts "MyButton#fuga is called" @fuga end def fuga=(arg) puts "MyButton#fuga= is called" @fuga = arg notify("fuga") end end class MyButton2 < MyButton type_register("MyButton2") # override default handler of "clicked" signal def signal_do_clicked(*args) puts "MyButton2#signal_do_clicked enter" super(*args) puts "MyButton2#signal_do_clicked leave" end # override default handler of "hoge" signal def signal_do_hoge(a, b) puts "MyButton2#signal_do_hoge enter" puts "a, b = #{a}, #{b}" super puts "MyButton2#signal_do_hoge leave" end end b = MyButton2.new("Hello") p b p b.label p b.gtype b.clicked b.signal_emit("hoge", 1, 2) b.signal_connect("notify"){|obj, pspec| puts "#{b} notify #{pspec}" } p b.get_property("fuga") b.set_property("fuga", 1) p b.get_property("fuga") p MyButton2.ancestors ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/iochannel.rb�����������������������������������������������������0000644�0001750�0001750�00000001343�11701304107�017352� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin iochannel.rb - Sample for GLib::IOChannel. Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: iochannel.rb,v 1.3 2006/12/20 18:08:20 mutoh Exp $ =end require 'glib2' path = ARGV[0] || __FILE__ GLib::IOChannel.open(path) {|io| puts io.read } stdout = GLib::IOChannel.new(path, "r") stdout.add_watch(GLib::IOChannel::IN ) {|io, condition| puts "condition = #{condition}" false } context = GLib::MainContext.default mainloop = GLib::MainLoop.new(context, true) Thread.new{ num = 0 loop { num += 1 str = stdout.gets puts "line #{num}: #{str}" unless str mainloop.quit break end } } mainloop.run stdout.close ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/shell.rb���������������������������������������������������������0000644�0001750�0001750�00000001327�11701304107�016523� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin shell.rb - Sample for GLib::Shell Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: shell.rb,v 1.1 2005/10/14 19:10:07 mutoh Exp $ =end require 'glib2' cmd = "ls *.c *.o" p GLib::Shell.parse(cmd) puts quote = GLib::Shell.quote(cmd) puts GLib::Shell.unquote(quote) puts "----" #Samples to catch an Exception begin GLib::Shell.parse('foooo "bar') rescue GLib::ShellError => e puts "domain = #{e.domain}" puts "code = #{e.code}" puts "message = #{e.message}" end begin GLib::Shell.unquote('foooo "bar') rescue GLib::ShellError => e puts "domain = #{e.domain}" puts "code = #{e.code}" puts "message = #{e.message}" end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/idle.rb����������������������������������������������������������0000644�0001750�0001750�00000001227�11701304107�016330� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin idle.rb - Sample for GLib::Idle, GLib::MainLoop. Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Date: 2005/03/13 14:39:58 $ $Id: idle.rb,v 1.1 2005/03/13 14:39:58 mutoh Exp $ =end require 'glib2' mainloop = GLib::MainLoop.new(nil, true) i = 0 GLib::Idle.add { i += 1 p "timeout1-#{i}" if i > 9 mainloop.quit false # the source is removed. else true # continue ... end } j = 0 GLib::Idle.add { j += 1 p "timeout2-#{i}" if j > 9 mainloop.quit false # the source is removed. else true # continue ... end } mainloop.run p "quit..." �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/timeout2.rb������������������������������������������������������0000644�0001750�0001750�00000001157�11701304107�017165� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin timeout2.rb - Sample for GLib::Timeout, GLib::MainLoop. Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Date: 2005/03/13 15:43:32 $ $Id: timeout2.rb,v 1.2 2005/03/13 15:43:32 mutoh Exp $ =end require 'glib2' context = GLib::MainContext.new mainloop = GLib::MainLoop.new(context, true) source = GLib::Timeout.source_new(1000) i = 0 source.set_callback { i += 1 p "timeout2-#{i}" if i > 9 mainloop.quit false # the source is removed. else true # continue ... end } source.attach(context) mainloop.run p "quit..." �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/utils.rb���������������������������������������������������������0000644�0001750�0001750�00000003707�11701304107�016560� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin utils.rb - Sample for GLib module function produced by rbglib_utils.c Copyright (C) 2004 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2004/10/21 15:50:21 $ $Id: utils.rb,v 1.2 2004/10/21 15:50:21 mutoh Exp $ =end require 'glib2' if GLib.check_version?(2, 2, 0) GLib.application_name = "application name" puts "GLib.application_name = #{GLib.application_name}" end GLib.prgname = "program name" puts "GLib.prgname = #{GLib.prgname}" puts "GLib.getenv('HOME') = #{GLib.getenv('HOME')}" if GLib.check_version?(2, 4, 0) GLib.setenv("FOO", "foo") puts "GLib.getenv('FOO') = #{GLib.getenv('FOO')}" GLib.unsetenv("FOO") puts "GLib.getenv('FOO') = #{GLib.getenv('FOO')}" end puts "GLib.user_name = #{GLib.user_name}" puts "GLib.real_name = #{GLib.real_name}" puts "GLib.home_dir = #{GLib.home_dir}" puts "GLib.tmp_dir = #{GLib.tmp_dir}" puts "GLib.current_dir = #{GLib.current_dir}" puts "GLib.path_is_absolute?('./') = #{GLib.path_is_absolute?("./")}" puts "GLib.path_skip_root('/usr/local/bin/ruby') = #{GLib.path_skip_root('/usr/local/bin/ruby')}" puts "GLib.path_get_basename(GLib.home_dir) = #{GLib.path_get_basename(GLib.home_dir)}" puts "GLib.path_get_dirname(GLib.home_dir) = #{GLib.path_get_dirname(GLib.home_dir)}" puts "GLib.find_program_in_path(GLib.prgname) = #{GLib.find_program_in_path(GLib.prgname)}" puts "GLib.bit_nth_lsf(3, 1) = #{GLib.bit_nth_lsf(3, 1)}" puts "GLib.bit_nth_msf(3, 1) = #{GLib.bit_nth_msf(3, 1)}" puts "GLib.bit_storage(3) = #{GLib.bit_storage(3)}" puts "GLib.spaced_primes_closest(10) = #{GLib.spaced_primes_closest(10)}" keys = { "foo" => 1 << 0, "bar" => 1 << 1, "hoge" => 1 << 2, "fuga" => 1 << 3 } puts GLib.parse_debug_string("foo", keys) puts GLib.parse_debug_string("bar", keys) puts GLib.parse_debug_string("foo:bar:hoge", keys) puts GLib.parse_debug_string("foo:bar:hoge:fuga", keys) ���������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/keyfile.rb�������������������������������������������������������0000644�0001750�0001750�00000005246�11701304107�017050� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin keyfile.rb - Sample for GLib::KeyFile Copyright (C) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: keyfile.rb,v 1.2 2006/12/23 17:43:03 mutoh Exp $ =end require 'glib2' $KCODE = "U" # # Create a GLib::KeyFile # kf = GLib::KeyFile.new kf.set_value("Group 1", "value", "Hello World") kf.set_comment("Group 1", nil, "This file is generated by keyfile.rb") kf.set_string("Group 1", "string", "Hello World\nRuby-GNOME2") kf.set_locale_string("Group 1", "locale_string", "ja", "こんにちわ世界") kf.set_locale_string("Group 1", "locale_string", "en", "Hello World") kf.set_boolean("Group 1", "boolean", true) kf.set_integer("Group 1", "integer", 1) kf.set_double("Group 1", "double", 1.0) kf.set_string_list("Group 2", "string_list", ["foo", "bar"]) kf.set_locale_string_list("Group 2", "locale_string_list", "ja", ["こんにちわ", "世界"]) kf.set_locale_string_list("Group 2", "locale_string_list", "en", ["Hellow", "World"]) kf.set_boolean_list("Group 2", "boolean_list", [true, false]) kf.set_integer_list("Group 2", "integer_list", [1, 2, 3]) kf.set_double_list("Group 2", "double_list", [1.2, 1.3, 1.45]) kf.set_comment("Group 2", "string_list", "comment of string_list") # Save as "keyfile.ini" File.open("keyfile.ini", "w") do |out| out.write kf.to_data end #kf.remove_comment("Group 2", "string_list") #kf.remove_key("Group 2", "string_list") #kf.remove_group("Group 2") # # Load from "keyfile.ini" # kf2 = GLib::KeyFile.new kf2.load_from_file("keyfile.ini") puts "Group 1: value = #{kf2.get_value("Group 1", "value")}" puts "Group 1: string = #{kf2.get_string("Group 1", "string")}" puts "Group 1: locale_string[ja] = #{kf2.get_locale_string("Group 1", "locale_string", "ja")}" puts "Group 1: locale_string[en] = #{kf2.get_locale_string("Group 1", "locale_string", "en")}" puts "Group 1: boolean = #{kf2.get_boolean("Group 1", "boolean")}" puts "Group 1: integer = #{kf2.get_integer("Group 1", "integer")}" puts "Group 1: double = #{kf2.get_double("Group 1", "double")}" puts "Group 2: string_list = #{kf2.get_string_list("Group 2", "string_list").inspect}" puts "Group 2: locale_string_list[ja] = #{kf2.get_locale_string_list("Group 2", "locale_string_list", "ja").inspect}" puts "Group 2: locale_string_list[en] = #{kf2.get_locale_string_list("Group 2", "locale_string_list", "en").inspect}" puts "Group 2: boolean_list = #{kf2.get_boolean_list("Group 2", "boolean_list").inspect}" puts "Group 2: integer_list = #{kf2.get_integer_list("Group 2", "integer_list").inspect}" puts "Group 2: double_list = #{kf2.get_double_list("Group 2", "double_list").inspect}" puts "Group 2: comment = #{kf2.get_comment("Group 2", "string_list")}" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/timer.rb���������������������������������������������������������0000644�0001750�0001750�00000001524�11701304107�016533� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin timer.rb - Sample for GLib::Timer Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: timer.rb,v 1.1 2005/10/14 19:48:41 mutoh Exp $ =end require 'glib2' timer = GLib::Timer.new timer.start puts "start (status = running) : #{timer.elapsed}" sleep(3) puts "after 3 sec (status = running) : #{timer.elapsed}" sleep(3) puts "after 3 sec (status = running) : #{timer.elapsed}" timer.stop puts "stop (status = stoped) : #{timer.elapsed}" sleep(3) puts "after 3 sec (status = stoped) : #{timer.elapsed}" timer.continue puts "continue (status = running) : #{timer.elapsed}" sleep(3) puts "after 3 sec (status = running) : #{timer.elapsed}" timer.reset puts "reset (status = running) : #{timer.elapsed}" sleep(3) puts "after 3 sec (status = running) : #{timer.elapsed}" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/type-register2.rb������������������������������������������������0000755�0001750�0001750�00000005201�11701304107�020277� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin type-register2.rb - Sample for GLib::Object You also need Ruby/GTK. Copyright (C) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 14:31:22 $ $Id: type-register2.rb,v 1.3 2006/06/17 14:31:22 mutoh Exp $ =end require 'gtk2' class MyButton < Gtk::Button type_register def initialize(label = nil) # XXX: # When type_register() is used. # super is equivalent to GLib::Object#initialize. super("label" => label) @fuga = 0 end # override existing default handler of "clicked" signal. def signal_do_clicked(*args) puts "MyButton#signal_do_clicked enter" #p caller super puts "MyButton#signal_do_clicked leave" end # define new signal "hoge" signal_new("hoge", # name GLib::Signal::RUN_FIRST, # flags nil, # accumulator (XXX: not supported yet) GLib::Type["void"], # return type GLib::Type["gint"], GLib::Type["gint"] # parameter types ) # define default handler of "hoge" signal def signal_do_hoge(a, b) puts "MyButton#signal_do_hoge enter" #p caller puts "MyButton#signal_do_hoge leave" end # define new property "fuga" install_property(GLib::Param::Int.new("fuga", # name "Fuga", # nick "fuga hoge", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE | GLib::Param::WRITABLE)) # implementation of the property "fuga" def fuga puts "MyButton#fuga is called" @fuga end def fuga=(arg) puts "MyButton#fuga= is called" @fuga = arg notify("fuga") end end class MyButton2 < MyButton type_register("MyButton2") # override default handler of "clicked" signal def signal_do_clicked(*args) puts "MyButton2#signal_do_clicked enter" super(*args) puts "MyButton2#signal_do_clicked leave" end # override default handler of "hoge" signal def signal_do_hoge(a, b) puts "MyButton2#signal_do_hoge enter" puts "a, b = #{a}, #{b}" #p caller super puts "MyButton2#signal_do_hoge leave" end end b = MyButton2.new("Hello") p b p b.label p b.gtype b.clicked b.signal_emit("hoge", 1, 2) b.signal_connect("notify"){|obj, pspec| puts "#{b} notify #{pspec}" } p b.get_property("fuga") b.set_property("fuga", 1) p b.get_property("fuga") p MyButton2.ancestors �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/timeout.rb�������������������������������������������������������0000644�0001750�0001750�00000000753�11701304107�017104� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin timeout.rb - Sample for GLib::Timeout, GLib::MainLoop. Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: timeout.rb,v 1.2 2005/07/14 17:05:22 mutoh Exp $ =end require 'glib2' mainloop = GLib::MainLoop.new(nil, true) i = 0 GLib::Timeout.add(1000) { i += 1 p "timeout-#{i}" if i > 9 mainloop.quit false # the source is removed. else true # continue ... end } mainloop.run p "quit..." ���������������������ruby-gnome2-all-2.2.5/glib2/sample/bookmarkfile.rb��������������������������������������������������0000644�0001750�0001750�00000003565�11701304107�020067� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin bookmarkfile.rb - Sample for GLib::BookmarkFile Copyright (C) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: bookmarkfile.rb,v 1.1 2006/12/26 09:59:51 mutoh Exp $ =end require 'glib2' $KCODE = "U" # # Create bookmarkfile data. # URI = "http://ruby-gnome2.sourceforge.jp/" bf = GLib::BookmarkFile.new bf.set_title(URI, "Ruby-GNOME2 sample") bf.set_description(URI, "Ruby-GNOME2 Sampe for GLib::BookmarkFile") bf.set_mime_type(URI, "text/html") bf.set_private(URI, false) bf.set_icon(URI, "http://ruby-gnome2.sourceforge.jp/logo-gy.png", "image/png") bf.set_added(URI, Time.now) bf.set_modified(URI, Time.now) bf.set_visited(URI, Time.now) bf.set_groups(URI, ["Ruby", "GTK+"]) bf.set_app_info(URI, "WWW Browser", "firefox %u", 1, Time.now) bf.add_group(URI, "GNOME") bf.add_application(URI, "Ruby VM", "ruby %u") #bf.remove_group(URI, "GTK+") #bf.remove_application(URI, "Ruby VM") #bf.remove_item(URI) #bf.move_item(URI, "http://gtk.org/") # Save as "bookmarkfile.xml" bf.to_file("bookmarkfile.xml") # # Load from "bookmarkfile.xml" # bf2 = GLib::BookmarkFile.new bf2.load_from_file("bookmarkfile.xml") puts "size = #{bf2.size}" puts "uris = #{bf2.uris.inspect}" bf2.uris.each do |uri| puts "uri: [#{uri}]" puts " * title: [#{bf2.get_title(uri)}]" puts " * description: [#{bf2.get_description(uri)}]" puts " * mime_type: [#{bf2.get_mime_type(uri)}]" puts " * private?: [#{bf2.private?(uri)}]" puts " * icon: [#{bf2.get_icon(uri).inspect}]" puts " * added: [#{bf2.get_added(uri)}]" puts " * modified: [#{bf2.get_modified(uri)}]" puts " * visited: [#{bf2.get_visited(uri)}]" puts " * groups: #{bf2.get_groups(uri).inspect}" puts " * applications: #{bf2.get_applications(uri).inspect}" begin puts " * app_info: #{bf2.get_app_info(uri, "WWW Browser").inspect}" rescue puts $! end puts end �������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/sample/spawn.rb���������������������������������������������������������0000644�0001750�0001750�00000001053�11701304107�016540� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin spawn.rb - Sample for GLib::Spawn Copyright (C) 2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Date: 2005/10/14 19:10:07 $ $Id: spawn.rb,v 1.3 2005/10/14 19:10:07 mutoh Exp $ =end require 'glib2' p GLib::Spawn.command_line_sync("ls") puts "---" #Here is an example to catch GLib::SpawnError. begin p GLib::Spawn.command_line_sync("nonexist_app") rescue => e puts "class = #{e.class}" puts "domain = #{e.domain}" puts "code = #{e.code}" puts "message = #{e.message}" end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/Makefile.lib������������������������������������������������������������0000644�0001750�0001750�00000022424�12446173027�016030� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� SHELL = /bin/sh # V=0 quiet, V=1 verbose. other values don't work. V = 0 Q1 = $(V:1=) Q = $(Q1:0=@) ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### srcdir = /home/kou/work/ruby/ruby-gnome2.clean/glib2 topdir = /usr/include/ruby-2.1.0 hdrdir = $(topdir) arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0 PATH_SEPARATOR = : VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby prefix = $(DESTDIR)/usr rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME) rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME) rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) exec_prefix = $(prefix) vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME) vendorhdrdir = $(rubyhdrdir)/vendor_ruby sitehdrdir = $(rubyhdrdir)/site_ruby rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version) vendorlibdir = $(vendordir)/$(ruby_version) vendordir = $(rubylibprefix)/vendor_ruby sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby sitelibdir = $(sitedir)/$(ruby_version) sitedir = $(DESTDIR)/usr/local/lib/site_ruby rubyarchdir = $(rubyarchprefix)/$(ruby_version) rubylibdir = $(rubylibprefix)/$(ruby_version) sitearchincludedir = $(includedir)/$(sitearch) archincludedir = $(includedir)/$(arch) sitearchlibdir = $(libdir)/$(sitearch) archlibdir = $(libdir)/$(arch) ridir = $(datarootdir)/$(RI_BASE_NAME) mandir = $(prefix)/share/man localedir = $(datarootdir)/locale libdir = $(exec_prefix)/lib psdir = $(docdir) pdfdir = $(docdir) dvidir = $(docdir) htmldir = $(docdir) infodir = $(prefix)/share/info docdir = $(datarootdir)/doc/$(PACKAGE) oldincludedir = $(DESTDIR)/usr/include includedir = $(prefix)/include localstatedir = $(DESTDIR)/var sharedstatedir = $(prefix)/com sysconfdir = $(DESTDIR)/etc datadir = $(datarootdir) datarootdir = $(prefix)/share libexecdir = $(prefix)/lib/ruby2.1 sbindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/bin archdir = $(rubyarchdir) CC = gcc CXX = g++ LIBRUBY = $(LIBRUBY_SO) LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static empty = OUTFLAG = -o $(empty) COUTFLAG = -o $(empty) RUBY_EXTCONF_H = cflags = $(optflags) $(debugflags) $(warnflags) optflags = -O3 -fno-fast-math debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration CCDLFLAGS = -fPIC CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC $(ARCH_FLAG) INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) DEFS = CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags) CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG) ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic dldflags = ARCH_FLAG = DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) LDSHARED = $(CC) -shared LDSHAREDXX = $(CXX) -shared AR = ar EXEEXT = RUBY_INSTALL_NAME = ruby2.1 RUBY_SO_NAME = ruby-2.1 RUBYW_INSTALL_NAME = RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) RUBYW_BASE_NAME = rubyw RUBY_BASE_NAME = ruby arch = x86_64-linux-gnu sitearch = $(arch) ruby_version = 2.1.0 ruby = $(bindir)/ruby2.1 RUBY = $(ruby) ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h RM = rm -f RM_RF = $(RUBY) -run -e rm -- -rf RMDIRS = rmdir --ignore-fail-on-non-empty -p MAKEDIRS = /bin/mkdir -p INSTALL = /usr/bin/install -c INSTALL_PROG = $(INSTALL) -m 0755 INSTALL_DATA = $(INSTALL) -m 644 COPY = cp TOUCH = exit > #### End of system configuration section. #### preload = libpath = . $(archlibdir) LIBPATH = -L. -L$(archlibdir) DEFFILE = CLEANFILES = mkmf.log DISTCLEANFILES = DISTCLEANDIRS = extout = extout_prefix = target_prefix = LOCAL_LIBS = LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc ORIG_SRCS = SRCS = $(ORIG_SRCS) OBJS = HDRS = TARGET = TARGET_NAME = TARGET_ENTRY = Init_$(TARGET_NAME) DLLIB = EXTSTATIC = STATIC_LIB = TIMESTAMP_DIR = . BINDIR = $(bindir) RUBYCOMMONDIR = $(sitedir)$(target_prefix) RUBYLIBDIR = $(sitelibdir)$(target_prefix) RUBYARCHDIR = $(sitearchdir)$(target_prefix) HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) TARGET_SO = $(DLLIB) CLEANLIBS = $(TARGET).so CLEANOBJS = *.o *.bak all: Makefile static: $(STATIC_LIB) .PHONY: all install static install-so install-rb .PHONY: clean clean-so clean-static clean-rb clean-static:: clean-rb-default:: clean-rb:: clean-so:: clean: clean-so clean-static clean-rb-default clean-rb -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time distclean-rb-default:: distclean-rb:: distclean-so:: distclean-static:: distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true realclean: distclean install: install-so install-rb install-so: Makefile install-rb: pre-install-rb install-rb-default install-rb-default: pre-install-rb-default pre-install-rb: Makefile pre-install-rb-default: Makefile pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.time install-rb-default: $(RUBYLIBDIR)/gnome2-raketask.rb $(RUBYLIBDIR)/gnome2-raketask.rb: $(srcdir)/lib/gnome2-raketask.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2-raketask.rb $(@D) install-rb-default: $(RUBYLIBDIR)/mkmf-gnome2.rb $(RUBYLIBDIR)/mkmf-gnome2.rb: $(srcdir)/lib/mkmf-gnome2.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/mkmf-gnome2.rb $(@D) install-rb-default: $(RUBYLIBDIR)/glib-mkenums.rb $(RUBYLIBDIR)/glib-mkenums.rb: $(srcdir)/lib/glib-mkenums.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/glib-mkenums.rb $(@D) install-rb-default: $(RUBYLIBDIR)/glib2.rb $(RUBYLIBDIR)/glib2.rb: $(srcdir)/lib/glib2.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/glib2.rb $(@D) pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time install-rb-default: $(RUBYLIBDIR)/gnome2/rake/native-binary-build-task.rb $(RUBYLIBDIR)/gnome2/rake/native-binary-build-task.rb: $(srcdir)/lib/gnome2/rake/native-binary-build-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/native-binary-build-task.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gnome2/rake/windows-binary-download-task.rb $(RUBYLIBDIR)/gnome2/rake/windows-binary-download-task.rb: $(srcdir)/lib/gnome2/rake/windows-binary-download-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/windows-binary-download-task.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gnome2/rake/windows-binary-build-task.rb $(RUBYLIBDIR)/gnome2/rake/windows-binary-build-task.rb: $(srcdir)/lib/gnome2/rake/windows-binary-build-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/windows-binary-build-task.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gnome2/rake/package-task.rb $(RUBYLIBDIR)/gnome2/rake/package-task.rb: $(srcdir)/lib/gnome2/rake/package-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/package-task.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gnome2/rake/external-package.rb $(RUBYLIBDIR)/gnome2/rake/external-package.rb: $(srcdir)/lib/gnome2/rake/external-package.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/external-package.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gnome2/rake/source-download-task.rb $(RUBYLIBDIR)/gnome2/rake/source-download-task.rb: $(srcdir)/lib/gnome2/rake/source-download-task.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/source-download-task.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gnome2/rake/package.rb $(RUBYLIBDIR)/gnome2/rake/package.rb: $(srcdir)/lib/gnome2/rake/package.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gnome2/rake/package.rb $(@D) pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.glib2.time install-rb-default: $(RUBYLIBDIR)/glib2/deprecatable.rb $(RUBYLIBDIR)/glib2/deprecatable.rb: $(srcdir)/lib/glib2/deprecatable.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.glib2.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/glib2/deprecatable.rb $(@D) pre-install-rb-default: $(ECHO) installing default libraries $(TIMESTAMP_DIR)/.RUBYLIBDIR.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR) $(Q) $(TOUCH) $@ $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gnome2.-.rake.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/gnome2/rake $(Q) $(TOUCH) $@ $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.glib2.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/glib2 $(Q) $(TOUCH) $@ site-install: site-install-so site-install-rb site-install-so: install-so site-install-rb: install-rb ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/Makefile����������������������������������������������������������������0000644�0001750�0001750�00000000625�12446173027�015262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������all: (cd ext/glib2 && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/glib2 && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/glib2 && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/glib2 && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/glib2 && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib �����������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/patches/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12257552167�015254� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/glib2/patches/glib-2.38.2-add-missing-exeext.diff�����������������������������0000644�0001750�0001750�00000002002�12257552167�023242� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru glib-2.38.2.orig/gio/tests/Makefile.am glib-2.38.2/gio/tests/Makefile.am --- glib-2.38.2.orig/gio/tests/Makefile.am 2013-11-12 14:30:22.000000000 +0900 +++ glib-2.38.2/gio/tests/Makefile.am 2013-12-23 15:13:59.328468099 +0900 @@ -431,7 +431,7 @@ if CROSS_COMPILING glib_compile_resources=$(GLIB_COMPILE_RESOURCES) else - glib_compile_resources=$(top_builddir)/gio/glib-compile-resources + glib_compile_resources=$(top_builddir)/gio/glib-compile-resources$(EXEEXT) endif resources.o: test_resources2.h diff -ru glib-2.38.2.orig/tests/gobject/Makefile.am glib-2.38.2/tests/gobject/Makefile.am --- glib-2.38.2.orig/tests/gobject/Makefile.am 2013-11-08 00:29:13.000000000 +0900 +++ glib-2.38.2/tests/gobject/Makefile.am 2013-12-23 15:12:21.190876890 +0900 @@ -51,7 +51,7 @@ if CROSS_COMPILING glib_genmarshal=$(GLIB_GENMARSHAL) else - glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal + glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal$(EXEEXT) endif testmarshal.h: stamp-testmarshal.h ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�016262� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/test/�������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�017244� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/test/run-test.rb��������������������������������������������0000755�0001750�0001750�00000004440�12516434313�021357� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2013-2014 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 have_make = system("which make > /dev/null") ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") clutter_base = File.join(ruby_gnome2_base, "clutter") gstreamer_base = File.join(ruby_gnome2_base, "gstreamer") clutter_gstreamer_base = File.join(ruby_gnome2_base, "clutter-gstreamer") modules = [ [glib_base, "glib2"], [cairo_gobject_base, "cairo-gobject"], [gobject_introspection_base, "gobject-introspection"], [clutter_base, "clutter"], [gstreamer_base, "gstreamer"], [clutter_gstreamer_base, "clutter-gst"], ] modules.each do |target, module_name| if File.exist?(File.join(target, "Makefile")) and have_make `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $VERBOSE = false # TODO: remove me $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" $LOAD_PATH.unshift(File.join(clutter_base, "test")) require "clutter-test-utils" $LOAD_PATH.unshift(File.join(clutter_gstreamer_base, "test")) require "clutter-gstreamer-test-utils" require "clutter-gst" exit Test::Unit::AutoRunner.run(true) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/test/test-clutter-gst.rb������������������������������������0000644�0001750�0001750�00000001713�12516434313�023025� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013-2014 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 class ClutterGstTest < Test::Unit::TestCase include ClutterGStreamerTestUtils def test_init omit_on_travis_ci assert_nothing_raised do ClutterGst.init end end end �����������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb������������������������0000644�0001750�0001750�00000002640�12416346617�025367� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013-2014 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 require "test-unit" require "test/unit/notify" module ClutterGStreamerTestUtils def later_version?(major, minor, micro=nil) micro ||= 0 clutter_gstreamer_version = [ ClutterGst::MAJOR_VERSION, ClutterGst::MINOR_VERSION, ClutterGst::MICRO_VERSION, ] (clutter_gstreamer_version <=> [major, minor, micro]) >= 0 end def only_clutter_gstreamer_version(major, minor, micro=nil) micro ||= 0 unless later_version?(major, minor, micro) omit("Require Clutter-GStreamer >= #{major}.#{minor}.#{micro}") end end def omit_on_travis_ci omit("This test can't be run on Travis CI") if ENV["CI"] end end ������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/Rakefile����������������������������������������������������0000644�0001750�0001750�00000004174�12446237364�017751� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013-2014 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/ClutterGStreamer is a Ruby binding of Clutter-GStreamer." package.description = "Ruby/ClutterGStreamer is a Ruby binding of Clutter-GStreamer." package.dependency.gem.runtime = ["gdk_pixbuf2", "clutter", "gstreamer"] package.dependency.gem.development = ["test-unit-notify"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "gdk_pixbuf2", "atk", "pango", "gobject-introspection", "clutter", "gstreamer", ] package.windows.gobject_introspection_dependencies = [ "atk", "pango", "gdk_pixbuf2", "clutter", "gstreamer", ] package.external_packages = [ { :name => "clutter-gst", :download_site => :gnome, :label => "Clutter-GStreamer", :version => "3.0.0", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :built_file => "bin/libclutter-gst-3.0-0.dll", }, } ] end package_task.define namespace :dependency do desc "Install depenencies" task :install do # TODO: Install gir1.2-clutter-gst-1.0 on Debian. end end task :build => "dependency:install" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/README.md���������������������������������������������������0000644�0001750�0001750�00000001456�12147676243�017564� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/ClutterGStreamer Ruby/ClutterGStreamer is a Ruby binding of Clutter-GStreamer. ## Requirements * Ruby/Clutter and Ruby/GStreamer in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [Clutter-GStreamer](http://blogs.gnome.org/clutter/) ## Install gem install clutter-gstreamer ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ### Exceptions Ruby scripts and image files in sample/ are ported and copied from Clutter. Headers in samples/*.rb describes that the location of the original file of the Ruby script and image files. The original files are licensed under the LGPL v2.1 or later. ## Project Website http://ruby-gnome2.sourceforge.jp/ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/COPYING.LIB�������������������������������������������������0000644�0001750�0001750�00000063642�12147676243�017752� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/lib/��������������������������������������������������������0000755�0001750�0001750�00000000000�12446237546�017046� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/lib/clutter-gstreamer.rb������������������������������������0000644�0001750�0001750�00000001440�12416346617�023040� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 require "clutter-gst" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/lib/clutter-gst.rb������������������������������������������0000644�0001750�0001750�00000004507�12446237546�021656� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013-2014 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 require "gdk_pixbuf2" require "clutter" require "gst" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) module ClutterGst LOG_DOMAIN = "Clutter-GStreamer" GLib::Log.set_log_domain(LOG_DOMAIN) class << self def const_missing(name) init if const_defined?(name) const_get(name) else super end end def init(argv=[]) class << self remove_method(:init) remove_method(:const_missing) end Gst.init if Gst.respond_to?(:init) Clutter.init if Clutter.respond_to?(:init) loader = Loader.new(self, argv) loader.load("ClutterGst") end end class Loader < GObjectIntrospection::Loader class InitError < StandardError end def initialize(base_module, init_arguments) super(base_module) @init_arguments = init_arguments end private def pre_load(repository, namespace) init = repository.find(namespace, "init") arguments = [ [$0] + @init_arguments, ] error, returned_arguments = init.invoke(:arguments => arguments) @init_arguments.replace(returned_arguments[1..-1]) if error.to_i <= 0 raise InitError, "failed to initialize Clutter-GStreamer: #{error.name}" end end def post_load(repository, namespace) end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/�����������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�017556� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/media-actions-start.png������������������������������0000644�0001750�0001750�00000005754�12257552167�024151� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���)���0���S���sRGB����bKGD������ pHYs�� �� ����tIME1GI �� lIDATX͙kpיe5#[f HDd@ؑN&6l*ZmW#SVdXg1]LBj7ةd2f/Ƌ(A4=}Η3#q $੒z5{Ki�b�jh��KP@ �\hk_qߒ%M_c&&&�*Ȋŋ4ͻ_ϟ_dF�7Raf***]ܰh;VnP@U �`f|]?嶶E?5Z `QҡiZr-d&[ <88<ڄigR9�vUFAb2ԸVwz:ArK#'+ï Fdž֯Ʈgw]UimG/[5+]W%sNRI03r, +la͚(y{GGFLfc]]h4:06vn< _H)AD "H)s|k5E6'҇rU\"?`0^Vh;?+++в--a-Z*y)Xf蚁U+L΍S]3?HćG @@ $7u0:;:}}d2 92SSy"*�D"?4D-uB9 b H%1�{N>0VLUUոyPȶ,+kfA'ϯ*Bf,<s7qno!H)w޾|eUSiX,?88(TCVUU%x%7oA*Y Ղ2nށ!щ'揎 B3˲Rjzhhd×ODHm:P@$@DD qa03UVΣ?zjjkԩJOWKhadfYQQQQ[[ ]1azC`A9 �1Gy!҃:P5k8ɓml!i0,X �ݍR �C\0 k9YҦM3WZD"Q;PVV[UnݺkذaCId2p]ڂ|+.X\N=A�6RbvᶥԩӕMꏖE H477+4Ge�Sә塔r%fyPPR"f15hjXB]]]\S]R cD"N&8r䈣utv$R9dBA@�K(`V<us]x)=HJ!w19hf!=1=by6;QJh"Q9bFUmCjs߰xg +H13/PD.^;(_{ܺp!mz33vt ,+)D~"1# !fͣ~bPJA5rX2'Ӽ}6>*Yu<0tCӢyިnlhMfw!ۅG%Q+ՁF]"d.YfF4E4�>p`?mݾ4ɲ>e23;R{LmC4@ ?kEP_̂ fCra8c_G AuHصk'y͜{ccSmw=22P(4OO> =B9J *Di [1]h9ef! a[?)+{w[ZVC!95IQ�O,ݜ(]J(u_D+@g{0`&gs쀮ӉD7? 1 `hƍݻw�Ch!\JJ,Rae3 t�_~ {>OoL%XOwv8#,]vmpM6]ԻuێAD1ékVXK'>~a0 !oG:{,tx#뺟\uuOO뺞Zz^tww_rcxR\b# 0# ޳9/i .|⫏?z봩rmy{!>|+V, �Q; F(sZF)_� &04M@Jɽ/ҿHkjky-;,px̲jkH&W5mCD ) X|0A4")Iö_|KOݶdRԌi窫%�8qW !p,(FB$CJ%%]166+<,:>W ph8 ٔc�@� ٟ̃@�BhLPl@SS/=XBQ�i"l6 ˲GZRhap`=nV ш �x+sr7o޶o};9KD#�T9EH' Dy㭷Nc 7zѨoqf3s !^� pV ϧ}{Gȓ/}=a"c4B&fyR1bv9c˿yKRITUUǿИ9GDCD|M.J'oW�ƛGg?߇3N<_޻;m+,29/ n� �CC¾=t)]]gxSojBSlB wޭ,%u_ l}ǿȣ?gf-P+ODuwkؿgDO}~И`<M] RԾDuv;)f %RMD�Hf6A(`H.R2mFDy�)"Q\ "Jg�>#w����IENDB`��������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/video-sink-navigation.rb�����������������������������0000755�0001750�0001750�00000006033�12416346617�024315� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gst/examples/video-sink-navigation.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # The original header: # video-sink.c - A small example around the videotestsrc ! capsfilter ! # navigationtest ! videoconvert ! cluttersink pipeline. # # Copyright (C) 2007,2008 OpenedHand # # Copyright (C) 2013-2014 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 require "clutter-gst" stage = Clutter::Stage.new stage.user_resizable = true stage.signal_connect("destroy") do Clutter.main_quit end # Make a timeline timeline = Clutter::Timeline.new(1000) timeline.loop = true # We need to set certain props on the target texture currently for # efficient/correct playback onto the texture (which sucks a bit) texture = Clutter::Texture.new # NOTE: Because warning is given, I comment out. #texture.set_property("disable-slicing", true) texture.signal_connect("size-change") do |texture, width, height| stage = texture.stage next if stage.nil? # go out of the block if stage is nil stage_width, stage_height = stage.size new_height = (height * stage_width) / width if new_height <= stage_height new_width = stage_width new_x = 0 new_y = (stage_height - new_height) / 2 else new_width = (width * stage_height) / height new_height = stage_height new_x = (stage_width - new_width) / 2 new_y = 0 end texture.set_position(new_x, new_y) texture.set_size(new_width, new_height) end # Set up pipeline pipeline = Gst::Pipeline.new("pipeline") src = Gst::ElementFactory.make("videotestsrc") filter = Gst.parse_launch("capsfilter caps=video/x-raw,pixel-aspect-ratio=1/4") test = Gst::ElementFactory.make("navigationtest") colorspace = Gst::ElementFactory.make("videoconvert") sink = ClutterGst::VideoSink.new(texture) # We can try other patterns # src.pattern = 10 pipeline << src << filter << test << colorspace << sink src >> filter >> test >> colorspace >> sink pipeline.play # Resize with the window constraint = Clutter::BindConstraint.new(stage, :size, 0.0) texture.constraints = constraint # Rotate a bit texture.set_pivot_point(0.5, 0.5) texture.set_rotation_angle(:z_axis, 45.0) # start the timeline timeline.start stage.add_child(texture) # texture.opacity = 0x11 stage.show Clutter.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/video-player.rb��������������������������������������0000755�0001750�0001750�00000025127�12416346617�022515� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gst/examples/video-player.c. The # image files used in this sample code are copied from clutter-gst/examples. # They are licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # The original header: # video-player.c - A simple video player with an OSD. # # Copyright (C) 2007,2008 OpenedHand # Copyright (C) 2013 Collabora # # Copyright (C) 2013-2014 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 require "optparse" require "clutter-gst" SEEK_H = 14 SEEK_W = 440 GST_PLAY_FLAG_VIS = (1 << 3) class VideoApp attr_accessor :stage attr_accessor :vtexture attr_accessor :control, :control_bg, :control_label attr_accessor :control_play, :control_pause attr_accessor :control_seek1, :control_seek2, :control_seekbar attr_accessor :controls_showing, :paused, :mouse_in_window attr_accessor :controls_timeout def initialize @controls_showing = false @paused = false @mouse_in_window = false @controls_timeout = 0 end end opt_fullscreen = false opt_loop = false parser = OptionParser.new parser.on("-f", "--[no-]fullscreen", "Start the player in fullscreen", "(#{opt_fullscreen})") do |boolean| opt_fullscreen = boolean end parser.on("-l", "--[no-]loop", "Start the video again once reached EOS", "(#{opt_loop})") do |boolean| opt_loop = boolean end parser.parse! def controls_timeout_cb(app) app.controls_timeout = 0 show_controls(app, false) false end def actor_animate(actor, mode, duration, first_property, *args) actor.save_easing_state actor.easing_mode = mode actor.easing_duration = duration actor.set_property(first_property, args.first) end def show_controls(app, vis) return if app.control.nil? if vis == true && app.controls_showing == true if app.controls_timeout == 0 app.controls_timeout = GLib::Timeout.add_seconds(5) do controls_timeout_cb(app) end end return end if vis == true && app.controls_showing == false app.controls_showing = true app.stage.show_cursor actor_animate(app.control, :ease_out_quint, 250, "opacity", 224) return end if vis == false && app.controls_showing == true app.controls_showing = false if app.mouse_in_window app.stage.hide_cursor end actor_animate(app.control, :ease_out_quint, 250, "opacity", 0) return end end def toggle_pause_state(app) return if app.vtexture.nil? if app.paused app.vtexture.playing = true app.paused = false app.control_play.hide app.control_pause.show else app.vtexture.playing = false app.paused = true app.control_pause.hide app.control_play.show end end def position_controls(app, controls) stage_width, stage_height = app.stage.size bg_width, bg_height = app.control.size x = ((stage_width - bg_width) / 2).floor y = stage_height - bg_height - 28 controls.set_position(x, y) end def new_rectangle_with_color(color) actor = Clutter::Actor.new actor.background_color = color actor end stage_color = Clutter::Color.new(0, 0, 0, 0) control_color1 = Clutter::Color.new(73, 74, 77, 0xee) control_color2 = Clutter::Color.new(0xcc, 0xcc, 0xcc, 0xff) if ARGV.length < 1 puts "Usage: #{$0} [OPTIONS] <video file> - A simple video player" exit(false) end stage = Clutter::Stage.new stage.background_color = Clutter::Color.new(0, 0, 0, 0) stage.set_size(768, 576) stage.set_minimum_size(640, 480) stage.fullscreen = true if opt_fullscreen app = VideoApp.new app.stage = stage app.vtexture = ClutterGst::VideoTexture.new raise "failed to create vtexture" if app.vtexture.nil? # By default ClutterGst seeks to the nearest key frame (faster). However # it has the weird effect that when you click on the progress bar, the fill # goes to the key frame position that can be quite far from where you # clicked. Using the ACCURATE flag tells playbin2 to seek to the actual # frame app.vtexture.seek_flags = :accurate app.vtexture.signal_connect("eos") do |media, app| if opt_loop media.progress = 0.0 media.playing = true end end stage.signal_connect("allocation-changed") do |stage, box, flags| position_controls(app, app.control) show_controls(app, true) end stage.signal_connect("destroy") do Clutter.main_quit end # Handle it ourselves so can scale up for fullscreen better app.vtexture.signal_connect_after("size-change") do |texture, base_width, base_height| stage_width, stage_height = stage.size # base_width and base_height are the actual dimensions of the buffers before # taking the pixel aspect ratio into account. We need to get the actual # size of the texture to display frame_width, frame_height = texture.size new_height = (frame_height * stage_width) / frame_width if new_height <= stage_height new_width = stage_width new_x = 0 new_y = (stage_height - new_height) / 2 else new_width = (frame_width * stage_height) / frame_height new_height = stage_height new_x = (stage_width - new_width) / 2 new_y = 0 end texture.set_position(new_x, new_y) texture.set_size(new_width, new_height) end # Load up out video texture app.vtexture.filename = ARGV[0] # Set up things so that a visualisation is played if there's no video pipe = app.vtexture.pipeline raise "Unable to get gstreamer pipeline!" unless pipe iter = pipe.iterate_sinks raise "Unable to iterate over sinks!" unless iter playsink = nil while (value = iter.next)[0] == :ok playsink = value[1].value sink_name = playsink.name # unused end goomsource = Gst::ElementFactory.make("goom", "source") raise "Unable to create goom visualiser!" unless goomsource # TODO: warnings occurred #playsink_flags = playsink.flags.value #playsink_flags |= GST_PLAY_FLAG_VIS playsink.vis_plugin = goomsource #playsink.flags = playsink_flags # Create the control UI app.control = Clutter::Actor.new app.control_bg = Clutter::Texture.new app.control_bg.from_file = File.expand_path("vid-panel.png", File.dirname(__FILE__)) app.control_play = Clutter::Texture.new app.control_play.from_file = File.expand_path("media-actions-start.png", File.dirname(__FILE__)) app.control_pause = Clutter::Texture.new app.control_pause.from_file = File.expand_path("media-actions-pause.png", File.dirname(__FILE__)) app.control_seek1 = new_rectangle_with_color(control_color1) app.control_seek2 = new_rectangle_with_color(control_color2) app.control_seekbar = new_rectangle_with_color(control_color1) app.control_seekbar.opacity = 0x99 app.control_label = Clutter::Text.new app.control_label.font_name = "Sans Bold 14" app.control_label.text = File.basename(ARGV[0]) stage.title = File.basename(ARGV[0]) # substitutes for label text app.control_label.color = control_color1 app.control_play.hide app.control.add_child(app.control_bg) app.control.add_child(app.control_play) app.control.add_child(app.control_pause) app.control.add_child(app.control_seek1) app.control.add_child(app.control_seek2) app.control.add_child(app.control_seekbar) app.control.add_child(app.control_label) app.control.opacity = 0xee app.control_play.set_position(22, 31) app.control_pause.set_position(18, 31) app.control_seek1.set_size(SEEK_W + 4, SEEK_H + 4) app.control_seek1.set_position(80, 57) app.control_seek2.set_size(SEEK_W, SEEK_H) app.control_seek2.set_position(82, 59) app.control_seekbar.set_size(0, SEEK_H) app.control_seekbar.set_position(82, 59) app.control_label.set_position(82, 29) # Add control UI to stage stage.add_child(app.vtexture) stage.add_child(app.control) position_controls(app, app.control) stage.hide_cursor actor_animate(app.control, :ease_out_quint, 1000, "opacity", 0) # Hook up other events stage.signal_connect("event") do |stage, event| handled = false case event.type when Clutter::EventType::MOTION show_controls(app, true) handled = true when Clutter::EventType::BUTTON_PRESS if app.controls_showing actor = stage.get_actor_at_pos(:all, event.x, event.y) if actor == app.control_pause || actor == app.control_play toggle_pause_state(app) elsif actor == app.control_seek1 || actor == app.control_seek2 || actor == app.control_seekbar x, y = app.control_seekbar.transformed_position dist = event.x - x def clamp(x, low, high) if x > high high elsif x < low low else x end end dist = clamp(dist, 0, SEEK_W) progress = 1.0 * dist / SEEK_W app.vtexture.progress == progress end end handled = true when Clutter::EventType::KEY_PRESS animation = nil case event.key_symbol when Clutter::Keys::KEY_d if app.vtexture app.stage.remove_child(app.vtexture) app.vtexture = nil end if app.control app.stage.remove_child(app.control) app.control = nil end when Clutter::Keys::KEY_q, Clutter::Keys::KEY_Escape app.stage.destroy when Clutter::Keys::KEY_e if app.vtexture app.vtexture .set_pivot_point(0.5, 0) animation = actor_animate(app.vtexture, :linear, 500, "rotation-angle-y", 360.0) animation.signal_connect_after("transitions-completed") do if app.vtexture app.vtexture.set_rotation_angle(:y_axis, 0.0) end end handled = true end else toggle_pause_state(app) handled = true end when Clutter::EventType::ENTER app.mouse_in_window = true app.stage.cursor_visible = app.controls_showing when Clutter::EventType::LEAVE app.mouse_in_window = false app.stage.show_cursor end handled end app.vtexture.signal_connect("notify::progress") do |video_texture, pspec| progress = video_texture.progress app.control_seekbar.set_size(progress * SEEK_W, SEEK_H) end app.vtexture.playing = true stage.show Clutter.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/media-actions-pause.png������������������������������0000644�0001750�0001750�00000005430�12257552167�024120� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���1���^*"���sRGB����bKGD������ pHYs�� �� ����tIME2@\_�� IDAThޭZˎ]W]{NH P"DC1B�s|�s`0 $ ʄ!R$(}o={1؏vbv{wZjU�OG�o�kc�.g`��SND#�m^{BD"y:i4`f/?p9|/̯tHo~3�03� [/}?K)D/|^}7>A7|WT5Lt~4MS3;53섀3i0nG!\yT~CU/t譛7_?�\l@M1FsF �?xYtBvr/.E)&x)%\z*sH) �x `IJ)ʳ>|b0#�PU4J*�"sL<g1 :RJ9/~V˲~kfƓaeGEc;_ wwtB$R f9@jnUPԄ1FzqV "j$ 3�C6 !l.OR};["(KUd U^EEHb925{;+c%rˏ�Lj^_uO[EcDvCC,:uoo B+"udUY90mBG2�pEJc)S*}�Z_ v"J`πP}.T)Ѩ @O)Qq :elj Tj<m/E/4:+r'7x4!GATΚ\T1Dxp H6w(8ۘΏ݁#M3!N c4:Б_ȭth-h-yڱ0U &7)kz@cf̞W6VN Y"E18@8ٟV.C kh XJ b<ȫidkzzPK#[ݘ'K;&귴,F)rZX(ƈ[;)Cر(J,%PJZ�!BUD?뉓Enm5J@LF-d9b*.h qkm" UE5 3 URl,tU H3AJ?JJO!03TKYt|@3sF+< �ܜ1DzJ lPӎ!mE* بjeՂK̀TUؠv? 775h!sl5ȐyO%&zdJ_sPUL ؂>U'B-=�75B\73<IlrÔ&D5Ӳ6PQJ`%3 w-ْa\3ru^+�W!Dr3_6[VvMRs`n9HO)-tn vh4tZ1f8 \x%۹AРj p9BPԃYCцl9{l>RF;"Wi dۄhv" gUҊ\d@8`̐Dub޹qz:h.BܐR,eUHC BRH1RT8Jb032 jQ0е+ve' w/k5Sb'zDxlkf93i*R!,dUfF3-J),~�fBzBa,C:L˒lPC\D39r׀*n @HuMsB$ΉHW!f)`BC`jZ#˹zZaF6χ52_j(WA7E +RJp�3/COUJ@,ׂFAe�g΅Fձ˾)""Rllt])=)]isZc鷬dQY' l,# MMU6i!^kʔj'nͥh}9`H+Pv@ YCBILa A48hxS9ccr>h:L*0fmKjb}[6R{B<p΍,lͮ ji+ >M "A.:,FQwm@VK\=gh([g!5NZ�5opv4&<%s8�:d./j66?3*1iOmV"y>i- wh4sYrӫ˂x[mj2 >cjZӑz;ΰZŜc !̇CpPYNY\c h)EhwGV2k|Uf)N>1 Z�ׯ[U[r_0M cn_pqggg4317\1D@f=?m:==J.yg޼qH>4V[0ubc!�r4p|n>{#�>zHs"y7Ǔ"rOB5sRasNz~ roCR}'v$!$"oLDnȣ!�.}Fv-jR����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/video-sink.rb����������������������������������������0000755�0001750�0001750�00000005233�12416346617�022161� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of clutter-gst/examples/video-sink.c. # It is licensed under the terms of the GNU Lesser General Public # License, version 2.1 or (at your option) later. # # The original header: # video-sink.c - A small example around the videotestsrc ! warptv ! # videoconvert ! cluttersink pipeline. # # Copyright (C) 2007,2008 OpenedHand # # Copyright (C) 2013-2014 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 require "clutter-gst" stage = Clutter::Stage.new stage.signal_connect("destroy") do Clutter.main_quit end # Make a timeline timeline = Clutter::Timeline.new(1000) timeline.loop = true # We need to set certain props on the target texture currently for # efficient/correct playback onto the texture (which sucks a bit) texture = Clutter::Texture.new # NOTE: Because warning is given, I comment out. #texture.set_property("disable-slicing", true) texture.signal_connect("size-change") do |widget, width, height| stage = widget.stage next if stage.nil? # go out of the block if stage is nil stage_width, stage_height = stage.size new_height = (height * stage_width) / width if new_height <= stage_height new_width = stage_width new_x = 0 new_y = (stage_height - new_height) / 2 else new_width = (width * stage_height) / height new_height = stage_height new_x = (stage_width - new_width) / 2 new_y = 0 end widget.set_position(new_x, new_y) widget.set_size(new_width, new_height) end # Set up pipeline pipeline = Gst::Pipeline.new("pipeline") src = Gst::ElementFactory.make("videotestsrc") warp = Gst::ElementFactory.make("warptv") colorspace = Gst::ElementFactory.make("videoconvert") sink = ClutterGst::VideoSink.new(texture) # We can try other patterns # src.pattern = 10 pipeline << src << warp << colorspace << sink src >> warp >> colorspace >> sink pipeline.play # start the timeline timeline.start stage.add_child(texture) # texture.opacity = 0x11 stage.show Clutter.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/clutter-gstreamer/sample/vid-panel.png����������������������������������������0000644�0001750�0001750�00000124326�12257552167�022155� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��0���l���t"���sRGB����bKGD������ pHYs�� �� ����tIME V"���tEXtComment�Created with The GIMPd%n�� �IDATxKmrTc}v|W!&(<중E?Ѡ!"t=DDD=$$H)8(mhX !DqAc~U5F͵='=9}U#z{^oz{^oz{^oz{^oz{^oz{^oz{^oz{^oz{^o7x{^o_3z{^oۯ/+WD z}~ >8>]{.ȷz{> sW?pm#.lb}N `?\$" xy2@�?MoA80~>7/Jt#g uݟd\@d G;yۛqۨ"s:yoԟ#'I|oo/Ы"s=*o-ɟ_{Y~^oXo]Wht2>}JʽZ;>kX�GƄy6Q?6JN{f> 񉞛u7{p{=xyd.|k/?\=nǨCM{rz+Ni$D&h^z>Y|@ ~.PZku7s'(OX8g7luMtgE_]^_@036ED.SX;+j;�|_~Eį&;T=Bs+_~˙ʯXM_-Aw9m,>w 7WޮfwM6~1iΦopu%2p v0>+.nw8zȈu=;õ",%^{aE!*eDz[K> !|Uc)p@qkj9CFw}Pד?z~{^_(g`y_2xbl&080č\^^gM?,RAsyPܨy&{mٶ�!&^07g:ןRW=3tF,.>WM:hSHhX�84Ԇl__/_O?/1^?}k_efy@Fe;gdS|v!H6trASePn?1nog1YU`FoɅA~'"rE]ggP xB:l:b YBźso}k�gNO:FPh0}/Z{~ Xm)>x]^[!X}hJ/ O'!oU8ϦF:N ><,qڵbch rͽOt,F(EUƹRŦP&m5IYHʟqzV}тL M֨l<U%'ś63]0]ZSzFߗU˰R7 =7Qԍa^%3 B?/uEf~ro2,`~g~&K/~_MlS!񄔧y4f>.9V7]ςֱa::mpUZ~i)_@p(pA/g?#‹*l 66 LF R .Xlq63£;`ޛ1!ε7xL͎x0w=GnY2{N:MLv_grn0C(TMynyz(b[m?l6�54LQ%�gOPsRoqy8]? ųNR3Ii\kHK|V hoa1*{_٣FmͮG{ǣ X_y撂DX Tt9|Kߏ5 +eC҅^༧UW/qwYgP8.G�7?P|z/~.;_m_CA$"y-yo+<]G'3S>�"<0Dij~jeb:wa: {$}I=<6Ɂ4|d>qzwL.Rd͍io:ċ<גy<$M/ț wVrslX͜y :ew~y6;3@[zs)!Rl s8?)qoF 2I='vqHMGbE<egR�=] O֨GW!{&}<+;)4R$uWM0wPUV\eüWo ,f'Sh}ɱ5?]l5+=́+�XɾA-do8͌fz +0CuK;SI#w4jR@O4s 3NHgVʹ]|9xA=_#=K&??oD# 'QrS_=F¿W||QHX]>؀@׫zu:AP+rۨ˜0l,xp `n˜کm >ŗwWui3~&FH,6!0r}&g2@JÔ >Ikv(MS(t㠼spȶgN:G:62VO(.c zm}V]:z!#N{^Ni ӓ?T!kihi#[r Hzнd?Dωu:¢-iTQ5xA~A/�kqƶ+,HE|]3n.{u}yl]>/#\/q=Q}vqir1EW>oǾ/?)*W?~?+_򗩌BwZV|%S 9 W</8#cUBUx~-+7p™rpa6]؁/!v֏'<g]B yH.EBs:#ͨyspy$JUEJ&m)j<Rɒ&,E_;Q#":<T?8Ak\c'HtA>nzʟ*|_kWؚKR  -/yun+ |MQP+ϐR#ʉuDZ-BXgp0R'e\@GX=^G m(._=LA�!trqz=c󅝢G˦ǯȼu~r݋B)ZBOn̪AKJOKigOT2g ]w?c7qM>ŸWLDޯO>H(.uRn;!PWU B~ԊŦ;mʵc@8̐Խ~L^!x膳u8dy |pP D:B4lT҈}~֍Gpy! {DD/=l3`:_⥛wUę3k+]2+RTUYLRtwRqBb )2H&dnu!ZjK(USAѪ^-`=p*B ЀO VڃFU^t+M*)n|xU\.8{뵎la]XעKWUEϸzo5I"pe(aɼhw*N޽]JqM_M[*rB)QN83A[}U|暨k}&{L\`F__#wG/G_?Ëy S6D|g|K_dbn[gw=w!:ܶ.Ty+'W]fW }AzH!`S9ͭR tۦpwC Q*Eu 'qG7:p'}l$s]EB m5Rr3{-́kpފοI"|9 X`kF޼uE [#;ooCCМgiQo0D@VQ(5dU:5q)m@rhF漟K\VYhÚ.9Shh+g,1.={(yxK0}$8MPH8U%|LρDoT~#>s'E^@4JRl} -8 5Kܮgj/_0}A*7miӠ=›U{']_:uqb>ȇ("~{/ŏ[So<@pKX#T}!7~:0TK R ј(.J/nU 5ҳ_E=QD`{RL0FYFe%H\_(Nx%یFq.'Y6b_nre`)W5^P�pD®5\\_ː8=f�Tvؔu:c^+͗OJ]�=t K!sykPPk+ %ゴ*zV>@]d >RE1 Wc,^!a*ȀŹuWyDFWa {]a]Hga/h 4c/|v6)#½{2y߃쵱GjﱟN0>ڟϲYHz~w~3toO@.8/Y+y12aS9GJ zgNE沮}v y`b 4.s=YJ}lc) o^xiVW)`Ix+T& <ȡaЯ8yݫA$pӻmo'_7Φ/x}[V5>@(杁czCl~�u|B7{48<&&lxR-K=9գJ:g[1φ]p-{LR$/6ep"p*}b=Lfn[U*X]O4vpzմ}HSs\KӼL;[jJU2 !xk?ʈQTrR~̞nCEF0~/GRD_g+q;~3|w-_fҭ M”Hnb$ɤ/�U%D123.Yƛ:om.dt'Y5x>DI7 5`)LnMM<w6_O\<tec `yUuJw'e-&`юp#ݝ@i8Q%W29M$)pZT h]tP*m<,sSLZZ*/(8!fX%6 @pfig:t݉;p0ZaE=wt۳<74.nmcCZ 檅|/0̬nޤsA eLl]Ͻݱgt -jo G$}lGb/R;`@ ._CYUVtZ82ғ,E9nx@É׿G~Zu} 1"">U\䁒f@o,WˈkTB:Kn(Z(9Ժ:EϽ/qaʅfyA IzG"J t |M^FSs^EjP=%p&|XQŧsVޝ3s&'E)YQ6y<هTx} VHPQ# %#^fD\Z ο {6?nЗA>Z>e}T~&p XT@Mvg₽,ˋGd۔ч]tHƫ25)J-Rtd#L^˾b#y1ˊA9qm ֋Q)acA3x8A+9$"Pe[T#Hz=W;cG  գf@HˣzyfI0Yo�^ 28ˢ#PFI<х`,H|8O~-~CkD|{C+,""{;#xMYB.L>[>1Oge]Y(hnv 77cԮ]I}<Et bepu!cp;lTZlr9TǃӤA쎴)3Fm""_ :Z6Zmg8I٤Z(rc5pm4~UNI!S u2)7Jz( ,qd8*c҈* H`R]A&>'02!T.st-U%6 UU}bҎ{TaD s)][w8c~J9t"xp$)<b`֑r:jHg!8 s,.kR\8ɸXʔBzu?%ʘ:T.݌;jO!# 6ܩRjes'VY݉ZpC8�cЗ6rѴRZhVL9 Ϡ<V!: SMQ^tIgh5Yo;c'G'?*+o`,kgp<9>8~ț -fEF=]8Yco|fp`) "@;w$i;l*uɋ|Q\x".ObF|(؛HdzoְΠ<!mRgg^S`pa12{x6 |-] ٠)W ]|@!zDMi9Uufb4-.DGE8Lq(vb㡵 V'9D(y# MBTB*\jt[ KK">|gM;+FET;L11KJ(H7gI&$º1!.5Q ^d0tbgv;[Zbw?C;7_ 1|~DrLR֟5^giGuv9Ufj 5i|VRagEH3OsDrT"dC +ýڻJ(^'ɲRs<KY Gv^=?|Lޣ:r뚑bJ^szI9 ^4PaSe#׎[iR03VI3O(n|wK@@dյ~ amt+/X^3b2:3g(n=^d\3RA"ʓ7^)*@;kFQ3{!c9g¦ӭ ?�I߇H?wF".O%5�� �IDAT3V>},t,HC.1PH sQ)Uv>RG>28ɴmXCh0BeT2{Z& \PSX.] >Ai&X{rM)m!oF(|IA"8.D5aCȿ2\IF( PVˈA]WϿkNݻIYa\0g$ilN & d gJBP4xc\3&:YvJ(oť.d{ 罰%IWO=##ʕ/!uc|rFN=0Bf y}:ߐb +ٛo{ gΨ[|ĥv~t=bMS&8ʋrvg轷gXpz֖p/;E71ic p:7zc %!szpl3V-АqٳV䣛 }"mމRG9 ?QPiUD AķiɅ9ې\]̾Xs\k$DŽZliE`_KH@SehyVMg^=ggd!3 ƼJ;!A)Ak}s(D0{-qg$}E<a{+LB<I%%B"e+'c8:rf 6 vX1ި%(#a)2jбz1007wBbCrXyH&A&O@,Q7MJLI,s>W<˸Ln@\]E{&Yi8U:8 sȃydb jxӱat9VUt ̠5$=#S<W!/<%ӇYs+/Yx7xSge\)`.~3Oz-HϚ-BH/iLH;Z.`d(?Cp;|bL#GWe#~,6RK{ 7֙0JDOD3O"OrWPc.-9*{OA@;,Sկ|._>RDG9!ƻ @y؀u}R=Reҽ'E 3MFr#B`丑OJ6!B3WJF@rs+2e~OY 9XN@U�+7 zZG p8aM Lc.dx~SXDBi`r$$0M4f,+l55yÍ ԈVLQMXO� *u4 [ /Z[r=2ɼUN ;3n.~.gT`Cf3$<%u3e6.j 2z#D+J'j(2X� 8AYꏳ<e*#Xەpf5TE H͋lFi4JooZ"'dܦ ˝CM35Eٌ~9Rn @U2xL%@B ?͝O)=sSǝ}yJ b9"M2L 0"rpN6(%Csp0ݴ (et+p/}K1I_wׁ/ <oظ$p i2") bUGtf3/ѻhve~\M@~[߶$yzR2]!pr%J+FT`.0fDLu֔qvr%:+䚓)NF^1 Zr[wFUc.rݹہæZ2Pi1R`ŔGIgΫ3pCuAķz &>(i]\γڙA3~�[%rX@١4dGKl2B&Qz#<`H"WXDNN[w4->t†D4/# 2b ucL9t uY!0I ?d!tӶlT=[)J aE xhP}~ktL-w>ֈd 3!L13jJȻ?H/抈u\7,ˑё3NGϔ?4^bF1 BWF|mG{P8XYpXÇP+J3,,*0Kuc5"%fŲs~ʟ3'K햨1(ZvD[jkz*aHʈB*3zUV-G(*crC'WBIzM&sqpԦ\xcnZQPQvgVg.#:1tFUBkl:3Q]mLȳCAp{5-`!]̘7%\(˃A"<=+1DRqAy%V-̑RTx_!%LY&><A+9 b%\%3di$4 NG=ʂXЈf1z˰{+'~:HW;sdh3x5 lUj prF]AۮAOzPZv2fK"]t ՏS|,F;*hF9%J"8m" GA@d0tdVRvj}9*'{+I<JhNf73B!UTM}A(i!FN(+Rk"zͨH9THI9.Тt&rOetČt8٦<9_\ )ȳUo?0i6#A;iKqXcR֜ހX.'GY?p0O`G{2Dq�N-Q9kTQp$ɸO˘WdАn`-+ʬ*j/#8< "!@:B]525o`[amL ~k�3u)[jKBH,sIC}|~$ R4Ԡ@nc:Tc?ZGU=5g!~ULr]SбI8m zӫB_$r8lSP8.mJPW{ApIܞU>ߍ\KvxX)'N jf7"W%kPq$6d͍vƀRt-*TQ.&ՆZ+UؕIs̡7xFFHtɩBZ0WFn@ʏ]N4?ċsnNra-dzr5TWV猇R't\:<G]j0-?v|1euIE0�ywiHF>!%.|rAe(Q#1N8Å|z"QG:& 4bTDA_%[œFҰKm,WajH^}{̅\>lmr<ѽ,yG*xx6 TXGa}�hq}LC[JV!ELFt"Ka]ŸqO ٰ>h٤|9,}I~+kH;oVPȘs W0% YF .O K-;ʪ6H㎒WfUj"DAc,\9 :C\v OC@" Tg\0fe7thr{Np4-MɆJrA?E!'<cDbZB}ĹZqP.fm[wDѻ}*;3,hn?ܨjGgMqEHQ,jbU4D&ω%"1UAl2̀Quu>8{Mgb 00Y.!sJZkT)(U53^f4&skBu'be K@+ B˄Mh$Ƈ*s;Ϭ̽?Ŵr^^dMתӋ\J0S&^O|QY-%# EFꗄť DŽjD0K9˾lǸ:HvrބJ?vP3S5қXef<?(saFPF8SipL#P-<j+c!{DᆌPMd\.Bg*XI~8/&rqH=(B2c`Sm ׿Cb%g:1YB ƂDVМ(,>iJQúzv^nv uE#u;]g̣'4Bӌgڡ4YYѤͣ(2xfxUyȈEH7*7g򳔓m{$<hkp91WDrȷmgX>xI ZsL9_044%gE#]q&7bAwUL2+BRJ-4B( {<M[iO+�qNr iUĻg6 Ϭ7mLH9N6¤[~c!U5/lv9dID/.#Llt/aA=(,)VK(%őq:TGI#8A%LQt^RDxnbSMtԺaaT鵎I4JVT^<e71?-P/U-؄\˲cnt]SHWws5pEZ0fjr|ܸ\„r KM Ù؉q0j_ 3:&| eWI+}9oo6Qk{t ?\ 攥\UBQA~ Xj:ϭZA}bKۂטlLb_I A7TnP=E(^[ڽOdseBXQK+[yN18=.v.WQUT*1CCa# &i7fDap#8Cfrj15sDm7FAE%MF嫄_në:0ů"pS ,&T)/ǟF-lw .3+| oRgcM4@I8e"',Pe|8#?uK"\dsy(VȨY2.X#rKsV܅^)X͕RE l@_<Qnr&d嫢Q R,R.e?3})\ Ch;aWCT9:bu8Ӏ^F@lVSVcyHXr(!ءR+qdQ/3EƲc@"hM˿*Hl/Oƕ+?3;N KyR\>Ubi!rͧ X:T( TM3agA8M\+<(6k pa7Go[Nnmx)|R9\W4ڍY^+X8LZڍ<&k,M*ZЄ^U1yO7Fe˱fr9CNC <o[bqc]˱Ig&Ss."uU#5I>>Lτ¦@͒6S: i)N#4?+p8_pLt>K:/Xbr{1UuӮsaKPoܫAQ)0~ Q(};bsGbLja#4Y# |sx$n4TEO!P{-yNA|KmQ\E\B+ byT%XbrU.$АTsTbI.6l(5ř*g %R O-%\_MNژ-D O"`gCa#s{lsx5eV0u3W>%K/C6l/ TdV,rZJsuEȅPF:M9{5~Yȣ;uSZHhjIDV ů& QN#fzllg)_&x5wCȨ 2MQ-&@{VP/xM)t:as:%Mx;ϟ!EV5`?F -:)Aъqlnj:wG*@s,bT=[<;o~7~"sIAaYP3=PMc [ v43fOɱ*>3 nBz} gR!%�)C!͡ḰQ1A5QyVHPN++i~3m%oDV9wZexУ=/T[Ufi)]}?Ǽ4C1 Еl=-1 TmOD0h(E{>71Ò,s]=@|9z_|OnVÇ1^)w/ib<$ t>Q)!,̲jN t^+YP=Qڧj~:.r[KLe57̋B=NsU)7a$TeJHȔ<;F¡ճYkR_r]kx<&xB:!=eleH+u 斥-qą8[)]#!=f$r;;\Z<d>y( wʵxvR4hq'j8[ #M.NVA*7 `qUc8z)EB^˾b%t^ckCݲc=A^͇9QDo9NX9?2VꅄC:AթhR-ĥ\COhF\!60O;Z�6j|$FxiX\>@Rbsת<nl*DSъ-9y9y׿.U~woN='αU٦BM6}J&j> s#$m-Yh}(_a.%6 <rGkg%DHՏ)>y>L1 ъQ9a;K^rّʧ'@A )49J@;EwtaeTl*8{Z9\҄E8,u?2byVVEtWр햔"%b\o0[*gӚc Gs!x|~.nBo(Q VB!~C-}X6QufKQD*93SBTk [!ƿ;HJ([!r_98ȪFfb8>3"tUN!oM>9aqŸصWK~Qq FNlC7r 4", M>̰RSrԼS(C W6\sTT""V#Ч~-IB+Igq.`b<@ zAT!DnK* 2y|^g'G < u.sC\+dtb~fv".,|14%5[+$Z *3{3b[[ ׸,各c#+#ϭ[3q'O D*ި9rP!JHT@/ u6o箜<`2GE[n?4TXV Kgk]L|ԃB?$xE0~V@ZKWnƠ(0F; Jwq,1g*&2Z{?zMjJ8\Bo!5\Ӥ TAiX!Uw a_Vu )kIsZaIVtIGAZE+]} "5kӴQq:a~8X{.sօ Iά~> (53s)LܷKLFDKbaЉB�� �IDAT%t1}f%~hK$% Sj: ).5ɐ'PO6hfUJ20eI_<BaheFԈ4`M>=3@<\/ B,uX<4#QJDӻa.VW%MkcHw:q SShp<g4ak]QCʬfU\'MG7Fx]ޑJ9v4bB ń9˔%/L9dZ}a#KM˻c&<8c{A;#/dy O"Fl/1rNv h< Iy.8~3)M p&Lڽ:cӸ<(=[P/Z8aڥαf|a[ڪ80eҴ3{PCJ ! ,@FKh6ɿKQLřf=h_ O)`'`r#*˃xPbU"!IIm>|Œjxܾ?sއcFdJ;\H_9drqUzjŊgv|v*hPN=X4 *4 g<j8[ڶWJKvQXSxvV)Wd9А4Q&y%KCc4H1˔0T&NJVPa.tiq0L{a# X ߣ~WPr0vӹ\nz%yѐYxp{hbŨӯ6{"Y4iMf8jeraV[w8DsQg)<,j]ll/&"gF(o("emLA,+xdhf^rF<|GD (5FSg'0@,L^ T-�eA d|%m S8Q cE G$iQv=.*3 !yaJWF&|-XL0(U7GsM'2}L ĐּOkxJO2c"|V=<=TBܐ4@wk�9Sd"@63AJL ֹSjS1,/bۡ!mwO=M}DK֏`9i|h]r2c&d~2C<ZtH!$fTE8%8`qޅc�9s$}A"Ìn~zAaRHEϪ 9b̶AbC(qWbHEB#[TI:lv'Όţs9{"$)cZ8  F&ѱs ֋H%ӹFZ{,Վj:;&ukD0JN$j\9-E`a<XʈE…shEeHKk<&ۘf- 9P*Af<C:0ft#fȉ/9ENˠIF5!<5 MY%ΒLKއMNm~5WW;ZLѳ-Dօ8%͋]HsDf5~cg $Z]- R'u[7Sr]XD-ݦ>2%SɘHe %&8qr Ij2*22߷炝K͇4+UT+bƁ*,h.iPBxW],qqw.)Hi?͚jR}ܦƐ36>'Պ^){174?aJ,́"Tt4&Do2rA$sn+ + 9us85E$p]l@O2=`<Nj+&\5\n1c6+M*W&OՁ~Rۣz\YEׄ/WZmk=59rgC`r'1TbW8(Gĵ]Eiayx@l^B)[K! 1_:A_0 P_y@mb QPGP+q" 1i qw6x wI9-" Sk $pe<G8|h$΂agBM8wԴ8 Ϥ`9zd$w%6^96e jNAU=ԋ05ahC9I;=8 0"02R妿hj 5~drApUN<aEXCHa<T,ލoe*#Kmdb8�MtEԕ*x1O<*d6#K ^SjSYiqS6#; 1a =fjgV/%hӸhM:Vke±nj\נj1";Z9uSd7KF?,$] +|5e0#8kZa-,XRKXV6HXp3 W)jwQrrLC*ΆM&܋! P tZn\Gf\ܫ.~{$< B-94`J 5BR )ST]JȨoѰ8YYQݻg;p&,=z$<Nz,GE( 40Cܨo< HO vr( 㔬c `!:%lPZ!5\MBX+y"iftjpFXd;4Y@aefYQagaKNxM*<-굹K@WH bY!j$ơm�Q G|�̛)0Iͽ2Uoxs!ĶAwS6'>r<VV9 9-γѯMsR�(ľ\eF_rl`z5 #PRT p@8"[qYOת 4k 2LICMjo{!NnJy@bsz-~O5@|"BU*sGJ �)4ZVk$V ٌȘ\Y$Zx& 1 $y6 %[hBzn6')@(1hҜ1W!R6iTJ K h qqb}TUJQ{(їbfn6PT򇓆B$7T,FH6g, yLPx{4ǐ[4sTONzl;Î"ʝ/f8mbYx"CMvmN$r" /~Jp'rezWR>G(904 O"L2ƤTo{YsHsԝ429X.N$W윪/"2AK*<R4H:+C\&I&R1+ފ*u$\jf?9䅬Dy�CF U 6IOi[+VX:Ҹ �PB0 ]t9Ş"VT^ɛxʌe]XI68PI3ŁՉjhEF5!XBnGO0CB߸na)1a F<",*&2F*Ok @j6VU!lcP0h5ay@!a+GTYJPL;飔)Y&+B,F>U+~*J\c2]䠧<NYm8ia ͈Er-ST?!9A;,Dh8ߣd;c {un'(RIHSVNɚG]Shu`=w ?E�i\0F?u?ETN/dlOe\Dl&.E\ kf{؁ZF͑m^[*ށW2i!\S 7:hÑ3!ZPA`$͓C٫Z\EPlUp TbJmM<@[iZB]ӝ zFLӲ:Y><L"31 re<8nkR"hՑ:M;cˡ3ňlƹH eBWPNs]_T5&?T? YZ@#ɒuOM:rPfhAw-E8\CgP#Αrurnf,(r&%nV0K"X%"McJ1<-%oAhA n=O :�ܣJ 1i\S" HA#frM42mr)9=X8!ͳ'|ĸ9EdEp|� %[]V/-\KGE2p&|'yP72̘/=7OFb"eV'6v=sWڜ94ՙAHI).r ⑬ܒw`I&o*H؊80ɽ Ա84cgѧ/QGC Kb0l*n'*)p|-b\dJf.2B*<%árUEKR'1L(hAP2\ 76R%㭰C4|$I=NGaj.)q=q>cDzE_ϗm,@MJ;aʼnEoPS9Q_c6*H~|\Z!jb'rԪĮEjeYqg?IO.I/dVK4x "2G-iXe& BS}y>Mt$p+]UpwIJaX˱*@3-hC`A11z乼rg{q1˵[SI&WʞD5CS)b b<M>Gn_9g4iK8aG;khB n ߌ'If%Lf9ˊo5w߫I# 4k@61+IlFnji -GJ:1e'KHp{t(a3#̲\6bVx&OPv((^{eXY= b'9VT!- 8;+ZV{Q!GtWw)]"3\-8:h( q><^B":j9BaS Ay#A-4=jzS="CVމz Ta<.w42e6+A7m|&خTC)hXs&j'ȁdwJD)^jTHTct(rs /CSr :t1B\1+sFC=,H:vj6`2<\B3MrbIl,4_/l#kΡ$4ep#Eݯ[Fb*XI`VbA4EfH!^ n3CX@zrV#Y-:.”+)\ kʜ,ڴQȳJTã /]8fF5a@mqBS7W{V\5S#pD˨s~ȤT�2d<QQmW=[bqYuͽG͘i ]%Mx\Ռ!*pOs8^Udz&+S`L~EI;:1N`h %xXpw"A@r?J[_(W~IXTqŸ]Cѩe]m$l&]U!+MU>7C%F9fV W'ۿ9gD W(tW>a #3?tL;o%~SlK̆h'(+. o0'%hLk)4\DJ2_3ӌyHڮXO5B? A9CS*7M e1Sê(f7N3X !^ilh9͒ZȖ\3.\msS}igF^f^_P)O5Je3[�Ş͗HrAK1avl\H-[�Q:~&q|бl-NWXܹk\{ȃ_k{"[{BELf/kP1 Qi^vsD5ɞRjfbrO(QdiNjhBrnh!Sy )#LwsCݨ,_qq{rߨF/�8@^-\^mb>ܙ )/+Sw{}}RȡMSz@rPgQ'=ٯ1Ryo4ݶPL2ͻ{$;ZWnƓ 㐖¿g&d+Xȍ2r vu{ 9T 9Indwp<$ґ'- w.mXuFI2JlhXRjЅ=Cg13]h85#4!E-zt yT2n]Ržxer9n UnóvK4CV͓Fg, ejljy@殠q+W$?p]�mPKVZi~0ΦɱWPwBJQ~JV{ sCQg2|vmBѷpLFj l:3GY%{2R wfG!?E p8>i1`NB{b8IQ'I3\Mryu҃jO*3\iГ&q[r)9(/�1!.rB|#TWCQ8PoVKٕΜhżbժK?V5$!"#W5n;hdGUMufSLj=z#Pv{7!&#C|cnUU<1|D+C\ uXF=[k%Ӹ(u?JǞޯtW4>θ)a;cDj֟I"E ӶuR|k̑V|4a3u4^YHm13. ӄH 'J5=.�h?HḨh"'~ |$ ʡͰ$mꬮv\Ku )j'tRܻvVҽ~ck]9ugcA[$J's['J³ ƌ"T,2Yg!JM+jm͐Lq`W|>S'ǪIVXY{d1jRRC)vof7eJd֜sFpȩi Z ʬ t>j8t{{ƽq`t� TYdjXK!ke{ta2b{%tyosݒB90Ǎ.*VTvH(3 A@J&c1!^ }Sw^:H( =Nd'i*z6֗:쎝cqK!LwH8P^#o+p5z]=4L{ov_r`Ȓ/۵<}> ՟yze5iÀjT*vg2iXKqK(w^i2D?-3o%qXĕ\G-l<G҉0%P 6(7IƌaҴqis(p׆p~DG1A%񶖎R^ΤD@y(q63;̕ڕfH+}K*_G>CaN�n.ۇB@!?!zq(:-$أ(J(\Tp}v;rEƸग़bxM0Yj*KЀ$N.݌e /fIѻ2Ή)L鉎.ϹӣM!�OBؗs O7Ƒnh>jjyD'`%Ymr15HQ*a6j7}j8NGMV+z,sF-sH覡{B`XMTB!!!֊tsƼ(BFO&QR?"D}*7f�Bk%c.,'&j B&Lb8y#= 5dHD4^!;�� �IDAT.ls@b7(4ʦ(GzWKjR,.n_z}M1H!APɪer; T\d\0ro XP~JF.R}7J0DL]RTg\&9s�r b_J°Zv/&m&R =5wt+ܶ3:<-C55d ˕57_aQւwS0}#nmgmН+\rMw8q<gZe(l|>fx"W:{XI椗ɽc/*/%b_e!�O3 hJ%J 剙4 (x k11{!j*īwN:HYɸA)jDZuBվP,oGc=DF 9i-\]f|'S uCrm1'*!*E]ioߗQ^T/;)NTL a,_;%:5F=p".MÔzb`$ݟzOF 95ȵ-މrm΃$ʋuSHXXgS.q|<( 9u 3gCo/捻|@gĢ|&xx_CP^yԮEG{м*Q־hn 66 sRG0AJswXHցdd#<7qpgbWidDn8o7U56)1g^?cF㥨 m)#uADž,ΔBLY5ULF<'Er\#;IRFtV�dN.,@ָZ*^H.I}ai#.&ͺhJ!~I&rqNdmSQc̞n)k<*RM\Nގ7Eh*f%Eř@{uQ蟻IAcbO{zfsT#JK@R9::r#kT1N2׈b!|@__pRr`4vaϵqSrR@ AqB(p 92{-B<4a5Kx|$ۘұ_]Ѱ uF890J%IZ51h)V"c=CIi:&'Թ:vV5CZ)U{K9E)c> @*4W0dfaFd-sG+ZazHCj*Q䆵T90` D# XӶa:)b:-v;!=&:Nj0Qb Y3f%.1ңDOH,1IQ2:>b^Uxe,U!|x)mO9 9dh) Bn2^ =TNX!9|.^x\#PZv8o䦍tߣ^L@2Rem'I!fvѣ9#Ө.JAhYS u^ή蠌9󔹵9\2VϤ[|ZhF\iR5\R1EuԨ"`|`K̎U^", CJzTy.[ ME2> iJYP;)fQWҏܴg+wW:K5oQ|MMnPe±S%@Ba?Kš74A)oSBEPK`ȿH{"3? m ) (X7׺썊HH�<p)%Zmg.sa!* +V&A8/ñyTrl]MB:r~d<,kqҎs]L~$MkLkD9P [3"Y`1,[Dzx,R ً簺D~*R"ihH5Xn*$E3HX 1nqs%ǧp2~ZAY{m{8 1渺 zvຜ*YkUrX\XXy<i\u'y TR}6\٤wF)]2v*7xU )L_N?LH}ShVAS fL*-Ӑ.KNH 7#o.r=σ%R9vŒR䕁@k0۸nRRKiik\R0τ 8bM] P&~!k9<ƟFI`zR_�pBp8,41;xuNJxs>C<p*t}x47_ruI@c~O0 [ !K%DR'l$EeijTr:)%Cfb|o@ \π)иdA9`o=N+{J%|kXrljHjQ3�PR|1lY=플�A\.7?9>8 Sq,irۆC5[L%5g㙆K9fx PMy*tOTgS6QJ`+ݙY},q8*hػ-2/3˨g ")vħ3pnߕ&ۦNtr}*­/)2%Cf)W9}hkdY.gIxL,s%\VYC{rQVEEy"w}46Hy *^z<Ϣ"õ$4us67AH2JEjJh*(jJ_IлtGEH8r fgq5' SiaB{,Q>^<s٘M}࡛ FtPG=hҀ _m=؋ڗɜ} 4fZE#fd y^N`o*OQa!dxoZOt3Xɬ s%ÐMen*[t&+Z˲j\A):!21_$NpRCqϦme3@p{A5̶Ҹ<MP CH%`]lhUCeLS.+fW(,I8;fV)lA Ѿ۲r( jb3b{B-b|Dѓ BKY'ʂنd)NG:,T(*eаIMg1Qeh.&)t+i*dd 5=ݼ:+Rxz?\G!a$'zP.&22mT2cya@3$ F5p.Pk%3-I:UES4#j3Iq|C"uY)T݅r&42;WnlXZ 7%SI!H~Gs .wkiEcD(w*7$F7t4.NA~zT3Y{%gQ^]s'KBxe?S~@~(3x+}Z.ّׯ<#^Wh TsKNXTs0YH:34I8h30HbRIaOwhނdY^e}kvڪUbTE>//~~ /Z_^cR$(h[_ R? ۙݙk>ϵ~ǺgnH}%Oy羯<׹qVYHJUDh9Y tP% C;۞ rMK)9 }z捛@ O ΑOj(`JT{-_Ξ*!@B0X{IDh2ό6{3jK(an!;+60ܲyꪙ:tfv k&D89sR6D<@@E*`w#&.,pwҕ&& 瞣iAf_DY-}Xᣊx*.ד֡46 N}De#< >+3C=#p7O|ȦtM=!Ve;eA-ޚZ\H,NihEpbGY/v{q*F]OsBAӌ:̄ϡÝIA|kyϨG 9Iy?p (t_F6o<7rsR8([ut-R88[TJd&tB&FXDP- d-RMC:ZB8lEX .g/+aYRsK1Z.Ȅl @c%sסG5T3; g)-Jv 6p-|( ՋCq7dm"�r4!ܯ4,ElgKK'E 9fZl)->Ff^BhYH#GNg+̀cȩXCm.tvQ &FNmX!ct: -\O$*CʅԡeǁaSũqF]%zJ;ޝ+=[{tśέnE_4oNu#&cTe\=YΖeU]+',<w<7GOe1:;ɮ>Gǜl1[6?_z3H<,c"RU3E]):f� h\lyt~0@#دF7ulOuiYȧ9Ba SF =&IRoT$.iECJpx'U8d^'Q=x\ABh)L ЩN 22q`aA{3�o$"QL&l5]pHɥ MF&uA‘JPMY:}Mv^G X; 5öҞ\W`1O4+jIi0?3u7?16vIyGPdzw]?9@jzR K1Q2y3"�k 9Fԛ@Y\&?r63D.k@F87#VA?^չܤ#%؊G: d9q38Β'`Q]4HTl~pJvm<NK>`T`phw$%UL�~F`f�c<Cۛt;A,КzMydZn(fڅBN &eoVS#٢,WO 9԰aBO(7XSekOjr5Su|M#q0A +"�҂6;\,3۩8f�Մ"Ԕ'U1讂df [`{,ly8;;㥊Yu!%g+y"ԯF0uEMjt3A|Ojӓ�(4EZw8clH,%:&C vޝ 91}u{O)JI ~<T蘐bfT+HAiSjL3R+i胱aZQF j=Fu:<%7lڽ+6Dk23�:h[0 ʰ<xf&EE.RR`�҃](8j9{&Hp4:c"QcakQ%D Z~vL/G O--@B*Zݑr2@gwx8jζήqm*g@k`zНǩ l&!D9RzWFGjy'!\X] KtX'4C;Jfӣa:NyՔ`e ;D}&Hws)U%ZvUB9Ru(sj*zd}ʤc쒤cjt>U6I+CQAD)�܋`(94ŐXvXH @Ib:@; 󷨗{+;@-(꭬Dtsra0[b 5tܝ6yh)cZd'T8;"!b0.VZL{JB{+#„Ȇ:[+"f[le۬΅z5|X?Ew)*J3rڍzo0zR_}ʮբ8JL%;thh!)Gu\ҖGwc?* iT(6<oncmh$1%7ji6R4l"ɽHpDJBf UDZ[[~Mrۣ]l]FpuGd>+xWα6a EdRdIcF(йp%uC&6^An^ĒrN>cNg9!!ffLPl 5wZU.3r@ UReT8"dYc91b}%gvF=dvpuڝ -F8{]L壃Ʈ�%Un7ԃmp[~$>;8f#vTka>sKG<qaz5?i&Fꊽh} ځCg#np|p Iծ*Q.n(o߱Zи6SlZe@M=�v􎱇M5MC_g͞czoɈ0and)9+̍ pSp"r9'ďrD"v?pIxY]𹹄[VM; ضK fDѱa 6ߧZ n$Oٌ #h?|{Â%e 5uxn??ݭ:x&D%-wdOt(N؂LSg]3%J xvNts,H9`g9=J\_^  @W%|B:0\{-V_wuJFZagQB:m] M$V7I7t5}_]4I&A6h5n#,* B* F0f,IJ/˅dB*{c(?v ^c~ۢEI%O}TfĨfƌ&;2;>[b"Bw:IgȘve%R` 8=TqR \@HZNHoFp&Egm̤,* ݈,7"1,bk@Tr@Pj4lLe1q"VYh%]~ 1>s`t@DkK]S7]V51?Gэ|=2DbL83i?ktz]NDAp@D:pSYhI=N0 il^.Dk+8m*cJpe#A⟃Ӡ5]\D34`Y.iEB "}70,"f3z4^r�n}dry\#p wSxd{h{/}8vw\6w:ކ =<Rz-K<7_f P%jnkk)Ỏ17Ww�6T-l? Ӡ Uk!C|bq>rW6 WaTV칤 a5,5iEŭLZ" ZٺtJ/4yO{]ߧpQGq31^Xc/',B>�+`ꘫ{; ɆL*dD@}L(֠lC؛;^'/w^n^v'7B{g]3�T,3u@e3 7$Ėcf!-4'xgϥNu�/%vAF E6V|Yvao}ʼsK6XbpdkeP1?W! N>q{{3G%U6Qhc5܀1)N*ZF5 !)Y[b\O:ޔRY*udӄnR.=49z_w:�6E:tPQ3 J+֏`6C󨌠{ׇUoޛbqI۞| # m02FFjA3O:ca6&QXaA,UH#9 "ٔ+!, "_ �� �IDATN4NX={ƚ)vhze/ҔiY|L, ;4a&HsAHdƈ:%Ɲ9Э^!!Ź8OGwzCw1vsu(0N>[b͡' K#A@zq8'-$OZ YT]�#UۆzYpe#pl7H<Rު-]b,lX}OXvl4d-K@=</Kۡ=*>j܅T0;)YH-.AekL'>\{u.f/q:֝w}t )fjܴIk s-)Yk`iRMѩ{!$0c|�~ɓ=Ns0>ٞ'Ð%J{M%FqoMJ敦-BI{GM N!Uǂ월bq;t-Aw\3-nJB[JMe6}]5_1t"m[CABI,i{6 ~+-~TPY}Xke<M%!8OGuّͰ00SV߄(J0.Λ2:Ldbu5w!~Q֦( #W%%#Z~ք%AL5ExHA]v<k-H(*Itjc8w(XY|=KizaJ":uܣppsLDV<%H a{RtM rDbTw~88(xD6^pӧyrGٳg V^{t^`݇bxp# <X\8;VςR"){.uO`Xa-aSɊ} 2ASRpSeiL4 qt2�bjzB] ۂeM+NS]hѻm(yNGjoFdւ>KjQAhw%;1s|K'_uj7 r2"8Z ԃܞJe:=;6BM`c/L#5Xp0&'E}_lwŗ=CAֶee~sN`.}|9֝d68Os*,-?Cv"=bSTvH[J<^B28Z[%wd&XNcOJlWfAВ-LHx>�q]0M2n.}y*Xo=PM~WG1B^ 37NC`8.eM*!ik<6+dY<ZP,|:i\lO"7TGVBnHǨ]@p~Y7&ɺ2z~#Uj;,\M-Ju{0I.eK&  aI-/R:29Zp@=*QW,IzӡTFz82>5drz e]zCn'3z9�왢M̸957'LePˎ撾W9.&|2<؃0F7cwb&w\ׁoRhtNKAP'yj`7!.:N3ķNG|α1qd J&y@\`kOfXhq HoEI9PݙXudU:8Y$Z0� Cy8ڎk<^ j,q@ŎS<ے Qv2ʈ"9ӧ/%.1}i}Tnm!SKFƢ'`G~ tYr`qVdlF"y:j mւ%76|ds6V͑YJ:3boSQrL*wǞfE[hhyȠd  d"a\n]T(C~8 1 GD•pEp1$}Šnîy}Qj`BHPRx7VJޘZ(QP/]C/3q*!p1kN\SM΅#gN�9F,ؤMHاڞ9*Q}2y"Dp!muӛoy{/$ 4taf~h'] :֣:w?4++S>sފ, '(|C>X|ױiɿ2OP2JW|(){PINϔm*;aI'Lw}C>YAht7d,z2gybMFE2do=DJ ЍvDQJ{TA백BgqSNgАiCAjCܹ4M8UJ•F7kۡwl {b$�F|7Tj2vܨPC,/i{! N0x}]3@ݟ}̌b ! 5Υ)XHy?kAz.,ܾgMCilu!pQ _ \=:J`omTx=WVtvlX1Uw聍a;9Lr}ZožYm*p%L}&6zv(܂փv: d-c4'$Qj vjY@pgͬH?y#FAz+jFArSwR#d;><jcO RJQ4{}۝3];v{V]>_7os<y򺙽efoM3c3{Koc/8D}KO9Yi~g+ ծfj 8iN1td)x#gЬHr4Z ~L Vcb,ؘ68I̓pX5RBm-VHgڐR=ɡX-jggGjgX<(r>Hu,HR䥎 ݨE."^m A m1̮j9Sghp\8w&me3Ɯ=p`7~t/6jƟR@XtFsop;v8 �,&Vɢ[HSN)L-!76ER5mCs dc߄TQϏcu�vA~nvW<<š(ᓢK e}vI'}ѥnhT Oz.#fmĨ597>(H <AM7yIV9/. `LY]fHcZwo7ް'Oѳt`~C/>†ȳVgI]#TE<72L^{J߮@E]->irؤbvb)SӬC)(w .p-l0{È*qu9 ;|]lBQHp{|K` wmT)fJvqVtN9*G`Q'"=woۿӆKXHEF$Zr-M9>)a�'txMaL(uڝ-j4uER= S V,}F.otTF tgu^lBBtHJPΊ>=J̑ h7oaF LsY8@7C 3<>R)NGI-;{Nqsj&Cx_9 '>E=v"ַug>Y|Xi2o Hj,ˣnߎ, `l`i M*1{DiDx=>=jϋ[Q@Mc݁8"Kco\,xyw|킦GHf_3{ZZ!ssDŽ|OZڬA_MqnGKB",Q yNqc|%<NMZNjTѓLrjA�*hzp$S7^|E)47A8(:l[ 󀼎&  _Hژ:"H!s\{{I#@B:6&B^ɱ̂G"�Dc1 '\Ѧ]!haOO}#r;m 9& � ow3jtt/yC*u.Wþxc`]/`X1-:<PcetEEhp:yu`sVq[Kcs ݿwNPpPz-TOŜڻT71E1'g̾dfo^c___7'f㻾{o4U}9'@NyC1bRҝ  uǮQɎDtBFsDm$!ڑscs@SЛ˝2IЖ(n: ?$2'E%4P'$~ޫ, Ҁ-~} ;\C;$'ſTP;Ͻ~V `wjТ-P^ly[Y}ՆTDfd1tOo.140I ܸ /DA1�BBiuiy[91tFe8CXjd첒n,MH!Ol<, מҝ,n]<i 1K4|h=dk X7ܑpp5 :L(EjZ(G) ,$bY0?90a0ҭg6�oM.7eAdPxɉAR70P&w[b2 V܏#'~SfzgY_O%=^~so=y>QK;e6DW$* Qw, +|X-L%zMHp�Ŭz%ۦ;s`wkOtК2p ]T!ng1~^]0]p&unj z&fiD TO)fˇ iUa 6 !ms7Q\8O\MHm[t{0y(xQ򹼱Ptcr~,cX4Z8udY@C0@tή#&L!y4SuH8 U[�zp6ݍ2=y Sy}CFpBe 3᝚<YՑ jwcGVS!^vU2 rTVGd#u.K&P眧@M * qm:vJcF!+qIF1)3yH(āV_9`~j'x7u0{lf3/OOWe*lRZ1Lr]ya!v:;@윓#Jx;y⊧ "u0M )ø`6jdQv^SNcҐ\H̬xWN:c6IE5~0*H~Αf܎bqm '-8=Vѻk~eO=:?MOWEiFBݻS<ɜ\:4޻~3 .;)7K}txNqbl;Fgi%f \r[pzQ0Fxuը_:D?ǰ͝N8DT+8(EPM"\ LS>3N;m[GSc.ow}V{ߞ={׿o"5&r +;1p3{#o~7}ϺygPto˽Z^8ps͢ 80ÔvtnOnV7P0aw ]oC*:'v�ڪͮTJHVs{ZiūP$fânK0]:r?|v*'p�ځ�~趴Vew0.}S>bVd�9^pV:L13LRl-oWJ �j4HU. =;OӇe+8'"E6]`B>{jZGQ:%{CMoɛ5h7>.eu&VWaI}Ȝ⚟BLéψ Qߍ`HA.9FߎvZY+~ iPKfiz5 hdUuh u\ph\ Ϲ\4 1<h7vO֪긼/,+U|i/afh^ķoù_qIJO[_Uv6דxȰ�Ba7*jt]wGMrLAUY/pn:�T^ȳ3%{-iх_x10;+n{•5"#ȹYBIS~:y+K[*EulWMP|޶CjvÅw#Oux/Yw轲HnB!É#I4y!|tV}7R`͇'٢N~OFTs1w:2i Tq"<Dݗ>q .Vk*{3 3WU|@Ѩ]ߑX#S)ˏW%^T։vUh,;̴<a|a֎UP,gᵆǹuXV`"2My cJ߹jn_vGE5�3,Nُ?|Q W p!Urԧ>W^y};}� eF)# 껸k }ByеWh[9:vl(M&H(�b߃#EacK3ۊ(9 QD` `ˋB=zc- ?[z.޺7;S84%ÆD�=vk�YEDEXFkuxꞴF-nBd:|qC:iWx],zfmD ` mLHc#cO'}f"09ݛv>�}rt$t|KwM' :tLnڻ9IZЋg_:u]]%އ1~ARG}>V550}Zb3eOa9oOW2jq1tfDM <*C_z)?;? St^X.^40#\'??ګ?W.b uL26Q0b Ʒ*C}ŕ'WUb8nQ{tF/):2Ycv6&o:,$\b}nAYӑj.DQJ^sc <K%Sf;:ы"X319uy(Q:~b#OLE烳cܘld:P`R DC9F)6Ǟ֖C8㩏 .,@}Fkv�PxA cDLQʭ}I[s4ZdpgW[7}4.\w͔]:Lj_>eKq[Mt HI_Fwi4RB[l.F 5+hmzakPB(!fA$k&*0ͷ}OUef_MͺGf~~{W?z'oU1']~8 rqA 3R]0Nsq5D`>]39%f qşO4:|3YT[u ]4窔Ut8]h AqO/mVq黱%΀ǙAPquFw47<caNk&A?{4$ jR=vWzAVA`#<!$'Y^#: i��IDATEw:A YN_'.lЅ5us)ѳう]sj Mݾ:, Fc_M� /SÑe 'cc8@aRK]  %XtDOs8Q["Aj?^-04JWh8xWGտ:q*^^_Nyd7+(b~}oJ^70]!)ïV,s'q +p,с=9/r~fֹHÐby`>*T9.3ۣfl5eh0g̎(ӈo;RŸbRadt\kVcaZ/@|̸z٣ePpu!VM+/H5罭Ì6GH$(C*OձP3:tI9PZX;J"hvuZ]I$m;rt,"v)c0e3JHd /5m Mb_@-7nr=#' k1A@ݑ><og̊\zOB Fsn͝ -Iݶd]~5)jmln2b`C3Bs)oWмmW?./wOoc??S? !xyV1>g6.0Qļjf"oo?oGgl3Jzx(*O1NRsOhnTIڭJu}'>dkrY'HmkiCXuĆ 0<CDRH^NR%T$W-2N=BдY2W<ӃBbtM1hc.LߺwMf }nz >mrJ8wlN^ t9qŻ0/8N2էTgZE%SࠡCW,Tpz><ʞ8+FC]4%�ڸb{[܍~ <?=y~~xҩ?L{QK?_{)3`]٢y:GPwQļW3}~_~#ګ+|Kv<:TD* i_Hъr4mrdL3>q Vpz<TU)I9`·=wy=KjF?g(y4NNyxl =1Gm:n;z Xx)vҮfLvN}7ObAS_sfI$o<&/l|چaӼ갸>M"y_=[^δu ,[/+ ?_\͐] 1 v^6SPw/-MWGJWo?;^`_~ݯu=Q.Zh :0O֟9:/q3?jж و. Cפ u_kٶ*ͺ-k2.={gZ|[@ov9ߺ غ)Rq~ݯu_C+.`X,^)`fJ|y*`vxށ_~ݯu|Fzpyм|%EI;%|o|ṃQ/3E_~ݯWУ _O,\޳xr #1yl:Bzdgh޽_~ݯu -7./r OGs`__N~ݯu__°y6f_iAx,|_~ݯ]Lʯp-`*fvevݯu_wnsU̢+*Z~ vSp_~ݯ? =_~ݯWvu_~ݯ�itd����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/�������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�013472� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/extconf.rb���������������������������������������������������������������0000644�0001750�0001750�00000002223�12516434313�015467� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "vte3" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/Rakefile�����������������������������������������������������������������0000644�0001750�0001750�00000002444�12516434313�015146� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2/rake/package-task' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/VTE is a Ruby binding of VTE." package.description = "Ruby/VTE is a Ruby binding of VTE." package.dependency.gem.runtime = ["gtk3"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", "gdk3", ] package.windows.build_packages = [ # { # :name => "ncurses", # :download_base_url => "http://ftp.gnu.org/pub/gnu/ncurses", # :label => "ncurses", # :version => "5.9", # :configure_args => [ # "--enable-sp-funcs", # "--enable-term-driver", # "--with-shared", # "--without-normal", # "--without-progs", # "--without-tests", # ], # :patches => [ # "ncurses-5.9-support-mingw32.diff", # "ncurses-5.9-add-missing-exe.diff", # ], # }, # { # :name => "vte", # :download_site => :gnome, # :label => "vte", # :version => "0.34.2", # :configure_args => [], # :compression_method => "xz", # } ] package.post_install_message = "This library is experimental." end package_task.define ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/README.md����������������������������������������������������������������0000644�0001750�0001750�00000000752�12516434313�014760� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/VTE3 Ruby/VTE3 is a Ruby binding of VTE for use with GTK3. ## Requirements * Ruby/GTK3 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [VTE](https://live.gnome.org/Terminal/VTE) ## Install gem install vte3 ## License Copyright (c) 2002-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ ����������������������ruby-gnome2-all-2.2.5/vte3/ext/���������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�014275� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015156� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvteterminalaccessible.c���������������������������������������0000644�0001750�0001750�00000002511�12516434313�022215� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte3private.h" #define RG_TARGET_NAMESPACE cTerminalAccessible static VALUE rg_initialize(VALUE self, VALUE terminal) { G_INITIALIZE(self, vte_terminal_accessible_new(RVAL2VTETERMINAL(terminal))); return Qnil; } void Init_vte_access(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_TERMINAL_ACCESSIBLE, "TerminalAccessible", mVte); RG_DEF_METHOD(initialize, 1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/extconf.rb������������������������������������������������������0000644�0001750�0001750�00000003511�12516434313�017151� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin extconf.rb for Ruby/VTE extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "vte3" package_id = "vte-2.90" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end setup_win32(module_name, base_dir) unless required_pkg_config_package([package_id, 0, 26, 0], :debian => "libvte-2.90-dev", :redhat => "vte3-devel", :homebrew => "vte3") exit(false) end ["glib2", "atk", "pango", "gtk3"].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 vte_headers = ["vte/vte.h"] have_type("VteTerminalCursorBlinkMode", vte_headers) unless have_macro("VTE_CHECK_VERSION", vte_headers) make_version_header("VTE", package_id, ".") end create_pkg_config_file("Ruby/VTE3", package_id) $defs << "-DRUBY_VTE3_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 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvte.c���������������������������������������������������������0000644�0001750�0001750�00000003765�12516434313�016457� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte3private.h" #define RG_TARGET_NAMESPACE mVte void Init_vte3(void); void Init_vte3(void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module("Vte"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(VTE_MAJOR_VERSION), INT2FIX(VTE_MINOR_VERSION), INT2FIX(VTE_MICRO_VERSION))); G_DEF_CLASS(VTE_TYPE_TERMINAL_ANTI_ALIAS, "TerminalAntiAlias", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_ERASE_BINDING, "TerminalEraseBinding", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, "TerminalCursorBlinkMode", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_SHAPE, "TerminalCursorShape", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_WRITE_FLAGS, "TerminalWriteFlags", RG_TARGET_NAMESPACE); Init_vte_access(RG_TARGET_NAMESPACE); Init_vte_reaper(RG_TARGET_NAMESPACE); Init_vte_terminal(RG_TARGET_NAMESPACE); Init_vte_charattributes(RG_TARGET_NAMESPACE); Init_vte_pty(RG_TARGET_NAMESPACE); } �����������ruby-gnome2-all-2.2.5/vte3/ext/vte3/depend����������������������������������������������������������0000644�0001750�0001750�00000000245�12516434313�016341� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-vte3.pc $(pkgconfigdir); \ fi �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvtecharattributes.c�������������������������������������������0000644�0001750�0001750�00000004542�12516434313�021416� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte3private.h" #define RG_TARGET_NAMESPACE cCharAttributes static ID id_row, id_column, id_fore, id_back, id_underline, id_strikethrough; static VALUE rg_initialize(VALUE self, VALUE row, VALUE column, VALUE fore, VALUE back, VALUE underline, VALUE strikethrough) { rb_ivar_set(self, id_row, row); rb_ivar_set(self, id_column, column); rb_ivar_set(self, id_fore, fore); rb_ivar_set(self, id_back, back); rb_ivar_set(self, id_underline, underline); rb_ivar_set(self, id_strikethrough, strikethrough); return Qnil; } static VALUE rg_underline_p(VALUE self) { return rb_ivar_get(self, id_underline); } static VALUE rg_strikethrough_p(VALUE self) { return rb_ivar_get(self, id_strikethrough); } void Init_vte_charattributes(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; id_row = rb_intern("@row"); id_column = rb_intern("@column"); id_fore = rb_intern("@fore"); id_back = rb_intern("@back"); id_underline = rb_intern("@underline"); id_strikethrough = rb_intern("@strikethrough"); RG_TARGET_NAMESPACE = rb_define_class_under(mVte, "CharAttributes", rb_cObject); RG_DEF_METHOD(initialize, 6); RG_DEF_ATTR("row", TRUE, FALSE, TRUE); RG_DEF_ATTR("column", TRUE, FALSE, TRUE); RG_DEF_ATTR("fore", TRUE, FALSE, TRUE); RG_DEF_ATTR("back", TRUE, FALSE, TRUE); RG_DEF_ALIAS("foreground", "fore"); RG_DEF_ALIAS("background", "back"); RG_DEF_METHOD_P(underline, 0); RG_DEF_METHOD_P(strikethrough, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvte3private.h�������������������������������������������������0000644�0001750�0001750�00000001043�12516434313�020125� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __RBVTE3PRIVATE_H__ #define __RBVTE3PRIVATE_H__ #include <vte/vte.h> #include <vte/vteaccess.h> #include <vte/reaper.h> #include <ruby.h> #include <rbpango.h> #include <rbgtk3.h> #include "rbvte3conversions.h" #ifndef VTE_CHECK_VERSION # include "rbvteversion.h" #endif G_GNUC_INTERNAL void Init_vte_access(VALUE mVte); G_GNUC_INTERNAL void Init_vte_reaper(VALUE mVte); G_GNUC_INTERNAL void Init_vte_terminal(VALUE mVte); G_GNUC_INTERNAL void Init_vte_charattributes(VALUE mVte); G_GNUC_INTERNAL void Init_vte_pty(VALUE mVte); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvtereaper.c���������������������������������������������������0000644�0001750�0001750�00000002267�12516434313�017652� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte3private.h" #define RG_TARGET_NAMESPACE cReaper static VALUE rg_s_get(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(vte_reaper_get()); } void Init_vte_reaper(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_REAPER, "Reaper", mVte); RG_DEF_SMETHOD(get, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvte3conversions.h���������������������������������������������0000644�0001750�0001750�00000005364�12516434313�021035� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2014 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 __RBVTE3CONVERSIONS_H__ #define __RBVTE3CONVERSIONS_H__ #define RVAL2VTEPTY(o) (VTE_PTY(RVAL2GOBJ(o))) #define RVAL2VTETERMINAL(o) (VTE_TERMINAL(RVAL2GOBJ(o))) #define RVAL2VTETERMINALCURSORBLINKMODE(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE)) #define VTETERMINALCURSORBLINKMODE2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE)) #define RVAL2VTETERMINALCURSORSHAPE(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_CURSOR_SHAPE)) #define VTETERMINALCURSORSHAPE2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_CURSOR_SHAPE)) #define RVAL2VTETERMINALERASEBINDING(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_ERASE_BINDING)) #define VTETERMINALERASEBINDING2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_ERASE_BINDING)) #define RVAL2VTETERMINALWRITEFLAGS(o) (RVAL2GENUM(o, VTE_TYPE_TERMINAL_WRITE_FLAGS)) #define VTETERMINALWRITEFLAGS2RVAL(o) (GENUM2RVAL(o, VTE_TYPE_TERMINAL_WRITE_FLAGS)) #define RVAL2VTEPTYFLAGS(o) (RVAL2GFLAGS(o, VTE_TYPE_PTY_FLAGS)) #define VTEPTYFLAGS2RVAL(o) (GFLAGS2RVAL(o, VTE_TYPE_PTY_FLAGS)) /* For GIO. They are temporary. They will be needless after Ruby/GDK3 * is based on Ruby/GObjectIntrospection. */ #define RVAL2GCANCELLABLE(o) (G_CANCELLABLE(RVAL2GOBJ(o))) #define RVAL2GOUTPUTSTREAM(o) (G_OUTPUT_STREAM(RVAL2GOBJ(o))) /* For GDK3. They are temporary. They will be needless after Ruby/GDK3 * is based on Ruby/GObjectIntrospection. */ #define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o))) #define RVAL2GDKCOLOR(o) ((GdkColor*)RVAL2BOXED(o, GDK_TYPE_COLOR)) #define GDKCOLOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_COLOR)) #define RVAL2GDKCURSOR(o) ((GdkCursor*)RVAL2BOXED(o, GDK_TYPE_CURSOR)) #define RVAL2GDKCURSORTYPE(o) (RVAL2GENUM(o, GDK_TYPE_CURSOR_TYPE)) #endif /* __RBVTE3CONVERSIONS_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvteterminal.c�������������������������������������������������0000644�0001750�0001750�00000060512�12516434313�020204� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte3private.h" #include <stdarg.h> #include <pwd.h> #define RG_TARGET_NAMESPACE cTerminal #define _SELF(s) (RVAL2VTETERMINAL(s)) static ID id_new, id_call; static char ** rval2cstrary(VALUE ary) { long i, len; char **result; if (NIL_P(ary)) return NULL; len = RARRAY_LEN(ary); result = ALLOC_N(char *, len + 1); for (i = 0; i < len; i++) { result[i] = g_strdup(RVAL2CSTR(RARRAY_PTR(ary)[i])); } result[i] = NULL; return result; } static void free_cstrary(char **ary) { long i; if (!ary) return; for (i = 0; ary[i] != NULL; i++) { g_free(ary[i]); } g_free(ary); } static VALUE attrary2rval(GArray *attrs) { long i, len; VALUE rb_attrs, rb_class; len = attrs->len; rb_attrs = rb_ary_new2(len); rb_class = rb_const_get(rb_const_get(rb_cObject, rb_intern("Vte")), rb_intern("CharAttributes")); for (i = 0; i < len; i++) { VteCharAttributes *attr; attr = &g_array_index(attrs, VteCharAttributes, i); rb_ary_push(rb_attrs, rb_funcall(rb_class, id_new, 6, LONG2NUM(attr->row), LONG2NUM(attr->column), GDKCOLOR2RVAL(&(attr->fore)), GDKCOLOR2RVAL(&(attr->back)), CBOOL2RVAL(attr->underline), CBOOL2RVAL(attr->strikethrough))); } return rb_attrs; } static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, vte_terminal_new()); return Qnil; } static VALUE fork_command_default_argv(void) { struct passwd *pwd; const char *shell = NULL; pwd = getpwuid(getuid()); if (pwd != NULL) shell = pwd->pw_shell; if (shell == NULL) shell = g_getenv("SHELL") ? g_getenv("SHELL") : "/bin/sh"; return rb_ary_new3(1, CSTR2RVAL(shell)); } static VALUE rg_fork_command(int argc, VALUE *argv, VALUE self) { VALUE options, rb_pty_flags, rb_working_directory, rb_command_argv, rb_envv, rb_spawn_flags; int pty_flags, spawn_flags; char *working_directory; char **command_argv; char **envv; GPid child_pid; gboolean result; GError *error = NULL; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "pty_flags", &rb_pty_flags, "working_directory", &rb_working_directory, "argv", &rb_command_argv, "envv", &rb_envv, "spawn_flags", &rb_spawn_flags, NULL); pty_flags = NIL_P(rb_pty_flags) ? VTE_PTY_DEFAULT : RVAL2VTEPTYFLAGS(rb_pty_flags); working_directory = RVAL2CSTR_ACCEPT_NIL(rb_working_directory); command_argv = rval2cstrary(NIL_P(rb_command_argv) ? fork_command_default_argv() : rb_command_argv); envv = rval2cstrary(rb_envv); spawn_flags = NIL_P(rb_spawn_flags) ? G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH : NUM2INT(rb_spawn_flags); result = vte_terminal_fork_command_full(_SELF(self), pty_flags, working_directory, command_argv, envv, spawn_flags, NULL, NULL, &child_pid, &error); free_cstrary(command_argv); free_cstrary(envv); if (error) RAISE_GERROR(error); return INT2NUM(child_pid); } static VALUE rg_feed(VALUE self, VALUE data) { glong length; length = RSTRING_LEN(data); if (length > 0) { vte_terminal_feed(_SELF(self), RSTRING_PTR(data), length); } return self; } static VALUE rg_feed_child(VALUE self, VALUE data) { glong length; length = RSTRING_LEN(data); if (length > 0) { vte_terminal_feed_child(_SELF(self), RSTRING_PTR(data), length); } return self; } static VALUE rg_feed_child_binary(VALUE self, VALUE data) { glong length; length = RSTRING_LEN(data); if (length > 0) { vte_terminal_feed_child_binary(_SELF(self), RSTRING_PTR(data), length); } return self; } static VALUE rg_copy_clipboard(VALUE self) { vte_terminal_copy_clipboard(_SELF(self)); return self; } static VALUE rg_paste_clipboard(VALUE self) { vte_terminal_paste_clipboard(_SELF(self)); return self; } static VALUE rg_copy_primary(VALUE self) { vte_terminal_copy_primary(_SELF(self)); return self; } static VALUE rg_paste_primary(VALUE self) { vte_terminal_paste_primary(_SELF(self)); return self; } static VALUE rg_set_size(VALUE self, VALUE columns, VALUE rows) { vte_terminal_set_size(_SELF(self), NUM2LONG(columns), NUM2LONG(rows)); return self; } static VALUE rg_set_audible_bell(VALUE self, VALUE is_audible) { vte_terminal_set_audible_bell(_SELF(self), RVAL2CBOOL(is_audible)); return self; } static VALUE rg_audible_bell_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_audible_bell(_SELF(self))); } static VALUE rg_set_visible_bell(VALUE self, VALUE is_visible) { vte_terminal_set_visible_bell(_SELF(self), RVAL2CBOOL(is_visible)); return self; } static VALUE rg_visible_bell_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_visible_bell(_SELF(self))); } static VALUE rg_set_scroll_background(VALUE self, VALUE scroll) { vte_terminal_set_scroll_background(_SELF(self), RVAL2CBOOL(scroll)); return self; } static VALUE rg_set_scroll_on_output(VALUE self, VALUE scroll) { vte_terminal_set_scroll_on_output(_SELF(self), RVAL2CBOOL(scroll)); return self; } static VALUE rg_set_scroll_on_keystroke(VALUE self, VALUE scroll) { vte_terminal_set_scroll_on_keystroke(_SELF(self), RVAL2CBOOL(scroll)); return self; } #if VTE_CHECK_VERSION(0, 36, 0) static VALUE rg_rewrap_on_resize_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_rewrap_on_resize(_SELF(self))); } static VALUE rg_set_rewrap_on_resize(VALUE self, VALUE rewrap) { vte_terminal_set_rewrap_on_resize(_SELF(self), RVAL2CBOOL(rewrap)); return self; } #endif static VALUE rg_set_color_dim(VALUE self, VALUE dim) { vte_terminal_set_color_dim(_SELF(self), RVAL2GDKCOLOR(dim)); return self; } static VALUE rg_set_color_bold(VALUE self, VALUE bold) { vte_terminal_set_color_bold(_SELF(self), RVAL2GDKCOLOR(bold)); return self; } static VALUE rg_set_color_foreground(VALUE self, VALUE foreground) { vte_terminal_set_color_foreground(_SELF(self), RVAL2GDKCOLOR(foreground)); return self; } static VALUE rg_set_color_background(VALUE self, VALUE background) { vte_terminal_set_color_background(_SELF(self), RVAL2GDKCOLOR(background)); return self; } static VALUE rg_set_color_cursor(VALUE self, VALUE cursor) { vte_terminal_set_color_cursor(_SELF(self), NIL_P(cursor) ? NULL : RVAL2GDKCOLOR(cursor)); return self; } static VALUE rg_set_color_highlight(VALUE self, VALUE highlight) { vte_terminal_set_color_highlight(_SELF(self), NIL_P(highlight) ? NULL : RVAL2GDKCOLOR(highlight)); return self; } static VALUE rg_set_colors(VALUE self, VALUE foreground, VALUE background, VALUE rb_palette) { glong i, len; GdkColor *palette; len = RARRAY_LEN(rb_palette); if (!(len == 0 || len == 8 || len == 16 || len == 24)) { char *inspect; inspect = RVAL2CSTR(rb_palette); rb_raise(rb_eArgError, "palette size must be 0, 8, 16 or 24: %s", inspect); } palette = ALLOCA_N(GdkColor, len); for (i = 0; i < len; i++) { GdkColor *color; color = RVAL2GDKCOLOR(RARRAY_PTR(rb_palette)[i]); palette[i] = *color; } vte_terminal_set_colors(_SELF(self), RVAL2GDKCOLOR(foreground), RVAL2GDKCOLOR(background), palette, len); return self; } static VALUE rg_set_default_colors(VALUE self) { vte_terminal_set_default_colors(_SELF(self)); return self; } static VALUE rg_set_background_image(VALUE self, VALUE image_or_path) { if (RVAL2CBOOL(rb_obj_is_kind_of(image_or_path, rb_cString))) { vte_terminal_set_background_image_file(_SELF(self), RVAL2CSTR(image_or_path)); } else { vte_terminal_set_background_image(_SELF(self), RVAL2GDKPIXBUF(image_or_path)); } return self; } static VALUE rg_set_background_tint_color(VALUE self, VALUE color) { vte_terminal_set_background_tint_color(_SELF(self), RVAL2GDKCOLOR(color)); return self; } static VALUE rg_set_background_saturation(VALUE self, VALUE saturation) { vte_terminal_set_background_saturation(_SELF(self), NUM2DBL(saturation)); return self; } static VALUE rg_set_background_transparent(VALUE self, VALUE transparent) { vte_terminal_set_background_transparent(_SELF(self), RVAL2CBOOL(transparent)); return self; } static VALUE rg_set_cursor_blinks(VALUE self, VALUE blink) { VteTerminalCursorBlinkMode mode; mode = RVAL2CBOOL(blink) ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF; vte_terminal_set_cursor_blink_mode(_SELF(self), mode); return self; } static VALUE rg_set_cursor_blink_mode(VALUE self, VALUE rb_mode) { VteTerminalCursorBlinkMode mode; mode = RVAL2VTETERMINALCURSORBLINKMODE(rb_mode); vte_terminal_set_cursor_blink_mode(_SELF(self), mode); return self; } static VALUE rg_cursor_blink_mode(VALUE self) { VteTerminalCursorBlinkMode mode; mode = vte_terminal_get_cursor_blink_mode(_SELF(self)); return VTETERMINALCURSORBLINKMODE2RVAL(mode); } static VALUE rg_set_cursor_shape(VALUE self, VALUE rb_shape) { VteTerminalCursorShape shape; shape = RVAL2VTETERMINALCURSORSHAPE(rb_shape); vte_terminal_set_cursor_shape(_SELF(self), shape); return self; } static VALUE rg_cursor_shape(VALUE self) { VteTerminalCursorShape shape; shape = vte_terminal_get_cursor_shape(_SELF(self)); return VTETERMINALCURSORSHAPE2RVAL(shape); } static VALUE rg_child_exit_status(VALUE self) { return INT2NUM(vte_terminal_get_child_exit_status(_SELF(self))); } static VALUE rg_set_scrollback_lines(VALUE self, VALUE lines) { vte_terminal_set_scrollback_lines(_SELF(self), NUM2LONG(lines)); return self; } static VALUE rg_im_append_menuitems(VALUE self, VALUE menushell) { vte_terminal_im_append_menuitems(_SELF(self), RVAL2GTKMENUSHELL(menushell)); return self; } static VALUE rg_set_font(VALUE self, VALUE desc_or_name) { if (rb_obj_is_kind_of(desc_or_name, rb_cString)) { vte_terminal_set_font_from_string(_SELF(self), RVAL2CSTR(desc_or_name)); } else { vte_terminal_set_font(_SELF(self), RVAL2PANGOFONTDESCRIPTION(desc_or_name)); } return self; } static VALUE rg_font(VALUE self) { PangoFontDescription *font_desc; font_desc = (PangoFontDescription *)vte_terminal_get_font(_SELF(self)); return PANGOFONTDESCRIPTION2RVAL(font_desc); } static VALUE rg_set_allow_bold(VALUE self, VALUE allow_bold) { vte_terminal_set_allow_bold(_SELF(self), RVAL2CBOOL(allow_bold)); return self; } static VALUE rg_allow_bold_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_allow_bold(_SELF(self))); } static VALUE rg_has_selection_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_has_selection(_SELF(self))); } static VALUE rg_set_word_chars(VALUE self, VALUE word_chars) { vte_terminal_set_word_chars(_SELF(self), RVAL2CSTR_ACCEPT_NIL(word_chars)); return self; } static VALUE rg_word_char_p(VALUE self, VALUE c) { return CBOOL2RVAL(vte_terminal_is_word_char(_SELF(self), NUM2UINT(c))); } static VALUE rg_set_backspace_binding(VALUE self, VALUE binding) { vte_terminal_set_backspace_binding(_SELF(self), RVAL2VTETERMINALERASEBINDING(binding)); return self; } static VALUE rg_set_delete_binding(VALUE self, VALUE binding) { vte_terminal_set_delete_binding(_SELF(self), RVAL2VTETERMINALERASEBINDING(binding)); return self; } static VALUE rg_mouse_autohide_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_mouse_autohide(_SELF(self))); } static VALUE rg_set_mouse_autohide(VALUE self, VALUE setting) { vte_terminal_set_mouse_autohide(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_reset(VALUE self, VALUE full, VALUE clear_history) { vte_terminal_reset(_SELF(self), RVAL2CBOOL(full), RVAL2CBOOL(clear_history)); return self; } static gboolean term_is_selected_cb(VteTerminal *terminal, glong column, glong row, gpointer data) { gboolean result = TRUE; VALUE callback = (VALUE)data; if (!NIL_P(callback)) { VALUE rb_result; rb_result = rb_funcall(callback, id_call, 3, GOBJ2RVAL(terminal), LONG2NUM(column), LONG2NUM(row)); result = RVAL2CBOOL(rb_result); } return result; } static VALUE rg_get_text(int argc, VALUE *argv, VALUE self) { VALUE get_attrs, include_trailing_spaces, proc, rb_text; GArray *attrs = NULL; char *text; rb_scan_args(argc, argv, "02&", &get_attrs, &include_trailing_spaces, &proc); if (get_attrs != Qfalse) attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes)); if (RVAL2CBOOL(include_trailing_spaces)) { text = vte_terminal_get_text_include_trailing_spaces( _SELF(self), term_is_selected_cb, (gpointer)proc, attrs); } else { text = vte_terminal_get_text(_SELF(self), term_is_selected_cb, (gpointer)proc, attrs); } rb_text = CSTR2RVAL(text); free(text); if (attrs) { VALUE rb_attrs; rb_attrs = attrary2rval(attrs); g_array_free(attrs, TRUE); return rb_ary_new3(2, rb_text, rb_attrs); } else { return rb_text; } } static VALUE rg_get_text_range(int argc, VALUE *argv, VALUE self) { VALUE start_row, start_col, end_row, end_col, get_attrs, proc, rb_text; GArray *attrs = NULL; char *text; rb_scan_args(argc, argv, "41&", &start_row, &start_col, &end_row, &end_col, &get_attrs, &proc); if (get_attrs != Qfalse) attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes)); text = vte_terminal_get_text_range(_SELF(self), NUM2LONG(start_row), NUM2LONG(start_col), NUM2LONG(end_row), NUM2LONG(end_col), term_is_selected_cb, (gpointer)proc, attrs); rb_text = CSTR2RVAL(text); free(text); if (attrs) { VALUE rb_attrs; rb_attrs = attrary2rval(attrs); g_array_free(attrs, TRUE); return rb_ary_new3(2, rb_text, rb_attrs); } else { return rb_text; } } static VALUE rg_cursor_position(VALUE self) { glong column, row; vte_terminal_get_cursor_position(_SELF(self), &column, &row); return rb_ary_new3(2, LONG2NUM(column), LONG2NUM(row)); } static VALUE rg_match_clear_all(VALUE self) { vte_terminal_match_clear_all(_SELF(self)); return self; } static VALUE rg_match_add(VALUE self, VALUE match) { return INT2NUM(vte_terminal_match_add(_SELF(self), RVAL2CSTR(match))); } static VALUE rg_match_set_cursor(VALUE self, VALUE tag, VALUE cursor) { if (NIL_P(cursor) || RVAL2GTYPE(cursor) == GDK_TYPE_CURSOR) { vte_terminal_match_set_cursor(_SELF(self), NUM2INT(tag), RVAL2GDKCURSOR(cursor)); } else if (RVAL2GTYPE(cursor) == GDK_TYPE_CURSOR_TYPE) { vte_terminal_match_set_cursor_type(_SELF(self), NUM2INT(tag), RVAL2GDKCURSORTYPE(cursor)); } else { vte_terminal_match_set_cursor_name(_SELF(self), NUM2INT(tag), RVAL2CSTR(cursor)); } return self; } static VALUE rg_match_remove(VALUE self, VALUE tag) { vte_terminal_match_remove(_SELF(self), NUM2INT(tag)); return self; } static VALUE rg_match_check(VALUE self, VALUE column, VALUE row) { char *string; int tag; string = vte_terminal_match_check(_SELF(self), NUM2LONG(column), NUM2LONG(row), &tag); if (string) { VALUE rb_string; rb_string = CSTR2RVAL(string); free(string); return rb_ary_new3(2, rb_string, INT2NUM(tag)); } else { return Qnil; } } static VALUE rg_default_emulation(VALUE self) { return CSTR2RVAL(vte_terminal_get_default_emulation(_SELF(self))); } static VALUE rg_status_line(VALUE self) { return CSTR2RVAL(vte_terminal_get_status_line(_SELF(self))); } static VALUE rg_adjustment(VALUE self) { return GOBJ2RVAL(vte_terminal_get_adjustment(_SELF(self))); } static VALUE rg_char_width(VALUE self) { return LONG2NUM(vte_terminal_get_char_width(_SELF(self))); } static VALUE rg_char_height(VALUE self) { return LONG2NUM(vte_terminal_get_char_height(_SELF(self))); } static VALUE rg_row_count(VALUE self) { return LONG2NUM(vte_terminal_get_row_count(_SELF(self))); } static VALUE rg_column_count(VALUE self) { return LONG2NUM(vte_terminal_get_column_count(_SELF(self))); } static VALUE rg_window_title(VALUE self) { return CSTR2RVAL(vte_terminal_get_window_title(_SELF(self))); } static VALUE rg_icon_title(VALUE self) { return CSTR2RVAL(vte_terminal_get_icon_title(_SELF(self))); } static VALUE rg_pty_new(VALUE self, VALUE flags) { VtePty *result; GError *error = NULL; result = vte_terminal_pty_new(_SELF(self), RVAL2VTEPTYFLAGS(flags), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(result); } static VALUE rg_search_find_next(VALUE self) { gboolean result; result = vte_terminal_search_find_next(_SELF(self)); return CBOOL2RVAL(result); } static VALUE rg_search_find_previous(VALUE self) { gboolean result; result = vte_terminal_search_find_previous(_SELF(self)); return CBOOL2RVAL(result); } static VALUE rg_search_get_wrap_around_p(VALUE self) { gboolean result; result = vte_terminal_search_get_wrap_around(_SELF(self)); return CBOOL2RVAL(result); } static VALUE rg_search_set_wrap_around(VALUE self, VALUE wrap_around) { vte_terminal_search_set_wrap_around(_SELF(self), RVAL2CBOOL(wrap_around)); return self; } static VALUE rg_select_all(VALUE self) { vte_terminal_select_all(_SELF(self)); return self; } static VALUE rg_select_none(VALUE self) { vte_terminal_select_none(_SELF(self)); return self; } static VALUE rg_set_opacity(VALUE self, VALUE opacity) { vte_terminal_set_opacity(_SELF(self), NUM2UINT(opacity)); return self; } static VALUE rg_watch_child(VALUE self, VALUE child_pid) { vte_terminal_watch_child(_SELF(self), NUM2INT(child_pid)); return self; } static VALUE rg_write_contents(int argc, VALUE *argv, VALUE self) { VALUE stream, flags, rb_cancellable; GCancellable *cancellable; gboolean result; GError *error = NULL; rb_scan_args(argc, argv, "21", &stream, &flags, &rb_cancellable); cancellable = NIL_P(rb_cancellable) ? NULL : RVAL2GCANCELLABLE(rb_cancellable); result = vte_terminal_write_contents(_SELF(self), RVAL2GOUTPUTSTREAM(stream), RVAL2VTETERMINALWRITEFLAGS(flags), cancellable, &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } void Init_vte_terminal(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; id_new = rb_intern("new"); id_call = rb_intern("call"); RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_TERMINAL, "Terminal", mVte); G_DEF_CLASS(VTE_TYPE_TERMINAL_ERASE_BINDING, "EraseBinding", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, "CursorBlinkMode", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_SHAPE, "CursorShape", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_TERMINAL_WRITE_FLAGS, "WriteFlags", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(fork_command, -1); RG_DEF_METHOD(feed, 1); RG_DEF_METHOD(feed_child, 1); RG_DEF_METHOD(feed_child_binary, 1); RG_DEF_METHOD(copy_clipboard, 0); RG_DEF_METHOD(paste_clipboard, 0); RG_DEF_METHOD(copy_primary, 0); RG_DEF_METHOD(paste_primary, 0); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(set_audible_bell, 1); RG_DEF_METHOD_P(audible_bell, 0); RG_DEF_METHOD(set_visible_bell, 1); RG_DEF_METHOD_P(visible_bell, 0); RG_DEF_METHOD(set_scroll_background, 1); RG_DEF_METHOD(set_scroll_on_output, 1); RG_DEF_METHOD(set_scroll_on_keystroke, 1); #if VTE_CHECK_VERSION(0, 36, 0) RG_DEF_METHOD_P(rewrap_on_resize, 0); RG_REPLACE_SET_PROPERTY(rewrap_on_resize, 1); #endif RG_DEF_METHOD(set_color_dim, 1); RG_DEF_METHOD(set_color_bold, 1); RG_DEF_METHOD(set_color_foreground, 1); RG_DEF_METHOD(set_color_background, 1); RG_DEF_METHOD(set_color_cursor, 1); RG_DEF_METHOD(set_color_highlight, 1); RG_DEF_METHOD(set_colors, 3); RG_DEF_METHOD(set_default_colors, 0); RG_DEF_METHOD(set_background_image, 1); RG_DEF_METHOD(set_background_tint_color, 1); RG_DEF_METHOD(set_background_saturation, 1); RG_DEF_METHOD(set_background_transparent, 1); RG_DEF_METHOD(set_cursor_blinks, 1); RG_DEF_METHOD(set_cursor_blink_mode, 1); RG_DEF_METHOD(cursor_blink_mode, 0); RG_DEF_METHOD(set_cursor_shape, 1); RG_DEF_METHOD(cursor_shape, 0); RG_DEF_METHOD(child_exit_status, 0); RG_DEF_METHOD(set_scrollback_lines, 1); RG_DEF_METHOD(im_append_menuitems, 1); RG_DEF_METHOD(set_font, 1); RG_DEF_METHOD(font, 0); RG_DEF_METHOD(set_allow_bold, 1); RG_DEF_METHOD_P(allow_bold, 0); RG_DEF_METHOD_P(has_selection, 0); RG_DEF_ALIAS("have_selection?", "has_selection?"); RG_DEF_METHOD(set_word_chars, 1); RG_DEF_METHOD_P(word_char, 1); RG_DEF_METHOD(set_backspace_binding, 1); RG_DEF_METHOD(set_delete_binding, 1); RG_DEF_METHOD_P(mouse_autohide, 0); RG_DEF_METHOD(set_mouse_autohide, 1); RG_DEF_METHOD(reset, 2); RG_DEF_METHOD(get_text, -1); RG_DEF_METHOD(get_text_range, -1); RG_DEF_METHOD(cursor_position, 0); RG_DEF_METHOD(match_clear_all, 0); RG_DEF_METHOD(match_add, 1); RG_DEF_METHOD(match_set_cursor, 2); RG_DEF_METHOD(match_remove, 1); RG_DEF_METHOD(match_check, 2); RG_DEF_METHOD(default_emulation, 0); RG_DEF_METHOD(status_line, 0); RG_DEF_METHOD(adjustment, 0); RG_DEF_METHOD(char_width, 0); RG_DEF_METHOD(char_height, 0); RG_DEF_METHOD(row_count, 0); RG_DEF_METHOD(column_count, 0); RG_DEF_METHOD(window_title, 0); RG_DEF_METHOD(icon_title, 0); RG_DEF_METHOD(pty_new, 1); RG_DEF_METHOD(search_find_next, 0); RG_DEF_METHOD(search_find_previous, 0); RG_DEF_METHOD_P(search_get_wrap_around, 0); RG_DEF_METHOD(search_set_wrap_around, 1); RG_DEF_ALIAS("search_wrap_around=", "search_set_wrap_around"); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(select_none, 0); RG_DEF_METHOD(set_opacity, 1); RG_DEF_METHOD(watch_child, 1); RG_DEF_METHOD(write_contents, -1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/ext/vte3/rbvtepty.c������������������������������������������������������0000644�0001750�0001750�00000005321�12516434313�017202� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbvte3private.h" #define RG_TARGET_NAMESPACE cPty #define _SELF(s) (RVAL2VTEPTY(s)) static VALUE rg_initialize(VALUE self, VALUE flags_or_fd) { VtePty *pty = NULL; GError *error = NULL; if (TYPE(flags_or_fd) == T_FIXNUM) { pty = vte_pty_new_foreign(NUM2INT(flags_or_fd), &error); } else { pty = vte_pty_new(RVAL2VTEPTYFLAGS(flags_or_fd), &error); } if (error) RAISE_GERROR(error); G_INITIALIZE(self, pty); return Qnil; } static VALUE rg_child_setup(VALUE self) { vte_pty_child_setup(_SELF(self)); return self; } static VALUE rg_close(VALUE self) { vte_pty_close(_SELF(self)); return self; } static VALUE rg_size(VALUE self) { int rows, columns; gboolean result; GError *error = NULL; result = vte_pty_get_size(_SELF(self), &rows, &columns, &error); if (error) RAISE_GERROR(error); return rb_ary_new3(2, INT2NUM(rows), INT2NUM(columns)); } static VALUE rg_set_size(VALUE self, VALUE rows, VALUE columns) { gboolean result; GError *error = NULL; result = vte_pty_set_size(_SELF(self), NUM2INT(rows), NUM2INT(columns), &error); if (error) RAISE_GERROR(error); return self; } static VALUE rg_set_utf8(VALUE self, VALUE utf8) { gboolean result; GError *error = NULL; result = vte_pty_set_utf8(_SELF(self), RVAL2CBOOL(utf8), &error); if (error) RAISE_GERROR(error); return self; } void Init_vte_pty(VALUE mVte) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_PTY, "Pty", mVte); G_DEF_CLASS(VTE_TYPE_PTY_ERROR, "Error", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_PTY_FLAGS, "Flags", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(child_setup, 0); RG_DEF_METHOD(close, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(set_utf8, 1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/COPYING.LIB��������������������������������������������������������������0000644�0001750�0001750�00000063642�12257552170�015154� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/lib/���������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�014243� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/lib/vte3.rb��������������������������������������������������������������0000644�0001750�0001750�00000000074�12516434313�015452� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������require "gtk3" require "vte3.so" require "vte3/deprecated" ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/lib/vte3/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015124� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/lib/vte3/deprecated.rb���������������������������������������������������0000644�0001750�0001750�00000003615�12516434313�017556� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������module Vte extend GLib::Deprecatable class Terminal extend GLib::Deprecatable define_deprecated_const :EraseBinding, 'Vte::TerminalEraseBinding' define_deprecated_const :CursorBlinkMode, 'Vte::TerminalCursorBlinkMode' define_deprecated_const :CursorShape, 'Vte::TerminalCursorShape' define_deprecated_const :WriteFlags, 'Vte::TerminalWriteFlags' define_deprecated_method :match_set_cursor_type, :match_set_cursor define_deprecated_method :fork_pty, :raise => "Use 'Vte::Pty#fork'." define_deprecated_method :using_xft?, :warn => "Don't use this method." do |_self| false end define_deprecated_method :padding, :warn => "Use 'inner-border' style property." do |_self| [0, 0] end define_deprecated_method :char_descent, :warn => "Don't use this method." do |_self| 0 end define_deprecated_method :char_ascent, :warn => "Don't use this method." do |_self| 0 end define_deprecated_method_by_hash_args :fork_command, 'command, argv, envv, directory, lastlog, utmp, wtmp', ':pty_flags => :default, :working_directory => <current>, :argv => <user_shell>, :envv => nil, :spawn_flags => :child_inherits_stdin' do |_self, command, argv, envv, directory, lastlog = true, utmp = true, wtmp = true| pty_flags = [!lastlog && :no_lastlog, !utmp && :no_utmp, !wtmp && :no_wtmp].select{|f| f} argv = command && [command, *argv] [{:pty_flags => pty_flags, :working_directory => directory, :argv => argv, :envv => envv}] end alias :__set_font__ :set_font private :__set_font__ def set_font(*args) if args.size == 1 params = args.first else raise GLib::DeprecatedError.new("#{caller[0]}: '#{self.class}#set_font(desc_or_name, antialias)' style has been deprecated. Use '#{self.class}#set_font(desc_or_name)' style.") end __set_font__(params) end end end �������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/sample/������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�014756� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/sample/terminal.rb�������������������������������������������������������0000755�0001750�0001750�00000001224�12516434313�017120� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin terminal.rb - Ruby/VTE sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: terminal.rb,v 1.2 2006/06/17 13:27:51 mutoh Exp $ =end require "vte3" window = Gtk::Window.new("Terminal sample") window.signal_connect("destroy"){Gtk.main_quit} terminal = Vte::Terminal.new terminal.set_font("Monospace 16") terminal.signal_connect("child-exited") do |widget| Gtk.main_quit end terminal.signal_connect("window-title-changed") do |widget| window.title = terminal.window_title end terminal.fork_command window.add(terminal) window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/sample/multiterm.rb������������������������������������������������������0000755�0001750�0001750�00000005120�12516434313�017326� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin multiterm.rb - Ruby/VTE sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: multiterm.rb,v 1.2 2006/06/17 13:27:51 mutoh Exp $ =end require "vte3" class MultiTerm def initialize @terminals = [] init_window add_terminal end def run @window.show_all @notebook.get_nth_page(@notebook.page).grab_focus end private def init_window @window = Gtk::Window.new("MultiTerm sample") @window.signal_connect("destroy") do |widget| Gtk.main_quit end init_notebook @window.add(@notebook) end def init_notebook @notebook = Gtk::Notebook.new @last_page_index = nil @notebook.signal_connect_after("switch-page") do |widget, page, i| max_page_index = widget.n_pages - 1 if max_page_index > 0 and i == max_page_index widget.page = @last_page_index end end @notebook.signal_connect("switch-page") do |widget, page, i| @last_page_index ||= i terminal = widget.get_nth_page(i) if terminal.respond_to?(:window_title) @last_page_index = i update_window_title(terminal.window_title) end end @notebook.tab_reorderable = true if @notebook.respond_to?(:tab_reorderable=) @notebook.scrollable = true init_new_tab_label dummy = Gtk::EventBox.new @notebook.append_page(dummy, @new_tab_label) end def init_new_tab_label @new_tab_label = Gtk::EventBox.new @new_tab_label.signal_connect("button-press-event") do |widget, event| add_terminal @notebook.page = @last_page_index true end # @new_tab_label.set_size_request(30, -1) image = Gtk::Image.new(Gtk::Stock::NEW, Gtk::IconSize::MENU) image.show @new_tab_label.add(image) @new_tab_label end def destroy @window.destroy end def add_terminal terminal = Vte::Terminal.new terminal.signal_connect("child-exited") do |widget| @notebook.remove_page(@notebook.page_num(widget)) @terminals.delete(widget) destroy if @terminals.empty? end terminal.signal_connect("window-title-changed") do |widget| @notebook.set_tab_label_text(widget, widget.window_title) update_window_title(widget.window_title) end terminal.set_font("Monospace 14") terminal.fork_command terminal.show last = @notebook.n_pages @notebook.insert_page(last - 1, terminal) @terminals << terminal end def update_window_title(title) @window.title = title if title end end multi_term = MultiTerm.new multi_term.run Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/patches/�����������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015124� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/patches/ncurses-5.9-support-mingw32.diff���������������������������������0000644�0001750�0001750�00000001320�12516434313�022743� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������--- ncurses-5.9/configure.orig 2011-04-01 08:35:51.000000000 +0900 +++ ncurses-5.9/configure 2013-01-20 16:03:44.730515836 +0900 @@ -5662,7 +5662,7 @@ fi cf_cv_rm_so_locs=yes ;; - linux*|gnu*|k*bsd*-gnu) #(vi + linux*|gnu*|k*bsd*-gnu|mingw32) #(vi if test "$DFT_LWR_MODEL" = "shared" ; then LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" @@ -5678,7 +5678,7 @@ cf_cv_shared_soname='`basename $@`' fi - MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' + MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats -o $@' ;; openbsd[2-9].*) #(vi if test "$DFT_LWR_MODEL" = "shared" ; then ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte3/patches/ncurses-5.9-add-missing-exe.diff���������������������������������0000644�0001750�0001750�00000000606�12516434313�022727� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������--- ncurses-5.9/ncurses/tinfo/MKcaptab.sh.orig 2010-12-26 08:43:58.000000000 +0900 +++ ncurses-5.9/ncurses/tinfo/MKcaptab.sh 2013-01-20 10:20:20.799215399 +0900 @@ -52,8 +52,8 @@ EOF -./make_hash 1 info $OPT1 <$DATA -./make_hash 3 cap $OPT1 <$DATA +./make_hash.exe 1 info $OPT1 <$DATA +./make_hash.exe 3 cap $OPT1 <$DATA $AWK -f $OPT2 bigstrings=$OPT1 tablename=capalias <$DATA ��������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�014602� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/test/���������������������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�015574� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/test/gstreamer-test-utils.rb����������������������������������������0000644�0001750�0001750�00000001436�12416346617�022231� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 require "test-unit" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/test/run-test.rb����������������������������������������������������0000755�0001750�0001750�00000003366�12416346617�017715� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2014 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") gstreamer_base = File.join(ruby_gnome2_base, "gstreamer") modules = [ [glib_base, "glib2"], [gobject_introspection_base, "gobject-introspection"], [gstreamer_base, "gstreamer"], ] modules.each do |target, module_name| makefile = File.join(target, "Makefile") if File.exist?(makefile) and system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(gstreamer_base, "test")) require "gstreamer-test-utils" require "gst" Gst.init exit Test::Unit::AutoRunner.run(true) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/test/test-child-proxy.rb��������������������������������������������0000644�0001750�0001750�00000001776�12416346617�021353� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestChildProxy < Test::Unit::TestCase def setup @bin = Gst::ElementFactory.make("decodebin") end def test_property any_caps = Gst::Caps.any @bin.caps = any_caps assert_equal(any_caps.to_s, @bin.caps.to_s) end end ��ruby-gnome2-all-2.2.5/gstreamer/test/test-element-factory.rb����������������������������������������0000644�0001750�0001750�00000001673�12416346617�022203� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestElementFactory < Test::Unit::TestCase def test_find name = "playbin" factory = Gst::ElementFactory.find(name) assert_equal(name, factory.name) end end ���������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/test/test-caps.rb���������������������������������������������������0000644�0001750�0001750�00000002120�12416346617�020017� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestCaps < Test::Unit::TestCase class TestConstructor < self def test_any assert_equal("ANY", Gst::Caps.any.to_s) end def test_empty assert_equal("EMPTY", Gst::Caps.empty.to_s) end def test_media_type assert_equal("audio/ogg", Gst::Caps.new("audio/ogg").to_s) end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/extconf.rb����������������������������������������������������������0000644�0001750�0001750�00000002230�11701304107�016565� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "gstreamer" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/Rakefile������������������������������������������������������������0000644�0001750�0001750�00000015450�12446231157�016262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2/rake/package-task' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GStreamer is a Ruby binding for GStreamer." package.description = "Ruby/GStreamer is a Ruby binding for GStreamer." package.dependency.gem.runtime = ["glib2", "gobject-introspection"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", "gtk2", "gobject-introspection", ] xiph_download_url_base = "http://downloads.xiph.org/releases" freedesktop_download_url_base = "http://gstreamer.freedesktop.org/src" sf_net_download_url_base = "http://downloads.sourceforge.net/project" libmad_version = "0.15.1b" package.external_packages = [ { :name => "libjpeg", :base_name => "jpeg-9a", :archive_base_name => "jpegsrc.v9a.tar.gz", :download_base_url => "http://www.ijg.org/files", :label => "libjpeg", :windows => { :configure_args => [], :built_file => "bin/libjpeg-9.dll", }, }, { :name => "sqlite-autoconf", :download_base_url => "http://www.sqlite.org/2014", :label => "SQLite", :version => "3080600", :compression_method => "gz", :windows => { :configure_args => [], :built_file => "bin/libsqlite3-0.dll", }, }, { :name => "libsoup", :download_site => :gnome, :label => "libsoup", :version => "2.48.1", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", "--without-apache-httpd", ], :build_concurrently => false, :patches => [ ], :built_file => "bin/libsoup-2.4-1.dll", }, }, { :name => "libogg", :download_base_url => "#{xiph_download_url_base}/ogg", :label => "Ogg", :version => "1.3.1", :windows => { :configure_args => [], :built_file => "bin/libogg-0.dll", }, }, { :name => "libvorbis", :download_base_url => "#{xiph_download_url_base}/vorbis", :label => "Vorbis", :version => "1.3.3", :windows => { :configure_args => [], :built_file => "bin/libvorbis-0.dll", }, }, { :name => "libtheora", :download_base_url => "#{xiph_download_url_base}/theora", :label => "Theora", :version => "1.1.1", :windows => { :configure_args => [ "--disable-examples" ], :build_concurrently => false, :patches => [ "libtheora-1.1.1-use-lf-in-def.diff", ], :built_file => "bin/libtheora-0.dll", }, }, # { # :name => "libmad", # :download_base_url => "#{sf_net_download_url_base}/mad/libmad/#{libmad_version}", # :label => "MAD", # :version => libmad_version, # :windows => { # :configure_args => ["CFLAGS=-O3 -march=i686"], # :need_autoreconf => true, # :patches => ["libmad-0.15.1b-fix-mingw-build.diff"], # }, # }, { :name => "flac", :download_base_url => "#{xiph_download_url_base}/flac", :label => "FLAC", :version => "1.3.0", :compression_method => "xz", :windows => { :configure_args => ["--disable-cpplibs"], :built_file => "bin/libFLAC-8.dll", }, }, { :name => "speex", :download_base_url => "#{xiph_download_url_base}/speex", :label => "Speex", :version => "1.2rc1", :windows => { :configure_args => [], :built_file => "bin/libspeex-1.dll", }, }, { :name => "gstreamer", :download_base_url => "#{freedesktop_download_url_base}/gstreamer", :label => "GStreamer", :version => "1.4.3", :compression_method => "xz", :windows => { :configure_args => [ "--enable-check", "--enable-introspection", ], :build_concurrently => false, :built_file => "bin/libgstreamer-1.0-0.dll", }, }, { :name => "gst-plugins-base", :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-base", :label => "GStreamer plugins (base)", :version => "1.4.3", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :build_concurrently => false, :built_file => "lib/gstreamer-1.0/libgstgio.dll", }, }, { :name => "gst-plugins-good", :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-good", :label => "GStreamer plugins (good)", :version => "1.4.3", :compression_method => "xz", :windows => { :configure_args => [ "--disable-shout2", ], :built_file => "lib/gstreamer-1.0/libgstcairo.dll", }, }, { :name => "gst-plugins-bad", :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-bad", :label => "GStreamer plugins (bad)", :version => "1.4.3", :compression_method => "xz", :windows => { :configure_args => ["--disable-librfb"], :cc_args => [ "-std=c99", ], :built_file => "lib/gstreamer-1.0/libgstmxf.dll", }, }, # { # :name => "gst-plugins-ugly", # :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-ugly", # :label => "GStreamer plugins (ugly)", # :version => "1.4.3", # :compression_method => "xz", # :windows => { # :configure_args => [], # }, # }, { :name => "gst-libav", :download_base_url => "#{freedesktop_download_url_base}/gst-libav", :label => "GStreamer libav", :version => "1.4.3", :compression_method => "xz", :windows => { :configure_args => [ "--with-libav-extra-configure=" + "--cross-prefix=#{package.windows.build_host}- " + "--target-os=mingw32 " + "--arch=i686 " + "--pkg-config=pkg-config " + "--disable-gpl " + "--disable-yasm", ], :built_file => "lib/gstreamer-1.0/libgstlibav.dll", }, :bundled_packages => [ { :name => "libav", :path => "gst-libs/ext/libav", :license_files => [ "LICENSE", "CREDITS", "COPYING.GPLv2", "COPYING.GPLv3", "COPYING.LGPLv2.1", "COPYING.LGPLv3", ], } ], }, ] package.cross_compiling do |spec| if /mingw|mswin/ =~ spec.platform.to_s spec.add_runtime_dependency("pango", ">= #{package.version}") spec.add_runtime_dependency("gdk_pixbuf2", ">= #{package.version}") end end end package_task.define ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/README.md�����������������������������������������������������������0000644�0001750�0001750�00000001433�12257552167�016077� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/GStreamer Ruby/GStreamer is a Ruby binding for GStreamer. ## Requirements * Ruby/GLib2 and Ruby/GObjectIntrospection in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [GStreamer](http://gstreamer.freedesktop.org/) ## Install gem install gstreamer ## License Copyright (c) 2002-2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ### Exceptions Ruby scripts and image files in sample/ are ported and copied from GStreamer. Headers in samples/*.rb describes that the location of the original file of the Ruby script and image files. The original files are licensed under the LGPL v2.1 or later. ## Project Website http://ruby-gnome2.sourceforge.jp/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/����������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�015375� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�017376� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/extconf.rb��������������������������������������������0000644�0001750�0001750�00000003620�12516434313�021372� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin extconf.rb for Ruby/GStreamer extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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+)\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 = "gstreamer" package_id = "gstreamer-1.0" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ["glib2", "gobject-introspection"].each do |package| directory = "#{package}#{version_suffix}" build_base_path = "#{directory}/tmp/#{RUBY_PLATFORM}" package_library_name = package.gsub(/-/, "_") build_dir = "#{build_base_path}/#{package_library_name}/#{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 setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libgstreamer1.0-dev", :redhat => "gstreamer-devel", :homebrew => "gstreamer", :macports => "gstreamer") exit(false) end unless PKGConfig.have_package("gobject-introspection-1.0") exit(false) end create_pkg_config_file("Ruby/GStreamer", package_id) $defs << "-DRUBY_GST_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 ����������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/depend������������������������������������������������0000644�0001750�0001750�00000000251�12064346475�020567� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gstreamer.pc $(pkgconfigdir); \ fi �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/rbgst-child-proxy.c�����������������������������������0000644�0001750�0001750�00000006053�12416346617�023137� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2014 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 "rbgst.h" #define RG_TARGET_NAMESPACE cChildProxy #define SELF(object) (GST_CHILD_PROXY(RVAL2GOBJ(object))) static void rg_raise_no_property_error(VALUE object, const gchar *name) { VALUE eNoSuchProperty; eNoSuchProperty = rb_const_get(mGLib, rb_intern("NoSuchProperty")); rb_raise(eNoSuchProperty, "%s: No such property: <%s>", rbg_inspect(object), name); } static VALUE rg_get_property(VALUE self, VALUE rb_name) { GstChildProxy *proxy; const gchar *name; GValue value = G_VALUE_INIT; VALUE rb_value; GObjectClass *g_object_class; GParamSpec *property_spec; proxy = SELF(self); name = RVAL2CSTR_ACCEPT_SYMBOL(rb_name); g_object_class = G_OBJECT_GET_CLASS(proxy); property_spec = g_object_class_find_property(g_object_class, name); if (!property_spec) { rg_raise_no_property_error(self, name); } g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(property_spec)); gst_child_proxy_get_property(proxy, name, &value); rb_value = GVAL2RVAL(&value); g_value_unset(&value); return rb_value; } static VALUE rg_set_property(VALUE self, VALUE rb_name, VALUE rb_value) { GstChildProxy *proxy; const gchar *name; GValue value = G_VALUE_INIT; GObjectClass *g_object_class; GParamSpec *property_spec; proxy = SELF(self); name = RVAL2CSTR_ACCEPT_SYMBOL(rb_name); g_object_class = G_OBJECT_GET_CLASS(proxy); property_spec = g_object_class_find_property(g_object_class, name); if (!property_spec) { rg_raise_no_property_error(self, name); } g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(property_spec)); rbgobj_rvalue_to_gvalue(rb_value, &value); gst_child_proxy_set_property(proxy, name, &value); g_value_unset(&value); return self; } void rb_gst_init_child_proxy(void) { VALUE mGst; VALUE RG_TARGET_NAMESPACE; mGst = rb_const_get(rb_cObject, rb_intern("Gst")); RG_TARGET_NAMESPACE = rb_const_get(mGst, rb_intern("ChildProxy")); rb_remove_method(RG_TARGET_NAMESPACE, "get_property"); RG_DEF_METHOD(get_property, 1); rb_remove_method(RG_TARGET_NAMESPACE, "set_property"); RG_DEF_METHOD(set_property, 2); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/rbgst.h�����������������������������������������������0000644�0001750�0001750�00000002113�12416346617�020675� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013-2014 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 <gst/gst.h> #include <rb-gobject-introspection.h> extern void Init_gstreamer (void); G_GNUC_INTERNAL extern void rb_gst_init_child_proxy (void); G_GNUC_INTERNAL extern void rb_gst_init_element_factory (void); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/rbgst-element-factory.c�������������������������������0000644�0001750�0001750�00000004041�12257552167�023770� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 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 "rbgst.h" #define RG_TARGET_NAMESPACE cElementFactory #define SELF(object) (GST_ELEMENT_FACTORY(RVAL2GOBJ(object))) static VALUE cStaticPadTemplate; static VALUE rg_static_pad_templates(VALUE self) { GstElementFactory *factory = SELF(self); const GList *templates; VALUE rb_templates; rb_templates = rb_ary_new(); templates = gst_element_factory_get_static_pad_templates(factory); for (; templates; templates = g_list_next(templates)) { GstStaticPadTemplate *template = templates->data; VALUE rb_template; rb_template = rb_funcall(cStaticPadTemplate, rb_intern("new"), 0); memcpy(DATA_PTR(rb_template), template, sizeof(GstStaticPadTemplate)); rb_ary_push(rb_templates, rb_template); } return rb_templates; } void rb_gst_init_element_factory(void) { VALUE mGst; VALUE RG_TARGET_NAMESPACE; mGst = rb_const_get(rb_cObject, rb_intern("Gst")); RG_TARGET_NAMESPACE = rb_const_get(mGst, rb_intern("ElementFactory")); cStaticPadTemplate = rb_const_get(mGst, rb_intern("StaticPadTemplate")); rb_remove_method(RG_TARGET_NAMESPACE, "static_pad_templates"); RG_DEF_METHOD(static_pad_templates, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/ext/gstreamer/rbgst.c�����������������������������������������������0000644�0001750�0001750�00000012667�12416346617�020707� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013-2014 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 "rbgst.h" static gboolean name_equal(GIArgInfo *info, const gchar *target_name) { GITypeInfo type_info; GIBaseInfo *interface_info; const gchar *namespace; const gchar *name; gboolean equal_name_p = FALSE; g_arg_info_load_type(info, &type_info); interface_info = g_type_info_get_interface(&type_info); namespace = g_base_info_get_namespace(interface_info); name = g_base_info_get_name(interface_info); if (strcmp(namespace, "Gst") == 0 && strcmp(name, target_name) == 0) { equal_name_p = TRUE; } g_base_info_unref(interface_info); return equal_name_p; } static gboolean rg_gst_bus_func_callback(GstBus *bus, GstMessage *message, gpointer user_data) { RBGICallbackData *callback_data = user_data; VALUE rb_keep; ID id_call; CONST_ID(id_call, "call"); rb_keep = rb_funcall(callback_data->rb_callback, id_call, 2, GOBJ2RVAL(bus), BOXED2RVAL(message, GST_MINI_OBJECT_TYPE(message))); if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) { rb_gi_callback_data_free(callback_data); } return RVAL2CBOOL(rb_keep); } static gpointer rg_gst_bus_func_callback_finder(GIArgInfo *info) { if (!name_equal(info, "BusFunc")) { return NULL; } return rg_gst_bus_func_callback; } static gboolean rg_gst_bus_sync_handler_callback(GstBus *bus, GstMessage *message, gpointer user_data) { RBGICallbackData *callback_data = user_data; VALUE rb_bus_sync_reply; ID id_call; CONST_ID(id_call, "call"); rb_bus_sync_reply = rb_funcall(callback_data->rb_callback, id_call, 2, GOBJ2RVAL(bus), BOXED2RVAL(message, GST_MINI_OBJECT_TYPE(message))); if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) { rb_gi_callback_data_free(callback_data); } return RVAL2GENUM(rb_bus_sync_reply, GST_TYPE_BUS_SYNC_REPLY); } static gpointer rg_gst_bus_sync_handler_callback_finder(GIArgInfo *info) { if (!name_equal(info, "BusSyncHandler")) { return NULL; } return rg_gst_bus_sync_handler_callback; } static void rg_gst_tag_foreach_func_callback(const GstTagList *list, const gchar *tag, gpointer user_data) { RBGICallbackData *callback_data = user_data; ID id_call; CONST_ID(id_call, "call"); rb_funcall(callback_data->rb_callback, id_call, 2, /* * XXX: Use gst_tag_list_copy() instead if we don't trust * users. Users should not use destructive methods such as * #insert. If many users use these methods, we shuold use * gst_tag_list_copy(). */ BOXED2RVAL((GstTagList *)list, GST_MINI_OBJECT_TYPE(list)), CSTR2RVAL(tag)); if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) { rb_gi_callback_data_free(callback_data); } } static gpointer rg_gst_tag_foreach_func_callback_finder(GIArgInfo *info) { if (!name_equal(info, "TagForeachFunc")) { return NULL; } return rg_gst_tag_foreach_func_callback; } static void rg_gst_value_list_r2g(VALUE from, GValue *to) { int i, n; if (NIL_P(from)) { return; } from = rbg_to_array(from); n = RARRAY_LEN(from); for (i = 0; i < n; i++) { VALUE rb_element; const RGObjClassInfo *class_info; GValue element = G_VALUE_INIT; rb_element = rb_ary_entry(from, i); class_info = RVAL2CINFO(rb_element); g_value_init(&element, class_info->gtype); rbgobj_rvalue_to_gvalue(rb_element, &element); gst_value_list_append_value(to, &element); } } static VALUE rg_gst_value_list_g2r(const GValue *from) { guint i, n; VALUE rb_values; n = gst_value_list_get_size(from); rb_values = rb_ary_new(); for (i = 0; i < n; i++) { const GValue *value; VALUE rb_value; value = gst_value_list_get_value(from, i); rb_value = rbgobj_gvalue_to_rvalue(value); rb_ary_push(rb_values, rb_value); } return rb_values; } void Init_gstreamer (void) { rb_gi_callback_register_finder(rg_gst_bus_func_callback_finder); rb_gi_callback_register_finder(rg_gst_bus_sync_handler_callback_finder); rb_gi_callback_register_finder(rg_gst_tag_foreach_func_callback_finder); rbgobj_register_r2g_func(GST_TYPE_LIST, rg_gst_value_list_r2g); rbgobj_register_g2r_func(GST_TYPE_LIST, rg_gst_value_list_g2r); rb_gst_init_child_proxy(); rb_gst_init_element_factory(); } �������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/COPYING.LIB���������������������������������������������������������0000644�0001750�0001750�00000063642�12257552167�016272� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�015363� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/������������������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�016160� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/caps.rb�����������������������������������������������������0000644�0001750�0001750�00000002172�12416346617�017435� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class Caps class << self def any caps = allocate caps.__send__(:initialize_new_any) caps end def empty caps = allocate caps.__send__(:initialize_new_empty) caps end end def structures size.times.collect do |i| get_structure(i) end end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/base-loader.rb����������������������������������������������0000644�0001750�0001750�00000001521�12257552167�020664� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class BaseLoader < GObjectIntrospection::Loader end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/bin.rb������������������������������������������������������0000644�0001750�0001750�00000002047�12137115065�017247� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class Bin alias_method :add_element, :add def add_elements(*elements) elements.each do |element| add_element(element) end end alias_method :add, :add_elements def <<(element) add_element(element) self end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/element-factory.rb������������������������������������������0000644�0001750�0001750�00000002027�12257552167�021606� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class ElementFactory def long_name get_metadata("long-name") end def klass get_metadata("klass") end def description get_metadata("description") end def author get_metadata("author") end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/bus.rb������������������������������������������������������0000644�0001750�0001750�00000002653�12142464437�017301� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class Bus alias_method :add_watch_full, :add_watch def add_watch(priority=GLib::PRIORITY_DEFAULT, &block) add_watch_full(priority, &block) end def sync_handler(&block) @sync_handler = lambda do |bus, message| begin block.call(bus, message) rescue Exception $stderr.puts("An exception is raised in " + "#{self.class}\##{__method__} callback: #{block}") $stderr.puts("#{$!.class}: #{$!.message}") $stderr.puts($@) BusSyncReply::DROP end end set_sync_handler(&@sync_handler) end private :set_sync_handler end end �������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/structure.rb������������������������������������������������0000644�0001750�0001750�00000002002�12257552167�020541� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class Structure def fields n_fields.times.collect do |i| field_name = nth_field_name(i) value = get_value(field_name) value.extend(ValueMethods) [field_name, value] end end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/registry.rb�������������������������������������������������0000644�0001750�0001750�00000002100�12257552167�020350� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class Registry alias_method :plugins, :plugin_list def get_features(name_or_type) if name_or_type.is_a?(GLib::Type) type = name_or_type get_feature_list(type) else name = name_or_type get_feature_list_by_plugin(name) end end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/plugin-feature.rb�������������������������������������������0000644�0001750�0001750�00000001605�12257552167�021440� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class PluginFeature alias_method :rank_raw, :rank def rank Rank.new(rank_raw) end end end ���������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/element.rb��������������������������������������������������0000644�0001750�0001750�00000002546�12257552167�020147� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class Element def stop set_state(State::NULL) end def ready set_state(State::READY) end def pause set_state(State::PAUSED) end def play set_state(State::PLAYING) end alias_method :link_element, :link def link_elements(*elements) elements.each do |element| link_element(element) end end alias_method :link, :link_elements def >>(element) link_element(element) element end alias_method :flags_raw, :flags def flags ElementFlags.new(flags_raw) end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst/controller-loader.rb����������������������������������������0000644�0001750�0001750�00000001527�12257552167�022143� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 module Gst class ControllerLoader < GObjectIntrospection::Loader end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gst.rb����������������������������������������������������������0000644�0001750�0001750�00000011612�12416346617�016506� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "English" require "gobject-introspection" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) if vendor_dir.exist? require "cairo" require "gdk_pixbuf2" require "pango" end module Gst LOG_DOMAIN = "GStreamer" GLib::Log.set_log_domain(LOG_DOMAIN) class << self def const_missing(name) init() if const_defined?(name) const_get(name) else super end end def method_missing(name, *args, &block) init() if respond_to?(name) __send__(name, *args, &block) else super end end def init(*argv) class << self remove_method(:init) remove_method(:const_missing) remove_method(:method_missing) end loader = Loader.new(self, argv) loader.load("Gst") require "gst/bin" require "gst/bus" require "gst/caps" require "gst/element" require "gst/element-factory" require "gst/plugin-feature" require "gst/registry" require "gst/structure" init_base init_controller end private def init_base require "gst/base-loader" base_loader = BaseLoader.new(self) base_loader.load("GstBase") end def init_controller require "gst/controller-loader" controller_loader = ControllerLoader.new(self) controller_loader.load("GstController") end end class Loader < GObjectIntrospection::Loader def initialize(base_module, init_arguments) super(base_module) @init_arguments = init_arguments end private def pre_load(repository, namespace) call_init_function(repository, namespace) define_value_modules end def call_init_function(repository, namespace) init_check = repository.find(namespace, "init_check") arguments = [ [$0] + @init_arguments, ] succeeded, argv, error = init_check.invoke(:arguments => arguments) @init_arguments.replace(argv[1..-1]) raise error unless succeeded end def define_value_modules @value_functions_module = Module.new @value_methods_module = Module.new @base_module.const_set("ValueFunctions", @value_functions_module) @base_module.const_set("ValueMethods", @value_methods_module) end def post_load(repository, namespace) require_extension self.class.start_callback_dispatch_thread end def require_extension begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gstreamer.so" rescue LoadError require "gstreamer.so" end end def load_function_info(info) case info.name when "init" # ignore when /\Avalue_/ method_name = $POSTMATCH load_value_function_info(info, method_name) else super end end def load_value_function_info(info, method_name) value_functions_module = @value_functions_module define_module_function(value_functions_module, method_name, info) @value_methods_module.module_eval do define_method(method_name) do |*arguments, &block| value_functions_module.send(method_name, self, *arguments, &block) end end end RENAME_MAP = { "uri_protocol_is_valid" => "valid_uri_protocol?", "uri_protocol_is_supported" => "supported_uri_protocol?", "uri_is_valid" => "valid_uri?", "uri_has_protocol" => "uri_has_protocol?", } def rubyish_method_name(function_info) RENAME_MAP[function_info.name] || super end UNLOCK_GVL_METHODS = { "Gst::Element#set_state" => true, "Gst::Element#get_state" => true, "Gst::Element#query_state" => true, "Gst::Element#send_event" => true, } def should_unlock_gvl?(function_info, klass) UNLOCK_GVL_METHODS["#{klass}\##{function_info.name}"] || super end end end ����������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/lib/gstreamer.rb����������������������������������������������������0000644�0001750�0001750�00000001430�12416346617�017677� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 require "gst" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/�������������������������������������������������������������0000755�0001750�0001750�00000000000�12257552167�016100� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/gst-inspect.rb�����������������������������������������������0000755�0001750�0001750�00000027546�12257552167�020706� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/evn ruby # # This sample code is a port of gstreamer/tools/gst-inspect.c. It is # licensed under the terms of the GNU Library General Public License, # version 2 or (at your option) later. # # The followin is the original code's copyright notation: # Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> # 2000 Wim Taymans <wtay@chello.be> # 2004 Thomas Vander Stichele <thomas@apestaart.org> # # # Copyright (C) 2013 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 require "optparse" require "ostruct" require "gst" def parse(argv) options = OpenStruct.new options.print_all = false options.print_auto_install_info = false opts = OptionParser.new do |opts| opts.banner += " [ELEMENT-NAME|PLUGIN-NAME]" opts.version = Gst.version opts.separator("") opts.on("-a", "--print-all", "Print all elements") do options.print_all = true end opts.on("--print-plugin-auto-install-info", "Print a machine-parsable list of features", "the specified plugin provides.", "Useful in connection with external", "automatic plugin installation mechanisms") do options.print_auto_install_info = true end end opts.parse!(argv) [options, argv.first] end class Inspector def initialize @prefix = "" end def print_list(print_all) plugins = {} n_features = 0 each_feature do |plugin, feature| plugins[plugin.name] = nil n_features += 1 if print_all if feature.is_a?(Gst::ElementFactory) print_element_factory(feature, true) end else print_feature(plugin, feature) end end puts puts("Total count: #{plugins.size} plugins, #{n_features} features") end def print_element(name) factory = Gst::ElementFactory.find(name) print_element_factory(factory, false) end private def puts(*args) if args.empty? super(@prefix) else super(*(args.collect {|arg| "#{@prefix}#{arg}"})) end end def prefix(new_prefix) prefix, @prefix = @prefix, new_prefix yield ensure @prefix = prefix end def each_feature registry = Gst::Registry.get registry.plugins.sort_by {|plugin| plugin.name}.each do |plugin| features = registry.get_features(plugin.name) features.sort_by {|feature| feature.name}.each do |feature| yield(plugin, feature) end end end def print_factory_details_info(factory) puts("Factory Details:", " Rank:\t\t#{factory.rank.nick} (#{factory.rank.to_i})", " Long name:\t#{factory.long_name}", " Class:\t#{factory.klass}", " Description:\t#{factory.description}", " Author(s):\t#{factory.author}", "") end def print_plugin_info(name) return if name.nil? registry = Gst::Registry.get plugin = registry.find_plugin(name) return if plugin.nil? puts("Plugin Details:", " Name:\t\t\t#{plugin.name}", " Description:\t\t#{plugin.description}", " Filename:\t\t#{plugin.filename || '(null)'}", " Version:\t\t#{plugin.version}", " License:\t\t#{plugin.license}", " Source module:\t#{plugin.source}") release_date = plugin.release_date_string if release_date puts(" Source release date:\t#{release_date}") end puts(" Binary package:\t#{plugin.package}", " Origin URL:\t\t#{plugin.origin}", "") end def print_hierarchy(element) ancestors = [] type = element.gtype while type ancestors << type type = type.parent end ancestors.reverse.each_with_index do |klass, i| if i.zero? mark = "" else mark = " " + (" " * (i - 1)) + "+----" end puts("#{mark}#{klass.name}") end puts end def print_interfaces(element) interfaces = element.gtype.interfaces return if interfaces.empty? puts("Implemented Interfaces:") interfaces.each do |interface| puts(" #{interface.name}") end puts end def print_caps(caps) if caps.any? puts("ANY") return end if caps.empty? puts("EMPTY") return end caps.structures.each do |structure| puts(structure.name) structure.fields.each do |name, value| puts(" %15s: %s" % [name, value.serialize]) end end end def print_pad_template_info(template) prefix("#{@prefix} ") do puts("#{template.direction.nick.upcase} template: '#{template.name_template}'") prefix("#{@prefix} ") do if template.presence == Gst::PadPresence::REQUEST puts("Availability: On request") else puts("Availability: #{template.presence.nick.capitalize}") end end end caps = template.caps return if caps.nil? prefix("#{@prefix} ") do puts("Capabilities:") prefix("#{@prefix} ") do print_caps(caps) end end puts end def print_pad_templates_info(element, factory) puts("Pad Templates:") templates = factory.static_pad_templates if templates.empty? puts(" none") return end templates.each do |template| print_pad_template_info(template) end end def print_element_flag_info(element) puts("Element Flags:") puts(" no flags set") puts return unless element.is_a?(Gst::Bin) puts("Bin Flags:") puts(" no flags set") puts end def print_implementation_info(element) puts("Element Implementation:") puts(" not supported") puts end def print_clocking_info(element) if !element.flags.require_clock? and !element.flags.provide_clock? and element.clock.nil? puts("Element has no clocking capabilities.") return end puts("Clocking Interaction:") puts(" element requires a clock") if element.flags.require_clock? if element.flags.provide_clock? clock = element.clock if clock.nil? puts(" element is supported tot provide a clock but returned nil") else puts(" element provides a clock: #{clock.name}") end end puts end def print_index_info(element) if element.flags.indexable? puts("Indexing capabilities:") puts(" element can do indexing") else puts("Element has no indexing capabilities.") end puts end def uri_type(element) case element.uri_type when Gst::URIType::SRC "source" when Gst::URIType::SINK "sink" else "unknown" end end def print_uri_handler_info(element) if element.is_a?(Gst::URIHandler) puts("URI handling capabilities:") puts(" Element can act as #{uri_type(element)}.") protocols = element.protocols if protocols.empty? puts(" No supported URI protocols") else puts(" Supported URI protocols:") protocols.each do |protocol| puts(" #{protocol}") end end else puts("Element has no URI handling capabilities.") end puts end def print_pad_info(element) puts("Pads:") pads = element.pads if pads.empty? puts(" none") return end pads.each do |pad| prefix("#{@prefix} ") do puts("#{pad.direction.nick.upcase}: '#{pad.name}'") prefix("#{@prefix} ") do template = pad.template puts("Pad Template: '#{template.name}'") if template caps = pad.caps break if caps.nil? puts("Capabilities:") prefix("#{@prefix} ") do print_caps(caps) end end end end puts end def print_element_properties_info(element) puts("Element Properties:") properties = element.class.properties if properties.empty? puts(" none") return end properties.each do |name| param = element.class.property(name) puts(" %-20s: %s" % [param.name, param.blurb]) flags = [] flags << "readable" if param.readable? flags << "writable" if param.writable? # flags << "controllable" if param.controllable? prefix("#{@prefix}#{' ' * 23} ") do puts("flags: #{flags.join(', ')}") description = "" type_name = param.value_type.name description << "#{type_name}." if param.readable? case param.gtype when GLib::Type["GParamObject"] # do nothing else default_value = element.get_property(name) description << " Default: #{default_value.inspect}" end else description << " Write only" end puts(description) end end puts end def print_signal_info(element, signal) args = ["object(#{element.class})"] signal.param_types.each_with_index do |name, i| args << "arg#{i}(#{name})" end args = args.join(", ") signature = "{|#{args}| ...} # => #{signal.return_type}" puts(" #{signal.name.inspect}: #{signature}") end def print_signals_info(element) signals = [] actions = [] element.class.signals.each do |name| signal = element.class.signal(name) next if signal.owner >= Gst::Element if signal.action? actions << signal else signals << signal end end [[signals, "Signals"], [actions, "Actions"]].each do |target_signals, description| unless target_signals.empty? puts("Element #{description}:") target_signals.each do |signal| print_signal_info(element, signal) end end end puts end def print_children_info(element) return unless element.is_a?(Gst::Bin) children = element.children return if children.empty? puts("Children:") children.each do |child| puts(" #{child.name}") end end def print_element_factory(factory, print_names) factory = factory.load if factory.nil? puts("element plugin (#{factory.name}) couldn't be loaded\n") return end element = factory.create prefix(print_names ? "#{factory.name}: " : "") do print_factory_details_info(factory) print_plugin_info(factory.plugin.name) print_hierarchy(element) print_interfaces(element) print_pad_templates_info(element, factory) puts print_element_flag_info(element) print_implementation_info(element) print_clocking_info(element) print_index_info(element) print_uri_handler_info(element) print_pad_info(element) print_element_properties_info(element) print_signals_info(element) print_children_info(element) end end def print_feature(plugin, feature) prefix("#{plugin.name}: #{feature.name}") do case feature when Gst::ElementFactory puts(": #{feature.long_name}") when Gst::TypeFindFactory if feature.extensions.empty? message = "no extensions" else message = feature.extensions.join(", ") end puts(": #{message}") else puts(" (#{feature.gtype})") end end end end options, element_name = parse(ARGV) inspector = Inspector.new if element_name inspector.print_element(element_name) else inspector.print_list(options.print_all) end ����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/typefind.rb��������������������������������������������������0000755�0001750�0001750�00000005656�12147676243�020266� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # This sample code is a port of # gstreamer/tests/examples/typefind/typefind.c. It is licensed # under the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Here is the original copyright header: # Copyright (C) <2005> Stefan Kost # Copyright (C) <2006> Tim-Philipp Müller # # Copyright (C) 2013 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 require "gst" require "rexml/document" def event_loop(pipe) running = true bus = pipe.bus while running do message = bus.poll(Gst::MessageType::ANY, Gst::CLOCK_TIME_NONE) raise "message nil" if message.nil? case message.type when Gst::MessageType::EOS running = false when Gst::MessageType::WARNING warning, debug = message.parse_warning puts "Debugging info: #{debug || 'none'}" puts "Warning: #{warning.message}" when Gst::MessageType::ERROR error, debug = message.parse_error puts "Debugging info: #{debug || 'none'}" puts "Error: #{error.message}" running = false end end end if ARGV.length < 1 puts "usage: #{$0} <filename>" exit(false) end # create a new pipeline to hold the elements pipeline = Gst::Pipeline.new("pipeline") raise "'pipeline' gstreamer plugin missing" if pipeline.nil? # create a file reader filesrc = Gst::ElementFactory.make("filesrc", "file_source") raise "'filesrc' gstreamer plugin missing" if filesrc.nil? filesrc.location = ARGV.first typefind = Gst::ElementFactory.make("typefind", "typefind") raise "'typefind' gstreamer plugin missing" if typefind.nil? sink = Gst::ElementFactory.make("fakesink", "sink") raise "'fakesink' gstreamer plugin missing" if sink.nil? # add objects to the main pipeline pipeline << filesrc << typefind << sink typefind.signal_connect("have-type") do |element, probability, caps| caps_str = caps.to_s xml = REXML::Document.new xml << REXML::XMLDecl.new capabilities = xml.add_element("Capabilities") cap1 = capabilities.add_element("Cap1") cap1.add_text(caps_str) xml.write($stdout, 2) puts end filesrc >> typefind >> sink # start playing pipeline.play # Run event loop listening for bus messages until EOS or ERROR event_loop(pipeline) # stop the bin pipeline.stop ����������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/helloworld.rb������������������������������������������������0000755�0001750�0001750�00000003700�12147676243�020603� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # This sample code is a port of # gstreamer/tests/examples/helloworld/helloworld.c. It is licensed # under the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" if ARGV.length < 1 puts "usage: #{$0} <media file or uri>" exit(false) end playbin = Gst::ElementFactory.make("playbin") if playbin.nil? puts "'playbin' gstreamer plugin missing" exit(false) end # take the commandline argument and ensure that it is a uri if Gst.valid_uri?(ARGV.first) uri = ARGV.first else uri = Gst.filename_to_uri(ARGV.first) end playbin.uri = uri # create and event loop feed gstreamer bus messages to it loop = GLib::MainLoop.new bus = playbin.bus bus.add_watch do |bus, message| case message.type when Gst::MessageType::EOS puts "End-of-stream" loop.quit when Gst::MessageType::ERROR error, debug = message.parse_error puts "Debugging info: #{debug || 'none'}" puts "Error: #{error.message}" loop.quit end true end # start play back and listed to events playbin.play begin loop.run rescue Interrupt puts "Interrupt" rescue => error puts "Error: #{error.message}" ensure playbin.stop end ����������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/audio-example.rb���������������������������������������������0000755�0001750�0001750�00000004463�12147676243�021171� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # audio-example.rb # # Builds a pipeline with [ audiotestsource ! autoaudiosink ] and sweeps # frequency and volume. # # Needs gst-plugin-base + gst-plugins-good installed. # # This sample code is a port of # gstreamer/tests/examples/controller/audio-example.c. It is licensed # under the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" bin = Gst::Pipeline.new("pipeline") clock = bin.clock src = Gst::ElementFactory.make("audiotestsrc", nil) raise "need audiotestsrc from gst-plugins-base" if src.nil? sink = Gst::ElementFactory.make("autoaudiosink", nil) raise "need autoaudiosink from gst-plugins-good" if sink.nil? bin << src << sink src >> sink # setup control sources cs1 = Gst::InterpolationControlSource.new cs2 = Gst::InterpolationControlSource.new src.add_control_binding(Gst::DirectControlBinding.new(src, "volume", cs1)) src.add_control_binding(Gst::DirectControlBinding.new(src, "freq", cs2)) # set interpolation mode cs1.mode = Gst::InterpolationMode::LINEAR cs2.mode = Gst::InterpolationMode::LINEAR # set control values cs1.set(0 * Gst::SECOND, 0.0) cs1.set(5 * Gst::SECOND, 1.0) cs2.set(0 * Gst::SECOND, 220.0 / 20000.0) cs2.set(3 * Gst::SECOND, 3520.0 / 20000.0) cs2.set(6 * Gst::SECOND, 440.0 / 20000.0) # run for 7 seconds clock_id = clock.new_single_shot_id(clock.time + (7 * Gst::SECOND)) bin.play wait_ret, jitter = Gst::Clock.id_wait(clock_id) $stderr.puts "Clock::id_wait returned: #{wait_ret}" if wait_ret != Gst::ClockReturn::OK bin.stop �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/mp3parselaunch.rb��������������������������������������������0000755�0001750�0001750�00000004053�12147676243�021357� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # This sample code is a port of # gstreamer/tests/examples/launch/mp3parselaunch.c. It is licensed # under the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" def event_loop(pipe) running = true bus = pipe.bus while running message = bus.poll(Gst::MessageType::ANY, Gst::CLOCK_TIME_NONE) raise "message nil" if message.nil? case message.type when Gst::MessageType::EOS running = false when Gst::MessageType::WARNING warning, debug = message.parse_warning puts "Debugging info: #{debug || 'none'}" puts "Warning: #{warning.message}" when Gst::MessageType::ERROR error, debug = message.parse_error puts "Debugging info: #{debug || 'none'}" puts "Error: #{error.message}" running = false end end end if ARGV.length < 1 puts "usage: #{$0} <mp3 file>" exit(false) end bin, error = Gst.parse_launch("filesrc name=my_filesrc ! mad ! autoaudiosink") if bin.nil? $stderr.puts "Parse error: #{error.message}" exit(false) end filesrc = bin.get_by_name("my_filesrc") filesrc.location = ARGV[0] # start playing bin.play # Run event loop listening for bus messages until EOS or ERROR event_loop(bin) # stop the bin bin.stop �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/text-color-example.rb����������������������������������������0000755�0001750�0001750�00000005413�12147676243�022164� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # text-color-example.rb # # Builds a pipeline with [videotestsrc ! textoverlay ! ximagesink] and # modulates color, text and text pos. # # Needs gst-plugin-base installed. # # This sample code is a port of # gstreamer/tests/examples/controller/text-color-example.c. It is # licensed under the terms of the GNU Library General Public License, # version 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" bin = Gst::Pipeline.new("pipeline") clock = bin.clock src = Gst::ElementFactory.make("videotestsrc", nil) raise "need videotestsrc from gst-plugins-base" if src.nil? src.pattern = 10 # checkers-8 text = Gst::ElementFactory.make("textoverlay", nil) raise "need textoverlay from gst-plugins-base" if text.nil? text.text = "GStreamer rocks!" text.font_desc = "Sans, 30" text.halignment = 4 # position text.valignment = 3 # position sink = Gst::ElementFactory.make("ximagesink", nil) raise "need ximagesink from gst-plugins-base" if sink.nil? bin << src << text << sink src >> text >> sink # setup control sources cs = Gst::LFOControlSource.new cs.frequency = 0.11 cs.amplitude = 0.2 cs.offset = 0.5 text.add_control_binding(Gst::DirectControlBinding.new(text, "xpos", cs)) cs = Gst::LFOControlSource.new cs.frequency = 0.04 cs.amplitude = 0.4 cs.offset = 0.5 text.add_control_binding(Gst::DirectControlBinding.new(text, "ypos", cs)) cs_r = Gst::LFOControlSource.new cs_r.frequency = 0.19 cs_r.amplitude = 0.5 cs_r.offset = 0.5 cs_g = Gst::LFOControlSource.new cs_g.frequency = 0.27 cs_g.amplitude = 0.5 cs_g.offset = 0.5 cs_b = Gst::LFOControlSource.new cs_b.frequency = 0.13 cs_b.amplitude = 0.5 cs_b.offset = 0.5 text.add_control_binding(Gst::ARGBControlBinding.new(text, "color", nil, cs_r, cs_g, cs_b)) # run for 10 seconds clock_id = clock.new_single_shot_id(clock.time + (30 * Gst::SECOND)) bin.play wait_ret, jitter = Gst::Clock.id_wait(clock_id) $stderr.puts "Clock.id_wait returned: #{wait_ret}" if wait_ret != Gst::ClockReturn::OK bin.stop �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/framestep1.rb������������������������������������������������0000755�0001750�0001750�00000010251�12147676243�020476� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # This sample code is a port of # gstreamer/tests/examples/stepping/framestep1.c. It is licensed # under the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" def event_loop(pipe) running = true bus = pipe.bus while running message = bus.timed_pop_filtered(Gst::CLOCK_TIME_NONE, Gst::MessageType::ANY) raise "message nil" if message.nil? case message.type when Gst::MessageType::EOS puts "got EOS" running = false when Gst::MessageType::WARNING warning, debug = message.parse_warning puts "Debugging info: #{debug || 'none'}" puts "Warning: #{warning.message}" when Gst::MessageType::ERROR error, debug = message.parse_error puts "Debugging info: #{debug || 'none'}" puts "Error: #{error.message}" running = false when Gst::MessageType::STEP_DONE format, amount, rate, flush, intermediate, duration, eos = message.parse_step_done if format == Gst::Format::DEFAULT puts "step done: #{gst_time(duration)} skipped in #{gst_time(amount)} frames" else puts "step done: #{gst_time(duration)} skipped" end running = false end end end def gst_time(time) Time.at(time / 1000000000.0).utc.strftime("%H:%M:%S.%N") end # create a new bin to hold the elements bin = Gst::Pipeline.new("pipeline") raise "'pipeline' gstreamer plugin missing" if bin.nil? # create a fake source videotestsrc = Gst::ElementFactory.make("videotestsrc", "videotestsrc") raise "'videotestsrc' gstreamer plugin missing" if videotestsrc.nil? videotestsrc.num_buffers = 10 # and a fake sink appsink = Gst::ElementFactory.make("appsink", "appsink") raise "'appsink' gstreamer plugin missing" if appsink.nil? appsink.emit_signals = true appsink.sync = true appsink.signal_connect("new-preroll") do |appsink| # signalled when a new preroll buffer is available sample = appsink.pull_preroll puts "have new-preroll sample #{sample}, timestamp #{gst_time(sample.buffer.pts)}" Gst::FlowReturn::OK end # add objects to the main pipeline bin << videotestsrc << appsink # link the elements videotestsrc >> appsink # go to the PAUSED state and wait for preroll puts "prerolling first frame" bin.pause bin.get_state(Gst::CLOCK_TIME_NONE) # step two frames, flush so that new preroll is queued puts "stepping three frames" unless bin.send_event(Gst::Event.new(Gst::Format::BUFFERS, 2, 1.0, true, false)) raise "Failed to send STEP event!" end # blocks and returns when we received the step done message event_loop(bin) # wait for step to really complete bin.get_state(Gst::CLOCK_TIME_NONE) result, pos = bin.query_position(Gst::Format::TIME) puts "stepped two frames, now at #{gst_time(pos)}" # step 3 frames, flush so that new preroll is queued puts "stepping 120 milliseconds" unless bin.send_event(Gst::Event.new(Gst::Format::TIME, 120 * Gst::MSECOND, 1.0, true, false)) raise "Failed to send STEP event!" end # blocks and returns when we received the step done message event_loop(bin) # wait for step to really complete bin.get_state(Gst::CLOCK_TIME_NONE) result, pos = bin.query_position(Gst::Format::TIME) puts "stepped 120ms frames, now at #{gst_time(pos)}" puts "playing until EOS" bin.play # Run event loop listening for bus messages until EOS or ERROR event_loop(bin) puts "finished" # stop the bin bin.stop �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/stream-status.rb���������������������������������������������0000755�0001750�0001750�00000005670�12147676243�021254� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # This sample code is a port of # gstreamer/tests/examples/streams/stream-status.c. It is licensed # under the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" def event_loop(bus, pipe) loop do message = bus.poll(Gst::MessageType::ANY, Gst::CLOCK_TIME_NONE) raise "message nil" if message.nil? case message.type when Gst::MessageType::EOS puts "received EOS" return when Gst::MessageType::WARNING warning, debug = message.parse_warning puts "#{message} #{warning.message}" when Gst::MessageType::ERROR error, debug = message.parse_error puts "#{message} #{error.message}" return end end end # create a new bin to hold the elements bin = Gst::Pipeline.new("pipeline") raise "'pipeline' gstreamer plugin missing" if bin.nil? # create a source fakesrc = Gst::ElementFactory.make("fakesrc", "fakesrc") raise "'fakesrc' gstreamer plugin missing" if fakesrc.nil? # and a sink fakesink = Gst::ElementFactory.make("fakesink", "fakesink") raise "'fakesink' gstreamer plugin missing" if fakesink.nil? # add objects to the main pipeline bin << fakesrc << fakesink # link the elements fakesrc >> fakesink # get the bus, we need to install a sync handler bin.bus.sync_handler do |bus, message| case message.type when Gst::MessageType::STREAM_STATUS type, owner = message.parse_stream_status val = message.stream_status_object puts "type: #{type}" puts "source: #{message.src.path_string}" puts "owner: #{owner.path_string}" puts "object: type #{val.type.name}, value #{val.value}" # see if we know how to deal with this object if val.type == Gst::Task task = val.value end case type when Gst::StreamStatusType::CREATE puts "created task #{task}" when Gst::StreamStatusType::ENTER # puts "raising task priority" # setpriority(PRIO_PROCESS, 0, -10) when Gst::StreamStatusType::LEAVE end end Gst::BusSyncReply::PASS end # start playing bin.play # run event loop listening for bus messages until EOS or ERROR event_loop(bus, bin) # stop the bin bin.stop ������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/sample/queue.rb�����������������������������������������������������0000755�0001750�0001750�00000005445�12147676243�017564� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # -*- coding: utf-8 -*- # # This sample code is a port of # gstreamer/tests/examples/queue/queue.c. It is licensed under # the terms of the GNU Library General Public License, version # 2 or (at your option) later. # # Copyright (C) 2013 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 require "gst" # This example uses the queue element to create a buffer between 2 elements. # The scheduler automatically uses 2 threads, 1 to feed and another to consume # data from the queue buffer # Event loop to listen to events posted on the Gst::Bus from the pipeline. Exits # on EOS or ERROR events def event_loop(pipe) running = true bus = pipe.bus while running message = bus.poll(Gst::MessageType::ANY, -1) case message.type when Gst::MessageType::EOS running = false when Gst::MessageType::WARNING warning, debug = message.parse_warning puts "Debugging info: #{debug || 'none'}" puts "Warning: #{warning.message}" when Gst::MessageType::ERROR error, debug = message.parse_error puts "Debugging info: #{debug || 'none'}" puts "Error: #{error.message}" running = false end end end if ARGV.length < 1 puts "usage: #{$0} <filename>" exit(false) end # create a new pipeline to hold the elements pipeline = Gst::Pipeline.new("pipeline") raise "'pipeline' gstreamer plugin missing" if pipeline.nil? # create a disk reader filesrc = Gst::ElementFactory.make("filesrc", "disk_source") raise "'filesrc' gstreamer plugin missing" if filesrc.nil? filesrc.location = ARGV.first decode = Gst::ElementFactory.make("mad", "decode") raise "'mad' gstreamer plugin missing" if decode.nil? queue = Gst::ElementFactory.make("queue", "queue") raise "'queue' gstreamer plugin missing" if queue.nil? # and an audio sink audiosink = Gst::ElementFactory.make("alsasink", "play_audio") raise "'alsasink' gstreamer plugin missing" if audiosink.nil? # add objects to the main pipeline pipeline << filesrc << decode << queue << audiosink filesrc >> decode >> queue >> audiosink # start playing pipeline.play # listen for EOS event_loop(pipeline) pipeline.stop ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/patches/������������������������������������������������������������0000755�0001750�0001750�00000000000�12446231174�016236� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/patches/libtheora-1.1.1-use-lf-in-def.diff��������������������������0000644�0001750�0001750�00000007403�12257552167�024042� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru libtheora-1.1.1.orig/win32/xmingw32/libtheoradec-all.def libtheora-1.1.1/win32/xmingw32/libtheoradec-all.def --- libtheora-1.1.1.orig/win32/xmingw32/libtheoradec-all.def 2009-07-14 08:55:00.000000000 +0900 +++ libtheora-1.1.1/win32/xmingw32/libtheoradec-all.def 2013-12-23 23:45:03.464282578 +0900 @@ -1,58 +1,58 @@ -EXPORTS -; Old alpha API - theora_version_string @ 1 - theora_version_number @ 2 - - theora_decode_header @ 3 - theora_decode_init @ 4 - theora_decode_packetin @ 5 - theora_decode_YUVout @ 6 - - theora_control @ 7 - - theora_packet_isheader @ 8 - theora_packet_iskeyframe @ 9 - - theora_granule_shift @ 10 - theora_granule_frame @ 11 - theora_granule_time @ 12 - - theora_info_init @ 13 - theora_info_clear @ 14 - - theora_clear @ 15 - - theora_comment_init @ 16 - theora_comment_add @ 17 - theora_comment_add_tag @ 18 - theora_comment_query @ 19 - theora_comment_query_count @ 20 - theora_comment_clear @ 21 - -; New theora-exp API - th_version_string @ 22 - th_version_number @ 23 - - th_decode_headerin @ 24 - th_decode_alloc @ 25 - th_setup_free @ 26 - th_decode_ctl @ 27 - th_decode_packetin @ 28 - th_decode_ycbcr_out @ 29 - th_decode_free @ 30 - - th_packet_isheader @ 31 - th_packet_iskeyframe @ 32 - - th_granule_frame @ 33 - th_granule_time @ 34 - - th_info_init @ 35 - th_info_clear @ 36 - - th_comment_init @ 37 - th_comment_add @ 38 - th_comment_add_tag @ 39 - th_comment_query @ 40 - th_comment_query_count @ 41 - th_comment_clear @ 42 +EXPORTS +; Old alpha API + theora_version_string @ 1 + theora_version_number @ 2 + + theora_decode_header @ 3 + theora_decode_init @ 4 + theora_decode_packetin @ 5 + theora_decode_YUVout @ 6 + + theora_control @ 7 + + theora_packet_isheader @ 8 + theora_packet_iskeyframe @ 9 + + theora_granule_shift @ 10 + theora_granule_frame @ 11 + theora_granule_time @ 12 + + theora_info_init @ 13 + theora_info_clear @ 14 + + theora_clear @ 15 + + theora_comment_init @ 16 + theora_comment_add @ 17 + theora_comment_add_tag @ 18 + theora_comment_query @ 19 + theora_comment_query_count @ 20 + theora_comment_clear @ 21 + +; New theora-exp API + th_version_string @ 22 + th_version_number @ 23 + + th_decode_headerin @ 24 + th_decode_alloc @ 25 + th_setup_free @ 26 + th_decode_ctl @ 27 + th_decode_packetin @ 28 + th_decode_ycbcr_out @ 29 + th_decode_free @ 30 + + th_packet_isheader @ 31 + th_packet_iskeyframe @ 32 + + th_granule_frame @ 33 + th_granule_time @ 34 + + th_info_init @ 35 + th_info_clear @ 36 + + th_comment_init @ 37 + th_comment_add @ 38 + th_comment_add_tag @ 39 + th_comment_query @ 40 + th_comment_query_count @ 41 + th_comment_clear @ 42 diff -ru libtheora-1.1.1.orig/win32/xmingw32/libtheoraenc-all.def libtheora-1.1.1/win32/xmingw32/libtheoraenc-all.def --- libtheora-1.1.1.orig/win32/xmingw32/libtheoraenc-all.def 2009-07-14 08:55:00.000000000 +0900 +++ libtheora-1.1.1/win32/xmingw32/libtheoraenc-all.def 2013-12-23 23:45:09.084147371 +0900 @@ -1,17 +1,17 @@ -EXPORTS -; Old alpha API - theora_encode_init @ 1 - theora_encode_YUVin @ 2 - theora_encode_packetout @ 3 - theora_encode_header @ 4 - theora_encode_comment @ 5 - theora_encode_tables @ 6 -; New theora-exp API - th_encode_alloc @ 7 - th_encode_ctl @ 8 - th_encode_flushheader @ 9 - th_encode_ycbcr_in @ 10 - th_encode_packetout @ 11 - th_encode_free @ 12 - TH_VP31_QUANT_INFO @ 13 - TH_VP31_HUFF_CODES @ 14 +EXPORTS +; Old alpha API + theora_encode_init @ 1 + theora_encode_YUVin @ 2 + theora_encode_packetout @ 3 + theora_encode_header @ 4 + theora_encode_comment @ 5 + theora_encode_tables @ 6 +; New theora-exp API + th_encode_alloc @ 7 + th_encode_ctl @ 8 + th_encode_flushheader @ 9 + th_encode_ycbcr_in @ 10 + th_encode_packetout @ 11 + th_encode_free @ 12 + TH_VP31_QUANT_INFO @ 13 + TH_VP31_HUFF_CODES @ 14 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gstreamer/patches/libmad-0.15.1b-fix-mingw-build.diff�������������������������0000644�0001750�0001750�00000002245�11704226436�024206� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ruN libmad-0.15.1b.orig/AUTHORS libmad-0.15.1b/AUTHORS --- libmad-0.15.1b.orig/AUTHORS 1970-01-01 09:00:00.000000000 +0900 +++ libmad-0.15.1b/AUTHORS 2012-01-07 19:35:23.810029179 +0900 @@ -0,0 +1 @@ +for autoconf. diff -ruN libmad-0.15.1b.orig/ChangeLog libmad-0.15.1b/ChangeLog --- libmad-0.15.1b.orig/ChangeLog 1970-01-01 09:00:00.000000000 +0900 +++ libmad-0.15.1b/ChangeLog 2012-01-07 19:36:28.244351603 +0900 @@ -0,0 +1 @@ +for autoconf. diff -ruN libmad-0.15.1b.orig/Makefile.am libmad-0.15.1b/Makefile.am --- libmad-0.15.1b.orig/Makefile.am 2004-02-17 11:02:03.000000000 +0900 +++ libmad-0.15.1b/Makefile.am 2012-01-07 19:30:38.245466821 +0900 @@ -101,7 +101,7 @@ version_info = $(version_current):$(version_revision):$(version_age) -libmad_la_LDFLAGS = -version-info $(version_info) +libmad_la_LDFLAGS = -version-info $(version_info) -no-undefined mad.h: config.status config.h Makefile.am \ $(srcdir)/COPYRIGHT $(srcdir)/mad.h.sed $(exported_headers) diff -ruN libmad-0.15.1b.orig/NEWS libmad-0.15.1b/NEWS --- libmad-0.15.1b.orig/NEWS 1970-01-01 09:00:00.000000000 +0900 +++ libmad-0.15.1b/NEWS 2012-01-07 19:35:28.429908891 +0900 @@ -0,0 +1 @@ +for autoconf. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/��������������������������������������������������������0000755�0001750�0001750�00000000000�12516441042�017124� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/���������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�020116� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-struct-info.rb��������������������������������0000644�0001750�0001750�00000003147�12416346617�023702� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 class TestStructInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @info = @repository.find("GObject", "Value") end def test_n_fields assert_equal(2, @info.n_fields) end def test_get_field assert_kind_of(GObjectIntrospection::FieldInfo, @info.get_field(0)) end def test_n_methods assert_operator(@info.n_methods, :>=, 62) end def test_get_method assert_kind_of(GObjectIntrospection::FunctionInfo, @info.get_method(0)) end def test_size assert_operator(@info.size, :>=, 20) end def test_alignment assert_operator(@info.alignment, :>=, 4) end def test_gtype_struct? assert_false(@info.gtype_struct?) end def test_foreign? assert_false(@info.foreign?) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-value-info.rb���������������������������������0000644�0001750�0001750�00000002104�12067770242�023457� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestValueInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @flags_info = @repository.find("GObject", "SignalFlags") @info = @flags_info.get_value(0) end def test_value assert_equal(1, @info.value) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-property-info.rb������������������������������0000644�0001750�0001750�00000002513�12067770242�024233� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestPropertyInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @object_info = @repository.find("Gio", "Application") @info = @object_info.get_property(0) end def test_flags assert_equal(GLib::Param::WRITABLE, @info.flags) end def test_type assert_kind_of(GObjectIntrospection::TypeInfo, @info.type) end def test_ownership_transfer assert_equal(GObjectIntrospection::Transfer::NOTHING, @info.ownership_transfer) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/gobject-introspection-test-utils.rb����������������0000644�0001750�0001750�00000002067�12067770242�027073� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 require "test-unit" require "test/unit/notify" module GObjectIntrospectionTestUtils def require_version(major, minor, micro) if (GObjectIntrospection::BUILD_VERSION <=> [major, minor, micro]) < 0 omit("require GObjectIntrospection #{major}.#{minor}.#{micro} or later.") end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-type-tag.rb�����������������������������������0000644�0001750�0001750�00000002155�12067770242�023152� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestTypeTag < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @function_info = @repository.find("GObject", "signal_list_ids") @type_info = @function_info.return_type @tag = @type_info.tag end def test_to_s assert_equal("array", @tag.to_s) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-function-info.rb������������������������������0000644�0001750�0001750�00000002536�12257552167�024206� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestFunctionInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @info = @repository.find("GObject", "signal_name") end def test_symbol assert_equal("g_signal_name", @info.symbol) end def test_flags assert_equal(GObjectIntrospection::FunctionInfoFlags.new(0), @info.flags) end def test_invoke # TODO: "#invoke" expects Array. We should confirm specification. #assert_equal("notify", @info.invoke(1)) assert_equal("notify", @info.invoke([1])) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-field-type.rb���������������������������������0000644�0001750�0001750�00000002534�12067770242�023463� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestFieldInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @object_info = @repository.find("Gio", "FileOutputStream") @info = @object_info.get_field(0) end def test_flags assert_equal(GObjectIntrospection::FieldInfoFlags::READABLE, @info.flags) end def test_size assert_equal(0, @info.size) end def test_offset assert_equal(0, @info.offset) end def test_type assert_kind_of(GObjectIntrospection::TypeInfo, @info.type) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-base-info.rb����������������������������������0000644�0001750�0001750�00000002141�12067770242�023256� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestBaseInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @info = @repository.find("GObject", "Object") end def test_name assert_equal("Object", @info.name) end def test_namespace assert_equal("GObject", @info.namespace) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-constant-info.rb������������������������������0000644�0001750�0001750�00000001776�12067770242�024212� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestConstantInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") # TODO: find ConstantInfo # @info = @repository.find("GObject", "Object") end end ��ruby-gnome2-all-2.2.5/gobject-introspection/test/test-loader.rb�������������������������������������0000644�0001750�0001750�00000002255�12067770242�022667� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestLoaderInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @info = @repository.find("Gio", "Application") @sandbox = Module.new end def test_define_class gtype = @info.gtype GObjectIntrospection::Loader.define_class(gtype, "Application", @sandbox) assert_equal(gtype, @sandbox::Application.gtype) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-callback-info.rb������������������������������0000644�0001750�0001750�00000002130�12067770242�024076� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestCallbackInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @info = @repository.find("Gio", "AsyncReadyCallback") end def test_name assert_equal(GObjectIntrospection::Transfer::NOTHING, @info.caller_owns) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-boxed-info.rb���������������������������������0000644�0001750�0001750�00000001546�12067770242�023455� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestBoxedInfo < Test::Unit::TestCase def setup # TODO: find BoxedInfo end end ����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/run-test.rb����������������������������������������0000755�0001750�0001750�00000003164�12067770242�022230� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2012 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") modules = [ [glib_base, "glib2"], [gobject_introspection_base, "gobject-introspection"] ] modules.each do |target, module_name| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" require "gobject-introspection" exit Test::Unit::AutoRunner.run(true) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-type-info.rb����������������������������������0000644�0001750�0001750�00000003543�12067770242�023334� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestTypeInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @function_info = @repository.find("GObject", "signal_list_ids") @info = @function_info.return_type end def test_pointer? assert_true(@info.pointer?) end def test_tag assert_kind_of(GObjectIntrospection::TypeTag, @info.tag) end def test_param_type assert_kind_of(GObjectIntrospection::TypeInfo, @info.get_param_type(0)) end def test_interface function_info = @repository.find("GObject", "type_class_ref") info = function_info.return_type assert_kind_of(GObjectIntrospection::StructInfo, info.interface) end def test_array_length assert_equal(1, @info.array_length) end def test_array_fixed_size assert_equal(-1, @info.array_fixed_size) end def test_zero_terminated? assert_false(@info.zero_terminated?) end def test_array_type assert_equal(GObjectIntrospection::ArrayType::C, @info.array_type) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-arg-info.rb�����������������������������������0000644�0001750�0001750�00000003566�12077252562�023132� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestArgInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @callable_info = @repository.find("GObject", "signal_name") @info = @callable_info.get_arg(0) end def test_direction assert_equal(GObjectIntrospection::Direction::IN, @info.direction) end def test_caller_allocate? assert_false(@info.caller_allocates?) end def test_return_value? assert_false(@info.return_value?) end def test_optional? assert_false(@info.optional?) end def test_may_be_null? assert_false(@info.may_be_null?) end def test_ownership_transfer assert_equal(GObjectIntrospection::Transfer::NOTHING, @info.ownership_transfer) end def test_scope assert_equal(GObjectIntrospection::ScopeType::INVALID, @info.scope) end def test_closure assert_equal(-1, @info.closure) end def test_destroy assert_equal(-1, @info.destroy) end def test_type assert_kind_of(GObjectIntrospection::TypeInfo, @info.type) end end ������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-repository.rb���������������������������������0000644�0001750�0001750�00000003645�12307003726�023635� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 class TestRepository < Test::Unit::TestCase include GObjectIntrospectionTestUtils def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @repository.require("Gio") end def test_get_n_infos assert_kind_of(Integer, @repository.get_n_infos("GObject")) end def test_get_info assert_kind_of(GObjectIntrospection::BaseInfo, @repository.get_info("GObject", 0)) end def test_get_dependencies require_version(1, 36, 0) assert_equal(["GObject-2.0"].sort, @repository.get_dependencies("Gio").sort) end def test_loaded_namespaces assert_equal(["GLib", "GObject", "Gio"].sort, @repository.loaded_namespaces.sort) end def test_enumerable namespaces = @repository.collect do |info| info.namespace end assert_equal(["GLib", "GObject", "Gio"].sort, namespaces.uniq.sort) end def test_find_by_gtype info = @repository.find(GLib::Object.gtype) assert_equal("Object", info.name) end def test_find_by_name info = @repository.find("GObject", "Object") assert_equal("Object", info.name) end end �������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-flags-info.rb���������������������������������0000644�0001750�0001750�00000002064�12067770242�023444� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestFlagsInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") end def test_class assert_kind_of(GObjectIntrospection::FlagsInfo, @repository.find("GObject", "SignalFlags")) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-callable-info.rb������������������������������0000644�0001750�0001750�00000002777�12077252562�024123� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestCallableInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @info = @repository.find("GObject", "signal_name") end def test_return_type assert_kind_of(GObjectIntrospection::TypeInfo, @info.return_type) end def test_caller_owns assert_equal(GObjectIntrospection::Transfer::NOTHING, @info.caller_owns) end def test_may_return_null? assert_false(@info.may_return_null?) end def test_n_args assert_equal(1, @info.n_args) end def test_get_arg assert_equal("signal_id", @info.get_arg(0).name) end def test_args assert_equal(["signal_id"], @info.args.collect(&:name)) end end �ruby-gnome2-all-2.2.5/gobject-introspection/test/test-object-info.rb��������������������������������0000644�0001750�0001750�00000006456�12416346617�023632� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestObjectInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @info = @repository.find("Gio", "FileOutputStream") end def test_type_name assert_equal("GFileOutputStream", @info.type_name) end def test_type_init assert_equal("g_file_output_stream_get_type", @info.type_init) end def test_abstract? assert_false(@info.abstract?) end def test_fundamental? assert_false(@info.fundamental?) end def test_parent assert_equal("OutputStream", @info.parent.name) end def test_n_interfaces assert_equal(1, @info.n_interfaces) end def test_get_interface assert_kind_of(GObjectIntrospection::InterfaceInfo, @info.get_interface(0)) end def test_n_fields assert_equal(2, @info.n_fields) end def test_get_field assert_kind_of(GObjectIntrospection::FieldInfo, @info.get_field(0)) end def test_n_properties info = @repository.find("Gio", "BufferedOutputStream") assert_equal(2, info.n_properties) end def test_get_property info = @repository.find("Gio", "BufferedOutputStream") assert_kind_of(GObjectIntrospection::PropertyInfo, info.get_property(0)) end def test_n_methods assert_equal(4, @info.n_methods) end def test_get_method_n assert_kind_of(GObjectIntrospection::FunctionInfo, @info.get_method(0)) end def test_get_method_name assert_kind_of(GObjectIntrospection::FunctionInfo, @info.get_method("get_etag")) end def test_n_signals info = @repository.find("Gio", "Application") assert_operator(5, :<=, info.n_signals) end def test_get_signal info = @repository.find("Gio", "Application") assert_kind_of(GObjectIntrospection::SignalInfo, info.get_signal(0)) end def test_n_vfuncs assert_equal(9, @info.n_vfuncs) end def test_get_vfunc_n assert_kind_of(GObjectIntrospection::VFuncInfo, @info.get_vfunc(0)) end def test_get_vfunc_name assert_kind_of(GObjectIntrospection::VFuncInfo, @info.get_vfunc("can_seek")) end def test_n_constants assert_equal(0, @info.n_constants) end def test_unref_function assert_nil(@info.unref_function) end def test_ref_function assert_nil(@info.ref_function) end def test_set_value_function assert_nil(@info.set_value_function) end def test_get_value_function assert_nil(@info.get_value_function) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-enum-info.rb����������������������������������0000644�0001750�0001750�00000003526�12307003726�023311� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 class TestEnumInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @info = @repository.find("Gio", "ResourceError") end def test_n_values assert_equal(2, @info.n_values) end def test_value assert_kind_of(GObjectIntrospection::ValueInfo, @info.get_value(0)) end def test_values assert_equal([GObjectIntrospection::ValueInfo] * @info.n_values, @info.values.collect(&:class)) end def test_n_methods assert_equal(1, @info.n_methods) end def test_method assert_kind_of(GObjectIntrospection::FunctionInfo, @info.get_method(0)) end def test_methods assert_equal([GObjectIntrospection::FunctionInfo] * @info.n_methods, @info.methods.collect(&:class)) end def test_storage_type assert_equal(GObjectIntrospection::TypeTag::UINT32, @info.storage_type) end def test_error_domain assert_equal("g-resource-error-quark", @info.error_domain) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-signal-info.rb��������������������������������0000644�0001750�0001750�00000002547�12416346617�023636� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 class TestSignalInfo < Test::Unit::TestCase include GObjectIntrospectionTestUtils def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @object_info = @repository.find("Gio", "Application") @info = @object_info.signals.find {|info| info.name == "startup"} end def test_flags require_version(1, 40, 0) assert_equal(GLib::SignalFlags::RUN_FIRST, @info.flags) end def test_class_closure assert_nil(@info.class_closure) end def test_true_stops_emit? assert_false(@info.true_stops_emit?) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-registered-type-info.rb�����������������������0000644�0001750�0001750�00000002342�12067770242�025463� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestRegisteredTypeInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("GObject") @info = @repository.find("GObject", "TypePlugin") end def test_type_name assert_equal("GTypePlugin", @info.type_name) end def test_type_init assert_equal("g_type_plugin_get_type", @info.type_init) end def test_gtype assert_equal(GLib::Type.new("GTypePlugin"), @info.gtype) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-union-info.rb���������������������������������0000644�0001750�0001750�00000001546�12067770242�023504� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestUnionInfo < Test::Unit::TestCase def setup # TODO: find UnionInfo end end ����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-vfunc-info.rb���������������������������������0000644�0001750�0001750�00000002543�12067770242�023473� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 class TestVFuncInfo < Test::Unit::TestCase def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @object_info = @repository.find("Gio", "FileOutputStream") @info = @object_info.get_vfunc(0) end def test_flags assert_equal(GObjectIntrospection::VFuncInfoFlags.new, @info.flags) end def test_offset assert_equal(GObjectIntrospection::VFuncInfo::UNKNOWN_OFFSET, @info.offset) end def test_signal assert_nil(@info.signal) end def test_invoker assert_nil(@info.invoker) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/test/test-interface-info.rb�����������������������������0000644�0001750�0001750�00000005423�12307003726�024303� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2014 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 class TestInterfaceInfo < Test::Unit::TestCase include GObjectIntrospectionTestUtils def setup @repository = GObjectIntrospection::Repository.default @repository.require("Gio") @info = @repository.find("Gio", "TlsServerConnection") end def test_n_prerequisites assert_equal(1, @info.n_prerequisites) end def test_prerequisite assert_kind_of(GObjectIntrospection::ObjectInfo, @info.get_prerequisite(0)) end def test_n_properties assert_equal(1, @info.n_properties) end def test_propertiy assert_kind_of(GObjectIntrospection::PropertyInfo, @info.get_property(0)) end def test_n_methods assert_equal(1, @info.n_methods) end def test_get_method_n assert_kind_of(GObjectIntrospection::FunctionInfo, @info.get_method(0)) end def test_get_method_name assert_kind_of(GObjectIntrospection::FunctionInfo, @info.get_method("new")) end def test_n_signals info = @repository.find("Gio", "Volume") assert_equal(2, info.n_signals) end def test_get_signal_n info = @repository.find("Gio", "Volume") assert_kind_of(GObjectIntrospection::SignalInfo, info.get_signal(0)) end def test_get_signal_name require_version(1, 36, 0) info = @repository.find("Gio", "Volume") assert_kind_of(GObjectIntrospection::SignalInfo, info.get_signal("changed")) end def test_n_vfuncs info = @repository.find("Gio", "Volume") assert_operator(0, :<, info.n_vfuncs) end def test_get_vfunc_n info = @repository.find("Gio", "Volume") assert_kind_of(GObjectIntrospection::VFuncInfo, info.get_vfunc(0)) end def test_get_vfunc_name info = @repository.find("Gio", "Volume") assert_kind_of(GObjectIntrospection::VFuncInfo, info.get_vfunc("can_eject")) end def test_iface_struct assert_kind_of(GObjectIntrospection::StructInfo, @info.iface_struct) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/extconf.rb����������������������������������������������0000755�0001750�0001750�00000004047�12067770242�021137� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2012 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 require "pathname" require "mkmf" require "rbconfig" require "fileutils" module_name = "gobject_introspection" package = "gobject-introspection" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' if RbConfig.respond_to?(:ruby) ruby = RbConfig.ruby else ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) end build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" unless system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) exit(false) end create_makefile(module_name) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/Rakefile������������������������������������������������0000644�0001750�0001750�00000010055�12446170460�020577� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2012-2014 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection." package.description = "Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection." package.dependency.gem.runtime = ["glib2"] package.dependency.gem.development = [["test-unit", ">= 2"]] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = ["glib2"] package.external_packages = [ { :name => "glib", :download_site => :gnome, :label => "GLib", :version => "2.42.1", :compression_method => "xz", :windows => { :build => false, }, :native => { :build => true, :need_autoreconf => true, :built_file => "lib/libglib-2.0.so", }, }, { :name => "gobject-introspection", :download_site => :gnome, :label => "gobject-introspection", :version => "1.42.0", :compression_method => "xz", :windows => { :configure_args => [ "--with-g-ir-scanner=#{package.native.absolute_binary_dir}/bin/g-ir-scanner", "--disable-tests", ], :patches => [ "support-external-g-ir-scanner.diff", ], :need_autoreconf => true, :built_file => "bin/libgirepository-1.0-1.dll", }, :native => { :build => true, :patches => [ # "cross-compilable-g-ir-scanner.diff", ], :built_file => "bin/g-ir-scanner", } }, ] end package_task.define namespace :native do namespace :"gobject-introspection" do g_ir_scanner_dir = package_task.native.absolute_binary_dir g_ir_scanner_dir += "lib/gobject-introspection/giscanner" patched_path = g_ir_scanner_dir + "patched" file patched_path.to_s do Dir.chdir(g_ir_scanner_dir.to_s) do patch = "#{package_task.package.patches_dir}/cross-g-ir-scanner.diff" sh("patch -p2 < #{patch}") rm_f(Dir.glob("*.{pyc,pyo}")) end touch(patched_path) end desc "Make g-ir-scanner workable for Windows on non Windows" task :cross => patched_path end namespace :builder do task :after => "native:gobject-introspection:cross" end end namespace :windows do namespace :"gobject-introspection" do pkg_config_dir = package_task.windows.absolute_binary_dir + "lib/pkgconfig" pc_path = pkg_config_dir + "gobject-introspection-1.0.pc" patched_path = pkg_config_dir + "patched" file patched_path.to_s do original_pc = pc_path.read new_pc = "" new_pc << "native_prefix=#{package_task.native.absolute_binary_dir}\n" new_pc << "native_bindir=${native_prefix}/bin\n" original_pc.each_line do |line| case line when /\Ag_ir_(scanner|compiler)=/ new_pc << line.gsub(/\${bindir}/, "${native_bindir}").gsub(/\.exe/, "") else new_pc << line end end pc_path.open("w") do |pc_file| pc_file.write(new_pc) end touch(patched_path) end desc "Use native tools" task :cross => patched_path.to_s end namespace :builder do task :after => "windows:gobject-introspection:cross" end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/README.md�����������������������������������������������0000644�0001750�0001750�00000001055�12077252562�020415� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/GObjectIntrospection Ruby/GObjectIntrospection is a Ruby binding of GObject Introspect. ## Requirements * Ruby/GLib2 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [GObject Introspection](http://live.gnome.org/GObjectIntrospection) ## Install gem install gobject-introspection ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/����������������������������������������������������0000755�0001750�0001750�00000000000�12067770242�017734� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/������������������������������0000755�0001750�0001750�00000000000�12516441042�024237� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-method-info.c�����������0000644�0001750�0001750�00000005077�12516434313�027626� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2013 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIMethodInfo #define SELF(self) RVAL2GI_FUNCTION_INFO(self) GType gi_method_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIMethodInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_invoke(VALUE self, VALUE rb_options) { GIFunctionInfo *info; GICallableInfo *callable_info; GIArgument return_value; VALUE rb_out_args; VALUE rb_return_value; info = SELF(self); /* TODO: use rb_protect */ rb_out_args = rb_gi_function_info_invoke_raw(info, rb_options, &return_value); callable_info = (GICallableInfo *)info; rb_return_value = GI_RETURN_ARGUMENT2RVAL(&return_value, callable_info); if (NIL_P(rb_out_args)) { return rb_return_value; } else { GITypeInfo return_value_info; g_callable_info_load_return_type(callable_info, &return_value_info); if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) { rb_ary_unshift(rb_out_args, rb_return_value); } if (RARRAY_LEN(rb_out_args) == 1) { return RARRAY_PTR(rb_out_args)[0]; } else { return rb_out_args; } } } void rb_gi_method_info_init(VALUE rb_mGI, VALUE rb_cGIFunctionInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_METHOD_INFO, "MethodInfo", rb_mGI, rb_cGIFunctionInfo); RG_DEF_METHOD(invoke, 1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/gobject_introspection.def�����0000644�0001750�0001750�00000000137�12137115064�031316� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������EXPORTS Init_gobject_introspection rb_gi_callback_data_free rb_gi_callback_register_finder ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-constructor-info.c������0000644�0001750�0001750�00000010230�12516434313�030716� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIConstructorInfo #define SELF(self) RVAL2GI_FUNCTION_INFO(self) GType gi_constructor_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIConstructorInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static void initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value) { GIBaseInfo *interface_info; GIInfoType interface_type; if (g_type_info_get_tag(info) != GI_TYPE_TAG_INTERFACE) { rb_raise(rb_eRuntimeError, "TODO: returned value isn't interface"); } interface_info = g_type_info_get_interface(info); interface_type = g_base_info_get_type(interface_info); g_base_info_unref(interface_info); switch (interface_type) { case GI_INFO_TYPE_OBJECT: g_object_ref_sink(value->v_pointer); G_INITIALIZE(receiver, value->v_pointer); break; case GI_INFO_TYPE_STRUCT: G_INITIALIZE(receiver, value->v_pointer); break; case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_CALLBACK: case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_FLAGS: case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_CONSTANT: case GI_INFO_TYPE_INVALID_0: rb_raise(rb_eRuntimeError, "TODO: returned value isn't object, struct or union"); break; case GI_INFO_TYPE_UNION: G_INITIALIZE(receiver, value->v_pointer); break; case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_UNRESOLVED: default: rb_raise(rb_eRuntimeError, "TODO: returned value isn't object, struct or union"); break; } } static VALUE rg_invoke(VALUE self, VALUE rb_options) { GIFunctionInfo *info; GICallableInfo *callable_info; VALUE receiver; GIArgument return_value; GITypeInfo return_value_info; info = SELF(self); callable_info = (GICallableInfo *)info; rb_options = rbg_to_hash(rb_options); receiver = rb_hash_delete(rb_options, ID2SYM(rb_intern("receiver"))); if (NIL_P(receiver)) { receiver = rb_hash_delete(rb_options, rb_str_new_cstr("receiver")); } if (NIL_P(receiver)) { rb_raise(rb_eArgError, "receiver is missing: %s", RBG_INSPECT(rb_options)); } /* TODO: use rb_protect */ rb_gi_function_info_invoke_raw(info, rb_options, &return_value); g_callable_info_load_return_type(callable_info, &return_value_info); initialize_receiver(receiver, &return_value_info, &return_value); return receiver; } void rb_gi_constructor_info_init(VALUE rb_mGI, VALUE rb_cGIFunctionInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_CONSTRUCTOR_INFO, "ConstructorInfo", rb_mGI, rb_cGIFunctionInfo); RG_DEF_METHOD(invoke, 1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-field-info.c������������0000644�0001750�0001750�00000007512�12516434313�027425� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2013 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIFieldInfo #define SELF(self) (RVAL2GI_FIELD_INFO(self)) GType gi_field_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIFieldInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_flags(VALUE self) { GIFieldInfo *info; info = SELF(self); return GI_FIELD_INFO_FLAGS2RVAL(g_field_info_get_flags(info)); } static VALUE rg_size(VALUE self) { GIFieldInfo *info; info = SELF(self); return INT2NUM(g_field_info_get_size(info)); } static VALUE rg_offset(VALUE self) { GIFieldInfo *info; info = SELF(self); return INT2NUM(g_field_info_get_offset(info)); } static VALUE rg_type(VALUE self) { GIFieldInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_field_info_get_type(info)); } VALUE rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory) { GIArgument argument; GITypeInfo *type_info; VALUE rb_field_value; if (!g_field_info_get_field(info, memory, &argument)) { rb_raise(rb_eArgError, "failed to get field value"); } type_info = g_field_info_get_type(info); rb_field_value = GI_ARGUMENT2RVAL(&argument, type_info); g_base_info_unref(type_info); return rb_field_value; } void rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory, VALUE rb_field_value) { GIArgument field_value; GITypeInfo *type_info; gboolean succeeded; type_info = g_field_info_get_type(info); RVAL2GI_VALUE_ARGUMENT(&field_value, type_info, rb_field_value); succeeded = g_field_info_set_field(info, memory, &field_value); rb_gi_value_argument_free(&field_value, type_info); g_base_info_unref(type_info); if (!succeeded) { rb_raise(rb_eArgError, "failed to set field value"); } } static VALUE rg_get_field(VALUE self, VALUE rb_memory) { GIFieldInfo *info; gpointer memory; info = SELF(self); memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory)); return rb_gi_field_info_get_field_raw(info, memory); } static VALUE rg_set_field(VALUE self, VALUE rb_memory, VALUE rb_field_value) { GIFieldInfo *info; gpointer memory; info = SELF(self); memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory)); rb_gi_field_info_set_field_raw(info, memory, rb_field_value); return Qnil; } void rb_gi_field_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_FIELD_INFO, "FieldInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(offset, 0); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(get_field, 1); RG_DEF_METHOD(set_field, 2); G_DEF_CLASS(G_TYPE_I_FIELD_INFO_FLAGS, "FieldInfoFlags", rb_mGI); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������././@LongLink���������������������������������������������������������������������������������������0000644�0000000�0000000�00000000151�00000000000�011600� L����������������������������������������������������������������������������������������������������ustar �root����������������������������root�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.h������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-typ0000644�0001750�0001750�00000003036�12446173031�032255� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Generated by glib-mkenums.rb ($Id$) */ #ifndef __GOBJECT_INTROSPECTION_ENUM_TYPES_H__ #define __GOBJECT_INTROSPECTION_ENUM_TYPES_H__ #include <glib-object.h> G_BEGIN_DECLS /* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */ GType g_i_repository_load_flags_get_type (void); #define G_TYPE_I_REPOSITORY_LOAD_FLAGS (g_i_repository_load_flags_get_type()) GType g_i_repository_error_get_type (void); #define G_TYPE_I_REPOSITORY_ERROR (g_i_repository_error_get_type()) /* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */ GType g_i_info_type_get_type (void); #define G_TYPE_I_INFO_TYPE (g_i_info_type_get_type()) GType g_i_transfer_get_type (void); #define G_TYPE_I_TRANSFER (g_i_transfer_get_type()) GType g_i_direction_get_type (void); #define G_TYPE_I_DIRECTION (g_i_direction_get_type()) GType g_i_scope_type_get_type (void); #define G_TYPE_I_SCOPE_TYPE (g_i_scope_type_get_type()) GType g_i_type_tag_get_type (void); #define G_TYPE_I_TYPE_TAG (g_i_type_tag_get_type()) GType g_i_array_type_get_type (void); #define G_TYPE_I_ARRAY_TYPE (g_i_array_type_get_type()) GType g_i_field_info_flags_get_type (void); #define G_TYPE_I_FIELD_INFO_FLAGS (g_i_field_info_flags_get_type()) GType g_iv_func_info_flags_get_type (void); #define G_TYPE_IV_FUNC_INFO_FLAGS (g_iv_func_info_flags_get_type()) GType g_i_function_info_flags_get_type (void); #define G_TYPE_I_FUNCTION_INFO_FLAGS (g_i_function_info_flags_get_type()) G_END_DECLS #endif /* __GOBJECT_INTROSPECTION_ENUM_TYPES_H__ */ /* Generated data ends here */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-callback-info.c���������0000644�0001750�0001750�00000003106�12121311640�030056� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGICallbackInfo #define SELF(self) RVAL2GI_BASE_INFO(self) GType gi_callback_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GICallbackInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } void rb_gi_callback_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_CALLBACK_INFO, "CallbackInfo", rb_mGI, rb_cGICallableInfo); (void)RG_TARGET_NAMESPACE; /* suppress a warning. */ } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-registered-type-info.c��0000644�0001750�0001750�00000004745�12121311640�031450� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIRegisteredTypeInfo #define SELF(self) (RVAL2GI_REGISTERED_TYPE_INFO(self)) GType gi_registered_type_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIRegisteredTypeInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_type_name(VALUE self) { GIRegisteredTypeInfo *info; info = SELF(self); return CSTR2RVAL(g_registered_type_info_get_type_name(info)); } static VALUE rg_type_init(VALUE self) { GIRegisteredTypeInfo *info; info = SELF(self); return CSTR2RVAL(g_registered_type_info_get_type_init(info)); } static VALUE rg_gtype(VALUE self) { GIRegisteredTypeInfo *info; info = SELF(self); return rbgobj_gtype_new(g_registered_type_info_get_g_type(info)); } void rb_gi_registered_type_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_REGISTERED_TYPE_INFO, "RegisteredTypeInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD(type_name, 0); RG_DEF_METHOD(type_init, 0); RG_DEF_METHOD(gtype, 0); rb_gi_struct_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_boxed_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_enum_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_object_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_interface_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_union_info_init(rb_mGI, RG_TARGET_NAMESPACE); } ���������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-type-tag.c��������������0000644�0001750�0001750�00000002423�12121311640�027124� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGITypeTag #define SELF(self) (RVAL2GI_TYPE_TAG(self)) static VALUE rg_to_s(VALUE self) { GITypeTag tag; tag = SELF(self); return CSTR2RVAL(g_type_tag_to_string(tag)); } void rb_gi_type_tag_init(VALUE rb_mGI) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_I_TYPE_TAG, "TypeTag", rb_mGI); RG_DEF_METHOD(to_s, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/extconf.rb��������������������0000755�0001750�0001750�00000006152�12516434313�026244� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2012-2013 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 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 = "gobject_introspection" package_id = "gobject-introspection-1.0" begin require "mkmf-gnome2" rescue LoadError require "rubygems" gem "glib2" require "mkmf-gnome2" end ["glib2"].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 setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libgirepository1.0-dev", :fedora => "gobject-introspection-devel", :homebrew => "gobject-introspection", :macports => "gobject-introspection") exit(false) end make_version_header("GI", package_id, ".") gi_headers = ["girepository.h"] have_func("g_interface_info_find_signal", gi_headers) enum_type_prefix = "gobject-introspection-enum-types" include_paths = PKGConfig.cflags_only_I(package_id) headers = include_paths.split.inject([]) do |result, path| result + Dir.glob(File.join(path.sub(/^-I/, ""), "gi{repository,types}.h")) end glib_mkenums(enum_type_prefix, headers, "G_TYPE_", ["girepository.h"]) create_pkg_config_file("Ruby/GObjectIntrospection", package_id, ruby_gnome2_version, "ruby-gobject-introspection.pc") ensure_objs $defs << "-DRUBY_GOBJECT_INTROSPECTION_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 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-types.h�����������������0000644�0001750�0001750�00000006523�12067770242�026570� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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_GI_TYPES_H #define RB_GI_TYPES_H #define GI_TYPE_CALLABLE_INFO (gi_callable_info_get_type()) #define GI_TYPE_FUNCTION_INFO (gi_function_info_get_type()) #define GI_TYPE_METHOD_INFO (gi_method_info_get_type()) #define GI_TYPE_CONSTRUCTOR_INFO (gi_constructor_info_get_type()) #define GI_TYPE_CALLBACK_INFO (gi_callback_info_get_type()) #define GI_TYPE_REGISTERED_TYPE_INFO (gi_registered_type_info_get_type()) #define GI_TYPE_STRUCT_INFO (gi_struct_info_get_type()) #define GI_TYPE_BOXED_INFO (gi_boxed_info_get_type()) #define GI_TYPE_ENUM_INFO (gi_enum_info_get_type()) #define GI_TYPE_FLAGS_INFO (gi_flags_info_get_type()) #define GI_TYPE_OBJECT_INFO (gi_object_info_get_type()) #define GI_TYPE_INTERFACE_INFO (gi_interface_info_get_type()) #define GI_TYPE_CONSTANT_INFO (gi_constant_info_get_type()) #define GI_TYPE_UNION_INFO (gi_union_info_get_type()) #define GI_TYPE_VALUE_INFO (gi_value_info_get_type()) #define GI_TYPE_SIGNAL_INFO (gi_signal_info_get_type()) #define GI_TYPE_VFUNC_INFO (gi_vfunc_info_get_type()) #define GI_TYPE_PROPERTY_INFO (gi_property_info_get_type()) #define GI_TYPE_FIELD_INFO (gi_field_info_get_type()) #define GI_TYPE_ARG_INFO (gi_arg_info_get_type()) #define GI_TYPE_TYPE_INFO (gi_type_info_get_type()) #define GI_TYPE_UNRESOLVED_INFO (gi_unresolved_info_get_type()) GType gi_callable_info_get_type (void); GType gi_function_info_get_type (void); GType gi_method_info_get_type (void); GType gi_constructor_info_get_type (void); GType gi_callback_info_get_type (void); GType gi_registered_type_info_get_type (void); GType gi_struct_info_get_type (void); GType gi_boxed_info_get_type (void); GType gi_enum_info_get_type (void); GType gi_flags_info_get_type (void); GType gi_object_info_get_type (void); GType gi_interface_info_get_type (void); GType gi_constant_info_get_type (void); GType gi_union_info_get_type (void); GType gi_value_info_get_type (void); GType gi_signal_info_get_type (void); GType gi_vfunc_info_get_type (void); GType gi_property_info_get_type (void); GType gi_field_info_get_type (void); GType gi_arg_info_get_type (void); GType gi_type_info_get_type (void); GType gi_unresolved_info_get_type (void); #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-object-info.c�����������0000644�0001750�0001750�00000017172�12121311640�027600� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIObjectInfo #define SELF(self) (RVAL2GI_OBJECT_INFO(self)) GType gi_object_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIObjectInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_type_name(VALUE self) { GIObjectInfo *info; info = SELF(self); return CSTR2RVAL(g_object_info_get_type_name(info)); } static VALUE rg_type_init(VALUE self) { GIObjectInfo *info; info = SELF(self); return CSTR2RVAL(g_object_info_get_type_init(info)); } static VALUE rg_abstract_p(VALUE self) { GIObjectInfo *info; info = SELF(self); return CBOOL2RVAL(g_object_info_get_abstract(info)); } static VALUE rg_fundamental_p(VALUE self) { GIObjectInfo *info; info = SELF(self); return CBOOL2RVAL(g_object_info_get_fundamental(info)); } static VALUE rg_parent(VALUE self) { GIObjectInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_object_info_get_parent(info)); } static VALUE rg_n_interfaces(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_interfaces(info)); } static VALUE rg_get_interface(VALUE self, VALUE rb_n) { GIObjectInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_object_info_get_interface(info, n)); } static VALUE rg_n_fields(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_fields(info)); } static VALUE rg_get_field(VALUE self, VALUE rb_n) { GIObjectInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_object_info_get_field(info, n)); } static VALUE rg_get_field_value(VALUE self, VALUE rb_object, VALUE rb_n) { GIObjectInfo *info; gint n; GIFieldInfo *field_info; VALUE rb_value; info = SELF(self); n = NUM2INT(rb_n); field_info = g_object_info_get_field(info, n); rb_value = rb_gi_field_info_get_field_raw(field_info, RVAL2GOBJ(rb_object)); g_base_info_unref(field_info); return rb_value; } static VALUE rg_set_field_value(VALUE self, VALUE rb_object, VALUE rb_n, VALUE rb_value) { GIObjectInfo *info; gint n; GIFieldInfo *field_info; info = SELF(self); n = NUM2INT(rb_n); field_info = g_object_info_get_field(info, n); rb_gi_field_info_set_field_raw(field_info, RVAL2GOBJ(rb_object), rb_value); /* TODO: use rb_ensure() to unref field_info. */ g_base_info_unref(field_info); return Qnil; } static VALUE rg_n_properties(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_properties(info)); } static VALUE rg_get_property(VALUE self, VALUE rb_n) { GIObjectInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_object_info_get_property(info, n)); } static VALUE rg_n_methods(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_methods(info)); } static VALUE rg_get_method(VALUE self, VALUE rb_n_or_name) { GIObjectInfo *info; GIFunctionInfo *function_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); function_info = g_object_info_get_method(info, n); } else { const gchar *name; name = RVAL2CSTR(rb_n_or_name); function_info = g_object_info_find_method(info, name); } return GI_BASE_INFO2RVAL_WITH_UNREF(function_info); } static VALUE rg_n_signals(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_signals(info)); } static VALUE rg_get_signal(VALUE self, VALUE rb_n) { GIObjectInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_object_info_get_signal(info, n)); } static VALUE rg_n_vfuncs(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_vfuncs(info)); } static VALUE rg_get_vfunc(VALUE self, VALUE rb_n_or_name) { GIObjectInfo *info; GIVFuncInfo *vfunc_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); vfunc_info = g_object_info_get_vfunc(info, n); } else { const gchar *name; name = RVAL2CSTR(rb_n_or_name); vfunc_info = g_object_info_find_vfunc(info, name); } return GI_BASE_INFO2RVAL_WITH_UNREF(vfunc_info); } static VALUE rg_n_constants(VALUE self) { GIObjectInfo *info; info = SELF(self); return INT2NUM(g_object_info_get_n_constants(info)); } static VALUE rg_get_constant(VALUE self, VALUE rb_n) { GIObjectInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_object_info_get_constant(info, n)); } static VALUE rg_unref_function(VALUE self) { GIObjectInfo *info; info = SELF(self); return CSTR2RVAL(g_object_info_get_unref_function(info)); } static VALUE rg_ref_function(VALUE self) { GIObjectInfo *info; info = SELF(self); return CSTR2RVAL(g_object_info_get_ref_function(info)); } static VALUE rg_set_value_function(VALUE self) { GIObjectInfo *info; info = SELF(self); return CSTR2RVAL(g_object_info_get_set_value_function(info)); } static VALUE rg_get_value_function(VALUE self) { GIObjectInfo *info; info = SELF(self); return CSTR2RVAL(g_object_info_get_get_value_function(info)); } void rb_gi_object_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_OBJECT_INFO, "ObjectInfo", rb_mGI, rb_cGIRegisteredTypeInfo); RG_DEF_METHOD(type_name, 0); RG_DEF_METHOD(type_init, 0); RG_DEF_METHOD_P(abstract, 0); RG_DEF_METHOD_P(fundamental, 0); RG_DEF_METHOD(parent, 0); RG_DEF_METHOD(n_interfaces, 0); RG_DEF_METHOD(get_interface, 1); RG_DEF_METHOD(n_fields, 0); RG_DEF_METHOD(get_field, 1); RG_DEF_METHOD(get_field_value, 2); RG_DEF_METHOD(set_field_value, 3); RG_DEF_METHOD(n_properties, 0); RG_DEF_METHOD(get_property, 1); RG_DEF_METHOD(n_methods, 0); RG_DEF_METHOD(get_method, 1); RG_DEF_METHOD(n_signals, 0); RG_DEF_METHOD(get_signal, 1); RG_DEF_METHOD(n_vfuncs, 0); RG_DEF_METHOD(get_vfunc, 1); RG_DEF_METHOD(n_constants, 0); RG_DEF_METHOD(get_constant, 1); RG_DEF_METHOD(unref_function, 0); RG_DEF_METHOD(ref_function, 0); RG_DEF_METHOD(set_value_function, 0); RG_DEF_METHOD(get_value_function, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gobject-introspection.c����0000644�0001750�0001750�00000003066�12121311640�031314� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2013 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_mGObjectIntrospection void Init_gobject_introspection(void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module("GObjectIntrospection"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(GI_MAJOR_VERSION), INT2FIX(GI_MINOR_VERSION), INT2FIX(GI_MICRO_VERSION))); rb_gi_argument_init(); rb_gi_type_tag_init(RG_TARGET_NAMESPACE); rb_gi_base_info_init(RG_TARGET_NAMESPACE); rb_gi_repository_init(RG_TARGET_NAMESPACE); rb_gi_loader_init(RG_TARGET_NAMESPACE); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/depend������������������������0000644�0001750�0001750�00000000451�12121311640�025411� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rb-gobject-introspection.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gobject-introspection.pc $(pkgconfigdir);\ fi �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������././@LongLink���������������������������������������������������������������������������������������0000644�0000000�0000000�00000000151�00000000000�011600� L����������������������������������������������������������������������������������������������������ustar �root����������������������������root�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-types.c������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/gobject-introspection-enum-typ0000644�0001750�0001750�00000017516�12446173031�032265� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* Generated by glib-mkenums.rb ($Id$) */ #include "gobject-introspection-enum-types.h" #include <girepository.h> /* enumerations from "/usr/include/gobject-introspection-1.0/girepository.h" */ GType g_i_repository_load_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { G_IREPOSITORY_LOAD_FLAG_LAZY, "G_IREPOSITORY_LOAD_FLAG_LAZY", "g-irepository-load-flag-lazy" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GIRepositoryLoadFlags", values); } return etype; } GType g_i_repository_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND, "G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND", "typelib-not-found" }, { G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH, "G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH", "namespace-mismatch" }, { G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT, "G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT", "namespace-version-conflict" }, { G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND, "G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND", "library-not-found" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GIRepositoryError", values); } return etype; } /* enumerations from "/usr/include/gobject-introspection-1.0/gitypes.h" */ GType g_i_info_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { GI_INFO_TYPE_INVALID, "GI_INFO_TYPE_INVALID", "invalid" }, { GI_INFO_TYPE_FUNCTION, "GI_INFO_TYPE_FUNCTION", "function" }, { GI_INFO_TYPE_CALLBACK, "GI_INFO_TYPE_CALLBACK", "callback" }, { GI_INFO_TYPE_STRUCT, "GI_INFO_TYPE_STRUCT", "struct" }, { GI_INFO_TYPE_BOXED, "GI_INFO_TYPE_BOXED", "boxed" }, { GI_INFO_TYPE_ENUM, "GI_INFO_TYPE_ENUM", "enum" }, { GI_INFO_TYPE_FLAGS, "GI_INFO_TYPE_FLAGS", "flags" }, { GI_INFO_TYPE_OBJECT, "GI_INFO_TYPE_OBJECT", "object" }, { GI_INFO_TYPE_INTERFACE, "GI_INFO_TYPE_INTERFACE", "interface" }, { GI_INFO_TYPE_CONSTANT, "GI_INFO_TYPE_CONSTANT", "constant" }, { GI_INFO_TYPE_INVALID_0, "GI_INFO_TYPE_INVALID_0", "invalid-0" }, { GI_INFO_TYPE_UNION, "GI_INFO_TYPE_UNION", "union" }, { GI_INFO_TYPE_VALUE, "GI_INFO_TYPE_VALUE", "value" }, { GI_INFO_TYPE_SIGNAL, "GI_INFO_TYPE_SIGNAL", "signal" }, { GI_INFO_TYPE_VFUNC, "GI_INFO_TYPE_VFUNC", "vfunc" }, { GI_INFO_TYPE_PROPERTY, "GI_INFO_TYPE_PROPERTY", "property" }, { GI_INFO_TYPE_FIELD, "GI_INFO_TYPE_FIELD", "field" }, { GI_INFO_TYPE_ARG, "GI_INFO_TYPE_ARG", "arg" }, { GI_INFO_TYPE_TYPE, "GI_INFO_TYPE_TYPE", "type" }, { GI_INFO_TYPE_UNRESOLVED, "GI_INFO_TYPE_UNRESOLVED", "unresolved" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GIInfoType", values); } return etype; } GType g_i_transfer_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { GI_TRANSFER_NOTHING, "GI_TRANSFER_NOTHING", "nothing" }, { GI_TRANSFER_CONTAINER, "GI_TRANSFER_CONTAINER", "container" }, { GI_TRANSFER_EVERYTHING, "GI_TRANSFER_EVERYTHING", "everything" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GITransfer", values); } return etype; } GType g_i_direction_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { GI_DIRECTION_IN, "GI_DIRECTION_IN", "in" }, { GI_DIRECTION_OUT, "GI_DIRECTION_OUT", "out" }, { GI_DIRECTION_INOUT, "GI_DIRECTION_INOUT", "inout" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GIDirection", values); } return etype; } GType g_i_scope_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { GI_SCOPE_TYPE_INVALID, "GI_SCOPE_TYPE_INVALID", "invalid" }, { GI_SCOPE_TYPE_CALL, "GI_SCOPE_TYPE_CALL", "call" }, { GI_SCOPE_TYPE_ASYNC, "GI_SCOPE_TYPE_ASYNC", "async" }, { GI_SCOPE_TYPE_NOTIFIED, "GI_SCOPE_TYPE_NOTIFIED", "notified" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GIScopeType", values); } return etype; } GType g_i_type_tag_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { GI_TYPE_TAG_VOID, "GI_TYPE_TAG_VOID", "void" }, { GI_TYPE_TAG_BOOLEAN, "GI_TYPE_TAG_BOOLEAN", "boolean" }, { GI_TYPE_TAG_INT8, "GI_TYPE_TAG_INT8", "int8" }, { GI_TYPE_TAG_UINT8, "GI_TYPE_TAG_UINT8", "uint8" }, { GI_TYPE_TAG_INT16, "GI_TYPE_TAG_INT16", "int16" }, { GI_TYPE_TAG_UINT16, "GI_TYPE_TAG_UINT16", "uint16" }, { GI_TYPE_TAG_INT32, "GI_TYPE_TAG_INT32", "int32" }, { GI_TYPE_TAG_UINT32, "GI_TYPE_TAG_UINT32", "uint32" }, { GI_TYPE_TAG_INT64, "GI_TYPE_TAG_INT64", "int64" }, { GI_TYPE_TAG_UINT64, "GI_TYPE_TAG_UINT64", "uint64" }, { GI_TYPE_TAG_FLOAT, "GI_TYPE_TAG_FLOAT", "float" }, { GI_TYPE_TAG_DOUBLE, "GI_TYPE_TAG_DOUBLE", "double" }, { GI_TYPE_TAG_GTYPE, "GI_TYPE_TAG_GTYPE", "gtype" }, { GI_TYPE_TAG_UTF8, "GI_TYPE_TAG_UTF8", "utf8" }, { GI_TYPE_TAG_FILENAME, "GI_TYPE_TAG_FILENAME", "filename" }, { GI_TYPE_TAG_ARRAY, "GI_TYPE_TAG_ARRAY", "array" }, { GI_TYPE_TAG_INTERFACE, "GI_TYPE_TAG_INTERFACE", "interface" }, { GI_TYPE_TAG_GLIST, "GI_TYPE_TAG_GLIST", "glist" }, { GI_TYPE_TAG_GSLIST, "GI_TYPE_TAG_GSLIST", "gslist" }, { GI_TYPE_TAG_GHASH, "GI_TYPE_TAG_GHASH", "ghash" }, { GI_TYPE_TAG_ERROR, "GI_TYPE_TAG_ERROR", "error" }, { GI_TYPE_TAG_UNICHAR, "GI_TYPE_TAG_UNICHAR", "unichar" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GITypeTag", values); } return etype; } GType g_i_array_type_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { { GI_ARRAY_TYPE_C, "GI_ARRAY_TYPE_C", "c" }, { GI_ARRAY_TYPE_ARRAY, "GI_ARRAY_TYPE_ARRAY", "array" }, { GI_ARRAY_TYPE_PTR_ARRAY, "GI_ARRAY_TYPE_PTR_ARRAY", "ptr-array" }, { GI_ARRAY_TYPE_BYTE_ARRAY, "GI_ARRAY_TYPE_BYTE_ARRAY", "byte-array" }, { 0, NULL, NULL } }; etype = g_enum_register_static ("GIArrayType", values); } return etype; } GType g_i_field_info_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { GI_FIELD_IS_READABLE, "GI_FIELD_IS_READABLE", "readable" }, { GI_FIELD_IS_WRITABLE, "GI_FIELD_IS_WRITABLE", "writable" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GIFieldInfoFlags", values); } return etype; } GType g_iv_func_info_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { GI_VFUNC_MUST_CHAIN_UP, "GI_VFUNC_MUST_CHAIN_UP", "must-chain-up" }, { GI_VFUNC_MUST_OVERRIDE, "GI_VFUNC_MUST_OVERRIDE", "must-override" }, { GI_VFUNC_MUST_NOT_OVERRIDE, "GI_VFUNC_MUST_NOT_OVERRIDE", "must-not-override" }, { GI_VFUNC_THROWS, "GI_VFUNC_THROWS", "throws" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GIVFuncInfoFlags", values); } return etype; } GType g_i_function_info_flags_get_type (void) { static GType etype = 0; if (etype == 0) { static const GFlagsValue values[] = { { GI_FUNCTION_IS_METHOD, "GI_FUNCTION_IS_METHOD", "is-method" }, { GI_FUNCTION_IS_CONSTRUCTOR, "GI_FUNCTION_IS_CONSTRUCTOR", "is-constructor" }, { GI_FUNCTION_IS_GETTER, "GI_FUNCTION_IS_GETTER", "is-getter" }, { GI_FUNCTION_IS_SETTER, "GI_FUNCTION_IS_SETTER", "is-setter" }, { GI_FUNCTION_WRAPS_VFUNC, "GI_FUNCTION_WRAPS_VFUNC", "wraps-vfunc" }, { GI_FUNCTION_THROWS, "GI_FUNCTION_THROWS", "throws" }, { 0, NULL, NULL } }; etype = g_flags_register_static ("GIFunctionInfoFlags", values); } return etype; } /* Generated data ends here */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-boxed-info.c������������0000644�0001750�0001750�00000003103�12121311640�027420� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIBoxedInfo #define SELF(self) (RVAL2GI_BOXED_INFO(self)) GType gi_boxed_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIBoxedInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } void rb_gi_boxed_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_BOXED_INFO, "BoxedInfo", rb_mGI, rb_cGIRegisteredTypeInfo); (void)RG_TARGET_NAMESPACE; /* suppress a warning. */ } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-vfunc-info.c������������0000644�0001750�0001750�00000004553�12121311640�027452� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIVFuncInfo #define SELF(self) RVAL2GI_BASE_INFO(self) GType gi_vfunc_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIVFuncInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_flags(VALUE self) { GIVFuncInfo *info; info = SELF(self); return GI_VFUNC_INFO_FLAGS2RVAL(g_vfunc_info_get_flags(info)); } static VALUE rg_offset(VALUE self) { GIVFuncInfo *info; info = SELF(self); return INT2NUM(g_vfunc_info_get_offset(info)); } static VALUE rg_signal(VALUE self) { GIVFuncInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_vfunc_info_get_signal(info)); } static VALUE rg_invoker(VALUE self) { GIVFuncInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_vfunc_info_get_invoker(info)); } void rb_gi_vfunc_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_VFUNC_INFO, "VFuncInfo", rb_mGI, rb_cGICallableInfo); rb_define_const(RG_TARGET_NAMESPACE, "UNKNOWN_OFFSET", INT2NUM(0xFFFF)); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(offset, 0); RG_DEF_METHOD(signal, 0); RG_DEF_METHOD(invoker, 0); G_DEF_CLASS(G_TYPE_IV_FUNC_INFO_FLAGS, "VFuncInfoFlags", rb_mGI); } �����������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gobject-introspection.h����0000644�0001750�0001750�00000003441�12307003726�031327� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2014 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_GOBJECT_INTROSPECTION_H #define RB_GOBJECT_INTROSPECTION_H #include <ruby.h> #include <rbgobject.h> #include <girepository.h> typedef gpointer (*RBGICallbackFinderFunc)(GIArgInfo *info); typedef struct { GIArgInfo arg_info; GIScopeType scope_type; GIDirection direction; gboolean callback_p; gboolean closure_p; gboolean destroy_p; gboolean array_p; gboolean array_length_p; gint in_arg_index; gint closure_in_arg_index; gint destroy_in_arg_index; gint array_in_arg_index; gint array_length_in_arg_index; gint array_length_arg_index; gint rb_arg_index; gint out_arg_index; } RBGIArgMetadata; typedef struct { RBGIArgMetadata *metadata; VALUE rb_gc_guard_key; VALUE rb_callback; } RBGICallbackData; void rb_gi_callback_register_finder (RBGICallbackFinderFunc finder); void rb_gi_callback_data_free (RBGICallbackData *callback_data); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-signal-info.c�����������0000644�0001750�0001750�00000004121�12121311640�027575� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGISignalInfo #define SELF(self) RVAL2GI_BASE_INFO(self) GType gi_signal_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GISignalInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_flags(VALUE self) { GISignalInfo *info; info = SELF(self); return GI_SIGNAL_FLAGS2RVAL(g_signal_info_get_flags(info)); } static VALUE rg_class_closure(VALUE self) { GISignalInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_signal_info_get_class_closure(info)); } static VALUE rg_true_stops_emit_p(VALUE self) { GISignalInfo *info; info = SELF(self); return CBOOL2RVAL(g_signal_info_true_stops_emit(info)); } void rb_gi_signal_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_SIGNAL_INFO, "SignalInfo", rb_mGI, rb_cGICallableInfo); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(class_closure, 0); RG_DEF_METHOD_P(true_stops_emit, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-constant-info.c���������0000644�0001750�0001750�00000004234�12516434313�030171� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIConstantInfo #define SELF(self) (RVAL2GI_CONSTANT_INFO(self)) GType gi_constant_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIConstantInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_type(VALUE self) { GIConstantInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_constant_info_get_type(info)); } static VALUE rg_value(VALUE self) { GIConstantInfo *info; GIArgument value; gint value_size; GITypeInfo *type_info; VALUE rb_value; info = SELF(self); type_info = g_constant_info_get_type(info); value_size = g_constant_info_get_value(info, &value); rb_value = GI_ARGUMENT2RVAL(&value, type_info); g_base_info_unref(type_info); g_constant_info_free_value(info, &value); return rb_value; } void rb_gi_constant_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_CONSTANT_INFO, "ConstantInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(value, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-flags-info.c������������0000644�0001750�0001750�00000003005�12121311640�027414� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIFlagsInfo GType gi_flags_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIFlagsInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } void rb_gi_flags_info_init(VALUE rb_mGI, VALUE rb_cGIEnumInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_FLAGS_INFO, "FlagsInfo", rb_mGI, rb_cGIEnumInfo); /* Suppress a warning. */ (void)RG_TARGET_NAMESPACE; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-property-info.c���������0000644�0001750�0001750�00000004120�12121311640�030203� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIPropertyInfo #define SELF(self) RVAL2GI_BASE_INFO(self) GType gi_property_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIPropertyInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_flags(VALUE self) { GIPropertyInfo *info; info = SELF(self); return INT2NUM(g_property_info_get_flags(info)); } static VALUE rg_type(VALUE self) { GIPropertyInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_property_info_get_type(info)); } static VALUE rg_ownership_transfer(VALUE self) { GIPropertyInfo *info; info = SELF(self); return GI_TRANSFER2RVAL(g_property_info_get_ownership_transfer(info)); } void rb_gi_property_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_PROPERTY_INFO, "PropertyInfo", rb_mGI, rb_cGICallableInfo); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(ownership_transfer, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-value-info.c������������0000644�0001750�0001750�00000003234�12121311640�027440� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIValueInfo #define SELF(self) (RVAL2GI_VALUE_INFO(self)) GType gi_value_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIValueInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_value(VALUE self) { GIValueInfo *info; info = SELF(self); return LONG2NUM(g_value_info_get_value(info)); } void rb_gi_value_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_VALUE_INFO, "ValueInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD(value, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rbgiversion.h�����������������0000644�0001750�0001750�00000001231�12446173031�026740� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /************************************************ rbgiversion.h - This file was generated by mkmf-gnome2.rb. ************************************************/ #ifndef __RBGI_VERSION_H__ #define __RBGI_VERSION_H__ #define GI_MAJOR_VERSION (1) #define GI_MINOR_VERSION (42) #define GI_MICRO_VERSION (0) #define GI_CHECK_VERSION(major,minor,micro) \ (GI_MAJOR_VERSION > (major) || \ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION > (minor)) || \ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION == (minor) && \ GI_MICRO_VERSION >= (micro))) #endif /* __RBGI_VERSION_H__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-enum-info.c�������������0000644�0001750�0001750�00000007206�12307003726�027304� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2014 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIEnumInfo #define SELF(self) (RVAL2GI_ENUM_INFO(self)) GType gi_enum_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIEnumInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_n_values(VALUE self) { GIEnumInfo *info; info = SELF(self); return INT2NUM(g_enum_info_get_n_values(info)); } static VALUE rg_get_value(VALUE self, VALUE rb_n) { GIEnumInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_enum_info_get_value(info, n)); } static VALUE rg_values(VALUE self) { GIEnumInfo *info; gint i, n; VALUE rb_values; info = SELF(self); rb_values = rb_ary_new(); n = g_enum_info_get_n_values(info); for (i = 0; i < n; i++) { GIValueInfo *value_info; value_info = g_enum_info_get_value(info, i); rb_ary_push(rb_values, GI_BASE_INFO2RVAL_WITH_UNREF(value_info)); } return rb_values; } static VALUE rg_n_methods(VALUE self) { GIEnumInfo *info; info = SELF(self); return INT2NUM(g_enum_info_get_n_methods(info)); } static VALUE rg_get_method(VALUE self, VALUE rb_n) { GIEnumInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_enum_info_get_method(info, n)); } static VALUE rg_methods(VALUE self) { GIEnumInfo *info; gint i, n; VALUE rb_methods; info = SELF(self); rb_methods = rb_ary_new(); n = g_enum_info_get_n_methods(info); for (i = 0; i < n; i++) { GIFunctionInfo *function_info; function_info = g_enum_info_get_method(info, i); rb_ary_push(rb_methods, GI_BASE_INFO2RVAL_WITH_UNREF(function_info)); } return rb_methods; } static VALUE rg_storage_type(VALUE self) { GIEnumInfo *info; info = SELF(self); return GI_TYPE_TAG2RVAL(g_enum_info_get_storage_type(info)); } static VALUE rg_error_domain(VALUE self) { GIEnumInfo *info; info = SELF(self); return CSTR2RVAL(g_enum_info_get_error_domain(info)); } void rb_gi_enum_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_ENUM_INFO, "EnumInfo", rb_mGI, rb_cGIRegisteredTypeInfo); RG_DEF_METHOD(n_values, 0); RG_DEF_METHOD(get_value, 1); RG_DEF_METHOD(values, 0); RG_DEF_METHOD(n_methods, 0); RG_DEF_METHOD(get_method, 1); RG_DEF_METHOD(methods, 0); RG_DEF_METHOD(storage_type, 0); RG_DEF_METHOD(error_domain, 0); rb_gi_flags_info_init(rb_mGI, RG_TARGET_NAMESPACE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-loader.c����������������0000644�0001750�0001750�00000014654�12516434313�026664� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2014 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGILoader static const gchar *boxed_class_converters_name = "@@boxed_class_converters"; static VALUE rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass) { VALUE rb_class; VALUE rb_gtype, rb_name, rb_module; VALUE rb_options, rb_parent, rb_size; GType gtype; rb_scan_args(argc, argv, "31", &rb_gtype, &rb_name, &rb_module, &rb_options); rbg_scan_options(rb_options, "parent", &rb_parent, "size", &rb_size, NULL); gtype = NUM2ULONG(rb_to_int(rb_gtype)); rb_class = G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name), rb_module, rb_parent); if (!NIL_P(rb_size)) { rb_iv_set(rb_class, "@size", rb_size); } return rb_class; } static VALUE rg_s_define_interface(G_GNUC_UNUSED VALUE klass, VALUE rb_gtype, VALUE rb_name, VALUE rb_module) { GType gtype; gtype = NUM2ULONG(rb_to_int(rb_gtype)); return G_DEF_INTERFACE(gtype, RVAL2CSTR(rb_name), rb_module); } static VALUE struct_alloc(VALUE klass) { VALUE rb_size; size_t size; gpointer instance; rb_size = rb_iv_get(klass, "@size"); size = NUM2ULONG(rb_size); instance = xmalloc(size); memset(instance, 0, size); return Data_Wrap_Struct(klass, NULL, xfree, instance); } static VALUE rg_s_define_struct(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass) { VALUE rb_size, rb_name, rb_module; VALUE rb_options, rb_parent; VALUE rb_class; rb_scan_args(argc, argv, "31", &rb_size, &rb_name, &rb_module, &rb_options); rbg_scan_options(rb_options, "parent", &rb_parent, NULL); rb_size = rb_to_int(rb_size); if (NIL_P(rb_parent)) { rb_parent = rb_cObject; } rb_class = rb_define_class_under(rb_module, RVAL2CSTR(rb_name), rb_parent); rb_iv_set(rb_class, "@size", rb_size); rb_define_alloc_func(rb_class, struct_alloc); return rb_class; } static VALUE rg_s_define_error(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass) { VALUE rb_domain, rb_name, rb_module; VALUE rb_options, rb_parent, rb_gtype; GQuark domain; const gchar *name; GType gtype = G_TYPE_INVALID; rb_scan_args(argc, argv, "31", &rb_domain, &rb_name, &rb_module, &rb_options); rbg_scan_options(rb_options, "parent", &rb_parent, "gtype", &rb_gtype, NULL); if (RB_TYPE_P(rb_domain, RUBY_T_STRING)) { domain = g_quark_from_string(RVAL2CSTR(rb_domain)); if (domain == 0) { rb_raise(rb_eArgError, "invalid domain name: <%s>", rbg_inspect(rb_domain)); } } else { domain = NUM2UINT(rb_domain); } name = RVAL2CSTR(rb_name); if (NIL_P(rb_parent)) { rb_parent = rb_eStandardError; } if (!NIL_P(rb_gtype)) { gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0)); } return G_DEF_ERROR(domain, name, rb_module, rb_parent, gtype); } typedef struct { GType type; VALUE rb_converters; VALUE rb_converter; } BoxedInstance2RObjData; static void boxed_class_converter_free(gpointer user_data) { BoxedInstance2RObjData *data = user_data; rb_ary_delete(data->rb_converters, data->rb_converter); g_free(data); } static VALUE boxed_instance2robj(gpointer instance, gpointer user_data) { BoxedInstance2RObjData *data = user_data; VALUE default_rb_instance; VALUE klass; gint flags = 0; ID id_call; default_rb_instance = rbgobj_make_boxed_default(instance, data->type); CONST_ID(id_call, "call"); klass = rb_funcall(data->rb_converter, id_call, 1, default_rb_instance); return rbgobj_make_boxed_raw(instance, data->type, klass, flags); } static VALUE rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype) { RGConvertTable table; BoxedInstance2RObjData *data; ID id_to_i; VALUE boxed_class_converters; memset(&table, 0, sizeof(RGConvertTable)); CONST_ID(id_to_i, "to_i"); table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0)); table.klass = Qnil; table.instance2robj = boxed_instance2robj; data = g_new(BoxedInstance2RObjData, 1); data->type = table.type; data->rb_converter = rb_block_proc(); boxed_class_converters = rb_cv_get(klass, boxed_class_converters_name); rb_ary_push(boxed_class_converters, data->rb_converter); table.user_data = data; table.notify = boxed_class_converter_free; rbgobj_convert_define(&table); return Qnil; } static VALUE rg_s_register_constant_rename_map(G_GNUC_UNUSED VALUE klass, VALUE rb_original, VALUE rb_renamed) { G_RENAME_CONSTANT(RVAL2CSTR(rb_original), RVAL2CSTR(rb_renamed)); return Qnil; } static VALUE rg_s_start_callback_dispatch_thread(G_GNUC_UNUSED VALUE klass) { rbgutil_start_callback_dispatch_thread(); return Qnil; } void rb_gi_loader_init(VALUE rb_mGI) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_class_under(rb_mGI, "Loader", rb_cObject); rb_cv_set(RG_TARGET_NAMESPACE, boxed_class_converters_name, rb_ary_new()); RG_DEF_SMETHOD(define_class, -1); RG_DEF_SMETHOD(define_interface, 3); RG_DEF_SMETHOD(define_struct, -1); RG_DEF_SMETHOD(define_error, -1); RG_DEF_SMETHOD(register_boxed_class_converter, 1); RG_DEF_SMETHOD(register_constant_rename_map, 2); RG_DEF_SMETHOD(start_callback_dispatch_thread, 0); } ������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-interface-info.c��������0000644�0001750�0001750�00000012652�12121311640�030270� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIInterfaceInfo #define SELF(self) (RVAL2GI_INTERFACE_INFO(self)) GType gi_interface_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIInterfaceInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_n_prerequisites(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return INT2NUM(g_interface_info_get_n_prerequisites(info)); } static VALUE rg_get_prerequisite(VALUE self, VALUE rb_n) { GIInterfaceInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_interface_info_get_prerequisite(info, n)); } static VALUE rg_n_properties(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return INT2NUM(g_interface_info_get_n_properties(info)); } static VALUE rg_get_property(VALUE self, VALUE rb_n) { GIInterfaceInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_interface_info_get_property(info, n)); } static VALUE rg_n_methods(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return INT2NUM(g_interface_info_get_n_methods(info)); } static VALUE rg_get_method(VALUE self, VALUE rb_n_or_name) { GIInterfaceInfo *info; GIFunctionInfo *function_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); function_info = g_interface_info_get_method(info, n); } else { const char *name; name = RVAL2CSTR(rb_n_or_name); function_info = g_interface_info_find_method(info, name); } return GI_BASE_INFO2RVAL_WITH_UNREF(function_info); } static VALUE rg_n_signals(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return INT2NUM(g_interface_info_get_n_signals(info)); } static VALUE rg_get_signal(VALUE self, VALUE rb_n_or_name) { GIInterfaceInfo *info; GISignalInfo *signal_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); signal_info = g_interface_info_get_signal(info, n); } else { #ifdef HAVE_G_INTERFACE_INFO_FIND_SIGNAL const char *name; name = RVAL2CSTR(rb_n_or_name); signal_info = g_interface_info_find_signal(info, name); #else rb_raise(rb_eArgError, "g_interface_info_find_signal() is defined " "since GObjectIntrospection 1.34"); #endif } return GI_BASE_INFO2RVAL_WITH_UNREF(signal_info); } static VALUE rg_n_vfuncs(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return INT2NUM(g_interface_info_get_n_vfuncs(info)); } static VALUE rg_get_vfunc(VALUE self, VALUE rb_n_or_name) { GIInterfaceInfo *info; GIVFuncInfo *vfunc_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); vfunc_info = g_interface_info_get_vfunc(info, n); } else { const gchar *name; name = RVAL2CSTR(rb_n_or_name); vfunc_info = g_interface_info_find_vfunc(info, name); } return GI_BASE_INFO2RVAL_WITH_UNREF(vfunc_info); } static VALUE rg_n_constants(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return INT2NUM(g_interface_info_get_n_constants(info)); } static VALUE rg_get_constant(VALUE self, VALUE rb_n) { GIInterfaceInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_interface_info_get_constant(info, n)); } static VALUE rg_iface_struct(VALUE self) { GIInterfaceInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_interface_info_get_iface_struct(info)); } void rb_gi_interface_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_INTERFACE_INFO, "InterfaceInfo", rb_mGI, rb_cGIRegisteredTypeInfo); RG_DEF_METHOD(n_prerequisites, 0); RG_DEF_METHOD(get_prerequisite, 1); RG_DEF_METHOD(n_properties, 0); RG_DEF_METHOD(get_property, 1); RG_DEF_METHOD(n_methods, 0); RG_DEF_METHOD(get_method, 1); RG_DEF_METHOD(n_signals, 0); RG_DEF_METHOD(get_signal, 1); RG_DEF_METHOD(n_vfuncs, 0); RG_DEF_METHOD(get_vfunc, 1); RG_DEF_METHOD(n_constants, 0); RG_DEF_METHOD(get_constant, 1); RG_DEF_METHOD(iface_struct, 0); } ��������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-argument.c��������������0000644�0001750�0001750�00000202335�12516434313�027233� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2014 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 "rb-gi-private.h" static VALUE rb_cGLibValue = Qnil; static void array_c_to_ruby(GIArgument *array, GITypeInfo *type_info, gint64 n_elements, VALUE rb_array) { const gchar **elements; gboolean fixed_size_p; gboolean zero_terminated_p; elements = array->v_pointer; if (!elements) { return; } fixed_size_p = g_type_info_get_array_fixed_size(type_info); zero_terminated_p = g_type_info_is_zero_terminated(type_info); if (n_elements != -1) { gint64 i; for (i = 0; i < n_elements; i++) { rb_ary_push(rb_array, CSTR2RVAL(elements[i])); } } else if (zero_terminated_p) { for (; *elements; elements++) { rb_ary_push(rb_array, CSTR2RVAL(*elements)); } } else { rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[c] -> Ruby: " "zero-terminated: %s " "fixed-size: %s " "length: %" G_GINT64_FORMAT, zero_terminated_p ? "true" : "false", fixed_size_p ? "true" : "false", n_elements); } } static gint64 get_array_length(GIArgument *argument, GITypeInfo *type_info) { GITypeTag type_tag; gint64 length = -1; if (!argument) { return length; } type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: rb_raise(rb_eNotImpError, "TODO: invalid array length argument?: <%s>", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INT8: length = argument->v_int8; break; case GI_TYPE_TAG_UINT8: length = argument->v_uint8; break; case GI_TYPE_TAG_INT16: length = argument->v_int16; break; case GI_TYPE_TAG_UINT16: length = argument->v_uint16; break; case GI_TYPE_TAG_INT32: length = argument->v_int32; break; case GI_TYPE_TAG_UINT32: length = argument->v_uint32; break; case GI_TYPE_TAG_INT64: length = argument->v_int64; break; case GI_TYPE_TAG_UINT64: length = argument->v_uint64; break; case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: invalid array length argument?: <%s>", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } return length; } VALUE rb_gi_array_argument_to_ruby(GIArgument *array_argument, GIArgument *length_argument, GITypeInfo *array_type_info, GITypeInfo *length_type_info) { VALUE rb_array; GIArrayType array_type; gint n_elements; array_type = g_type_info_get_array_type(array_type_info); n_elements = get_array_length(length_argument, length_type_info); if (n_elements == -1) { rb_array = rb_ary_new(); } else { rb_array = rb_ary_new2(n_elements); } switch (array_type) { case GI_ARRAY_TYPE_C: array_c_to_ruby(array_argument, array_type_info, n_elements, rb_array); break; case GI_ARRAY_TYPE_ARRAY: rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[array] -> Ruby"); break; case GI_ARRAY_TYPE_PTR_ARRAY: rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[ptr-array] -> Ruby"); break; case GI_ARRAY_TYPE_BYTE_ARRAY: rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[byte-array] -> Ruby"); break; default: g_assert_not_reached(); break; } return rb_array; } static VALUE interface_to_ruby(GIArgument *argument, GITypeInfo *type_info) { VALUE rb_interface; GIBaseInfo *interface_info; GIInfoType interface_type; GType gtype; interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); gtype = g_registered_type_info_get_g_type(interface_info); switch (interface_type) { case GI_INFO_TYPE_INVALID: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[invalid] -> Ruby"); break; case GI_INFO_TYPE_FUNCTION: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[function] -> Ruby"); break; case GI_INFO_TYPE_CALLBACK: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[callback] -> Ruby"); break; case GI_INFO_TYPE_STRUCT: if (gtype == G_TYPE_BYTES) { GBytes *bytes = argument->v_pointer; gconstpointer data; gsize size; data = g_bytes_get_data(bytes, &size); rb_interface = rb_enc_str_new(data, size, rb_ascii8bit_encoding()); } else { rb_interface = BOXED2RVAL(argument->v_pointer, gtype); } break; case GI_INFO_TYPE_BOXED: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[boxed] -> Ruby"); break; case GI_INFO_TYPE_ENUM: if (gtype == G_TYPE_NONE) { rb_interface = INT2NUM(argument->v_int32); } else { rb_interface = GENUM2RVAL(argument->v_int32, gtype); } break; case GI_INFO_TYPE_FLAGS: if (gtype == G_TYPE_NONE) { rb_interface = INT2NUM(argument->v_int32); } else { rb_interface = GFLAGS2RVAL(argument->v_int32, gtype); } break; case GI_INFO_TYPE_OBJECT: rb_interface = GOBJ2RVAL(argument->v_pointer); break; case GI_INFO_TYPE_INTERFACE: rb_interface = GOBJ2RVAL(argument->v_pointer); break; case GI_INFO_TYPE_CONSTANT: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[constant] -> Ruby"); break; case GI_INFO_TYPE_INVALID_0: g_assert_not_reached(); break; case GI_INFO_TYPE_UNION: rb_interface = BOXED2RVAL(argument->v_pointer, gtype); break; case GI_INFO_TYPE_VALUE: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[value] -> Ruby"); break; case GI_INFO_TYPE_SIGNAL: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[signal] -> Ruby"); break; case GI_INFO_TYPE_VFUNC: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[vfunc] -> Ruby"); break; case GI_INFO_TYPE_PROPERTY: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[property] -> Ruby"); break; case GI_INFO_TYPE_FIELD: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[field] -> Ruby"); break; case GI_INFO_TYPE_ARG: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[arg] -> Ruby"); break; case GI_INFO_TYPE_TYPE: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[type] -> Ruby"); break; case GI_INFO_TYPE_UNRESOLVED: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[unresolved] -> Ruby"); break; default: g_assert_not_reached(); break; } g_base_info_unref(interface_info); return rb_interface; } static VALUE rb_gi_argument_to_ruby_glist(GIArgument *argument, GITypeInfo *type_info) { VALUE rb_argument; GITypeInfo *element_type_info; GITypeTag element_type_tag; element_type_info = g_type_info_get_param_type(type_info, 0); element_type_tag = g_type_info_get_tag(element_type_info); g_base_info_unref(element_type_info); switch (element_type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: rb_raise(rb_eNotImpError, "TODO: GIArgument(GList)[%s] -> Ruby", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_UTF8: rb_argument = CSTRGLIST2RVAL(argument->v_pointer); break; case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: rb_raise(rb_eNotImpError, "TODO: GIArgument(GList)[%s] -> Ruby", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_INTERFACE: GOBJGLIST2RVAL(argument->v_pointer); break; case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: GIArgument(GList)[%s] -> Ruby", g_type_tag_to_string(element_type_tag)); break; default: g_assert_not_reached(); break; } return rb_argument; } VALUE rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info) { VALUE rb_argument = Qnil; GITypeTag type_tag; type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: if (g_type_info_is_pointer(type_info)) { rb_argument = ULONG2NUM(GPOINTER_TO_UINT(argument->v_pointer)); } else { rb_argument = Qnil; } break; case GI_TYPE_TAG_BOOLEAN: rb_argument = CBOOL2RVAL(argument->v_boolean); break; case GI_TYPE_TAG_INT8: rb_argument = INT2NUM(argument->v_int8); break; case GI_TYPE_TAG_UINT8: rb_argument = UINT2NUM(argument->v_uint8); break; case GI_TYPE_TAG_INT16: rb_argument = INT2NUM(argument->v_int16); break; case GI_TYPE_TAG_UINT16: rb_argument = UINT2NUM(argument->v_uint16); break; case GI_TYPE_TAG_INT32: rb_argument = INT2NUM(argument->v_int32); break; case GI_TYPE_TAG_UINT32: rb_argument = UINT2NUM(argument->v_uint32); break; case GI_TYPE_TAG_INT64: rb_argument = LONG2NUM(argument->v_int64); break; case GI_TYPE_TAG_UINT64: rb_argument = ULONG2NUM(argument->v_uint64); break; case GI_TYPE_TAG_FLOAT: rb_argument = DBL2NUM(argument->v_float); break; case GI_TYPE_TAG_DOUBLE: rb_argument = DBL2NUM(argument->v_double); break; case GI_TYPE_TAG_GTYPE: rb_argument = rbgobj_gtype_new(argument->v_size); break; case GI_TYPE_TAG_UTF8: rb_argument = CSTR2RVAL(argument->v_string); break; case GI_TYPE_TAG_FILENAME: /* TODO: set encoding */ rb_argument = CSTR2RVAL(argument->v_string); break; case GI_TYPE_TAG_ARRAY: rb_argument = rb_gi_array_argument_to_ruby(argument, NULL, type_info, NULL); break; case GI_TYPE_TAG_INTERFACE: rb_argument = interface_to_ruby(argument, type_info); break; case GI_TYPE_TAG_GLIST: rb_argument = rb_gi_argument_to_ruby_glist(argument, type_info); break; case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: rb_raise(rb_eNotImpError, "TODO: GIArgument(%s) -> Ruby", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_ERROR: rb_argument = GERROR2RVAL(argument->v_pointer); break; case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: GIArgument(%s) -> Ruby", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } return rb_argument; } static void rb_gi_out_argument_init_interface(GIArgument *argument, GIArgInfo *arg_info, GITypeInfo *type_info) { GIBaseInfo *interface_info; GIInfoType interface_type; if (!g_arg_info_is_caller_allocates(arg_info)) { argument->v_pointer = ALLOC(gpointer); return; } interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); switch (interface_type) { case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_CALLBACK: rb_raise(rb_eNotImpError, "TODO: allocates GIArgument(interface)[%s] for output", g_info_type_to_string(interface_type)); break; case GI_INFO_TYPE_STRUCT: { gsize struct_size; struct_size = g_struct_info_get_size(interface_info); argument->v_pointer = xmalloc(struct_size); memset(argument->v_pointer, 0, struct_size); } break; case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_FLAGS: case GI_INFO_TYPE_OBJECT: case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_CONSTANT: case GI_INFO_TYPE_INVALID_0: case GI_INFO_TYPE_UNION: case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_UNRESOLVED: rb_raise(rb_eNotImpError, "TODO: allocates GIArgument(interface)[%s] for output", g_info_type_to_string(interface_type)); break; default: g_assert_not_reached(); break; } g_base_info_unref(interface_info); } void rb_gi_out_argument_init(GIArgument *argument, GIArgInfo *arg_info) { GITypeInfo type_info; GITypeTag type_tag; memset(argument, 0, sizeof(GIArgument)); g_arg_info_load_type(arg_info, &type_info); type_tag = g_type_info_get_tag(&type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: break; case GI_TYPE_TAG_BOOLEAN: argument->v_pointer = ALLOC(gboolean); break; case GI_TYPE_TAG_INT8: argument->v_pointer = ALLOC(gint8); break; case GI_TYPE_TAG_UINT8: argument->v_pointer = ALLOC(guint8); break; case GI_TYPE_TAG_INT16: argument->v_pointer = ALLOC(gint16); break; case GI_TYPE_TAG_UINT16: argument->v_pointer = ALLOC(guint16); break; case GI_TYPE_TAG_INT32: argument->v_pointer = ALLOC(gint32); break; case GI_TYPE_TAG_UINT32: argument->v_pointer = ALLOC(guint32); break; case GI_TYPE_TAG_INT64: argument->v_pointer = ALLOC(gint64); break; case GI_TYPE_TAG_UINT64: argument->v_pointer = ALLOC(guint64); break; case GI_TYPE_TAG_FLOAT: argument->v_pointer = ALLOC(gfloat); break; case GI_TYPE_TAG_DOUBLE: argument->v_pointer = ALLOC(gdouble); break; case GI_TYPE_TAG_GTYPE: argument->v_pointer = ALLOC(GType); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: argument->v_pointer = ALLOC(gchar *); break; case GI_TYPE_TAG_ARRAY: argument->v_pointer = ALLOC(gpointer); break; case GI_TYPE_TAG_INTERFACE: rb_gi_out_argument_init_interface(argument, arg_info, &type_info); break; case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: argument->v_pointer = ALLOC(gpointer); break; case GI_TYPE_TAG_ERROR: argument->v_pointer = ALLOC(GError *); memset(argument->v_pointer, 0, sizeof(GError *)); break; case GI_TYPE_TAG_UNICHAR: argument->v_pointer = ALLOC(gunichar); break; default: g_assert_not_reached(); break; } } VALUE rb_gi_out_argument_to_ruby(GIArgument *argument, GIArgInfo *arg_info) { GIArgument normalized_argument; GITypeInfo type_info; GITypeTag type_tag; memset(&normalized_argument, 0, sizeof(GIArgument)); g_arg_info_load_type(arg_info, &type_info); type_tag = g_type_info_get_tag(&type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: break; case GI_TYPE_TAG_BOOLEAN: normalized_argument.v_boolean = *((gboolean *)(argument->v_pointer)); break; case GI_TYPE_TAG_INT8: normalized_argument.v_int8 = *((gint8 *)(argument->v_pointer)); break; case GI_TYPE_TAG_UINT8: normalized_argument.v_uint8 = *((guint8 *)(argument->v_pointer)); break; case GI_TYPE_TAG_INT16: normalized_argument.v_int16 = *((gint16 *)(argument->v_pointer)); break; case GI_TYPE_TAG_UINT16: normalized_argument.v_uint16 = *((guint16 *)(argument->v_pointer)); break; case GI_TYPE_TAG_INT32: normalized_argument.v_int32 = *((gint32 *)(argument->v_pointer)); break; case GI_TYPE_TAG_UINT32: normalized_argument.v_uint32 = *((guint32 *)(argument->v_pointer)); break; case GI_TYPE_TAG_INT64: normalized_argument.v_int64 = *((gint64 *)(argument->v_pointer)); break; case GI_TYPE_TAG_UINT64: normalized_argument.v_uint64 = *((guint64 *)(argument->v_pointer)); break; case GI_TYPE_TAG_FLOAT: normalized_argument.v_float = *((gfloat *)(argument->v_pointer)); break; case GI_TYPE_TAG_DOUBLE: normalized_argument.v_double = *((gdouble *)(argument->v_pointer)); break; case GI_TYPE_TAG_GTYPE: normalized_argument.v_size = *((GType *)(argument->v_pointer)); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: normalized_argument.v_string = *((gchar **)(argument->v_pointer)); break; case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: if (g_arg_info_is_caller_allocates(arg_info)) { normalized_argument.v_pointer = argument->v_pointer; } else { normalized_argument.v_pointer = *((gpointer *)(argument->v_pointer)); } break; case GI_TYPE_TAG_ERROR: normalized_argument.v_pointer = *((GError **)(argument->v_pointer)); break; case GI_TYPE_TAG_UNICHAR: normalized_argument.v_uint32 = *((guint32 *)(argument->v_pointer)); break; default: g_assert_not_reached(); break; } return rb_gi_argument_to_ruby(&normalized_argument, &type_info); } static void normalize_out_array_length(GIArgument *normalized_argument, GIArgument *argument, GITypeInfo *type_info) { GITypeTag type_tag; type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: rb_raise(rb_eNotImpError, "TODO: invalid out array length argument?: <%s>", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INT8: normalized_argument->v_int8 = *((gint8 *)argument->v_pointer); break; case GI_TYPE_TAG_UINT8: normalized_argument->v_uint8 = *((guint8 *)argument->v_pointer); break; case GI_TYPE_TAG_INT16: normalized_argument->v_int16 = *((gint16 *)argument->v_pointer); break; case GI_TYPE_TAG_UINT16: normalized_argument->v_uint16 = *((guint16 *)argument->v_pointer); break; case GI_TYPE_TAG_INT32: normalized_argument->v_int32 = *((gint32 *)argument->v_pointer); break; case GI_TYPE_TAG_UINT32: normalized_argument->v_uint32 = *((guint32 *)argument->v_pointer); break; case GI_TYPE_TAG_INT64: normalized_argument->v_int64 = *((gint64 *)argument->v_pointer); break; case GI_TYPE_TAG_UINT64: normalized_argument->v_uint64 = *((guint64 *)argument->v_pointer); break; case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: invalid out array length argument?: <%s>", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } } VALUE rb_gi_out_array_argument_to_ruby(GIArgument *array_argument, GIArgument *length_argument, GIArgInfo *array_arg_info, GIArgInfo *length_arg_info) { VALUE rb_array; GIArgument normalized_array_argument; GITypeInfo array_type_info; normalized_array_argument.v_pointer = *((gpointer *)(array_argument->v_pointer)); g_arg_info_load_type(array_arg_info, &array_type_info); if (length_argument) { GITypeInfo length_type_info; GIArgument normalized_length_argument; g_arg_info_load_type(length_arg_info, &length_type_info); normalize_out_array_length(&normalized_length_argument, length_argument, &length_type_info); rb_array = rb_gi_array_argument_to_ruby(&normalized_array_argument, &normalized_length_argument, &array_type_info, &length_type_info); } else { rb_array = rb_gi_array_argument_to_ruby(&normalized_array_argument, NULL, &array_type_info, NULL); } return rb_array; } void rb_gi_out_argument_fin(GIArgument *argument, GIArgInfo *arg_info) { GITypeInfo type_info; if (g_arg_info_get_direction(arg_info) != GI_DIRECTION_OUT) { return; } g_arg_info_load_type(arg_info, &type_info); xfree(argument->v_pointer); } static void rb_gi_return_argument_free_container(G_GNUC_UNUSED GIArgument *argument, GITypeInfo *type_info) { GITypeTag type_tag; type_tag = g_type_info_get_tag(type_info); rb_raise(rb_eNotImpError, "TODO: free GIArgument(%s) as container", g_type_tag_to_string(type_tag)); } static void rb_gi_return_argument_free_everything_array(GIArgument *argument, GITypeInfo *type_info) { switch (g_type_info_get_array_type(type_info)) { case GI_ARRAY_TYPE_C: g_strfreev(argument->v_pointer); break; case GI_ARRAY_TYPE_ARRAY: g_array_free(argument->v_pointer, TRUE); break; case GI_ARRAY_TYPE_PTR_ARRAY: g_ptr_array_free(argument->v_pointer, TRUE); break; case GI_ARRAY_TYPE_BYTE_ARRAY: g_ptr_array_free(argument->v_pointer, TRUE); break; default: g_assert_not_reached(); break; } } static void rb_gi_return_argument_free_everything_interface_struct(GIArgument *argument, GType gtype) { if (!argument->v_pointer) { return; } if (!gtype) { xfree(argument->v_pointer); } if (G_TYPE_IS_BOXED(gtype)) { g_boxed_free(gtype, argument->v_pointer); } else { rbgobj_instance_unref(argument->v_pointer); } } static void rb_gi_return_argument_free_everything_interface(GIArgument *argument, GITypeInfo *type_info) { GIBaseInfo *interface_info; GIInfoType interface_type; GType gtype; interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); gtype = g_registered_type_info_get_g_type(interface_info); g_base_info_unref(interface_info); switch (interface_type) { case GI_INFO_TYPE_INVALID: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[invalid] everything"); break; case GI_INFO_TYPE_FUNCTION: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[function] everything"); break; case GI_INFO_TYPE_CALLBACK: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[callback] everything"); break; case GI_INFO_TYPE_STRUCT: rb_gi_return_argument_free_everything_interface_struct(argument, gtype); break; case GI_INFO_TYPE_BOXED: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[boxed] everything"); break; case GI_INFO_TYPE_ENUM: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[enum] everything"); break; case GI_INFO_TYPE_FLAGS: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[flags] everything"); break; case GI_INFO_TYPE_OBJECT: if (argument->v_pointer) { g_object_unref(argument->v_pointer); } break; case GI_INFO_TYPE_INTERFACE: if (argument->v_pointer) { g_object_unref(argument->v_pointer); } break; case GI_INFO_TYPE_CONSTANT: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[constant] everything"); break; case GI_INFO_TYPE_INVALID_0: g_assert_not_reached(); break; case GI_INFO_TYPE_UNION: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[union] everything"); break; case GI_INFO_TYPE_VALUE: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[value] everything"); break; case GI_INFO_TYPE_SIGNAL: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[signal] everything"); break; case GI_INFO_TYPE_VFUNC: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[vfunc] everything"); break; case GI_INFO_TYPE_PROPERTY: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[property] everything"); break; case GI_INFO_TYPE_FIELD: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[field] everything"); break; case GI_INFO_TYPE_ARG: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[arg] everything"); break; case GI_INFO_TYPE_TYPE: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[type] everything"); break; case GI_INFO_TYPE_UNRESOLVED: rb_raise(rb_eNotImpError, "TODO: free GIArgument(interface)[unresolved] everything"); break; default: g_assert_not_reached(); break; } } static void rb_gi_return_argument_free_everything_glist(GIArgument *argument, GITypeInfo *type_info) { GITypeInfo *element_type_info; GITypeTag element_type_tag; element_type_info = g_type_info_get_param_type(type_info, 0); element_type_tag = g_type_info_get_tag(element_type_info); g_base_info_unref(element_type_info); switch (element_type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: rb_raise(rb_eNotImpError, "TODO: free GIArgument(GList)[%s] everything", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_UTF8: g_list_foreach(argument->v_pointer, (GFunc)g_free, NULL); g_list_free(argument->v_pointer); break; case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: rb_raise(rb_eNotImpError, "TODO: free GIArgument(GList)[%s] everything", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_INTERFACE: g_list_foreach(argument->v_pointer, (GFunc)g_object_unref, NULL); g_list_free(argument->v_pointer); break; case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: free GIArgument(GList)[%s] everything", g_type_tag_to_string(element_type_tag)); break; default: g_assert_not_reached(); break; } } static void rb_gi_return_argument_free_everything(GIArgument *argument, GITypeInfo *type_info) { GITypeTag type_tag; type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: rb_raise(rb_eNotImpError, "TODO: free GIArgument(%s) everything", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_UTF8: g_free(argument->v_string); break; case GI_TYPE_TAG_FILENAME: rb_raise(rb_eNotImpError, "TODO: free GIArgument(%s) everything", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_ARRAY: rb_gi_return_argument_free_everything_array(argument, type_info); break; case GI_TYPE_TAG_INTERFACE: rb_gi_return_argument_free_everything_interface(argument, type_info); break; case GI_TYPE_TAG_GLIST: rb_gi_return_argument_free_everything_glist(argument, type_info); break; case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: free GIArgument(%s) everything", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } } VALUE rb_gi_return_argument_to_ruby(GIArgument *argument, GICallableInfo *callable_info) { VALUE rb_argument; gboolean may_return_null; GITypeInfo return_value_info; may_return_null = g_callable_info_may_return_null(callable_info); if (may_return_null && !argument->v_pointer) { return Qnil; } g_callable_info_load_return_type(callable_info, &return_value_info); rb_argument = rb_gi_argument_to_ruby(argument, &return_value_info); switch (g_callable_info_get_caller_owns(callable_info)) { case GI_TRANSFER_NOTHING: break; case GI_TRANSFER_CONTAINER: rb_gi_return_argument_free_container(argument, &return_value_info); break; case GI_TRANSFER_EVERYTHING: rb_gi_return_argument_free_everything(argument, &return_value_info); break; default: g_assert_not_reached(); break; } return rb_argument; } static void rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info, VALUE rb_argument) { GIBaseInfo *interface_info; GIInfoType interface_type; GType gtype; interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); gtype = g_registered_type_info_get_g_type(interface_info); switch (interface_type) { case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_CALLBACK: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(interface)[%s]: <%s>", g_info_type_to_string(interface_type), g_base_info_get_name(interface_info)); break; case GI_INFO_TYPE_STRUCT: if (gtype == G_TYPE_NONE) { argument->v_pointer = DATA_PTR(rb_argument); } else if (gtype == G_TYPE_VALUE) { GValue *gvalue; gvalue = ALLOC(GValue); memset(gvalue, 0, sizeof(GValue)); if (rb_obj_is_kind_of(rb_argument, rb_cGLibValue)) { GValue *source_gvalue; source_gvalue = RVAL2BOXED(rb_argument, G_TYPE_VALUE); g_value_init(gvalue, source_gvalue->g_type); g_value_copy(source_gvalue, gvalue); } else { rbgobj_initialize_gvalue(gvalue, rb_argument); } argument->v_pointer = gvalue; } else { argument->v_pointer = RVAL2BOXED(rb_argument, gtype); } break; case GI_INFO_TYPE_BOXED: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(interface)[%s]: <%s>", g_info_type_to_string(interface_type), g_base_info_get_name(interface_info)); break; case GI_INFO_TYPE_ENUM: if (gtype == G_TYPE_NONE) { argument->v_int32 = NUM2INT(rb_argument); } else { argument->v_int32 = RVAL2GENUM(rb_argument, gtype); } break; case GI_INFO_TYPE_FLAGS: if (gtype == G_TYPE_NONE) { argument->v_int32 = NUM2INT(rb_argument); } else { argument->v_int32 = RVAL2GFLAGS(rb_argument, gtype); } break; case GI_INFO_TYPE_OBJECT: case GI_INFO_TYPE_INTERFACE: argument->v_pointer = RVAL2GOBJ(rb_argument); break; case GI_INFO_TYPE_CONSTANT: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(interface)[%s]: <%s>", g_info_type_to_string(interface_type), g_base_info_get_name(interface_info)); break; case GI_INFO_TYPE_INVALID_0: g_assert_not_reached(); break; case GI_INFO_TYPE_UNION: case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_UNRESOLVED: default: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(interface)[%s]: <%s>", g_info_type_to_string(interface_type), g_base_info_get_name(interface_info)); break; } g_base_info_unref(interface_info); } static void rb_gi_value_argument_from_ruby_void(GIArgument *argument, GITypeInfo *type_info, VALUE rb_argument) { if (!g_type_info_is_pointer(type_info)) { return; } if (RB_TYPE_P(rb_argument, RUBY_T_STRING)) { argument->v_pointer = RSTRING_PTR(rb_argument); } else { argument->v_pointer = GUINT_TO_POINTER(NUM2ULONG(rb_argument)); } } GIArgument * rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info, VALUE rb_argument) { GITypeTag type_tag; memset(argument, 0, sizeof(GIArgument)); type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: rb_gi_value_argument_from_ruby_void(argument, type_info, rb_argument); break; case GI_TYPE_TAG_BOOLEAN: argument->v_boolean = RVAL2CBOOL(rb_argument); break; case GI_TYPE_TAG_INT8: argument->v_int8 = NUM2INT(rb_argument); break; case GI_TYPE_TAG_UINT8: argument->v_uint8 = NUM2UINT(rb_argument); break; case GI_TYPE_TAG_INT16: argument->v_int16 = NUM2INT(rb_argument); break; case GI_TYPE_TAG_UINT16: argument->v_uint16 = NUM2UINT(rb_argument); break; case GI_TYPE_TAG_INT32: argument->v_int32 = NUM2INT(rb_argument); break; case GI_TYPE_TAG_UINT32: argument->v_uint32 = NUM2UINT(rb_argument); break; case GI_TYPE_TAG_INT64: argument->v_int64 = NUM2LONG(rb_argument); break; case GI_TYPE_TAG_UINT64: argument->v_uint64 = NUM2ULONG(rb_argument); break; case GI_TYPE_TAG_FLOAT: argument->v_float = NUM2DBL(rb_argument); break; case GI_TYPE_TAG_DOUBLE: argument->v_double = NUM2DBL(rb_argument); break; case GI_TYPE_TAG_GTYPE: /* TODO: support GLib::Type and String as GType name. */ argument->v_size = NUM2ULONG(rb_argument); break; case GI_TYPE_TAG_UTF8: /* TODO: support UTF-8 convert like rb_argument.encode("UTF-8"). */ argument->v_string = (gchar *)RVAL2CSTR(rb_argument); break; case GI_TYPE_TAG_FILENAME: argument->v_string = (gchar *)RVAL2CSTR(rb_argument); break; case GI_TYPE_TAG_ARRAY: rb_raise(rb_eNotImpError, "should not be reached: Ruby -> GIArgument(%s)", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INTERFACE: rb_gi_argument_from_ruby_interface(argument, type_info, rb_argument); break; case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(%s)", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } return argument; } static void rb_gi_inout_argument_from_ruby(GIArgument *argument, G_GNUC_UNUSED GIArgInfo *arg_info, GITypeInfo *type_info, VALUE rb_argument) { GIArgument in_argument; GITypeTag type_tag; rb_gi_value_argument_from_ruby(&in_argument, type_info, rb_argument); type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: break; case GI_TYPE_TAG_BOOLEAN: argument->v_pointer = ALLOC(gboolean); *((gboolean *)argument->v_pointer) = in_argument.v_boolean; break; case GI_TYPE_TAG_INT8: argument->v_pointer = ALLOC(gint8); *((gint8 *)argument->v_pointer) = in_argument.v_int8; break; case GI_TYPE_TAG_UINT8: argument->v_pointer = ALLOC(guint8); *((guint8 *)argument->v_pointer) = in_argument.v_uint8; break; case GI_TYPE_TAG_INT16: argument->v_pointer = ALLOC(gint16); *((gint16 *)argument->v_pointer) = in_argument.v_int16; break; case GI_TYPE_TAG_UINT16: argument->v_pointer = ALLOC(guint16); *((guint16 *)argument->v_pointer) = in_argument.v_uint16; break; case GI_TYPE_TAG_INT32: argument->v_pointer = ALLOC(gint32); *((gint32 *)argument->v_pointer) = in_argument.v_int32; break; case GI_TYPE_TAG_UINT32: argument->v_pointer = ALLOC(guint32); *((guint32 *)argument->v_pointer) = in_argument.v_uint32; break; case GI_TYPE_TAG_INT64: argument->v_pointer = ALLOC(gint64); *((gint64 *)argument->v_pointer) = in_argument.v_int64; break; case GI_TYPE_TAG_UINT64: argument->v_pointer = ALLOC(guint64); *((guint64 *)argument->v_pointer) = in_argument.v_uint64; break; case GI_TYPE_TAG_FLOAT: argument->v_pointer = ALLOC(gfloat); *((gfloat *)argument->v_pointer) = in_argument.v_float; break; case GI_TYPE_TAG_DOUBLE: argument->v_pointer = ALLOC(gdouble); *((gdouble *)argument->v_pointer) = in_argument.v_double; break; case GI_TYPE_TAG_GTYPE: argument->v_pointer = ALLOC(gsize); *((gsize *)argument->v_pointer) = in_argument.v_size; break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: argument->v_pointer = ALLOC(gchar *); *((gchar **)argument->v_pointer) = in_argument.v_string; break; case GI_TYPE_TAG_ARRAY: rb_raise(rb_eNotImpError, "should not be reached: Ruby -> GIArgument(%s)", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: argument->v_pointer = ALLOC(gpointer); *((gpointer *)argument->v_pointer) = in_argument.v_pointer; break; case GI_TYPE_TAG_ERROR: argument->v_pointer = ALLOC(GError *); *((GError **)argument->v_pointer) = in_argument.v_pointer; break; case GI_TYPE_TAG_UNICHAR: argument->v_pointer = ALLOC(gunichar); *((gunichar *)argument->v_pointer) = in_argument.v_uint32; break; default: g_assert_not_reached(); break; } } static void rb_gi_in_argument_transfer_interface(GIArgument *argument, G_GNUC_UNUSED GITransfer transfer, GITypeInfo *type_info, G_GNUC_UNUSED VALUE rb_argument) { GIBaseInfo *interface_info; GIInfoType interface_type; G_GNUC_UNUSED GType gtype; interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); gtype = g_registered_type_info_get_g_type(interface_info); g_base_info_unref(interface_info); switch (interface_type) { case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_CALLBACK: rb_raise(rb_eNotImpError, "TODO: in transfer (interface) [%s]", g_info_type_to_string(interface_type)); break; case GI_INFO_TYPE_STRUCT: rbgobj_boxed_unown(rb_argument); break; case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_FLAGS: rb_raise(rb_eNotImpError, "TODO: in transfer (interface) [%s]", g_info_type_to_string(interface_type)); break; case GI_INFO_TYPE_OBJECT: g_object_ref(argument->v_pointer); break; case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_CONSTANT: rb_raise(rb_eNotImpError, "TODO: in transfer (interface) [%s]", g_info_type_to_string(interface_type)); break; case GI_INFO_TYPE_INVALID_0: g_assert_not_reached(); break; case GI_INFO_TYPE_UNION: case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_UNRESOLVED: rb_raise(rb_eNotImpError, "TODO: in transfer (interface) [%s]", g_info_type_to_string(interface_type)); break; default: g_assert_not_reached(); break; } } static void rb_gi_in_argument_transfer(GIArgument *argument, GITransfer transfer, GITypeInfo *type_info, VALUE rb_argument) { GITypeTag type_tag; if (transfer == GI_TRANSFER_NOTHING) { return; } type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: rb_raise(rb_eNotImpError, "TODO: in transfer (%s)", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INTERFACE: rb_gi_in_argument_transfer_interface(argument, transfer, type_info, rb_argument); break; case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: in transfer (%s)", g_type_tag_to_string(type_tag)); default: g_assert_not_reached(); break; } } GIArgument * rb_gi_in_argument_from_ruby(GIArgument *argument, GIArgInfo *arg_info, VALUE rb_argument) { GITypeInfo type_info; if (g_arg_info_may_be_null(arg_info) && NIL_P(rb_argument)) { memset(argument, 0, sizeof(GIArgument)); return argument; } g_arg_info_load_type(arg_info, &type_info); if (g_arg_info_get_direction(arg_info) == GI_DIRECTION_INOUT) { rb_gi_inout_argument_from_ruby(argument, arg_info, &type_info, rb_argument); } else { rb_gi_value_argument_from_ruby(argument, &type_info, rb_argument); rb_gi_in_argument_transfer(argument, g_arg_info_get_ownership_transfer(arg_info), &type_info, rb_argument); } return argument; } static void set_in_array_length_argument(GIArgument *argument, GITypeInfo *type_info, gint64 length) { GITypeTag type_tag; if (!argument) { return; } type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: rb_raise(rb_eNotImpError, "TODO: invalid argument?: length[%s]", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INT8: argument->v_int8 = length; break; case GI_TYPE_TAG_UINT8: argument->v_uint8 = length; break; case GI_TYPE_TAG_INT16: argument->v_int16 = length; break; case GI_TYPE_TAG_UINT16: argument->v_uint16 = length; break; case GI_TYPE_TAG_INT32: argument->v_int32 = length; break; case GI_TYPE_TAG_UINT32: argument->v_uint32 = length; break; case GI_TYPE_TAG_INT64: argument->v_int64 = length; break; case GI_TYPE_TAG_UINT64: argument->v_uint64 = length; break; case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: invalid argument?: length[%s]", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } } static void set_in_array_gtype_arguments_from_ruby(GIArgument *array_argument, VALUE rb_class_array) { GType *types; gint i, n_args; n_args = RARRAY_LEN(rb_class_array); types = ALLOC_N(GType, n_args); for (i = 0; i < n_args; i++) { types[i] = CLASS2GTYPE(RARRAY_PTR(rb_class_array)[i]); } array_argument->v_pointer = types; } static void in_array_c_argument_from_ruby(GIArgument *array_argument, GIArgument *length_argument, G_GNUC_UNUSED GITypeInfo *array_type_info, GITypeInfo *length_type_info, GITypeInfo *element_type_info, VALUE rb_argument) { GITypeTag element_type_tag; element_type_tag = g_type_info_get_tag(element_type_info); switch (element_type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(array)[%s]", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: array_argument->v_pointer = RSTRING_PTR(rb_argument); set_in_array_length_argument(length_argument, length_type_info, RSTRING_LEN(rb_argument)); break; case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(array)[%s]", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_GTYPE: set_in_array_gtype_arguments_from_ruby(array_argument, rb_argument); set_in_array_length_argument(length_argument, length_type_info, RARRAY_LEN(rb_argument)); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: array_argument->v_pointer = RVAL2STRV(rb_argument); set_in_array_length_argument(length_argument, length_type_info, RARRAY_LEN(rb_argument)); break; case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(array)[%s]", g_type_tag_to_string(element_type_tag)); break; default: g_assert_not_reached(); break; } } static void in_array_argument_from_ruby(GIArgument *array_argument, GIArgument *length_argument, GITypeInfo *array_type_info, GITypeInfo *length_type_info, VALUE rb_argument) { GIArrayType array_type; GITypeInfo *element_type_info; array_type = g_type_info_get_array_type(array_type_info); element_type_info = g_type_info_get_param_type(array_type_info, 0); switch (array_type) { case GI_ARRAY_TYPE_C: in_array_c_argument_from_ruby(array_argument, length_argument, array_type_info, length_type_info, element_type_info, rb_argument); break; case GI_ARRAY_TYPE_ARRAY: case GI_ARRAY_TYPE_PTR_ARRAY: case GI_ARRAY_TYPE_BYTE_ARRAY: rb_raise(rb_eNotImpError, "TODO: Ruby -> GIArgument(array)[%s]", g_type_tag_to_string(g_type_info_get_tag(element_type_info))); break; default: g_assert_not_reached(); break; } g_base_info_unref(element_type_info); } static void set_inout_array_length_argument(GIArgument *argument, GITypeInfo *type_info, GIArgument *length) { GITypeTag type_tag; if (!argument) { return; } type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: rb_raise(rb_eNotImpError, "TODO: invalid argument?: length[%s]", g_type_tag_to_string(type_tag)); break; case GI_TYPE_TAG_INT8: argument->v_pointer = ALLOC(gint8); *((gint8 *)argument->v_pointer) = length->v_int8; break; case GI_TYPE_TAG_UINT8: argument->v_pointer = ALLOC(guint8); *((guint8 *)argument->v_pointer) = length->v_uint8; break; case GI_TYPE_TAG_INT16: argument->v_pointer = ALLOC(gint16); *((gint16 *)argument->v_pointer) = length->v_int16; break; case GI_TYPE_TAG_UINT16: argument->v_pointer = ALLOC(guint16); *((guint16 *)argument->v_pointer) = length->v_uint16; break; case GI_TYPE_TAG_INT32: argument->v_pointer = ALLOC(gint32); *((gint32 *)argument->v_pointer) = length->v_int32; break; case GI_TYPE_TAG_UINT32: argument->v_pointer = ALLOC(guint32); *((guint32 *)argument->v_pointer) = length->v_uint32; break; case GI_TYPE_TAG_INT64: argument->v_pointer = ALLOC(gint64); *((gint64 *)argument->v_pointer) = length->v_int64; break; case GI_TYPE_TAG_UINT64: argument->v_pointer = ALLOC(guint64); *((guint64 *)argument->v_pointer) = length->v_uint64; break; case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: invalid argument?: length[%s]", g_type_tag_to_string(type_tag)); break; default: g_assert_not_reached(); break; } } static void inout_array_argument_from_ruby(GIArgument *array_argument, GIArgument *length_argument, GITypeInfo *array_type_info, GITypeInfo *length_type_info, VALUE rb_argument) { GIArgument in_array_argument; GIArgument in_length_argument; in_array_argument_from_ruby(&in_array_argument, &in_length_argument, array_type_info, length_type_info, rb_argument); array_argument->v_pointer = ALLOC(gpointer); *((gpointer *)array_argument->v_pointer) = in_array_argument.v_pointer; set_inout_array_length_argument(length_argument, length_type_info, &in_length_argument); } GIArgument * rb_gi_in_array_argument_from_ruby(GIArgument *array_argument, GIArgument *length_argument, GIArgInfo *array_arg_info, GIArgInfo *length_arg_info, VALUE rb_argument) { GITypeInfo array_type_info; GITypeInfo length_type_info; GITypeInfo *length_type_info_arg = NULL; if (g_arg_info_may_be_null(array_arg_info) && NIL_P(rb_argument)) { memset(array_argument, 0, sizeof(GIArgument)); if (length_argument) { memset(length_argument, 0, sizeof(GIArgument)); } return array_argument; } g_arg_info_load_type(array_arg_info, &array_type_info); if (length_arg_info) { g_arg_info_load_type(length_arg_info, &length_type_info); length_type_info_arg = &length_type_info; } if (g_arg_info_get_direction(array_arg_info) == GI_DIRECTION_INOUT) { inout_array_argument_from_ruby(array_argument, length_argument, &array_type_info, length_type_info_arg, rb_argument); } else { GITransfer transfer; in_array_argument_from_ruby(array_argument, length_argument, &array_type_info, length_type_info_arg, rb_argument); transfer = g_arg_info_get_ownership_transfer(array_arg_info); rb_gi_in_argument_transfer(array_argument, transfer, &array_type_info, rb_argument); } return array_argument; } static void rb_gi_value_argument_free_array_c(GIArgument *argument, G_GNUC_UNUSED GITypeInfo *type_info, GITypeInfo *element_type_info) { GITypeTag element_type_tag; element_type_tag = g_type_info_get_tag(element_type_info); switch (element_type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: rb_raise(rb_eNotImpError, "TODO: free GIArgument(array)[%s]", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: /* Do nothing */ break; case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: rb_raise(rb_eNotImpError, "TODO: free GIArgument(array)[%s]", g_type_tag_to_string(element_type_tag)); break; case GI_TYPE_TAG_GTYPE: xfree(argument->v_pointer); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: g_free(argument->v_pointer); break; case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: rb_raise(rb_eNotImpError, "TODO: free GIArgument(array)[%s]", g_type_tag_to_string(element_type_tag)); break; default: g_assert_not_reached(); break; } } static void rb_gi_value_argument_free_array(GIArgument *argument, GITypeInfo *type_info) { GIArrayType array_type; GITypeInfo *element_type_info; array_type = g_type_info_get_array_type(type_info); element_type_info = g_type_info_get_param_type(type_info, 0); switch (array_type) { case GI_ARRAY_TYPE_C: rb_gi_value_argument_free_array_c(argument, type_info, element_type_info); break; case GI_ARRAY_TYPE_ARRAY: case GI_ARRAY_TYPE_PTR_ARRAY: case GI_ARRAY_TYPE_BYTE_ARRAY: break; default: g_assert_not_reached(); break; } g_base_info_unref(element_type_info); } static void rb_gi_value_argument_free_interface(GIArgument *argument, GITypeInfo *type_info) { GIBaseInfo *interface_info; GIInfoType interface_type; interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); if (interface_type == GI_INFO_TYPE_STRUCT) { GType gtype; gtype = g_registered_type_info_get_g_type(interface_info); if (gtype == G_TYPE_VALUE) { GValue *gvalue = argument->v_pointer; g_value_unset(gvalue); xfree(argument->v_pointer); } } g_base_info_unref(interface_info); } void rb_gi_value_argument_free(GIArgument *argument, GITypeInfo *type_info) { GITypeTag type_tag; type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: break; case GI_TYPE_TAG_ARRAY: rb_gi_value_argument_free_array(argument, type_info); break; case GI_TYPE_TAG_INTERFACE: rb_gi_value_argument_free_interface(argument, type_info); break; case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_UNICHAR: break; default: g_assert_not_reached(); break; } } static void rb_gi_inout_argument_free(GIArgument *argument, GITypeInfo *type_info) { GIArgument in_argument; GITypeTag type_tag; memset(&in_argument, 0, sizeof(GIArgument)); type_tag = g_type_info_get_tag(type_info); switch (type_tag) { case GI_TYPE_TAG_VOID: break; case GI_TYPE_TAG_BOOLEAN: in_argument.v_boolean = *((gboolean *)(argument->v_pointer)); break; case GI_TYPE_TAG_INT8: in_argument.v_int8 = *((gint8 *)(argument->v_pointer)); break; case GI_TYPE_TAG_UINT8: /* TODO!!! */ in_argument.v_uint8 = *((guint8 *)(argument->v_pointer)); argument->v_pointer = ALLOC(guint8); *((guint8 *)argument->v_pointer) = in_argument.v_uint8; break; case GI_TYPE_TAG_INT16: in_argument.v_int16 = *((gint16 *)(argument->v_pointer)); argument->v_pointer = ALLOC(gint16); *((gint16 *)argument->v_pointer) = in_argument.v_int16; break; case GI_TYPE_TAG_UINT16: in_argument.v_uint16 = *((guint16 *)(argument->v_pointer)); argument->v_pointer = ALLOC(guint16); *((guint16 *)argument->v_pointer) = in_argument.v_uint16; break; case GI_TYPE_TAG_INT32: in_argument.v_int32 = *((gint32 *)(argument->v_pointer)); argument->v_pointer = ALLOC(gint32); *((gint32 *)argument->v_pointer) = in_argument.v_int32; break; case GI_TYPE_TAG_UINT32: in_argument.v_uint32 = *((guint32 *)(argument->v_pointer)); argument->v_pointer = ALLOC(guint32); *((guint32 *)argument->v_pointer) = in_argument.v_uint32; break; case GI_TYPE_TAG_INT64: in_argument.v_int64 = *((gint64 *)(argument->v_pointer)); argument->v_pointer = ALLOC(gint64); *((gint64 *)argument->v_pointer) = in_argument.v_int64; break; case GI_TYPE_TAG_UINT64: in_argument.v_uint64 = *((guint64 *)(argument->v_pointer)); argument->v_pointer = ALLOC(guint64); *((guint64 *)argument->v_pointer) = in_argument.v_uint64; break; case GI_TYPE_TAG_FLOAT: in_argument.v_float = *((gfloat *)(argument->v_pointer)); argument->v_pointer = ALLOC(gfloat); *((gfloat *)argument->v_pointer) = in_argument.v_float; break; case GI_TYPE_TAG_DOUBLE: in_argument.v_double = *((gdouble *)(argument->v_pointer)); argument->v_pointer = ALLOC(gdouble); *((gdouble *)argument->v_pointer) = in_argument.v_double; break; case GI_TYPE_TAG_GTYPE: in_argument.v_size = *((gsize *)(argument->v_pointer)); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: in_argument.v_string = *((gchar **)(argument->v_pointer)); break; case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GHASH: in_argument.v_pointer = *((gpointer *)(argument->v_pointer)); break; case GI_TYPE_TAG_ERROR: in_argument.v_pointer = *((GError **)(argument->v_pointer)); break; case GI_TYPE_TAG_UNICHAR: in_argument.v_uint32 = *((gunichar *)(argument->v_pointer)); break; default: g_assert_not_reached(); break; } rb_gi_value_argument_free(&in_argument, type_info); xfree(argument->v_pointer); } void rb_gi_in_argument_free(GIArgument *argument, GIArgInfo *arg_info) { GITypeInfo type_info; g_arg_info_load_type(arg_info, &type_info); if (g_arg_info_get_direction(arg_info) == GI_DIRECTION_INOUT) { rb_gi_inout_argument_free(argument, &type_info); } else { rb_gi_value_argument_free(argument, &type_info); } } void rb_gi_argument_init(void) { rb_cGLibValue = rb_const_get(mGLib, rb_intern("Value")); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-arg-info.c��������������0000644�0001750�0001750�00000006665�12121311640�027110� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIArgInfo #define SELF(self) (RVAL2GI_ARG_INFO(self)) GType gi_arg_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIArgInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_direction(VALUE self) { GIArgInfo *info; info = SELF(self); return GI_DIRECTION2RVAL(g_arg_info_get_direction(info)); } static VALUE rg_caller_allocates_p(VALUE self) { GIArgInfo *info; info = SELF(self); return CBOOL2RVAL(g_arg_info_is_caller_allocates(info)); } static VALUE rg_return_value_p(VALUE self) { GIArgInfo *info; info = SELF(self); return CBOOL2RVAL(g_arg_info_is_return_value(info)); } static VALUE rg_optional_p(VALUE self) { GIArgInfo *info; info = SELF(self); return CBOOL2RVAL(g_arg_info_is_optional(info)); } static VALUE rg_may_be_null_p(VALUE self) { GIArgInfo *info; info = SELF(self); return CBOOL2RVAL(g_arg_info_may_be_null(info)); } static VALUE rg_ownership_transfer(VALUE self) { GIArgInfo *info; info = SELF(self); return GI_TRANSFER2RVAL(g_arg_info_get_ownership_transfer(info)); } static VALUE rg_scope(VALUE self) { GIArgInfo *info; info = SELF(self); return GI_SCOPE_TYPE2RVAL(g_arg_info_get_scope(info)); } static VALUE rg_closure(VALUE self) { GIArgInfo *info; info = SELF(self); return INT2NUM(g_arg_info_get_closure(info)); } static VALUE rg_destroy(VALUE self) { GIArgInfo *info; info = SELF(self); return INT2NUM(g_arg_info_get_destroy(info)); } static VALUE rg_type(VALUE self) { GIArgInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_arg_info_get_type(info)); } void rb_gi_arg_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_ARG_INFO, "ArgInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD_P(caller_allocates, 0); RG_DEF_METHOD_P(return_value, 0); RG_DEF_METHOD_P(optional, 0); RG_DEF_METHOD_P(may_be_null, 0); RG_DEF_METHOD(ownership_transfer, 0); RG_DEF_METHOD(scope, 0); RG_DEF_METHOD(closure, 0); RG_DEF_METHOD(destroy, 0); RG_DEF_METHOD(type, 0); G_DEF_CLASS(G_TYPE_I_DIRECTION, "Direction", rb_mGI); G_DEF_CLASS(G_TYPE_I_SCOPE_TYPE, "ScopeType", rb_mGI); G_DEF_CLASS(G_TYPE_I_TRANSFER, "Transfer", rb_mGI); } ���������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-private.h���������������0000644�0001750�0001750�00000011036�12516434313�027064� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2013 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_GI_PRIVATE_H #define RB_GI_PRIVATE_H #include <ruby.h> #include <rbgobject.h> #include <glib-enum-types.h> #include <girffi.h> #include "gobject-introspection-enum-types.h" #include "rbgiversion.h" #include "rb-gi-types.h" #include "rb-gi-conversions.h" #include "rb-gobject-introspection.h" #ifndef RB_TYPE_P # define RB_TYPE_P(object, type) (TYPE(object) == type) #endif extern void Init_gobject_introspection(void); void rb_gi_argument_init (void); void rb_gi_type_tag_init (VALUE rb_mGI); void rb_gi_base_info_init (VALUE rb_mGI); void rb_gi_callable_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_function_info_init (VALUE rb_mGI, VALUE rb_cGICallableInfo); void rb_gi_method_info_init (VALUE rb_mGI, VALUE rb_cGIFunctionInfo); void rb_gi_constructor_info_init (VALUE rb_mGI, VALUE rb_cGIFunctionInfo); void rb_gi_callback_info_init (VALUE rb_mGI, VALUE rb_cGICallableInfo); void rb_gi_registered_type_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_struct_info_init (VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo); void rb_gi_boxed_info_init (VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo); void rb_gi_enum_info_init (VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo); void rb_gi_flags_info_init (VALUE rb_mGI, VALUE rb_cGIEnumInfo); void rb_gi_object_info_init (VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo); void rb_gi_interface_info_init (VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo); void rb_gi_constant_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_union_info_init (VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo); void rb_gi_value_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_signal_info_init (VALUE rb_mGI, VALUE rb_cGICallableInfo); void rb_gi_vfunc_info_init (VALUE rb_mGI, VALUE rb_cGICallableInfo); void rb_gi_property_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_field_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_arg_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_type_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_unresolved_info_init (VALUE rb_mGI, VALUE rb_cGIBaseInfo); void rb_gi_repository_init (VALUE rb_mGI); void rb_gi_loader_init (VALUE rb_mGI); VALUE rb_gi_function_info_invoke_raw (GIFunctionInfo *info, VALUE rb_options, GIArgument *return_value); VALUE rb_gi_field_info_get_field_raw (GIFieldInfo *info, gpointer memory); void rb_gi_field_info_set_field_raw (GIFieldInfo *info, gpointer memory, VALUE rb_field_value); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c������������0000644�0001750�0001750�00000016343�12446160551�027634� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 */ /* GObjectIntrospection::Repository is used to manage repositories of * namespaces. Namespaces are represented on disk by type libraries * (.typelib files). */ #include "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIRepository #define SELF(self) RVAL2GI_REPOSITORY(self) /* Returns the singleton process-global default * GObjectIntrospection::Repository. It is not currently supported to have * multiple repositories in a particular process, but this function is provided * in the unlikely eventuality that it would become possible, and as a * convenience for higher level language bindings to conform to the GObject * method call conventions. * * @return [GObjectIntrospection::Repository] The global singleton * GObjectIntrospection::Repository. */ static VALUE rg_s_default(G_GNUC_UNUSED VALUE klass) { return GOBJ2RVAL(g_irepository_get_default()); } /* Force the namespace to be loaded if it isn't already. If namespace is not * loaded, this function will search for a ".typelib" file using the repository * search path. In addition, a version of namespace may be specified. If version * is not specified, the latest will be used. * * @param [String] namespace The namespace to load * @param [String, nil] version An optional version */ static VALUE rg_require(int argc, VALUE *argv, VALUE self) { VALUE rb_namespace, rb_version, rb_flags; const gchar *namespace_, *version; GIRepositoryLoadFlags flags = 0; GError *error = NULL; rb_scan_args(argc, argv, "12", &rb_namespace, &rb_version, &rb_flags); namespace_ = RVAL2CSTR(rb_namespace); version = RVAL2CSTR_ACCEPT_NIL(rb_version); if (!NIL_P(rb_flags)) { flags = RVAL2GI_REPOSITORY_LOAD_FLAGS(rb_flags); } g_irepository_require(SELF(self), namespace_, version, flags, &error); if (error) { RG_RAISE_ERROR(error); } return Qnil; } /* Return an array of all (transitive) versioned dependencies for namespace. * Returned strings are of the form "namespace-version". * Note: namespace must have already been loaded using a function such as * GObjectIntrospection::Repository.require() before calling this method. * * @param [String] namespace The namespace to get the dependencies for. * * @return [Array<String>] The dependencies. */ static VALUE rg_get_dependencies(VALUE self, VALUE rb_namespace) { GIRepository *repository; const gchar *namespace_; VALUE rb_dependencies; gchar **dependencies; gint i; repository = SELF(self); namespace_ = RVAL2CSTR(rb_namespace); dependencies = g_irepository_get_dependencies(repository, namespace_); rb_dependencies = rb_ary_new(); for (i = 0; dependencies[i]; i++) { rb_ary_push(rb_dependencies, CSTR2RVAL(dependencies[i])); } g_strfreev(dependencies); return rb_dependencies; } /* Return the list of currently loaded namespaces. * * @return [Array<String>] The loaded namespaces. */ static VALUE rg_loaded_namespaces(VALUE self) { GIRepository *repository; VALUE rb_namespaces; gchar **namespaces; gint i; repository = SELF(self); namespaces = g_irepository_get_loaded_namespaces(repository); rb_namespaces = rb_ary_new(); for (i = 0; namespaces[i]; i++) { rb_ary_push(rb_namespaces, CSTR2RVAL(namespaces[i])); } g_strfreev(namespaces); return rb_namespaces; } /* This method returns the number of metadata entries in given namespace. The * namespace must have already been loaded before calling this function. * * @param [String] namespace The namespace to fetch the entries from. * * @return [Integer] The number of metadata entries. */ static VALUE rg_get_n_infos(VALUE self, VALUE rb_namespace) { const gchar *namespace_; gint n_infos; namespace_ = RVAL2CSTR(rb_namespace); n_infos = g_irepository_get_n_infos(SELF(self), namespace_); return INT2NUM(n_infos); } /* This method returns a particular metadata entry in the given namespace. The * namespace must have already been loaded before calling this function. See * GObjectIntrospection::Repository#get_n_infos() to find the maximum number * of entries. * * @param [String] namespace The namespace to fetch the metadata entry from. * @param [Fixnum] index The index of the entry. * * @return [GObjectIntrospection::BaseInfo] The metadata entry. */ static VALUE rg_get_info(VALUE self, VALUE rb_namespace, VALUE rb_n) { GIRepository *repository; const gchar *namespace_; gint n; GIBaseInfo *info; repository = SELF(self); namespace_ = RVAL2CSTR(rb_namespace); n = NUM2INT(rb_n); info = g_irepository_get_info(repository, namespace_, n); return GI_BASE_INFO2RVAL_WITH_UNREF(info); } /* This method searches for a particular type or name. If only one argument is * given, it is interpreted as a gtype and all loaded namespaces are searched * for it. If two arguments are given the first is a particular namespace and * the second the name of an entry to search for. * * @overload find(type) * * @param [String] type The type to search for. * * @return [GObjectIntrospection::BaseInfo] The metadata entry. * * * @overload find(namespace, type) * * @param [String] namespace The namespace to search in. * * @param [String] type The type to search for. * * @return [GObjectIntrospection::BaseInfo] The metadata entry. */ static VALUE rg_find(int argc, VALUE *argv, VALUE self) { GIBaseInfo *info; if (argc == 1) { VALUE rb_gtype; GType gtype; rb_gtype = argv[0]; gtype = NUM2UINT(rb_gtype); info = g_irepository_find_by_gtype(SELF(self), gtype); } else { VALUE rb_namespace, rb_name; const gchar *namespace_, *name; rb_scan_args(argc, argv, "2", &rb_namespace, &rb_name); namespace_ = RVAL2CSTR(rb_namespace); name = RVAL2CSTR(rb_name); info = g_irepository_find_by_name(SELF(self), namespace_, name); } return GI_BASE_INFO2RVAL(info); } void rb_gi_repository_init(VALUE rb_mGI) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_IREPOSITORY, "Repository", rb_mGI); RG_DEF_SMETHOD(default, 0); RG_DEF_METHOD(require, -1); RG_DEF_METHOD(get_dependencies, 1); RG_DEF_METHOD(loaded_namespaces, 0); RG_DEF_METHOD(get_n_infos, 1); RG_DEF_METHOD(get_info, 2); RG_DEF_METHOD(find, -1); G_DEF_CLASS(G_TYPE_I_REPOSITORY_LOAD_FLAGS, "RepositoryLoadFlags", rb_mGI); G_DEF_CLASS(G_TYPE_I_REPOSITORY_ERROR, "RepositoryError", rb_mGI); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/ruby-gobject-introspection.pc�0000644�0001750�0001750�00000000143�12446173031�032055� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Name: Ruby/GObjectIntrospection Description: Ruby bindings for GObject Introspection Version: 2.2.4�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-type-info.c�������������0000644�0001750�0001750�00000006457�12121311640�027317� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGITypeInfo #define SELF(self) (RVAL2GI_TYPE_INFO(self)) GType gi_type_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GITypeInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } VALUE rb_gi_array_type_to_ruby(GIArrayType type) { if (type == (GIArrayType)-1) { return Qnil; } else { return GENUM2RVAL(type, G_TYPE_I_ARRAY_TYPE); } } static VALUE rg_pointer_p(VALUE self) { GITypeInfo *info; info = SELF(self); return CBOOL2RVAL(g_type_info_is_pointer(info)); } static VALUE rg_tag(VALUE self) { GITypeInfo *info; info = SELF(self); return GI_TYPE_TAG2RVAL(g_type_info_get_tag(info)); } static VALUE rg_get_param_type(VALUE self, VALUE rb_n) { GITypeInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_type_info_get_param_type(info, n)); } static VALUE rg_interface(VALUE self) { GITypeInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_type_info_get_interface(info)); } static VALUE rg_array_length(VALUE self) { GITypeInfo *info; info = SELF(self); return INT2NUM(g_type_info_get_array_length(info)); } static VALUE rg_array_fixed_size(VALUE self) { GITypeInfo *info; info = SELF(self); return INT2NUM(g_type_info_get_array_fixed_size(info)); } static VALUE rg_zero_terminated_p(VALUE self) { GITypeInfo *info; info = SELF(self); return CBOOL2RVAL(g_type_info_is_zero_terminated(info)); } static VALUE rg_array_type(VALUE self) { GITypeInfo *info; info = SELF(self); return GI_ARRAY_TYPE2RVAL(g_type_info_get_array_type(info)); } void rb_gi_type_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_TYPE_INFO, "TypeInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD_P(pointer, 0); RG_DEF_METHOD(tag, 0); RG_DEF_METHOD(get_param_type, 1); RG_DEF_METHOD(interface, 0); RG_DEF_METHOD(array_length, 0); RG_DEF_METHOD(array_fixed_size, 0); RG_DEF_METHOD_P(zero_terminated, 0); RG_DEF_METHOD(array_type, 0); rb_undef_method(RG_TARGET_NAMESPACE, "name"); G_DEF_CLASS(G_TYPE_I_ARRAY_TYPE, "ArrayType", rb_mGI); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-base-info.c�������������0000644�0001750�0001750�00000012414�12121311640�027236� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIBaseInfo #define SELF(self) RVAL2GI_BASE_INFO(self) VALUE rb_gi_base_info_to_ruby(GIBaseInfo *info) { GType g_type; GIInfoType info_type; if (!info) { return Qnil; } info_type = g_base_info_get_type(info); switch (info_type) { case GI_INFO_TYPE_INVALID: g_type = GI_TYPE_BASE_INFO; break; case GI_INFO_TYPE_FUNCTION: { GIFunctionInfoFlags flags; flags = g_function_info_get_flags((GIFunctionInfo *)info); if (flags & GI_FUNCTION_IS_METHOD) { g_type = GI_TYPE_METHOD_INFO; } else if (flags & GI_FUNCTION_IS_CONSTRUCTOR) { g_type = GI_TYPE_CONSTRUCTOR_INFO; } else { g_type = GI_TYPE_FUNCTION_INFO; } } break; case GI_INFO_TYPE_CALLBACK: g_type = GI_TYPE_CALLBACK_INFO; break; case GI_INFO_TYPE_STRUCT: g_type = GI_TYPE_STRUCT_INFO; break; case GI_INFO_TYPE_BOXED: g_type = GI_TYPE_BOXED_INFO; break; case GI_INFO_TYPE_ENUM: g_type = GI_TYPE_ENUM_INFO; break; case GI_INFO_TYPE_FLAGS: g_type = GI_TYPE_FLAGS_INFO; break; case GI_INFO_TYPE_OBJECT: g_type = GI_TYPE_OBJECT_INFO; break; case GI_INFO_TYPE_INTERFACE: g_type = GI_TYPE_INTERFACE_INFO; break; case GI_INFO_TYPE_CONSTANT: g_type = GI_TYPE_CONSTANT_INFO; break; case GI_INFO_TYPE_INVALID_0: g_type = GI_TYPE_BASE_INFO; break; case GI_INFO_TYPE_UNION: g_type = GI_TYPE_UNION_INFO; break; case GI_INFO_TYPE_VALUE: g_type = GI_TYPE_VALUE_INFO; break; case GI_INFO_TYPE_SIGNAL: g_type = GI_TYPE_SIGNAL_INFO; break; case GI_INFO_TYPE_VFUNC: g_type = GI_TYPE_VFUNC_INFO; break; case GI_INFO_TYPE_PROPERTY: g_type = GI_TYPE_PROPERTY_INFO; break; case GI_INFO_TYPE_FIELD: g_type = GI_TYPE_FIELD_INFO; break; case GI_INFO_TYPE_ARG: g_type = GI_TYPE_ARG_INFO; break; case GI_INFO_TYPE_TYPE: g_type = GI_TYPE_TYPE_INFO; break; case GI_INFO_TYPE_UNRESOLVED: g_type = GI_TYPE_UNRESOLVED_INFO; break; default: g_type = GI_TYPE_BASE_INFO; break; } return BOXED2RVAL(info, g_type); } VALUE rb_gi_base_info_to_ruby_with_unref(GIBaseInfo *info) { VALUE rb_info; rb_info = rb_gi_base_info_to_ruby(info); if (!NIL_P(rb_info)) { g_base_info_unref(info); } return rb_info; } GIBaseInfo * rb_gi_base_info_from_ruby(VALUE rb_info) { return RVAL2BOXED(rb_info, GI_TYPE_BASE_INFO); } static VALUE rg_type(VALUE self) { GIBaseInfo *info; info = SELF(self); return GI_INFO_TYPE2RVAL(g_base_info_get_type(info)); } static VALUE rg_name(VALUE self) { GIBaseInfo *info; info = SELF(self); return CSTR2RVAL(g_base_info_get_name(info)); } static VALUE rg_namespace(VALUE self) { GIBaseInfo *info; info = SELF(self); return CSTR2RVAL(g_base_info_get_namespace(info)); } static VALUE rg_operator_aref(VALUE self, VALUE name) { GIBaseInfo *info; info = SELF(self); return CSTR2RVAL(g_base_info_get_attribute(info, RVAL2CSTR(name))); } static VALUE rg_each(VALUE self) { GIAttributeIter iter = {0, }; GIBaseInfo *info; gchar *name, *value; RETURN_ENUMERATOR(self, 0, NULL); info = SELF(self); while (g_base_info_iterate_attributes(info, &iter, &name, &value)) { VALUE rb_name, rb_value; rb_name = CSTR2RVAL(name); rb_value = CSTR2RVAL(value); rb_yield(rb_ary_new3(2, rb_name, rb_value)); } return Qnil; } void rb_gi_base_info_init(VALUE rb_mGI) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(GI_TYPE_BASE_INFO, "BaseInfo", rb_mGI); rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(namespace, 0); RG_DEF_METHOD_OPERATOR("[]", aref, 1); RG_DEF_METHOD(each, 0); G_DEF_CLASS(G_TYPE_I_INFO_TYPE, "InfoType", rb_mGI); rb_gi_callable_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_registered_type_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_constant_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_value_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_property_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_field_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_arg_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_type_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_unresolved_info_init(rb_mGI, RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-unresolved-info.c�������0000644�0001750�0001750�00000003052�12121311640�030510� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TUNRESOLVEDET_NAMESPACE rb_cGIUnresolvedInfo GType gi_unresolved_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIUnresolvedInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } void rb_gi_unresolved_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_UNRESOLVED_INFO, "UnresolvedInfo", rb_mGI, rb_cGIBaseInfo); (void)RG_TARGET_NAMESPACE; /* suppress a warning. */ } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c���������0000644�0001750�0001750�00000062541�12516434313�030172� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2014 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 "rb-gi-private.h" #ifdef HAVE_RUBY_THREAD_H # include <ruby/thread.h> # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE void * # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE NULL #else # define rb_thread_call_without_gvl(func, func_data, ubf, ubf_data) \ rb_thread_blocking_region(func, func_data, ubf, ubf_data) # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE VALUE # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE Qnil #endif #define RG_TARGET_NAMESPACE rb_cGIFunctionInfo #define SELF(self) RVAL2GI_FUNCTION_INFO(self) static VALUE RG_TARGET_NAMESPACE; static VALUE rb_cGLibError; static const char *callbacks_key = "gi_callbacks"; static GPtrArray *callback_finders; GType gi_function_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIFunctionInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_symbol(VALUE self) { GIFunctionInfo *info; info = SELF(self); return CSTR2RVAL(g_function_info_get_symbol(info)); } static VALUE rg_flags(VALUE self) { GIFunctionInfo *info; info = SELF(self); return GI_FUNCTION_INFO_FLAGS2RVAL(g_function_info_get_flags(info)); } static VALUE rg_property(VALUE self) { GIFunctionInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL(g_function_info_get_property(info)); } static VALUE rg_vfunc(VALUE self) { GIFunctionInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL(g_function_info_get_vfunc(info)); } static void allocate_arguments(GICallableInfo *info, GArray *in_args, GArray *out_args, GPtrArray *args_metadata) { gint i, n_args; n_args = g_callable_info_get_n_args(info); for (i = 0; i < n_args; i++) { GIArgument argument; RBGIArgMetadata *metadata; GIArgInfo *arg_info; GIDirection direction; memset(&argument, 0, sizeof(GIArgument)); metadata = ALLOC(RBGIArgMetadata); arg_info = &(metadata->arg_info); g_callable_info_load_arg(info, i, arg_info); metadata->scope_type = g_arg_info_get_scope(arg_info); metadata->direction = g_arg_info_get_direction(arg_info); metadata->callback_p = (metadata->scope_type != GI_SCOPE_TYPE_INVALID); metadata->closure_p = FALSE; metadata->destroy_p = FALSE; metadata->array_p = FALSE; metadata->array_length_p = FALSE; metadata->in_arg_index = -1; metadata->closure_in_arg_index = -1; metadata->destroy_in_arg_index = -1; metadata->array_in_arg_index = -1; metadata->array_length_in_arg_index = -1; metadata->array_length_arg_index = -1; metadata->rb_arg_index = -1; metadata->out_arg_index = -1; direction = metadata->direction; if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) { metadata->in_arg_index = in_args->len; g_array_append_val(in_args, argument); } if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) { metadata->out_arg_index = out_args->len; g_array_append_val(out_args, argument); } g_ptr_array_add(args_metadata, metadata); } } static void fill_metadata_callback(GPtrArray *args_metadata) { guint i; for (i = 0; i < args_metadata->len; i++) { RBGIArgMetadata *metadata; GIArgInfo *arg_info; gint closure_index; gint destroy_index; metadata = g_ptr_array_index(args_metadata, i); if (!metadata->callback_p) { continue; } arg_info = &(metadata->arg_info); closure_index = g_arg_info_get_closure(arg_info); if (closure_index != -1) { RBGIArgMetadata *closure_metadata; closure_metadata = g_ptr_array_index(args_metadata, closure_index); closure_metadata->closure_p = TRUE; metadata->closure_in_arg_index = closure_metadata->in_arg_index; } destroy_index = g_arg_info_get_destroy(arg_info); if (destroy_index != -1) { RBGIArgMetadata *destroy_metadata; destroy_metadata = g_ptr_array_index(args_metadata, destroy_index); destroy_metadata->destroy_p = TRUE; metadata->destroy_in_arg_index = destroy_metadata->in_arg_index; } } } static void fill_metadata_array(GPtrArray *args_metadata) { guint i; for (i = 0; i < args_metadata->len; i++) { RBGIArgMetadata *metadata; RBGIArgMetadata *array_length_metadata; GIArgInfo *arg_info; GITypeInfo type_info; gint array_length_index = -1; metadata = g_ptr_array_index(args_metadata, i); arg_info = &(metadata->arg_info); g_arg_info_load_type(arg_info, &type_info); if (g_type_info_get_tag(&type_info) != GI_TYPE_TAG_ARRAY) { continue; } metadata->array_p = TRUE; array_length_index = g_type_info_get_array_length(&type_info); if (array_length_index == -1) { continue; } array_length_metadata = g_ptr_array_index(args_metadata, array_length_index); array_length_metadata->array_length_p = TRUE; array_length_metadata->rb_arg_index = -1; array_length_metadata->array_in_arg_index = metadata->in_arg_index; metadata->array_length_in_arg_index = array_length_metadata->in_arg_index; metadata->array_length_arg_index = array_length_index; } } static void fill_metadata_rb_arg_index(GPtrArray *args_metadata) { guint i; gint rb_arg_index = 0; for (i = 0; i < args_metadata->len; i++) { RBGIArgMetadata *metadata; metadata = g_ptr_array_index(args_metadata, i); if (metadata->closure_p) { continue; } if (metadata->destroy_p) { continue; } if (metadata->array_length_p) { continue; } if (metadata->in_arg_index == -1) { continue; } metadata->rb_arg_index = rb_arg_index; rb_arg_index++; } } static void fill_metadata(GPtrArray *args_metadata) { fill_metadata_callback(args_metadata); fill_metadata_array(args_metadata); fill_metadata_rb_arg_index(args_metadata); } static void callback_data_guard_from_gc(RBGICallbackData *callback_data) { VALUE rb_callbacks; rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key); callback_data->rb_gc_guard_key = rb_class_new_instance(0, NULL, rb_cObject); rb_hash_aset(rb_callbacks, callback_data->rb_gc_guard_key, callback_data->rb_callback); } static void callback_data_unguard_from_gc(RBGICallbackData *callback_data) { VALUE rb_callbacks; rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key); rb_hash_delete(rb_callbacks, callback_data->rb_gc_guard_key); } void rb_gi_callback_data_free(RBGICallbackData *callback_data) { callback_data_unguard_from_gc(callback_data); xfree(callback_data->metadata); xfree(callback_data); } static void destroy_notify(gpointer data) { RBGICallbackData *callback_data = data; rb_gi_callback_data_free(callback_data); } static gpointer find_callback_function(GIArgInfo *info) { guint i; gpointer callback = NULL; for (i = 0; i < callback_finders->len; i++) { RBGICallbackFinderFunc finder = g_ptr_array_index(callback_finders, i); callback = finder(info); if (callback) { break; } } return callback; } void rb_gi_callback_register_finder(RBGICallbackFinderFunc finder) { g_ptr_array_add(callback_finders, finder); } static gboolean source_func_p(GIArgInfo *info) { GITypeInfo type_info; GIBaseInfo *interface_info; GICallableInfo *callback_info; GITypeInfo return_type_info; GIArgInfo first_arg_info; GITypeInfo first_arg_type_info; g_arg_info_load_type(info, &type_info); if (g_type_info_get_tag(&type_info) != GI_TYPE_TAG_INTERFACE) { return FALSE; } interface_info = g_type_info_get_interface(&type_info); if (g_base_info_get_type(interface_info) != GI_INFO_TYPE_CALLBACK) { g_base_info_unref(interface_info); return FALSE; } callback_info = (GICallableInfo *)interface_info; g_callable_info_load_return_type(callback_info, &return_type_info); if (g_type_info_get_tag(&return_type_info) != GI_TYPE_TAG_BOOLEAN) { g_base_info_unref(interface_info); return FALSE; } if (g_callable_info_get_n_args(interface_info) != 1) { g_base_info_unref(interface_info); return FALSE; } g_callable_info_load_arg(interface_info, 0, &first_arg_info); g_arg_info_load_type(&first_arg_info, &first_arg_type_info); if (g_type_info_get_tag(&first_arg_type_info) != GI_TYPE_TAG_VOID) { g_base_info_unref(interface_info); return FALSE; } g_base_info_unref(interface_info); return TRUE; } static gboolean source_func_callback(gpointer user_data) { RBGICallbackData *callback_data = user_data; VALUE rb_keep; ID id_call; CONST_ID(id_call, "call"); rb_keep = rb_funcall(callback_data->rb_callback, id_call, 0); if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) { rb_gi_callback_data_free(callback_data); } return RVAL2CBOOL(rb_keep); } static gpointer source_func_callback_finder(GIArgInfo *arg_info) { if (!source_func_p(arg_info)) { return NULL; } return source_func_callback; } static void in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args) { gpointer callback; GIArgInfo *arg_info; GIArgument *callback_argument; arg_info = &(metadata->arg_info); callback = find_callback_function(arg_info); if (!callback) { GITypeInfo type_info; GIBaseInfo *interface_info; VALUE rb_type_name; g_arg_info_load_type(arg_info, &type_info); interface_info = g_type_info_get_interface(&type_info); rb_type_name = CSTR2RVAL(g_base_info_get_name(interface_info)); g_base_info_unref(interface_info); rb_raise(rb_eNotImpError, "TODO: <%s>(%s) callback is not supported yet.", RVAL2CSTR(rb_type_name), g_base_info_get_name(arg_info)); } callback_argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index)); callback_argument->v_pointer = callback; if (metadata->closure_in_arg_index != -1) { RBGICallbackData *callback_data; GIArgument *closure_argument; callback_data = ALLOC(RBGICallbackData); callback_data->metadata = metadata; callback_data->rb_callback = rb_block_proc(); callback_data_guard_from_gc(callback_data); closure_argument = &(g_array_index(in_args, GIArgument, metadata->closure_in_arg_index)); closure_argument->v_pointer = callback_data; } if (metadata->destroy_in_arg_index != -1) { GIArgument *destroy_argument; destroy_argument = &(g_array_index(in_args, GIArgument, metadata->destroy_in_arg_index)); destroy_argument->v_pointer = destroy_notify; } } static void in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments, GArray *in_args, GPtrArray *args_metadata) { if (metadata->rb_arg_index == -1) { return; } if (metadata->callback_p) { in_callback_argument_from_ruby(metadata, in_args); } else if (metadata->array_p) { GIArgument *array_argument; GIArgument *length_argument = NULL; GIArgInfo *length_arg_info = NULL; VALUE rb_argument = Qnil; if (RARRAY_LEN(rb_arguments) > metadata->rb_arg_index) { rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index]; } array_argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index)); if (metadata->array_length_in_arg_index != -1) { RBGIArgMetadata *length_metadata; length_argument = &(g_array_index(in_args, GIArgument, metadata->array_length_in_arg_index)); length_metadata = g_ptr_array_index(args_metadata, metadata->array_length_arg_index); length_arg_info = &(length_metadata->arg_info); } RVAL2GI_IN_ARRAY_ARGUMENT(array_argument, length_argument, &(metadata->arg_info), length_arg_info, rb_argument); } else { GIArgument *argument; VALUE rb_argument = Qnil; if (RARRAY_LEN(rb_arguments) > metadata->rb_arg_index) { rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index]; } argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index)); RVAL2GI_IN_ARGUMENT(argument, &(metadata->arg_info), rb_argument); } } static void out_argument_from_ruby(RBGIArgMetadata *metadata, GArray *out_args) { GIArgument *argument; argument = &(g_array_index(out_args, GIArgument, metadata->out_arg_index)); rb_gi_out_argument_init(argument, &(metadata->arg_info)); } static void arg_metadata_free(gpointer data) { RBGIArgMetadata *metadata = data; if (metadata->scope_type == GI_SCOPE_TYPE_ASYNC || metadata->scope_type == GI_SCOPE_TYPE_NOTIFIED) { return; } xfree(metadata); } static void arguments_from_ruby(GICallableInfo *info, VALUE rb_arguments, GArray *in_args, GArray *out_args, GPtrArray *args_metadata) { gint i, n_args; allocate_arguments(info, in_args, out_args, args_metadata); fill_metadata(args_metadata); n_args = g_callable_info_get_n_args(info); for (i = 0; i < n_args; i++) { RBGIArgMetadata *metadata; metadata = g_ptr_array_index(args_metadata, i); if (metadata->in_arg_index != -1) { in_argument_from_ruby(metadata, rb_arguments, in_args, args_metadata); } else { out_argument_from_ruby(metadata, out_args); } } } static VALUE out_arguments_to_ruby(GICallableInfo *callable_info, GArray *in_args, GArray *out_args, GPtrArray *args_metadata) { gint i, n_args; VALUE rb_out_args; rb_out_args = rb_ary_new(); n_args = g_callable_info_get_n_args(callable_info); for (i = 0; i < n_args; i++) { RBGIArgMetadata *metadata; GIArgument *argument = NULL; VALUE rb_argument; metadata = g_ptr_array_index(args_metadata, i); if (metadata->array_length_p) { continue; } switch (metadata->direction) { case GI_DIRECTION_IN: break; case GI_DIRECTION_OUT: argument = &g_array_index(out_args, GIArgument, metadata->out_arg_index); break; case GI_DIRECTION_INOUT: argument = &g_array_index(in_args, GIArgument, metadata->in_arg_index); break; default: g_assert_not_reached(); break; } if (!argument) { continue; } if (metadata->array_p) { GIArgument *length_argument = NULL; GIArgInfo *length_arg_info = NULL; if (metadata->array_length_in_arg_index != -1) { RBGIArgMetadata *length_metadata; length_metadata = g_ptr_array_index(args_metadata, metadata->array_length_arg_index); if (length_metadata->direction == GI_DIRECTION_OUT) { length_argument = &g_array_index(in_args, GIArgument, length_metadata->out_arg_index); } else { length_argument = &g_array_index(in_args, GIArgument, length_metadata->in_arg_index); } length_arg_info = &(length_metadata->arg_info); } rb_argument = GI_OUT_ARRAY_ARGUMENT2RVAL(argument, length_argument, &(metadata->arg_info), length_arg_info); } else { rb_argument = GI_OUT_ARGUMENT2RVAL(argument, &(metadata->arg_info)); } rb_ary_push(rb_out_args, rb_argument); } if (RARRAY_LEN(rb_out_args) == 0) { return Qnil; } else { return rb_out_args; } } static void arguments_init(GArray **in_args, GArray **out_args, GPtrArray **args_metadata) { *in_args = g_array_new(FALSE, FALSE, sizeof(GIArgument)); *out_args = g_array_new(FALSE, FALSE, sizeof(GIArgument)); *args_metadata = g_ptr_array_new_with_free_func(arg_metadata_free); } static void arguments_free(GArray *in_args, GArray *out_args, GPtrArray *args_metadata) { guint i; for (i = 0; i < args_metadata->len; i++) { RBGIArgMetadata *metadata; gint in_arg_index; metadata = g_ptr_array_index(args_metadata, i); if (metadata->direction == GI_DIRECTION_IN || metadata->direction == GI_DIRECTION_INOUT) { in_arg_index = metadata->in_arg_index; if (in_arg_index != -1) { GIArgument *argument; argument = &(g_array_index(in_args, GIArgument, in_arg_index)); rb_gi_in_argument_free(argument, &(metadata->arg_info)); } } else { GIArgument *argument; argument = &(g_array_index(out_args, GIArgument, metadata->out_arg_index)); rb_gi_out_argument_fin(argument, &(metadata->arg_info)); } } g_array_unref(in_args); g_array_unref(out_args); g_ptr_array_unref(args_metadata); } typedef struct { GIFunctionInfo *info; GArray *in_args; GArray *out_args; GIArgument *return_value; GError **error; gboolean succeeded; } InvokeData; static void rb_gi_function_info_invoke_raw_call(InvokeData *data) { data->succeeded = g_function_info_invoke(data->info, (GIArgument *)((void *)(data->in_args->data)), data->in_args->len, (GIArgument *)((void *)(data->out_args->data)), data->out_args->len, data->return_value, data->error); } static RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE rb_gi_function_info_invoke_raw_call_without_gvl_body(void *user_data) { InvokeData *data = (InvokeData *)user_data; rb_gi_function_info_invoke_raw_call(data); return RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE; } static gboolean gobject_based_p(GIBaseInfo *info) { GIBaseInfo *container_info; GIRegisteredTypeInfo *registered_type_info; container_info = g_base_info_get_container(info); if (g_base_info_get_type(container_info) != GI_INFO_TYPE_STRUCT) { return TRUE; } registered_type_info = (GIRegisteredTypeInfo *)container_info; if (g_registered_type_info_get_type_init(registered_type_info)) { return TRUE; } return FALSE; } VALUE rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options, GIArgument *return_value) { GICallableInfo *callable_info; GIArgument receiver; GArray *in_args, *out_args; GPtrArray *args_metadata; VALUE rb_out_args = Qnil; gboolean succeeded; GError *error = NULL; gboolean unlock_gvl = FALSE; VALUE rb_receiver, rb_arguments, rb_unlock_gvl; if (RB_TYPE_P(rb_options, RUBY_T_ARRAY)) { rb_receiver = Qnil; rb_arguments = rb_options; rb_unlock_gvl = Qnil; } else if (NIL_P(rb_options)) { rb_receiver = Qnil; rb_arguments = rb_ary_new(); rb_unlock_gvl = Qnil; } else { rb_options = rbg_check_hash_type(rb_options); rbg_scan_options(rb_options, "receiver", &rb_receiver, "arguments", &rb_arguments, "unlock_gvl", &rb_unlock_gvl, NULL); } if (NIL_P(rb_receiver)) { receiver.v_pointer = NULL; } else { if (gobject_based_p((GIBaseInfo *)info)) { receiver.v_pointer = RVAL2GOBJ(rb_receiver); } else { receiver.v_pointer = DATA_PTR(rb_receiver); } } rb_arguments = rbg_to_array(rb_arguments); if (!NIL_P(rb_unlock_gvl) && RVAL2CBOOL(rb_unlock_gvl)) { unlock_gvl = TRUE; } callable_info = (GICallableInfo *)info; arguments_init(&in_args, &out_args, &args_metadata); if (receiver.v_pointer) { g_array_append_val(in_args, receiver); } arguments_from_ruby(callable_info, rb_arguments, in_args, out_args, args_metadata); { InvokeData data; data.info = info; data.in_args = in_args; data.out_args = out_args; data.return_value = return_value; data.error = &error; if (unlock_gvl) { rb_thread_call_without_gvl( rb_gi_function_info_invoke_raw_call_without_gvl_body, &data, NULL, NULL); } else { rb_gi_function_info_invoke_raw_call(&data); } succeeded = data.succeeded; } if (succeeded) { rb_out_args = out_arguments_to_ruby(callable_info, in_args, out_args, args_metadata); } arguments_free(in_args, out_args, args_metadata); if (!succeeded) { RG_RAISE_ERROR(error); } if (!NIL_P(rb_out_args) && RARRAY_LEN(rb_out_args) == 1) { VALUE rb_out_arg; rb_out_arg = RARRAY_PTR(rb_out_args)[0]; if (rb_obj_is_kind_of(rb_out_arg, rb_eException)) { rb_exc_raise(rb_out_arg); } } return rb_out_args; } static VALUE rg_invoke(VALUE self, VALUE rb_options) { GIFunctionInfo *info; GICallableInfo *callable_info; GIArgument return_value; VALUE rb_out_args; VALUE rb_return_value; info = SELF(self); /* TODO: use rb_protect() */ rb_out_args = rb_gi_function_info_invoke_raw(info, rb_options, &return_value); callable_info = (GICallableInfo *)info; rb_return_value = GI_RETURN_ARGUMENT2RVAL(&return_value, callable_info); if (NIL_P(rb_out_args)) { return rb_return_value; } else { GITypeInfo return_value_info; g_callable_info_load_return_type(callable_info, &return_value_info); if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) { rb_ary_unshift(rb_out_args, rb_return_value); } if (RARRAY_LEN(rb_out_args) == 1) { return RARRAY_PTR(rb_out_args)[0]; } else { return rb_out_args; } } } void rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo) { rb_cGLibError = rb_const_get(mGLib, rb_intern("Error")); RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_FUNCTION_INFO, "FunctionInfo", rb_mGI, rb_cGICallableInfo); rb_iv_set(RG_TARGET_NAMESPACE, callbacks_key, rb_hash_new()); callback_finders = g_ptr_array_new(); rb_gi_callback_register_finder(source_func_callback_finder); RG_DEF_METHOD(symbol, 0); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(property, 0); RG_DEF_METHOD(vfunc, 0); RG_DEF_METHOD(invoke, 1); G_DEF_CLASS(G_TYPE_I_FUNCTION_INFO_FLAGS, "FunctionInfoFlags", rb_mGI); rb_gi_method_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_constructor_info_init(rb_mGI, RG_TARGET_NAMESPACE); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-union-info.c������������0000644�0001750�0001750�00000011762�12121311640�027461� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIUnionInfo #define SELF(self) (RVAL2GI_UNION_INFO(self)) GType gi_union_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIUnionInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_n_fields(VALUE self) { GIUnionInfo *info; info = SELF(self); return INT2NUM(g_union_info_get_n_fields(info)); } static VALUE rg_get_field(VALUE self, VALUE rb_n) { GIUnionInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_union_info_get_field(info, n)); } static VALUE rg_get_field_value(VALUE self, VALUE rb_union, VALUE rb_n) { GIUnionInfo *info; gint n; GIFieldInfo *field_info; GType gtype; VALUE rb_value; info = SELF(self); n = NUM2INT(rb_n); field_info = g_union_info_get_field(info, n); gtype = g_registered_type_info_get_g_type(info); rb_value = rb_gi_field_info_get_field_raw(field_info, RVAL2BOXED(rb_union, gtype)); g_base_info_unref(field_info); return rb_value; } static VALUE rg_set_field_value(VALUE self, VALUE rb_union, VALUE rb_n, VALUE rb_value) { GIUnionInfo *info; gint n; GIFieldInfo *field_info; GType gtype; info = SELF(self); n = NUM2INT(rb_n); field_info = g_union_info_get_field(info, n); gtype = g_registered_type_info_get_g_type(info); rb_gi_field_info_set_field_raw(field_info, RVAL2BOXED(rb_union, gtype), rb_value); /* TODO: use rb_ensure() to unref field_info. */ g_base_info_unref(field_info); return Qnil; } static VALUE rg_n_methods(VALUE self) { GIUnionInfo *info; info = SELF(self); return INT2NUM(g_union_info_get_n_methods(info)); } static VALUE rg_get_method(VALUE self, VALUE rb_n_or_name) { GIUnionInfo *info; GIFunctionInfo *function_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); function_info = g_union_info_get_method(info, n); } else { const gchar *name; name = RVAL2CSTR(rb_n_or_name); function_info = g_union_info_find_method(info, name); } return GI_BASE_INFO2RVAL_WITH_UNREF(function_info); } static VALUE rg_discriminated_p(VALUE self) { GIUnionInfo *info; info = SELF(self); return CBOOL2RVAL(g_union_info_is_discriminated(info)); } static VALUE rg_discriminator_offset(VALUE self) { GIUnionInfo *info; info = SELF(self); return INT2NUM(g_union_info_get_discriminator_offset(info)); } static VALUE rg_discriminator_type(VALUE self) { GIUnionInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL_WITH_UNREF(g_union_info_get_discriminator_type(info)); } static VALUE rg_get_discriminator(VALUE self, VALUE rb_n) { GIUnionInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_union_info_get_discriminator(info, n)); } static VALUE rg_size(VALUE self) { GIUnionInfo *info; info = SELF(self); return ULONG2NUM(g_union_info_get_size(info)); } static VALUE rg_alignment(VALUE self) { GIUnionInfo *info; info = SELF(self); return ULONG2NUM(g_union_info_get_alignment(info)); } void rb_gi_union_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_UNION_INFO, "UnionInfo", rb_mGI, rb_cGIRegisteredTypeInfo); RG_DEF_METHOD(n_fields, 0); RG_DEF_METHOD(get_field, 1); RG_DEF_METHOD(get_field_value, 2); RG_DEF_METHOD(set_field_value, 3); RG_DEF_METHOD(n_methods, 0); RG_DEF_METHOD(get_method, 1); RG_DEF_METHOD_P(discriminated, 0); RG_DEF_METHOD(discriminator_offset, 0); RG_DEF_METHOD(discriminator_type, 0); RG_DEF_METHOD(get_discriminator, 1); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(alignment, 0); } ��������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-conversions.h�����������0000644�0001750�0001750�00000017636�12516434313�027776� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2014 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_GI_CONVERSIONS_H #define RB_GI_CONVERSIONS_H #define RVAL2GI_REPOSITORY(rb_object) (G_IREPOSITORY(RVAL2GOBJ(rb_object))) #define RVAL2GI_REPOSITORY_LOAD_FLAGS(rb_flags) \ (RVAL2GFLAGS(rb_flags, G_TYPE_I_REPOSITORY_LOAD_FLAGS)) #define GI_BASE_INFO2RVAL(info) \ (rb_gi_base_info_to_ruby((GIBaseInfo *)(info))) #define GI_BASE_INFO2RVAL_WITH_UNREF(info) \ (rb_gi_base_info_to_ruby_with_unref((GIBaseInfo *)(info))) #define RVAL2GI_BASE_INFO(rb_object) (rb_gi_base_info_from_ruby(rb_object)) #define GI_ARGUMENT2RVAL(argument, type_info) \ (rb_gi_argument_to_ruby((argument), (type_info))) #define GI_ARRAY_ARGUMENT2RVAL(array_argument, length_argument, \ array_type_info, length_type_info) \ (rb_gi_array_argument_to_ruby((array_argument), \ (length_argument), \ (array_type_info), \ (length_type_info))) #define GI_OUT_ARGUMENT2RVAL(argument, arg_info) \ (rb_gi_out_argument_to_ruby((argument), (arg_info))) #define GI_OUT_ARRAY_ARGUMENT2RVAL(array_argument, length_argument, \ array_arg_info, length_arg_info) \ (rb_gi_out_array_argument_to_ruby((array_argument), (length_argument), \ (array_arg_info), (length_arg_info))) #define GI_RETURN_ARGUMENT2RVAL(argument, callable_info) \ (rb_gi_return_argument_to_ruby((argument), (callable_info))) #define RVAL2GI_VALUE_ARGUMENT(argument, type_info, rb_argument) \ (rb_gi_value_argument_from_ruby((argument), (type_info), (rb_argument))) #define RVAL2GI_IN_ARGUMENT(argument, arg_info, rb_argument) \ (rb_gi_in_argument_from_ruby((argument), (arg_info), (rb_argument))) #define RVAL2GI_IN_ARRAY_ARGUMENT(array_argument, length_argument, \ array_arg_info, length_arg_info, \ rb_argument) \ (rb_gi_in_array_argument_from_ruby((array_argument), (length_argument), \ (array_arg_info), (length_arg_info), \ (rb_argument))) #define RVAL2GI_REGISTERED_TYPE_INFO(rb_object) \ ((GIRegisteredTypeInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_FUNCTION_INFO(rb_object) \ ((GIFunctionInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_STRUCT_INFO(rb_object) \ ((GIStructInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_ENUM_INFO(rb_object) \ ((GIEnumInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_OBJECT_INFO(rb_object) \ ((GIObjectInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_INTERFACE_INFO(rb_object) \ ((GIInterfaceInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_CONSTANT_INFO(rb_object) \ ((GIConstantInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_UNION_INFO(rb_object) \ ((GIUnionInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_VALUE_INFO(rb_object) \ ((GIValueInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_ARG_INFO(rb_object) \ ((GIArgInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_FIELD_INFO(rb_object) \ ((GIFieldInfo *)RVAL2GI_BASE_INFO(rb_object)) #define RVAL2GI_TYPE_INFO(rb_object) \ ((GITypeInfo *)RVAL2GI_BASE_INFO(rb_object)) #define GI_INFO_TYPE2RVAL(type) (GENUM2RVAL(type, G_TYPE_I_INFO_TYPE)) #define GI_TRANSFER2RVAL(transfer) (GENUM2RVAL(transfer, G_TYPE_I_TRANSFER)) #define GI_DIRECTION2RVAL(direction) (GENUM2RVAL(direction, G_TYPE_I_DIRECTION)) #define GI_SCOPE_TYPE2RVAL(scope) (GENUM2RVAL(scope, G_TYPE_I_SCOPE_TYPE)) #define RVAL2GI_TYPE_TAG(rb_tag) (RVAL2GENUM(rb_tag, G_TYPE_I_TYPE_TAG)) #define GI_TYPE_TAG2RVAL(tag) (GENUM2RVAL(tag, G_TYPE_I_TYPE_TAG)) #define GI_ARRAY_TYPE2RVAL(type) (rb_gi_array_type_to_ruby(type)) #define GI_FUNCTION_INFO_FLAGS2RVAL(tag) \ (GFLAGS2RVAL(tag, G_TYPE_I_FUNCTION_INFO_FLAGS)) #define GI_SIGNAL_FLAGS2RVAL(tag) \ (GFLAGS2RVAL(tag, G_TYPE_SIGNAL_FLAGS)) #define GI_VFUNC_INFO_FLAGS2RVAL(tag) \ (GFLAGS2RVAL(tag, G_TYPE_IV_FUNC_INFO_FLAGS)) #define GI_FIELD_INFO_FLAGS2RVAL(tag) \ (GFLAGS2RVAL(tag, G_TYPE_I_FIELD_INFO_FLAGS)) VALUE rb_gi_base_info_to_ruby (GIBaseInfo *info); VALUE rb_gi_base_info_to_ruby_with_unref(GIBaseInfo *info); GIBaseInfo *rb_gi_base_info_from_ruby (VALUE rb_info); VALUE rb_gi_argument_to_ruby (GIArgument *argument, GITypeInfo *type_info); VALUE rb_gi_array_argument_to_ruby (GIArgument *array_argument, GIArgument *length_argument, GITypeInfo *array_type_info, GITypeInfo *length_type_info); void rb_gi_out_argument_init (GIArgument *argument, GIArgInfo *arg_info); VALUE rb_gi_out_argument_to_ruby (GIArgument *argument, GIArgInfo *arg_info); VALUE rb_gi_out_array_argument_to_ruby (GIArgument *array_argument, GIArgument *length_argument, GIArgInfo *array_arg_info, GIArgInfo *length_arg_info); void rb_gi_out_argument_fin (GIArgument *argument, GIArgInfo *arg_info); VALUE rb_gi_return_argument_to_ruby (GIArgument *argument, GICallableInfo *callable_info); GIArgument *rb_gi_value_argument_from_ruby (GIArgument *argument, GITypeInfo *type_info, VALUE rb_argument); GIArgument *rb_gi_in_argument_from_ruby (GIArgument *argument, GIArgInfo *arg_info, VALUE rb_argument); GIArgument *rb_gi_in_array_argument_from_ruby (GIArgument *array_argument, GIArgument *length_argument, GIArgInfo *array_arg_info, GIArgInfo *length_arg_info, VALUE rb_argument); void rb_gi_value_argument_free (GIArgument *argument, GITypeInfo *type_info); void rb_gi_in_argument_free (GIArgument *argument, GIArgInfo *arg_info); VALUE rb_gi_array_type_to_ruby (GIArrayType type); #endif ��������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/Makefile����������������������0000644�0001750�0001750�00000024460�12446173031�025707� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� SHELL = /bin/sh # V=0 quiet, V=1 verbose. other values don't work. V = 0 Q1 = $(V:1=) Q = $(Q1:0=@) ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection/ext/gobject-introspection topdir = /usr/include/ruby-2.1.0 hdrdir = $(topdir) arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0 PATH_SEPARATOR = : VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby prefix = $(DESTDIR)/usr rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME) rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME) rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) exec_prefix = $(prefix) vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME) vendorhdrdir = $(rubyhdrdir)/vendor_ruby sitehdrdir = $(rubyhdrdir)/site_ruby rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version) vendorlibdir = $(vendordir)/$(ruby_version) vendordir = $(rubylibprefix)/vendor_ruby sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby sitelibdir = $(sitedir)/$(ruby_version) sitedir = $(DESTDIR)/usr/local/lib/site_ruby rubyarchdir = $(rubyarchprefix)/$(ruby_version) rubylibdir = $(rubylibprefix)/$(ruby_version) sitearchincludedir = $(includedir)/$(sitearch) archincludedir = $(includedir)/$(arch) sitearchlibdir = $(libdir)/$(sitearch) archlibdir = $(libdir)/$(arch) ridir = $(datarootdir)/$(RI_BASE_NAME) mandir = $(prefix)/share/man localedir = $(datarootdir)/locale libdir = $(exec_prefix)/lib psdir = $(docdir) pdfdir = $(docdir) dvidir = $(docdir) htmldir = $(docdir) infodir = $(prefix)/share/info docdir = $(datarootdir)/doc/$(PACKAGE) oldincludedir = $(DESTDIR)/usr/include includedir = $(prefix)/include localstatedir = $(DESTDIR)/var sharedstatedir = $(prefix)/com sysconfdir = $(DESTDIR)/etc datadir = $(datarootdir) datarootdir = $(prefix)/share libexecdir = $(prefix)/lib/ruby2.1 sbindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/bin archdir = $(rubyarchdir) CC = gcc CXX = g++ LIBRUBY = $(LIBRUBY_SO) LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static empty = OUTFLAG = -o $(empty) COUTFLAG = -o $(empty) RUBY_EXTCONF_H = cflags = $(optflags) $(debugflags) $(warnflags) optflags = -O3 -fno-fast-math debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration CCDLFLAGS = -fPIC CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings -pthread -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $(ARCH_FLAG) INCFLAGS = -I. -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2.clean/glib2/ext/glib2 -I/var/lib/gems/2.1.0/gems/glib2-2.2.3/ext/glib2 -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I$(vendorarchdir) DEFS = CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DHAVE_G_INTERFACE_INFO_FIND_SIGNAL -DRUBY_GOBJECT_INTROSPECTION_COMPILATION -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags) CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG) ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/lib/x86_64-linux-gnu dldflags = ARCH_FLAG = DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) LDSHARED = $(CC) -shared LDSHAREDXX = $(CXX) -shared AR = ar EXEEXT = RUBY_INSTALL_NAME = ruby2.1 RUBY_SO_NAME = ruby-2.1 RUBYW_INSTALL_NAME = RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) RUBYW_BASE_NAME = rubyw RUBY_BASE_NAME = ruby arch = x86_64-linux-gnu sitearch = $(arch) ruby_version = 2.1.0 ruby = $(bindir)/ruby2.1 RUBY = $(ruby) ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h RM = rm -f RM_RF = $(RUBY) -run -e rm -- -rf RMDIRS = rmdir --ignore-fail-on-non-empty -p MAKEDIRS = /bin/mkdir -p INSTALL = /usr/bin/install -c INSTALL_PROG = $(INSTALL) -m 0755 INSTALL_DATA = $(INSTALL) -m 644 COPY = cp TOUCH = exit > #### End of system configuration section. #### preload = libpath = . $(archlibdir) LIBPATH = -L. -L$(archlibdir) DEFFILE = CLEANFILES = mkmf.log DISTCLEANFILES = rbgiversion.h gobject-introspection-enum-types.h gobject-introspection-enum-types.c ruby-gobject-introspection.pc DISTCLEANDIRS = extout = extout_prefix = target_prefix = LOCAL_LIBS = LIBS = $(LIBRUBYARG_SHARED) -lgirepository-1.0 -lglib-2.0 -lgobject-2.0 -lpthread -lgmp -ldl -lcrypt -lm -lc ORIG_SRCS = rb-gi-method-info.c rb-gi-constructor-info.c rb-gi-field-info.c rb-gi-callback-info.c rb-gi-registered-type-info.c rb-gi-type-tag.c rb-gi-object-info.c rb-gobject-introspection.c gobject-introspection-enum-types.c rb-gi-boxed-info.c rb-gi-vfunc-info.c rb-gi-signal-info.c rb-gi-constant-info.c rb-gi-flags-info.c rb-gi-property-info.c rb-gi-value-info.c rb-gi-enum-info.c rb-gi-loader.c rb-gi-interface-info.c rb-gi-argument.c rb-gi-arg-info.c rb-gi-repository.c rb-gi-type-info.c rb-gi-base-info.c rb-gi-unresolved-info.c rb-gi-function-info.c rb-gi-union-info.c rb-gi-struct-info.c rb-gi-callable-info.c SRCS = $(ORIG_SRCS) rb-gi-method-info.c rb-gi-constructor-info.c rb-gi-field-info.c rb-gi-callback-info.c rb-gi-registered-type-info.c rb-gi-type-tag.c rb-gi-object-info.c rb-gobject-introspection.c gobject-introspection-enum-types.c rb-gi-boxed-info.c rb-gi-vfunc-info.c rb-gi-signal-info.c rb-gi-constant-info.c rb-gi-flags-info.c rb-gi-property-info.c rb-gi-value-info.c rb-gi-enum-info.c rb-gi-loader.c rb-gi-interface-info.c rb-gi-argument.c rb-gi-arg-info.c rb-gi-repository.c rb-gi-type-info.c rb-gi-base-info.c rb-gi-unresolved-info.c rb-gi-function-info.c rb-gi-union-info.c rb-gi-struct-info.c rb-gi-callable-info.c OBJS = rb-gi-method-info.o rb-gi-constructor-info.o rb-gi-field-info.o rb-gi-callback-info.o rb-gi-registered-type-info.o rb-gi-type-tag.o rb-gi-object-info.o rb-gobject-introspection.o gobject-introspection-enum-types.o rb-gi-boxed-info.o rb-gi-vfunc-info.o rb-gi-signal-info.o rb-gi-constant-info.o rb-gi-flags-info.o rb-gi-property-info.o rb-gi-value-info.o rb-gi-enum-info.o rb-gi-loader.o rb-gi-interface-info.o rb-gi-argument.o rb-gi-arg-info.o rb-gi-repository.o rb-gi-type-info.o rb-gi-base-info.o rb-gi-unresolved-info.o rb-gi-function-info.o rb-gi-union-info.o rb-gi-struct-info.o rb-gi-callable-info.o HDRS = $(srcdir)/gobject-introspection-enum-types.h $(srcdir)/rb-gi-types.h $(srcdir)/rb-gobject-introspection.h $(srcdir)/rbgiversion.h $(srcdir)/rb-gi-private.h $(srcdir)/rb-gi-conversions.h TARGET = gobject_introspection TARGET_NAME = gobject_introspection TARGET_ENTRY = Init_$(TARGET_NAME) DLLIB = $(TARGET).so EXTSTATIC = STATIC_LIB = TIMESTAMP_DIR = . BINDIR = $(bindir) RUBYCOMMONDIR = $(sitedir)$(target_prefix) RUBYLIBDIR = $(sitelibdir)$(target_prefix) RUBYARCHDIR = $(sitearchdir)$(target_prefix) HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) TARGET_SO = $(DLLIB) CLEANLIBS = $(TARGET).so CLEANOBJS = *.o *.bak all: $(DLLIB) static: $(STATIC_LIB) .PHONY: all install static install-so install-rb .PHONY: clean clean-so clean-static clean-rb clean-static:: clean-rb-default:: clean-rb:: clean-so:: clean: clean-so clean-static clean-rb-default clean-rb -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time distclean-rb-default:: distclean-rb:: distclean-so:: distclean-static:: distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true realclean: distclean install: install-so install-rb install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR) clean-static:: -$(Q)$(RM) $(STATIC_LIB) install-rb: pre-install-rb install-rb-default install-rb-default: pre-install-rb-default pre-install-rb: Makefile pre-install-rb-default: Makefile pre-install-rb-default: $(ECHO) installing default gobject_introspection libraries $(TIMESTAMP_DIR)/.RUBYARCHDIR.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR) $(Q) $(TOUCH) $@ site-install: site-install-so site-install-rb site-install-so: install-so site-install-rb: install-rb .SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o .cc.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .mm.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .cxx.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .cpp.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .C.o: $(ECHO) compiling $(<) $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< .c.o: $(ECHO) compiling $(<) $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< .m.o: $(ECHO) compiling $(<) $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< $(DLLIB): $(OBJS) Makefile $(ECHO) linking shared-object $(DLLIB) -$(Q)$(RM) $(@) $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) ### install-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rb-gobject-introspection.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-gobject-introspection.pc $(pkgconfigdir);\ fi ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-struct-info.c�����������0000644�0001750�0001750�00000011756�12416346617�027703� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012-2013 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGIStructInfo #define SELF(self) (RVAL2GI_STRUCT_INFO(self)) GType gi_struct_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GIStructInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_n_fields(VALUE self) { GIStructInfo *info; info = SELF(self); return INT2NUM(g_struct_info_get_n_fields(info)); } static VALUE rg_get_field(VALUE self, VALUE rb_n) { GIStructInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_struct_info_get_field(info, n)); } static gpointer extract_raw_struct(VALUE rb_struct, GIStructInfo *struct_info) { GType gtype; gpointer raw_struct; gtype = g_registered_type_info_get_g_type(struct_info); if (gtype == G_TYPE_NONE && rb_respond_to(rb_struct, rb_intern("gtype"))) { VALUE rb_gtype; rb_gtype = rb_funcall(rb_struct, rb_intern("gtype"), 0); gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0)); } if (gtype == G_TYPE_NONE) { raw_struct = DATA_PTR(rb_struct); } else { raw_struct = RVAL2BOXED(rb_struct, gtype); } return raw_struct; } static VALUE rg_get_field_value(VALUE self, VALUE rb_struct, VALUE rb_n) { GIStructInfo *info; gpointer raw_struct; gint n; GIFieldInfo *field_info; VALUE rb_value; info = SELF(self); raw_struct = extract_raw_struct(rb_struct, info); n = NUM2INT(rb_n); field_info = g_struct_info_get_field(info, n); rb_value = rb_gi_field_info_get_field_raw(field_info, raw_struct); g_base_info_unref(field_info); return rb_value; } static VALUE rg_set_field_value(VALUE self, VALUE rb_struct, VALUE rb_n, VALUE rb_value) { GIStructInfo *info; gpointer raw_struct; gint n; GIFieldInfo *field_info; info = SELF(self); raw_struct = extract_raw_struct(rb_struct, info); n = NUM2INT(rb_n); field_info = g_struct_info_get_field(info, n); rb_gi_field_info_set_field_raw(field_info, raw_struct, rb_value); /* TODO: use rb_ensure() to unref field_info. */ g_base_info_unref(field_info); return Qnil; } static VALUE rg_n_methods(VALUE self) { GIStructInfo *info; info = SELF(self); return INT2NUM(g_struct_info_get_n_methods(info)); } static VALUE rg_get_method(VALUE self, VALUE rb_n_or_name) { GIStructInfo *info; GIFunctionInfo *function_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, RUBY_T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); function_info = g_struct_info_get_method(info, n); } else { const gchar *name; name = RVAL2CSTR(rb_n_or_name); function_info = g_struct_info_find_method(info, name); } return GI_BASE_INFO2RVAL_WITH_UNREF(function_info); } static VALUE rg_size(VALUE self) { GIStructInfo *info; info = SELF(self); return UINT2NUM(g_struct_info_get_size(info)); } static VALUE rg_alignment(VALUE self) { GIStructInfo *info; info = SELF(self); return UINT2NUM(g_struct_info_get_alignment(info)); } static VALUE rg_gtype_struct_p(VALUE self) { GIStructInfo *info; info = SELF(self); return CBOOL2RVAL(g_struct_info_is_gtype_struct(info)); } static VALUE rg_foreign_p(VALUE self) { GIStructInfo *info; info = SELF(self); return CBOOL2RVAL(g_struct_info_is_foreign(info)); } void rb_gi_struct_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_STRUCT_INFO, "StructInfo", rb_mGI, rb_cGIRegisteredTypeInfo); RG_DEF_METHOD(n_fields, 0); RG_DEF_METHOD(get_field, 1); RG_DEF_METHOD(get_field_value, 2); RG_DEF_METHOD(set_field_value, 3); RG_DEF_METHOD(n_methods, 0); RG_DEF_METHOD(get_method, 1); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(alignment, 0); RG_DEF_METHOD_P(gtype_struct, 0); RG_DEF_METHOD_P(foreign, 0); } ������������������ruby-gnome2-all-2.2.5/gobject-introspection/ext/gobject-introspection/rb-gi-callable-info.c���������0000644�0001750�0001750�00000005441�12121311640�030065� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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 "rb-gi-private.h" #define RG_TARGET_NAMESPACE rb_cGICallableInfo #define SELF(self) ((GICallableInfo *)(RVAL2GI_BASE_INFO(self))) GType gi_callable_info_get_type(void) { static GType type = 0; if (type == 0) { type = g_boxed_type_register_static("GICallableInfo", (GBoxedCopyFunc)g_base_info_ref, (GBoxedFreeFunc)g_base_info_unref); } return type; } static VALUE rg_return_type(VALUE self) { GICallableInfo *info; info = SELF(self); return GI_BASE_INFO2RVAL(g_callable_info_get_return_type(info)); } static VALUE rg_caller_owns(VALUE self) { GICallableInfo *info; info = SELF(self); return GI_TRANSFER2RVAL(g_callable_info_get_caller_owns(info)); } static VALUE rg_may_return_null_p(VALUE self) { GICallableInfo *info; info = SELF(self); return CBOOL2RVAL(g_callable_info_may_return_null(info)); } static VALUE rg_n_args(VALUE self) { GICallableInfo *info; info = SELF(self); return INT2NUM(g_callable_info_get_n_args(info)); } static VALUE rg_get_arg(VALUE self, VALUE rb_n) { GICallableInfo *info; gint n; info = SELF(self); n = NUM2INT(rb_n); return GI_BASE_INFO2RVAL_WITH_UNREF(g_callable_info_get_arg(info, n)); } void rb_gi_callable_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_PARENT(GI_TYPE_CALLABLE_INFO, "CallableInfo", rb_mGI, rb_cGIBaseInfo); RG_DEF_METHOD(return_type, 0); RG_DEF_METHOD(caller_owns, 0); RG_DEF_METHOD_P(may_return_null, 0); RG_DEF_METHOD(n_args, 0); RG_DEF_METHOD(get_arg, 1); rb_gi_function_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_callback_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_signal_info_init(rb_mGI, RG_TARGET_NAMESPACE); rb_gi_vfunc_info_init(rb_mGI, RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/COPYING.LIB���������������������������������������������0000644�0001750�0001750�00000063642�12067770242�020607� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/����������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�017675� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection.rb����������������������������0000644�0001750�0001750�00000003610�12516434313�024535� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2013 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 require "glib2" module GObjectIntrospection class << self def prepend_typelib_path(path) GLib.prepend_path_to_environment_variable(path, "GI_TYPELIB_PATH") end end end base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gobject_introspection.so" rescue LoadError require "gobject_introspection.so" end vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) module GObjectIntrospection LOG_DOMAIN = "GObjectIntrospection" end GLib::Log.set_log_domain(GObjectIntrospection::LOG_DOMAIN) require "gobject-introspection/repository" require "gobject-introspection/callable-info" require "gobject-introspection/object-info" require "gobject-introspection/interface-info" require "gobject-introspection/struct-info" require "gobject-introspection/boxed-info" require "gobject-introspection/union-info" require "gobject-introspection/loader" ������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/������������������������������0000755�0001750�0001750�00000000000�12516434313�024210� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/struct-info.rb����������������0000644�0001750�0001750�00000001775�12067770242�027031� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 require "gobject-introspection/collection-reader" module GObjectIntrospection class StructInfo extend CollectionReader alias_method :__methods__, :methods collection_reader("fields") collection_reader("methods") end end ���ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/union-info.rb�����������������0000644�0001750�0001750�00000001774�12077252562�026635� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "gobject-introspection/collection-reader" module GObjectIntrospection class UnionInfo extend CollectionReader alias_method :__methods__, :methods collection_reader("fields") collection_reader("methods") end end ����ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/callable-info.rb��������������0000644�0001750�0001750�00000005151�12516434313�027227� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "gobject-introspection/collection-reader" module GObjectIntrospection class CallableInfo extend CollectionReader collection_reader("args") def in_args array_length_indexes = [] callback_indexes = [] closure_indexes = [] destroy_indexes = [] args.each_with_index do |arg, i| if arg.type.tag == TypeTag::ARRAY array_length = arg.type.array_length array_length_indexes << array_length if array_length != -1 end unless arg.scope == ScopeType::INVALID callback_indexes << i closure_index = arg.closure closure_indexes << closure_index if closure_index != -1 destroy_index = arg.destroy destroy_indexes << destroy_index if destroy_index != -1 end end args.find_all.with_index do |arg, i| case arg.direction when Direction::IN, Direction::INOUT if array_length_indexes.include?(i) false elsif callback_indexes.include?(i) false elsif closure_indexes.include?(i) false elsif destroy_indexes.include?(i) false else true end else false end end end def required_in_args in_args.reject do |arg| arg.may_be_null? end end def n_in_args in_args.size end def n_required_in_args required_in_args.size end def require_callback? args.any? do |arg| arg.direction == Direction::IN and arg.scope != ScopeType::INVALID end end def out_args args.find_all do |arg| case arg.direction when Direction::OUT, Direction::INOUT true else false end end end def n_out_args out_args.size end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/collection-reader.rb����������0000644�0001750�0001750�00000002256�12067770242�030142� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 module GObjectIntrospection module CollectionReader def collection_reader(name) n_getter = "n_#{name}" if name.end_with?("ies") singular = name.sub(/ies\z/, "y") else singular = name.sub(/s\z/, "") end getter = "get_#{singular}" define_method(name) do send(n_getter).times.collect do |i| send(getter, i) end end end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/boxed-info.rb�����������������0000644�0001750�0001750�00000001774�12147676243�026612� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "gobject-introspection/collection-reader" module GObjectIntrospection class BoxedInfo extend CollectionReader alias_method :__methods__, :methods collection_reader("fields") collection_reader("methods") end end ����ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/object-info.rb����������������0000644�0001750�0001750�00000002251�12067770242�026741� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 require "gobject-introspection/collection-reader" module GObjectIntrospection class ObjectInfo extend CollectionReader alias_method :__methods__, :methods collection_reader("interfaces") collection_reader("fields") collection_reader("properties") collection_reader("methods") collection_reader("signals") collection_reader("vfuncs") collection_reader("constants") end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/interface-info.rb�������������0000644�0001750�0001750�00000002217�12077252562�027436� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "gobject-introspection/collection-reader" module GObjectIntrospection class InterfaceInfo extend CollectionReader alias_method :__methods__, :methods collection_reader("prerequisites") collection_reader("properties") collection_reader("methods") collection_reader("signals") collection_reader("vfuncs") collection_reader("constants") end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/repository.rb�����������������0000644�0001750�0001750�00000002130�12067770242�026755� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012 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 module GObjectIntrospection class Repository include Enumerable def each(*namespaces) if namespaces.empty? namespaces = loaded_namespaces end namespaces.each do |namespace| get_n_infos(namespace).times do |i| yield(get_info(namespace, i)) end end end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/lib/gobject-introspection/loader.rb���������������������0000644�0001750�0001750�00000033337�12516434313�026014� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2012-2013 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 module GObjectIntrospection class Loader class << self def load(namespace, base_module, options={}) loader = new(base_module) loader.version = options[:version] loader.load(namespace) end end attr_accessor :version def initialize(base_module) @base_module = base_module @version = nil end def load(namespace) repository = Repository.default repository.require(namespace, @version) pre_load(repository, namespace) repository.each(namespace) do |info| load_info(info) end post_load(repository, namespace) end private def pre_load(repository, namespace) end def post_load(repository, namespace) end def load_info(info) case info when FunctionInfo load_function_info(info) when StructInfo load_struct_info(info) when BoxedInfo load_boxed_info(info) when FlagsInfo load_flags_info(info) when EnumInfo load_enum_info(info) when ObjectInfo load_object_info(info) when InterfaceInfo load_interface_info(info) when ConstantInfo load_constant_info(info) when UnionInfo load_union_info(info) end end def load_function_info(info) name = rubyish_method_name(info) define_module_function(@base_module, name, info) end def define_module_function(target_module, name, function_info) unlock_gvl = should_unlock_gvl?(function_info, target_module) validate = lambda do |arguments| method_name = "#{target_module}\#.#{name}" validate_arguments(function_info, method_name, arguments) end target_module.module_eval do define_method(name) do |*arguments, &block| validate.call(arguments, &block) function_info.invoke({ :arguments => arguments, :unlock_gvl => unlock_gvl, }, &block) end module_function(name) end end def define_singleton_method(klass, name, info) unlock_gvl = should_unlock_gvl?(info, klass) validate = lambda do |arguments| validate_arguments(info, "#{klass}.#{name}", arguments) end singleton_class = (class << klass; self; end) singleton_class.__send__(:define_method, name) do |*arguments, &block| validate.call(arguments, &block) if block.nil? and info.require_callback? Enumerator.new(self, name, *arguments) else info.invoke({ :arguments => arguments, :unlock_gvl => unlock_gvl, }, &block) end end end def define_struct(info, options={}) if info.gtype == GLib::Type::NONE klass = self.class.define_struct(info.size, info.name, @base_module, :parent => options[:parent]) else klass = self.class.define_class(info.gtype, info.name, @base_module, :parent => options[:parent], :size => info.size) end load_fields(info, klass) load_methods(info, klass) end def load_struct_info(info) return if info.gtype_struct? define_struct(info) end def define_boxed(info) klass = self.class.define_class(info.gtype, info.name, @base_module) _ = klass # TODO: Remove me. It is just for suppressing a warning. # TODO # load_fields(info, klass) # load_methods(info, klass) end def load_boxed_info(info) define_boxed(info) end def load_enum_value(value_info, enum_module) enum_module.const_set(value_info.name.upcase, value_info.value) end def define_enum(info) self.class.define_class(info.gtype, enum_class_name(info), @base_module) end def enum_class_name(info) info.name end def define_error(info) self.class.define_error(info.error_domain, error_class_name(info), @base_module, :parent => error_parent_class(info), :gtype => info.gtype) end def error_class_name(info) info.name end def error_parent_class(info) nil end def load_enum_info(info) if info.gtype == GLib::Type::NONE enum_module = Module.new info.values.each do |value_info| load_enum_value(value_info, enum_module) end @base_module.const_set(info.name, enum_module) else if info.error_domain define_error(info) else define_enum(info) end end end def load_flag_value(value_info, flags_module) flags_module.const_set(value_info.name.upcase, value_info.value) end def load_flags_info(info) if info.gtype == GLib::Type::NONE flags_module = Module.new info.values.each do |value_info| load_flag_value(value_info, flags_module) end @base_module.const_set(info.name, flags_module) else self.class.define_class(info.gtype, info.name, @base_module) end end def load_object_info(info) klass = self.class.define_class(info.gtype, info.name, @base_module) load_fields(info, klass) load_methods(info, klass) end def load_fields(info, klass) info.n_fields.times do |i| field_info = info.get_field(i) load_field(info, i, field_info, klass) end end def load_field(info, i, field_info, klass) name = field_info.name flags = field_info.flags if flags.readable? if field_info.type.tag == TypeTag::BOOLEAN reader_method_name = "#{name}?" else reader_method_name = name end klass.__send__(:define_method, reader_method_name) do || info.get_field_value(self, i) end end if flags.writable? klass.__send__(:define_method, "#{name}=") do |value| info.set_field_value(self, i, value) end end end def load_methods(info, klass) grouped_methods = info.methods.group_by do |method_info| method_info.class end grouped_methods.each do |method_info_class, method_infos| next if method_infos.empty? case method_infos.first when ConstructorInfo load_constructor_infos(method_infos, klass) when MethodInfo load_method_infos(method_infos, klass) when FunctionInfo load_function_infos(method_infos, klass) else raise "TODO: #{method_info_class}" end end end def load_constructor_infos(infos, klass) return if infos.empty? validate = lambda do |info, method_name, arguments| validate_arguments(info, "#{klass}\##{method_name}", arguments) end infos.each do |info| name = "initialize_#{info.name}" unlock_gvl = should_unlock_gvl?(info, klass) klass.__send__(:define_method, name) do |*arguments, &block| validate.call(info, name, arguments, &block) info.invoke({ :receiver => self, :arguments => arguments, :unlock_gvl => unlock_gvl, }, &block) end klass.__send__(:private, name) end find_info = lambda do |arguments| find_suitable_callable_info(infos, arguments) end klass.__send__(:define_method, "initialize") do |*arguments, &block| info = find_info.call(arguments, &block) __send__("initialize_#{info.name}", *arguments, &block) end end def validate_arguments(info, method_name, arguments) n_in_args = info.n_in_args n_required_in_args = info.n_required_in_args return if (n_required_in_args..n_in_args).cover?(arguments.size) detail = "#{arguments.size} for " if n_in_args == n_required_in_args detail << "#{n_in_args}" else detail << "#{n_required_in_args}..#{n_in_args}" end message = "#{method_name}: wrong number of arguments (#{detail})" raise ArgumentError, message end def find_suitable_callable_info(infos, arguments) min_n_args = nil max_n_args = nil candidate_infos = [] infos.each do |info| n_in_args = info.n_in_args n_required_in_args = info.n_required_in_args if (n_required_in_args..n_in_args).cover?(arguments.size) candidate_infos << info end min_n_args = [min_n_args || n_required_in_args, n_required_in_args].min max_n_args = [max_n_args || n_in_args, n_in_args].max end if candidate_infos.size == 1 return candidate_infos.first elsif candidate_infos.size > 1 candidate_info = candidate_infos.find do |info| in_arg_infos = info.in_args arguments.each.with_index.all? do |argument, i| match_argument?(in_arg_infos[i], argument) end end return candidate_info || candidate_infos.first end detail = "#{arguments.size} for #{min_n_args}" if min_n_args < max_n_args detail << "..#{max_n_args}" end raise ArgumentError, "wrong number of arguments (#{detail})" end def match_argument?(arg_info, argument) case arg_info.type.tag when TypeTag::UTF8 argument.is_a?(String) else # TODO false end end def rubyish_method_name(function_info, options={}) name = function_info.name if options[:prefix] name = name.gsub(/\A#{Regexp.escape(options[:prefix])}/, "") end return_type = function_info.return_type if return_type.tag == GObjectIntrospection::TypeTag::BOOLEAN case name when /\A(?:is|get_is)_/ "#{$POSTMATCH}?" when /\Aget_/ if function_info.n_in_args.zero? "#{$POSTMATCH}?" else name end when /\A(?:has|use)_/ "#{name}?" else name end elsif /\Aget_/ =~ name and function_info.n_in_args.zero? $POSTMATCH else case name when "to_string" "to_s" when "foreach" "each" else name end end end def should_unlock_gvl?(function_info, klass) false end def load_method_infos(infos, klass) infos.each do |info| method_name = rubyish_method_name(info) load_method_info(info, klass, method_name) end end def load_method_info(info, klass, method_name) define_method(info, klass, method_name) define_equal_style_setter(info, klass, method_name) end def define_method(info, klass, method_name) unlock_gvl = should_unlock_gvl?(info, klass) validate = lambda do |arguments| validate_arguments(info, "#{klass}\##{method_name}", arguments) end if klass.method_defined?(method_name) and klass.instance_method(method_name).owner == klass klass.__send__(:remove_method, method_name) end function_info_p = (info.class == FunctionInfo) klass.__send__(:define_method, method_name) do |*arguments, &block| arguments = [self] + arguments if function_info_p validate.call(arguments, &block) if block.nil? and info.require_callback? to_enum(method_name, *arguments) else options = { :arguments => arguments, :unlock_gvl => unlock_gvl, } options[:receiver] = self unless function_info_p info.invoke(options, &block) end end end def define_equal_style_setter(info, klass, method_name) if /\Aset_/ =~ method_name and info.n_args == 1 setter_method_name = "#{$POSTMATCH}=" if klass.method_defined?(setter_method_name) and klass.instance_method(setter_method_name).owner == klass klass.__send__(:remove_method, setter_method_name) end klass.__send__(:alias_method, setter_method_name, method_name) end end def load_function_infos(infos, klass) infos.each do |info| name = rubyish_method_name(info) next if name == "new" next if name == "alloc" define_singleton_method(klass, name, info) end end def load_interface_info(info) interface_module = self.class.define_interface(info.gtype, info.name, @base_module) load_methods(info, interface_module) end def load_constant_info(info) @base_module.const_set(info.name, info.value) end def load_union_info(info) klass = self.class.define_class(info.gtype, info.name, @base_module) load_fields(info, klass) load_methods(info, klass) end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/Makefile.lib��������������������������������������������0000644�0001750�0001750�00000022155�12446173031�021340� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� SHELL = /bin/sh # V=0 quiet, V=1 verbose. other values don't work. V = 0 Q1 = $(V:1=) Q = $(Q1:0=@) ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### srcdir = /home/kou/work/ruby/ruby-gnome2.clean/gobject-introspection topdir = /usr/include/ruby-2.1.0 hdrdir = $(topdir) arch_hdrdir = /usr/include/x86_64-linux-gnu/ruby-2.1.0 PATH_SEPARATOR = : VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby prefix = $(DESTDIR)/usr rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME) rubyarchprefix = $(archlibdir)/$(RUBY_BASE_NAME) rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) exec_prefix = $(prefix) vendorarchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/vendor_ruby sitearchhdrdir = $(sitearchincludedir)/$(RUBY_VERSION_NAME)/site_ruby rubyarchhdrdir = $(archincludedir)/$(RUBY_VERSION_NAME) vendorhdrdir = $(rubyhdrdir)/vendor_ruby sitehdrdir = $(rubyhdrdir)/site_ruby rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) vendorarchdir = $(rubysitearchprefix)/vendor_ruby/$(ruby_version) vendorlibdir = $(vendordir)/$(ruby_version) vendordir = $(rubylibprefix)/vendor_ruby sitearchdir = $(DESTDIR)/usr/local/lib/x86_64-linux-gnu/site_ruby sitelibdir = $(sitedir)/$(ruby_version) sitedir = $(DESTDIR)/usr/local/lib/site_ruby rubyarchdir = $(rubyarchprefix)/$(ruby_version) rubylibdir = $(rubylibprefix)/$(ruby_version) sitearchincludedir = $(includedir)/$(sitearch) archincludedir = $(includedir)/$(arch) sitearchlibdir = $(libdir)/$(sitearch) archlibdir = $(libdir)/$(arch) ridir = $(datarootdir)/$(RI_BASE_NAME) mandir = $(prefix)/share/man localedir = $(datarootdir)/locale libdir = $(exec_prefix)/lib psdir = $(docdir) pdfdir = $(docdir) dvidir = $(docdir) htmldir = $(docdir) infodir = $(prefix)/share/info docdir = $(datarootdir)/doc/$(PACKAGE) oldincludedir = $(DESTDIR)/usr/include includedir = $(prefix)/include localstatedir = $(DESTDIR)/var sharedstatedir = $(prefix)/com sysconfdir = $(DESTDIR)/etc datadir = $(datarootdir) datarootdir = $(prefix)/share libexecdir = $(prefix)/lib/ruby2.1 sbindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/bin archdir = $(rubyarchdir) CC = gcc CXX = g++ LIBRUBY = $(LIBRUBY_SO) LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static empty = OUTFLAG = -o $(empty) COUTFLAG = -o $(empty) RUBY_EXTCONF_H = cflags = $(optflags) $(debugflags) $(warnflags) optflags = -O3 -fno-fast-math debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration CCDLFLAGS = -fPIC CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC $(ARCH_FLAG) INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) DEFS = CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags) CXXFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat -Werror=format-security $(ARCH_FLAG) ldflags = -L. -Wl,-z,relro -L/build/ruby2.1-64qTCU/ruby2.1-2.1.5/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic dldflags = ARCH_FLAG = DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) LDSHARED = $(CC) -shared LDSHAREDXX = $(CXX) -shared AR = ar EXEEXT = RUBY_INSTALL_NAME = ruby2.1 RUBY_SO_NAME = ruby-2.1 RUBYW_INSTALL_NAME = RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) RUBYW_BASE_NAME = rubyw RUBY_BASE_NAME = ruby arch = x86_64-linux-gnu sitearch = $(arch) ruby_version = 2.1.0 ruby = $(bindir)/ruby2.1 RUBY = $(ruby) ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h RM = rm -f RM_RF = $(RUBY) -run -e rm -- -rf RMDIRS = rmdir --ignore-fail-on-non-empty -p MAKEDIRS = /bin/mkdir -p INSTALL = /usr/bin/install -c INSTALL_PROG = $(INSTALL) -m 0755 INSTALL_DATA = $(INSTALL) -m 644 COPY = cp TOUCH = exit > #### End of system configuration section. #### preload = libpath = . $(archlibdir) LIBPATH = -L. -L$(archlibdir) DEFFILE = CLEANFILES = mkmf.log DISTCLEANFILES = DISTCLEANDIRS = extout = extout_prefix = target_prefix = LOCAL_LIBS = LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc ORIG_SRCS = SRCS = $(ORIG_SRCS) OBJS = HDRS = TARGET = TARGET_NAME = TARGET_ENTRY = Init_$(TARGET_NAME) DLLIB = EXTSTATIC = STATIC_LIB = TIMESTAMP_DIR = . BINDIR = $(bindir) RUBYCOMMONDIR = $(sitedir)$(target_prefix) RUBYLIBDIR = $(sitelibdir)$(target_prefix) RUBYARCHDIR = $(sitearchdir)$(target_prefix) HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) TARGET_SO = $(DLLIB) CLEANLIBS = $(TARGET).so CLEANOBJS = *.o *.bak all: Makefile static: $(STATIC_LIB) .PHONY: all install static install-so install-rb .PHONY: clean clean-so clean-static clean-rb clean-static:: clean-rb-default:: clean-rb:: clean-so:: clean: clean-so clean-static clean-rb-default clean-rb -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time distclean-rb-default:: distclean-rb:: distclean-so:: distclean-static:: distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true realclean: distclean install: install-so install-rb install-so: Makefile install-rb: pre-install-rb install-rb-default install-rb-default: pre-install-rb-default pre-install-rb: Makefile pre-install-rb-default: Makefile pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.time install-rb-default: $(RUBYLIBDIR)/gobject-introspection.rb $(RUBYLIBDIR)/gobject-introspection.rb: $(srcdir)/lib/gobject-introspection.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection.rb $(@D) pre-install-rb-default: $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time install-rb-default: $(RUBYLIBDIR)/gobject-introspection/struct-info.rb $(RUBYLIBDIR)/gobject-introspection/struct-info.rb: $(srcdir)/lib/gobject-introspection/struct-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/struct-info.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/union-info.rb $(RUBYLIBDIR)/gobject-introspection/union-info.rb: $(srcdir)/lib/gobject-introspection/union-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/union-info.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/callable-info.rb $(RUBYLIBDIR)/gobject-introspection/callable-info.rb: $(srcdir)/lib/gobject-introspection/callable-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/callable-info.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/collection-reader.rb $(RUBYLIBDIR)/gobject-introspection/collection-reader.rb: $(srcdir)/lib/gobject-introspection/collection-reader.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/collection-reader.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/boxed-info.rb $(RUBYLIBDIR)/gobject-introspection/boxed-info.rb: $(srcdir)/lib/gobject-introspection/boxed-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/boxed-info.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/object-info.rb $(RUBYLIBDIR)/gobject-introspection/object-info.rb: $(srcdir)/lib/gobject-introspection/object-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/object-info.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/interface-info.rb $(RUBYLIBDIR)/gobject-introspection/interface-info.rb: $(srcdir)/lib/gobject-introspection/interface-info.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/interface-info.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/repository.rb $(RUBYLIBDIR)/gobject-introspection/repository.rb: $(srcdir)/lib/gobject-introspection/repository.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/repository.rb $(@D) install-rb-default: $(RUBYLIBDIR)/gobject-introspection/loader.rb $(RUBYLIBDIR)/gobject-introspection/loader.rb: $(srcdir)/lib/gobject-introspection/loader.rb $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time $(Q) $(INSTALL_DATA) $(srcdir)/lib/gobject-introspection/loader.rb $(@D) pre-install-rb-default: $(ECHO) installing default libraries $(TIMESTAMP_DIR)/.RUBYLIBDIR.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR) $(Q) $(TOUCH) $@ $(TIMESTAMP_DIR)/.RUBYLIBDIR.-.gobject-introspection.time: $(Q) $(MAKEDIRS) $(@D) $(RUBYLIBDIR)/gobject-introspection $(Q) $(TOUCH) $@ site-install: site-install-so site-install-rb site-install-so: install-so site-install-rb: install-rb �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/Makefile������������������������������������������������0000644�0001750�0001750�00000000745�12446173031�020574� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������all: (cd ext/gobject-introspection && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/gobject-introspection && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/gobject-introspection && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/gobject-introspection && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/gobject-introspection && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib ���������������������������ruby-gnome2-all-2.2.5/gobject-introspection/patches/������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�020566� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/patches/support-external-g-ir-scanner.diff��������������0000644�0001750�0001750�00000025216�12416346617�027245� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff --git a/Makefile-gir.am b/Makefile-gir.am index 52f7ee3..c03f4e2 100644 --- a/Makefile-gir.am +++ b/Makefile-gir.am @@ -68,7 +68,8 @@ GLib_2_0_gir_SCANNERFLAGS = \ --symbol-prefix=g \ --symbol-prefix=glib \ --c-include="glib.h" \ - $(GLib_2_0_gir_DOCSRC) + $(GLib_2_0_gir_DOCSRC) \ + --library-path=$(GLIB_LIBDIR) GLib_2_0_gir_PACKAGES = glib-2.0 GLib_2_0_gir_CFLAGS = \ -I$(GLIB_INCLUDEDIR) \ @@ -87,7 +88,12 @@ endif BUILT_GIRSOURCES += GLib-2.0.gir -GLib-2.0.gir: g-ir-scanner g-ir-compiler$(EXEEXT) +if BUILD_SCANNER +G_IR_SCANNER_DEPENDENCY = g-ir-scanner +else +G_IR_SCANNER_DEPENDENCY = +endif +GLib-2.0.gir: $(G_IR_SCANNER_DEPENDENCY) g-ir-compiler$(EXEEXT) gir/DBusGLib-1.0.typelib: GObject-2.0.gir @@ -105,7 +111,8 @@ GObject_2_0_gir_SCANNERFLAGS = \ --identifier-prefix=G \ --c-include="glib-object.h" \ --add-include-path=. \ - $(GObject_2_0_gir_DOCSRC) + $(GObject_2_0_gir_DOCSRC) \ + --library-path=$(GOBJECT_LIBDIR) GObject_2_0_gir_PACKAGES = gobject-2.0 GObject_2_0_gir_INCLUDES = GLib-2.0 @@ -133,7 +140,8 @@ GModule_2_0_gir_SCANNERFLAGS = \ --identifier-prefix=G \ --c-include="gmodule.h" \ --add-include-path=. \ - $(GModule_2_0_gir_DOCSRC) + $(GModule_2_0_gir_DOCSRC) \ + --library-path=$(GMODULE_LIBDIR) GModule_2_0_gir_PACKAGES = gmodule-2.0 GModule_2_0_gir_INCLUDES = GLib-2.0 @@ -171,7 +179,8 @@ Gio_2_0_gir_SCANNERFLAGS = \ --c-include="gio/gio.h" \ $(GIO_CINCLUDES) \ --add-include-path=. \ - $(Gio_2_0_gir_DOCSRC) + $(Gio_2_0_gir_DOCSRC) \ + --library-path=$(GIO_LIBDIR) Gio_2_0_gir_PACKAGES = gio-2.0 $(GIO_UNIX_PACKAGES) Gio_2_0_gir_INCLUDES = GObject-2.0 diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am index c2273cd..0f47126 100644 --- a/Makefile-giscanner.am +++ b/Makefile-giscanner.am @@ -1,17 +1,21 @@ ## Process this file with automake to produce Makefile.in +if BUILD_SCANNER BUILT_SOURCES += \ scannerparser.c \ scannerparser.h \ scannerlexer.c \ scannerlexer.h +endif AM_YFLAGS = -d -t # Why do I have to do this automake? scannerlexer.h: scannerlexer.c +if BUILD_SCANNER noinst_LTLIBRARIES += libgiscanner.la +endif libgiscanner_la_SOURCES = \ giscanner/sourcescanner.c \ @@ -24,7 +28,9 @@ libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS) $(GIO_CFLAGS) # Python module pkgpyexecdir = $(pkglibdir)/giscanner +if BUILD_SCANNER pkgpyexec_LTLIBRARIES = _giscanner.la +endif pkgpyexec_PYTHON = \ giscanner/__init__.py \ giscanner/annotationmain.py \ diff --git a/Makefile-tools.am b/Makefile-tools.am index 34d2a25..87c3a1f 100644 --- a/Makefile-tools.am +++ b/Makefile-tools.am @@ -1,5 +1,8 @@ bin_PROGRAMS += g-ir-compiler g-ir-generate + +if BUILD_SCANNER bin_SCRIPTS += g-ir-scanner g-ir-annotation-tool +endif if BUILD_DOCTOOL bin_SCRIPTS += g-ir-doc-tool @@ -12,6 +15,7 @@ EXTRA_DIST += \ TOOL_SUBSTITUTIONS = sed -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON\@,$(PYTHON), +if BUILD_SCANNER g-ir-scanner: tools/g-ir-scanner.in _giscanner.la Makefile $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $@.tmp && mv $@.tmp $@ @chmod a+x $@ @@ -19,10 +23,13 @@ g-ir-scanner: tools/g-ir-scanner.in _giscanner.la Makefile g-ir-annotation-tool: tools/g-ir-annotation-tool.in _giscanner.la Makefile $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $@.tmp && mv $@.tmp $@ @chmod a+x $@ +endif +if BUILD_DOCTOOL g-ir-doc-tool: tools/g-ir-doc-tool.in _giscanner.la Makefile $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $@.tmp && mv $@.tmp $@ @chmod a+x $@ +endif g_ir_compiler_SOURCES = tools/compiler.c g_ir_compiler_CPPFLAGS = -DGIREPO_DEFAULT_SEARCH_PATH="\"$(libdir)\"" \ @@ -46,4 +53,10 @@ GCOVSOURCES = \ $(g_ir_compiler_SOURCES) \ $(g_ir_generate_SOURCES) -CLEANFILES += g-ir-scanner g-ir-annotation-tool g-ir-doc-tool +if BUILD_SCANNER +CLEANFILES += g-ir-scanner g-ir-annotation-tool +endif + +if BUILD_DOCTOOL +CLEANFILES += g-ir-doc-tool +endif diff --git a/Makefile.am b/Makefile.am index 1a988a5..b14b745 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,8 +35,11 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-doctool man_MANS += \ docs/g-ir-compiler.1 \ - docs/g-ir-generate.1 \ + docs/g-ir-generate.1 +if BUILD_SCANNER +man_MANS += \ docs/g-ir-scanner.1 +endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gobject-introspection-1.0.pc gobject-introspection-no-export-1.0.pc diff --git a/common.mk b/common.mk index 303622f..30a011a 100644 --- a/common.mk +++ b/common.mk @@ -9,11 +9,14 @@ INTROSPECTION_SCANNER = \ env PATH=".libs:$(PATH)" \ LPATH=.libs \ - CC="$(CC)" \ + CC="$(CC)" +if BUILD_SCANNER +INTROSPECTION_SCANNER += \ PYTHONPATH=$(top_builddir):$(top_srcdir) \ UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \ - UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \ - $(top_builddir)/g-ir-scanner + UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) +endif +INTROSPECTION_SCANNER += $(G_IR_SCANNER) INTROSPECTION_SCANNER_ARGS = \ --verbose \ diff --git a/configure.ac b/configure.ac index 1fd260a..615ff18 100644 --- a/configure.ac +++ b/configure.ac @@ -250,19 +250,42 @@ AC_FUNC_STRTOD AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull]) AC_CHECK_FUNCS([backtrace backtrace_symbols]) -# Python -AM_PATH_PYTHON([2.6]) -case "$host" in -*-*-mingw*) - # Change backslashes to forward slashes in pyexecdir to avoid - # quoting issues - pyexecdir=`echo $pyexecdir | tr '\\\\' '/'` - ;; +AC_ARG_WITH(g_ir_scanner, + AS_HELP_STRING([--with-g-ir-scanner], + [Use existing g-ir-scanner instead of building. @<:@default=no@:>@]), + [], + [with_g_ir_scanner=no]) +case "x${with_g_ir_scanner}" in +xyes) + AC_PATH_PROG(G_IR_SCANNER, + [g-ir-scanner], + [AC_MSG_ERROR([g-ir-scanner not found.])]) + build_g_ir_scanner=no + ;; +xno) + # Python + AM_PATH_PYTHON([2.6]) + case "$host" in + *-*-mingw*) + # Change backslashes to forward slashes in pyexecdir to avoid + # quoting issues + pyexecdir=`echo $pyexecdir | tr '\\\\' '/'` + ;; + esac + AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found])) + if test "x$os_win32" = "xyes"; then + AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.])) + fi + G_IR_SCANNER="\$(top_builddir)/g-ir-scanner" + build_g_ir_scanner=yes + ;; +*) + G_IR_SCANNER="${with_g_ir_scanner}" + build_g_ir_scanner=no + ;; esac -AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found])) -if test "x$os_win32" = "xyes"; then - AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.])) -fi +AC_SUBST(G_IR_SCANNER) +AM_CONDITIONAL(BUILD_SCANNER, test x${build_g_ir_scanner} = xyes) dnl Not enabled by default until 3.6 cycle when we can propose mako as dnl an external dependency @@ -347,6 +370,13 @@ fi AC_SUBST(EXTRA_LINK_FLAGS) +AC_ARG_ENABLE(tests, + [AS_HELP_STRING([--disable-tests], + [disable tests])], + [], + [enable_tests=yes]) +AM_CONDITIONAL(ENABLE_TESTS, test x"$enable_tests" = xyes) + AC_CONFIG_FILES([ Makefile tests/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index bdd0fa7..70f1825 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,7 +17,9 @@ tests_DATA = \ gimarshallingtests.h \ gitestmacros.h +if ENABLE_TESTS EXTRA_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la +endif libeverything_1_0_la_SOURCES = everything.c libgimarshallingtests_1_0_la_SOURCES = gimarshallingtests.c @@ -27,7 +29,9 @@ EXTRA_DIST += \ gi-tester \ gitestmacros.h +if ENABLE_TESTS BUILT_SOURCES += everything.c everything.h +endif CLEANFILES += \ $(BUILT_SOURCES) \ diff --git a/tests/offsets/Makefile.am b/tests/offsets/Makefile.am index 65d8773..66b00b1 100644 --- a/tests/offsets/Makefile.am +++ b/tests/offsets/Makefile.am @@ -11,7 +11,9 @@ EXTRA_PROGRAMS = ############################################################ +if ENABLE_TESTS EXTRA_LTLIBRARIES += liboffsets.la +endif liboffsets_la_SOURCES = \ offsets.h \ @@ -32,7 +34,9 @@ CLEANFILES += Offsets-1.0.gir Offsets-1.0.typelib liboffsets.la ############################################################ +if ENABLE_TESTS EXTRA_PROGRAMS += gitestoffsets +endif nodist_gitestoffsets_SOURCES = gitestoffsets.c gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_srcdir)/tests @@ -41,9 +45,11 @@ gitestoffsets_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS) gitestoffsets.c: gen-gitestoffsets offsets.h Offsets-1.0.typelib $(AM_V_GEN) $(PYTHON) $(srcdir)/gen-gitestoffsets $(srcdir)/offsets.h > $@ || ( rm -f $@ && false ) +if ENABLE_TESTS EXTRA_DIST += gen-gitestoffsets BUILT_SOURCES += gitestoffsets.c CLEANFILES += gitestoffsets.c $(EXTRA_PROGRAMS) +endif ############################################################ diff --git a/tests/repository/Makefile.am b/tests/repository/Makefile.am index 882fa9e..89c9069 100644 --- a/tests/repository/Makefile.am +++ b/tests/repository/Makefile.am @@ -2,8 +2,10 @@ AM_CFLAGS = $(GOBJECT_CFLAGS) AM_LDFLAGS = -module -avoid-version LIBS = $(GOBJECT_LIBS) +if ENABLE_TESTS EXTRA_PROGRAMS = gitestrepo gitestthrows gitypelibtest CLEANFILES = $(EXTRA_PROGRAMS) +endif gitestrepo_SOURCES = $(srcdir)/gitestrepo.c gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am index 92ab12a..41f4de8 100644 --- a/tests/scanner/Makefile.am +++ b/tests/scanner/Makefile.am @@ -9,6 +9,7 @@ INTROSPECTION_SCANNER_ARGS += --warn-all CLEANFILES = +if ENABLE_TESTS EXTRA_LTLIBRARIES = \ libsletter.la \ libutility.la \ @@ -19,6 +20,7 @@ EXTRA_LTLIBRARIES = \ libtypedefs.la \ $(NULL) CLEANFILES += $(EXTRA_LTLIBRARIES) +endif GI_SCANNER_CFLAGS = -I$(top_srcdir)/tests AM_CPPFLAGS = -I$(top_srcdir)/girepository @@ -147,7 +149,7 @@ Typedefs_1_0_gir_FILES = $(libtypedefs_la_SOURCES) Typedefs_1_0_gir_SCANNERFLAGS = --c-include="typedefs.h" --identifier-prefix=Typedefs --symbol-prefix=typedefs GIRS += Typedefs-1.0.gir -if !OS_WIN32 +if ENABLE_TESTS EXTRA_PROGRAMS = barapp CLEANFILES += $(EXTRA_PROGRAMS) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gobject-introspection/patches/cross-g-ir-scanner.diff�������������������������0000644�0001750�0001750�00000003556�12416346617�025045� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py index 1c66aac..e922feb 100644 --- a/giscanner/ccompiler.py +++ b/giscanner/ccompiler.py @@ -137,17 +137,16 @@ class CCompiler(object): is_msvc = False libtool = utils.get_libtool_command(options) if libtool: - args.append(utils.which(os.environ.get('SHELL', 'sh.exe'))) args.extend(libtool) args.append('--mode=execute') - # FIXME: it could have prefix (i686-w64-mingw32-dlltool.exe) - args.extend(['dlltool.exe', '--identify']) + args.extend([compiler_cmd.replace('gcc', 'dlltool'), '--identify']) proc = subprocess.Popen([compiler_cmd, '-print-search-dirs'], stdout=subprocess.PIPE) o, e = proc.communicate() for line in o.splitlines(): if line.startswith('libraries: '): libsearch = line[len('libraries: '):].split(';') + libsearch = options.library_paths + libsearch shlibs = [] not_resolved = [] diff --git a/giscanner/dumper.py b/giscanner/dumper.py index 45a09fc..3c70be6 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -160,6 +160,7 @@ class DumpCompiler(object): else: o_path = self._generate_tempfile(tmpdir, '.o') + os.name = 'nt' if os.name == 'nt': ext = '.exe' else: @@ -263,10 +264,7 @@ class DumpCompiler(object): else: args.extend(['-o', output]) if libtool: - if os.name == 'nt': - args.append('-Wl,--export-all-symbols') - else: - args.append('-export-dynamic') + args.append('-export-dynamic') cppflags = os.environ.get('CPPFLAGS', '') for cppflag in cppflags.split(): ��������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/�������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�013461� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�014452� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gc.rb����������������������������������������������������������0000644�0001750�0001750�00000000764�11701304107�016416� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������require 'test/unit' require 'gtk2' class TestGC < Test::Unit::TestCase priority :must def test_closure 10.times do invisible = Gtk::Invisible.new invisible.signal_connect("destroy") {} GC.start end end def test_inheritance_and_gc button = Class.new(Gtk::Button) box = Gtk::HBox.new n = 10 n.times do box.add(button.new) end GC.start assert_equal([button] * 10, box.children.collect {|item| item.class}) end end ������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_menu_item.rb�����������������������������������������������0000644�0001750�0001750�00000000435�11701304107�020647� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkMenuItem < Test::Unit::TestCase include GtkTestUtils def test_new_with_label item = Gtk::MenuItem.new("Label") assert_equal("Label", item.label) end def test_new_with_nil_label item = Gtk::MenuItem.new(nil) assert_equal("", item.label) end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_display.rb�������������������������������������������������0000644�0001750�0001750�00000002204�11701304107�020306� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkDisplay < Test::Unit::TestCase include GtkTestUtils def test_supports_predicates display = Gdk::Display.default assert_boolean(display.supports_shapes?) assert_boolean(display.supports_input_shapes?) only_gtk_version(2, 12, 0) assert_boolean(display.supports_composite?) end def test_startup_notification_id only_gtk_version(2, 12, 0) only_x11 display = Gdk::Display.default assert_nil(display.startup_notification_id) end def test_broadcast_startup_message omit("Not yet implemented (GNOME bug #528020)") only_gtk_version(2, 16, 0) only_x11 id = "#{$$}_TIME_#{Time.now.to_i}" screen = Gdk::Screen.default.number.to_s assert_nothing_raised do Gdk::Display.default.broadcast_startup_message("new", "ID" => id, "NAME" => "Hello World", "SCREEN" => screen) Gdk::Display.default.broadcast_startup_message("remove", "ID" => id) end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_about_dialog.rb��������������������������������������������0000644�0001750�0001750�00000000526�11701304107�021317� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkAboutDialog < Test::Unit::TestCase include GtkTestUtils def setup @dialog = Gtk::AboutDialog.new end def test_program_name only_gtk_version(2, 12, 0) assert_equal(File.basename($0), @dialog.program_name) @dialog.program_name = "my-program" assert_equal("my-program", @dialog.program_name) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_window_attribute.rb����������������������������������������0000644�0001750�0001750�00000000474�11701304107�022242� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkWindowAttribute < Test::Unit::TestCase include GtkTestUtils def test_initialize attrs = Gdk::WindowAttr.new(100, 100, :only, :temp) assert_equal([100, 100, Gdk::Window::INPUT_ONLY, Gdk::Window::TEMP], [attrs.width, attrs.height, attrs.wclass, attrs.window_type]) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_entry.rb���������������������������������������������������0000644�0001750�0001750�00000000724�11701304107�020027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkEntry < Test::Unit::TestCase include GtkTestUtils def setup @entry = Gtk::Entry.new end def test_cursor_hadjustment only_gtk_version(2, 12) assert_nil(@entry.cursor_hadjustment) adjustment = Gtk::Adjustment.new(0.0, 0.0, 100.0, 100.0, 1.0, 1.0) @entry.cursor_hadjustment = adjustment assert_equal(adjustment, @entry.cursor_hadjustment) end end ��������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_buildable.rb�����������������������������������������������0000644�0001750�0001750�00000002656�11701304107�020617� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkBuildable < Test::Unit::TestCase include GtkTestUtils def setup @buildable = Gtk::HBox.new end def test_name only_gtk_version(2, 12, 0) assert_equal("", @buildable.name) @buildable.name = "YYY" assert_equal("YYY", @buildable.name) @buildable.name = nil assert_equal("", @buildable.name) end def test_add_child only_gtk_version(2, 12, 0) assert_equal([], @buildable.children) builder = Gtk::Builder.new entry = Gtk::Entry.new @buildable.add_child(builder, entry) assert_equal([entry], @buildable.children) end def test_set_buildable_property only_gtk_version(2, 12, 0) assert_nil(@buildable.parent) builder = Gtk::Builder.new parent = Gtk::HBox.new @buildable.set_buildable_property(builder, "parent", parent) assert_equal(parent, @buildable.parent) end def test_construct_child only_gtk_version(2, 12, 0) assert_nil(@buildable.parent) @buildable = Gtk::UIManager.new @buildable.add_ui(<<-EOU) <ui> <toolbar name='Toolbar'> </toolbar> </ui> EOU builder = Gtk::Builder.new assert_kind_of(Gtk::Toolbar, @buildable.construct_child(builder, "Toolbar")) end def test_get_internal_child only_gtk_version(2, 12, 0) assert_nil(@buildable.parent) @buildable = Gtk::Dialog.new builder = Gtk::Builder.new assert_kind_of(Gtk::VBox, @buildable.get_internal_child(builder, "vbox")) end end ����������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_recent_data.rb���������������������������������������������0000644�0001750�0001750�00000001660�12124610262�021141� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkRecentData < Test::Unit::TestCase def test_mime_type data = Gtk::RecentData.new assert_nil(data.mime_type) end end ��������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_pixbuf.rb��������������������������������������������������0000644�0001750�0001750�00000002365�12416346617�020166� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestGdkPixbuf < Test::Unit::TestCase def test_from_drawable colormap = nil gdk_window = Gdk::Window.default_root_window src_x = 0 src_y = 0 width, height = gdk_window.size assert_nothing_raised do Gdk::Pixbuf.from_drawable(colormap, gdk_window, src_x, src_y, width, height) end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_selection_data.rb������������������������������������������0000644�0001750�0001750�00000001022�11701304107�021614� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestSelectionData < Test::Unit::TestCase def setup @window = Gtk::Invisible.new.window end def test_type_integer name = "ID" value = 10 Gdk::Property.change(@window, name, Gdk::Selection::TYPE_INTEGER, :replace, value) assert_equal([Gdk::Selection::TYPE_INTEGER, [value]], Gdk::Property.get(@window, name, Gdk::Selection::TYPE_INTEGER, false)[0, 2]) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_gc.rb������������������������������������������������������0000644�0001750�0001750�00000000200�11701304107�017224� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkGC < Test::Unit::TestCase include GtkTestUtils def test_constant assert_const_defined(Gdk, :GC) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/run-test.rb���������������������������������������������������������0000755�0001750�0001750�00000001703�12002536277�016556� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gtk_base = File.join(ruby_gnome2_base, "gtk2") [[glib_base, "glib2"], [atk_base, "atk"], [pango_base, "pango"], [gdk_pixbuf_base, "gdk_pixbuf2"], [gtk_base, "gtk2"]].each do |target, module_name| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require 'glib-test-init' $LOAD_PATH.unshift(File.join(gtk_base, "test")) require 'gtk-test-utils' require 'gtk2' exit Test::Unit::AutoRunner.run(true) �������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_icon_theme.rb����������������������������������������������0000644�0001750�0001750�00000001415�12257552167�021020� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkIconTheme < Test::Unit::TestCase include GtkTestUtils def setup @theme = Gtk::IconTheme.default end def test_choose_icon only_gtk_version(2, 12) assert_nil(@theme.choose_icon("non-existent", 100)) icon = @theme.choose_icon("face-cool", 10) assert_not_nil(icon) assert_match(/face-cool/, icon.filename) assert_not_nil(@theme.choose_icon("face-cool", 29, [:use_builtin, :no_svg])) end def test_contexts only_gtk_version(2, 12) assert_operator(@theme.contexts, :include?, "MimeTypes") end class TestIcons < self def test_no_argument assert_operator(@theme.icons, :include?, "face-cool") end def test_context assert_operator(@theme.icons("Actions"), :include?, "find") end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_color.rb���������������������������������������������������0000644�0001750�0001750�00000000423�11701304107�017760� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkColor < Test::Unit::TestCase def test_to_s color = Gdk::Color.new(0xffff, 0x1234, 0xabcd) if Gtk.check_version?(2, 12, 0) assert_equal("#ffff1234abcd", color.to_s) else assert_match(/\A#<Gdk::Color:.*>\z/, color.to_s) end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_widget.rb��������������������������������������������������0000644�0001750�0001750�00000001253�11701304107�020147� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkWidget < Test::Unit::TestCase include GtkTestUtils def setup @widget = Gtk::Invisible.new end def test_set_window attrs = Gdk::WindowAttr.new(100, 100, :only, :temp) window = Gdk::Window.new(nil, attrs, 0) @widget.window = window assert_equal(window, @widget.window) end def test_modify_color_component_with_nil_color assert_nothing_raised do @widget.modify_base(:normal, nil) end assert_nothing_raised do @widget.modify_text(:normal, nil) end assert_nothing_raised do @widget.modify_fg(:normal, nil) end assert_nothing_raised do @widget.modify_bg(:normal, nil) end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_list_store.rb����������������������������������������������0000644�0001750�0001750�00000003730�12102213526�021055� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkListStore < Test::Unit::TestCase include GtkTestUtils ID = 0 NAME = 1 COLUMNS = { ID => Integer, NAME => String, } def setup columns = COLUMNS.keys.sort.collect do |key| COLUMNS[key] end @store = Gtk::ListStore.new(*columns) end def test_set_values only_gtk_version(2, 12) iter = @store.append assert_nothing_raised do @store.set_values(iter, [0, '1']) end assert_equal([0, '1'], [iter[0], iter[1]]) iter = @store.append assert_nothing_raised do @store.set_values(iter, [2, '3']) end assert_equal([2, '3'], [iter[0], iter[1]]) assert_nothing_raised do @store.set_values(iter, []) end assert_equal([2, '3'], [iter[0], iter[1]]) end def test_set_values_with_hash only_gtk_version(2, 12) iter = @store.append assert_nothing_raised do @store.set_values(iter, {ID => 0, NAME => 'me'}) end assert_equal([0, 'me'], [iter[ID], iter[NAME]]) iter = @store.append assert_nothing_raised do @store.set_values(iter, {NAME => 'you', ID => 2}) end assert_equal([2, 'you'], [iter[ID], iter[NAME]]) assert_nothing_raised do @store.set_values(iter, {NAME => "she"}) end assert_equal([2, 'she'], [iter[ID], iter[NAME]]) assert_nothing_raised do @store.set_values(iter, {}) end assert_equal([2, 'she'], [iter[ID], iter[NAME]]) end def test_iter_gc n_iterators = count_objects(Gtk::TreeIter) 50.times do |i| iter = @store.append iter[ID] = i iter[NAME] = i.to_s end 100.times do @store.iter_first end iter = @store.iter_first while @store.remove(iter); end iter = nil assert_equal(0, @store.to_enum(:each).to_a.size) GC.start assert_equal(n_iterators, count_objects(Gtk::TreeIter)) end private def count_objects(klass) n_objects = ObjectSpace.each_object(Gtk::TreeIter) do # do nothing end n_objects end end ����������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk.rb���������������������������������������������������������0000644�0001750�0001750�00000000646�11701304107�016571� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdk < Test::Unit::TestCase include GtkTestUtils def test_notify_startup_complete assert_nothing_raised do Gdk.notify_startup_complete end notify_with_id = Proc.new do Gdk.notify_startup_complete("startup-id") end if Gtk.check_version?(2, 12, 0) assert_nothing_raised(¬ify_with_id) else assert_raise(NotImplementedError, ¬ify_with_id) end end end ������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_builder.rb�������������������������������������������������0000644�0001750�0001750�00000010602�11701304107�020310� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkBuilder < Test::Unit::TestCase include GtkTestUtils def test_constants only_gtk_version(2, 12, 0) assert_kind_of(Gtk::BuilderError, Gtk::BuilderError::INVALID_TAG) end def test_new only_gtk_version(2, 12, 0) assert_nothing_raised do Gtk::Builder.new end end def test_add_from_file only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nothing_raised do builder.add_from_file(ui_definition_file.path) end assert_kind_of(Gtk::Dialog, builder["dialog1"]) end def test_add_from_string only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nothing_raised do builder.add_from_string(ui_definition) end assert_kind_of(Gtk::VBox, builder["vbox1"]) end def test_add_with_file only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nothing_raised do builder.add(ui_definition_file.path) end assert_kind_of(Gtk::HButtonBox, builder["hbuttonbox1"]) end def test_add_with_string only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nothing_raised do builder.add(ui_definition) end assert_kind_of(Gtk::Button, builder["ok_button"]) end def test_add_chain only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nothing_raised do builder << ui_definition_file.path << ui_definition_simple end assert_kind_of(Gtk::Dialog, builder["dialog1"]) assert_kind_of(Gtk::Window, builder["main-window"]) end def test_objects only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nothing_raised do builder << ui_definition_file.path << ui_definition_simple end assert_equal(["dialog1", "vbox1", "hbuttonbox1", "ok_button", "main-window"].sort, builder.objects.collect {|object| object.builder_name}.sort) end def test_translation_domain only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nil(builder.translation_domain) builder.translation_domain = "ruby-gnome2" assert_equal("ruby-gnome2", builder.translation_domain) end def test_connect_signals only_gtk_version(2, 12, 0) handler_names = [] builder = Gtk::Builder.new builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal([].sort, handler_names.sort) builder << ui_definition ok_button = builder["ok_button"] builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal(["ok_button_clicked"].sort, handler_names.sort) end def test_connect_signals_with_no_signal_ui_definition only_gtk_version(2, 12, 0) handler_names = [] builder = Gtk::Builder.new builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal([].sort, handler_names.sort) builder << ui_definition_simple builder.connect_signals do |name| handler_names << name Proc.new {} end assert_equal([].sort, handler_names.sort) end def test_get_type_from_name only_gtk_version(2, 12, 0) builder = Gtk::Builder.new assert_nil(builder.get_type("XXX")) assert_equal(Gtk::VBox, builder.get_type("GtkVBox")) end private def ui_definition <<-EOX <interface> <object class="GtkDialog" id="dialog1"> <child internal-child="vbox"> <object class="GtkVBox" id="vbox1"> <property name="border-width">10</property> <child internal-child="action_area"> <object class="GtkHButtonBox" id="hbuttonbox1"> <property name="border-width">20</property> <child> <object class="GtkButton" id="ok_button"> <property name="label">gtk-ok</property> <property name="use-stock">TRUE</property> <signal name="clicked" handler="ok_button_clicked"/> </object> </child> </object> </child> </object> </child> </object> </interface> EOX end def ui_definition_simple <<-EOX <interface> <object class="GtkWindow" id="main-window"> </object> </interface> EOX end def ui_definition_with_signal <<-EOX <interface> <object class="GtkWindow" id="main-window"> </object> </interface> EOX end def ui_definition_file xml = Tempfile.new("Gtk::Builder") xml.print(ui_definition) xml.close xml end end ������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_recent_filter_info.rb��������������������������������������0000644�0001750�0001750�00000001762�12124610262�022533� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkRecentFilterInfo < Test::Unit::TestCase include GtkTestUtils def test_contains info = Gtk::RecentFilterInfo.new assert_equal(Gtk::RecentFilter::Flags.new, info.contains) end end ��������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_infobar.rb�������������������������������������������������0000644�0001750�0001750�00000002061�12307003726�020310� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestGtkInfoBar < Test::Unit::TestCase include GtkTestUtils def setup @infobar = Gtk::InfoBar.new end def test_message_type_accessors type_error = Gtk::MessageType::ERROR @infobar.message_type = type_error assert_equal(type_error, @infobar.message_type) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_allocation.rb����������������������������������������������0000644�0001750�0001750�00000001711�12124610262�021012� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkAllocation < Test::Unit::TestCase def test_width allocation = Gtk::Allocation.new(0, 10, 20, 30) assert_equal(20, allocation.width) end end �������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/gtk-test-utils.rb���������������������������������������������������0000644�0001750�0001750�00000000501�11701304107�017653� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������require 'tempfile' module GtkTestUtils private def only_gtk_version(major, minor, micro=nil) micro ||= 0 unless Gtk.check_version?(major, minor, micro) omit("Require GTK+ >= #{major}.#{minor}.#{micro}") end end def only_x11 omit("Only for X11 backend") unless Gdk.windowing_x11? end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_border.rb��������������������������������������������������0000644�0001750�0001750�00000001670�12124610262�020146� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkBorder < Test::Unit::TestCase def test_left border = Gtk::Border.new(10, 15, 20, 25) assert_equal(10, border.left) end end ������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_image.rb���������������������������������������������������0000644�0001750�0001750�00000000335�11701304107�017746� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkImage < Test::Unit::TestCase include GtkTestUtils def test_stock image = Gtk::Image.new(Gtk::Stock::GO_FORWARD, Gtk::IconSize::DIALOG) assert_equal(Gtk::Stock::GO_FORWARD, image.stock) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_unix_print.rb����������������������������������������������0000644�0001750�0001750�00000000623�11701304107�021063� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkUnixPrint < Test::Unit::TestCase def test_classes if GLib.os_unix? assertion = :assert_const_defined else assertion = :assert_not_const_defined end send(assertion, Gtk, :PageSetupUnixDialog) send(assertion, Gtk, :Printer) send(assertion, Gtk, :PrintCapabilities) send(assertion, Gtk, :PrintJob) send(assertion, Gtk, :PrintUnixDialog) end end �������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_tree_path.rb�����������������������������������������������0000644�0001750�0001750�00000000763�11701304107�020644� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkTreePath < Test::Unit::TestCase include GtkTestUtils def test_compare assert_equal(-1, tree_path("0") <=> tree_path("1")) assert_equal(0, tree_path("0") <=> tree_path("0")) assert_equal(1, tree_path("1") <=> tree_path("0")) end def test_equal assert_equal(tree_path("0"), tree_path("0")) assert_not_equal(tree_path("0"), tree_path("1")) assert_not_equal(tree_path("0"), "0") end private def tree_path(path) Gtk::TreePath.new(path) end end �������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_rectangle.rb�����������������������������������������������0000644�0001750�0001750�00000001705�12124610262�020614� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGdkRectangle < Test::Unit::TestCase def test_width rectangle = Gdk::Rectangle.new(0, 10, 20, 30) assert_equal(20, rectangle.width) end end �����������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_rc_style.rb������������������������������������������������0000644�0001750�0001750�00000000560�11701304107�020510� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGtkRcStyle < Test::Unit::TestCase include GtkTestUtils def setup @style = Gtk::RcStyle.new end def test_color_flags assert_equal(Gtk::RC::Flags.new, @style.color_flags(:normal)) @style.set_color_flags(:normal, [:fg, :bg]) assert_equal(Gtk::RC::Flags::FG | Gtk::RC::Flags::BG, @style.color_flags(:normal)) end end ������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_event.rb���������������������������������������������������0000644�0001750�0001750�00000000661�12307003726�017775� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkEvent < Test::Unit::TestCase include GtkTestUtils class TestMotion < self def test_request only_gtk_version(2, 12, 0) motion = Gdk::EventMotion.new assert_nothing_raised do motion.request end end end class TestButton < self def setup @button = Gdk::EventButton.new(:button_press) end def test_window assert_nil(@button.window) end end end �������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_accel_group_entry.rb���������������������������������������0000644�0001750�0001750�00000001676�12124610262�022403� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkAccelGroupEntry < Test::Unit::TestCase def test_accel_path entry = Gtk::AccelGroupEntry.new assert_nil(entry.accel_path) end end ������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_keymap.rb��������������������������������������������������0000644�0001750�0001750�00000000305�11701304107�020127� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkKeymap < Test::Unit::TestCase include GtkTestUtils def test_have_bidi_layouts? only_gtk_version(2, 12, 0) assert_boolean(Gdk::Keymap.default.have_bidi_layouts?) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_geometry.rb������������������������������������������������0000644�0001750�0001750�00000001671�12124610262�020505� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGdkGeometry < Test::Unit::TestCase def test_min_width geometry = Gdk::Geometry.new assert_equal(0, geometry.min_width) end end �����������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_pango.rb���������������������������������������������������0000644�0001750�0001750�00000000402�11701304107�017743� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkPango < Test::Unit::TestCase include GtkTestUtils def test_emboss_color_attribute only_gtk_version(2, 12, 0) color = Gdk::PangoAttrEmbossColor.new(Gdk::Color.parse("red")) assert_equal([65535, 0, 0], color.value.to_a) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gtk_accel_key.rb�����������������������������������������������0000644�0001750�0001750�00000001647�12124610262�020614� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestGtkAccelKey < Test::Unit::TestCase def test_flags key = Gtk::AccelKey.new assert_equal(0, key.flags) end end �����������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/test/test_gdk_window.rb��������������������������������������������������0000644�0001750�0001750�00000001422�12307003726�020157� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������class TestGdkWindow < Test::Unit::TestCase include GtkTestUtils def setup @window = Gtk::Invisible.new.window end def test_set_composited only_gtk_version(2, 12, 0) assert_nothing_raised do @window.composited = false end end def test_set_opacity only_gtk_version(2, 12, 0) assert_nothing_raised do @window.opacity = 0.5 end end def test_set_startup_id only_gtk_version(2, 12, 0) assert_nothing_raised do @window.startup_id = "startup-id" @window.startup_id = nil end end def test_cursor_accessors only_gtk_version(2, 18, 0) arrow_type = Gdk::Cursor::Type::ARROW cursor = Gdk::Cursor.new(arrow_type) @window.cursor = cursor assert_kind_of(Gdk::Cursor, @window.cursor) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/extconf.rb���������������������������������������������������������������0000644�0001750�0001750�00000002223�11701304107�015445� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "gtk2" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/Rakefile�����������������������������������������������������������������0000644�0001750�0001750�00000003357�12446221322�015134� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2/rake/package-task' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/GTK2 is a Ruby binding of GTK+-2.x." package.description = "Ruby/GTK2 is a Ruby binding of GTK+-2.x." package.dependency.gem.runtime = ["atk", "pango", "gdk_pixbuf2"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "atk", "pango", "gdk_pixbuf2", ] package.external_packages = [ { :name => "gtk+", :download_site => :gnome, :label => "gtk+", :version => "2.24.25", :compression_method => "xz", :windows => { :configure_args => [ "--with-included-immodules", ], :need_autoreconf => true, :patches => [ "gtk+-2.24.25-add-missing-exeext-and-fix-directory.diff", "gtk+-2.24.22-remove-PRIVATE-from-def.diff", ], :built_file => "bin/libgtk-win32-2.0-0.dll", }, }, { :name => "hicolor-icon-theme", :download_base_url => "http://icon-theme.freedesktop.org/releases", :label => "gtk-hi-color-icon-theme", :version => "0.13", :windows => { :configure_args => [], :build_concurrently => false, :built_file => "share/icons/hicolor/index.theme", } }, ] end package_task.define namespace :windows do desc "create default gtkrc" task :gtkrc do gtkrc_path = File.join("vendor", "local", "etc", "gtk-2.0", "gtkrc") mkdir_p(File.dirname(gtkrc_path)) File.open(gtkrc_path, "w") do |gtkrc| gtkrc.puts('gtk-theme-name = "MS-Windows"') end end namespace :builder do task :after => ["windows:gtkrc"] end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/���������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014253� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12446160551�015134� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkentrycompletion.c������������������������������������������0000644�0001750�0001750�00000007042�12257552167�021600� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } static VALUE rg_insert_prefix(VALUE self) { gtk_entry_completion_insert_prefix(_SELF(self)); return self; } 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 void Init_gtk_entry_completion(VALUE mGtk) { 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); RG_DEF_METHOD(insert_prefix, 0); 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 } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhpaned.c���������������������������������������������������0000644�0001750�0001750�00000002543�11701304107�017563� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHPaned static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_hpaned_new()); return Qnil; } void Init_gtk_hpaned(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HPANED, "HPaned", mGtk); RG_DEF_METHOD(initialize, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkicontheme.c������������������������������������������������0000644�0001750�0001750�00000016512�12257552167�020322� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cIconTheme #define _SELF(i) GTK_ICON_THEME(RVAL2GOBJ(i)) #define RVAL2ICON_LOOKUP_FLAGS(flags) (RVAL2GFLAGS(flags, GTK_TYPE_ICON_LOOKUP_FLAGS)) #define ICON_INFO2RVAL(info) (BOXED2RVAL(info, GTK_TYPE_ICON_INFO)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_icon_theme_new()); return Qnil; } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_icon_theme_get_default()); } static VALUE rg_s_get_for_screen(G_GNUC_UNUSED VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_icon_theme_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); } static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_icon_theme_set_screen(_SELF(self), GDK_SCREEN(RVAL2GOBJ(screen))); return self; } static VALUE rg_set_search_path(VALUE self, VALUE rbpath) { GtkIconTheme *theme = _SELF(self); long n; const gchar **path = RVAL2STRS(rbpath, n); gtk_icon_theme_set_search_path(theme, path, n); g_free(path); return self; } static VALUE rg_search_path(VALUE self) { gchar **path; gtk_icon_theme_get_search_path(_SELF(self), &path, NULL); return STRV2RVAL_FREE(path); } static VALUE rg_append_search_path(VALUE self, VALUE path) { gtk_icon_theme_append_search_path(_SELF(self), RVAL2CSTR(path)); return self; } static VALUE rg_prepend_search_path(VALUE self, VALUE path) { gtk_icon_theme_prepend_search_path(_SELF(self), RVAL2CSTR(path)); return self; } static VALUE rg_set_custom_theme(VALUE self, VALUE theme_name) { gtk_icon_theme_set_custom_theme(_SELF(self), NIL_P(theme_name) ? NULL : RVAL2CSTR(theme_name)); return self; } static VALUE rg_has_icon_p(VALUE self, VALUE icon_name) { return CBOOL2RVAL(gtk_icon_theme_has_icon(_SELF(self), RVAL2CSTR(icon_name))); } static VALUE rg_lookup_icon(VALUE self, VALUE icon_name, VALUE size, VALUE flags) { GtkIconInfo* info; info = gtk_icon_theme_lookup_icon(_SELF(self), RVAL2CSTR(icon_name), NUM2INT(size), RVAL2ICON_LOOKUP_FLAGS(flags)); return ICON_INFO2RVAL(info); } static VALUE rg_load_icon(VALUE self, VALUE icon_name, VALUE size, VALUE flags) { GError *error = NULL; GdkPixbuf *pixbuf; pixbuf = gtk_icon_theme_load_icon(_SELF(self), RVAL2CSTR(icon_name), NUM2INT(size), RVAL2ICON_LOOKUP_FLAGS(flags), &error); if (!pixbuf) RAISE_GERROR(error); return GOBJ2RVAL(pixbuf); } static VALUE rg_icons(int argc, VALUE *argv, VALUE self) { VALUE context; GList *icons; rb_scan_args(argc, argv, "01", &context); icons = gtk_icon_theme_list_icons(_SELF(self), RVAL2CSTR_ACCEPT_NIL(context)); return GLIST2ARY_STR_FREE(icons); } static VALUE rg_get_icon_sizes(VALUE self, VALUE icon_name) { VALUE ary = rb_ary_new(); gint* sizes = gtk_icon_theme_get_icon_sizes(_SELF(self), RVAL2CSTR(icon_name)); gint* tmp_sizes = sizes; while (*tmp_sizes) { rb_ary_push(ary, INT2NUM(*tmp_sizes)); tmp_sizes++; } g_free(sizes); return ary; } static VALUE rg_example_icon_name(VALUE self) { return CSTR2RVAL_FREE(gtk_icon_theme_get_example_icon_name(_SELF(self))); } static VALUE rg_rescan_if_needed(VALUE self) { return CBOOL2RVAL(gtk_icon_theme_rescan_if_needed(_SELF(self))); } static VALUE rg_s_add_builtin_icon(VALUE self, VALUE icon_name, VALUE size, VALUE pixbuf) { gtk_icon_theme_add_builtin_icon(RVAL2CSTR(icon_name), NUM2INT(size), GDK_PIXBUF(RVAL2GOBJ(pixbuf))); return self; } #if GTK_CHECK_VERSION(2, 12, 0) static VALUE rg_choose_icon(int argc, VALUE *argv, VALUE self) { VALUE rb_icon_names, rb_size, rb_flags; gint size; const gchar **icon_names; GtkIconLookupFlags flags; GtkIconInfo *info; rb_scan_args(argc, argv, "21", &rb_icon_names, &rb_size, &rb_flags); if (RVAL2CBOOL(rb_obj_is_kind_of(rb_icon_names, rb_cString))) { icon_names = ALLOCA_N(const gchar *, 2); icon_names[0] = RVAL2CSTR(rb_icon_names); icon_names[1] = NULL; } else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_icon_names, rb_cArray))) { icon_names = RVAL2STRV(rb_icon_names); } else { rb_raise(rb_eArgError, "expected (name, size), (name, size, flags), " "([name1, name2, ...], size) or " "([name1, name2, ...], size, flags): %s", RBG_INSPECT(rb_ary_new4(argc, argv))); } size = NUM2INT(rb_size); if (NIL_P(rb_flags)) { flags = GTK_ICON_LOOKUP_GENERIC_FALLBACK; } else { flags = RVAL2ICON_LOOKUP_FLAGS(rb_flags); } info = gtk_icon_theme_choose_icon(_SELF(self), icon_names, size, flags); return ICON_INFO2RVAL(info); } static VALUE rg_contexts(VALUE self) { return GLIST2ARY_STR_FREE(gtk_icon_theme_list_contexts(_SELF(self))); } #endif void Init_gtk_icon_theme(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_THEME, "IconTheme", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_SMETHOD(default, 0); RG_DEF_SMETHOD(get_for_screen, 1); RG_DEF_METHOD(set_screen, 1); RG_DEF_METHOD(set_search_path, 1); RG_DEF_METHOD(search_path, 0); RG_DEF_METHOD(append_search_path, 1); RG_DEF_METHOD(prepend_search_path, 1); RG_DEF_METHOD(set_custom_theme, 1); RG_DEF_METHOD_P(has_icon, 1); RG_DEF_METHOD(lookup_icon, 3); RG_DEF_METHOD(load_icon, 3); RG_DEF_METHOD(icons, -1); RG_DEF_METHOD(get_icon_sizes, 1); RG_DEF_METHOD(example_icon_name, 0); RG_DEF_METHOD(rescan_if_needed, 0); RG_DEF_SMETHOD(add_builtin_icon, 3); #if GTK_CHECK_VERSION(2, 12, 0) RG_DEF_METHOD(choose_icon, -1); RG_DEF_METHOD(contexts, 0); #endif G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkIconThemeError */ G_DEF_ERROR(GTK_ICON_THEME_ERROR, "IconThemeError", mGtk, rb_eRuntimeError, GTK_TYPE_ICON_THEME_ERROR); /* GtkIconLookupFlags */ G_DEF_CLASS(GTK_TYPE_ICON_LOOKUP_FLAGS, "LookupFlags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_ICON_LOOKUP_FLAGS, "GTK_ICON_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkselection.c������������������������������������������������0000644�0001750�0001750�00000011510�12257552167�020325� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 mSelection #define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w))) static VALUE rg_m_owner_set(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { gboolean ret; if (argc == 3){ VALUE widget, selection, time; rb_scan_args(argc, argv, "30", &widget, &selection, &time); ret = gtk_selection_owner_set(RVAL2WIDGET(widget), RVAL2ATOM(selection), NUM2INT(time)); } else { VALUE display, widget, selection, time; rb_scan_args(argc, argv, "40", &display, &widget, &selection, &time); ret = gtk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)), RVAL2WIDGET(widget), RVAL2ATOM(selection), NUM2INT(time)); } return CBOOL2RVAL(ret); } static VALUE rg_m_add_target(VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE info) { gtk_selection_add_target(RVAL2WIDGET(widget), RVAL2ATOM(selection), RVAL2ATOM(target), NUM2INT(info)); return self; } static VALUE rg_m_add_targets(VALUE self, VALUE rbwidget, VALUE rbselection, VALUE rbtargets) { GtkWidget *widget = RVAL2WIDGET(rbwidget); GdkAtom selection = RVAL2ATOM(rbselection); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_selection_add_targets(widget, selection, targets, n); g_free(targets); return self; } static VALUE rg_m_clear_targets(VALUE self, VALUE widget, VALUE selection) { gtk_selection_clear_targets(RVAL2WIDGET(widget), RVAL2ATOM(selection)); return self; } static VALUE rg_m_convert(G_GNUC_UNUSED VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE time) { gboolean ret = gtk_selection_convert(RVAL2WIDGET(widget), RVAL2ATOM(selection), RVAL2ATOM(target), NUM2INT(time)); return CBOOL2RVAL(ret); } static VALUE rg_m_remove_all(VALUE self, VALUE widget) { gtk_selection_remove_all(RVAL2WIDGET(widget)); return self; } static VALUE rg_m_include_image_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets, VALUE rbwritable) { gboolean writable = RVAL2CBOOL(rbwritable); long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_image(targets, n, writable); g_free(targets); return result; } static VALUE rg_m_include_text_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets) { long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_text(targets, n); g_free(targets); return result; } static VALUE rg_m_include_uri_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets) { long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_uri(targets, n); g_free(targets); return result; } static VALUE rg_m_include_rich_text_p(G_GNUC_UNUSED VALUE self, VALUE rbtargets, VALUE rbbuffer) { GtkTextBuffer *buffer = GTK_TEXT_BUFFER(RVAL2GOBJ(rbbuffer)); long n; GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n); gboolean result; result = gtk_targets_include_rich_text(targets, n, buffer); g_free(targets); return result; } void Init_gtk_selection(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Selection"); RG_DEF_MODFUNC(owner_set, 3); RG_DEF_MODFUNC(add_target, 4); RG_DEF_MODFUNC(add_targets, 3); RG_DEF_MODFUNC(clear_targets, 2); RG_DEF_MODFUNC(convert, 4); RG_DEF_MODFUNC(remove_all, 1); RG_DEF_MODFUNC_P(include_image, 2); RG_DEF_MODFUNC_P(include_text, 1); RG_DEF_MODFUNC_P(include_uri, 1); RG_DEF_MODFUNC_P(include_rich_text, 2); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkscrolledwindow.c�������������������������������������������0000644�0001750�0001750�00000007153�12257552167�021407� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cScrolledWindow #define _SELF(self) (GTK_SCROLLED_WINDOW(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GtkAdjustment *h_adj = NULL; GtkAdjustment *v_adj = NULL; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (!NIL_P(arg1)) h_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1)); if (!NIL_P(arg2)) v_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg2)); RBGTK_INITIALIZE(self, gtk_scrolled_window_new(h_adj, v_adj)); return Qnil; } static VALUE rg_set_policy(VALUE self, VALUE hpolicy, VALUE vpolicy) { gtk_scrolled_window_set_policy(_SELF(self), RVAL2GENUM(hpolicy, GTK_TYPE_POLICY_TYPE), RVAL2GENUM(vpolicy, GTK_TYPE_POLICY_TYPE)); return self; } static VALUE rg_policy(VALUE self) { GtkPolicyType hpolicy, vpolicy; gtk_scrolled_window_get_policy(_SELF(self), &hpolicy, &vpolicy); return rb_ary_new3(2, GENUM2RVAL(hpolicy, GTK_TYPE_POLICY_TYPE), GENUM2RVAL(vpolicy, GTK_TYPE_POLICY_TYPE)); } static VALUE rg_add_with_viewport(VALUE self, VALUE other) { gtk_scrolled_window_add_with_viewport(_SELF(self), GTK_WIDGET(RVAL2GOBJ(other))); G_CHILD_ADD(self, other); return self; } static VALUE rg_hscrollbar(VALUE self) { return GOBJ2RVAL(gtk_scrolled_window_get_hscrollbar(_SELF(self))); } static VALUE rg_vscrollbar(VALUE self) { return GOBJ2RVAL(gtk_scrolled_window_get_vscrollbar(_SELF(self))); } static VALUE rg_set_placement(VALUE self, VALUE corner_type) { gtk_scrolled_window_set_placement(_SELF(self), RVAL2GENUM(corner_type, GTK_TYPE_CORNER_TYPE)); return self; } static VALUE rg_unset_placement(VALUE self) { gtk_scrolled_window_unset_placement(_SELF(self)); return self; } static VALUE rg_placement(VALUE self) { return GENUM2RVAL(gtk_scrolled_window_get_placement(_SELF(self)), GTK_TYPE_CORNER_TYPE); } void Init_gtk_scrolled_window(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCROLLED_WINDOW, "ScrolledWindow", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_policy, 2); RG_DEF_METHOD(policy, 0); RG_DEF_METHOD(add_with_viewport, 1); RG_DEF_METHOD(hscrollbar, 0); RG_DEF_METHOD(vscrollbar, 0); RG_DEF_METHOD(unset_placement, 0); RG_DEF_METHOD(placement, 0); RG_DEF_METHOD(set_placement, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "placement"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvbox.c�����������������������������������������������������0000644�0001750�0001750�00000003041�11701304107�017274� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVBox static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE homogeneous, spacing; rb_scan_args(argc, argv, "02", &homogeneous, &spacing); RBGTK_INITIALIZE(self, gtk_vbox_new(RVAL2CBOOL(homogeneous), (NIL_P(spacing)?0:NUM2INT(spacing)))); return Qnil; } void Init_gtk_vbox(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VBOX, "VBox", mGtk); RG_DEF_METHOD(initialize, -1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreestore.c������������������������������������������������0000644�0001750�0001750�00000025436�12257552167�020370� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011-2012 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 cTreeStore #define _SELF(s) (GTK_TREE_STORE(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { gint cnt; GtkTreeStore* store; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } store = gtk_tree_store_newv(argc, buf); G_INITIALIZE(self, store); return Qnil; } static VALUE rg_set_column_types(int argc, VALUE *argv, VALUE self) { gint cnt; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } gtk_tree_store_set_column_types(_SELF(self), argc, buf); return self; } static VALUE rg_set_value(VALUE self, VALUE iter, VALUE column, VALUE value) { GType gtype = gtk_tree_model_get_column_type(GTK_TREE_MODEL(RVAL2GOBJ(self)), NUM2INT(column)); GValue gval = G_VALUE_INIT; g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(value, &gval); G_CHILD_ADD(self, iter); G_CHILD_ADD(iter, value); gtk_tree_store_set_value(_SELF(self), RVAL2GTKTREEITER(iter), NUM2INT(column), &gval); g_value_unset(&gval); return self; } /* void gtk_tree_store_set (GtkTreeStore *tree_store, GtkTreeIter *iter, ...); void gtk_tree_store_set_valist (GtkTreeStore *tree_store, GtkTreeIter *iter, va_list var_args); */ static VALUE rg_remove(VALUE self, VALUE iter) { G_CHILD_REMOVE(self, iter); return CBOOL2RVAL(gtk_tree_store_remove(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { VALUE parent, position, values, ret; GtkTreeIter iter; GtkTreeStore* model = _SELF(self); rb_scan_args(argc, argv, "21", &parent, &position, &values); if (NIL_P(values)){ gtk_tree_store_insert(model, &iter, NIL_P(parent) ? NULL : RVAL2GTKTREEITER(parent), NUM2INT(position)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); } else { gint *c_columns; GValue *c_values; long size, i; size = NUM2INT(rb_funcall(values, rb_intern("size"), 0)); c_columns = ALLOCA_N(gint, size); c_values = ALLOCA_N(GValue, size); if(TYPE(values)==T_ARRAY) { for(i=0; i<size; i++) { GType gtype; GValue gval = G_VALUE_INIT; c_columns[i] = i; gtype = gtk_tree_model_get_column_type(GTK_TREE_MODEL(RVAL2GOBJ(self)), c_columns[i]); g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(rb_ary_shift(values), &gval); c_values[i] = gval; } } else if(TYPE(values)==T_HASH) { VALUE r_columns; r_columns = rb_funcall(values, rb_intern("keys"), 0); for(i=0; i<size; i++) { GType gtype; GValue gval = G_VALUE_INIT; c_columns[i] = NUM2INT (rb_ary_entry(r_columns, i)); gtype = gtk_tree_model_get_column_type(GTK_TREE_MODEL(RVAL2GOBJ(self)), c_columns[i]); g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(rb_hash_aref(values, INT2NUM(c_columns[i])), &gval); c_values[i] = gval; } } else { rb_raise(rb_eArgError, "values must be of type Hash or Array"); } gtk_tree_store_insert_with_valuesv(model, &iter, NIL_P(parent) ? NULL : RVAL2GTKTREEITER(parent), NUM2INT(position), c_columns, c_values, size); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); for(i=0; i<size; i++) { G_CHILD_ADD(ret, rbgobj_gvalue_to_rvalue(&(c_values[i]))); g_value_unset(&(c_values[i])); } } return ret; } static VALUE rg_insert_before(VALUE self, VALUE parent, VALUE sibling) { VALUE ret; GtkTreeIter iter; GtkTreeStore* model = _SELF(self); gtk_tree_store_insert_before(model, &iter, NIL_P(parent) ? NULL : RVAL2GTKTREEITER(parent), NIL_P(sibling) ? NULL : RVAL2GTKTREEITER(sibling)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_insert_after(VALUE self, VALUE parent, VALUE sibling) { VALUE ret; GtkTreeIter iter; GtkTreeStore* model = _SELF(self); gtk_tree_store_insert_after(model, &iter, NIL_P(parent) ? NULL : RVAL2GTKTREEITER(parent), NIL_P(sibling) ? NULL : RVAL2GTKTREEITER(sibling)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); return ret; } /* The 2 following functions where implemented as TreeStore#insert which will use a Hash instead of pairs of parameters void gtk_tree_store_insert_with_values (GtkTreeStore *tree_store, GtkTreeIter *iter, GtkTreeIter *parent, gint position, ...); void gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store, GtkTreeIter *iter, GtkTreeIter *parent, gint position, gint *columns, GValue *values, gint n_values); */ static VALUE rg_prepend(VALUE self, VALUE parent) { VALUE ret; GtkTreeIter iter; GtkTreeStore* model = _SELF(self); gtk_tree_store_prepend(model, &iter, NIL_P(parent)?NULL:RVAL2GTKTREEITER(parent)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_append(VALUE self, VALUE parent) { VALUE ret; GtkTreeIter iter; GtkTreeStore* model = _SELF(self); gtk_tree_store_append(model, &iter, NIL_P(parent)?NULL:RVAL2GTKTREEITER(parent)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_ancestor_p(VALUE self, VALUE iter, VALUE descendant) { return gtk_tree_store_is_ancestor(_SELF(self), RVAL2GTKTREEITER(iter), RVAL2GTKTREEITER(descendant)); } static VALUE rg_iter_depth(VALUE self, VALUE iter) { return INT2NUM(gtk_tree_store_iter_depth(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_clear(VALUE self) { G_CHILD_REMOVE_ALL(self); gtk_tree_store_clear(_SELF(self)); return self; } static VALUE rg_iter_is_valid_p(VALUE self, VALUE iter) { return (NIL_P(iter)) ? Qfalse : CBOOL2RVAL(gtk_tree_store_iter_is_valid(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_reorder(VALUE self, VALUE rbparent, VALUE rbnew_order) { GtkTreeStore *store = _SELF(self); GtkTreeIter *parent = RVAL2GTKTREEITER(rbparent); gint n_children = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), parent); long n; gint *new_order = RVAL2GINTS(rbnew_order, n); if (n != n_children) { g_free(new_order); rb_raise(rb_eArgError, "new order array must contain the same number of elements as the number of children in the parent: %ld != %d", n, n_children); } gtk_tree_store_reorder(store, parent, new_order); g_free(new_order); return self; } static VALUE rg_swap(VALUE self, VALUE iter1, VALUE iter2) { gtk_tree_store_swap(_SELF(self), RVAL2GTKTREEITER(iter1), RVAL2GTKTREEITER(iter2)); return self; } static VALUE rg_move_before(VALUE self, VALUE iter, VALUE position) { gtk_tree_store_move_before(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; } static VALUE rg_move_after(VALUE self, VALUE iter, VALUE position) { gtk_tree_store_move_after(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; } void Init_gtk_tree_store(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_STORE, "TreeStore", mGtk); rbgtk_register_treeiter_set_value_func(GTK_TYPE_TREE_STORE, (rbgtkiter_set_value_func)>k_tree_store_set_value); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_column_types, -1); RG_DEF_METHOD(set_value, 3); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(insert, -1); RG_DEF_METHOD(insert_before, 2); RG_DEF_METHOD(insert_after, 2); RG_DEF_METHOD(prepend, 1); RG_DEF_METHOD(append, 1); RG_DEF_METHOD_P(ancestor, 2); RG_DEF_METHOD(iter_depth, 1); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD_P(iter_is_valid, 1); RG_DEF_METHOD(reorder, 2); RG_DEF_METHOD(swap, 2); RG_DEF_METHOD(move_before, 2); RG_DEF_METHOD(move_after, 2); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentmanager.c��������������������������������������������0000644�0001750�0001750�00000010453�12257552167�021160� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentManager #define _SELF(self) (GTK_RECENT_MANAGER(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_recent_manager_new()); return Qnil; } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_recent_manager_get_default()); } static VALUE rg_s_get_for_screen(G_GNUC_UNUSED VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_recent_manager_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); } static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_recent_manager_set_screen(_SELF(self), GDK_SCREEN(RVAL2GOBJ(screen))); return self; } static VALUE rg_add_item(int argc, VALUE *argv, VALUE self) { VALUE uri, data; gboolean ret; rb_scan_args(argc, argv, "11", &uri, &data); if (NIL_P(data)){ ret = gtk_recent_manager_add_item(_SELF(self), RVAL2CSTR(uri)); if (! ret) rb_raise(rb_eRuntimeError, "Can't add the uri"); } else { ret = gtk_recent_manager_add_full(_SELF(self), RVAL2CSTR(uri), RVAL2BOXED(data, GTK_TYPE_RECENT_DATA)); if (! ret) rb_raise(rb_eRuntimeError, "Can't add the uri or data"); } return self; } static VALUE rg_remove_item(VALUE self, VALUE uri) { GError* error = NULL; gboolean ret = gtk_recent_manager_remove_item(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_lookup_item(VALUE self, VALUE uri) { GError* error = NULL; GtkRecentInfo* info = gtk_recent_manager_lookup_item(_SELF(self), RVAL2CSTR(uri), &error); if (error) RAISE_GERROR(error); return BOXED2RVAL(info, GTK_TYPE_RECENT_INFO); } static VALUE rg_has_item_p(VALUE self, VALUE uri) { return CBOOL2RVAL(gtk_recent_manager_has_item(_SELF(self), RVAL2CSTR(uri))); } static VALUE rg_move_item(VALUE self, VALUE uri, VALUE new_uri) { GError* error = NULL; gboolean ret = gtk_recent_manager_move_item(_SELF(self), RVAL2CSTR(uri), RVAL2CSTR(new_uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_items(VALUE self) { return GLIST2ARY2F(gtk_recent_manager_get_items(_SELF(self)), GTK_TYPE_RECENT_INFO); } static VALUE rg_purge_items(VALUE self) { GError* error = NULL; gint ret = gtk_recent_manager_purge_items(_SELF(self), &error); if (error) RAISE_GERROR(error); return INT2NUM(ret); } void Init_gtk_recent_manager(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_MANAGER, "RecentManager", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_SMETHOD(default, 0); RG_DEF_SMETHOD(get_for_screen, 1); RG_DEF_METHOD(set_screen, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "set_screen"); RG_DEF_METHOD(add_item, -1); RG_DEF_METHOD(remove_item, 1); RG_DEF_METHOD(lookup_item, 1); RG_DEF_METHOD_P(has_item, 1); RG_DEF_METHOD(move_item, 2); RG_DEF_METHOD(items, 0); RG_DEF_METHOD(purge_items, 0); /* GtkRecentManagerError */ G_DEF_ERROR(GTK_RECENT_MANAGER_ERROR, "RecentManagerError", mGtk, rb_eRuntimeError, GTK_TYPE_RECENT_MANAGER_ERROR); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkdevice.c���������������������������������������������������0000644�0001750�0001750�00000014347�11701304107�017550� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkitemfactory.c����������������������������������������������0000644�0001750�0001750�00000024340�11701304107�020651� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 Hiroshi Igarashi, * dellin, * MUTOH Masao * * 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-pixbuf/gdk-pixdata.h> #define RG_TARGET_NAMESPACE cItemFactory #define _SELF(self) (GTK_ITEM_FACTORY(RVAL2GOBJ(self))) #define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w))) #define RVAL2ACCEL(a) (GTK_ACCEL_GROUP(RVAL2GOBJ(a))) static VALUE action_table; static guint action_id = 0; static VALUE rg_initialize(VALUE self, VALUE type, VALUE path, VALUE accel) { VALUE obj = rb_eval_string("eval('self', binding)"); G_RELATIVE(obj, self); RBGTK_INITIALIZE(self, gtk_item_factory_new(NUM2ULONG(type), RVAL2CSTR(path), RVAL2ACCEL(accel))); return Qnil; } static VALUE rg_construct(int argc, VALUE *argv, VALUE self) { VALUE type, path, accel; GtkItemFactory* ifact = _SELF(self); ifact->accel_group = NULL; rb_scan_args(argc, argv, "21", &type, &path, &accel); gtk_item_factory_construct(ifact, FIX2INT(type), RVAL2CSTR(path), RVAL2ACCEL(accel)); return self; } static VALUE rg_s_from_widget(VALUE self, VALUE widget) { VALUE obj = GOBJ2RVAL(gtk_item_factory_from_widget(RVAL2WIDGET(widget))); G_RELATIVE(obj, self); return obj; } static VALUE rg_s_path_from_widget(G_GNUC_UNUSED VALUE self, VALUE widget) { return CSTR2RVAL(gtk_item_factory_path_from_widget(RVAL2WIDGET(widget))); } static VALUE rg_get_item(VALUE self, VALUE path) { VALUE obj = Qnil; GtkWidget* widget = gtk_item_factory_get_item(_SELF(self), RVAL2CSTR(path)); if (widget){ obj = GOBJ2RVAL(widget); G_RELATIVE(obj, self); } return obj; } static VALUE rg_get_widget(VALUE self, VALUE path) { VALUE obj = Qnil; GtkWidget* widget = gtk_item_factory_get_widget(_SELF(self), RVAL2CSTR(path)); if (widget){ obj = GOBJ2RVAL(widget); G_RELATIVE(obj, self); } return obj; } /* We can't implement them because actions are always 1. GtkWidget* gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory, guint action); GtkWidget* gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory, guint action); */ static int menuitem_type_check(char *item_type) { if (item_type == NULL || strcmp(item_type, "<Branch>") == 0 || (strcmp(item_type, "<LastBranch>") == 0) || (strcmp(item_type, "<Separator>") == 0)) return 0; else return -1; } static void items_exec_callback_wrap(G_GNUC_UNUSED VALUE callback_data, guint action_id, GtkWidget *widget) { VALUE iter, data; VALUE action = rb_hash_aref(action_table, UINT2NUM(action_id)); iter = RARRAY_PTR(action)[0]; data = RARRAY_PTR(action)[1]; if (!NIL_P(iter)) { rb_funcall(iter, id_call, 2, data, GOBJ2RVAL(widget)); } } static void create_factory_entry(GtkItemFactoryEntry *entry, VALUE self, VALUE path, VALUE item_type, VALUE accel, VALUE extdata, VALUE func, VALUE data) { VALUE action; entry->path = (gchar *)(NIL_P(path) ? NULL : RVAL2CSTR(path)); entry->item_type = (gchar *)(NIL_P(item_type) ? "<Branch>" : RVAL2CSTR(item_type)); entry->accelerator = (gchar *)(NIL_P(accel) ? NULL : RVAL2CSTR(accel)); if (menuitem_type_check(entry->item_type) == 0) { entry->callback = NULL; } else { if (NIL_P(func)) { entry->callback = NULL; } else { entry->callback = items_exec_callback_wrap; } } action = rb_ary_new3(2, func, data); G_RELATIVE(self, action); rb_hash_aset(action_table, UINT2NUM(action_id), action); entry->callback_action = action_id; action_id++; if (NIL_P(extdata)){ entry->extra_data = NULL; } else if (TYPE(extdata) == T_STRING){ entry->extra_data = RVAL2CSTR(extdata); } else if (TYPE(extdata) == T_SYMBOL){ entry->extra_data = rb_id2name(SYM2ID(extdata)); } else if (RVAL2GTYPE(extdata) == GDK_TYPE_PIXBUF){ GdkPixdata pixdata; guint stream_length_p; gdk_pixdata_from_pixbuf(&pixdata, GDK_PIXBUF(RVAL2GOBJ(extdata)), TRUE); entry->extra_data = gdk_pixdata_serialize(&pixdata, &stream_length_p); } else { entry->extra_data = NULL; } } static VALUE rg_create_item(int argc, VALUE *argv, VALUE self) { VALUE path, type, accel, extdata, data, func; GtkItemFactoryEntry *entry; rb_scan_args(argc, argv, "14", &path, &type, &accel, &extdata, &data); entry = ALLOC(GtkItemFactoryEntry); func = rb_rescue((VALUE(*)())rb_block_proc, 0, NULL, 0); create_factory_entry(entry, self, path, type, accel, extdata, func, data); gtk_item_factory_create_item(_SELF(self), entry, (gpointer)self, 1); g_free(entry); return self; } static VALUE rg_create_items(VALUE self, VALUE ary) { VALUE entry, path, accel, type, func, data, extdata; GtkItemFactoryEntry *entries; guint i, len, n_menu_entries; n_menu_entries = RARRAY_LEN(ary); entries = ALLOC_N(GtkItemFactoryEntry, n_menu_entries); for (i = 0; i < n_menu_entries; i++) { entry = RARRAY_PTR(ary)[i]; len = RARRAY_LEN(entry); Check_Type(entry, T_ARRAY); path = RARRAY_PTR(entry)[0]; type = ((len > 1) ? RARRAY_PTR(entry)[1] : Qnil); accel = ((len > 2) ? RARRAY_PTR(entry)[2] : Qnil); extdata = ((len > 3) ? RARRAY_PTR(entry)[3] : Qnil); func = ((len > 4) ? RARRAY_PTR(entry)[4] : Qnil); data = ((len > 5) ? RARRAY_PTR(entry)[5] : Qnil); create_factory_entry(&entries[i], self, path, type, accel, extdata, func, data); } gtk_item_factory_create_items (_SELF(self), n_menu_entries, entries, NULL); g_free(entries); return self; } static VALUE rg_delete_item(VALUE self, VALUE path) { gtk_item_factory_delete_item(_SELF(self), RVAL2CSTR(path)); return self; } /* Don't implement. Use Gtk::ItemFactory#delete_item instead. void gtk_item_factory_delete_entry (GtkItemFactory *ifactory, GtkItemFactoryEntry *entry); void gtk_item_factory_delete_entries (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries); */ static VALUE rg_popup(VALUE self, VALUE x, VALUE y, VALUE mouse_button, VALUE time) { gtk_item_factory_popup(_SELF(self), NUM2UINT(x), NUM2UINT(y), NUM2UINT(mouse_button), NUM2UINT(time)); return self; } /* Do we need these methods? void gtk_item_factory_popup_with_data (GtkItemFactory *ifactory, gpointer popup_data, GtkDestroyNotify destroy, guint x, guint y, guint mouse_button, guint32 time); gpointer gtk_item_factory_popup_data (GtkItemFactory *ifactory); gpointer gtk_item_factory_popup_data_from_widget (GtkWidget *widget); void gtk_item_factory_set_translate_func (GtkItemFactory *ifactory, GtkTranslateFunc func, gpointer data, GtkDestroyNotify notify); */ void Init_gtk_itemfactory(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ITEM_FACTORY, "ItemFactory", mGtk); RG_DEF_SMETHOD(from_widget, 1); RG_DEF_SMETHOD(path_from_widget, 1); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(construct, -1); RG_DEF_METHOD(get_item, 1); RG_DEF_METHOD(get_widget, 1); RG_DEF_METHOD(create_item, -1); RG_DEF_METHOD(create_items, 1); RG_DEF_METHOD(delete_item, 1); RG_DEF_METHOD(popup, 4); /* Ruby/GTK Original constants */ rb_define_const(RG_TARGET_NAMESPACE, "TYPE_MENU_BAR", INT2FIX(GTK_TYPE_MENU_BAR)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_MENU", INT2FIX(GTK_TYPE_MENU)); rb_define_const(RG_TARGET_NAMESPACE, "TYPE_OPTION_MENU", INT2FIX(GTK_TYPE_OPTION_MENU)); rb_define_const(RG_TARGET_NAMESPACE, "TITLE", CSTR2RVAL("<Title>")); rb_define_const(RG_TARGET_NAMESPACE, "ITEM", CSTR2RVAL("<Item>")); rb_define_const(RG_TARGET_NAMESPACE, "CHECK_ITEM", CSTR2RVAL("<CheckItem>")); rb_define_const(RG_TARGET_NAMESPACE, "TOGGLE_ITEM", CSTR2RVAL("<ToggleItem>")); rb_define_const(RG_TARGET_NAMESPACE, "RADIO_ITEM", CSTR2RVAL("<RadioItem>")); rb_define_const(RG_TARGET_NAMESPACE, "IMAGE_ITEM", CSTR2RVAL("<ImageItem>")); rb_define_const(RG_TARGET_NAMESPACE, "STOCK_ITEM", CSTR2RVAL("<StockItem>")); rb_define_const(RG_TARGET_NAMESPACE, "SEPARATOR", CSTR2RVAL("<Separator>")); rb_define_const(RG_TARGET_NAMESPACE, "BRANCH", CSTR2RVAL("<Branch>")); rb_define_const(RG_TARGET_NAMESPACE, "LAST_BRANCH", CSTR2RVAL("<LastBranch>")); rb_define_const(RG_TARGET_NAMESPACE, "TEAROFF", CSTR2RVAL("<Tearoff>")); action_table = rb_hash_new(); rb_global_variable(&action_table); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkpaned.c����������������������������������������������������0000644�0001750�0001750�00000005673�11701304107�017422� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cPaned #define _SELF(self) (GTK_PANED(RVAL2GOBJ(self))) #define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w))) static VALUE rg_add1(VALUE self, VALUE child) { gtk_paned_add1(_SELF(self), RVAL2WIDGET(child)); return self; } static VALUE rg_add2(VALUE self, VALUE child) { gtk_paned_add2(_SELF(self), RVAL2WIDGET(child)); return self; } static VALUE rg_pack1(VALUE self, VALUE child, VALUE resize, VALUE shrink) { gtk_paned_pack1(_SELF(self), RVAL2WIDGET(child), RVAL2CBOOL(resize), RVAL2CBOOL(shrink)); return self; } static VALUE rg_pack2(VALUE self, VALUE child, VALUE resize, VALUE shrink) { gtk_paned_pack2(_SELF(self), RVAL2WIDGET(child), RVAL2CBOOL(resize), RVAL2CBOOL(shrink)); return self; } static VALUE rg_child1(VALUE self) { GtkWidget *child = _SELF(self)->child1; return (child == NULL) ? Qnil : GOBJ2RVAL(child); } static VALUE rg_child2(VALUE self) { GtkWidget *child = _SELF(self)->child2; return (child == NULL) ? Qnil : GOBJ2RVAL(child); } static VALUE rg_child1_resize_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->child1_resize); } static VALUE rg_child1_shrink_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->child1_shrink); } static VALUE rg_child2_resize_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->child2_resize); } static VALUE rg_child2_shrink_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->child2_shrink); } void Init_gtk_paned(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PANED, "Paned", mGtk); RG_DEF_METHOD(add1, 1); RG_DEF_METHOD(add2, 1); RG_DEF_METHOD(pack1, 3); RG_DEF_METHOD(pack2, 3); RG_DEF_METHOD(child1, 0); RG_DEF_METHOD(child2, 0); RG_DEF_METHOD_P(child1_resize, 0); RG_DEF_METHOD_P(child1_shrink, 0); RG_DEF_METHOD_P(child2_resize, 0); RG_DEF_METHOD_P(child2_shrink, 0); } ���������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkframe.c����������������������������������������������������0000644�0001750�0001750�00000004263�11701304107�017417� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cFrame static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label; rb_scan_args(argc, argv, "01", &label); RBGTK_INITIALIZE(self, gtk_frame_new(NIL_P(label)?NULL:RVAL2CSTR(label))); return Qnil; } static VALUE rg_set_label_align(VALUE self, VALUE xalign, VALUE yalign) { gtk_frame_set_label_align(GTK_FRAME(RVAL2GOBJ(self)), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_label_align(VALUE self) { gfloat xalign, yalign; gtk_frame_get_label_align(GTK_FRAME(RVAL2GOBJ(self)), &xalign, &yalign); return rb_ary_new3(2, rb_float_new(xalign), rb_float_new(yalign)); } void Init_gtk_frame(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FRAME, "Frame", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_label_align, 2); RG_DEF_METHOD(label_align, 0); rb_undef_method(RG_TARGET_NAMESPACE, "shadow"); rb_undef_method(RG_TARGET_NAMESPACE, "shadow="); rb_undef_method(RG_TARGET_NAMESPACE, "set_shadow"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfixed.c����������������������������������������������������0000644�0001750�0001750�00000004262�11701304107�017423� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cFixed #define _SELF(self) (GTK_FIXED(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_fixed_new()); return Qnil; } static VALUE rg_put(VALUE self, VALUE win, VALUE x, VALUE y) { gtk_fixed_put(_SELF(self), GTK_WIDGET(RVAL2GOBJ(win)), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_move(VALUE self, VALUE win, VALUE x, VALUE y) { gtk_fixed_move(_SELF(self), GTK_WIDGET(RVAL2GOBJ(win)), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_has_window_p(VALUE self) { return CBOOL2RVAL(gtk_fixed_get_has_window(_SELF(self))); } static VALUE rg_set_has_window(VALUE self, VALUE has_window) { gtk_fixed_set_has_window(_SELF(self), RVAL2CBOOL(has_window)); return self; } void Init_gtk_fixed(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FIXED, "Fixed", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(put, 3); RG_DEF_METHOD(move, 3); RG_DEF_METHOD_P(has_window, 0); RG_DEF_METHOD(set_has_window, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtk.c���������������������������������������������������������0000644�0001750�0001750�00000035064�12416346617�016427� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 gboolean quit_loop(G_GNUC_UNUSED gpointer user_data) { gtk_main_quit(); return G_SOURCE_REMOVE; } static VALUE rg_m_main(G_GNUC_UNUSED VALUE self) { GSource *interrupt_source; interrupt_source = rbg_interrupt_source_new(); g_source_set_callback(interrupt_source, quit_loop, NULL, NULL); g_source_attach(interrupt_source, NULL); gtk_main(); g_source_destroy(interrupt_source); g_source_unref(interrupt_source); rb_thread_check_ints(); 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)); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkimage.c����������������������������������������������������0000644�0001750�0001750�00000011565�12257552167�017434� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cImage #define _SELF(s) (GTK_IMAGE(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GType gtype; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (NIL_P(arg1)){ widget = gtk_image_new(); } else if (TYPE(arg1) == T_STRING && argc == 1){ widget = gtk_image_new_from_file(RVAL2CSTR(arg1)); } else if (TYPE(arg1) == T_SYMBOL){ widget = gtk_image_new_from_stock(rb_id2name(SYM2ID(arg1)), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE)); } else if (TYPE(arg1) == T_STRING){ widget = gtk_image_new_from_icon_name(RVAL2CSTR(arg1), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE)); } else { gtype = RVAL2GTYPE(arg1); if (gtype == GDK_TYPE_IMAGE){ widget = gtk_image_new_from_image(GDK_IMAGE(RVAL2GOBJ(arg1)), GDK_BITMAP(RVAL2GOBJ(arg2))); } else if (gtype == GDK_TYPE_PIXBUF){ widget = gtk_image_new_from_pixbuf(GDK_PIXBUF(RVAL2GOBJ(arg1))); } else if (gtype == GDK_TYPE_PIXMAP){ widget = gtk_image_new_from_pixmap(GDK_PIXMAP(RVAL2GOBJ(arg1)), GDK_BITMAP(RVAL2GOBJ(arg2))); } else if (gtype == GTK_TYPE_ICON_SET){ widget = gtk_image_new_from_icon_set((GtkIconSet*)RVAL2BOXED(arg1, GTK_TYPE_ICON_SET), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE)); } else if (g_type_is_a(gtype, GDK_TYPE_PIXBUF_ANIMATION)) { widget = gtk_image_new_from_animation(GDK_PIXBUF_ANIMATION(RVAL2GOBJ(arg1))); } } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_set(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GType gtype; rb_scan_args(argc, argv, "11", &arg1, &arg2); if (TYPE(arg1) == T_STRING && argc == 1){ gtk_image_set_from_file(_SELF(self), RVAL2CSTR(arg1)); } else if (TYPE(arg1) == T_SYMBOL){ gtk_image_set_from_stock(_SELF(self), rb_id2name(SYM2ID(arg1)), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE)); } else if (TYPE(arg1) == T_STRING){ gtk_image_set_from_icon_name(_SELF(self), RVAL2CSTR(arg1), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE)); } else { gtype = RVAL2GTYPE(arg1); if (gtype == GDK_TYPE_IMAGE){ gtk_image_set_from_image(_SELF(self), GDK_IMAGE(RVAL2GOBJ(arg1)), GDK_BITMAP(RVAL2GOBJ(arg2))); } else if (gtype == GDK_TYPE_PIXBUF){ gtk_image_set_from_pixbuf(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(arg1))); } else if (gtype == GDK_TYPE_PIXMAP){ gtk_image_set_from_pixmap(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(arg1)), GDK_BITMAP(RVAL2GOBJ(arg2))); } else if (gtype == GTK_TYPE_ICON_SET){ gtk_image_set_from_icon_set(_SELF(self), (GtkIconSet*)RVAL2BOXED(arg1, GTK_TYPE_ICON_SET), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE)); } else if (g_type_is_a(gtype, GDK_TYPE_PIXBUF_ANIMATION)) { gtk_image_set_from_animation(_SELF(self), GDK_PIXBUF_ANIMATION(RVAL2GOBJ(arg1))); } else { rb_raise(rb_eArgError, "invalid argument: %s", rb_class2name(arg1)); } } return self; } static VALUE rg_clear(VALUE self) { gtk_image_clear(_SELF(self)); return self; } void Init_gtk_image(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IMAGE, "Image", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set, -1); RG_DEF_METHOD(clear, 0); /* GtkImageType */ G_DEF_CLASS(GTK_TYPE_IMAGE_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_IMAGE_TYPE, "GTK_IMAGE_"); G_SET_SYMBOL_PROPERTY(GTK_TYPE_IMAGE, "stock"); } �������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentchooserdialog.c��������������������������������������0000644�0001750�0001750�00000004517�12257552167�022374� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentChooserDialog #define _SELF(self) (GTK_RECENT_CHOOSER_DIALOG(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE title, parent, button_ary; GtkWidget* dialog; if (rb_obj_is_kind_of(argv[2], GTYPE2CLASS(GTK_TYPE_RECENT_MANAGER))){ VALUE manager; rb_scan_args(argc, argv, "03*", &title, &parent, &manager, &button_ary); dialog = gtk_recent_chooser_dialog_new_for_manager((const gchar*)RVAL2CSTR_ACCEPT_NIL(title), GTK_WINDOW(RVAL2GOBJ(parent)), GTK_RECENT_MANAGER(RVAL2GOBJ(manager)), (const gchar*)NULL, NULL); } else { rb_scan_args(argc, argv, "02*", &title, &parent, &button_ary); dialog = gtk_recent_chooser_dialog_new((const gchar*)RVAL2CSTR_ACCEPT_NIL(title), GTK_WINDOW(RVAL2GOBJ(parent)), (const gchar*)NULL, NULL); } RBGTK_INITIALIZE(self, dialog); if (button_ary != Qnil){ rbgtk_dialog_add_buttons_internal(self, button_ary); } return Qnil; } void Init_gtk_recent_chooser_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER_DIALOG, "RecentChooserDialog", mGtk); RG_DEF_METHOD(initialize, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvscale.c���������������������������������������������������0000644�0001750�0001750�00000003475�11701304107�017606� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVScale static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; GtkAdjustment *adj = NULL; GtkWidget *widget; rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3); if (NIL_P(arg1) || RVAL2GTYPE(arg1) == GTK_TYPE_ADJUSTMENT){ if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1)); widget = gtk_vscale_new(adj); } else { widget = gtk_vscale_new_with_range(NUM2DBL(arg1), NUM2DBL(arg2), NUM2DBL(arg3)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_vscale(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VSCALE, "VScale", mGtk); RG_DEF_METHOD(initialize, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreesortable.c���������������������������������������������0000644�0001750�0001750�00000007366�11701304107�021027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 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" #define RG_TARGET_NAMESPACE mTreeSortable #define _SELF(s) (GTK_TREE_SORTABLE(RVAL2GOBJ(s))) static VALUE rg_sort_column_changed(VALUE self) { gtk_tree_sortable_sort_column_changed(_SELF(self)); return self; } static VALUE rg_sort_column_id(VALUE self) { gint sort_column_id; GtkSortType order; if (gtk_tree_sortable_get_sort_column_id(_SELF(self), &sort_column_id, &order)) { VALUE ary; ary = rb_ary_new2(2); rb_ary_push(ary, INT2NUM(sort_column_id)); rb_ary_push(ary, GENUM2RVAL(order, GTK_TYPE_SORT_TYPE)); return ary; } else { return Qnil; /* XXX: or something else? exception? */ } } static VALUE rg_set_sort_column_id(int argc, VALUE *argv, VALUE self) { gint sort_column_id; GtkSortType order; if (argc == 1 || argc == 2) { sort_column_id = NUM2INT(argv[0]); order = (argc == 2) ? RVAL2GENUM(argv[1], GTK_TYPE_SORT_TYPE) : GTK_SORT_ASCENDING; } else { rb_raise(rb_eArgError, "need 1 or 2 arguments."); } gtk_tree_sortable_set_sort_column_id(_SELF(self), sort_column_id, order); return self; } static gint sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer func) { a->user_data3 = model; b->user_data3 = model; return NUM2INT(rb_funcall((VALUE)func, id_call, 2, GTKTREEITER2RVAL(a), GTKTREEITER2RVAL(b))); } static VALUE rg_set_sort_func(VALUE self, VALUE sort_column_id) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_sortable_set_sort_func(_SELF(self), NUM2INT(sort_column_id), (GtkTreeIterCompareFunc)sort_func, (gpointer)func, NULL); return self; } static VALUE rg_set_default_sort_func(VALUE self) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_sortable_set_default_sort_func(_SELF(self), (GtkTreeIterCompareFunc)sort_func, (gpointer)func, NULL); return self; } static VALUE rg_has_default_sort_func_p(VALUE self) { return RVAL2CBOOL(gtk_tree_sortable_has_default_sort_func(_SELF(self))); } void Init_gtk_treesortable(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TREE_SORTABLE, "TreeSortable", mGtk); RG_DEF_METHOD(sort_column_changed, 0); RG_DEF_METHOD(sort_column_id, 0); RG_DEF_METHOD(set_sort_column_id, -1); RG_DEF_METHOD(set_sort_func, 1); RG_DEF_METHOD(set_default_sort_func, 0); RG_DEF_METHOD_P(has_default_sort_func, 0); rb_define_const(RG_TARGET_NAMESPACE, "DEFAULT_SORT_COLUMN_ID", GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID); } /* vim: set sts=4 sw=4 ts=8: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccessible.c�����������������������������������������������0000644�0001750�0001750�00000002425�11701304107�020420� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtklayout.c���������������������������������������������������0000644�0001750�0001750�00000005246�11701304107�017644� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cLayout #define _SELF(self) (GTK_LAYOUT(RVAL2GOBJ(self))) #define RVAL2ADJ(a) (GTK_ADJUSTMENT(RVAL2GOBJ(a))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE hadjustment, vadjustment; GtkWidget* layout; rb_scan_args(argc, argv, "02", &hadjustment, &vadjustment); layout = gtk_layout_new( NIL_P(hadjustment) ? 0 : RVAL2ADJ(hadjustment), NIL_P(vadjustment) ? 0 : RVAL2ADJ(vadjustment)); RBGTK_INITIALIZE(self, layout); return Qnil; } static VALUE rg_put(VALUE self, VALUE widget, VALUE x, VALUE y) { gtk_layout_put(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_move(VALUE self, VALUE widget, VALUE x, VALUE y) { gtk_layout_move(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_set_size(VALUE self, VALUE width, VALUE height) { gtk_layout_set_size(_SELF(self), NUM2UINT(width), NUM2UINT(height)); return self; } static VALUE rg_size(VALUE self) { guint width, height; gtk_layout_get_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_bin_window(VALUE self) { return GOBJ2RVAL(_SELF(self)->bin_window); } void Init_gtk_layout(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LAYOUT, "Layout", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(put, 3); RG_DEF_METHOD(move, 3); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(bin_window, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkgc.c�������������������������������������������������������0000644�0001750�0001750�00000025254�12257552167�016723� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } static VALUE rg_screen(VALUE self) { return GOBJ2RVAL(gdk_gc_get_screen(_SELF(self))); } 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); RG_DEF_METHOD(screen, 0); 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 } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprintunixdialog.c������������������������������������������0000644�0001750�0001750�00000005432�11701304107�021544� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #ifdef HAVE_GTK_UNIX_PRINT #include <gtk/gtkprintunixdialog.h> #define RG_TARGET_NAMESPACE cPrintUnixDialog #define _SELF(s) (GTK_PRINT_UNIX_DIALOG(RVAL2GOBJ(s))) #ifndef GTK_TYPE_PRINT_CAPABILITIES # define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type()) #endif static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkWidget *dialog; VALUE title, parent; rb_scan_args(argc, argv, "02", &title, &parent); dialog = gtk_print_unix_dialog_new(NIL_P(title) ? NULL : RVAL2CSTR(title), RVAL2GOBJ(parent)); RBGTK_INITIALIZE(self, dialog); return Qnil; } static VALUE rg_add_custom_tab(VALUE self, VALUE child, VALUE tab_label) { gtk_print_unix_dialog_add_custom_tab(_SELF(self), RVAL2GOBJ(child), RVAL2GOBJ(tab_label)); return self; } static VALUE rg_set_manual_capability(VALUE self, VALUE rb_capabilities) { GtkPrintCapabilities capabilities; capabilities = RVAL2GFLAGS(rb_capabilities, GTK_TYPE_PRINT_CAPABILITIES); gtk_print_unix_dialog_set_manual_capabilities(_SELF(self), capabilities); return self; } #endif void Init_gtk_print_unix_dialog(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_UNIX_DIALOG, "PrintUnixDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(add_custom_tab, 2); RG_DEF_METHOD(set_manual_capability, 1); RG_DEF_ALIAS("settings", "print_settings"); RG_DEF_ALIAS("set_settings", "set_print_settings"); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkPrintCapabilities */ G_DEF_CLASS(GTK_TYPE_PRINT_CAPABILITIES, "Capabilities", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_CAPABILITIES, "GTK_PRINT_"); #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktooltip.c��������������������������������������������������0000644�0001750�0001750�00000004560�11701304107�020017� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #if GTK_CHECK_VERSION(2,12,0) #define RG_TARGET_NAMESPACE cTooltip /* GTK_TOOLTIP type-cast is private because it should be useless */ #define _SELF(self) (RVAL2GOBJ(self)) static VALUE rg_set_markup(VALUE self, VALUE markup) { gtk_tooltip_set_markup(_SELF(self), RVAL2CSTR(markup)); return self; } static VALUE rg_set_text(VALUE self, VALUE text) { gtk_tooltip_set_text(_SELF(self), RVAL2CSTR(text)); return self; } static VALUE rg_set_icon(VALUE self, VALUE icon) { gtk_tooltip_set_icon(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(icon))); return self; } static VALUE rg_set_icon_from_stock(VALUE self, VALUE stock_id, VALUE size) { gtk_tooltip_set_icon_from_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE)); return self; } static VALUE rg_set_custom(VALUE self, VALUE custom_widget) { gtk_tooltip_set_custom(_SELF(self), GTK_WIDGET(RVAL2GOBJ(custom_widget))); return self; } #endif void Init_gtk_tooltip(VALUE mGtk) { #if GTK_CHECK_VERSION(2,12,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOLTIP, "Tooltip", mGtk); RG_DEF_METHOD(set_markup, 1); RG_DEF_METHOD(set_text, 1); RG_DEF_METHOD(set_icon, 1); RG_DEF_METHOD(set_icon_from_stock, 2); RG_DEF_METHOD(set_custom, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); #endif } ������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkwindow.c���������������������������������������������������0000644�0001750�0001750�00000067577�12307003726�017643� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cWindow #define _SELF(s) GDK_WINDOW(RVAL2GOBJ(s)) static VALUE rg_initialize(VALUE self, VALUE parent, VALUE attributes, VALUE attributes_mask) { GdkWindow* win; win = gdk_window_new(NIL_P(parent) ? NULL : _SELF(parent), (GdkWindowAttr*)RVAL2BOXED(attributes, GDK_TYPE_WINDOW_ATTR), RVAL2GFLAGS(attributes_mask, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE)); G_INITIALIZE(self, win); return Qnil; } static VALUE rg_destroy(VALUE self) { gdk_window_destroy(_SELF(self)); return Qnil; } static VALUE rg_window_type(VALUE self) { return GENUM2RVAL(gdk_window_get_window_type(_SELF(self)), GDK_TYPE_WINDOW_TYPE); } static VALUE rg_s_at_pointer(G_GNUC_UNUSED VALUE self) { gint x, y; GdkWindow* win = gdk_window_at_pointer(&x, &y); return rb_ary_new3(3, GOBJ2RVAL(win), INT2FIX(x), INT2FIX(y)); } static VALUE rg_show(VALUE self) { gdk_window_show(_SELF(self)); return self; } static VALUE rg_show_unraised(VALUE self) { gdk_window_show_unraised(_SELF(self)); return self; } static VALUE rg_hide(VALUE self) { gdk_window_hide(_SELF(self)); return Qnil; } static VALUE rg_visible_p(VALUE self) { return CBOOL2RVAL(gdk_window_is_visible(_SELF(self))); } static VALUE rg_viewable_p(VALUE self) { return CBOOL2RVAL(gdk_window_is_viewable(_SELF(self))); } static VALUE rg_state(VALUE self) { return GENUM2RVAL(gdk_window_get_state(_SELF(self)), GDK_TYPE_WINDOW_STATE); } static VALUE rg_withdraw(VALUE self) { gdk_window_withdraw(_SELF(self)); return Qnil; } static VALUE rg_iconify(VALUE self) { gdk_window_iconify(_SELF(self)); return self; } static VALUE rg_deiconify(VALUE self) { gdk_window_deiconify(_SELF(self)); return self; } static VALUE rg_stick(VALUE self) { gdk_window_stick(_SELF(self)); return self; } static VALUE rg_unstick(VALUE self) { gdk_window_unstick(_SELF(self)); return self; } static VALUE rg_maximize(VALUE self) { gdk_window_maximize(_SELF(self)); return self; } static VALUE rg_unmaximize(VALUE self) { gdk_window_unmaximize(_SELF(self)); return self; } static VALUE rg_fullscreen(VALUE self) { gdk_window_fullscreen(_SELF(self)); return self; } static VALUE rg_unfullscreen(VALUE self) { gdk_window_unfullscreen(_SELF(self)); return self; } static VALUE rg_set_keep_above(VALUE self, VALUE setting) { gdk_window_set_keep_above(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_keep_below(VALUE self, VALUE setting) { gdk_window_set_keep_below(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_move(VALUE self, VALUE x, VALUE y) { gdk_window_move(_SELF(self), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_resize(VALUE self, VALUE w, VALUE h) { gdk_window_resize(_SELF(self), NUM2INT(w), NUM2INT(h)); return self; } static VALUE rg_move_resize(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) { gdk_window_move_resize(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); return self; } static VALUE rg_scroll(VALUE self, VALUE dx, VALUE dy) { gdk_window_scroll(_SELF(self), NUM2INT(dx), NUM2INT(dy)); return self; } static VALUE rg_move_region(VALUE self, VALUE region, VALUE dx, VALUE dy) { gdk_window_move_region(_SELF(self), (GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION), NUM2INT(dx), NUM2INT(dy)); return self; } static VALUE rg_reparent(VALUE self, VALUE new_parent, VALUE x, VALUE y) { gdk_window_reparent(_SELF(self), _SELF(new_parent), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_clear(VALUE self) { gdk_window_clear(_SELF(self)); return self; } static VALUE rg_clear_area(int argc, VALUE *argv, VALUE self) { VALUE gen_expose, x, y, w, h; rb_scan_args(argc, argv, "41", &x, &y, &w, &h, &gen_expose); if (! NIL_P(gen_expose) && RVAL2CBOOL(gen_expose)){ gdk_window_clear_area_e(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); } else { gdk_window_clear_area(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); } return self; } static VALUE rg_raise(VALUE self) { gdk_window_raise(_SELF(self)); return self; } static VALUE rg_lower(VALUE self) { gdk_window_lower(_SELF(self)); return self; } static VALUE rg_focus(VALUE self, VALUE timestamp) { gdk_window_focus(_SELF(self), NUM2UINT(timestamp)); return self; } static VALUE rg_register_dnd(VALUE self) { gdk_window_register_dnd(_SELF(self)); return self; } static VALUE rg_begin_resize_drag(VALUE self, VALUE edge, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp) { gdk_window_begin_resize_drag(_SELF(self), RVAL2GENUM(edge, GDK_TYPE_WINDOW_EDGE), NUM2INT(button), NUM2INT(root_x), NUM2INT(root_y), NUM2UINT(timestamp)); return self; } static VALUE rg_begin_move_drag(VALUE self, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp) { gdk_window_begin_move_drag(_SELF(self), NUM2INT(button), NUM2INT(root_x), NUM2INT(root_y), NUM2UINT(timestamp)); return self; } static VALUE rg_s_constrain_size(G_GNUC_UNUSED VALUE self, VALUE geometry, VALUE flags, VALUE w, VALUE h) { gint new_width, new_height; gdk_window_constrain_size((GdkGeometry*)RVAL2BOXED(geometry, GDK_TYPE_GEOMETRY), RVAL2GFLAGS(flags, GDK_TYPE_WINDOW_HINTS), NUM2INT(w), NUM2INT(h), &new_width, &new_height); return rb_assoc_new(INT2NUM(new_width), INT2NUM(new_height)); } #if GTK_CHECK_VERSION(2, 12, 0) static VALUE rg_beep(VALUE self) { gdk_window_beep(_SELF(self)); return self; } #endif static VALUE rg_begin_paint(VALUE self, VALUE area) { if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){ gdk_window_begin_paint_rect(_SELF(self), (GdkRectangle*)RVAL2BOXED(area, GDK_TYPE_RECTANGLE)); } else { gdk_window_begin_paint_region(_SELF(self), (GdkRegion*)RVAL2BOXED(area, GDK_TYPE_REGION)); } return self; } static VALUE rg_end_paint(VALUE self) { gdk_window_end_paint(_SELF(self)); return self; } static VALUE rg_invalidate(VALUE self, VALUE area, VALUE invalidate_children) { if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_REGION))){ gdk_window_invalidate_region(_SELF(self), RVAL2BOXED(area, GDK_TYPE_REGION), RVAL2CBOOL(invalidate_children)); } else { gdk_window_invalidate_rect(_SELF(self), RVAL2BOXED(area, GDK_TYPE_RECTANGLE), RVAL2CBOOL(invalidate_children)); } return self; } static gboolean invalidate_child_func_wrap(GdkWindow *window, VALUE func) { VALUE result = rb_funcall(func, id_call, 1, GOBJ2RVAL(window)); return RVAL2CBOOL(result); } typedef gboolean (*ChildFunc) (GdkWindow*, gpointer); static VALUE rg_invalidate_maybe_recurse(VALUE self, VALUE region) { VALUE func = (VALUE)NULL; if (rb_block_given_p()){ func = rb_block_proc(); G_RELATIVE(self, func); } gdk_window_invalidate_maybe_recurse(_SELF(self), RVAL2BOXED(region, GDK_TYPE_REGION), (ChildFunc)invalidate_child_func_wrap, (gpointer)func); return self; } static VALUE rg_update_area(VALUE self) { GdkRegion* ret = gdk_window_get_update_area(_SELF(self)); return BOXED2RVAL(ret, GDK_TYPE_REGION); } static VALUE rg_freeze_updates(VALUE self) { gdk_window_freeze_updates(_SELF(self)); return self; } static VALUE rg_thaw_updates(VALUE self) { gdk_window_thaw_updates(_SELF(self)); return self; } static VALUE rg_s_process_all_updates(VALUE self) { gdk_window_process_all_updates(); return self; } static VALUE rg_process_updates(VALUE self, VALUE update_children) { gdk_window_process_updates(_SELF(self), RVAL2CBOOL(update_children)); return self; } static VALUE rg_s_set_debug_updates(VALUE self, VALUE setting) { gdk_window_set_debug_updates(RVAL2CBOOL(setting)); return self; } static VALUE rg_internal_paint_info(VALUE self) { GdkDrawable* real_drawable; gint x_offset, y_offset; gdk_window_get_internal_paint_info(_SELF(self), &real_drawable, &x_offset, &y_offset); return rb_ary_new3(3, GOBJ2RVAL(real_drawable), INT2NUM(x_offset), INT2NUM(y_offset)); } static VALUE rg_configure_finished(VALUE self) { gdk_window_configure_finished(_SELF(self)); return self; } static VALUE rg_enable_synchronized_configure(VALUE self) { gdk_window_enable_synchronized_configure(_SELF(self)); if (rb_block_given_p()) { rb_ensure(rb_yield, self, rg_configure_finished, self); } return self; } static VALUE rg_set_user_data(VALUE self, VALUE user_data) { gdk_window_set_user_data(_SELF(self), (gpointer)RVAL2GOBJ(user_data)); return self; } static VALUE rg_set_override_redirect(VALUE self, VALUE override_redirect) { gdk_window_set_override_redirect(_SELF(self), RVAL2CBOOL(override_redirect)); return self; } static VALUE rg_set_accept_focus(VALUE self, VALUE accept_focus) { gdk_window_set_accept_focus(_SELF(self), RVAL2CBOOL(accept_focus)); return self; } static VALUE rg_set_focus_on_map(VALUE self, VALUE focus_on_map) { gdk_window_set_focus_on_map(_SELF(self), RVAL2CBOOL(focus_on_map)); return self; } /* GdkXEvent is not implemented. void gdk_window_add_filter (GdkWindow *window, GdkFilterFunc function, gpointer data); void gdk_window_remove_filter (GdkWindow *window, GdkFilterFunc function, gpointer data); GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent, GdkEvent *event, gpointer data); */ static VALUE rg_shape_combine_mask(VALUE self, VALUE shape_mask, VALUE offset_x, VALUE offset_y) { gdk_window_shape_combine_mask(_SELF(self), GDK_BITMAP(RVAL2GOBJ(shape_mask)), NUM2INT(offset_x), NUM2INT(offset_y)); return self; } static VALUE rg_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y) { gdk_window_shape_combine_region(_SELF(self), NIL_P(shape_region) ? NULL : (GdkRegion*)RVAL2BOXED(shape_region, GDK_TYPE_REGION), INT2NUM(offset_x), INT2NUM(offset_y)); return self; } static VALUE rg_set_child_shapes(VALUE self) { gdk_window_set_child_shapes(_SELF(self)); return self; } static VALUE rg_merge_child_shapes(VALUE self) { gdk_window_merge_child_shapes(_SELF(self)); return self; } static VALUE rg_input_shape_combine_mask(VALUE self, VALUE mask, VALUE x, VALUE y) { gdk_window_input_shape_combine_mask(_SELF(self), GDK_BITMAP(RVAL2GOBJ(mask)), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_input_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y) { gdk_window_input_shape_combine_region(_SELF(self), (GdkRegion*)RVAL2BOXED(shape_region, GDK_TYPE_REGION), NUM2INT(offset_x), NUM2INT(offset_y)); return self; } static VALUE rg_set_child_input_shapes(VALUE self) { gdk_window_set_child_input_shapes(_SELF(self)); return self; } static VALUE rg_merge_child_input_shapes(VALUE self) { gdk_window_merge_child_input_shapes(_SELF(self)); return self; } static VALUE rg_set_static_gravities(VALUE self, VALUE use_static) { gboolean ret = gdk_window_set_static_gravities(_SELF(self), RVAL2CBOOL(use_static)); if (! ret) rb_raise(rb_eRuntimeError, "couldn't turn on static gravity"); return self; } static VALUE rg_set_title(VALUE self, VALUE title) { gdk_window_set_title(_SELF(self),RVAL2CSTR(title)); return self; } static VALUE rg_set_background(VALUE self, VALUE color) { gdk_window_set_background(_SELF(self), RVAL2GDKCOLOR(color)); return self; } static VALUE rg_set_back_pixmap(VALUE self, VALUE pixmap, VALUE parent_relative) { gdk_window_set_back_pixmap(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(pixmap)), RVAL2CBOOL(parent_relative)); return self; } #if !GTK_CHECK_VERSION(2,18, 0) static VALUE rg_set_cursor(VALUE self, VALUE cursor) { gdk_window_set_cursor(_SELF(self), RVAL2BOXED(cursor, GDK_TYPE_CURSOR)); return self; } #endif static VALUE rg_user_data(VALUE self) { GObject *data = NULL; gdk_window_get_user_data(_SELF(self), (gpointer)&data); return GOBJ2RVAL(data); } static VALUE rg_geometry(VALUE self) { gint x, y, w, h, d; gdk_window_get_geometry(_SELF(self), &x, &y, &w, &h, &d); return rb_ary_new3(5, INT2NUM(x), INT2NUM(y), INT2NUM(w), INT2NUM(h), INT2NUM(d)); } static VALUE rg_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask) { gdk_window_set_geometry_hints(_SELF(self), NIL_P(geometry) ? (GdkGeometry*)NULL : (GdkGeometry*)RVAL2BOXED(geometry, GDK_TYPE_GEOMETRY), RVAL2GFLAGS(geom_mask, GDK_TYPE_WINDOW_HINTS)); return self; } static VALUE rg_set_icon_list(VALUE self, VALUE rbpixbufs) { GdkWindow *window = _SELF(self); GList *pixbufs = RVAL2GDKPIXBUFGLIST(rbpixbufs); gdk_window_set_icon_list(window, pixbufs); g_list_free(pixbufs); return self; } static VALUE rg_set_modal_hint(VALUE self, VALUE modal) { gdk_window_set_modal_hint(_SELF(self), RVAL2CBOOL(modal)); return self; } static VALUE rg_set_type_hint(VALUE self, VALUE hint) { gdk_window_set_type_hint(_SELF(self), RVAL2GENUM(hint, GDK_TYPE_WINDOW_TYPE_HINT)); return self; } static VALUE rg_type_hint(VALUE self) { return GENUM2RVAL(gdk_window_get_type_hint(_SELF(self)), GDK_TYPE_WINDOW_TYPE_HINT); } static VALUE rg_set_skip_taskbar_hint(VALUE self, VALUE hint) { gdk_window_set_skip_taskbar_hint(_SELF(self), RVAL2CBOOL(hint)); return self; } static VALUE rg_set_skip_pager_hint(VALUE self, VALUE hint) { gdk_window_set_skip_pager_hint(_SELF(self), RVAL2CBOOL(hint)); return self; } static VALUE rg_set_urgency_hint(VALUE self, VALUE hint) { gdk_window_set_urgency_hint(_SELF(self), RVAL2CBOOL(hint)); return self; } static VALUE rg_position(VALUE self) { gint x, y; gdk_window_get_position(_SELF(self), &x, &y); return rb_assoc_new(INT2NUM(x), INT2NUM(y)); } static VALUE rg_root_origin(VALUE self) { int x, y; gdk_window_get_root_origin(_SELF(self), &x, &y); return rb_assoc_new(INT2FIX(x), INT2FIX(y)); } static VALUE rg_frame_extents(VALUE self) { GdkRectangle rect; gdk_window_get_frame_extents(_SELF(self), &rect); return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE); } static VALUE rg_origin(VALUE self) { gint x, y; gdk_window_get_origin(_SELF(self), &x, &y); return rb_assoc_new(INT2NUM(x), INT2NUM(y)); } static VALUE rg_pointer(VALUE self) { gint x, y; GdkModifierType state; GdkWindow* ret = gdk_window_get_pointer(_SELF(self), &x, &y, &state); return rb_ary_new3(4, GOBJ2RVAL(ret), INT2NUM(x), INT2NUM(y), GFLAGS2RVAL(state, GDK_TYPE_MODIFIER_TYPE)); } static VALUE rg_parent(VALUE self) { return GOBJ2RVAL(gdk_window_get_parent(_SELF(self))); } static VALUE rg_toplevel(VALUE self) { return GOBJ2RVAL(gdk_window_get_toplevel(_SELF(self))); } static VALUE rg_children(VALUE self) { /* Don't use gdk_window_get_children() here */ GList* list = gdk_window_peek_children(_SELF(self)); VALUE ary = rb_ary_new(); while (list) { rb_ary_push(ary, GOBJ2RVAL(list->data)); list = list->next; } return ary; } static VALUE rg_events(VALUE self) { return GFLAGS2RVAL(gdk_window_get_events(_SELF(self)), GDK_TYPE_EVENT_MASK); } static VALUE rg_set_events(VALUE self, VALUE mask) { gdk_window_set_events(_SELF(self), RVAL2GFLAGS(mask, GDK_TYPE_EVENT_MASK)); return self; } static VALUE rg_set_icon(VALUE self, VALUE icon, VALUE pixmap, VALUE mask) { gdk_window_set_icon(_SELF(self), NIL_P(icon) ? NULL :_SELF(icon), NIL_P(pixmap) ? NULL : GDK_PIXMAP(RVAL2GOBJ(pixmap)), NIL_P(mask) ? NULL : GDK_BITMAP(RVAL2GOBJ(mask))); return self; } static VALUE rg_set_icon_name(VALUE self, VALUE name) { gdk_window_set_icon_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_set_transient_for(VALUE self, VALUE parent) { gdk_window_set_transient_for(_SELF(self), _SELF(parent)); return self; } static VALUE rg_set_role(VALUE self, VALUE role) { gdk_window_set_role(_SELF(self), RVAL2CSTR(role)); return self; } static VALUE rg_set_group(VALUE self, VALUE leader) { gdk_window_set_group(_SELF(self), _SELF(leader)); return self; } static VALUE rg_group(VALUE self) { return GOBJ2RVAL(gdk_window_get_group(_SELF(self))); } static VALUE rg_set_decorations(VALUE self, VALUE decor) { gdk_window_set_decorations(_SELF(self), RVAL2GFLAGS(decor, GDK_TYPE_WM_DECORATION)); return self; } static VALUE rg_decorations(VALUE self) { GdkWMDecoration decorations; gboolean ret = gdk_window_get_decorations(_SELF(self), &decorations); return ret ? GFLAGS2RVAL(decorations, GDK_TYPE_WM_DECORATION) : Qnil; } static VALUE rg_set_functions(VALUE self, VALUE func) { gdk_window_set_functions(_SELF(self), RVAL2GFLAGS(func, GDK_TYPE_WM_FUNCTION)); return self; } #if GTK_CHECK_VERSION(2, 12, 0) static VALUE rg_set_composited(VALUE self, VALUE composited) { gdk_window_set_composited(_SELF(self), RVAL2CBOOL(composited)); return self; } static VALUE rg_set_opacity(VALUE self, VALUE opacity) { gdk_window_set_opacity(_SELF(self), NUM2DBL(opacity)); return self; } static VALUE rg_set_startup_id(VALUE self, VALUE startup_id) { gdk_window_set_startup_id(_SELF(self), RVAL2CSTR_ACCEPT_NIL(startup_id)); return self; } #endif static VALUE rg_s_toplevels(G_GNUC_UNUSED VALUE self) { return GLIST2ARYF(gdk_window_get_toplevels()); } static VALUE rg_s_default_root_window(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gdk_get_default_root_window()); } /* Would you need this? GdkPointerHooks* gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks); */ /* From X Window System Interaction */ static VALUE rg_s_foreign_new(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE arg[2]; GdkWindow * win = NULL; rb_scan_args(argc, argv, "11", &arg[0], &arg[1]); switch(argc) { case 1: win = gdk_window_foreign_new(RVAL2GDKNATIVEWINDOW(arg[0])); break; case 2: win = gdk_window_foreign_new_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1])); break; default: break; } if (win == NULL) return Qnil; else { return GOBJ2RVAL(win); } } static VALUE rg_s_lookup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE arg[2]; GdkWindow * win = NULL; rb_scan_args(argc, argv, "11", &arg[0], &arg[1]); switch(argc) { case 1: win = gdk_window_lookup(RVAL2GDKNATIVEWINDOW(arg[0])); break; case 2: win = gdk_window_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1])); break; default: break; } if (win == NULL) return Qnil; else { return GOBJ2RVAL(win); } } #ifdef GDK_WINDOWING_X11 static VALUE rg_server_time(VALUE self) { return UINT2NUM(gdk_x11_get_server_time(_SELF(self))); } static VALUE rg_set_user_time(VALUE self, VALUE time) { gdk_x11_window_set_user_time(_SELF(self), NUM2UINT(time)); return Qnil; } static VALUE rg_move_to_current_desktop(VALUE self) { gdk_x11_window_move_to_current_desktop(_SELF(self)); return self; } #endif void Init_gtk_gdk_window(VALUE mGdk) { GObjectClass *g_class; VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_WINDOW, "Window", mGdk); g_class = g_type_class_peek(GDK_TYPE_WINDOW); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(destroy, 0); RG_DEF_METHOD(window_type, 0); RG_DEF_SMETHOD(at_pointer, 0); RG_DEF_SMETHOD(constrain_size, 4); RG_DEF_SMETHOD(process_all_updates, 0); RG_DEF_SMETHOD(set_debug_updates, 1); RG_DEF_METHOD(show, 0); RG_DEF_METHOD(show_unraised, 0); RG_DEF_METHOD(hide, 0); RG_DEF_METHOD_P(visible, 0); RG_DEF_METHOD_P(viewable, 0); RG_DEF_METHOD(withdraw, 0); RG_DEF_METHOD(state, 0); RG_DEF_METHOD(iconify, 0); RG_DEF_METHOD(deiconify, 0); RG_DEF_METHOD(stick, 0); RG_DEF_METHOD(unstick, 0); RG_DEF_METHOD(maximize, 0); RG_DEF_METHOD(unmaximize, 0); RG_DEF_METHOD(fullscreen, 0); RG_DEF_METHOD(unfullscreen, 0); RG_DEF_METHOD(set_keep_above, 1); RG_DEF_METHOD(set_keep_below, 1); RG_DEF_METHOD(move, 2); RG_DEF_METHOD(resize, 2); RG_DEF_METHOD(move_resize, 4); RG_DEF_METHOD(scroll, 2); RG_DEF_METHOD(move_region, 3); RG_DEF_METHOD(reparent, 3); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD(clear_area, -1); RG_DEF_METHOD(raise, 0); RG_DEF_METHOD(lower, 0); RG_DEF_METHOD(focus, 1); RG_DEF_METHOD(register_dnd, 0); #if GTK_CHECK_VERSION(2, 12, 0) RG_DEF_METHOD(beep, 0); #endif RG_DEF_METHOD(begin_resize_drag, 5); RG_DEF_METHOD(begin_move_drag, 4); RG_DEF_METHOD(begin_paint, 1); RG_DEF_METHOD(end_paint, 0); RG_DEF_METHOD(invalidate, 2); RG_DEF_METHOD(invalidate_maybe_recurse, 1); RG_DEF_METHOD(update_area, 0); RG_DEF_METHOD(freeze_updates, 0); RG_DEF_METHOD(thaw_updates, 0); RG_DEF_METHOD(process_updates, 1); RG_DEF_METHOD(internal_paint_info, 0); RG_DEF_METHOD(configure_finished, 0); RG_DEF_METHOD(enable_synchronized_configure, 0); RG_DEF_METHOD(set_user_data, 1); RG_DEF_METHOD(set_override_redirect, 1); RG_DEF_METHOD(set_accept_focus, 1); RG_DEF_METHOD(set_focus_on_map, 1); RG_DEF_METHOD(shape_combine_mask, 3); RG_DEF_METHOD(shape_combine_region, 3); RG_DEF_METHOD(set_child_shapes, 0); RG_DEF_METHOD(merge_child_shapes, 0); RG_DEF_METHOD(input_shape_combine_mask, 3); RG_DEF_METHOD(input_shape_combine_region, 3); RG_DEF_METHOD(set_child_input_shapes, 0); RG_DEF_METHOD(merge_child_input_shapes, 0); RG_DEF_METHOD(set_static_gravities, 1); RG_DEF_METHOD(set_title, 1); RG_DEF_METHOD(set_background, 1); RG_DEF_METHOD(set_back_pixmap, 2); #if !GTK_CHECK_VERSION(2, 18, 0) RG_DEF_METHOD(set_cursor, 1); #endif RG_DEF_METHOD(user_data, 0); RG_DEF_METHOD(geometry, 0); RG_DEF_METHOD(set_geometry_hints, 2); RG_DEF_METHOD(set_icon_list, 1); RG_DEF_METHOD(set_modal_hint, 1); RG_DEF_METHOD(set_type_hint, 1); RG_DEF_METHOD(type_hint, 0); RG_DEF_METHOD(set_skip_taskbar_hint, 1); RG_DEF_METHOD(set_skip_pager_hint, 1); RG_DEF_METHOD(set_urgency_hint, 1); RG_DEF_METHOD(position, 0); RG_DEF_METHOD(root_origin, 0); RG_DEF_METHOD(frame_extents, 0); RG_DEF_METHOD(origin, 0); RG_DEF_METHOD(pointer, 0); RG_DEF_METHOD(parent, 0); RG_DEF_METHOD(toplevel, 0); RG_DEF_SMETHOD(default_root_window, 0); RG_DEF_METHOD(children, 0); RG_DEF_METHOD(events, 0); RG_DEF_METHOD(set_events, 1); RG_DEF_METHOD(set_icon, 3); RG_DEF_METHOD(set_icon_name, 1); RG_DEF_METHOD(set_transient_for, 1); RG_DEF_METHOD(set_role, 1); RG_DEF_METHOD(set_group, 1); RG_DEF_METHOD(group, 0); RG_DEF_METHOD(set_decorations, 1); RG_DEF_METHOD(decorations, 0); RG_DEF_METHOD(set_functions, 1); #if GTK_CHECK_VERSION(2, 12, 0) RG_DEF_METHOD(set_composited, 1); RG_DEF_METHOD(set_opacity, 1); RG_DEF_METHOD(set_startup_id, 1); #endif RG_DEF_SMETHOD(toplevels, 0); RG_DEF_SMETHOD(foreign_new, -1); RG_DEF_SMETHOD(lookup, -1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GdkWindowType */ G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WINDOW_TYPE, "GDK_WINDOW_"); /* GdkWindowClass */ G_DEF_CLASS(GDK_TYPE_WINDOW_CLASS, "Class", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WINDOW_CLASS, "GDK_"); /* GdkWindowHints */ G_DEF_CLASS(GDK_TYPE_WINDOW_HINTS, "Hints", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WINDOW_HINTS, "GDK_"); /* GdkGravity */ G_DEF_CLASS(GDK_TYPE_GRAVITY, "Gravity", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_GRAVITY, "GDK_"); /* GdkWindowEdge */ G_DEF_CLASS(GDK_TYPE_WINDOW_EDGE, "Edge", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WINDOW_EDGE, "GDK_WINDOW_"); /* GdkWindowTypeHint */ G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE_HINT, "TypeHint", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WINDOW_TYPE_HINT, "GDK_WINDOW_"); /* GdkWindowAttibutesType */ G_DEF_CLASS(GDK_TYPE_WINDOW_ATTRIBUTES_TYPE, "AttributesType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE, "GDK_"); /* GdkFilterReturn */ G_DEF_CLASS(GDK_TYPE_FILTER_RETURN, "FilterReturn", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_FILTER_RETURN, "GDK_"); /* GdkModifierType */ G_DEF_CLASS(GDK_TYPE_MODIFIER_TYPE, "ModifierType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_MODIFIER_TYPE, "GDK_"); /* GdkWMDecoration */ G_DEF_CLASS(GDK_TYPE_WM_DECORATION, "WMDecoration", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WM_DECORATION, "GDK_"); /* GdkWMFunction */ G_DEF_CLASS(GDK_TYPE_WM_FUNCTION, "WMFunction", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_WM_FUNCTION, "GDK_"); rb_define_const(RG_TARGET_NAMESPACE, "PARENT_RELATIVE", INT2FIX(GDK_PARENT_RELATIVE)); #ifdef GDK_WINDOWING_X11 RG_DEF_METHOD(server_time, 0); RG_DEF_METHOD(set_user_time, 1); RG_DEF_METHOD(move_to_current_desktop, 0); G_DEF_CLASS3("GdkWindowImplX11", "WindowImplX11", mGdk); #elif defined(GDK_WINDOWING_WIN32) G_DEF_CLASS3("GdkWindowImplWin32", "WindowImplWin32", mGdk); #elif defined(GDK_WINDOWING_FB) G_DEF_CLASS3("GdkWindowFB", "WindowFB", mGdk); #endif } ���������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdktimecoord.c������������������������������������������������0000644�0001750�0001750�00000006556�11701304107�020301� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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)); } ��������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/global.h��������������������������������������������������������0000644�0001750�0001750�00000034745�12257552167�016572� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2013 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 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 */ ���������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfontbutton.c�����������������������������������������������0000644�0001750�0001750�00000002737�12257552167�020555� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cFontButton static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE fontname; GtkWidget* widget; rb_scan_args(argc, argv, "01", &fontname); if (NIL_P(fontname)){ widget = gtk_font_button_new(); } else { widget = gtk_font_button_new_with_font(RVAL2CSTR(fontname)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_fontbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FONT_BUTTON, "FontButton", mGtk); RG_DEF_METHOD(initialize, -1); } ���������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreemodelfilter.c������������������������������������������0000644�0001750�0001750�00000013636�12257552167�021541� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cTreeModelFilter #define _SELF(s) (GTK_TREE_MODEL_FILTER(RVAL2GOBJ(s))) static ID id_child_model; static ID id_root; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE child_model, root; GtkTreeModel* widget; rb_scan_args(argc, argv, "11", &child_model, &root); G_CHILD_SET(self, id_child_model, child_model); if (NIL_P(root)){ widget = gtk_tree_model_filter_new(GTK_TREE_MODEL(RVAL2GOBJ(child_model)), (GtkTreePath*)NULL); } else { G_CHILD_SET(self, id_root, root); widget = gtk_tree_model_filter_new(GTK_TREE_MODEL(RVAL2GOBJ(child_model)), (GtkTreePath*)RVAL2GTKTREEPATH(root)); } G_INITIALIZE(self, widget); return Qnil; } static gboolean visible_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { VALUE ret; iter->user_data3 = model; ret = rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); return RVAL2CBOOL(ret); } static VALUE rg_set_visible_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_model_filter_set_visible_func(_SELF(self), (GtkTreeModelFilterVisibleFunc)visible_func, (gpointer)func, NULL); return self; } static void modify_func(GtkTreeModel *model, GtkTreeIter *iter, GValue *value, gint column, gpointer func) { VALUE ret; iter->user_data3 = model; ret = rb_funcall((VALUE)func, id_call, 3, GOBJ2RVAL(model), GTKTREEITER2RVAL(iter), INT2NUM(column)); rbgobj_rvalue_to_gvalue(ret, value); } /* * Should return value * * e.g. * filter.set_modify_func(String) do |model, iter, column| * "foo" * end */ static VALUE rg_set_modify_func(int argc, VALUE *argv, VALUE self) { VALUE func = rb_block_proc(); gint i; GType* types; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); types = ALLOCA_N(GType, argc); G_RELATIVE(self, func); for (i = 0; i < argc; i++){ types[i] = CLASS2GTYPE(argv[i]); } gtk_tree_model_filter_set_modify_func(_SELF(self), argc, types, (GtkTreeModelFilterModifyFunc)modify_func, (gpointer)func, NULL); return self; } static VALUE rg_set_visible_column(VALUE self, VALUE column) { gtk_tree_model_filter_set_visible_column(_SELF(self), NUM2INT(column)); return self; } static VALUE rg_model(VALUE self) { return GOBJ2RVAL(gtk_tree_model_filter_get_model(_SELF(self))); } static VALUE rg_convert_child_iter_to_iter(VALUE self, VALUE child_iter) { GtkTreeIter filter_iter; GtkTreeModelFilter* modelfilter = _SELF(self); gtk_tree_model_filter_convert_child_iter_to_iter(modelfilter, &filter_iter, RVAL2GTKTREEITER(child_iter)); filter_iter.user_data3 = gtk_tree_model_filter_get_model(modelfilter); return GTKTREEITER2RVAL(&filter_iter); } static VALUE rg_convert_iter_to_child_iter(VALUE self, VALUE filtered_iter) { GtkTreeIter child_iter; GtkTreeModelFilter* modelfilter = _SELF(self); gtk_tree_model_filter_convert_iter_to_child_iter(modelfilter, &child_iter, RVAL2GTKTREEITER(filtered_iter)); child_iter.user_data3 = gtk_tree_model_filter_get_model(modelfilter); return GTKTREEITER2RVAL(&child_iter); } static VALUE rg_convert_child_path_to_path(VALUE self, VALUE child_path) { return GTKTREEPATH2RVAL(gtk_tree_model_filter_convert_child_path_to_path( _SELF(self), RVAL2GTKTREEPATH(child_path))); } static VALUE rg_convert_path_to_child_path(VALUE self, VALUE filter_path) { return GTKTREEPATH2RVAL(gtk_tree_model_filter_convert_path_to_child_path( _SELF(self), RVAL2GTKTREEPATH(filter_path))); } static VALUE rg_refilter(VALUE self) { gtk_tree_model_filter_refilter(_SELF(self)); return self; } static VALUE rg_clear_cache(VALUE self) { gtk_tree_model_filter_clear_cache(_SELF(self)); return self; } void Init_gtk_treemodelfilter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_MODEL_FILTER, "TreeModelFilter", mGtk); id_child_model = rb_intern("child_model"); id_root = rb_intern("root"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_visible_func, 0); RG_DEF_METHOD(set_modify_func, -1); RG_DEF_METHOD(set_visible_column, 1); RG_DEF_METHOD(model, 0); RG_DEF_METHOD(convert_child_iter_to_iter, 1); RG_DEF_METHOD(convert_iter_to_child_iter, 1); RG_DEF_METHOD(convert_child_path_to_path, 1); RG_DEF_METHOD(convert_path_to_child_path, 1); RG_DEF_METHOD(refilter, 0); RG_DEF_METHOD(clear_cache, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ��������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrenderer.c���������������������������������������������0000644�0001750�0001750�00000011100�12257552167�021001� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } #ifndef GTK_DISABLE_DEPRECATED static VALUE rg_editing_canceled(VALUE self) { gtk_cell_renderer_editing_canceled(_SELF(self)); return self; } #endif static VALUE rg_stop_editing(VALUE self, VALUE canceled) { gtk_cell_renderer_stop_editing(_SELF(self), RVAL2CBOOL(canceled)); return self; } 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); #ifndef GTK_DISABLE_DEPRECATED RG_DEF_METHOD(editing_canceled, 0); #endif RG_DEF_METHOD(stop_editing, 1); 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_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkx11.c������������������������������������������������������0000644�0001750�0001750�00000021153�12257552167�016735� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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: win = gdk_xid_table_lookup_for_display(RVAL2GOBJ(arg[0]), NUM2UINT(arg[1])); 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 } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkiconinfo.c�������������������������������������������������0000644�0001750�0001750�00000005752�12257552167�020157� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cIconInfo #define _SELF(i) ((GtkIconInfo*)RVAL2BOXED(i, GTK_TYPE_ICON_INFO)) static VALUE rg_base_size(VALUE self) { return INT2NUM(gtk_icon_info_get_base_size(_SELF(self))); } static VALUE rg_filename(VALUE self) { return CSTR2RVAL(gtk_icon_info_get_filename(_SELF(self))); } static VALUE rg_builtin_pixbuf(VALUE self) { return GOBJ2RVAL(gtk_icon_info_get_builtin_pixbuf(_SELF(self))); } static VALUE rg_load_icon(VALUE self) { GError* error = NULL; GdkPixbuf* pixbuf = gtk_icon_info_load_icon(_SELF(self), &error); VALUE ret; if (error) RAISE_GERROR(error); ret = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return ret; } static VALUE rg_set_raw_coordinates(VALUE self, VALUE raw_coordinates) { gtk_icon_info_set_raw_coordinates(_SELF(self), RVAL2CBOOL(raw_coordinates)); return self; } static VALUE rg_embedded_rect(VALUE self) { GdkRectangle rectangle; gboolean ret = gtk_icon_info_get_embedded_rect(_SELF(self), &rectangle); if (ret) return BOXED2RVAL(&rectangle, GDK_TYPE_RECTANGLE); else return Qnil; } static VALUE rg_attach_points(VALUE self) { GdkPoint* points; gint n_points, i; gboolean ret = gtk_icon_info_get_attach_points(_SELF(self), &points, &n_points); VALUE ary = Qnil; if (ret){ ary = rb_ary_new(); for (i = 0; i < n_points; i++){ rb_ary_push(ary, rb_assoc_new(INT2NUM(points[i].x), INT2NUM(points[i].y))); } g_free(points); } return ary; } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(gtk_icon_info_get_display_name(_SELF(self))); } void Init_gtk_iconinfo(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_INFO, "IconInfo", mGtk); RG_DEF_METHOD(base_size, 0); RG_DEF_METHOD(filename, 0); RG_DEF_METHOD(builtin_pixbuf, 0); RG_DEF_METHOD(load_icon, 0); RG_DEF_METHOD(set_raw_coordinates, 1); RG_DEF_METHOD(embedded_rect, 0); RG_DEF_METHOD(attach_points, 0); RG_DEF_METHOD(display_name, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ����������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccelerator.c����������������������������������������������0000644�0001750�0001750�00000004733�12257552167�020635� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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))); } 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))); } 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); RG_DEF_SMETHOD(get_label, 2); RG_DEF_SMETHOD(set_default_mod_mask, 1); RG_DEF_SMETHOD(default_mod_mask, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkscale.c����������������������������������������������������0000644�0001750�0001750�00000003116�12257552167�017432� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cScale #define _SELF(self) (GTK_SCALE(RVAL2GOBJ(self))) static VALUE rg_layout(VALUE self) { return GOBJ2RVAL(gtk_scale_get_layout(_SELF(self))); } static VALUE rg_layout_offsets(VALUE self) { gint x, y; gtk_scale_get_layout_offsets(_SELF(self), &x, &y); return rb_assoc_new(INT2NUM(x), INT2NUM(y)); } void Init_gtk_scale(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCALE, "Scale", mGtk); RG_DEF_METHOD(layout, 0); RG_DEF_METHOD(layout_offsets, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbox.c������������������������������������������������������0000644�0001750�0001750�00000007762�11701304107�017124� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ��������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbuilder.c��������������������������������������������������0000644�0001750�0001750�00000011125�11701304107�017746� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextappearance.c�������������������������������������������0000644�0001750�0001750�00000012353�11701304107�021330� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" /*****************************************/ static GtkTextAppearance* app_copy(const GtkTextAppearance* app) { GtkTextAppearance* new_app; g_return_val_if_fail (app != NULL, NULL); new_app = g_new(GtkTextAppearance, 1); *new_app = *app; return new_app; } GType gtk_text_appearance_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkTextAppearance", (GBoxedCopyFunc)app_copy, (GBoxedFreeFunc)g_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cTextAppearance #define _SELF(t) ((GtkTextAppearance*)RVAL2BOXED(t, GTK_TYPE_TEXT_APPEARANCE)) /***********************************************/ #define ATTR_INT(name)\ static VALUE \ txt_app_int_ ## name (VALUE self)\ {\ return INT2NUM(_SELF(self)->name);\ }\ static VALUE \ txt_app_int_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = NUM2INT(val); \ return self;\ } #define ATTR_BOOL(name)\ static VALUE \ txt_app_bool_ ## name (VALUE self)\ {\ return CBOOL2RVAL(_SELF(self)->name);\ }\ static VALUE \ txt_app_bool_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2CBOOL(val);\ return self;\ } #define ATTR_ENUM(name, gtype)\ static VALUE \ txt_app_enums_ ## name (VALUE self)\ {\ return GENUM2RVAL(_SELF(self)->name, gtype);\ }\ static VALUE \ txt_app_enums_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2GENUM(val, gtype);\ return self;\ } #define ATTR_GOBJ(name)\ static VALUE \ txt_app_gobj_ ## name (VALUE self)\ {\ VALUE val; \ if (_SELF(self)->name == NULL) return Qnil;\ val = GOBJ2RVAL(_SELF(self)->name); \ G_CHILD_SET(self, rb_intern(G_STRINGIFY(name)), val);\ return val; \ }\ static VALUE \ txt_app_gobj_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2GOBJ(val);\ G_CHILD_SET(self, rb_intern(G_STRINGIFY(name)), val);\ return self;\ } #define ATTR_COLOR(name)\ static VALUE \ txt_app_color_ ## name (VALUE self)\ {\ VALUE val = BOXED2RVAL(&_SELF(self)->name, GDK_TYPE_COLOR);\ G_CHILD_SET(self, rb_intern(G_STRINGIFY(name)), val);\ return val;\ }\ static VALUE \ txt_app_color_set_ ## name (VALUE self, VALUE val)\ {\ G_CHILD_SET(self, rb_intern(G_STRINGIFY(name)), val);\ _SELF(self)->name = *RVAL2GDKCOLOR(val); \ return self;\ } #define DEFINE_ACCESSOR(gt, type, name) \ rb_define_method(gt, G_STRINGIFY(name), txt_app_ ## type ## _## name, 0);\ rb_define_method(gt, G_STRINGIFY(set_ ## name), txt_app_ ## type ## _set_## name, 1); /***********************************************/ ATTR_COLOR(bg_color); ATTR_COLOR(fg_color); ATTR_GOBJ(bg_stipple); ATTR_GOBJ(fg_stipple); ATTR_INT(rise); ATTR_ENUM(underline, PANGO_TYPE_UNDERLINE); ATTR_BOOL(strikethrough); ATTR_BOOL(draw_bg); ATTR_BOOL(inside_selection); ATTR_BOOL(is_text); static VALUE rg_initialize(VALUE self) { GtkTextAppearance* app = ALLOC(GtkTextAppearance); memset(app, 0, sizeof(GtkTextAppearance)); G_INITIALIZE(self, app); return Qnil; } void Init_gtk_text_appearance(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_APPEARANCE, "TextAppearance", mGtk); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, color, bg_color); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, color, fg_color); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, gobj, bg_stipple); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, gobj, fg_stipple); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, rise); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, underline); RG_DEF_METHOD(initialize, 0); rb_define_method(RG_TARGET_NAMESPACE, "strikethrough?", txt_app_bool_strikethrough, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_strikethrough", txt_app_bool_set_strikethrough, 1); rb_define_method(RG_TARGET_NAMESPACE, "draw_bg?", txt_app_bool_draw_bg, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_draw_bg", txt_app_bool_set_draw_bg, 1); rb_define_method(RG_TARGET_NAMESPACE, "inside_selection?", txt_app_bool_inside_selection, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_inside_selection", txt_app_bool_set_inside_selection, 1); rb_define_method(RG_TARGET_NAMESPACE, "text?", txt_app_bool_is_text, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_text", txt_app_bool_set_is_text, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprintjob.c�������������������������������������������������0000644�0001750�0001750�00000007352�11701304107�020156� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #ifdef HAVE_GTK_UNIX_PRINT #include <gtk/gtkprintjob.h> #ifndef GTK_TYPE_PRINT_CAPABILITIES # define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type()) #endif #ifdef HAVE_RB_CAIRO_H # include <rb_cairo.h> #endif #define RG_TARGET_NAMESPACE cPrintJob #define _SELF(s) (GTK_PRINT_JOB(RVAL2GOBJ(s))) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_initialize(VALUE self, VALUE title, VALUE printer, VALUE settings, VALUE page_setup) { GtkPrintJob *job; job = gtk_print_job_new(RVAL2CSTR(title), GTK_PRINTER(RVAL2GOBJ(printer)), GTK_PRINT_SETTINGS(RVAL2GOBJ(settings)), GTK_PAGE_SETUP(RVAL2GOBJ(page_setup))); G_INITIALIZE(self, job); return Qnil; } static VALUE rg_status(VALUE self) { return GENUM2RVAL(gtk_print_job_get_status(_SELF(self)), GTK_TYPE_PRINT_STATUS); } static VALUE rg_set_source_file(VALUE self, VALUE filename) { GError *error = NULL; gboolean result; result = gtk_print_job_set_source_file(_SELF(self), RVAL2CSTR(filename), &error); if (!result) RAISE_GERROR(error); return Qnil; } #ifdef HAVE_RB_CAIRO_H static VALUE rg_surface(VALUE self) { cairo_surface_t *surface; GError *error = NULL; surface = gtk_print_job_get_surface(_SELF(self), &error); if (error) RAISE_GERROR(error); return CRSURFACE2RVAL(surface); } #endif struct callback_arg { VALUE callback; VALUE job; GError* error; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; if (arg->error) RAISE_GERROR(arg->error); rb_funcall(arg->callback, id_call, 1, arg->job); return Qnil; } static void complete_func(GtkPrintJob *job, gpointer data, GError *error) { struct callback_arg arg; arg.callback = (VALUE)data; arg.job = GOBJ2RVAL(job); arg.error = error; G_PROTECT_CALLBACK(invoke_callback, &arg); } static void remove_callback_reference(gpointer data) { G_CHILD_REMOVE(RG_TARGET_NAMESPACE, (VALUE)data); } static VALUE rg_send(VALUE self) { VALUE block = rb_block_proc(); G_CHILD_ADD(RG_TARGET_NAMESPACE, block); gtk_print_job_send(_SELF(self), complete_func, (gpointer)block, remove_callback_reference); return self; } #endif void Init_gtk_print_job(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_JOB, "PrintJob", mGtk); G_DEF_CLASS(GTK_TYPE_PRINT_CAPABILITIES, "PrintCapabilities", mGtk); RG_DEF_METHOD(initialize, 4); RG_DEF_METHOD(status, 0); RG_DEF_METHOD(set_source_file, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "source_file"); #ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(surface, 0); #endif RG_DEF_METHOD(send, 0); #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktearoffmenuitem.c������������������������������������������0000644�0001750�0001750�00000002625�11701304107�021517� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTearoffMenuItem static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_tearoff_menu_item_new()); return Qnil; } void Init_gtk_tearoff_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEAROFF_MENU_ITEM, "TearoffMenuItem", mGtk); RG_DEF_METHOD(initialize, 0); } �����������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrendereraccel.c����������������������������������������0000644�0001750�0001750�00000003037�12257552167�022003� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } void Init_gtk_cellrendereraccel(VALUE mGtk) { 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_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtksettings.c�������������������������������������������������0000644�0001750�0001750�00000016022�12257552167�020203� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003,2004 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 cSettings static VALUE prop_func_table; static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_settings_get_default()); } static VALUE rg_s_get_for_screen(G_GNUC_UNUSED VALUE self, VALUE screen) { return GOBJ2RVAL(gtk_settings_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); } /* * Gtk::Settings.install_property(...) do |spec, str| * #parse str * new_val = .... # parse value from string. * new_val # return new_val or nil if you can't convert the value. * end */ static gboolean rc_property_parser(const GParamSpec *pspec, const GString *rc_string, GValue *property_value) { VALUE spec = GOBJ2RVAL((gpointer)pspec); VALUE func = rb_hash_aref(prop_func_table, spec); VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str)); if (NIL_P(ret)) { return FALSE; } else if (RVAL2CBOOL(ret)){ rbgobj_rvalue_to_gvalue(ret, property_value); return TRUE; } else { rb_raise(rb_eArgError, "Gtk::Settings#install_property() block should return new value or nil"); } } static VALUE rg_s_install_property(VALUE self, VALUE spec) { GParamSpec* pspec = G_PARAM_SPEC(RVAL2GOBJ(spec)); if (rb_block_given_p()){ VALUE func = rb_block_proc(); rb_hash_aset(prop_func_table, spec, func); gtk_settings_install_property_parser(pspec, (GtkRcPropertyParser)rc_property_parser); } else { gtk_settings_install_property(pspec); } return self; } static VALUE settings_rc_property_parse(G_GNUC_UNUSED VALUE self, VALUE rbspec, VALUE rbstring, GtkRcPropertyParser parser) { GParamSpec *spec = RVAL2GOBJ(rbspec); GString *string = g_string_new(RVAL2CSTR(rbstring)); GValue property = G_VALUE_INIT; gboolean parsed; g_value_init(&property, spec->value_type); parsed = parser(spec, string, &property); g_string_free(string, TRUE); return parsed ? GVAL2RVAL_UNSET(&property) : Qnil; } static VALUE rg_s_rc_property_parse_color(VALUE self, VALUE rbspec, VALUE rbstring) { return settings_rc_property_parse(self, rbspec, rbstring, gtk_rc_property_parse_color); } static VALUE rg_s_rc_property_parse_enum(VALUE self, VALUE rbspec, VALUE rbstring) { return settings_rc_property_parse(self, rbspec, rbstring, gtk_rc_property_parse_enum); } static VALUE rg_s_rc_property_parse_flags(VALUE self, VALUE rbspec, VALUE rbstring) { return settings_rc_property_parse(self, rbspec, rbstring, gtk_rc_property_parse_flags); } static VALUE rg_s_rc_property_parse_requisition(G_GNUC_UNUSED VALUE self, VALUE rbspec, VALUE rbstring) { GParamSpec *spec = RVAL2GOBJ(rbspec); GString *string = g_string_new(RVAL2CSTR(rbstring)); GValue property = G_VALUE_INIT; gboolean parsed; GtkRequisition *requisition; gint width; gint height; g_value_init(&property, GTK_TYPE_REQUISITION); parsed = gtk_rc_property_parse_requisition(spec, string, &property); g_string_free(string, TRUE); if (!parsed) return Qnil; requisition = g_value_get_boxed(&property); width = requisition->width; height = requisition->height; g_value_unset(&property); return rb_assoc_new(INT2NUM(width), INT2NUM(height)); } static VALUE settings_rc_property_parse_border_result(VALUE value) { return BOXED2RVAL(g_value_get_boxed((GValue *)value), GTK_TYPE_BORDER); } static VALUE settings_rc_property_parse_border_ensure(VALUE value) { g_value_unset((GValue *)value); return Qnil; } static VALUE rg_s_rc_property_parse_border(G_GNUC_UNUSED VALUE self, VALUE rbspec, VALUE rbstring) { GParamSpec *spec = RVAL2GOBJ(rbspec); GString *string = g_string_new(RVAL2CSTR(rbstring)); GValue property = G_VALUE_INIT; gboolean parsed; g_value_init(&property, GTK_TYPE_BORDER); parsed = gtk_rc_property_parse_border(spec, string, &property); g_string_free(string, TRUE); if (!parsed) return Qnil; return rb_ensure(settings_rc_property_parse_border_result, (VALUE)&property, settings_rc_property_parse_border_ensure, (VALUE)&property); } static VALUE rg_set_property_value(VALUE self, VALUE rbname, VALUE rbvalue, VALUE origin) { GtkSettings *settings = GTK_SETTINGS(RVAL2GOBJ(self)); GtkSettingsValue svalue = { (gchar *)RVAL2CSTR(origin), G_VALUE_INIT }; const gchar *name = RVAL2CSTR(rbname); g_value_init(&svalue.value, RVAL2GTYPE(rbvalue)); rbgobj_rvalue_to_gvalue(rbvalue, &svalue.value); gtk_settings_set_property_value(settings, name, &svalue); g_value_unset(&svalue.value); return self; } /* We don't need them, Use set_property_value() instead. void gtk_settings_set_string_property (GtkSettings *settings, const gchar *name, const gchar *v_string, const gchar *origin); void gtk_settings_set_long_property (GtkSettings *settings, const gchar *name, glong v_long, const gchar *origin); void gtk_settings_set_double_property (GtkSettings *settings, const gchar *name, gdouble v_double, const gchar *origin); */ void Init_gtk_settings(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SETTINGS, "Settings", mGtk); rb_global_variable(&prop_func_table); prop_func_table = rb_hash_new(); RG_DEF_SMETHOD(default, 0); RG_DEF_SMETHOD(get_for_screen, 1); RG_DEF_SMETHOD(install_property, 1); RG_DEF_SMETHOD(rc_property_parse_color, 2); RG_DEF_SMETHOD(rc_property_parse_enum, 2); RG_DEF_SMETHOD(rc_property_parse_flags, 2); RG_DEF_SMETHOD(rc_property_parse_requisition, 2); RG_DEF_SMETHOD(rc_property_parse_border, 2); RG_DEF_METHOD(set_property_value, 3); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/extconf.rb������������������������������������������������������0000644�0001750�0001750�00000007000�12446160551�017124� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=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 unless check_cairo(:top_dir => top_dir) exit(false) end setup_windows(module_name, base_dir) unless required_pkg_config_package([package_id, 2, 10, 0], :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 ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvbbox.c����������������������������������������������������0000644�0001750�0001750�00000002572�11701304107�017446� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVButtonBox static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_vbutton_box_new()); return Qnil; } void Init_gtk_vbutton_box(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VBUTTON_BOX, "VButtonBox", mGtk); RG_DEF_METHOD(initialize, 0); } ��������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtknotebook.c�������������������������������������������������0000644�0001750�0001750�00000030476�12257552167�020174� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cNotebook #define _SELF(self) GTK_NOTEBOOK(RVAL2GOBJ(self)) #define RVAL2WIDGET(w) GTK_WIDGET(RVAL2GOBJ(w)) #define GTK_TYPE_NOTEBOOK_PAGE (gtk_notebookpage_get_type()) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_notebook_new()); return Qnil; } static VALUE rg_append_page(int argc, VALUE *argv, VALUE self) { VALUE child, label; rb_scan_args(argc, argv, "11", &child, &label); gtk_notebook_append_page(_SELF(self), RVAL2WIDGET(child), NIL_P(label) ? NULL : RVAL2WIDGET(label)); G_CHILD_ADD(self, child); return self; } static VALUE rg_append_page_menu(int argc, VALUE *argv, VALUE self) { VALUE child, tab_label, menu_label; rb_scan_args(argc, argv, "12", &child, &tab_label, &menu_label); gtk_notebook_append_page_menu(_SELF(self), RVAL2WIDGET(child), RVAL2WIDGET(tab_label), NIL_P(menu_label) ? NULL : RVAL2WIDGET(menu_label)); return self; } static VALUE rg_prepend_page(int argc, VALUE *argv, VALUE self) { VALUE child, label; rb_scan_args(argc, argv, "11", &child, &label); gtk_notebook_prepend_page(_SELF(self), RVAL2WIDGET(child), NIL_P(label) ? NULL : RVAL2WIDGET(label)); return self; } static VALUE rg_prepend_page_menu(int argc, VALUE *argv, VALUE self) { VALUE child, tab_label, menu_label; rb_scan_args(argc, argv, "12", &child, &tab_label, &menu_label); gtk_notebook_prepend_page_menu(_SELF(self), RVAL2WIDGET(child), RVAL2WIDGET(tab_label), NIL_P(menu_label) ? NULL : RVAL2WIDGET(menu_label)); return self; } static VALUE rg_insert_page(int argc, VALUE *argv, VALUE self) { VALUE pos, child, label; rb_scan_args(argc, argv, "21", &pos, &child, &label); gtk_notebook_insert_page(_SELF(self), RVAL2WIDGET(child), NIL_P(label) ? NULL : RVAL2WIDGET(label), NUM2INT(pos)); return self; } static VALUE rg_insert_page_menu(int argc, VALUE *argv, VALUE self) { VALUE pos, child, tab_label, menu_label; rb_scan_args(argc, argv, "22", &pos, &child, &tab_label, &menu_label); gtk_notebook_insert_page_menu(_SELF(self), RVAL2WIDGET(child), RVAL2WIDGET(tab_label), RVAL2WIDGET(menu_label), NUM2INT(pos)); return self; } static VALUE rg_remove_page(VALUE self, VALUE pos) { gtk_notebook_remove_page(_SELF(self), NUM2INT(pos)); return self; } static VALUE rg_page_num(VALUE self, VALUE child) { return INT2FIX(gtk_notebook_page_num(_SELF(self), RVAL2WIDGET(child))); } static VALUE rg_next_page(VALUE self) { gtk_notebook_next_page(_SELF(self)); return self; } static VALUE rg_prev_page(VALUE self) { gtk_notebook_prev_page(_SELF(self)); return self; } static VALUE rg_reorder_child(VALUE self, VALUE child, VALUE pos) { gtk_notebook_reorder_child(_SELF(self), RVAL2WIDGET(child), NUM2INT(pos)); return self; } static VALUE rg_get_menu_label(VALUE self, VALUE child) { return GOBJ2RVAL(gtk_notebook_get_menu_label(_SELF(self), RVAL2WIDGET(child))); } static VALUE rg_get_nth_page(VALUE self, VALUE page_num) { GtkWidget *page = gtk_notebook_get_nth_page(_SELF(self), NUM2INT(page_num)); return page ? GOBJ2RVAL(page) : Qnil; } static VALUE rg_n_pages(VALUE self) { return INT2NUM(gtk_notebook_get_n_pages(_SELF(self))); } static VALUE rg_get_tab_label(VALUE self, VALUE child) { return GOBJ2RVAL(gtk_notebook_get_tab_label(_SELF(self), RVAL2WIDGET(child))); } static VALUE rg_query_tab_label_packing(VALUE self, VALUE child) { gboolean expand, fill; GtkPackType pack_type; VALUE ary; gtk_notebook_query_tab_label_packing(_SELF(self), RVAL2WIDGET(child), &expand, &fill, &pack_type); ary = rb_ary_new2(3); rb_ary_push(ary, CBOOL2RVAL(expand)); rb_ary_push(ary, CBOOL2RVAL(fill)); rb_ary_push(ary, GENUM2RVAL(pack_type, GTK_TYPE_PACK_TYPE)); return ary; } static VALUE rg_set_menu_label(VALUE self, VALUE child, VALUE label) { gtk_notebook_set_menu_label(_SELF(self), RVAL2WIDGET(child), NIL_P(label)?NULL:RVAL2WIDGET(label)); return self; } static VALUE rg_set_menu_label_text(VALUE self, VALUE child, VALUE text) { gtk_notebook_set_menu_label_text(_SELF(self), RVAL2WIDGET(child), RVAL2CSTR(text)); return self; } static VALUE rg_set_tab_label(VALUE self, VALUE child, VALUE label) { gtk_notebook_set_tab_label(_SELF(self), RVAL2WIDGET(child), NIL_P(label)?NULL:RVAL2WIDGET(label)); return self; } static VALUE rg_set_tab_label_packing(VALUE self, VALUE child, VALUE expand, VALUE fill, VALUE pack_type) { gtk_notebook_set_tab_label_packing(_SELF(self), RVAL2WIDGET(child), RVAL2CBOOL(expand), RVAL2CBOOL(fill), RVAL2GENUM(pack_type, GTK_TYPE_PACK_TYPE)); return self; } static VALUE rg_set_tab_label_text(VALUE self, VALUE child, VALUE text) { gtk_notebook_set_tab_label_text(_SELF(self), RVAL2WIDGET(child), RVAL2CSTR(text)); return self; } static VALUE rg_get_menu_label_text(VALUE self, VALUE child) { return CSTR2RVAL(gtk_notebook_get_menu_label_text(_SELF(self), RVAL2WIDGET(child))); } static VALUE rg_get_tab_label_text(VALUE self, VALUE child) { return CSTR2RVAL(gtk_notebook_get_tab_label_text(_SELF(self), RVAL2WIDGET(child))); } static VALUE rg_get_tab_reorderable(VALUE self, VALUE child) { return CBOOL2RVAL(gtk_notebook_get_tab_reorderable(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)))); } static VALUE rg_set_tab_reorderable(VALUE self, VALUE child, VALUE reorderable) { gtk_notebook_set_tab_reorderable(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), RVAL2CBOOL(reorderable)); return self; } static VALUE rg_get_tab_detachable(VALUE self, VALUE child) { return CBOOL2RVAL(gtk_notebook_get_tab_detachable(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)))); } static VALUE rg_set_tab_detachable(VALUE self, VALUE child, VALUE detachable) { gtk_notebook_set_tab_detachable(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), RVAL2CBOOL(detachable)); return self; } static GtkNotebook* creation_func(GtkNotebook *source, GtkWidget *page, gint x, gint y, gpointer func) { VALUE ret; ret = rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(source), GOBJ2RVAL(page), INT2NUM(x), INT2NUM(y)); return NIL_P(ret) ? (GtkNotebook*)NULL : GTK_NOTEBOOK(RVAL2GOBJ(ret)); } static VALUE rg_s_set_window_creation_hook(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_notebook_set_window_creation_hook((GtkNotebookWindowCreationFunc)creation_func, (gpointer)func, (GDestroyNotify)NULL); return self; } #if GTK_CHECK_VERSION(2,20,0) static VALUE rg_set_action_widget(VALUE self, VALUE widget, VALUE pack_type) { gtk_notebook_set_action_widget(_SELF(self), RVAL2WIDGET(widget), RVAL2GENUM(pack_type, GTK_TYPE_PACK_TYPE)); return self; } static VALUE rg_get_action_widget(VALUE self, VALUE pack_type) { return GOBJ2RVAL(gtk_notebook_get_action_widget(_SELF(self), RVAL2GENUM(pack_type, GTK_TYPE_PACK_TYPE))); } #endif /***********************************************/ /* * Gtk::NotebookPage */ typedef struct { VALUE parent; GtkNotebookPage *page; } GtkNotebookPageData; static GtkNotebookPageData * notebookpage_copy(const GtkNotebookPage *page) { GtkNotebookPageData *data; g_return_val_if_fail (page != NULL, NULL); data = g_new(GtkNotebookPageData, 1); data->page = (GtkNotebookPage *)page; return data; } static GType gtk_notebookpage_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkNotebookPageData", (GBoxedCopyFunc)notebookpage_copy, (GBoxedFreeFunc)g_free); return our_type; } static VALUE signal_g2r_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkNotebookPageData npp; npp.parent = GVAL2RVAL(&values[0]); npp.page = (GtkNotebookPage*)g_value_get_pointer(&values[1]); return rb_ary_new3(3, GVAL2RVAL(&values[0]), BOXED2RVAL(&npp, GTK_TYPE_NOTEBOOK_PAGE), GVAL2RVAL(&values[2])); } /*****************************************/ void Init_gtk_notebook(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_NOTEBOOK, "Notebook", mGtk); G_DEF_CLASS(GTK_TYPE_NOTEBOOK_PAGE, "NotebookPage", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_page, -1); RG_DEF_METHOD(append_page_menu, -1); RG_DEF_METHOD(prepend_page, -1); RG_DEF_METHOD(prepend_page_menu, -1); RG_DEF_METHOD(insert_page, -1); RG_DEF_METHOD(insert_page_menu, -1); RG_DEF_METHOD(remove_page, 1); RG_DEF_METHOD(page_num, 1); RG_DEF_METHOD(next_page, 0); RG_DEF_METHOD(prev_page, 0); RG_DEF_METHOD(reorder_child, 2); RG_DEF_METHOD(get_menu_label, 1); RG_DEF_METHOD(get_nth_page, 1); RG_DEF_METHOD(n_pages, 0); RG_DEF_METHOD(get_tab_label, 1); RG_DEF_METHOD(query_tab_label_packing, 1); RG_DEF_METHOD(set_menu_label, 2); RG_DEF_METHOD(set_menu_label_text, 2); RG_DEF_METHOD(set_tab_label, 2); RG_DEF_METHOD(set_tab_label_packing, 4); RG_DEF_METHOD(set_tab_label_text, 2); RG_DEF_METHOD(get_menu_label_text, 1); RG_DEF_METHOD(get_tab_label_text, 1); RG_DEF_METHOD(get_tab_reorderable, 1); RG_DEF_METHOD(set_tab_reorderable, 2); RG_DEF_METHOD(get_tab_detachable, 1); RG_DEF_METHOD(set_tab_detachable, 2); RG_DEF_SMETHOD(set_window_creation_hook, 0); #if GTK_CHECK_VERSION(2,20,0) RG_DEF_METHOD(set_action_widget, 2); RG_DEF_METHOD(get_action_widget, 1); #endif /* GtkNotebookTab */ rb_define_const(RG_TARGET_NAMESPACE, "TAB_FIRST", GTK_NOTEBOOK_TAB_FIRST); rb_define_const(RG_TARGET_NAMESPACE, "TAB_LAST", GTK_NOTEBOOK_TAB_LAST); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "switch_page", (GValToRValSignalFunc)signal_g2r_func); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdk.c���������������������������������������������������������0000644�0001750�0001750�00000026701�12257552167�016407� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } static VALUE rg_m_display_arg_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gdk_get_display_arg_name()); } 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; } 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; } 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; disp = display ? DisplayString(display) : gdk_get_display_arg_name(); 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) { return Qtrue; } void Init_gtk_gdk(void) { RG_TARGET_NAMESPACE = rb_define_module("Gdk"); RG_DEF_MODFUNC(display_arg_name, 0); RG_DEF_MODFUNC(set_locale, 0); RG_DEF_MODFUNC(set_sm_client_id, 1); RG_DEF_MODFUNC(notify_startup_complete, -1); 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); }���������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkseparatormenuitem.c����������������������������������������0000644�0001750�0001750�00000002413�11701304107�022064� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cSeparatorMenuItem static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_separator_menu_item_new()); return Qnil; } void Init_gtk_separator_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEPARATOR_MENU_ITEM, "SeparatorMenuItem", mGtk); RG_DEF_METHOD(initialize, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprintoperation.c�������������������������������������������0000644�0001750�0001750�00000011403�12257552167�021416� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cPrintOperation #define _SELF(s) (GTK_PRINT_OPERATION(RVAL2GOBJ(s))) static VALUE RG_TARGET_NAMESPACE; static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_print_operation_new()); return Qnil; } static VALUE rg_run(int argc, VALUE *argv, VALUE self) { VALUE action, parent, rb_result; GtkPrintOperationResult result; GError *error = NULL; rb_scan_args(argc, argv, "11", &action, &parent); result = gtk_print_operation_run(_SELF(self), RVAL2GENUM(action, GTK_TYPE_PRINT_OPERATION_ACTION), RVAL2GOBJ(parent), &error); rb_result = GENUM2RVAL(result, GTK_TYPE_PRINT_OPERATION_RESULT); if (rb_block_given_p()) { return rb_yield(rb_result); } else { if (result == GTK_PRINT_OPERATION_RESULT_ERROR) RAISE_GERROR(error); return rb_result; } } static VALUE rg_error(VALUE self) { GError *error = NULL; gtk_print_operation_get_error(_SELF(self), &error); return error ? rbgerr_gerror2exception(error) : Qnil; } static VALUE rg_finished_p(VALUE self) { return CBOOL2RVAL(gtk_print_operation_is_finished(_SELF(self))); } static VALUE rg_cancel(VALUE self) { gtk_print_operation_cancel(_SELF(self)); return self; } struct callback_arg { VALUE callback; VALUE page_setup; }; static VALUE invoke_callback(VALUE arg_) { struct callback_arg *arg = (struct callback_arg *)arg_; return rb_funcall(arg->callback, id_call, 1, arg->page_setup); } static void page_setup_done_cb(GtkPageSetup *page_setup, gpointer data) { VALUE callback = (VALUE)data; struct callback_arg arg; G_CHILD_UNSET(RG_TARGET_NAMESPACE, rb_intern("setup_done_cb")); arg.callback = callback; arg.page_setup = GOBJ2RVAL(page_setup); G_PROTECT_CALLBACK(invoke_callback, &arg); } static VALUE rg_s_run_page_setup_dialog(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE parent, page_setup, settings; rb_scan_args(argc, argv, "03", &parent, &page_setup, &settings); if (rb_block_given_p()) { volatile VALUE func = rb_block_proc(); G_CHILD_SET(RG_TARGET_NAMESPACE, rb_intern("setup_done_cb"), func); gtk_print_run_page_setup_dialog_async(RVAL2GOBJ(parent), RVAL2GOBJ(page_setup), RVAL2GOBJ(settings), page_setup_done_cb, (gpointer)func); return Qnil; } else { return GOBJ2RVALU(gtk_print_run_page_setup_dialog(RVAL2GOBJ(parent), RVAL2GOBJ(page_setup), RVAL2GOBJ(settings))); } } void Init_gtk_print_operation(VALUE mGtk) { RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION, "PrintOperation", mGtk); G_DEF_ERROR(GTK_PRINT_ERROR, "PrintError", mGtk, rb_eRuntimeError, GTK_TYPE_PRINT_ERROR); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(run, -1); RG_DEF_METHOD(error, 0); RG_DEF_METHOD_P(finished, 0); RG_DEF_METHOD(cancel, 0); RG_DEF_SMETHOD(run_page_setup_dialog, -1); /* GtkPrintStatus */ G_DEF_CLASS(GTK_TYPE_PRINT_STATUS, "Status", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_STATUS, "GTK_PRINT_"); /* GtkPrintOperationAction */ G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_ACTION,"Action", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_OPERATION_ACTION, "GTK_PRINT_OPERATION_"); /* GtkPrintOperationResult */ G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_RESULT, "Result", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_OPERATION_RESULT, "GTK_PRINT_OPERATION_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmisc.c�����������������������������������������������������0000644�0001750�0001750�00000004067�11701304107�017262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cMisc #define _SELF(s) (GTK_MISC(RVAL2GOBJ(s))) static VALUE rg_set_alignment(VALUE self, VALUE xalign, VALUE yalign) { gtk_misc_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_set_padding(VALUE self, VALUE xpad, VALUE ypad) { gtk_misc_set_padding(_SELF(self), NUM2DBL(xpad), NUM2DBL(ypad)); return self; } static VALUE rg_alignment(VALUE self) { gfloat xalign, yalign; gtk_misc_get_alignment(_SELF(self), &xalign, &yalign); return rb_ary_new3(2, rb_float_new(xalign), rb_float_new(yalign)); } static VALUE rg_padding(VALUE self) { gint xpad, ypad; gtk_misc_get_padding(_SELF(self), &xpad, &ypad); return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad)); } void Init_gtk_misc(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MISC, "Misc", mGtk); RG_DEF_METHOD(set_alignment, 2); RG_DEF_METHOD(set_padding, 2); RG_DEF_METHOD(alignment, 0); RG_DEF_METHOD(padding, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkinputdialog.c����������������������������������������������0000644�0001750�0001750�00000002576�11701304107�020651� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cInputDialog static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_input_dialog_new()); return Qnil; } void Init_gtk_input_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_INPUT_DIALOG, "InputDialog", mGtk); RG_DEF_METHOD(initialize, 0); } ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkeventbox.c�������������������������������������������������0000644�0001750�0001750�00000002557�11701304107�020163� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cEventBox static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_event_box_new()); return Qnil; } void Init_gtk_eventbox(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_EVENT_BOX, "EventBox", mGtk); RG_DEF_METHOD(initialize, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkassistant.c������������������������������������������������0000644�0001750�0001750�00000014055�12257552167�020360� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } void Init_gtk_assistant(VALUE mGtk) { 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_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkactiongroup.c����������������������������������������������0000644�0001750�0001750�00000033005�12257552167�020675� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" 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; } static VALUE rg_translate_string(VALUE self, VALUE str) { return CSTR2RVAL(gtk_action_group_translate_string(_SELF(self), RVAL2CSTR(str))); } 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); } void Init_gtk_actiongroup(VALUE mGtk) { 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"); RG_DEF_METHOD(translate_string, 1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/depend����������������������������������������������������������0000644�0001750�0001750�00000000751�12064346475�016330� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������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 �����������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkconversions.h����������������������������������������������0000644�0001750�0001750�00000002300�11701304107�020650� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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__ */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkadjustment.c�����������������������������������������������0000644�0001750�0001750�00000004441�11701304107�020501� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkradioaction.c����������������������������������������������0000644�0001750�0001750�00000007345�12257552167�020647� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cRadioAction #define _SELF(self) (GTK_RADIO_ACTION(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self, VALUE name, VALUE label, VALUE tooltip, VALUE stock_id, VALUE value) { const gchar *gstock = NULL; if (TYPE(stock_id) == T_STRING){ gstock = RVAL2CSTR(stock_id); } else if (TYPE(stock_id) == T_SYMBOL) { gstock = rb_id2name(SYM2ID(stock_id)); } G_INITIALIZE(self, gtk_radio_action_new(RVAL2CSTR(name), RVAL2CSTR(label), NIL_P(tooltip) ? NULL : RVAL2CSTR(tooltip), gstock, NUM2INT(value))); return Qnil; } static VALUE raction_get_group(VALUE self) { /* Owned by GTK+ */ return GSLIST2ARY(gtk_radio_action_get_group(_SELF(self))); } struct rbgtk_rval2gtkradioactiongslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbgtk_rval2gtkradioactiongslist_body(VALUE value) { long i; struct rbgtk_rval2gtkradioactiongslist_args *args = (struct rbgtk_rval2gtkradioactiongslist_args *)value; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, GTK_RADIO_ACTION(RVAL2GOBJ(RARRAY_PTR(args->ary)[i]))); return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkradioactiongslist_rescue(VALUE value) { g_slist_free(((struct rbgtk_rval2gtkradioactiongslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbgtk_rval2gtkradioactiongslist(VALUE value) { struct rbgtk_rval2gtkradioactiongslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbgtk_rval2gtkradioactiongslist_body, (VALUE)&args, rbgtk_rval2gtkradioactiongslist_rescue, (VALUE)&args); return args.result; } #define RVAL2GTKRADIOACTIONGSLIST(value) rbgtk_rval2gtkradioactiongslist(value) static VALUE raction_set_group(VALUE self, VALUE rbgroup) { GtkRadioAction *action = _SELF(self); /* TODO: This might leak. Use gtk_radio_action_join_group() in 3.0. */ if (TYPE(rbgroup) == T_ARRAY) gtk_radio_action_set_group(action, RVAL2GTKRADIOACTIONGSLIST(rbgroup)); else if (NIL_P(rbgroup)) gtk_radio_action_set_group(action, NULL); else gtk_radio_action_set_group(action, gtk_radio_action_get_group(GTK_RADIO_ACTION(RVAL2GOBJ(rbgroup)))); return self; } void Init_gtk_radio_action(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_ACTION, "RadioAction", mGtk); RG_DEF_METHOD(initialize, 5); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "group", raction_get_group, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "group", raction_set_group, 1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkstatusicon.c�����������������������������������������������0000644�0001750�0001750�00000005642�12257552167�020545� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cStatusIcon #define _SELF(w) (GTK_STATUS_ICON(RVAL2GOBJ(w))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_status_icon_new()); return Qnil; } /* Don't implement this. Use Gtk::StatusIcon.new.set_foo(v) instead. GtkStatusIcon* gtk_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf); GtkStatusIcon* gtk_status_icon_new_from_file (const gchar *filename); GtkStatusIcon* gtk_status_icon_new_from_stock (const gchar *stock_id); GtkStatusIcon* gtk_status_icon_new_from_icon_name (const gchar *icon_name); */ static VALUE rg_set_tooltip(VALUE self, VALUE tooltip_text) { gtk_status_icon_set_tooltip(_SELF(self), RVAL2CSTR(tooltip_text)); return self; } static VALUE rg_position_menu(VALUE self, VALUE menu) { gint x, y; gboolean push_in; gtk_status_icon_position_menu(GTK_MENU(RVAL2GOBJ(menu)), &x, &y, &push_in, (gpointer)(_SELF(self))); return rb_ary_new3(3, INT2NUM(x), INT2NUM(y), CBOOL2RVAL(push_in)); } static VALUE rg_geometry(VALUE self) { GdkScreen* screen; GdkRectangle area; GtkOrientation orientation; gboolean ret = gtk_status_icon_get_geometry(_SELF(self), &screen, &area, &orientation); if (ret) { return rb_ary_new3(3, GOBJ2RVAL(screen), BOXED2RVAL(&area, GDK_TYPE_RECTANGLE), GENUM2RVAL(orientation, GTK_TYPE_ORIENTATION)); } else { return rb_ary_new3(3, Qnil, Qnil, Qnil); } } void Init_gtk_status_icon(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STATUS_ICON, "StatusIcon", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_tooltip, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "tooltip"); RG_DEF_METHOD(position_menu, 1); RG_DEF_METHOD(geometry, 0); } ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreeselection.c��������������������������������������������0000644�0001750�0001750�00000013655�12257552167�021221� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTreeSelection #define _SELF(s) (GTK_TREE_SELECTION(RVAL2GOBJ(s))) #define RVAL2TREEMODEL(s) (GTK_TREE_MODEL(RVAL2GOBJ(s))) static VALUE rg_set_mode(VALUE self, VALUE type) { gtk_tree_selection_set_mode(_SELF(self), RVAL2GENUM(type, GTK_TYPE_SELECTION_MODE)); return self; } static VALUE rg_mode(VALUE self) { return GENUM2RVAL(gtk_tree_selection_get_mode(_SELF(self)), GTK_TYPE_SELECTION_MODE); } static gboolean selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(selection), GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), CBOOL2RVAL(path_currently_selected))); } static VALUE rg_set_select_function(VALUE self) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_selection_set_select_function(_SELF(self), (GtkTreeSelectionFunc)selection_func, (gpointer)func, NULL); return self; } /* We don't need this(?) gpointer gtk_tree_selection_get_user_data (GtkTreeSelection *selection); */ static VALUE rg_tree_view(VALUE self) { return GOBJ2RVAL(gtk_tree_selection_get_tree_view(_SELF(self))); } static VALUE rg_selected(VALUE self) { GtkTreeIter iter; GtkTreeModel* model; gboolean ret = gtk_tree_selection_get_selected(_SELF(self), &model, &iter); iter.user_data3 = model; return ret ? GTKTREEITER2RVAL(&iter) : Qnil; } static void foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { iter->user_data3 = model; rb_funcall((VALUE)data, id_call, 3, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter)); } static VALUE rg_selected_each(VALUE self) { volatile VALUE func = rb_block_proc(); gtk_tree_selection_selected_foreach(_SELF(self), (GtkTreeSelectionForeachFunc)foreach_func, (gpointer)func); return self; } static VALUE rg_select_path(VALUE self, VALUE path) { gtk_tree_selection_select_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_unselect_path(VALUE self, VALUE path) { gtk_tree_selection_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_path_is_selected_p(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_tree_selection_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_select_iter(VALUE self, VALUE iter) { gtk_tree_selection_select_iter(_SELF(self), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_unselect_iter(VALUE self, VALUE iter) { gtk_tree_selection_unselect_iter(_SELF(self), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_iter_is_selected_p(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_tree_selection_iter_is_selected(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_select_all(VALUE self) { gtk_tree_selection_select_all(_SELF(self)); return self; } static VALUE rg_unselect_all(VALUE self) { gtk_tree_selection_unselect_all(_SELF(self)); return self; } static VALUE rg_select_range(VALUE self, VALUE start_path, VALUE end_path) { gtk_tree_selection_select_range(_SELF(self), RVAL2GTKTREEPATH(start_path), RVAL2GTKTREEPATH(end_path)); return self; } static VALUE rg_selected_rows(VALUE self) { GtkTreeModel* model; GList* list = gtk_tree_selection_get_selected_rows(_SELF(self), &model); VALUE ret = GLIST2ARY2(list, GTK_TYPE_TREE_PATH); g_list_foreach(list, (GFunc)gtk_tree_path_free, (gpointer)NULL); g_list_free(list); return ret; } static VALUE rg_count_selected_rows(VALUE self) { return INT2NUM(gtk_tree_selection_count_selected_rows(_SELF(self))); } static VALUE rg_unselect_range(VALUE self, VALUE start_path, VALUE end_path) { gtk_tree_selection_unselect_range(_SELF(self), RVAL2GTKTREEPATH(start_path), RVAL2GTKTREEPATH(end_path)); return self; } void Init_gtk_treeselection(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_SELECTION, "TreeSelection", mGtk); RG_DEF_METHOD(set_mode, 1); RG_DEF_METHOD(mode, 0); RG_DEF_METHOD(set_select_function, 0); RG_DEF_METHOD(tree_view, 0); RG_DEF_METHOD(selected, 0); RG_DEF_METHOD(selected_each, 0); RG_DEF_METHOD(select_path, 1); RG_DEF_METHOD(unselect_path, 1); RG_DEF_METHOD_P(path_is_selected, 1); RG_DEF_METHOD(select_iter, 1); RG_DEF_METHOD(unselect_iter, 1); RG_DEF_METHOD_P(iter_is_selected, 1); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(select_range, 2); RG_DEF_METHOD(selected_rows, 0); RG_DEF_METHOD(count_selected_rows, 0); RG_DEF_METHOD(unselect_range, 2); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �����������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreedragsource.c�������������������������������������������0000644�0001750�0001750�00000002030�11701304107�021331� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" void Init_gtk_treedragsource(VALUE mGtk) { G_DEF_INTERFACE(GTK_TYPE_TREE_DRAG_SOURCE, "TreeDragSource", mGtk); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaboutdialog.c����������������������������������������������0000644�0001750�0001750�00000011231�12446160551�020622� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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(RARRAY_PTR(ary)[i])[1])); } 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; } void Init_gtk_aboutdialog(VALUE mGtk) { 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); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrenderercombo.c����������������������������������������0000644�0001750�0001750�00000002403�12257552167�022027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cCellRendererCombo static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_combo_new()); return Qnil; } void Init_gtk_cellrenderercombo(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_COMBO, "CellRendererCombo", mGtk); RG_DEF_METHOD(initialize, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkspinbutton.c�����������������������������������������������0000644�0001750�0001750�00000010045�11701304107�020525� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cSpinButton #define _SELF(self) (GTK_SPIN_BUTTON(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; GtkAdjustment *adj = NULL; gfloat climb_rate; gint digits; GtkWidget *widget; rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3); if (NIL_P(arg1) || RVAL2GTYPE(arg1) == GTK_TYPE_ADJUSTMENT){ if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1)); climb_rate = (NIL_P(arg2))? 0.0: NUM2DBL(arg2); digits = (NIL_P(arg3))? 0: NUM2UINT(arg3); widget = gtk_spin_button_new(adj, climb_rate, digits); } else { widget = gtk_spin_button_new_with_range(NUM2DBL(arg1), NUM2DBL(arg2), NUM2DBL(arg3)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_configure(VALUE self, VALUE adj, VALUE climb_rate, VALUE digits) { gtk_spin_button_configure(_SELF(self), GTK_ADJUSTMENT(RVAL2GOBJ(adj)), NUM2DBL(climb_rate), NUM2UINT(digits)); return self; } static VALUE rg_set_increments(VALUE self, VALUE step, VALUE page) { gtk_spin_button_set_increments(_SELF(self), NUM2DBL(step), NUM2DBL(page)); return self; } static VALUE rg_set_range(VALUE self, VALUE min, VALUE max) { gtk_spin_button_set_range(_SELF(self), NUM2DBL(min), NUM2DBL(max)); return self; } static VALUE rg_value_as_int(VALUE self) { return INT2NUM(gtk_spin_button_get_value_as_int(_SELF(self))); } static VALUE rg_spin(VALUE self, VALUE direction, VALUE increment) { gtk_spin_button_spin(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_SPIN_TYPE), NUM2DBL(increment)); return self; } static VALUE rg_update(VALUE self) { gtk_spin_button_update(_SELF(self)); return self; } static VALUE rg_increments(VALUE self) { gdouble step, page; gtk_spin_button_get_increments(_SELF(self), &step, &page); return rb_ary_new3(2, rb_float_new(step), rb_float_new(page)); } static VALUE rg_range(VALUE self) { gdouble min, max; gtk_spin_button_get_range(_SELF(self), &min, &max); return rb_ary_new3(2, rb_float_new(min), rb_float_new(max)); } void Init_gtk_spin_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SPIN_BUTTON, "SpinButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(configure, 3); RG_DEF_METHOD(set_increments, 2); RG_DEF_METHOD(set_range, 2); RG_DEF_METHOD(value_as_int, 0); RG_DEF_METHOD(spin, 2); RG_DEF_METHOD(update, 0); RG_DEF_METHOD(increments, 0); RG_DEF_METHOD(range, 0); /* GtkSpinType */ G_DEF_CLASS(GTK_TYPE_SPIN_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SPIN_TYPE, "GTK_SPIN_"); /* GtkSpinButtonUpdatePolicy */ G_DEF_CLASS(GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY, "UpdatePolicy", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY, "GTK_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkscalebutton.c����������������������������������������������0000644�0001750�0001750�00000004151�11701304107�020644� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #if GTK_CHECK_VERSION(2,12,0) #define RG_TARGET_NAMESPACE cScaleButton #define _SELF(s) (GTK_SCALE_BUTTON(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3, arg4, arg5; GtkWidget *widget; gdouble min = 0; gdouble max = 100; gdouble step = 2; rb_scan_args(argc, argv, "14", &arg1, &arg2, &arg3, &arg4, &arg5); if (!NIL_P(arg2)) min = NUM2DBL(arg2); if (!NIL_P(arg3)) max = NUM2DBL(arg3); if (!NIL_P(arg4)) step = NUM2DBL(arg4); widget = gtk_scale_button_new(RVAL2GENUM(arg1, GTK_TYPE_ICON_SIZE), min, max, step, NULL); RBGTK_INITIALIZE(self, widget); if (!NIL_P(arg5)) { const gchar **icons = RVAL2STRV(arg5); gtk_scale_button_set_icons(_SELF(self), icons); g_free(icons); } return Qnil; } #endif void Init_gtk_scalebutton(VALUE mGtk) { #if GTK_CHECK_VERSION(2,12,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SCALE_BUTTON, "ScaleButton", mGtk); RG_DEF_METHOD(initialize, -1); #endif } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkconst.c����������������������������������������������������0000644�0001750�0001750�00000002400�11701304107�017422� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhseparator.c�����������������������������������������������0000644�0001750�0001750�00000002566�11701304107�020501� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHSeparator static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_hseparator_new()); return Qnil; } void Init_gtk_hseparator(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HSEPARATOR, "HSeparator", mGtk); RG_DEF_METHOD(initialize, 0); } ������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrc.c�������������������������������������������������������0000644�0001750�0001750�00000014531�12257552167�016752� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 mRC /* static VALUE rc_scanner_new(VALUE self) { return BOXED2RVAL(gtk_rc_scanner_new(), GTK_TYPE_GSCANNER); } */ static VALUE rg_m_get_style(G_GNUC_UNUSED VALUE self, VALUE widget) { GtkStyle* style = gtk_rc_get_style(GTK_WIDGET(RVAL2GOBJ(widget))); GType gtype = G_OBJECT_TYPE(style); const gchar* name = G_OBJECT_TYPE_NAME(style); if (! rb_const_defined_at(mGtk, rb_intern(name))){ G_DEF_CLASS(gtype, (gchar*)name, mGtk); } return GOBJ2RVAL(gtk_rc_get_style(GTK_WIDGET(RVAL2GOBJ(widget)))); } static VALUE rg_m_get_style_by_paths(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE settings, widget_path, class_path, klass; GtkStyle* style; GType gtype; const gchar* name; rb_scan_args(argc, argv, "13", &settings, &widget_path, &class_path, &klass); style = gtk_rc_get_style_by_paths(GTK_SETTINGS(RVAL2GOBJ(settings)), NIL_P(widget_path) ? NULL : RVAL2CSTR(widget_path), NIL_P(class_path) ? NULL : RVAL2CSTR(class_path), NIL_P(klass) ? G_TYPE_NONE : CLASS2GTYPE(klass)); if (style){ gtype = G_OBJECT_TYPE(style); name = G_OBJECT_TYPE_NAME(style); if (! rb_const_defined_at(mGtk, rb_intern(name))){ G_DEF_CLASS(gtype, (gchar*)name, mGtk); } return GOBJ2RVAL(style); } return Qnil; } static VALUE rg_m_parse(G_GNUC_UNUSED VALUE self, VALUE filename) { gtk_rc_parse(RVAL2CSTR(filename)); return filename; } static VALUE rg_m_parse_string(G_GNUC_UNUSED VALUE self, VALUE rc_string) { gtk_rc_parse_string(RVAL2CSTR(rc_string)); return rc_string; } static VALUE rg_m_reparse_all(G_GNUC_UNUSED VALUE self) { return CBOOL2RVAL(gtk_rc_reparse_all()); } static VALUE rg_m_reparse_all_for_settings(G_GNUC_UNUSED VALUE self, VALUE settings, VALUE force_load) { return CBOOL2RVAL(gtk_rc_reparse_all_for_settings(GTK_SETTINGS(RVAL2GOBJ(settings)), RVAL2CBOOL(force_load))); } static VALUE rg_m_reset_styles(G_GNUC_UNUSED VALUE self, VALUE settings) { gtk_rc_reset_styles(GTK_SETTINGS(RVAL2GOBJ(settings))); return settings; } static VALUE rg_m_add_default_file(G_GNUC_UNUSED VALUE self, VALUE filename) { gtk_rc_add_default_file(RVAL2CSTR(filename)); return filename; } static VALUE rg_m_default_files(G_GNUC_UNUSED VALUE self) { gchar** files = gtk_rc_get_default_files(); VALUE ary = rb_ary_new(); while(*files){ rb_ary_push(ary, CSTR2RVAL(*files)); files++; } return ary; } static VALUE rg_m_set_default_files(G_GNUC_UNUSED VALUE self, VALUE rbfilenames) { gchar **filenames = (gchar **)RVAL2STRV(rbfilenames); gtk_rc_set_default_files(filenames); g_free(filenames); return rbfilenames; } /* guint gtk_rc_parse_color (GScanner *scanner, GdkColor *color); guint gtk_rc_parse_color_full (GScanner *scanner, GtkRcStyle *style, GdkColor *color); guint gtk_rc_parse_state (GScanner *scanner, GtkStateType *state); guint gtk_rc_parse_priority (GScanner *scanner, GtkPathPriorityType *priority); */ static VALUE rg_m_find_module_in_path(G_GNUC_UNUSED VALUE self, VALUE module_file) { return CSTR2RVAL_FREE(gtk_rc_find_module_in_path(RVAL2CSTR(module_file))); } /* gchar* gtk_rc_find_pixmap_in_path (GtkSettings *settings, GScanner *scanner, const gchar *pixmap_file); */ static VALUE rg_m_module_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL_FREE(gtk_rc_get_module_dir()); } static VALUE rg_m_im_module_path(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gtk_rc_get_im_module_path()); } static VALUE rg_m_im_module_file(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gtk_rc_get_im_module_file()); } static VALUE rg_m_theme_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL_FREE(gtk_rc_get_theme_dir()); } void Init_gtk_rc(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "RC"); RG_DEF_MODFUNC(get_style, 1); RG_DEF_MODFUNC(get_style_by_paths, -1); RG_DEF_MODFUNC(parse, 1); RG_DEF_MODFUNC(parse_string, 1); RG_DEF_MODFUNC(reparse_all, 0); RG_DEF_MODFUNC(reparse_all_for_settings, 2); RG_DEF_MODFUNC(reset_styles, 1); RG_DEF_MODFUNC(add_default_file, 1); RG_DEF_MODFUNC(default_files, 0); RG_DEF_MODFUNC(set_default_files, 1); RG_DEF_MODFUNC(find_module_in_path, 1); RG_DEF_MODFUNC(module_dir, 0); RG_DEF_MODFUNC(im_module_path, 0); RG_DEF_MODFUNC(im_module_file, 0); RG_DEF_MODFUNC(theme_dir, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkRcFlags */ G_DEF_CLASS(GTK_TYPE_RC_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_RC_FLAGS, "GTK_RC_"); /* GtkRcTokenType */ G_DEF_CLASS(GTK_TYPE_RC_TOKEN_TYPE, "TokenType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_RC_TOKEN_TYPE, "GTK_RC_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkimcontextsimple.c������������������������������������������0000644�0001750�0001750�00000004211�11701304107�021542� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cIMContextSimple #define _SELF(self) (GTK_IM_CONTEXT_SIMPLE(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_im_context_simple_new()); return Qnil; } /* TODO: Why are we taking a third argument? Shouldn't it be determined by the * length of rbdata? */ static VALUE rg_add_table(VALUE self, VALUE rbdata, VALUE rbmax_seq_len, VALUE rbn_seqs) { GtkIMContextSimple *context_simple = _SELF(self); gint max_seq_len = NUM2INT(rbmax_seq_len); gint n_seqs = NUM2INT(rbn_seqs); long n; guint16 *data; if (max_seq_len > GTK_MAX_COMPOSE_LEN) rb_raise(rb_eArgError, "max_seq_len cannot be greater than GTK_MAX_COMPOSE_LEN: %d > %d", max_seq_len, GTK_MAX_COMPOSE_LEN); data = RVAL2GUINT16S(rbdata, n); gtk_im_context_simple_add_table(context_simple, data, max_seq_len, n_seqs); g_free(data); return self; } void Init_gtk_imcontext_simple(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IM_CONTEXT_SIMPLE, "IMContextSimple", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add_table, 3); rb_define_const(RG_TARGET_NAMESPACE, "MAX_COMPOSE_LEN", GTK_MAX_COMPOSE_LEN); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkvisual.c���������������������������������������������������0000644�0001750�0001750�00000013475�12257552167�017637� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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))); } static VALUE rg_screen(VALUE self) { return GOBJ2RVAL(gdk_visual_get_screen(_SELF(self))); } /* 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 */ RG_DEF_METHOD(screen, 0); 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_"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkdragcontext.c����������������������������������������������0000644�0001750�0001750�00000017735�12257552167�020661� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 { 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); } 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 { 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); } 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; } static VALUE rg_drag_drop_succeeded_p(VALUE self) { return CBOOL2RVAL(gdk_drag_drop_succeeded(_SELF(self))); } 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); RG_DEF_METHOD_P(drag_drop_succeeded, 0); /* 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_"); } �����������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentdata.c�����������������������������������������������0000644�0001750�0001750�00000007653�12257552167�020467� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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" /*****************************************/ static GtkRecentData* rd_copy(const GtkRecentData* data) { GtkRecentData* new_data; g_return_val_if_fail (data != NULL, NULL); new_data = g_new(GtkRecentData, 1); *new_data = *data; return new_data; } static void rd_free(GtkRecentData* boxed) { if (boxed){ g_free(boxed->groups); g_free(boxed); } } GType gtk_recent_data_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkRecentData", (GBoxedCopyFunc)rd_copy, (GBoxedFreeFunc)rd_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cRecentData #define _SELF(w) ((GtkRecentData*)RVAL2BOXED(w, GTK_TYPE_RECENT_DATA)) static VALUE rg_initialize(VALUE self) { GtkRecentData data; memset(&data, 0, sizeof(GtkRecentData)); G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_RECENT_DATA, &data)); return Qnil; } #define RD_STR(name)\ static VALUE \ rd_get_ ## name (VALUE self)\ {\ return CSTR2RVAL(_SELF(self)->name);\ }\ static VALUE \ rd_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = (gchar *)RVAL2CSTR(val);\ return self;\ } RD_STR(display_name); RD_STR(description); RD_STR(mime_type); RD_STR(app_name); RD_STR(app_exec); static VALUE rg_groups(VALUE self) { gchar** grps = _SELF(self)->groups; VALUE ary = rb_ary_new(); gint i = 0; while (grps[i]) { rb_ary_push(ary, CSTR2RVAL((gchar*)grps[i])); i++; } return ary; } static VALUE rg_set_groups(VALUE self, VALUE groups) { _SELF(self)->groups = RVAL2STRV_DUP(groups); return self; } static VALUE rg_private_p(VALUE self) { return CBOOL2RVAL(_SELF(self)->is_private); } static VALUE rg_set_private(VALUE self, VALUE is_private) { _SELF(self)->is_private = RVAL2CBOOL(is_private); return self; } void Init_gtk_recent_data(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_DATA, "RecentData", mGtk); RG_DEF_METHOD(initialize, 0); rb_define_method(RG_TARGET_NAMESPACE, "display_name", rd_get_display_name, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_display_name", rd_set_display_name, 1); rb_define_method(RG_TARGET_NAMESPACE, "description", rd_get_description, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_description", rd_set_description, 1); rb_define_method(RG_TARGET_NAMESPACE, "mime_type", rd_get_mime_type, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_mime_type", rd_set_mime_type, 1); rb_define_method(RG_TARGET_NAMESPACE, "app_name", rd_get_app_name, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_app_name", rd_set_app_name, 1); rb_define_method(RG_TARGET_NAMESPACE, "app_exec", rd_get_app_exec, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_app_exec", rd_set_app_exec, 1); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD(set_groups, 1); RG_DEF_METHOD_P(private, 0); RG_DEF_METHOD(set_private, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkliststore.c������������������������������������������������0000644�0001750�0001750�00000024577�12257552167�020411� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cListStore #define _SELF(s) (GTK_LIST_STORE(RVAL2GOBJ(s))) static ID id_to_a, id_size; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { gint cnt; GtkListStore* store; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } store = gtk_list_store_newv(argc, buf); G_INITIALIZE(self, store); return Qnil; } static VALUE rg_set_column_types(int argc, VALUE *argv, VALUE self) { gint cnt; GType* buf; if (argc == 0) rb_raise(rb_eArgError, "need more than 1 class type."); buf = ALLOCA_N(GType, argc); for (cnt = 0; cnt < argc; cnt++) { buf[cnt] = CLASS2GTYPE(argv[cnt]); } gtk_list_store_set_column_types(_SELF(self), argc, buf); return self; } static VALUE rg_set_value(VALUE self, VALUE iter, VALUE column, VALUE value) { GType gtype = gtk_tree_model_get_column_type(GTK_TREE_MODEL(RVAL2GOBJ(self)), NUM2INT(column)); GValue gval = G_VALUE_INIT; g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(value, &gval); G_CHILD_ADD(iter, value); gtk_list_store_set_value(_SELF(self), RVAL2GTKTREEITER(iter), NUM2INT(column), &gval); g_value_unset(&gval); return self; } #if GTK_CHECK_VERSION(2, 12, 0) typedef struct _ValuesInfo { gint i; VALUE iter; GtkTreeModel *model; gint *g_columns; GValue *g_values; } ValuesInfo; static int collect_value(VALUE key, VALUE value, ValuesInfo *info) { GType g_type; gint column; column = NUM2INT(key); info->g_columns[info->i] = column; g_type = gtk_tree_model_get_column_type(info->model, column); g_value_init(&(info->g_values[info->i]), g_type); rbgobj_rvalue_to_gvalue(value, &(info->g_values[info->i])); G_CHILD_ADD(info->iter, value); info->i++; return ST_CONTINUE; } static void hash_to_values(VALUE hash, VALUE iter, GtkTreeModel *model, gint *g_columns, GValue *g_values, G_GNUC_UNUSED gint length) { ValuesInfo info; info.i = 0; info.iter = iter; info.model = model; info.g_columns = g_columns; info.g_values = g_values; rb_hash_foreach(hash, collect_value, (VALUE)(&info)); } static void array_to_values(VALUE array, VALUE iter, GtkTreeModel *model, gint *g_columns, GValue *g_values, gint length) { gint i; for (i = 0; i < length; i++) { GType g_type; g_columns[i] = i; g_type = gtk_tree_model_get_column_type(model, i); g_value_init(&g_values[i], g_type); rbgobj_rvalue_to_gvalue(RARRAY_PTR(array)[i], &g_values[i]); G_CHILD_ADD(iter, RARRAY_PTR(array)[i]); } } static VALUE rg_set_values(VALUE self, VALUE iter, VALUE values) { GValue *g_values; GtkListStore *store; GtkTreeModel *model; gint *g_columns; gint i, length; length = NUM2INT(rb_funcall(values, id_size, 0)); if (length == 0) return self; g_columns = ALLOCA_N(gint, length); g_values = ALLOCA_N(GValue, length); MEMZERO(g_values, GValue, length); store = _SELF(self); model = GTK_TREE_MODEL(store); if (RVAL2CBOOL(rb_obj_is_kind_of(values, rb_cHash))) { hash_to_values(values, iter, model, g_columns, g_values, length); } else if (RVAL2CBOOL(rb_obj_is_kind_of(values, rb_cArray))) { array_to_values(values, iter, model, g_columns, g_values, length); } else { rb_raise(rb_eArgError, "must be array or hash of values"); } gtk_list_store_set_valuesv(store, RVAL2GTKTREEITER(iter), g_columns, g_values, length); for (i = 0; i < length; i++) g_value_unset(&g_values[i]); return self; } #endif /* void gtk_tree_store_set (GtkTreeStore *tree_store, GtkTreeIter *iter, ...); void gtk_tree_store_set_valist (GtkTreeStore *tree_store, GtkTreeIter *iter, va_list var_args); */ static VALUE rg_remove(VALUE self, VALUE iter) { G_CHILD_REMOVE(self, iter); return CBOOL2RVAL(gtk_list_store_remove(_SELF(self), RVAL2GTKTREEITER(iter))); } struct lstore_insert_args { GtkListStore *store; GtkTreeIter iter; gint position; VALUE ary; long i; long n; gint *columns; GValue *values; }; static VALUE lstore_insert_body(VALUE value) { struct lstore_insert_args *args = (struct lstore_insert_args *)value; GtkTreeModel *model = GTK_TREE_MODEL(args->store); for (args->i = 0; args->i < args->n; args->i++) { VALUE ary = rb_ary_to_ary(RARRAY_PTR(args->ary)[args->i]); args->columns[args->i] = NUM2INT(RARRAY_PTR(ary)[1]); g_value_init(&args->values[args->i], gtk_tree_model_get_column_type(model, args->columns[args->i])); rbgobj_rvalue_to_gvalue(RARRAY_PTR(ary)[0], &args->values[args->i]); } gtk_list_store_insert_with_valuesv(args->store, &args->iter, args->position, args->columns, args->values, args->n); return Qnil; } static VALUE lstore_insert_ensure(VALUE value) { long i; struct lstore_insert_args *args = (struct lstore_insert_args *)value; for (i = 0; i < args->i; i++) g_value_unset(&args->values[i]); g_free(args->values); g_free(args->columns); return Qnil; } /* Gtk::ListStore#insert(pos, val1 => 0, val2 => 2, ... ) */ static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { VALUE position, values, result; struct lstore_insert_args args; args.store = _SELF(self); rb_scan_args(argc, argv, "11", &position, &values); args.position = NUM2INT(position); if (NIL_P(values)){ gtk_list_store_insert(args.store, &args.iter, args.position); } else { args.ary = rb_funcall(values, id_to_a, 0); args.n = RARRAY_LEN(args.ary); args.columns = g_new(gint, args.n); args.values = g_new0(GValue, args.n); rb_ensure(lstore_insert_body, (VALUE)&args, lstore_insert_ensure, (VALUE)&args); } args.iter.user_data3 = args.store; result = GTKTREEITER2RVAL(&args.iter); return result; } static VALUE rg_insert_before(VALUE self, VALUE sibling) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_insert_before(model, &iter, NIL_P(sibling) ? NULL : RVAL2GTKTREEITER(sibling)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_insert_after(VALUE self, VALUE sibling) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_insert_after(model, &iter, NIL_P(sibling) ? NULL : RVAL2GTKTREEITER(sibling)); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_prepend(VALUE self) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_prepend(model, &iter); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_append(VALUE self) { VALUE ret; GtkTreeIter iter; GtkListStore* model = _SELF(self); gtk_list_store_append(model, &iter); iter.user_data3 = model; ret = GTKTREEITER2RVAL(&iter); return ret; } static VALUE rg_clear(VALUE self) { G_CHILD_REMOVE_ALL(self); gtk_list_store_clear(_SELF(self)); return self; } static VALUE rg_iter_is_valid_p(VALUE self, VALUE iter) { return (NIL_P(iter)) ? Qfalse : CBOOL2RVAL(gtk_list_store_iter_is_valid(_SELF(self), RVAL2GTKTREEITER(iter))); } static VALUE rg_reorder(VALUE self, VALUE rbnew_order) { GtkListStore *store = _SELF(self); long n; gint *new_order = RVAL2GINTS(rbnew_order, n); gtk_list_store_reorder(store, new_order); g_free(new_order); return self; } static VALUE rg_swap(VALUE self, VALUE iter1, VALUE iter2) { gtk_list_store_swap(_SELF(self), RVAL2GTKTREEITER(iter1), RVAL2GTKTREEITER(iter2)); return self; } static VALUE rg_move_before(VALUE self, VALUE iter, VALUE position) { gtk_list_store_move_before(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; } static VALUE rg_move_after(VALUE self, VALUE iter, VALUE position) { gtk_list_store_move_after(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; } void Init_gtk_list_store(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LIST_STORE, "ListStore", mGtk); id_to_a = rb_intern("to_a"); id_size = rb_intern("size"); rbgtk_register_treeiter_set_value_func(GTK_TYPE_LIST_STORE, (rbgtkiter_set_value_func)>k_list_store_set_value); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_column_types, -1); RG_DEF_METHOD(set_value, 3); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(insert, -1); RG_DEF_METHOD(insert_before, 1); RG_DEF_METHOD(insert_after, 1); RG_DEF_METHOD(prepend, 0); RG_DEF_METHOD(append, 0); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD_P(iter_is_valid, 1); RG_DEF_METHOD(reorder, 1); RG_DEF_METHOD(swap, 2); RG_DEF_METHOD(move_before, 2); RG_DEF_METHOD(move_after, 2); #if GTK_CHECK_VERSION(2, 12, 0) RG_DEF_METHOD(set_values, 2); #endif } ���������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkradiomenuitem.c��������������������������������������������0000644�0001750�0001750�00000011100�11701304107�021153� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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, * dellin * * 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 cRadioMenuItem struct rbgtk_rval2gtkradiomenuitemgslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbgtk_rval2gtkradiomenuitemgslist_body(VALUE value) { long i; struct rbgtk_rval2gtkradiomenuitemgslist_args *args = (struct rbgtk_rval2gtkradiomenuitemgslist_args *)value; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, GTK_RADIO_MENU_ITEM(RVAL2GOBJ(RARRAY_PTR(args->ary)[i]))); return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkradiomenuitemgslist_rescue(VALUE value) { g_slist_free(((struct rbgtk_rval2gtkradiomenuitemgslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbgtk_rval2gtkradiomenuitemgslist(VALUE value) { struct rbgtk_rval2gtkradiomenuitemgslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbgtk_rval2gtkradiomenuitemgslist_body, (VALUE)&args, rbgtk_rval2gtkradiomenuitemgslist_rescue, (VALUE)&args); return args.result; } #define RVAL2GTKRADIOMENUITEMGSLIST(value) rbgtk_rval2gtkradiomenuitemgslist(value) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; GtkWidget *widget; GSList *list = NULL; const gchar *label = NULL; const gchar *mnemonic = NULL; if (rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3) > 0 && TYPE(arg1) == T_STRING) { if (NIL_P(arg2) || RVAL2CBOOL(arg2)) mnemonic = RVAL2CSTR(arg1); else label = RVAL2CSTR(arg1); } else { if (!NIL_P(arg2)) { if (NIL_P(arg3) || RVAL2CBOOL(arg3)) mnemonic = RVAL2CSTR(arg2); else label = RVAL2CSTR(arg2); } if (rb_obj_is_kind_of(arg1, GTYPE2CLASS(GTK_TYPE_RADIO_MENU_ITEM))) list = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(RVAL2GOBJ(arg1))); else if (TYPE(arg1) == T_ARRAY) /* TODO: This might leak. */ list = RVAL2GTKRADIOMENUITEMGSLIST(arg1); else if (!NIL_P(arg1)) rb_raise(rb_eArgError, "invalid argument %s (expect Array or Gtk::RadioMenuItem)", rb_class2name(CLASS_OF(arg1))); } if (label != NULL) widget = gtk_radio_menu_item_new_with_label(list, label); else if (mnemonic != NULL) widget = gtk_radio_menu_item_new_with_mnemonic(list, mnemonic); else widget = gtk_radio_menu_item_new(list); RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rmitem_get_group(VALUE self) { /* Owened by GTK+ */ return GSLIST2ARY(gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(RVAL2GOBJ(self)))); } static VALUE rmitem_set_group(VALUE self, VALUE grp_ary) { GtkRadioMenuItem *rmitem2add, *rmitem_orig; GSList *group; rmitem2add = GTK_RADIO_MENU_ITEM(RVAL2GOBJ(self)); rmitem_orig = GTK_RADIO_MENU_ITEM(RVAL2GOBJ(rb_ary_entry(grp_ary, 0))); group = gtk_radio_menu_item_group(rmitem_orig); gtk_radio_menu_item_set_group(rmitem2add, group); return GSLIST2ARY(gtk_radio_menu_item_get_group(rmitem2add)); } void Init_gtk_radio_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_MENU_ITEM, "RadioMenuItem", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "group", rmitem_get_group, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "group", rmitem_set_group, 1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextmark.c�������������������������������������������������0000644�0001750�0001750�00000004212�11701304107�020156� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 cTextMark #define _SELF(s) (GTK_TEXT_MARK(RVAL2GOBJ(s))) #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_initialize(VALUE self, VALUE name, VALUE left_gravity) { if (NIL_P(name)) G_INITIALIZE(self, gtk_text_mark_new(NULL, RVAL2CBOOL(left_gravity))); else G_INITIALIZE(self, gtk_text_mark_new(RVAL2CSTR(name), RVAL2CBOOL(left_gravity))); return Qnil; } #endif static VALUE rg_set_visible(VALUE self, VALUE setting) { gtk_text_mark_set_visible(_SELF(self), RVAL2CBOOL(setting)); return setting; } static VALUE rg_visible_p(VALUE self) { return CBOOL2RVAL(gtk_text_mark_get_visible(_SELF(self))); } static VALUE rg_deleted_p(VALUE self) { return CBOOL2RVAL(gtk_text_mark_get_deleted(_SELF(self))); } static VALUE rg_buffer(VALUE self) { return GOBJ2RVAL(gtk_text_mark_get_buffer(_SELF(self))); } void Init_gtk_textmark(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_MARK, "TextMark", mGtk); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(initialize, 2); #endif RG_DEF_METHOD(set_visible, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "visible"); RG_DEF_METHOD_P(visible, 0); RG_DEF_METHOD_P(deleted, 0); RG_DEF_METHOD(buffer, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkexpander.c�������������������������������������������������0000644�0001750�0001750�00000003130�12257552167�020145� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cExpander #define _SELF(self) (GTK_EXPANDER(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "11", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ widget = gtk_expander_new(RVAL2CSTR(label)); } else { widget = gtk_expander_new_with_mnemonic(RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_expander(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_EXPANDER, "Expander", mGtk); RG_DEF_METHOD(initialize, -1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktoggletoolbutton.c�����������������������������������������0000644�0001750�0001750�00000003337�12257552167�021763� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cToggleToolButton #define _SELF(self) (GTK_TOGGLE_TOOL_BUTTON(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE stock_id; GtkToolItem* item; rb_scan_args(argc, argv, "01", &stock_id); if (NIL_P(stock_id)){ item = gtk_toggle_tool_button_new(); } else { if (TYPE(stock_id) == T_SYMBOL){ item = gtk_toggle_tool_button_new_from_stock(rb_id2name(SYM2ID(stock_id))); } else { item = gtk_toggle_tool_button_new_from_stock(RVAL2CSTR(stock_id)); } } RBGTK_INITIALIZE(self, item); return Qnil; } void Init_gtk_toggletoolbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOGGLE_TOOL_BUTTON, "ToggleToolButton", mGtk); RG_DEF_METHOD(initialize, -1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkinfobar.c��������������������������������������������������0000644�0001750�0001750�00000007246�12307003726�017757� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2012 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,18,0) #define RG_TARGET_NAMESPACE cInfoBar #define _SELF(self) (GTK_INFO_BAR(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { if (argc == 0){ RBGTK_INITIALIZE(self, gtk_info_bar_new ()); } else if (argc > 0){ //TODO gtk_info_bar_new_with_buttons rb_raise(rb_eArgError, "method does not yet supported adding buttons"); } else { rb_raise(rb_eArgError, "invalid argument number"); } return Qnil; } static VALUE rg_get_action_area(VALUE self) { return GOBJ2RVAL(gtk_info_bar_get_action_area(_SELF(self))); } static VALUE rg_get_content_area(VALUE self) { return GOBJ2RVAL(gtk_info_bar_get_content_area(_SELF(self))); } static VALUE rg_set_default_response(VALUE self, VALUE response_id) { gtk_info_bar_set_default_response(_SELF(self), RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE)); return self; } static VALUE rg_add_action_widget(VALUE self, VALUE widget, VALUE response_id) { gtk_info_bar_add_action_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE)); return self; } 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_info_bar_add_button(_SELF(self), name, RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE))); } /* static VALUE rg_add_buttons(int argc, VALUE *argv, VALUE self) { } */ static VALUE rg_set_response_sensitive(VALUE self, VALUE response_id, VALUE sensitive) { gtk_info_bar_set_response_sensitive(_SELF(self), RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE), RVAL2CBOOL(sensitive)); return self; } static VALUE rg_response(VALUE self, VALUE response_id) { gtk_info_bar_response(_SELF(self), RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE)); return self; } #endif void Init_gtk_infobar(VALUE mGtk) { #if GTK_CHECK_VERSION(2,18,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_INFO_BAR, "InfoBar", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(get_action_area, 0); RG_DEF_ALIAS("action_area", "get_action_area"); RG_DEF_METHOD(get_content_area, 0); RG_DEF_ALIAS("content_area", "get_content_area"); RG_DEF_METHOD(set_default_response, 1); RG_DEF_METHOD(add_action_widget, 2); RG_DEF_METHOD(add_button, 2); /* RG_DEF_METHOD(add_buttons, -1); */ RG_DEF_METHOD(set_response_sensitive, 2); RG_DEF_METHOD(response, 1); #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktargetlist.c�����������������������������������������������0000644�0001750�0001750�00000006617�12257552167�020536� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cTargetList #define _SELF(r) ((GtkTargetList*)RVAL2BOXED(r, GTK_TYPE_TARGET_LIST)) static VALUE rg_initialize(VALUE self, VALUE rbtargets) { long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); GtkTargetList *list = gtk_target_list_new(targets, n); g_free(targets); G_INITIALIZE(self, list); return Qnil; } static VALUE rg_add(VALUE self, VALUE target, VALUE flags, VALUE info) { gtk_target_list_add(_SELF(self), RVAL2ATOM(target), FIX2UINT(flags), FIX2UINT(info)); return self; } static VALUE rg_add_table(VALUE self, VALUE rbtargets) { GtkTargetList *list = _SELF(self); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_target_list_add_table(list, targets, n); g_free(targets); return self; } static VALUE rg_add_text_targets(VALUE self, VALUE info) { gtk_target_list_add_text_targets(_SELF(self), NUM2UINT(info)); return self; } static VALUE rg_add_image_targets(VALUE self, VALUE info, VALUE writable) { gtk_target_list_add_image_targets(_SELF(self), NUM2UINT(info), RVAL2CBOOL(writable)); return self; } static VALUE rg_add_uri_targets(VALUE self, VALUE info) { gtk_target_list_add_uri_targets(_SELF(self), NUM2UINT(info)); return self; } static VALUE rg_add_rich_text_targets(VALUE self, VALUE info, VALUE deserializable, VALUE buffer) { gtk_target_list_add_rich_text_targets(_SELF(self), NUM2UINT(info), RVAL2CBOOL(deserializable), GTK_TEXT_BUFFER(RVAL2GOBJ(buffer))); return self; } static VALUE rg_remove(VALUE self, VALUE target) { gtk_target_list_remove(_SELF(self), RVAL2ATOM(target)); return self; } static VALUE rg_find(VALUE self, VALUE target) { guint info; gboolean ret = gtk_target_list_find(_SELF(self), RVAL2ATOM(target), &info); return ret ? INT2NUM(info) : Qnil; } void Init_gtk_target_list(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TARGET_LIST, "TargetList", mGtk); rbgobj_boxed_not_copy_obj(GTK_TYPE_TARGET_LIST); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(add, 3); RG_DEF_METHOD(add_table, 1); RG_DEF_METHOD(add_text_targets, 1); RG_DEF_METHOD(add_image_targets, 2); RG_DEF_METHOD(add_uri_targets, 1); RG_DEF_METHOD(add_rich_text_targets, 3); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(find, 1); } �����������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkdialog.c���������������������������������������������������0000644�0001750�0001750�00000017417�12416346617�017611� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2014 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 gboolean destroy_dialog(gpointer user_data) { GtkWidget *dialog = user_data; gtk_widget_destroy(dialog); return G_SOURCE_REMOVE; } static VALUE rg_run(VALUE self) { GtkDialog *dialog; GSource *interrupt_source; VALUE response; dialog = _SELF(self); interrupt_source = rbg_interrupt_source_new(); g_source_set_callback(interrupt_source, destroy_dialog, dialog, NULL); g_source_attach(interrupt_source, NULL); response = INT2NUM(gtk_dialog_run(dialog)); g_source_destroy(interrupt_source); g_source_unref(interrupt_source); rb_thread_check_ints(); if (rb_block_given_p()) { return rb_yield(response); } else { return response; } } 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; } 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; } static VALUE rg_vbox(VALUE self) { return GOBJ2RVAL(_SELF(self)->vbox); } static VALUE rg_action_area(VALUE self) { return GOBJ2RVAL(_SELF(self)->action_area); } static VALUE rg_get_response(VALUE self, VALUE widget) { return INT2NUM(gtk_dialog_get_response_for_widget(_SELF(self), RVAL2GOBJ(widget))); } 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"); RG_DEF_SMETHOD_P(alternative_dialog_button_order, 1); RG_DEF_METHOD(set_alternative_button_order, 1); RG_DEF_METHOD(set_response_sensitive, 2); RG_DEF_METHOD(vbox, 0); RG_DEF_METHOD(action_area, 0); RG_DEF_METHOD(get_response, 1); RG_DEF_ALIAS("get_response_for_widget", "get_response"); /* 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_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkiconfactory.c����������������������������������������������0000644�0001750�0001750�00000004432�11701304107�020643� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cIconFactory #define _SELF(s) (GTK_ICON_FACTORY(RVAL2GOBJ(s))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_icon_factory_new()); return Qnil; } static VALUE rg_add(VALUE self, VALUE id, VALUE icon_set) { gtk_icon_factory_add(_SELF(self), RVAL2CSTR(id), (GtkIconSet*)RVAL2BOXED(icon_set, GTK_TYPE_ICON_SET)); return self; } static VALUE rg_add_default(VALUE self) { gtk_icon_factory_add_default(_SELF(self)); return self; } static VALUE rg_lookup(VALUE self, VALUE id) { GtkIconSet *icon_set; icon_set = gtk_icon_factory_lookup(_SELF(self), RVAL2CSTR(id)); return BOXED2RVAL(icon_set, GTK_TYPE_ICON_SET); } static VALUE rg_s_lookup_default(G_GNUC_UNUSED VALUE self, VALUE id) { GtkIconSet *icon_set; icon_set = gtk_icon_factory_lookup_default(RVAL2CSTR(id)); return BOXED2RVAL(icon_set, GTK_TYPE_ICON_SET); } static VALUE rg_remove_default(VALUE self) { gtk_icon_factory_remove_default(_SELF(self)); return self; } void Init_gtk_icon_factory(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_FACTORY, "IconFactory", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, 2); RG_DEF_METHOD(add_default, 0); RG_DEF_METHOD(remove_default, 0); RG_DEF_METHOD(lookup, 1); RG_DEF_SMETHOD(lookup_default, 1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/init.c����������������������������������������������������������0000664�0001750�0001750�00000021423�11740310343�016237� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmenuitem.c�������������������������������������������������0000644�0001750�0001750�00000006126�11701304107�020150� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cMenuItem #define _SELF(s) (GTK_MENU_ITEM(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { const gchar *label = NULL; VALUE rb_label, use_underline; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "02", &rb_label, &use_underline); if (!NIL_P(rb_label)) label = RVAL2CSTR(rb_label); if (label) { if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)) { widget = gtk_menu_item_new_with_mnemonic(label); } else { widget = gtk_menu_item_new_with_label(label); } } else { widget = gtk_menu_item_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE mitem_set_submenu(VALUE self, VALUE child) { GtkMenuItem *item; GtkWidget *submenu; item = _SELF(self); submenu = gtk_menu_item_get_submenu(item); if (submenu) G_CHILD_REMOVE(self, GOBJ2RVAL(submenu)); gtk_menu_item_set_submenu(item, GTK_WIDGET(RVAL2GOBJ(child))); G_CHILD_ADD(self, child); return self; } static VALUE rg_remove_submenu(VALUE self) { GtkMenuItem *item; GtkWidget *submenu; item = _SELF(self); submenu = gtk_menu_item_get_submenu(item); gtk_menu_item_remove_submenu(item); if (submenu) G_CHILD_REMOVE(self, GOBJ2RVAL(submenu)); return self; } static VALUE rg_toggle_size_request(VALUE self) { gint requisition; gtk_menu_item_toggle_size_request(_SELF(self), &requisition); return INT2NUM(requisition); } static VALUE rg_toggle_size_allocate(VALUE self, VALUE allocation) { gtk_menu_item_toggle_size_allocate(_SELF(self), NUM2INT(allocation)); return self; } void Init_gtk_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_ITEM, "MenuItem", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "submenu", mitem_set_submenu, 1); RG_DEF_METHOD(remove_submenu, 0); RG_DEF_METHOD(toggle_size_request, 0); RG_DEF_METHOD(toggle_size_allocate, 1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkselectiondata.c��������������������������������������������0000644�0001750�0001750�00000016156�12416346617�021170� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cSelectionData #define _SELF(d) ((GtkSelectionData*)RVAL2BOXED(d, GTK_TYPE_SELECTION_DATA)) static GdkAtom compound_text; /************************************************************************/ void rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom *gtype, void **data, gint *format, gint *length) { void* dat = NULL; gint fmt, len; GdkAtom ntype = RVAL2ATOM(type); if(ntype == GDK_SELECTION_TYPE_INTEGER){ glong *i; i = ALLOC(glong); *i = NUM2INT(src); dat = i; fmt = 32; len = 1; } else if(ntype == GDK_SELECTION_TYPE_STRING) { dat = (void *)RVAL2CSTR(src); fmt = 8; if (NIL_P(size)) { len = RSTRING_LEN(src); } else { len = NUM2UINT(size); } } else if(ntype == compound_text){ guchar* str = (guchar*)dat; gdk_string_to_compound_text(RVAL2CSTR(src), &ntype, &fmt, &str, &len); } else if(type != Qnil && size != Qnil && src != Qnil) { dat = (void *)RVAL2CSTR(src); fmt = NUM2INT(size); len = (RSTRING_LEN(src) * sizeof(char) / fmt); } else { rb_raise(rb_eArgError, "no supported type."); } *gtype = ntype; *data = dat; *format = fmt; *length = len; } void rbgtk_atom2selectiondata_free(GdkAtom type, void *dat) { if (type == GDK_SELECTION_TYPE_INTEGER || type == GDK_SELECTION_TYPE_ATOM) { xfree(dat); } else if(type == compound_text) { gdk_free_compound_text(dat); } } /************************************************************************/ static VALUE rg_selection(VALUE self) { GdkAtom selection = _SELF(self)->selection; return BOXED2RVAL(&selection, GDK_TYPE_ATOM); } static VALUE rg_target(VALUE self) { return BOXED2RVAL(_SELF(self)->target, GDK_TYPE_ATOM); } static VALUE rg_type(VALUE self) { return BOXED2RVAL(_SELF(self)->type, GDK_TYPE_ATOM); } static VALUE rg_format(VALUE self) { return INT2NUM(_SELF(self)->format); } static VALUE rg_data(VALUE self) { return RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const char*)_SELF(self)->data, _SELF(self)->length)); } static VALUE rg_display(VALUE self) { return BOXED2RVAL(_SELF(self)->display, GDK_TYPE_DISPLAY); } /* Instance Methods */ static VALUE rg_set(int argc, VALUE *argv, VALUE self) { void* dat; VALUE type, src; gint fmt, len; GdkAtom ntype; VALUE size = Qnil; if(3 == argc) rb_scan_args(argc, argv, "30", &type, &size, &src); else rb_scan_args(argc, argv, "20", &type, &src); rbgtk_atom2selectiondata(type, size, src, &ntype, &dat, &fmt, &len); gtk_selection_data_set(_SELF(self), ntype, fmt, dat, len); rbgtk_atom2selectiondata_free(ntype, dat); return self; } static VALUE rg_set_text(VALUE self, VALUE str) { StringValue(str); if (!gtk_selection_data_set_text(_SELF(self), RSTRING_PTR(str), RSTRING_LEN(str))) rb_raise(rb_eRuntimeError, "the selection wasn't successfully set"); return self; } static VALUE rg_text(VALUE self) { return CSTR2RVAL_FREE((gchar *)gtk_selection_data_get_text(_SELF(self))); } static VALUE rg_set_pixbuf(VALUE self, VALUE pixbuf) { if (!gtk_selection_data_set_pixbuf(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf)))) rb_raise(rb_eRuntimeError, "the selection wasn't successfully set"); return self; } static VALUE rg_pixbuf(VALUE self) { return GOBJ2RVAL(gtk_selection_data_get_pixbuf(_SELF(self))); } static VALUE rg_set_uris(VALUE self, VALUE uris) { gboolean ret; gchar **guris; guris = (gchar **)RVAL2STRV(uris); ret = gtk_selection_data_set_uris(_SELF(self), guris); g_free(guris); if (!ret) rb_raise(rb_eRuntimeError, "the selection wasn't successfully."); return self; } static VALUE rg_uris(VALUE self) { VALUE ary = rb_ary_new(); gchar** uris = gtk_selection_data_get_uris(_SELF(self)); if (uris) { gchar **uri = uris; while (*uri) { rb_ary_push(ary, CSTR2RVAL(*uri)); uri++; } g_strfreev(uris); } return ary; } static VALUE rg_targets(VALUE self) { GdkAtom* targets; gint n_atoms; VALUE result = Qnil; gboolean ret = gtk_selection_data_get_targets(_SELF(self), &targets, &n_atoms); if (ret) { int i; result = rb_ary_new2(n_atoms); for (i = 0; i < n_atoms; i++){ rb_ary_push(result, BOXED2RVAL(targets[i], GDK_TYPE_ATOM)); } } g_free(targets); return result; } static VALUE rg_targets_include_image(VALUE self, VALUE writable) { return CBOOL2RVAL(gtk_selection_data_targets_include_image(_SELF(self), RVAL2CBOOL(writable))); } static VALUE rg_targets_include_text(VALUE self) { return CBOOL2RVAL(gtk_selection_data_targets_include_text(_SELF(self))); } static VALUE rg_targets_include_uri(VALUE self) { return CBOOL2RVAL(gtk_selection_data_targets_include_uri(_SELF(self))); } static VALUE rg_targets_include_rich_text(VALUE self, VALUE buffer) { return CBOOL2RVAL(gtk_selection_data_targets_include_rich_text(_SELF(self), GTK_TEXT_BUFFER(RVAL2GOBJ(buffer)))); } void Init_gtk_selectiondata(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SELECTION_DATA, "SelectionData", mGtk); rbgobj_boxed_not_copy_obj(GTK_TYPE_SELECTION_DATA); compound_text = gdk_atom_intern("COMPOUND_TEXT", FALSE); RG_DEF_METHOD(selection, 0); RG_DEF_METHOD(target, 0); RG_DEF_METHOD(type, 0); RG_DEF_METHOD(format, 0); RG_DEF_METHOD(data, 0); RG_DEF_METHOD(display, 0); RG_DEF_METHOD(set, -1); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_text, 1); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(set_pixbuf, 1); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(set_uris, 1); RG_DEF_METHOD(targets_include_image, 1); RG_DEF_METHOD(targets, 0); RG_DEF_METHOD(targets_include_text, 0); RG_DEF_METHOD(targets_include_uri, 0); RG_DEF_METHOD(targets_include_rich_text, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentchoosermenu.c����������������������������������������0000644�0001750�0001750�00000003123�12257552167�022071� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentChooserMenu #define _SELF(self) (GTK_RECENT_CHOOSER_MENU(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE manager; GtkWidget* menu; rb_scan_args(argc, argv, "01", &manager); if (NIL_P(manager)){ menu = gtk_recent_chooser_menu_new_for_manager(GTK_RECENT_MANAGER(RVAL2GOBJ(manager))); } else { menu = gtk_recent_chooser_menu_new(); } RBGTK_INITIALIZE(self, menu); return Qnil; } void Init_gtk_recent_chooser_menu(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER_MENU, "RecentChooserMenu", mGtk); RG_DEF_METHOD(initialize, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkseparatortoolitem.c����������������������������������������0000644�0001750�0001750�00000002404�12257552167�022117� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cSeparatorToolItem static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_separator_tool_item_new()); return Qnil; } void Init_gtk_separatortoolitem(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SEPARATOR_TOOL_ITEM, "SeparatorToolItem", mGtk); RG_DEF_METHOD(initialize, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbin.c������������������������������������������������������0000644�0001750�0001750�00000002565�11701304107�017100� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentfilterinfo.c�����������������������������������������0000644�0001750�0001750�00000011164�12257552167�021707� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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" /*****************************************/ static GtkRecentFilterInfo* rf_copy(const GtkRecentFilterInfo* info) { GtkRecentFilterInfo* new_info; g_return_val_if_fail (info != NULL, NULL); new_info = g_new(GtkRecentFilterInfo, 1); *new_info = *info; return new_info; } static void rf_free(GtkRecentFilterInfo* boxed) { if (boxed) { g_free(boxed->applications); g_free(boxed->groups); g_free(boxed); } } GType gtk_recent_filter_info_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkRecentFilterInfo", (GBoxedCopyFunc)rf_copy, (GBoxedFreeFunc)rf_free); return our_type; } /*****************************************/ #define RG_TARGET_NAMESPACE cRecentFilterInfo #define _SELF(w) ((GtkRecentFilterInfo*)RVAL2BOXED(w, GTK_TYPE_RECENT_FILTER_INFO)) static VALUE rg_initialize(VALUE self) { GtkRecentFilterInfo finfo; memset(&finfo, 0, sizeof(GtkRecentFilterInfo)); G_INITIALIZE(self, g_boxed_copy(GTK_TYPE_RECENT_FILTER_INFO, &finfo)); return Qnil; } static VALUE rg_contains(VALUE self) { return GFLAGS2RVAL(_SELF(self)->contains, GTK_TYPE_RECENT_FILTER_FLAGS); } static VALUE rg_set_contains(VALUE self, VALUE contains) { _SELF(self)->contains = RVAL2GFLAGS(contains, GTK_TYPE_RECENT_FILTER_FLAGS); return self; } #define FINFO_STR(name)\ static VALUE \ rf_get_ ## name (VALUE self)\ {\ return CSTR2RVAL(_SELF(self)->name);\ }\ static VALUE \ rf_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2CSTR(val);\ return self;\ } FINFO_STR(uri); FINFO_STR(display_name); FINFO_STR(mime_type); static VALUE rg_applications(VALUE self) { const gchar** apps = _SELF(self)->applications; VALUE ary = rb_ary_new(); gint i = 0; while (apps[i]) { rb_ary_push(ary, CSTR2RVAL((gchar*)apps[i])); i++; } return ary; } static VALUE rg_set_applications(VALUE self, VALUE applications) { /* NOTE: This can't be right. What guarantees that the entries in * applications will be around? It should be RVAL2STRV_DUP and use * g_strfreev in free above. */ _SELF(self)->applications = RVAL2STRV(applications); return self; } static VALUE rg_groups(VALUE self) { const gchar** grps = _SELF(self)->groups; VALUE ary = rb_ary_new(); gint i = 0; while (grps[i]) { rb_ary_push(ary, CSTR2RVAL((gchar*)grps[i])); i++; } return ary; } static VALUE rg_set_groups(VALUE self, VALUE groups) { _SELF(self)->groups = RVAL2STRV(groups); return self; } static VALUE rg_age(VALUE self) { return INT2NUM(_SELF(self)->age); } static VALUE rg_set_age(VALUE self, VALUE age) { _SELF(self)->age = NUM2INT(age); return self; } void Init_gtk_recent_filter_info(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_FILTER_INFO, "RecentFilterInfo", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(contains, 0); RG_DEF_METHOD(set_contains, 1); rb_define_method(RG_TARGET_NAMESPACE, "uri", rf_get_uri, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_uri", rf_set_uri, 1); rb_define_method(RG_TARGET_NAMESPACE, "display_name", rf_get_display_name, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_display_name", rf_set_display_name, 1); rb_define_method(RG_TARGET_NAMESPACE, "mime_type", rf_get_mime_type, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_mime_type", rf_set_mime_type, 1); RG_DEF_METHOD(applications, 0); RG_DEF_METHOD(set_applications, 1); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD(set_groups, 1); RG_DEF_METHOD(age, 0); RG_DEF_METHOD(set_age, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilechooserdialog.c����������������������������������������0000644�0001750�0001750�00000004447�12257552167�022035� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 cFileChooserDialog #define _SELF(self) GTK_FILE_CHOOSER_DIALOG(RVAL2GOBJ(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE title, parent, action, back, button_ary; GtkWidget* dialog; const gchar *gtitle; GtkWindow *gparent; GtkFileChooserAction gaction; const gchar *gback; rb_scan_args(argc, argv, "04*", &title, &parent, &action, &back, &button_ary); gtitle = NIL_P(title) ? NULL : RVAL2CSTR(title); gparent = NIL_P(parent) ? NULL : GTK_WINDOW(RVAL2GOBJ(parent)); gaction = NIL_P(action) ? GTK_FILE_CHOOSER_ACTION_OPEN : RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION); gback = NIL_P(back) ? NULL : RVAL2CSTR(back); dialog = gtk_file_chooser_dialog_new_with_backend(gtitle, gparent, gaction, gback, NULL, NULL); RBGTK_INITIALIZE(self, dialog); rbgtk_dialog_add_buttons_internal(self, button_ary); return Qnil; } void Init_gtk_file_chooser_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_DIALOG, "FileChooserDialog", mGtk); RG_DEF_METHOD(initialize, -1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmacros.h���������������������������������������������������0000644�0001750�0001750�00000002625�11701304107�017616� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_GTK_MACROS_H__ #define __RB_GTK_MACROS_H__ #define RBGTK_MAJOR_VERSION RBGLIB_MAJOR_VERSION #define RBGTK_MINOR_VERSION RBGLIB_MINOR_VERSION #define RBGTK_MICRO_VERSION RBGLIB_MICRO_VERSION #if defined(G_PLATFORM_WIN32) && !defined(RUBY_GTK2_STATIC_COMPILATION) # ifdef RUBY_GTK2_COMPILATION # define RUBY_GTK2_VAR __declspec(dllexport) # else # define RUBY_GTK2_VAR extern __declspec(dllimport) # endif #else # define RUBY_GTK2_VAR extern #endif #endif /* __RB_GTK_MACROS_H__ */ �����������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkwindowgroup.c����������������������������������������������0000644�0001750�0001750�00000003276�11701304107�020714� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cWindowGroup static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_window_group_new()); return Qnil; } static VALUE rg_add(VALUE self, VALUE window) { gtk_window_group_add_window(GTK_WINDOW_GROUP(RVAL2GOBJ(self)), GTK_WINDOW(RVAL2GOBJ(window))); return self; } static VALUE rg_remove(VALUE self, VALUE window) { gtk_window_group_remove_window(GTK_WINDOW_GROUP(RVAL2GOBJ(self)), GTK_WINDOW(RVAL2GOBJ(window))); return self; } void Init_gtk_windowgroup(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WINDOW_GROUP, "WindowGroup", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, 1); RG_DEF_METHOD(remove, 1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbutton.c���������������������������������������������������0000644�0001750�0001750�00000006234�12257552167�017662� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } 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)); } 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); RG_DEF_METHOD(set_alignment, 2); G_DEF_SETTER(RG_TARGET_NAMESPACE, "alignment"); RG_DEF_METHOD(alignment, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkcursor.c���������������������������������������������������0000644�0001750�0001750�00000007143�12257552167�017644� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) { VALUE display, type_or_name; rb_scan_args(argc, argv, "20", &display, &type_or_name); if (TYPE(type_or_name) == T_STRING) cursor = gdk_cursor_new_from_name(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)), RVAL2CSTR(type_or_name)); else cursor = gdk_cursor_new_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)), RVAL2GENUM(type_or_name, GDK_TYPE_CURSOR_TYPE)); } else if (argc == 4) { 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 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; } static VALUE rg_display(VALUE self) { return GOBJ2RVAL(gdk_cursor_get_display((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR))); } 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); } static VALUE rg_image(VALUE self) { return GOBJ2RVAL(gdk_cursor_get_image((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR))); } void Init_gtk_gdk_cursor(VALUE mGdk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(display, 0); RG_DEF_METHOD_P(pixmap, 0); RG_DEF_METHOD(cursor_type, 0); RG_DEF_METHOD(image, 0); G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_CURSOR_TYPE, "GDK_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkdrawingarea.c����������������������������������������������0000644�0001750�0001750�00000002577�11701304107�020617� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ���������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkpango.c����������������������������������������������������0000644�0001750�0001750�00000013573�12257552167�017437� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 { ret = GOBJ2RVAL(gdk_pango_context_get_for_screen(GDK_SCREEN(RVAL2GOBJ(screen)))); } 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 } �������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprintcontext.c���������������������������������������������0000644�0001750�0001750�00000006327�12257552167�021113� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cPrintContext #define _SELF(s) (GTK_PRINT_CONTEXT(RVAL2GOBJ(s))) # ifdef HAVE_RB_CAIRO_H #include <rb_cairo.h> /* Rendering */ static VALUE rg_cairo_context(VALUE self) { return CRCONTEXT2RVAL(gtk_print_context_get_cairo_context(_SELF(self))); } # endif static VALUE rg_page_setup(VALUE self) { return GOBJ2RVAL(gtk_print_context_get_page_setup(_SELF(self))); } static VALUE rg_width(VALUE self) { return rb_float_new(gtk_print_context_get_width(_SELF(self))); } static VALUE rg_height(VALUE self) { return rb_float_new(gtk_print_context_get_height(_SELF(self))); } static VALUE rg_dpi_x(VALUE self) { return rb_float_new(gtk_print_context_get_dpi_x(_SELF(self))); } static VALUE rg_dpi_y(VALUE self) { return rb_float_new(gtk_print_context_get_dpi_y(_SELF(self))); } /* Fonts */ static VALUE rg_pango_fontmap(VALUE self) { return GOBJ2RVAL(gtk_print_context_get_pango_fontmap(_SELF(self))); } static VALUE rg_create_pango_context(VALUE self) { return GOBJ2RVALU(gtk_print_context_create_pango_context(_SELF(self))); } static VALUE rg_create_pango_layout(VALUE self) { return GOBJ2RVALU(gtk_print_context_create_pango_layout(_SELF(self))); } /* Needed for preview implementations */ # ifdef HAVE_RB_CAIRO_H static VALUE rg_set_cairo_context(VALUE self, VALUE cr, VALUE dpi_x, VALUE dpi_y) { gtk_print_context_set_cairo_context(_SELF(self), RVAL2CRCONTEXT(cr), NUM2DBL(dpi_x), NUM2DBL(dpi_y)); return self; } # endif void Init_gtk_print_context(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_CONTEXT, "PrintContext", mGtk); /* Rendering */ # ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(cairo_context, 0); # endif RG_DEF_METHOD(page_setup, 0); RG_DEF_METHOD(width, 0); RG_DEF_METHOD(height, 0); RG_DEF_METHOD(dpi_x, 0); RG_DEF_METHOD(dpi_y, 0); /* Fonts */ RG_DEF_METHOD(pango_fontmap, 0); RG_DEF_METHOD(create_pango_context, 0); RG_DEF_METHOD(create_pango_layout, 0); /* Needed for preview implementations */ # ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(set_cairo_context, 3); # endif G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilefilter.c�����������������������������������������������0000644�0001750�0001750�00000007534�12257552167�020500� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 cFileFilter #define _SELF(self) GTK_FILE_FILTER(RVAL2GOBJ(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_file_filter_new()); return Qnil; } static VALUE rg_set_name(VALUE self, VALUE name) { gtk_file_filter_set_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_name(VALUE self) { return CSTR2RVAL(gtk_file_filter_get_name(_SELF(self))); } static VALUE rg_add_mime_type(VALUE self, VALUE mime) { gtk_file_filter_add_mime_type(_SELF(self), RVAL2CSTR(mime)); return self; } static VALUE rg_add_pattern(VALUE self, VALUE pattern) { gtk_file_filter_add_pattern(_SELF(self), RVAL2CSTR(pattern)); return self; } /* Should return true/false */ static gboolean filter_func(const GtkFileFilterInfo *info, gpointer func) { return CBOOL2RVAL(rb_funcall((VALUE)func, id_call, 5, GFLAGS2RVAL(info->contains, GTK_TYPE_FILE_FILTER_FLAGS), CSTR2RVAL(info->filename), CSTR2RVAL(info->uri), CSTR2RVAL(info->display_name), CSTR2RVAL(info->mime_type))); } static VALUE rg_add_pixbuf_formats(VALUE self) { gtk_file_filter_add_pixbuf_formats(_SELF(self)); return self; } static VALUE rg_add_custom(VALUE self, VALUE needed) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_file_filter_add_custom(_SELF(self), RVAL2GFLAGS(needed, GTK_TYPE_FILE_FILTER_FLAGS), (GtkFileFilterFunc)filter_func, (gpointer)func, NULL); return self; } static VALUE rg_needed(VALUE self) { return GFLAGS2RVAL(gtk_file_filter_get_needed(_SELF(self)), GTK_TYPE_FILE_FILTER_FLAGS); } static VALUE rg_filter_p(VALUE self, VALUE contains, VALUE filename, VALUE uri, VALUE display_name, VALUE mime_type) { GtkFileFilterInfo info; info.contains = RVAL2GFLAGS(contains, GTK_TYPE_FILE_FILTER_FLAGS); info.filename = RVAL2CSTR(filename); info.uri = RVAL2CSTR(uri); info.display_name = RVAL2CSTR(display_name); info.mime_type = RVAL2CSTR(mime_type); return CBOOL2RVAL(gtk_file_filter_filter(_SELF(self), &info)); } void Init_gtk_file_filter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_FILTER, "FileFilter", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_name, 1); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(add_mime_type, 1); RG_DEF_METHOD(add_pattern, 1); RG_DEF_METHOD(add_pixbuf_formats, 0); RG_DEF_METHOD(add_custom, 1); RG_DEF_METHOD(needed, 0); RG_DEF_METHOD_P(filter, 5); G_DEF_SETTERS(RG_TARGET_NAMESPACE); G_DEF_CLASS(GTK_TYPE_FILE_FILTER_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_FILE_FILTER_FLAGS, "GTK_FILE_FILTER_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmenushell.c������������������������������������������������0000644�0001750�0001750�00000006047�12257552167�020345� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cMenuShell #define _SELF(self) (GTK_MENU_SHELL(RVAL2GOBJ(self))) #define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w))) static VALUE rg_append(VALUE self, VALUE child) { gtk_menu_shell_append(_SELF(self),RVAL2WIDGET(child)); G_CHILD_ADD(self, child); return self; } static VALUE rg_prepend(VALUE self, VALUE child) { gtk_menu_shell_prepend(_SELF(self), RVAL2WIDGET(child)); G_CHILD_ADD(self, child); return self; } static VALUE rg_insert(VALUE self, VALUE child, VALUE pos) { gtk_menu_shell_insert(_SELF(self), RVAL2WIDGET(child), NUM2INT(pos)); G_CHILD_ADD(self, child); return self; } static VALUE rg_deactivate(VALUE self) { gtk_menu_shell_deactivate(_SELF(self)); return self; } static VALUE rg_select_item(VALUE self, VALUE menu_item) { gtk_menu_shell_select_item(_SELF(self), RVAL2WIDGET(menu_item)); return self; } static VALUE rg_select_first(VALUE self, VALUE search_sensitive) { gtk_menu_shell_select_first(_SELF(self), RVAL2CBOOL(search_sensitive)); return self; } static VALUE rg_deselect(VALUE self) { gtk_menu_shell_deselect(_SELF(self)); return self; } static VALUE rg_activate_item(VALUE self, VALUE menu_item, VALUE force_deactivate) { gtk_menu_shell_activate_item(_SELF(self), RVAL2WIDGET(menu_item), RVAL2CBOOL(force_deactivate)); return self; } void Init_gtk_menu_shell(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_SHELL, "MenuShell", mGtk); RG_DEF_METHOD(append, 1); RG_DEF_METHOD(prepend, 1); RG_DEF_METHOD(insert, 2); RG_DEF_METHOD(deactivate, 0); RG_DEF_METHOD(select_item, 1); RG_DEF_METHOD(select_first, 1); RG_DEF_METHOD(deselect, 0); RG_DEF_METHOD(activate_item, 2); /* GtkMenuDirectionType */ G_DEF_CLASS(GTK_TYPE_MENU_DIRECTION_TYPE, "DirectionType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_MENU_DIRECTION_TYPE, "GTK_MENU_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilesystemerror.c������������������������������������������0000644�0001750�0001750�00000004013�12257552167�021576� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005,2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 cFileSystemError void Init_gtk_filesystemerror(VALUE mGtk) { #ifdef GTK_FILE_SYSTEM_ERROR VALUE RG_TARGET_NAMESPACE; /* GtkFileSystemError */ RG_TARGET_NAMESPACE = G_DEF_ERROR2(GTK_FILE_SYSTEM_ERROR, "FileSystemError", mGtk, rb_eRuntimeError); rb_define_const(RG_TARGET_NAMESPACE, "NONEXISTENT", INT2NUM(GTK_FILE_SYSTEM_ERROR_NONEXISTENT)); rb_define_const(RG_TARGET_NAMESPACE, "NOT_FOLDER", INT2NUM(GTK_FILE_SYSTEM_ERROR_NOT_FOLDER)); rb_define_const(RG_TARGET_NAMESPACE, "INVALID_URI", INT2NUM(GTK_FILE_SYSTEM_ERROR_INVALID_URI)); rb_define_const(RG_TARGET_NAMESPACE, "BAD_FILENAME", INT2NUM(GTK_FILE_SYSTEM_ERROR_BAD_FILENAME)); rb_define_const(RG_TARGET_NAMESPACE, "FAILED", INT2NUM(GTK_FILE_SYSTEM_ERROR_FAILED)); rb_define_const(RG_TARGET_NAMESPACE, "ALREADY_EXSITS", INT2NUM(GTK_FILE_SYSTEM_ERROR_ALREADY_EXISTS)); #endif } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprintsettings.c��������������������������������������������0000644�0001750�0001750�00000056570�12257552167�021274� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cPrintSettings #define _SELF(s) (GTK_PRINT_SETTINGS(RVAL2GOBJ(s))) #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT)) static VALUE s_string, s_bool, s_double, s_length, s_int; #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GtkPrintSettings* settings = NULL; GError *error = NULL; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (NIL_P(arg1)){ settings = gtk_print_settings_new(); } else if (NIL_P(arg2)){ settings = gtk_print_settings_new_from_file(RVAL2CSTR(arg1), &error); if (!settings) { RAISE_GERROR(error); } } else { settings = gtk_print_settings_new_from_key_file((GKeyFile*)RVAL2BOXED(arg1, G_TYPE_KEY_FILE), RVAL2CSTR(arg2), &error); if (!settings) { RAISE_GERROR(error); } } G_INITIALIZE(self, settings); return Qnil; } #else static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_print_settings_new()); return Qnil; } #endif static VALUE rg_dup(VALUE self) { return GOBJ2RVALU(gtk_print_settings_copy(_SELF(self))); } static VALUE rg_has_key_p(VALUE self, VALUE key) { return CBOOL2RVAL(gtk_print_settings_has_key(_SELF(self), RVAL2CSTR(key))); } static VALUE ps_get(VALUE self, VALUE key) { return CSTR2RVAL(gtk_print_settings_get(_SELF(self), RVAL2CSTR(key))); } static VALUE ps_set(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set(_SELF(self), RVAL2CSTR(key), RVAL2CSTR_ACCEPT_NIL(value)); return self; } static VALUE rg_unset(VALUE self, VALUE key) { gtk_print_settings_unset(_SELF(self), RVAL2CSTR(key)); return self; } static void ps_foreach_cb(const gchar *key, const gchar *value, gpointer data) { rb_funcall((VALUE)data, id_call, 2, CSTR2RVAL(key), CSTR2RVAL(value)); } static VALUE rg_each(VALUE self) { gtk_print_settings_foreach(_SELF(self), ps_foreach_cb, (gpointer)rb_block_proc()); return self; } static VALUE rg_get_bool(VALUE self, VALUE key) { return CBOOL2RVAL(gtk_print_settings_get_bool(_SELF(self), RVAL2CSTR(key))); } static VALUE ps_set_bool(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set_bool(_SELF(self), RVAL2CSTR(key), RVAL2CBOOL(value)); return self; } static VALUE rg_get_double(int argc, VALUE *argv, VALUE self) { VALUE key, default_value; gdouble value; rb_scan_args(argc, argv, "11", &key, &default_value); if (NIL_P(default_value)) value = gtk_print_settings_get_double(_SELF(self), RVAL2CSTR(key)); else value = gtk_print_settings_get_double_with_default(_SELF(self), RVAL2CSTR(key), NUM2DBL(default_value)); return rb_float_new(value); } static VALUE ps_set_double(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set_double(_SELF(self), RVAL2CSTR(key), NUM2DBL(value)); return self; } static VALUE rg_get_length(VALUE self, VALUE key, VALUE unit) { return rb_float_new(gtk_print_settings_get_length(_SELF(self), RVAL2CSTR(key), RVAL2UNIT(unit))); } static VALUE ps_set_length(VALUE self, VALUE key, VALUE value, VALUE unit) { gtk_print_settings_set_length(_SELF(self), RVAL2CSTR(key), NUM2DBL(value), RVAL2UNIT(unit)); return self; } static VALUE rg_get_int(int argc, VALUE *argv, VALUE self) { VALUE key, default_value; gint value; rb_scan_args(argc, argv, "11", &key, &default_value); if (NIL_P(default_value)) value = gtk_print_settings_get_int(_SELF(self), RVAL2CSTR(key)); else value = gtk_print_settings_get_int_with_default(_SELF(self), RVAL2CSTR(key), NUM2INT(default_value)); return INT2NUM(value); } static VALUE ps_set_int(VALUE self, VALUE key, VALUE value) { gtk_print_settings_set_int(_SELF(self), RVAL2CSTR(key), NUM2INT(value)); return self; } static VALUE rg_get(int argc, VALUE *argv, VALUE self) { VALUE key, type, unit_or_default, result; rb_scan_args(argc, argv, "12", &key, &type, &unit_or_default); if (NIL_P(type) || (RVAL2CBOOL(rb_equal(type, s_string)))) { result = ps_get(self, key); } else if (RVAL2CBOOL(rb_equal(type, s_bool))) { result = rg_get_bool(self, key); } else if (RVAL2CBOOL(rb_equal(type, s_double))) { VALUE double_argv[2]; double_argv[0] = key; double_argv[1] = unit_or_default; result = rg_get_double(2, double_argv, self); } else if (RVAL2CBOOL(rb_equal(type, s_length))) { result = rg_get_length(self, key, unit_or_default); } else if (RVAL2CBOOL(rb_equal(type, s_int))) { VALUE int_argv[2]; int_argv[0] = key; int_argv[1] = unit_or_default; result = rg_get_int(2, int_argv, self); } else { VALUE inspected_type; inspected_type = rb_inspect(type); rb_raise(rb_eArgError, "%s must be nil, :string, :bool, :double, :length or :int", RVAL2CSTR(inspected_type)); } return result; } static VALUE rg_set(int argc, VALUE *argv, VALUE self) { VALUE key, value, unit; rb_scan_args(argc, argv, "21", &key, &value, &unit); switch (TYPE(value)) { case T_STRING: ps_set(self, key, value); break; case T_TRUE: case T_FALSE: ps_set_bool(self, key, value); break; case T_FIXNUM: ps_set_int(self, key, value); break; case T_FLOAT: if (NIL_P(unit)) { ps_set_double(self, key, value); } else { ps_set_length(self, key, value, unit); } break; case T_NIL: rg_unset(self, key); break; default: { VALUE inspected_value; inspected_value = rb_inspect(value); rb_raise(rb_eArgError, "%s is invalid value", RVAL2CSTR(inspected_value)); break; } } return self; } static VALUE rg_operator_ps_set_generic_indexer(int argc, VALUE *argv, VALUE self) { if (argc == 3) { VALUE swapped_argv[3]; swapped_argv[0] = argv[0]; swapped_argv[1] = argv[2]; swapped_argv[2] = argv[1]; rg_set(argc, swapped_argv, self); } else if (argc == 2) { rg_set(argc, argv, self); } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc); } return argv[2]; } /* Helpers: */ static VALUE rg_printer(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_printer(_SELF(self))); } static VALUE rg_set_printer(VALUE self, VALUE printer) { gtk_print_settings_set_printer(_SELF(self), RVAL2CSTR_ACCEPT_NIL(printer)); return self; } static VALUE rg_orientation(VALUE self) { return GENUM2RVAL(gtk_print_settings_get_orientation(_SELF(self)), GTK_TYPE_PAGE_ORIENTATION); } static VALUE rg_set_orientation(VALUE self, VALUE orientation) { gtk_print_settings_set_orientation(_SELF(self), RVAL2GENUM(orientation, GTK_TYPE_PAGE_ORIENTATION)); return self; } static VALUE rg_paper_size(VALUE self) { return GOBJ2RVAL(gtk_print_settings_get_paper_size(_SELF(self))); } static VALUE rg_set_paper_size(VALUE self, VALUE paper_size) { gtk_print_settings_set_paper_size(_SELF(self), RVAL2BOXED(paper_size, GTK_TYPE_PAPER_SIZE)); return self; } static VALUE rg_paper_width(VALUE self, VALUE unit) { return rb_float_new(gtk_print_settings_get_paper_width(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_set_paper_width(VALUE self, VALUE paper_width, VALUE unit) { gtk_print_settings_set_paper_width(_SELF(self), NUM2DBL(paper_width), RVAL2UNIT(unit)); return self; } static VALUE rg_paper_height(VALUE self, VALUE unit) { return rb_float_new(gtk_print_settings_get_paper_height(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_set_paper_height(VALUE self, VALUE paper_height, VALUE unit) { gtk_print_settings_set_paper_height(_SELF(self), NUM2DBL(paper_height), RVAL2UNIT(unit)); return self; } static VALUE rg_use_color_p(VALUE self) { return CBOOL2RVAL(gtk_print_settings_get_use_color(_SELF(self))); } static VALUE rg_set_use_color(VALUE self, VALUE use_color) { gtk_print_settings_set_use_color(_SELF(self), RVAL2CBOOL(use_color)); return self; } static VALUE rg_collate_p(VALUE self) { return CBOOL2RVAL(gtk_print_settings_get_collate(_SELF(self))); } static VALUE rg_set_collate(VALUE self, VALUE collate) { gtk_print_settings_set_collate(_SELF(self), RVAL2CBOOL(collate)); return self; } static VALUE rg_reverse_p(VALUE self) { return CBOOL2RVAL(gtk_print_settings_get_reverse(_SELF(self))); } static VALUE rg_set_reverse(VALUE self, VALUE reverse) { gtk_print_settings_set_reverse(_SELF(self), RVAL2CBOOL(reverse)); return self; } static VALUE rg_duplex(VALUE self) { return GENUM2RVAL(gtk_print_settings_get_duplex(_SELF(self)), GTK_TYPE_PRINT_DUPLEX); } static VALUE rg_set_duplex(VALUE self, VALUE duplex) { gtk_print_settings_set_duplex(_SELF(self), RVAL2GENUM(duplex, GTK_TYPE_PRINT_DUPLEX)); return self; } static VALUE rg_quality(VALUE self) { return GENUM2RVAL(gtk_print_settings_get_quality(_SELF(self)), GTK_TYPE_PRINT_QUALITY); } static VALUE rg_set_quality(VALUE self, VALUE quality) { gtk_print_settings_set_quality(_SELF(self), RVAL2GENUM(quality, GTK_TYPE_PRINT_QUALITY)); return self; } static VALUE rg_n_copies(VALUE self) { return INT2NUM(gtk_print_settings_get_n_copies(_SELF(self))); } static VALUE rg_set_n_copies(VALUE self, VALUE n_copies) { gtk_print_settings_set_n_copies(_SELF(self), NUM2INT(n_copies)); return self; } static VALUE rg_number_up(VALUE self) { return INT2NUM(gtk_print_settings_get_number_up(_SELF(self))); } static VALUE rg_set_number_up(VALUE self, VALUE number_up) { gtk_print_settings_set_number_up(_SELF(self), NUM2INT(number_up)); return self; } static VALUE rg_resolution(VALUE self) { return INT2NUM(gtk_print_settings_get_resolution(_SELF(self))); } static VALUE rg_set_resolution(VALUE self, VALUE resolution) { gtk_print_settings_set_resolution(_SELF(self), NUM2INT(resolution)); return self; } static VALUE rg_scale(VALUE self) { return rb_float_new(gtk_print_settings_get_scale(_SELF(self))); } static VALUE rg_set_scale(VALUE self, VALUE scale) { gtk_print_settings_set_scale(_SELF(self), NUM2DBL(scale)); return self; } static VALUE rg_print_pages(VALUE self) { return GENUM2RVAL(gtk_print_settings_get_print_pages(_SELF(self)), GTK_TYPE_PRINT_PAGES); } static VALUE rg_set_print_pages(VALUE self, VALUE print_pages) { gtk_print_settings_set_print_pages(_SELF(self), RVAL2GENUM(print_pages, GTK_TYPE_PRINT_PAGES)); return self; } static VALUE rg_page_ranges(VALUE self) { VALUE rb_ranges; GtkPageRange *ranges; int i, num_ranges; ranges = gtk_print_settings_get_page_ranges(_SELF(self), &num_ranges); rb_ranges = rb_ary_new2(num_ranges); for (i = 0; i < num_ranges; i++) { rb_ary_push(rb_ranges, rb_ary_new3(2, INT2NUM(ranges[i].start), INT2NUM(ranges[i].end))); } g_free(ranges); return rb_ranges; } struct rbgtk_rval2gtkpageranges_args { VALUE ary; long n; GtkPageRange *result; }; static VALUE rbgtk_rval2gtkpageranges_body(VALUE value) { long i; struct rbgtk_rval2gtkpageranges_args *args = (struct rbgtk_rval2gtkpageranges_args *)value; for (i = 0; i < args->n; i++) { VALUE ary = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]); if (RARRAY_LEN(ary) != 2) rb_raise(rb_eArgError, "range %ld should be array of size 2", i); args->result[i].start = NUM2INT(RARRAY_PTR(ary)[0]); args->result[i].end = NUM2INT(RARRAY_PTR(ary)[1]); } return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkpageranges_rescue(VALUE value) { g_free(((struct rbgtk_rval2gtkpageranges_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GtkPageRange * rbgtk_rval2gtkpageranges(VALUE value, long *n) { struct rbgtk_rval2gtkpageranges_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = g_new(GtkPageRange, args.n + 1); rb_rescue(rbgtk_rval2gtkpageranges_body, (VALUE)&args, rbgtk_rval2gtkpageranges_rescue, (VALUE)&args); if (n != NULL) *n = args.n; return args.result; } #define RVAL2GTKPAGERANGES(value, n) rbgtk_rval2gtkpageranges(value, n) static VALUE rg_set_page_ranges(VALUE self, VALUE rbpage_ranges) { GtkPrintSettings *settings = _SELF(self); long n; GtkPageRange *page_ranges = RVAL2GTKPAGERANGES(rbpage_ranges, &n); gtk_print_settings_set_page_ranges(settings, page_ranges, n); g_free(page_ranges); return self; } static VALUE rg_page_set(VALUE self) { return GENUM2RVAL(gtk_print_settings_get_page_set(_SELF(self)), GTK_TYPE_PAGE_SET); } static VALUE rg_set_page_set(VALUE self, VALUE page_set) { gtk_print_settings_set_page_set(_SELF(self), RVAL2GENUM(page_set, GTK_TYPE_PAGE_SET)); return self; } static VALUE rg_default_source(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_default_source(_SELF(self))); } static VALUE rg_set_default_source(VALUE self, VALUE default_source) { gtk_print_settings_set_default_source(_SELF(self), RVAL2CSTR_ACCEPT_NIL(default_source)); return self; } static VALUE rg_media_type(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_media_type(_SELF(self))); } static VALUE rg_set_media_type(VALUE self, VALUE media_type) { gtk_print_settings_set_media_type(_SELF(self), RVAL2CSTR_ACCEPT_NIL(media_type)); return self; } static VALUE rg_dither(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_dither(_SELF(self))); } static VALUE rg_set_dither(VALUE self, VALUE dither) { gtk_print_settings_set_dither(_SELF(self), RVAL2CSTR_ACCEPT_NIL(dither)); return self; } static VALUE rg_finishings(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_finishings(_SELF(self))); } static VALUE rg_set_finishings(VALUE self, VALUE finishings) { gtk_print_settings_set_finishings(_SELF(self), RVAL2CSTR_ACCEPT_NIL(finishings)); return self; } static VALUE rg_output_bin(VALUE self) { return CSTR2RVAL(gtk_print_settings_get_output_bin(_SELF(self))); } static VALUE rg_set_output_bin(VALUE self, VALUE output_bin) { gtk_print_settings_set_output_bin(_SELF(self), RVAL2CSTR_ACCEPT_NIL(output_bin)); return self; } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_to_file(VALUE self, VALUE file_name) { GError *error = NULL; if (!gtk_print_settings_to_file(_SELF(self), RVAL2CSTR(file_name), &error)) { RAISE_GERROR(error); } return self; } static VALUE rg_to_key_file(int argc, VALUE *argv, VALUE self) { VALUE key_file, group_name; rb_scan_args(argc, argv, "11", &key_file, &group_name); gtk_print_settings_to_key_file(_SELF(self), (GKeyFile*)RVAL2BOXED(key_file, G_TYPE_KEY_FILE), RVAL2CSTR_ACCEPT_NIL(group_name)); return self; } #endif void Init_gtk_print_settings(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE; s_string = ID2SYM(rb_intern("string")); s_bool = ID2SYM(rb_intern("bool")); s_double = ID2SYM(rb_intern("double")); s_length = ID2SYM(rb_intern("length")); s_int = ID2SYM(rb_intern("int")); RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_SETTINGS, "PrintSettings", mGtk); rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(initialize, -1); #else RG_DEF_METHOD(initialize, 0); #endif RG_DEF_METHOD(dup, 0); RG_DEF_METHOD_P(has_key, 1); RG_DEF_METHOD(get, -1); RG_DEF_ALIAS("[]", "get"); RG_DEF_METHOD(get_bool, 1); RG_DEF_METHOD(get_double, -1); RG_DEF_METHOD(get_length, 2); RG_DEF_METHOD(get_int, -1); RG_DEF_METHOD(set, -1); RG_DEF_METHOD_OPERATOR("[]=", ps_set_generic_indexer, -1); RG_DEF_METHOD(unset, -1); RG_DEF_ALIAS("delete", "unset"); RG_DEF_METHOD(each, 0); rb_define_const(RG_TARGET_NAMESPACE, "PRINTER", CSTR2RVAL(GTK_PRINT_SETTINGS_PRINTER)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION", CSTR2RVAL(GTK_PRINT_SETTINGS_ORIENTATION)); rb_define_const(RG_TARGET_NAMESPACE, "PAPER_FORMAT", CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_FORMAT)); rb_define_const(RG_TARGET_NAMESPACE, "PAPER_WIDTH", CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_WIDTH)); rb_define_const(RG_TARGET_NAMESPACE, "PAPER_HEIGHT", CSTR2RVAL(GTK_PRINT_SETTINGS_PAPER_HEIGHT)); rb_define_const(RG_TARGET_NAMESPACE, "N_COPIES", CSTR2RVAL(GTK_PRINT_SETTINGS_N_COPIES)); rb_define_const(RG_TARGET_NAMESPACE, "DEFAULT_SOURCE", CSTR2RVAL(GTK_PRINT_SETTINGS_DEFAULT_SOURCE)); rb_define_const(RG_TARGET_NAMESPACE, "QUALITY", CSTR2RVAL(GTK_PRINT_SETTINGS_QUALITY)); rb_define_const(RG_TARGET_NAMESPACE, "RESOLUTION", CSTR2RVAL(GTK_PRINT_SETTINGS_RESOLUTION)); rb_define_const(RG_TARGET_NAMESPACE, "USE_COLOR", CSTR2RVAL(GTK_PRINT_SETTINGS_USE_COLOR)); rb_define_const(RG_TARGET_NAMESPACE, "DUPLEX", CSTR2RVAL(GTK_PRINT_SETTINGS_DUPLEX)); rb_define_const(RG_TARGET_NAMESPACE, "COLLATE", CSTR2RVAL(GTK_PRINT_SETTINGS_COLLATE)); rb_define_const(RG_TARGET_NAMESPACE, "REVERSE", CSTR2RVAL(GTK_PRINT_SETTINGS_REVERSE)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_TYPE", CSTR2RVAL(GTK_PRINT_SETTINGS_MEDIA_TYPE)); rb_define_const(RG_TARGET_NAMESPACE, "DITHER", CSTR2RVAL(GTK_PRINT_SETTINGS_DITHER)); rb_define_const(RG_TARGET_NAMESPACE, "SCALE", CSTR2RVAL(GTK_PRINT_SETTINGS_SCALE)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_PAGES", CSTR2RVAL(GTK_PRINT_SETTINGS_PRINT_PAGES)); rb_define_const(RG_TARGET_NAMESPACE, "PAGE_RANGES", CSTR2RVAL(GTK_PRINT_SETTINGS_PAGE_RANGES)); rb_define_const(RG_TARGET_NAMESPACE, "PAGE_SET", CSTR2RVAL(GTK_PRINT_SETTINGS_PAGE_SET)); rb_define_const(RG_TARGET_NAMESPACE, "FINISHINGS", CSTR2RVAL(GTK_PRINT_SETTINGS_FINISHINGS)); rb_define_const(RG_TARGET_NAMESPACE, "NUMBER_UP", CSTR2RVAL(GTK_PRINT_SETTINGS_NUMBER_UP)); rb_define_const(RG_TARGET_NAMESPACE, "OUTPUT_BIN", CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_BIN)); rb_define_const(RG_TARGET_NAMESPACE, "OUTPUT_FILE_FORMAT", CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT)); rb_define_const(RG_TARGET_NAMESPACE, "OUTPUT_URI", CSTR2RVAL(GTK_PRINT_SETTINGS_OUTPUT_URI)); rb_define_const(RG_TARGET_NAMESPACE, "WIN32_DRIVER_VERSION", CSTR2RVAL(GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION)); rb_define_const(RG_TARGET_NAMESPACE, "WIN32_DRIVER_EXTRA", CSTR2RVAL(GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA)); /* Helpers: */ RG_DEF_METHOD(printer, 0); RG_DEF_METHOD(set_printer, 1); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(set_orientation, 1); RG_DEF_METHOD(paper_size, 0); RG_DEF_METHOD(set_paper_size, 1); RG_DEF_METHOD(paper_width, 1); RG_DEF_METHOD(set_paper_width, 2); RG_DEF_METHOD(paper_height, 1); RG_DEF_METHOD(set_paper_height, 2); RG_DEF_METHOD_P(use_color, 0); RG_DEF_METHOD(set_use_color, 1); RG_DEF_METHOD_P(collate, 0); RG_DEF_METHOD(set_collate, 1); RG_DEF_METHOD_P(reverse, 0); RG_DEF_METHOD(set_reverse, 1); RG_DEF_METHOD(duplex, 0); RG_DEF_METHOD(set_duplex, 1); RG_DEF_METHOD(quality, 0); RG_DEF_METHOD(set_quality, 1); RG_DEF_METHOD(n_copies, 0); RG_DEF_METHOD(set_n_copies, 1); RG_DEF_METHOD(number_up, 0); RG_DEF_METHOD(set_number_up, 1); RG_DEF_METHOD(resolution, 0); RG_DEF_METHOD(set_resolution, 1); RG_DEF_METHOD(scale, 0); RG_DEF_METHOD(set_scale, 1); RG_DEF_METHOD(print_pages, 0); RG_DEF_METHOD(set_print_pages, 1); RG_DEF_METHOD(page_ranges, 0); RG_DEF_METHOD(set_page_ranges, 1); RG_DEF_METHOD(page_set, 0); RG_DEF_METHOD(set_page_set, 1); RG_DEF_METHOD(default_source, 0); RG_DEF_METHOD(set_default_source, 1); RG_DEF_METHOD(media_type, 0); RG_DEF_METHOD(set_media_type, 1); RG_DEF_METHOD(dither, 0); RG_DEF_METHOD(set_dither, 1); RG_DEF_METHOD(finishings, 0); RG_DEF_METHOD(set_finishings, 1); RG_DEF_METHOD(output_bin, 0); RG_DEF_METHOD(set_output_bin, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkPageOrientation */ G_DEF_CLASS(GTK_TYPE_PAGE_ORIENTATION, "PageOrientation", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PAGE_ORIENTATION, "GTK_PAGE_"); /* GtkPrintDuplex */ G_DEF_CLASS(GTK_TYPE_PRINT_DUPLEX, "PrintDuplex", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_DUPLEX, "GTK_PRINT_"); /* GtkPrintQuality */ G_DEF_CLASS(GTK_TYPE_PRINT_QUALITY, "PrintQuality", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_QUALITY, "GTK_PRINT_"); /* GtkPrintPages */ G_DEF_CLASS(GTK_TYPE_PRINT_PAGES, "PrintPages", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PRINT_PAGES, "GTK_PRINT_"); /* GtkPageSet */ G_DEF_CLASS(GTK_TYPE_PAGE_SET, "PageSet", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PAGE_SET, "GTK_"); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(to_file, 1); RG_DEF_METHOD(to_key_file, -1); #endif } ����������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcurve.c����������������������������������������������������0000644�0001750�0001750�00000006077�11701304107�017456� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcheckmenuitem.c��������������������������������������������0000644�0001750�0001750�00000003756�11701304107�021154� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkdrag.c�����������������������������������������������������0000644�0001750�0001750�00000031675�12257552167�017273� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } 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; } 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))); } 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; } 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; } 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; } 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; } static VALUE rg_m_source_unset(VALUE self, VALUE widget) { gtk_drag_source_unset(RVAL2WIDGET(widget)); return self; } 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); } 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; } 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); RG_DEF_MODFUNC(dest_add_text_targets, 1); RG_DEF_MODFUNC(dest_add_image_targets, 1); RG_DEF_MODFUNC(dest_add_uri_targets, 1); RG_DEF_MODFUNC(dest_set_track_motion, 2); RG_DEF_MODFUNC(dest_get_track_motion, 1); 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); RG_DEF_MODFUNC(set_icon_name, 4); RG_DEF_MODFUNC(set_icon_default, 1); RG_DEF_MODFUNC(source_set, 4); RG_DEF_MODFUNC(source_set_icon, -1); RG_DEF_MODFUNC(source_set_icon_name, 2); RG_DEF_MODFUNC(source_unset, 1); RG_DEF_MODFUNC(source_set_target_list, 2); RG_DEF_MODFUNC(source_get_target_list, 1); RG_DEF_MODFUNC(source_add_text_targets, 1); RG_DEF_MODFUNC(source_add_image_targets, 1); RG_DEF_MODFUNC(source_add_uri_targets, 1); 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_"); } �������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkeditable.c�������������������������������������������������0000644�0001750�0001750�00000010156�11701304107�020074� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhscale.c���������������������������������������������������0000644�0001750�0001750�00000003475�11701304107�017570� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHScale static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; GtkAdjustment *adj = NULL; GtkWidget *widget; rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3); if (NIL_P(arg1) || RVAL2GTYPE(arg1) == GTK_TYPE_ADJUSTMENT){ if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1)); widget = gtk_hscale_new(adj); } else { widget = gtk_hscale_new_with_range(NUM2DBL(arg1), NUM2DBL(arg2), NUM2DBL(arg3)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_hscale(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HSCALE, "HScale", mGtk); RG_DEF_METHOD(initialize, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvscrollbar.c�����������������������������������������������0000644�0001750�0001750�00000003052�11701304107�020471� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVScrollbar static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1; GtkAdjustment *adj = NULL; rb_scan_args(argc, argv, "01", &arg1); if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1)); RBGTK_INITIALIZE(self, gtk_vscrollbar_new(adj)); return Qnil; } void Init_gtk_vscrollbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VSCROLLBAR, "VScrollbar", mGtk); RG_DEF_METHOD(initialize, -1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrange.c����������������������������������������������������0000644�0001750�0001750�00000004174�12257552167�017444� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cRange #define _SELF(self) (GTK_RANGE(RVAL2GOBJ(self))) static VALUE rg_value(VALUE self) { return rb_float_new(gtk_range_get_value(_SELF(self))); } static VALUE rg_set_increments(VALUE self, VALUE step, VALUE page) { gtk_range_set_increments(_SELF(self), NUM2DBL(step), NUM2DBL(page)); return self; } static VALUE rg_set_range(VALUE self, VALUE min, VALUE max) { gtk_range_set_range(_SELF(self), NUM2DBL(min), NUM2DBL(max)); return self; } static VALUE rg_set_value(VALUE self, VALUE value) { gtk_range_set_value(_SELF(self), NUM2DBL(value)); return self; } void Init_gtk_range(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RANGE, "Range", mGtk); RG_DEF_METHOD(value, 0); RG_DEF_METHOD(set_increments, 2); RG_DEF_METHOD(set_range, 2); RG_DEF_METHOD(set_value, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "value"); /* GtkSensitivityType */ G_DEF_CLASS(GTK_TYPE_SENSITIVITY_TYPE, "SensitivityType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SENSITIVITY_TYPE, "GTK_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdk.h���������������������������������������������������������0000644�0001750�0001750�00000005121�11701304107�016363� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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__ */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvpaned.c���������������������������������������������������0000644�0001750�0001750�00000002543�11701304107�017601� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVPaned static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_vpaned_new()); return Qnil; } void Init_gtk_vpaned(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VPANED, "VPaned", mGtk); RG_DEF_METHOD(initialize, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkallocation.c�����������������������������������������������0000644�0001750�0001750�00000007541�12124610262�020456� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcelleditable.c���������������������������������������������0000644�0001750�0001750�00000003253�11701304107�020734� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkstatusbar.c������������������������������������������������0000644�0001750�0001750�00000004232�11701304107�020331� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cStatusbar #define _SELF(self) (GTK_STATUSBAR(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_statusbar_new()); return Qnil; } static VALUE rg_get_context_id(VALUE self, VALUE text) { return INT2FIX(gtk_statusbar_get_context_id(_SELF(self), RVAL2CSTR(text))); } static VALUE rg_push(VALUE self, VALUE id, VALUE text) { return INT2FIX(gtk_statusbar_push(_SELF(self), NUM2INT(id), RVAL2CSTR(text))); } static VALUE rg_pop(VALUE self, VALUE id) { gtk_statusbar_pop(_SELF(self), NUM2INT(id)); return self; } static VALUE rg_remove(VALUE self, VALUE cid, VALUE mid) { gtk_statusbar_remove(_SELF(self), NUM2INT(cid), NUM2INT(mid)); return self; } void Init_gtk_statusbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STATUSBAR, "Statusbar", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(get_context_id, 1); RG_DEF_METHOD(push, 2); RG_DEF_METHOD(pop, 1); RG_DEF_METHOD(remove, 2); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktexttagtable.c���������������������������������������������0000644�0001750�0001750�00000005103�11701304107�021007� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTextTagTable #define _SELF(self) (GTK_TEXT_TAG_TABLE(RVAL2GOBJ(self))) #define RVAL2TAG(t) (GTK_TEXT_TAG(RVAL2GOBJ(t))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_text_tag_table_new()); return Qnil; } static VALUE rg_add(VALUE self, VALUE tag) { G_CHILD_ADD(self, tag); gtk_text_tag_table_add(_SELF(self), RVAL2TAG(tag)); return self; } static VALUE rg_remove(VALUE self, VALUE tag) { G_CHILD_REMOVE(self, tag); gtk_text_tag_table_remove(_SELF(self), RVAL2TAG(tag)); return self; } static VALUE rg_lookup(VALUE self, VALUE name) { VALUE ret = Qnil; GtkTextTag* tag = gtk_text_tag_table_lookup(_SELF(self), RVAL2CSTR(name)); if (tag){ ret = GOBJ2RVAL(tag); G_CHILD_ADD(self, ret); } return ret; } static gboolean txt_tt_foreach_func(GtkTextTag *tag, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 1, GOBJ2RVAL(tag))); } static VALUE rg_each(VALUE self) { volatile VALUE func = rb_block_proc(); gtk_text_tag_table_foreach(_SELF(self), (GtkTextTagTableForeach)txt_tt_foreach_func, (gpointer)func); return self; } static VALUE rg_size(VALUE self) { return INT2NUM(gtk_text_tag_table_get_size(_SELF(self))); } void Init_gtk_text_tag_table(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_TAG_TABLE, "TextTagTable", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(add, 1); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(lookup, 1); RG_DEF_ALIAS("[]", "lookup"); RG_DEF_METHOD(each, 0); RG_DEF_METHOD(size, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktable.c����������������������������������������������������0000644�0001750�0001750�00000012471�11701304107�017414� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTable #define _SELF(self) (GTK_TABLE(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE row, col, homogeneous; rb_scan_args(argc, argv, "21", &row, &col, &homogeneous); RBGTK_INITIALIZE(self, gtk_table_new(NUM2INT(row), NUM2INT(col), RVAL2CBOOL(homogeneous))); return Qnil; } static VALUE rg_resize(VALUE self, VALUE rows, VALUE columns) { gtk_table_resize(_SELF(self), NUM2UINT(rows), NUM2UINT(columns)); return self; } static VALUE rg_attach(int argc, VALUE *argv, VALUE self) { VALUE child, left, right, top, bottom; VALUE arg0, arg1, arg2, arg3; gint xspc, yspc; GtkAttachOptions xopt, yopt; xopt = yopt = GTK_EXPAND | GTK_FILL; xspc = yspc = 0; rb_scan_args(argc, argv, "54", &child, &left, &right, &top, &bottom, &arg0, &arg1, &arg2, &arg3); if (!NIL_P(arg0)) xopt = RVAL2GFLAGS(arg0, GTK_TYPE_ATTACH_OPTIONS); if (!NIL_P(arg1)) yopt = RVAL2GFLAGS(arg1, GTK_TYPE_ATTACH_OPTIONS); if (!NIL_P(arg2)) xspc = NUM2INT(arg2); if (!NIL_P(arg3)) yspc = NUM2INT(arg3); gtk_table_attach(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), NUM2INT(left),NUM2INT(right), NUM2INT(top),NUM2INT(bottom), xopt, yopt, xspc, yspc); G_CHILD_ADD(self, child); return self; } static VALUE rg_attach_defaults(VALUE self, VALUE widget, VALUE left_attach, VALUE right_attach, VALUE top_attach, VALUE bottom_attach) { gtk_table_attach_defaults(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), NUM2UINT(left_attach), NUM2UINT(right_attach), NUM2UINT(top_attach), NUM2UINT(bottom_attach)); G_CHILD_ADD(self, widget); return self; } static VALUE tbl_set_row_spacing(VALUE self, VALUE row, VALUE spc) { gtk_table_set_row_spacing(_SELF(self), NUM2UINT(row), NUM2UINT(spc)); return self; } static VALUE rg_get_row_spacing(VALUE self, VALUE row) { return UINT2NUM(gtk_table_get_row_spacing(_SELF(self), NUM2UINT(row))); } static VALUE tbl_set_col_spacing(VALUE self, VALUE col, VALUE spc) { gtk_table_set_col_spacing(_SELF(self), NUM2UINT(col), NUM2UINT(spc)); return self; } static VALUE rg_get_column_spacing(VALUE self, VALUE col) { return UINT2NUM(gtk_table_get_col_spacing(_SELF(self), NUM2UINT(col))); } static VALUE rg_set_row_spacings(VALUE self, VALUE spc) { gtk_table_set_row_spacings(_SELF(self), NUM2UINT(spc)); return self; } static VALUE rg_set_column_spacings(VALUE self, VALUE spc) { gtk_table_set_col_spacings(_SELF(self), NUM2UINT(spc)); return self; } static VALUE rg_row_spacings(VALUE self) { return UINT2NUM(_SELF(self)->row_spacing); } static VALUE rg_column_spacings(VALUE self) { return UINT2NUM(_SELF(self)->column_spacing); } static VALUE rg_default_row_spacing(VALUE self) { return UINT2NUM(gtk_table_get_default_row_spacing(_SELF(self))); } static VALUE rg_default_column_spacing(VALUE self) { return UINT2NUM(gtk_table_get_default_col_spacing(_SELF(self))); } void Init_gtk_table(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TABLE, "Table", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(resize, 2); RG_DEF_METHOD(attach, -1); RG_DEF_METHOD(attach_defaults, 5); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "row_spacing", tbl_set_row_spacing, 2); rb_undef_method(RG_TARGET_NAMESPACE, "row_spacing="); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "column_spacing", tbl_set_col_spacing, 2); rb_undef_method(RG_TARGET_NAMESPACE, "column_spacing="); RG_DEF_METHOD(get_row_spacing, 1); rb_undef_method(RG_TARGET_NAMESPACE, "row_spacing"); RG_DEF_METHOD(get_column_spacing, 1); rb_undef_method(RG_TARGET_NAMESPACE, "column_spacing"); RG_DEF_METHOD(set_row_spacings, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "row_spacings"); RG_DEF_METHOD(set_column_spacings, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "column_spacings"); RG_DEF_METHOD(row_spacings, 0); RG_DEF_METHOD(column_spacings, 0); RG_DEF_METHOD(default_row_spacing, 0); RG_DEF_METHOD(default_column_spacing, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentchooserwidget.c��������������������������������������0000644�0001750�0001750�00000003143�12257552167�022412� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentChooserWidget #define _SELF(self) (GTK_RECENT_CHOOSER_WIDGET(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE manager; GtkWidget* widget; rb_scan_args(argc, argv, "01", &manager); if (NIL_P(manager)){ widget = gtk_recent_chooser_widget_new_for_manager(GTK_RECENT_MANAGER(RVAL2GOBJ(manager))); } else { widget = gtk_recent_chooser_widget_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_recent_chooser_widget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER_WIDGET, "RecentChooserWidget", mGtk); RG_DEF_METHOD(initialize, -1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkimagemenuitem.c��������������������������������������������0000644�0001750�0001750�00000004477�11701304107�021162� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cImageMenuItem static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label, use_underline_or_accel_group; GtkWidget *widget = NULL; if (rb_scan_args(argc, argv, "02", &label, &use_underline_or_accel_group) > 0) { if (TYPE(label) == T_STRING){ if (NIL_P(use_underline_or_accel_group) || RVAL2CBOOL(use_underline_or_accel_group)){ widget = gtk_image_menu_item_new_with_mnemonic(RVAL2CSTR(label)); } else { widget = gtk_image_menu_item_new_with_label(RVAL2CSTR(label)); } } else if (TYPE(label) == T_SYMBOL){ widget = gtk_image_menu_item_new_from_stock(rb_id2name(SYM2ID(label)), NIL_P(use_underline_or_accel_group) ? NULL : GTK_ACCEL_GROUP(RVAL2GOBJ(use_underline_or_accel_group))); } else { rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)", rb_class2name(CLASS_OF(label))); } } else { widget = gtk_image_menu_item_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_image_menu_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IMAGE_MENU_ITEM, "ImageMenuItem", mGtk); RG_DEF_METHOD(initialize, -1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkdisplaymanager.c�������������������������������������������0000644�0001750�0001750�00000003135�12257552167�021324� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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))); } */ void Init_gtk_gdk_display_manager(VALUE mGdk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY_MANAGER, "DisplayManager", mGdk); RG_DEF_SMETHOD(get, 0); RG_DEF_METHOD(displays, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkatom.c�����������������������������������������������������0000644�0001750�0001750�00000006415�12124610262�017250� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkselection.c������������������������������������������������0000644�0001750�0001750�00000014070�12257552167�020311� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 { 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)); } 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 { 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))); } } 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 { 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)); } 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)); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkdisplay.c��������������������������������������������������0000644�0001750�0001750�00000032545�12257552167�020000� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2013 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" #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; } static VALUE rg_flush(VALUE self) { gdk_display_flush(_SELF(self)); return self; } 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); } 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); } 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); */ 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))); } 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; } static VALUE rg_core_pointer(VALUE self) { return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self))); } 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; } #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; } 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; } 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 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))); } #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) { 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); RG_DEF_METHOD(flush, 0); 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); 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); RG_DEF_METHOD(pointer, 0); RG_DEF_METHOD(window_at_pointer, 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); 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); RG_DEF_METHOD(core_pointer, 0); RG_DEF_METHOD(warp_pointer, 3); G_DEF_SETTERS(RG_TARGET_NAMESPACE); #ifdef GDK_WINDOWING_X11 RG_DEF_METHOD(grab, 0); RG_DEF_METHOD(ungrab, 0); RG_DEF_METHOD(register_standard_event_type, 2); RG_DEF_METHOD(user_time, 0); RG_DEF_METHOD(set_cursor_theme, 2); # 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 RG_DEF_METHOD_P(supports_shapes, 0); RG_DEF_METHOD_P(supports_input_shapes, 0); #if GTK_CHECK_VERSION(2, 12, 0) RG_DEF_METHOD_P(supports_composite, 0); RG_DEF_METHOD(trigger_tooltip_query, 0); #endif } �����������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkgamma.c����������������������������������������������������0000644�0001750�0001750�00000003203�11701304107�017400� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cGammaCurve static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_gamma_curve_new()); return Qnil; } static VALUE rg_gamma(VALUE self) { return rb_float_new(GTK_GAMMA_CURVE(RVAL2GOBJ(self))->gamma); } static VALUE rg_curve(VALUE self) { return GOBJ2RVAL(GTK_GAMMA_CURVE(RVAL2GOBJ(self))->curve); } void Init_gtk_gamma_curve(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_GAMMA_CURVE, "GammaCurve", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(gamma, 0); RG_DEF_METHOD(curve, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcontainer.c������������������������������������������������0000644�0001750�0001750�00000054127�11701304107�020313� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktoolbutton.c�����������������������������������������������0000644�0001750�0001750�00000003354�12257552167�020560� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cToolButton #define _SELF(self) (GTK_TOOL_BUTTON(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE obj, label; GtkToolItem* item; rb_scan_args(argc, argv, "02", &obj, &label); if (TYPE(obj) == T_SYMBOL){ item = gtk_tool_button_new_from_stock(rb_id2name(SYM2ID(obj))); } else if (TYPE(obj) == T_STRING){ item = gtk_tool_button_new_from_stock(RVAL2CSTR(obj)); } else { item = gtk_tool_button_new(GTK_WIDGET(RVAL2GOBJ(obj)), NIL_P(label) ? NULL : RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, item); return Qnil; } void Init_gtk_toolbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOL_BUTTON, "ToolButton", mGtk); RG_DEF_METHOD(initialize, -1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextiter.c�������������������������������������������������0000644�0001750�0001750�00000042414�12257552167�020217� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002,2003 Masahiro Sakai * * 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 cTextIter #define _SELF(s) ((GtkTextIter*)RVAL2BOXED(s, GTK_TYPE_TEXT_ITER)) #define RVAL2TAG(t) (GTK_TEXT_TAG(RVAL2GOBJ(t))) #define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER)) static gboolean is_compat_240; static ID id_pixbuf; static VALUE rg_buffer(VALUE self) { return GOBJ2RVAL(gtk_text_iter_get_buffer(_SELF(self))); } #define def_gint_getter(__name__) \ static VALUE \ get_##__name__(VALUE self) \ { \ return INT2NUM(gtk_text_iter_get_##__name__(_SELF(self))); \ } def_gint_getter(offset) def_gint_getter(line) def_gint_getter(line_offset) def_gint_getter(line_index) def_gint_getter(visible_line_offset) def_gint_getter(visible_line_index) static VALUE rg_char(VALUE self) { gchar buf[10]; gint len = g_unichar_to_utf8(gtk_text_iter_get_char(_SELF(self)), buf); buf[len] = '\0'; return CSTR2RVAL(buf); } static VALUE rg_get_slice(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_slice(_SELF(self), _SELF(rhs))); } static VALUE rg_get_text(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_text(_SELF(self), _SELF(rhs))); } static VALUE rg_get_visible_slice(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_visible_slice(_SELF(self), _SELF(rhs))); } static VALUE rg_get_visible_text(VALUE self, VALUE rhs) { return CSTR2RVAL(gtk_text_iter_get_visible_text(_SELF(self), _SELF(rhs))); } static VALUE rg_pixbuf(VALUE self) { GdkPixbuf* pixbuf = gtk_text_iter_get_pixbuf(_SELF(self)); VALUE ret = Qnil; if (pixbuf){ ret = GOBJ2RVAL(pixbuf); G_CHILD_SET(self, id_pixbuf, ret); } return ret; } static VALUE rg_marks(VALUE self) { return GSLIST2ARYF(gtk_text_iter_get_marks(_SELF(self))); } static VALUE rg_toggled_tags(VALUE self, VALUE toggled_on) { return GSLIST2ARYF(gtk_text_iter_get_toggled_tags(_SELF(self), RVAL2CBOOL(toggled_on))); } static VALUE rg_child_anchor(VALUE self) { GtkTextChildAnchor* anchor = gtk_text_iter_get_child_anchor(_SELF(self)); return anchor ? GOBJ2RVAL(anchor) : Qnil; } static VALUE rg_begins_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_begins_tag(_SELF(self), RVAL2TAG(tag))); } static VALUE rg_ends_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_ends_tag(_SELF(self), RVAL2TAG(tag))); } static VALUE rg_toggles_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_toggles_tag(_SELF(self), RVAL2TAG(tag))); } static VALUE rg_has_tag_p(VALUE self, VALUE tag) { return CBOOL2RVAL(gtk_text_iter_has_tag(_SELF(self), RVAL2TAG(tag))); } static VALUE rg_tags(VALUE self) { return GSLIST2ARYF(gtk_text_iter_get_tags(_SELF(self))); } static VALUE rg_editable_p(VALUE self, VALUE default_setting) { return CBOOL2RVAL(gtk_text_iter_editable(_SELF(self), RVAL2CBOOL(default_setting))); } static VALUE rg_can_insert_p(VALUE self, VALUE default_setting) { return CBOOL2RVAL(gtk_text_iter_can_insert(_SELF(self), RVAL2CBOOL(default_setting))); } #define def_predicate(__name__) \ static VALUE \ __name__(VALUE self) \ { \ return CBOOL2RVAL(gtk_text_iter_##__name__(_SELF(self))); \ } def_predicate(starts_word) def_predicate(ends_word) def_predicate(inside_word) def_predicate(starts_sentence) def_predicate(ends_sentence) def_predicate(starts_line) def_predicate(ends_line) def_predicate(is_cursor_position) def_gint_getter(chars_in_line) def_gint_getter(bytes_in_line) static VALUE rg_attributes(VALUE self) { GtkTextAttributes attr; if(gtk_text_iter_get_attributes(_SELF(self), &attr) == TRUE){ return BOXED2RVAL(&attr, GTK_TYPE_TEXT_ATTRIBUTES); } else { return Qnil; } } static VALUE rg_language(VALUE self) { return CSTR2RVAL(pango_language_to_string(gtk_text_iter_get_language(_SELF(self)))); } def_predicate(is_end) def_predicate(is_start) #define def_move(__name__) \ static VALUE \ __name__(VALUE self) \ { \ return CBOOL2RVAL(gtk_text_iter_##__name__(_SELF(self))); \ } #define def_move_gint(__name__) \ static VALUE \ __name__(VALUE self, VALUE i) \ { \ return CBOOL2RVAL(gtk_text_iter_##__name__(_SELF(self), NUM2INT(i))); \ } def_move(forward_char) def_move(backward_char) def_move_gint(forward_chars) def_move_gint(backward_chars) def_move(forward_line) def_move(backward_line) def_move_gint(forward_lines) def_move_gint(backward_lines) def_move(forward_word_end) def_move(backward_word_start) def_move_gint(forward_word_ends) def_move_gint(backward_word_starts) def_move(forward_sentence_end) def_move(backward_sentence_start) def_move_gint(forward_sentence_ends) def_move_gint(backward_sentence_starts) def_move_gint(forward_visible_word_ends) def_move_gint(backward_visible_word_starts) def_move(forward_visible_word_end) def_move(backward_visible_word_start) def_move(forward_visible_cursor_position) def_move(backward_visible_cursor_position) def_move_gint(forward_visible_cursor_positions) def_move_gint(backward_visible_cursor_positions) def_move(forward_visible_line) def_move(backward_visible_line) def_move_gint(forward_visible_lines) def_move_gint(backward_visible_lines) def_move(forward_cursor_position) def_move(backward_cursor_position) def_move_gint(forward_cursor_positions) def_move_gint(backward_cursor_positions) def_move(forward_to_line_end) static VALUE rg_forward_to_end(VALUE self) { gtk_text_iter_forward_to_end(_SELF(self)); return self; } #define def_gint_setter(__name__) \ static VALUE \ set_##__name__(VALUE self, VALUE val) \ { \ gtk_text_iter_set_##__name__(_SELF(self), NUM2INT(val)); \ return val; \ } def_gint_setter(offset) def_gint_setter(line) def_gint_setter(line_offset) def_gint_setter(line_index) def_gint_setter(visible_line_offset) def_gint_setter(visible_line_index) static VALUE rg_forward_to_tag_toggle(int argc, VALUE *argv, VALUE self) { VALUE tag; rb_scan_args(argc, argv, "01", &tag); return CBOOL2RVAL(gtk_text_iter_forward_to_tag_toggle(_SELF(self), NIL_P(tag) ? NULL : RVAL2TAG(tag))); } static VALUE rg_backward_to_tag_toggle(int argc, VALUE *argv, VALUE self) { VALUE tag; rb_scan_args(argc, argv, "01", &tag); return CBOOL2RVAL(gtk_text_iter_backward_to_tag_toggle(_SELF(self), NIL_P(tag) ? NULL : RVAL2TAG(tag))); } static gboolean char_predicate_func(guint32 ch, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 1, UINT2NUM(ch))); } static VALUE rg_forward_find_char(int argc, VALUE *argv, VALUE self) { VALUE limit; volatile VALUE func = rb_block_proc(); rb_scan_args(argc, argv, "01", &limit); return CBOOL2RVAL(gtk_text_iter_forward_find_char(_SELF(self), (GtkTextCharPredicate)char_predicate_func, (gpointer)func, NIL_P(limit) ? NULL : _SELF(limit))); } static VALUE rg_backward_find_char(int argc, VALUE *argv, VALUE self) { VALUE limit; volatile VALUE func = rb_block_proc(); rb_scan_args(argc, argv, "01", &limit); return CBOOL2RVAL(gtk_text_iter_backward_find_char(_SELF(self), (GtkTextCharPredicate)char_predicate_func, (gpointer)func, NIL_P(limit) ? NULL : _SELF(limit))); } static VALUE rg_forward_search(int argc, VALUE *argv, VALUE self) { GtkTextIter m_start, m_end; VALUE str, flags, limit; gboolean ret; rb_scan_args(argc, argv, "21", &str, &flags, &limit); if (is_compat_240){ ret = gtk_text_iter_forward_search(_SELF(self), RVAL2CSTR(str), RVAL2GFLAGS(flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start, &m_end, NIL_P(limit) ? NULL : _SELF(limit)); } else { ret = gtk_text_iter_forward_search(_SELF(self), RVAL2CSTR(str), RVAL2GENUM(flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start, &m_end, NIL_P(limit) ? NULL : _SELF(limit)); } return ret ? rb_ary_new3(2, ITR2RVAL(&m_start), ITR2RVAL(&m_end)) : Qnil; } static VALUE rg_backward_search(int argc, VALUE *argv, VALUE self) { GtkTextIter m_start, m_end; VALUE str, flags, limit; gboolean ret; rb_scan_args(argc, argv, "21", &str, &flags, &limit); if (is_compat_240){ ret = gtk_text_iter_backward_search(_SELF(self), RVAL2CSTR(str), RVAL2GFLAGS(flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start, &m_end, NIL_P(limit) ? NULL : _SELF(limit)); } else { ret = gtk_text_iter_backward_search(_SELF(self), RVAL2CSTR(str), RVAL2GENUM(flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start, &m_end, NIL_P(limit) ? NULL : _SELF(limit)); } return ret ? rb_ary_new3(2, ITR2RVAL(&m_start), ITR2RVAL(&m_end)) : Qnil; } static VALUE rg_operator_equal(VALUE self, VALUE other) { return CBOOL2RVAL(gtk_text_iter_equal(_SELF(self), _SELF(other))); } static VALUE rg_operator_compare(VALUE self, VALUE rhs) { return INT2NUM(gtk_text_iter_compare(_SELF(self), _SELF(rhs))); } /* The following methods don't have to be implimented. Including Comparable module is enough. gboolean gtk_text_iter_in_range (const GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end); void gtk_text_iter_order (GtkTextIter *first, GtkTextIter *second); */ void Init_gtk_textiter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_ITER, "TextIter", mGtk); rb_include_module(RG_TARGET_NAMESPACE, rb_mComparable); is_compat_240 = gtk_check_version(2, 4, 0) ? FALSE : TRUE; id_pixbuf = rb_intern("pixbuf"); RG_DEF_METHOD(buffer, 0); rb_define_method(RG_TARGET_NAMESPACE, "offset", get_offset, 0); rb_define_method(RG_TARGET_NAMESPACE, "line", get_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "line_offset", get_line_offset, 0); rb_define_method(RG_TARGET_NAMESPACE, "line_index", get_line_index, 0); rb_define_method(RG_TARGET_NAMESPACE, "visible_line_offset", get_visible_line_offset, 0); rb_define_method(RG_TARGET_NAMESPACE, "visible_line_index", get_visible_line_index, 0); RG_DEF_METHOD(char, 0); RG_DEF_METHOD(get_slice, 1); RG_DEF_METHOD(get_text, 1); RG_DEF_METHOD(get_visible_slice, 1); RG_DEF_METHOD(get_visible_text, 1); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(marks, 0); RG_DEF_METHOD(child_anchor, 0); RG_DEF_METHOD(toggled_tags, 1); RG_DEF_METHOD_P(begins_tag, 1); RG_DEF_METHOD_P(ends_tag, 1); RG_DEF_METHOD_P(toggles_tag, 1); RG_DEF_METHOD_P(has_tag, 1); RG_DEF_METHOD(tags, 0); RG_DEF_METHOD_P(editable, 1); RG_DEF_METHOD_P(can_insert, 1); rb_define_method(RG_TARGET_NAMESPACE, "starts_word?", starts_word, 0); rb_define_method(RG_TARGET_NAMESPACE, "ends_word?", ends_word, 0); rb_define_method(RG_TARGET_NAMESPACE, "inside_word?", inside_word, 0); rb_define_method(RG_TARGET_NAMESPACE, "starts_sentence?", starts_sentence, 0); rb_define_method(RG_TARGET_NAMESPACE, "ends_sentence?", ends_sentence, 0); rb_define_method(RG_TARGET_NAMESPACE, "starts_line?", starts_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "ends_line?", ends_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "cursor_position?", is_cursor_position, 0); rb_define_method(RG_TARGET_NAMESPACE, "chars_in_line", get_chars_in_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "bytes_in_line", get_bytes_in_line, 0); RG_DEF_METHOD(attributes, 0); RG_DEF_METHOD(language, 0); rb_define_method(RG_TARGET_NAMESPACE, "end?", is_end, 0); rb_define_method(RG_TARGET_NAMESPACE, "start?", is_start, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_char", forward_char, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_char", backward_char, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_chars", forward_chars, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_chars", backward_chars, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_line", forward_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_line", backward_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_lines", forward_lines, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_lines", backward_lines, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_word_end", forward_word_end, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_word_start", backward_word_start, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_word_ends", forward_word_ends, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_word_starts", backward_word_starts, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_sentence_end", forward_sentence_end, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_sentence_start", backward_sentence_start, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_sentence_ends", forward_sentence_ends, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_sentence_starts", backward_sentence_starts, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_visible_word_ends", forward_visible_word_ends, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_visible_word_starts", backward_visible_word_starts, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_visible_word_end", forward_visible_word_end, 0); rb_define_method(RG_TARGET_NAMESPACE, "backword_visible_word_start", backward_visible_word_start, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_visible_cursor_position", forward_visible_cursor_position, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_visible_cursor_position", backward_visible_cursor_position, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_visible_cursor_positions", forward_visible_cursor_positions, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_visible_cursor_positions", backward_visible_cursor_positions, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_visible_line", forward_visible_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_visible_line", backward_visible_line, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_visible_lines", forward_visible_lines, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_visible_lines", backward_visible_lines, 1); rb_define_method(RG_TARGET_NAMESPACE, "forward_cursor_position", forward_cursor_position, 0); rb_define_method(RG_TARGET_NAMESPACE, "backward_cursor_position", backward_cursor_position, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_cursor_positions", forward_cursor_positions, 1); rb_define_method(RG_TARGET_NAMESPACE, "backward_cursor_positions", backward_cursor_positions, 1); RG_DEF_METHOD(forward_to_end, 0); rb_define_method(RG_TARGET_NAMESPACE, "forward_to_line_end", forward_to_line_end, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_offset", set_offset, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_line", set_line, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_line_offset", set_line_offset, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_line_index", set_line_index, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_visible_line_offset", set_visible_line_offset, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_visible_line_index", set_visible_line_index, 1); RG_DEF_METHOD(forward_to_tag_toggle, -1); RG_DEF_METHOD(backward_to_tag_toggle, -1); RG_DEF_METHOD(forward_find_char, -1); RG_DEF_METHOD(backward_find_char, -1); RG_DEF_METHOD(forward_search, -1); RG_DEF_METHOD(backward_search, -1); RG_DEF_METHOD_OPERATOR("==", equal, 1); RG_DEF_METHOD_OPERATOR("<=>", compare, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkTextSearchFlags */ G_DEF_CLASS(GTK_TYPE_TEXT_SEARCH_FLAGS, "SearchFlags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TEXT_SEARCH_FLAGS, "GTK_TEXT_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkevent.c����������������������������������������������������0000644�0001750�0001750�00000122734�12307003726�017440� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2013 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" static VALUE rb_cGdkEvent; static VALUE rb_cGdkEventAny; static VALUE rb_cGdkEventExpose; static VALUE rb_cGdkEventNoExpose; static VALUE rb_cGdkEventVisibility; static VALUE rb_cGdkEventMotion; static VALUE rb_cGdkEventButton; static VALUE rb_cGdkEventScroll; static VALUE rb_cGdkEventKey; static VALUE rb_cGdkEventCrossing; static VALUE rb_cGdkEventFocus; static VALUE rb_cGdkEventConfigure; static VALUE rb_cGdkEventProperty; static VALUE rb_cGdkEventSelection; static VALUE rb_cGdkEventOwnerChange; static VALUE rb_cGdkEventProximity; static VALUE rb_cGdkEventClient; static VALUE rb_cGdkEventDND; static VALUE rb_cGdkEventWindowState; static VALUE rb_cGdkEventSetting; static VALUE rb_cGdkEventGrabBroken; #define DEFINE_EVENT_TYPE(type_lower_case, type_upper_case) \ static GType \ rb_gdk_event_ ## type_lower_case ## _get_type(void) \ { \ static GType type = 0; \ if (type == 0) { \ type = g_boxed_type_register_static("GdkEvent" # type_upper_case, \ (GBoxedCopyFunc)gdk_event_copy, \ (GBoxedFreeFunc)gdk_event_free); \ } \ return type; \ } DEFINE_EVENT_TYPE(any, Any) DEFINE_EVENT_TYPE(expose, Expose) DEFINE_EVENT_TYPE(no_expose, NoExpose) DEFINE_EVENT_TYPE(visibility, Visibility) DEFINE_EVENT_TYPE(motion, Motion) DEFINE_EVENT_TYPE(button, Button) DEFINE_EVENT_TYPE(scroll, Scroll) DEFINE_EVENT_TYPE(key, Key) DEFINE_EVENT_TYPE(crossing, Crossing) DEFINE_EVENT_TYPE(focus, Focus) DEFINE_EVENT_TYPE(configure, Configure) DEFINE_EVENT_TYPE(property, Property) DEFINE_EVENT_TYPE(selection, Selection) DEFINE_EVENT_TYPE(owner_change, OwnerChange) DEFINE_EVENT_TYPE(proximity, Proximity) DEFINE_EVENT_TYPE(client, Client) DEFINE_EVENT_TYPE(dnd, DND) DEFINE_EVENT_TYPE(window_state, WindowState) DEFINE_EVENT_TYPE(setting, Setting) DEFINE_EVENT_TYPE(grab_broken, GrabBroken) #define GDK_TYPE_EVENT_ANY (rb_gdk_event_any_get_type()) #define GDK_TYPE_EVENT_EXPOSE (rb_gdk_event_expose_get_type()) #define GDK_TYPE_EVENT_NO_EXPOSE (rb_gdk_event_no_expose_get_type()) #define GDK_TYPE_EVENT_VISIBILITY (rb_gdk_event_visibility_get_type()) #define GDK_TYPE_EVENT_MOTION (rb_gdk_event_motion_get_type()) #define GDK_TYPE_EVENT_BUTTON (rb_gdk_event_button_get_type()) #define GDK_TYPE_EVENT_SCROLL (rb_gdk_event_scroll_get_type()) #define GDK_TYPE_EVENT_KEY (rb_gdk_event_key_get_type()) #define GDK_TYPE_EVENT_CROSSING (rb_gdk_event_crossing_get_type()) #define GDK_TYPE_EVENT_FOCUS (rb_gdk_event_focus_get_type()) #define GDK_TYPE_EVENT_CONFIGURE (rb_gdk_event_configure_get_type()) #define GDK_TYPE_EVENT_PROPERTY (rb_gdk_event_property_get_type()) #define GDK_TYPE_EVENT_SELECTION (rb_gdk_event_selection_get_type()) #define GDK_TYPE_EVENT_OWNER_CHANGE (rb_gdk_event_owner_change_get_type()) #define GDK_TYPE_EVENT_PROXIMITY (rb_gdk_event_proximity_get_type()) #define GDK_TYPE_EVENT_CLIENT (rb_gdk_event_client_get_type()) #define GDK_TYPE_EVENT_DND (rb_gdk_event_dnd_get_type()) #define GDK_TYPE_EVENT_WINDOW_STATE (rb_gdk_event_window_state_get_type()) #define GDK_TYPE_EVENT_SETTING (rb_gdk_event_setting_get_type()) #define GDK_TYPE_EVENT_GRAB_BROKEN (rb_gdk_event_grab_broken_get_type()) /***********************************************/ static GType rb_gdk_event_type_to_gtype(GdkEventType event_type) { GType gtype = GDK_TYPE_EVENT_ANY; switch (event_type) { case GDK_NOTHING: case GDK_DELETE: case GDK_DESTROY: break; case GDK_EXPOSE: gtype = GDK_TYPE_EVENT_EXPOSE; break; case GDK_MOTION_NOTIFY: gtype = GDK_TYPE_EVENT_MOTION; break; case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: case GDK_BUTTON_RELEASE: gtype = GDK_TYPE_EVENT_BUTTON; break; case GDK_KEY_PRESS: case GDK_KEY_RELEASE: gtype = GDK_TYPE_EVENT_KEY; break; case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: gtype = GDK_TYPE_EVENT_CROSSING; break; case GDK_FOCUS_CHANGE: gtype = GDK_TYPE_EVENT_FOCUS; break; case GDK_CONFIGURE: gtype = GDK_TYPE_EVENT_CONFIGURE; break; case GDK_MAP: case GDK_UNMAP: break; case GDK_PROPERTY_NOTIFY: gtype = GDK_TYPE_EVENT_PROPERTY; break; case GDK_SELECTION_CLEAR: case GDK_SELECTION_REQUEST: case GDK_SELECTION_NOTIFY: gtype = GDK_TYPE_EVENT_SELECTION; break; case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: gtype = GDK_TYPE_EVENT_PROXIMITY; break; case GDK_DRAG_ENTER: case GDK_DRAG_LEAVE: case GDK_DRAG_MOTION: case GDK_DRAG_STATUS: case GDK_DROP_START: case GDK_DROP_FINISHED: gtype = GDK_TYPE_EVENT_DND; break; case GDK_CLIENT_EVENT: gtype = GDK_TYPE_EVENT_CLIENT; break; case GDK_VISIBILITY_NOTIFY: gtype = GDK_TYPE_EVENT_VISIBILITY; break; case GDK_NO_EXPOSE: gtype = GDK_TYPE_EVENT_NO_EXPOSE; break; case GDK_SCROLL: gtype = GDK_TYPE_EVENT_SCROLL; break; case GDK_WINDOW_STATE: gtype = GDK_TYPE_EVENT_WINDOW_STATE; break; case GDK_SETTING: gtype = GDK_TYPE_EVENT_SETTING; break; case GDK_OWNER_CHANGE: gtype = GDK_TYPE_EVENT_OWNER_CHANGE; break; case GDK_GRAB_BROKEN: gtype = GDK_TYPE_EVENT_GRAB_BROKEN; break; #if GTK_CHECK_VERSION(2, 14, 0) case GDK_DAMAGE: gtype = GDK_TYPE_EVENT_EXPOSE; break; #endif #if GTK_CHECK_VERSION(2, 18, 0) case GDK_EVENT_LAST: break; #endif default: break; } return gtype; } static VALUE rb_gdk_event_type_to_class(GdkEventType event_type) { VALUE klass = Qnil; switch (event_type) { case GDK_NOTHING: case GDK_DELETE: case GDK_DESTROY: break; case GDK_EXPOSE: klass = rb_cGdkEventExpose; break; case GDK_MOTION_NOTIFY: klass = rb_cGdkEventMotion; break; case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: case GDK_BUTTON_RELEASE: klass = rb_cGdkEventButton; break; case GDK_KEY_PRESS: case GDK_KEY_RELEASE: klass = rb_cGdkEventKey; break; case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: klass = rb_cGdkEventCrossing; break; case GDK_FOCUS_CHANGE: klass = rb_cGdkEventFocus; break; case GDK_CONFIGURE: klass = rb_cGdkEventConfigure; break; case GDK_MAP: case GDK_UNMAP: break; case GDK_PROPERTY_NOTIFY: klass = rb_cGdkEventProperty; break; case GDK_SELECTION_CLEAR: case GDK_SELECTION_REQUEST: case GDK_SELECTION_NOTIFY: klass = rb_cGdkEventSelection; break; case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: klass = rb_cGdkEventProximity; break; case GDK_DRAG_ENTER: case GDK_DRAG_LEAVE: case GDK_DRAG_MOTION: case GDK_DRAG_STATUS: case GDK_DROP_START: case GDK_DROP_FINISHED: klass = rb_cGdkEventDND; break; case GDK_CLIENT_EVENT: klass = rb_cGdkEventClient; break; case GDK_VISIBILITY_NOTIFY: klass = rb_cGdkEventVisibility; break; case GDK_NO_EXPOSE: klass = rb_cGdkEventNoExpose; break; case GDK_SCROLL: klass = rb_cGdkEventScroll; break; case GDK_WINDOW_STATE: klass = rb_cGdkEventWindowState; break; case GDK_SETTING: klass = rb_cGdkEventSetting; break; case GDK_OWNER_CHANGE: klass = rb_cGdkEventOwnerChange; break; case GDK_GRAB_BROKEN: klass = rb_cGdkEventGrabBroken; break; #if GTK_CHECK_VERSION(2, 14, 0) case GDK_DAMAGE: klass = rb_cGdkEventExpose; break; #endif #if GTK_CHECK_VERSION(2, 18, 0) case GDK_EVENT_LAST: break; #endif default: break; } if (NIL_P(klass)) { klass = rb_cGdkEventAny; } return klass; } static GType rb_gdk_event_to_gtype(VALUE event) { VALUE klass; GType type = GDK_TYPE_EVENT; klass = rb_obj_class(event); if (klass == rb_cGdkEvent) { type = GDK_TYPE_EVENT; } else if (klass == rb_cGdkEventAny) { type = GDK_TYPE_EVENT_ANY; } else if (klass == rb_cGdkEventExpose) { type = GDK_TYPE_EVENT_EXPOSE; } else if (klass == rb_cGdkEventNoExpose) { type = GDK_TYPE_EVENT_NO_EXPOSE; } else if (klass == rb_cGdkEventVisibility) { type = GDK_TYPE_EVENT_VISIBILITY; } else if (klass == rb_cGdkEventMotion) { type = GDK_TYPE_EVENT_MOTION; } else if (klass == rb_cGdkEventButton) { type = GDK_TYPE_EVENT_BUTTON; } else if (klass == rb_cGdkEventScroll) { type = GDK_TYPE_EVENT_SCROLL; } else if (klass == rb_cGdkEventKey) { type = GDK_TYPE_EVENT_KEY; } else if (klass == rb_cGdkEventCrossing) { type = GDK_TYPE_EVENT_CROSSING; } else if (klass == rb_cGdkEventFocus) { type = GDK_TYPE_EVENT_FOCUS; } else if (klass == rb_cGdkEventConfigure) { type = GDK_TYPE_EVENT_CONFIGURE; } else if (klass == rb_cGdkEventProperty) { type = GDK_TYPE_EVENT_PROPERTY; } else if (klass == rb_cGdkEventSelection) { type = GDK_TYPE_EVENT_SELECTION; } else if (klass == rb_cGdkEventOwnerChange) { type = GDK_TYPE_EVENT_OWNER_CHANGE; } else if (klass == rb_cGdkEventProximity) { type = GDK_TYPE_EVENT_PROXIMITY; } else if (klass == rb_cGdkEventClient) { type = GDK_TYPE_EVENT_CLIENT; } else if (klass == rb_cGdkEventDND) { type = GDK_TYPE_EVENT_DND; } else if (klass == rb_cGdkEventWindowState) { type = GDK_TYPE_EVENT_WINDOW_STATE; } else if (klass == rb_cGdkEventSetting) { type = GDK_TYPE_EVENT_SETTING; } else if (klass == rb_cGdkEventGrabBroken) { type = GDK_TYPE_EVENT_GRAB_BROKEN; } else { rb_raise(rb_eArgError, "Not event object: %s", RBG_INSPECT(event)); } return type; } VALUE make_gdkevent(GdkEvent *event) { if (!event) return Qnil; return BOXED2RVAL(event, rb_gdk_event_type_to_gtype(event->any.type)); } GdkEvent* get_gdkevent(VALUE event) { return RVAL2BOXED(event, rb_gdk_event_to_gtype(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 */ #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;\ } #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 */ static VALUE gdkevent_initialize(VALUE self, VALUE type) { GdkEventType event_type; VALUE klass; event_type = RVAL2GENUM(type, GDK_TYPE_EVENT_TYPE); klass = rb_gdk_event_type_to_class(event_type); if (!RVAL2CBOOL(rb_obj_is_kind_of(self, klass))) { rb_raise(rb_eArgError, "Wrong event type for this class: %s: %s", RBG_INSPECT(type), RBG_INSPECT(klass)); } G_INITIALIZE(self, gdk_event_new(event_type)); return Qnil; } 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; } 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))); } /* 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 { return CBOOL2RVAL(gdk_event_send_client_message_for_display( GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)), get_gdkevent(self), RVAL2GDKNATIVEWINDOW(xid))); } } 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 */ 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); /* GdkEventGrabBroken */ ATTR_BOOL(grab_broken, keyboard); ATTR_BOOL(grab_broken, implicit); ATTR_GOBJ(grab_broken, grab_window); GDKEVENT_INIT(grab_broken, GDK_GRAB_BROKEN); /* MISC */ static VALUE gdkevent_g2r(const GValue *values) { return make_gdkevent(g_value_get_boxed(&values[0])); } void Init_gtk_gdk_event(VALUE mGdk) { /* GdkEvent */ rb_cGdkEvent = G_DEF_CLASS(GDK_TYPE_EVENT, "Event", mGdk); rb_define_method(rb_cGdkEvent, "initialize", gdkevent_initialize, 1); rb_define_method(rb_cGdkEvent, "event_type", gdkevent_type, 0); rb_define_singleton_method(rb_cGdkEvent, "events_pending?", gdkevent_s_events_pending, 0); rb_define_singleton_method(rb_cGdkEvent, "peek", gdkevent_s_peek, 0); rb_define_singleton_method(rb_cGdkEvent, "get", gdkevent_s_get, 0); rb_define_method(rb_cGdkEvent, "put", gdkevent_put, 0); rb_define_method(rb_cGdkEvent, "get_axis", gdkevent_get_axis, 1); rb_define_method(rb_cGdkEvent, "coords", gdkevent_get_coords, 0); rb_define_method(rb_cGdkEvent, "root_coords", gdkevent_get_root_coords, 0); rb_define_singleton_method(rb_cGdkEvent, "handler_set", gdkevent_s_handler_set, 0); rb_define_singleton_method(rb_cGdkEvent, "show_events?", gdkevent_s_get_show_events, 0); rb_define_singleton_method(rb_cGdkEvent, "set_show_events", gdkevent_s_set_show_events, 1); rb_define_singleton_method(rb_cGdkEvent, "setting_get", gdkevent_s_setting_get, -1); rb_define_singleton_method(rb_cGdkEvent, "add_client_message_filter", gdkevent_s_add_client_message_filter, 1); rb_define_method(rb_cGdkEvent, "screen", gdkevent_screen, 0); rb_define_method(rb_cGdkEvent, "set_screen", gdkevent_set_screen, 1); /* GdkEventAny fields */ DEFINE_ACCESSOR(rb_cGdkEvent, any, window); rb_define_method(rb_cGdkEvent, "send_event?", gdkeventany_send_event, 0); rb_define_method(rb_cGdkEvent, "set_send_event", gdkeventany_set_send_event, 1); G_DEF_SETTERS(rb_cGdkEvent); /* * GdkEvent's Constants */ rb_define_const(rb_cGdkEvent, "CURRENT_TIME", INT2FIX(GDK_CURRENT_TIME)); rb_define_const(rb_cGdkEvent, "PRIORITY_EVENTS", INT2FIX(GDK_PRIORITY_EVENTS)); rb_define_const(rb_cGdkEvent, "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", rb_cGdkEvent); G_RENAME_CONSTANT("2BUTTON_PRESS","BUTTON2_PRESS"); G_RENAME_CONSTANT("3BUTTON_PRESS","BUTTON3_PRESS"); G_DEF_CONSTANTS(rb_cGdkEvent, GDK_TYPE_EVENT_TYPE, "GDK_"); /* GdkEventMask */ G_DEF_CLASS(GDK_TYPE_EVENT_MASK, "Mask", rb_cGdkEvent); G_DEF_CONSTANTS(rb_cGdkEvent, GDK_TYPE_EVENT_MASK, "GDK_"); /* GdkEventAny */ rb_cGdkEventAny = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_ANY, "EventAny", mGdk, rb_cGdkEvent); G_DEF_SETTERS(rb_cGdkEventAny); /* GdkEventExpose */ rb_cGdkEventExpose = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_EXPOSE, "EventExpose", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventExpose, expose, area); DEFINE_ACCESSOR(rb_cGdkEventExpose, expose, region); DEFINE_ACCESSOR(rb_cGdkEventExpose, expose, count); DEFINE_INIT(rb_cGdkEventExpose, expose); rb_define_singleton_method(rb_cGdkEventExpose, "get_graphics_expose", gdkevent_s_get_graphics_expose, 1); G_DEF_SETTERS(rb_cGdkEventExpose); /* GdkEventNoExpose */ rb_cGdkEventNoExpose = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_NO_EXPOSE, "EventNoExpose", mGdk, rb_cGdkEvent); DEFINE_INIT(rb_cGdkEventNoExpose, noexpose); /* GdkEventVisibility */ rb_cGdkEventVisibility = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_VISIBILITY, "EventVisibility", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventVisibility, visibility, state); DEFINE_INIT(rb_cGdkEventVisibility, visibility); G_DEF_SETTERS(rb_cGdkEventVisibility); /* GdkVisibilityState */ G_DEF_CLASS(GDK_TYPE_VISIBILITY_STATE, "State", rb_cGdkEventVisibility); G_DEF_CONSTANTS(rb_cGdkEventVisibility, GDK_TYPE_VISIBILITY_STATE, "GDK_VISIBILITY_"); /* GdkEventMotion */ rb_cGdkEventMotion = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_MOTION, "EventMotion", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, time); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, x); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, y); rb_define_method(rb_cGdkEventMotion, "axes", gdkeventmotion_axes, 0); rb_define_method(rb_cGdkEventMotion, "set_axes", gdkeventmotion_set_axes, 1); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, state); rb_define_method(rb_cGdkEventMotion, "hint?", gdkeventmotion_is_hint, 0); rb_define_method(rb_cGdkEventMotion, "set_hint", gdkeventmotion_set_is_hint, 1); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, device); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, x_root); DEFINE_ACCESSOR(rb_cGdkEventMotion, motion, y_root); DEFINE_INIT(rb_cGdkEventMotion, motion); #if GTK_CHECK_VERSION(2, 12, 0) rb_define_method(rb_cGdkEventMotion, "request", gdkeventmotion_request_motions, 0); #endif G_DEF_SETTERS(rb_cGdkEventMotion); /* GdkEventButton */ rb_cGdkEventButton = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_BUTTON, "EventButton", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventButton, button, time); DEFINE_ACCESSOR(rb_cGdkEventButton, button, x); DEFINE_ACCESSOR(rb_cGdkEventButton, button, y); rb_define_method(rb_cGdkEventButton, "axes", gdkeventbutton_axes, 0); rb_define_method(rb_cGdkEventButton, "set_axes", gdkeventbutton_set_axes, 2); DEFINE_ACCESSOR(rb_cGdkEventButton, button, state); DEFINE_ACCESSOR(rb_cGdkEventButton, button, button); DEFINE_ACCESSOR(rb_cGdkEventButton, button, device); DEFINE_ACCESSOR(rb_cGdkEventButton, button, x_root); DEFINE_ACCESSOR(rb_cGdkEventButton, button, y_root); G_DEF_SETTERS(rb_cGdkEventButton); /* GdkEventScroll */ rb_cGdkEventScroll = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_SCROLL, "EventScroll", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, time); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, x); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, y); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, state); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, direction); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, device); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, x_root); DEFINE_ACCESSOR(rb_cGdkEventScroll, scroll, y_root); DEFINE_INIT(rb_cGdkEventScroll, scroll); G_DEF_SETTERS(rb_cGdkEventScroll); /* GdkScrollDirection */ G_DEF_CLASS(GDK_TYPE_SCROLL_DIRECTION, "Direction", rb_cGdkEventScroll); G_DEF_CONSTANTS(rb_cGdkEventScroll, GDK_TYPE_SCROLL_DIRECTION, "GDK_SCROLL_"); /* GdkEventKey */ rb_cGdkEventKey = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_KEY, "EventKey", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventKey, key, time); DEFINE_ACCESSOR(rb_cGdkEventKey, key, state); DEFINE_ACCESSOR(rb_cGdkEventKey, key, keyval); DEFINE_ACCESSOR(rb_cGdkEventKey, key, hardware_keycode); DEFINE_ACCESSOR(rb_cGdkEventKey, key, group); G_DEF_SETTERS(rb_cGdkEventKey); /* GdkEventCrossing */ rb_cGdkEventCrossing = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_CROSSING, "EventCrossing", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, subwindow); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, time); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, x); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, y); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, x_root); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, y_root); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, mode); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, detail); rb_define_method(rb_cGdkEventCrossing, "focus?", gdkeventcrossing_focus, 0); rb_define_method(rb_cGdkEventCrossing, "set_focus", gdkeventcrossing_set_focus, 1); DEFINE_ACCESSOR(rb_cGdkEventCrossing, crossing, state); G_DEF_SETTERS(rb_cGdkEventCrossing); /* GdkCrossingMode */ G_DEF_CLASS(GDK_TYPE_CROSSING_MODE, "Mode", rb_cGdkEventScroll); G_DEF_CONSTANTS(rb_cGdkEventCrossing, GDK_TYPE_CROSSING_MODE, "GDK_CROSSING_"); /* GdkNotifyType */ G_DEF_CLASS(GDK_TYPE_NOTIFY_TYPE, "NotifyType", rb_cGdkEventScroll); G_DEF_CONSTANTS(rb_cGdkEventScroll, GDK_TYPE_NOTIFY_TYPE, "GDK_"); /* GdkEventFocus */ rb_cGdkEventFocus = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_FOCUS, "EventFocus", mGdk, rb_cGdkEvent); rb_define_method(rb_cGdkEventFocus, "in?", gdkeventfocus_change_in, 0); rb_define_method(rb_cGdkEventFocus, "set_in", gdkeventfocus_change_set_in, 1); DEFINE_INIT(rb_cGdkEventFocus, focus_change); G_DEF_SETTERS(rb_cGdkEventFocus); /* GdkEventConfigure */ rb_cGdkEventConfigure = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_CONFIGURE, "EventConfigure", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, x); DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, y); DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, width); DEFINE_ACCESSOR(rb_cGdkEventConfigure, configure, height); DEFINE_INIT(rb_cGdkEventConfigure, configure); G_DEF_SETTERS(rb_cGdkEventConfigure); /* GdkEventProperty */ rb_cGdkEventProperty = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_PROPERTY, "EventProperty", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventProperty, property, atom); DEFINE_ACCESSOR(rb_cGdkEventProperty, property, time); DEFINE_ACCESSOR(rb_cGdkEventProperty, property, state); DEFINE_INIT(rb_cGdkEventProperty, property); G_DEF_SETTERS(rb_cGdkEventProperty); /* GdkPropertyState */ G_DEF_CLASS(GDK_TYPE_PROPERTY_STATE, "State", rb_cGdkEventProperty); G_DEF_CONSTANTS(rb_cGdkEventProperty, GDK_TYPE_PROPERTY_STATE, "GDK_"); /* GdkEventSelection */ rb_cGdkEventSelection = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_SELECTION, "EventSelection", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, selection); DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, target); DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, property); DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, requestor); DEFINE_ACCESSOR(rb_cGdkEventSelection, selection, time); G_DEF_SETTERS(rb_cGdkEventSelection); /* GdkEventOwnerChange */ rb_cGdkEventOwnerChange = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_OWNER_CHANGE, "EventOwnerChange", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, owner); DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, reason); DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, selection); DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, time); DEFINE_ACCESSOR(rb_cGdkEventOwnerChange, owner_change, selection_time); G_DEF_SETTERS(rb_cGdkEventOwnerChange); DEFINE_INIT(rb_cGdkEventOwnerChange, owner_change); /* GdkOwnerChange */ G_DEF_CLASS(GDK_TYPE_OWNER_CHANGE, "OwnerChange", rb_cGdkEventScroll); G_DEF_CONSTANTS(rb_cGdkEventScroll, GDK_TYPE_OWNER_CHANGE, "GDK_OWNER_CHANGE_"); /* GdkEventProximity */ rb_cGdkEventProximity = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_PROXIMITY, "EventProximity", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventProximity, proximity, time); DEFINE_ACCESSOR(rb_cGdkEventProximity, proximity, device); G_DEF_SETTERS(rb_cGdkEventProximity); /* GdkEventClient */ rb_cGdkEventClient = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_CLIENT, "EventClient", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventClient, client, message_type); rb_define_method(rb_cGdkEventClient, "data_format", gdkeventclient_data_format, 0); rb_define_method(rb_cGdkEventClient, "data", gdkeventclient_data, 0); rb_define_method(rb_cGdkEventClient, "send_client_message", gdkeventclient_send_client_message, -1); rb_define_method(rb_cGdkEventClient, "send_clientmessage_toall", gdkeventclient_send_clientmessage_toall, 0); DEFINE_INIT(rb_cGdkEventClient, client); G_DEF_SETTERS(rb_cGdkEventClient); /* GdkEventDND */ rb_cGdkEventDND = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_DND, "EventDND", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, context); DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, time); DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, x_root); DEFINE_ACCESSOR(rb_cGdkEventDND, dnd, y_root); G_DEF_SETTERS(rb_cGdkEventDND); /* GdkEventWindowState */ rb_cGdkEventWindowState = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_WINDOW_STATE, "EventWindowState", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventWindowState, window_state, changed_mask); DEFINE_ACCESSOR(rb_cGdkEventWindowState, window_state, new_window_state); DEFINE_INIT(rb_cGdkEventWindowState, window_state); G_DEF_SETTERS(rb_cGdkEventWindowState); /* GdkWindowState */ G_DEF_CLASS(GDK_TYPE_WINDOW_STATE, "WindowState", rb_cGdkEventScroll); G_DEF_CONSTANTS(rb_cGdkEventWindowState, GDK_TYPE_WINDOW_STATE, "GDK_WINDOW_STATE_"); /* GdkEventSetting */ rb_cGdkEventSetting = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_SETTING, "EventSetting", mGdk, rb_cGdkEvent); DEFINE_ACCESSOR(rb_cGdkEventSetting, setting, action); DEFINE_ACCESSOR(rb_cGdkEventSetting, setting, name); DEFINE_INIT(rb_cGdkEventSetting, setting); G_DEF_SETTERS(rb_cGdkEventSetting); /* GdkSettingAction */ G_DEF_CLASS(GDK_TYPE_SETTING_ACTION, "Action", rb_cGdkEventScroll); G_DEF_CONSTANTS(rb_cGdkEventSetting, GDK_TYPE_SETTING_ACTION, "GDK_SETTING_"); /* GdkEventGrabBroken */ rb_cGdkEventGrabBroken = G_DEF_CLASS_WITH_PARENT(GDK_TYPE_EVENT_GRAB_BROKEN, "EventGrabBroken", mGdk, rb_cGdkEvent); rb_define_method(rb_cGdkEventGrabBroken, "keyboard?", gdkeventgrab_broken_keyboard, 0); rb_define_method(rb_cGdkEventGrabBroken, "set_keyboard", gdkeventgrab_broken_set_keyboard, 1); rb_define_method(rb_cGdkEventGrabBroken, "implicit?", gdkeventgrab_broken_implicit, 0); rb_define_method(rb_cGdkEventGrabBroken, "set_implicit", gdkeventgrab_broken_set_implicit, 1); DEFINE_ACCESSOR(rb_cGdkEventGrabBroken, grab_broken, grab_window); DEFINE_INIT(rb_cGdkEventGrabBroken, grab_broken); G_DEF_SETTERS(rb_cGdkEventGrabBroken); rbgobj_register_g2r_func(GDK_TYPE_EVENT, &gdkevent_g2r); } ������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkrectangle.c������������������������������������������������0000644�0001750�0001750�00000006606�12124610262�020256� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ��������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellview.c�������������������������������������������������0000644�0001750�0001750�00000007140�12257552167�020156� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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))); } void Init_gtk_cellview(VALUE mGtk) { 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); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkwidget.c���������������������������������������������������0000644�0001750�0001750�00000076267�12307003726�017633� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cWidget #define _SELF(self) (GTK_WIDGET(RVAL2GOBJ(self))) static VALUE style_prop_func_table; static VALUE rg_flags(VALUE self) { return GFLAGS2RVAL(GTK_WIDGET_FLAGS(_SELF(self)), GTK_TYPE_WIDGET_FLAGS); } static VALUE rg_set_flags(VALUE self, VALUE flag) { GTK_WIDGET_SET_FLAGS(_SELF(self), RVAL2GFLAGS(flag, GTK_TYPE_WIDGET_FLAGS)); return self; } static VALUE rg_unset_flags(VALUE self, VALUE flag) { GTK_WIDGET_UNSET_FLAGS(_SELF(self), RVAL2GFLAGS(flag, GTK_TYPE_WIDGET_FLAGS)); return self; } static VALUE rg_unparent(VALUE self) { gtk_widget_unparent(_SELF(self)); return self; } static VALUE rg_show(VALUE self) { gtk_widget_show(_SELF(self)); return self; } static VALUE rg_show_now(VALUE self) { gtk_widget_show_now(_SELF(self)); return self; } static VALUE rg_hide(VALUE self) { gtk_widget_hide(_SELF(self)); return self; } static VALUE rg_show_all(VALUE self) { gtk_widget_show_all(_SELF(self)); return self; } static VALUE rg_hide_all(VALUE self) { gtk_widget_hide_all(_SELF(self)); return self; } static VALUE rg_map(VALUE self) { gtk_widget_map(_SELF(self)); return self; } static VALUE rg_unmap(VALUE self) { gtk_widget_unmap(_SELF(self)); return self; } static VALUE rg_realize(VALUE self) { gtk_widget_realize(_SELF(self)); return self; } static VALUE rg_unrealize(VALUE self) { gtk_widget_unrealize(_SELF(self)); return self; } static VALUE rg_queue_draw(VALUE self) { gtk_widget_queue_draw(_SELF(self)); return self; } static VALUE rg_queue_resize(VALUE self) { gtk_widget_queue_resize(_SELF(self)); return self; } static VALUE rg_queue_resize_no_redraw(VALUE self) { gtk_widget_queue_resize_no_redraw(_SELF(self)); return self; } /* Note this method is not gtk_widget_get_size_request */ static VALUE rg_size_request(VALUE self) { GtkRequisition req; gtk_widget_size_request(_SELF(self), &req); return rb_ary_new3(2, INT2NUM(req.width), INT2NUM(req.height)); } static VALUE rg_child_requisition(VALUE self) { GtkRequisition req; gtk_widget_get_child_requisition(_SELF(self), &req); return rb_ary_new3(2, INT2NUM(req.width), INT2NUM(req.height)); } static VALUE rg_size_allocate(VALUE self, VALUE alloc) { gtk_widget_size_allocate(_SELF(self), (GtkAllocation*)RVAL2BOXED(alloc, GTK_TYPE_ALLOCATION)); return self; } static VALUE rg_add_accelerator(VALUE self, VALUE sig, VALUE accel, VALUE key, VALUE mod, VALUE flag) { gtk_widget_add_accelerator(_SELF(self), RVAL2CSTR(sig), GTK_ACCEL_GROUP(RVAL2GOBJ(accel)), NUM2INT(key), RVAL2GFLAGS(mod, GDK_TYPE_MODIFIER_TYPE), RVAL2GFLAGS(flag, GTK_TYPE_ACCEL_FLAGS)); return self; } static VALUE rg_remove_accelerator(VALUE self, VALUE accel, VALUE key, VALUE mod) { return CBOOL2RVAL(gtk_widget_remove_accelerator(_SELF(self), GTK_ACCEL_GROUP(RVAL2GOBJ(accel)), NUM2INT(key), RVAL2GFLAGS(mod, GDK_TYPE_MODIFIER_TYPE))); } static VALUE rg_set_accel_path(VALUE self, VALUE accel_path, VALUE accel_group) { gtk_widget_set_accel_path(_SELF(self), RVAL2CSTR(accel_path), GTK_ACCEL_GROUP(RVAL2GOBJ(accel_group))); return self; } static VALUE rg_accel_closures(VALUE self) { return GLIST2ARY2F(gtk_widget_list_accel_closures(_SELF(self)), G_TYPE_CLOSURE); } static VALUE rg_can_activate_accel_p(VALUE self, VALUE signal_id) { return CBOOL2RVAL(gtk_widget_can_activate_accel(_SELF(self), NUM2UINT(signal_id))); } static VALUE rg_event(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_widget_event(_SELF(self), RVAL2GEV(event))); } static VALUE rg_activate(VALUE self) { return CBOOL2RVAL(gtk_widget_activate(_SELF(self))); } static VALUE rg_reparent(VALUE self, VALUE parent) { gtk_widget_reparent(_SELF(self), _SELF(parent)); return self; } static VALUE rg_intersect(VALUE self, VALUE area) { GdkRectangle intersection; gboolean ret = gtk_widget_intersect(_SELF(self), (GdkRectangle*)RVAL2BOXED(area, GDK_TYPE_RECTANGLE), &intersection); return ret ? BOXED2RVAL(&intersection, GDK_TYPE_RECTANGLE) : Qnil; } static VALUE rg_grab_default(VALUE self) { gtk_widget_grab_default(_SELF(self)); return self; } static VALUE rg_set_state(VALUE self, VALUE state) { gtk_widget_set_state(_SELF(self), RVAL2GTKSTATETYPE(state)); return self; } static VALUE rg_set_parent_window(VALUE self, VALUE parent_window) { gtk_widget_set_parent_window(_SELF(self), GDK_WINDOW(RVAL2GOBJ(parent_window))); return self; } static VALUE rg_parent_window(VALUE self) { return GOBJ2RVAL(gtk_widget_get_parent_window(_SELF(self))); } static VALUE rg_add_events(VALUE self, VALUE events) { gtk_widget_add_events(_SELF(self), NUM2INT(events)); return self; } static VALUE rg_toplevel(VALUE self) { return GOBJ2RVAL(gtk_widget_get_toplevel(_SELF(self))); } static VALUE rg_get_ancestor(VALUE self, VALUE klass) { return GOBJ2RVAL(gtk_widget_get_ancestor(_SELF(self), CLASS2GTYPE(klass))); } static VALUE rg_colormap(VALUE self) { return GOBJ2RVAL(gtk_widget_get_colormap(_SELF(self))); } static VALUE rg_set_colormap(VALUE self, VALUE colormap) { gtk_widget_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap))); return self; } static VALUE rg_visual(VALUE self) { return GOBJ2RVAL(gtk_widget_get_visual(_SELF(self))); } static VALUE rg_pointer(VALUE self) { int x, y; gtk_widget_get_pointer(_SELF(self), &x, &y); return rb_assoc_new(INT2FIX(x), INT2FIX(y)); } static VALUE rg_ancestor_p(VALUE self, VALUE ancestor) { return CBOOL2RVAL(gtk_widget_is_ancestor(_SELF(self), _SELF(ancestor))); } static VALUE rg_translate_coordinates(VALUE self, VALUE dest_widget, VALUE src_x, VALUE src_y) { gint dest_x, dest_y; gboolean ret; VALUE result = Qnil; ret = gtk_widget_translate_coordinates(_SELF(self), _SELF(dest_widget), NUM2INT(src_x), NUM2INT(src_y), &dest_x, &dest_y); if (ret) result = rb_ary_new3(2, INT2FIX(dest_x), INT2FIX(dest_y)); return result; } static VALUE rg_hide_on_delete(VALUE self) { return CBOOL2RVAL(gtk_widget_hide_on_delete(_SELF(self))); } static VALUE rg_ensure_style(VALUE self) { gtk_widget_ensure_style(_SELF(self)); return self; } static VALUE rg_reset_rc_styles(VALUE self) { gtk_widget_reset_rc_styles(_SELF(self)); return self; } static VALUE rg_s_push_colormap(G_GNUC_UNUSED VALUE self, VALUE cmap) { gtk_widget_push_colormap(GDK_COLORMAP(RVAL2GOBJ(cmap))); return cmap; } static VALUE rg_s_pop_colormap(VALUE self) { gtk_widget_pop_colormap(); return self; } static VALUE rg_s_set_default_colormap(G_GNUC_UNUSED VALUE self, VALUE cmap) { gtk_widget_set_default_colormap(GDK_COLORMAP(RVAL2GOBJ(cmap))); return cmap; } static VALUE rg_s_default_style(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_widget_get_default_style()); } static VALUE rg_s_default_colormap(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_widget_get_default_colormap()); } static VALUE rg_s_default_visual(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(gtk_widget_get_default_visual()); } static VALUE rg_set_direction(VALUE self, VALUE dir) { gtk_widget_set_direction(_SELF(self), RVAL2GENUM(dir, GTK_TYPE_TEXT_DIRECTION)); return self; } static VALUE rg_direction(VALUE self) { return GENUM2RVAL(gtk_widget_get_direction(_SELF(self)), GTK_TYPE_TEXT_DIRECTION); } static VALUE rg_s_set_default_direction(VALUE self, VALUE dir) { gtk_widget_set_default_direction(RVAL2GENUM(dir, GTK_TYPE_TEXT_DIRECTION)); return self; } static VALUE rg_s_default_direction(G_GNUC_UNUSED VALUE self) { return GENUM2RVAL(gtk_widget_get_default_direction(), GTK_TYPE_TEXT_DIRECTION); } static VALUE rg_shape_combine_mask(VALUE self, VALUE shape_mask, VALUE offset_x, VALUE offset_y) { gtk_widget_shape_combine_mask(_SELF(self), GDK_BITMAP(RVAL2GOBJ(shape_mask)), NUM2INT(offset_x), NUM2INT(offset_y)); return self; } static VALUE rg_input_shape_combine_mask(VALUE self, VALUE shape_mask, VALUE offset_x, VALUE offset_y) { gtk_widget_input_shape_combine_mask(_SELF(self), GDK_BITMAP(RVAL2GOBJ(shape_mask)), NUM2INT(offset_x), NUM2INT(offset_y)); return self; } static VALUE rg_path(VALUE self) { guint path_length; gchar *path; gchar *path_reversed; VALUE str_path; VALUE str_path_reversed; gtk_widget_path(_SELF(self), &path_length, &path, &path_reversed); str_path = CSTR2RVAL(path); str_path_reversed = CSTR2RVAL(path_reversed); g_free(path); g_free(path_reversed); return rb_ary_new3(2, str_path, str_path_reversed); } static VALUE rg_class_path(VALUE self) { guint path_length; gchar *path; gchar *path_reversed; VALUE str_path; VALUE str_path_reversed; gtk_widget_class_path(_SELF(self), &path_length, &path, &path_reversed); str_path = CSTR2RVAL(path); str_path_reversed = CSTR2RVAL(path_reversed); g_free(path); g_free(path_reversed); return rb_ary_new3(2, str_path, str_path_reversed); } static VALUE rg_composite_name(VALUE self) { return CSTR2RVAL(gtk_widget_get_composite_name(_SELF(self))); } static VALUE rg_modify_style(VALUE self, VALUE style) { gtk_widget_modify_style(_SELF(self), GTK_RC_STYLE(RVAL2GOBJ(style))); return self; } static VALUE rg_modifier_style(VALUE self) { return GOBJ2RVAL(gtk_widget_get_modifier_style(_SELF(self))); } static VALUE rg_modify_fg(VALUE self, VALUE state, VALUE color) { gtk_widget_modify_fg(_SELF(self), RVAL2GTKSTATETYPE(state), RVAL2GDKCOLOR(color)); return self; } static VALUE rg_modify_bg(VALUE self, VALUE state, VALUE color) { gtk_widget_modify_bg(_SELF(self), RVAL2GTKSTATETYPE(state), RVAL2GDKCOLOR(color)); return self; } static VALUE rg_modify_text(VALUE self, VALUE state, VALUE color) { gtk_widget_modify_text(_SELF(self), RVAL2GTKSTATETYPE(state), RVAL2GDKCOLOR(color)); return self; } static VALUE rg_modify_base(VALUE self, VALUE state, VALUE color) { gtk_widget_modify_base(_SELF(self), RVAL2GTKSTATETYPE(state), RVAL2GDKCOLOR(color)); return self; } static VALUE rg_modify_font(VALUE self, VALUE font_desc) { gtk_widget_modify_font(_SELF(self), (PangoFontDescription*)RVAL2BOXED(font_desc, PANGO_TYPE_FONT_DESCRIPTION)); return self; } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_modify_cursor(VALUE self, VALUE primary, VALUE seconday) { gtk_widget_modify_cursor(_SELF(self), RVAL2BOXED(primary, GDK_TYPE_COLOR), RVAL2BOXED(seconday, GDK_TYPE_COLOR)); return self; } #endif static VALUE rg_create_pango_context(VALUE self) { return GOBJ2RVALU(gtk_widget_create_pango_context(_SELF(self))); } static VALUE rg_pango_context(VALUE self) { return GOBJ2RVAL(gtk_widget_get_pango_context(_SELF(self))); } static VALUE rg_create_pango_layout(int argc, VALUE *argv, VALUE self) { VALUE text; rb_scan_args(argc, argv, "01", &text); return GOBJ2RVALU(gtk_widget_create_pango_layout(_SELF(self), RVAL2CSTR_ACCEPT_NIL(text))); } static VALUE rg_render_icon(int argc, VALUE *argv, VALUE self) { VALUE stock_id, size, detail; rb_scan_args(argc, argv, "21", &stock_id, &size, &detail); return GOBJ2RVALU(gtk_widget_render_icon(_SELF(self), rb_id2name(SYM2ID(stock_id)), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE), RVAL2CSTR_ACCEPT_NIL(detail))); } static VALUE rg_s_pop_composite_child(VALUE self) { gtk_widget_pop_composite_child(); return self; } static VALUE rg_s_push_composite_child(VALUE self) { gtk_widget_push_composite_child(); return self; } static VALUE rg_queue_draw_area(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_widget_queue_draw_area(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_reset_shapes(VALUE self) { gtk_widget_reset_shapes(_SELF(self)); return self; } static VALUE rg_set_redraw_on_allocate(VALUE self, VALUE redraw_on_allocate) { gtk_widget_set_redraw_on_allocate(_SELF(self), RVAL2CBOOL(redraw_on_allocate)); return self; } static VALUE rg_set_composite_name(VALUE self, VALUE name) { gtk_widget_set_composite_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_set_scroll_adjustments(VALUE self, VALUE h, VALUE v) { return CBOOL2RVAL(gtk_widget_set_scroll_adjustments(_SELF(self), GTK_ADJUSTMENT(_SELF(h)), GTK_ADJUSTMENT(_SELF(v)))); } static VALUE rg_mnemonic_activate(VALUE self, VALUE group_cycling) { return CBOOL2RVAL(gtk_widget_mnemonic_activate(_SELF(self), RVAL2CBOOL(group_cycling))); } /* * Gtk::Widget.install_style_property(...) do |spec, str| * #parse str * new_val = .... # parse value from string. * new_val # return new_val or nil if you can't convert the value. * end */ static gboolean rc_property_parser(const GParamSpec *pspec, const GString *rc_string, GValue *property_value) { VALUE spec = GOBJ2RVAL((gpointer)pspec); VALUE func = rb_hash_aref(style_prop_func_table, spec); VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str)); if (NIL_P(ret)) { return FALSE; } else if (RVAL2CBOOL(ret)){ rbgobj_rvalue_to_gvalue(ret, property_value); return TRUE; } else { rb_raise(rb_eArgError, "Gtk::Widget#install_style_property() block should return new value or nil"); } } static VALUE rg_s_install_style_property(VALUE self, VALUE spec) { const RGObjClassInfo* cinfo = rbgobj_lookup_class(self); GtkWidgetClass* gclass; GParamSpec* pspec = G_PARAM_SPEC(RVAL2GOBJ(spec)); if (cinfo->klass != self) rb_raise(rb_eTypeError, "%s isn't registered class", rb_class2name(self)); gclass = (GtkWidgetClass *)g_type_class_ref(cinfo->gtype); if (rb_block_given_p()){ VALUE func = rb_block_proc(); rb_hash_aset(style_prop_func_table, spec, func); gtk_widget_class_install_style_property_parser(gclass, pspec, (GtkRcPropertyParser)rc_property_parser); } else { gtk_widget_class_install_style_property(gclass, pspec); } return self; } static VALUE rg_s_style_property(VALUE self, VALUE property_name) { GtkWidgetClass* 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 = (GtkWidgetClass*)g_type_class_ref(CLASS2GTYPE(self)); prop = gtk_widget_class_find_style_property(oclass, name); if (!prop){ g_type_class_unref(oclass); rb_raise(rb_eval_string("GLib::NoPropertyError"), "no such property: %s", name); } result = GOBJ2RVAL(prop); g_type_class_unref(oclass); return result; } static VALUE rg_s_style_properties(int argc, VALUE *argv, VALUE self) { GtkWidgetClass* 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_widget_class_list_style_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 rg_region_intersect(VALUE self, VALUE region) { return BOXED2RVAL(gtk_widget_region_intersect(_SELF(self), (GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION)), GDK_TYPE_REGION); } static VALUE rg_send_expose(VALUE self, VALUE event) { return INT2NUM(gtk_widget_send_expose(_SELF(self), RVAL2GEV(event))); } /* They are needless method for ruby. void gtk_widget_style_get (GtkWidget *widget, const gchar *first_property_name, ...); void gtk_widget_style_get_valist (GtkWidget *widget, const gchar *first_property_name, va_list var_args); */ static VALUE rg_style_get_property(VALUE self, VALUE prop_name) { GParamSpec* pspec = NULL; const char* name; if (SYMBOL_P(prop_name)) { name = rb_id2name(SYM2ID(prop_name)); } else { name = RVAL2CSTR(prop_name); } pspec = gtk_widget_class_find_style_property((GtkWidgetClass*)g_type_class_ref(RVAL2GTYPE(self)), name); if (!pspec) rb_raise(rb_eval_string("GLib::NoPropertyError"), "No such property: %s", name); else { // FIXME: use rb_ensure to call g_value_unset() GValue gval = G_VALUE_INIT; VALUE ret; g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec)); gtk_widget_style_get_property(GTK_WIDGET(RVAL2GOBJ(self)), name, &gval); ret = GVAL2RVAL(&gval); g_value_unset(&gval); return ret; } } static VALUE rg_accessible(VALUE self) { return GOBJ2RVAL(gtk_widget_get_accessible(_SELF(self))); } static VALUE rg_child_focus(VALUE self, VALUE direction) { return CBOOL2RVAL(gtk_widget_child_focus(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_DIRECTION_TYPE))); } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_error_bell(VALUE self) { gtk_widget_error_bell(_SELF(self)); return self; } static VALUE rg_keynav_failed(VALUE self, VALUE direction) { return CBOOL2RVAL(gtk_widget_keynav_failed(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_DIRECTION_TYPE))); } #endif static VALUE rg_child_notify(VALUE self, VALUE child_property) { gtk_widget_child_notify(_SELF(self), RVAL2CSTR(child_property)); return self; } static VALUE rg_freeze_child_notify(VALUE self) { gtk_widget_freeze_child_notify(_SELF(self)); return self; } static VALUE rg_child_visible_p(VALUE self) { return CBOOL2RVAL(gtk_widget_get_child_visible(_SELF(self))); } static VALUE rg_settings(VALUE self) { return GOBJ2RVAL(gtk_widget_get_settings(_SELF(self))); } static VALUE rg_get_clipboard(VALUE self, VALUE selection) { return CLIPBOARD2RVAL(gtk_widget_get_clipboard(_SELF(self), RVAL2ATOM(selection))); } static VALUE rg_display(VALUE self) { return GOBJ2RVAL(gtk_widget_get_display(_SELF(self))); } static VALUE rg_root_window(VALUE self) { return GOBJ2RVAL(gtk_widget_get_root_window(_SELF(self))); } static VALUE rg_screen(VALUE self) { return GOBJ2RVAL(gtk_widget_get_screen(_SELF(self))); } static VALUE rg_has_screen_p(VALUE self) { return CBOOL2RVAL(gtk_widget_has_screen(_SELF(self))); } /* Note this method is not gtk_widget_size_request() */ static VALUE rg_get_size_request(VALUE self) { gint width, height; gtk_widget_get_size_request(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_set_child_visible(VALUE self, VALUE is_visible) { gtk_widget_set_child_visible(_SELF(self), RVAL2CBOOL(is_visible)); return self; } static VALUE rg_set_size_request(VALUE self, VALUE width, VALUE height) { gtk_widget_set_size_request(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_thaw_child_notify(VALUE self) { gtk_widget_thaw_child_notify(_SELF(self)); return self; } static VALUE rg_mnemonic_labels(VALUE self) { return GLIST2ARYF(gtk_widget_list_mnemonic_labels(_SELF(self))); } static VALUE rg_add_mnemonic_label(VALUE self, VALUE label) { gtk_widget_add_mnemonic_label(_SELF(self), GTK_WIDGET(RVAL2GOBJ(label))); return self; } static VALUE rg_remove_mnemonic_label(VALUE self, VALUE label) { gtk_widget_remove_mnemonic_label(_SELF(self), GTK_WIDGET(RVAL2GOBJ(label))); return self; } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_set_tooltip_window(VALUE self, VALUE custom_window) { gtk_widget_set_tooltip_window(_SELF(self), GTK_WINDOW(RVAL2GOBJ(custom_window))); return self; } static VALUE rg_tooltip_window(VALUE self) { return GOBJ2RVAL(gtk_widget_get_tooltip_window(_SELF(self))); } static VALUE rg_trigger_tooltip_query(VALUE self) { gtk_widget_trigger_tooltip_query(_SELF(self)); return self; } #endif static VALUE rg_action(VALUE self) { return GOBJ2RVAL(gtk_widget_get_action(_SELF(self))); } static VALUE rg_composited_p(VALUE self) { return CBOOL2RVAL(gtk_widget_is_composited(_SELF(self))); } #if !GTK_CHECK_VERSION(2, 14, 0) static VALUE rg_window(VALUE self) { return GOBJ2RVAL(_SELF(self)->window); } #endif static VALUE rg_set_window(VALUE self, VALUE window) { #if GTK_CHECK_VERSION(2,18,0) gtk_widget_set_window(_SELF(self), GDK_WINDOW(RVAL2GOBJ(window))); #else _SELF(self)->window = RVAL2GOBJ(window); #endif return self; } #define DEFINE_IS_WIDGET(STATE) \ static VALUE \ widget_ ## STATE (VALUE self) \ { \ return( GTK_WIDGET_ ## STATE (_SELF(self))? Qtrue: Qfalse ); \ } DEFINE_IS_WIDGET(TOPLEVEL); DEFINE_IS_WIDGET(NO_WINDOW); DEFINE_IS_WIDGET(REALIZED); DEFINE_IS_WIDGET(MAPPED); /*DEFINE_IS_WIDGET(VISIBLE); VISIBLE is defined as property*/ DEFINE_IS_WIDGET(DRAWABLE); DEFINE_IS_WIDGET(PARENT_SENSITIVE); DEFINE_IS_WIDGET(IS_SENSITIVE); DEFINE_IS_WIDGET(HAS_GRAB); DEFINE_IS_WIDGET(RC_STYLE); static VALUE rg_allocation(VALUE self) { return BOXED2RVAL(&(_SELF(self)->allocation), GTK_TYPE_ALLOCATION); } static VALUE rg_set_allocation(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) { GtkAllocation *a = &(_SELF(self)->allocation); a->x = NUM2INT(x); a->y = NUM2INT(y); a->width = NUM2INT(w); a->height = NUM2INT(h); return self; } static VALUE rg_requisition(VALUE self) { GtkRequisition req = _SELF(self)->requisition; return rb_ary_new3(2, INT2NUM(req.width), INT2NUM(req.height)); } static VALUE rg_set_requisition(VALUE self, VALUE w, VALUE h) { GtkRequisition *r = &(_SELF(self)->requisition); r->width = NUM2INT(w); r->height = NUM2INT(h); return self; } static VALUE rg_state(VALUE self) { return GENUM2RVAL(_SELF(self)->state, GTK_TYPE_STATE_TYPE); } static VALUE rg_saved_state(VALUE self) { return GENUM2RVAL(_SELF(self)->saved_state, GTK_TYPE_STATE_TYPE); } static VALUE widget_signal_size_request(G_GNUC_UNUSED guint num, const GValue *values) { GtkRequisition* req = (GtkRequisition*)g_value_get_boxed(&values[1]); return rb_ary_new3(2, GVAL2RVAL(&values[0]), rb_ary_new3(2, INT2NUM(req->width), INT2NUM(req->height))); } static VALUE widget_signal_size_allocate(G_GNUC_UNUSED guint num, const GValue *values) { GtkAllocation* alloc = (GtkAllocation*)g_value_get_boxed(&values[1]); return rb_ary_new3(2, GVAL2RVAL(&values[0]), BOXED2RVAL(alloc, GTK_TYPE_ALLOCATION)); } void Init_gtk_widget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WIDGET, "Widget", mGtk); rb_global_variable(&style_prop_func_table); style_prop_func_table = rb_hash_new(); /* * instance methods */ RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(set_flags, 1); RG_DEF_METHOD(unset_flags, 1); RG_DEF_METHOD(unparent, 0); RG_DEF_METHOD(show, 0); RG_DEF_METHOD(show_now, 0); RG_DEF_METHOD(hide, 0); RG_DEF_METHOD(show_all, 0); RG_DEF_METHOD(hide_all, 0); RG_DEF_METHOD(map, 0); RG_DEF_METHOD(unmap, 0); RG_DEF_METHOD(realize, 0); RG_DEF_METHOD(unrealize, 0); RG_DEF_METHOD(queue_draw, 0); RG_DEF_METHOD(queue_resize, 0); RG_DEF_METHOD(queue_resize_no_redraw, 0); RG_DEF_METHOD(size_request, 0); RG_DEF_METHOD(child_requisition, 0); RG_DEF_METHOD(size_allocate, 1); RG_DEF_METHOD(add_accelerator, 5); RG_DEF_METHOD(remove_accelerator, 3); RG_DEF_METHOD(set_accel_path, 2); RG_DEF_METHOD(accel_closures, 0); RG_DEF_METHOD_P(can_activate_accel, 1); RG_DEF_METHOD(event, 1); RG_DEF_METHOD(activate, 0); RG_DEF_METHOD(reparent, 1); RG_DEF_SMETHOD(install_style_property, 1); RG_DEF_SMETHOD(style_property, 1); RG_DEF_SMETHOD(style_properties, -1); RG_DEF_METHOD(intersect, 1); RG_DEF_METHOD(grab_default, 0); RG_DEF_METHOD(set_state, 1); RG_DEF_METHOD(set_parent_window, 1); RG_DEF_METHOD(parent_window, 0); RG_DEF_METHOD(add_events, 1); RG_DEF_METHOD(toplevel, 0); RG_DEF_METHOD(get_ancestor, 1); RG_DEF_METHOD(colormap, 0); RG_DEF_METHOD(set_colormap, 1); RG_DEF_METHOD(visual, 0); RG_DEF_METHOD(pointer, 0); RG_DEF_METHOD_P(ancestor, 1); RG_DEF_METHOD(translate_coordinates, 3); RG_DEF_METHOD(hide_on_delete, 0); RG_DEF_METHOD(ensure_style, 0); RG_DEF_METHOD(reset_rc_styles, 0); RG_DEF_METHOD(set_direction, 1); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD(shape_combine_mask, 3); RG_DEF_METHOD(input_shape_combine_mask, 3); RG_DEF_METHOD(path, 0); RG_DEF_METHOD(class_path, 0); RG_DEF_METHOD(composite_name, 0); RG_DEF_METHOD(modify_style, 1); RG_DEF_METHOD(modifier_style, 0); RG_DEF_METHOD(modify_fg, 2); RG_DEF_METHOD(modify_bg, 2); RG_DEF_METHOD(modify_text, 2); RG_DEF_METHOD(modify_base, 2); RG_DEF_METHOD(modify_font, 1); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(modify_cursor, 2); #endif RG_DEF_METHOD(create_pango_context, 0); RG_DEF_METHOD(pango_context, 0); RG_DEF_METHOD(create_pango_layout, -1); RG_DEF_METHOD(render_icon, -1); RG_DEF_METHOD(queue_draw_area, 4); RG_DEF_METHOD(reset_shapes, 0); RG_DEF_METHOD(set_redraw_on_allocate, 1); RG_DEF_METHOD(set_composite_name, 1); RG_DEF_METHOD(set_scroll_adjustments, 2); /* for backward compatibility. */ RG_DEF_ALIAS("set_scroll_adjustment", "set_scroll_adjustments"); RG_DEF_METHOD(mnemonic_activate, 1); RG_DEF_METHOD(region_intersect, 1); RG_DEF_METHOD(send_expose, 1); RG_DEF_METHOD(style_get_property, 1); RG_DEF_METHOD(accessible, 0); RG_DEF_METHOD(child_focus, 1); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(error_bell, 0); RG_DEF_METHOD(keynav_failed, 0); #endif RG_DEF_METHOD(child_notify, 1); RG_DEF_METHOD(freeze_child_notify, 0); RG_DEF_METHOD_P(child_visible, 0); RG_DEF_METHOD(settings, 0); RG_DEF_METHOD(get_clipboard, 1); RG_DEF_METHOD(display, 0); RG_DEF_METHOD(root_window, 0); RG_DEF_METHOD(screen, 0); RG_DEF_METHOD_P(has_screen, 0); RG_DEF_METHOD(set_child_visible, 1); RG_DEF_METHOD(get_size_request, 0); RG_DEF_METHOD(set_size_request, 2); RG_DEF_METHOD(thaw_child_notify, 0); RG_DEF_METHOD(mnemonic_labels, 0); RG_DEF_METHOD(add_mnemonic_label, 1); RG_DEF_METHOD(remove_mnemonic_label, 1); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(set_tooltip_window, 1); RG_DEF_METHOD(tooltip_window, 0); RG_DEF_METHOD(trigger_tooltip_query, 0); #endif RG_DEF_METHOD(action, 0); RG_DEF_METHOD_P(composited, 0); #if !GTK_CHECK_VERSION(2, 14, 0) RG_DEF_METHOD(window, 0); #endif RG_DEF_METHOD(set_window, 1); RG_DEF_METHOD(allocation, 0); RG_DEF_METHOD(set_allocation, 4); RG_DEF_METHOD(requisition, 0); RG_DEF_METHOD(set_requisition, 2); RG_DEF_METHOD(state, 0); RG_DEF_METHOD(saved_state, 0); rb_define_method(RG_TARGET_NAMESPACE, "toplevel?", widget_TOPLEVEL, 0); rb_define_method(RG_TARGET_NAMESPACE, "no_window?", widget_NO_WINDOW, 0); rb_define_method(RG_TARGET_NAMESPACE, "realized?", widget_REALIZED, 0); rb_define_method(RG_TARGET_NAMESPACE, "mapped?", widget_MAPPED, 0); rb_define_method(RG_TARGET_NAMESPACE, "drawable?", widget_DRAWABLE, 0); rb_define_method(RG_TARGET_NAMESPACE, "parent_sensitive?", widget_PARENT_SENSITIVE, 0); /* This method's name avoid to sensitive? of a property variables. */ rb_define_method(RG_TARGET_NAMESPACE, "sensitive_with_parent?", widget_IS_SENSITIVE, 0); rb_define_method(RG_TARGET_NAMESPACE, "has_grab?", widget_HAS_GRAB, 0); rb_define_method(RG_TARGET_NAMESPACE, "rc_style?", widget_RC_STYLE, 0); /* * singleton methods */ RG_DEF_SMETHOD(push_colormap, 1); RG_DEF_SMETHOD(pop_colormap, 0); RG_DEF_SMETHOD(set_default_colormap, 1); RG_DEF_SMETHOD(default_style, 0); RG_DEF_SMETHOD(default_colormap, 0); RG_DEF_SMETHOD(default_visual, 0); RG_DEF_SMETHOD(set_default_direction, 1); RG_DEF_SMETHOD(default_direction, 0); RG_DEF_SMETHOD(pop_composite_child, 0); RG_DEF_SMETHOD(push_composite_child, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* * constants */ /* GtkWidgetFlags */ G_DEF_CLASS(GTK_TYPE_WIDGET_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_WIDGET_FLAGS, "GTK_"); /* GtkWidgetHelpType */ G_DEF_CLASS(GTK_TYPE_WIDGET_HELP_TYPE, "HelpType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_WIDGET_HELP_TYPE, "GTK_WIDGET_"); /* GtkTextDirection */ G_DEF_CLASS(GTK_TYPE_TEXT_DIRECTION, "TextDirection", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TEXT_DIRECTION, "GTK_"); /* Special signals */ G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "size-request", (GValToRValSignalFunc)widget_signal_size_request); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "size-allocate", (GValToRValSignalFunc)widget_signal_size_allocate); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprogress.c�������������������������������������������������0000644�0001750�0001750�00000002232�11701304107�020163� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" void Init_gtk_progress(VALUE mGtk) { G_DEF_CLASS(GTK_TYPE_PROGRESS, "Progress", mGtk); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentchooser.c��������������������������������������������0000644�0001750�0001750�00000013200�12257552167�021201� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentChooser #define _SELF(self) (GTK_RECENT_CHOOSER(RVAL2GOBJ(self))) static VALUE rg_set_show_numbers(VALUE self, VALUE val) { gtk_recent_chooser_set_show_numbers(_SELF(self), RVAL2CBOOL(val)); return self; } static VALUE rg_show_numbers(VALUE self) { return CBOOL2RVAL(gtk_recent_chooser_get_show_numbers(_SELF(self))); } struct callback_arg { VALUE callback; VALUE a, b; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; return rb_funcall(arg->callback, id_call, 1, arg->a, arg->b); } static void remove_callback_reference(gpointer callback) { G_CHILD_REMOVE(mGtk, (VALUE)callback); } static gint sort_func(GtkRecentInfo *a, GtkRecentInfo *b, gpointer func) { struct callback_arg arg; arg.callback = (VALUE)func; arg.a = BOXED2RVAL(a, GTK_TYPE_RECENT_INFO); arg.b = BOXED2RVAL(b, GTK_TYPE_RECENT_INFO); return NUM2INT(G_PROTECT_CALLBACK(invoke_callback, &arg)); } static VALUE rg_set_sort_func(VALUE self) { VALUE func = rb_block_proc(); G_CHILD_ADD(mGtk, func); gtk_recent_chooser_set_sort_func(_SELF(self), (GtkRecentSortFunc)sort_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; } static VALUE rg_set_current_uri(VALUE self, VALUE uri) { GError *error = NULL; gboolean ret = gtk_recent_chooser_set_current_uri(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_current_uri(VALUE self) { return CSTR2RVAL(gtk_recent_chooser_get_current_uri(_SELF(self))); } static VALUE rg_current_item(VALUE self) { return BOXED2RVAL(gtk_recent_chooser_get_current_item(_SELF(self)), GTK_TYPE_RECENT_INFO); } static VALUE rg_select_uri(VALUE self, VALUE uri) { GError *error = NULL; gboolean ret = gtk_recent_chooser_select_uri(_SELF(self), RVAL2CSTR(uri), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_unselect_uri(VALUE self, VALUE uri) { gtk_recent_chooser_unselect_uri(_SELF(self), RVAL2CSTR(uri)); return self; } static VALUE rg_select_all(VALUE self) { gtk_recent_chooser_select_all(_SELF(self)); return self; } static VALUE rg_unselect_all(VALUE self) { gtk_recent_chooser_unselect_all(_SELF(self)); return self; } static VALUE rg_items(VALUE self) { GList* list = gtk_recent_chooser_get_items(_SELF(self)); VALUE ary = rb_ary_new(); while (list) { rb_ary_push(ary, BOXED2RVAL(list->data, GTK_TYPE_RECENT_INFO)); gtk_recent_info_unref(list->data); list = list->next; } g_list_free(list); return ary; } static VALUE rg_uris(VALUE self) { gsize i; gsize size; gchar** uris = gtk_recent_chooser_get_uris(_SELF(self), &size); VALUE ary = rb_ary_new(); for (i = 0; i < size; i++){ rb_ary_push(ary, CSTR2RVAL(uris[i])); } g_strfreev(uris); return ary; } static VALUE rg_add_filter(VALUE self, VALUE filter) { gtk_recent_chooser_add_filter(_SELF(self), GTK_RECENT_FILTER(RVAL2GOBJ(filter))); return self; } static VALUE rg_remove_filter(VALUE self, VALUE filter) { gtk_recent_chooser_remove_filter(_SELF(self), GTK_RECENT_FILTER(RVAL2GOBJ(filter))); return self; } static VALUE rg_filters(VALUE self) { return GSLIST2ARYF(gtk_recent_chooser_list_filters(_SELF(self))); } void Init_gtk_recent_chooser(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_CHOOSER, "RecentChooser", mGtk); RG_DEF_METHOD(set_show_numbers, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "show_numbers"); RG_DEF_METHOD(show_numbers, 0); RG_DEF_METHOD(set_sort_func, 0); RG_DEF_METHOD(set_current_uri, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "current_uri"); RG_DEF_METHOD(current_uri, 0); RG_DEF_METHOD(current_item, 0); RG_DEF_METHOD(select_uri, 1); RG_DEF_METHOD(unselect_uri, 1); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(items, 0); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(add_filter, 1); RG_DEF_METHOD(remove_filter, 1); RG_DEF_METHOD(filters, 0); /* GtkRecentChooserError */ G_DEF_ERROR(GTK_RECENT_CHOOSER_ERROR, "RecentChooserError", mGtk, rb_eRuntimeError, GTK_TYPE_RECENT_CHOOSER_ERROR); /* GtkRecentSortType */ G_DEF_CLASS(GTK_TYPE_RECENT_SORT_TYPE, "SortType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_RECENT_SORT_TYPE, "GTK_RECENT_"); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvruler.c���������������������������������������������������0000644�0001750�0001750�00000002542�11701304107�017642� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVRuler static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_vruler_new()); return Qnil; } void Init_gtk_vruler(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VRULER, "VRuler", mGtk); RG_DEF_METHOD(initialize, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkarrow.c����������������������������������������������������0000644�0001750�0001750�00000003724�11701304107�017460� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } ��������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreemodelsort.c��������������������������������������������0000644�0001750�0001750�00000006763�12257552167�021246� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cTreeModelSort #define _SELF(s) (GTK_TREE_MODEL_SORT(RVAL2GOBJ(s))) static ID id_model; static VALUE rg_initialize(VALUE self, VALUE model) { G_CHILD_SET(self, id_model, model); G_INITIALIZE(self, gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model)))); return Qnil; } static VALUE rg_convert_child_path_to_path(VALUE self, VALUE child_path) { return GTKTREEPATH2RVAL(gtk_tree_model_sort_convert_child_path_to_path( _SELF(self), RVAL2GTKTREEPATH(child_path))); } static VALUE rg_convert_child_iter_to_iter(VALUE self, VALUE child_iter) { GtkTreeIter sort_iter; GtkTreeModelSort* modelsort = _SELF(self); gtk_tree_model_sort_convert_child_iter_to_iter(modelsort, &sort_iter, RVAL2GTKTREEITER(child_iter)); sort_iter.user_data3 = gtk_tree_model_sort_get_model(modelsort); return GTKTREEITER2RVAL(&sort_iter); } static VALUE rg_convert_path_to_child_path(VALUE self, VALUE sorted_path) { return GTKTREEPATH2RVAL(gtk_tree_model_sort_convert_path_to_child_path( _SELF(self), RVAL2GTKTREEPATH(sorted_path))); } static VALUE rg_convert_iter_to_child_iter(VALUE self, VALUE sorted_iter) { GtkTreeIter child_iter; GtkTreeModelSort* modelsort = _SELF(self); gtk_tree_model_sort_convert_iter_to_child_iter(modelsort, &child_iter, RVAL2GTKTREEITER(sorted_iter)); child_iter.user_data3 = gtk_tree_model_sort_get_model(modelsort); return GTKTREEITER2RVAL(&child_iter); } static VALUE rg_reset_default_sort_func(VALUE self) { gtk_tree_model_sort_reset_default_sort_func(_SELF(self)); return self; } static VALUE rg_clear_cache(VALUE self) { gtk_tree_model_sort_clear_cache(_SELF(self)); return self; } static VALUE rg_iter_is_valid_p(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_tree_model_sort_iter_is_valid(_SELF(self), RVAL2GTKTREEITER(iter))); } void Init_gtk_tmodelsort(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_MODEL_SORT, "TreeModelSort", mGtk); id_model = rb_intern("model"); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(convert_child_path_to_path, 1); RG_DEF_METHOD(convert_child_iter_to_iter, 1); RG_DEF_METHOD(convert_path_to_child_path, 1); RG_DEF_METHOD(convert_iter_to_child_iter, 1); RG_DEF_METHOD(reset_default_sort_func, 0); RG_DEF_METHOD(clear_cache, 0); RG_DEF_METHOD_P(iter_is_valid, 1); } �������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkuimanager.c������������������������������������������������0000644�0001750�0001750�00000012676�12257552167�020326� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cUIManager #define _SELF(self) (GTK_UI_MANAGER(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_ui_manager_new()); return Qnil; } static VALUE rg_insert_action_group(VALUE self, VALUE action_group, VALUE pos) { gtk_ui_manager_insert_action_group(_SELF(self), RVAL2GOBJ(action_group), NUM2INT(pos)); G_CHILD_ADD(self, action_group); return self; } static VALUE rg_remove_action_group(VALUE self, VALUE action_group) { gtk_ui_manager_remove_action_group(_SELF(self), RVAL2GOBJ(action_group)); G_CHILD_REMOVE(self, action_group); return self; } static VALUE rg_action_groups(VALUE self) { /* Owned by GTK+ */ return GLIST2ARY(gtk_ui_manager_get_action_groups(_SELF(self))); } static VALUE rg_accel_group(VALUE self) { return GOBJ2RVAL(gtk_ui_manager_get_accel_group(_SELF(self))); } static VALUE rg_get_widget(VALUE self, VALUE path) { GtkWidget* widget = gtk_ui_manager_get_widget(_SELF(self), RVAL2CSTR(path)); if (! widget) rb_raise(rb_eArgError, "no widget was found."); return GOBJ2RVAL(widget); } static VALUE rg_get_toplevels(VALUE self, VALUE types) { return GSLIST2ARYF(gtk_ui_manager_get_toplevels(_SELF(self), RVAL2GFLAGS(types, GTK_TYPE_UI_MANAGER_ITEM_TYPE))); } static VALUE rg_get_action(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_ui_manager_get_action(_SELF(self), RVAL2CSTR(path))); } static VALUE rg_add_ui(int argc, VALUE *argv, VALUE self) { GError* error = NULL; guint ret; VALUE buffer; if (argc == 1) { VALUE buffer_or_filename; rb_scan_args(argc, argv, "10", &buffer_or_filename); StringValue(buffer_or_filename); buffer = rb_funcall(buffer_or_filename, rb_intern("include?"), 1, CSTR2RVAL("<ui>")); if (RVAL2CBOOL(buffer)){ StringValue(buffer_or_filename); ret = gtk_ui_manager_add_ui_from_string(_SELF(self), RSTRING_PTR(buffer_or_filename), RSTRING_LEN(buffer_or_filename), &error); } else { ret = gtk_ui_manager_add_ui_from_file(_SELF(self), RVAL2CSTR(buffer_or_filename), &error); } } else { VALUE merge_id, path, name, action, type, top; rb_scan_args(argc, argv, "60", &merge_id, &path, &name, &action, &type, &top); ret = NUM2UINT(merge_id); gtk_ui_manager_add_ui(_SELF(self), ret, RVAL2CSTR(path), RVAL2CSTR(name), RVAL2CSTR(action), RVAL2GFLAGS(type, GTK_TYPE_UI_MANAGER_ITEM_TYPE), RVAL2CBOOL(top)); } if (ret == 0) RAISE_GERROR(error); return UINT2NUM(ret); } static VALUE rg_new_merge_id(VALUE self) { return UINT2NUM(gtk_ui_manager_new_merge_id(_SELF(self))); } static VALUE rg_remove_ui(VALUE self, VALUE merge_id) { gtk_ui_manager_remove_ui(_SELF(self), NUM2UINT(merge_id)); return self; } static VALUE rg_ensure_update(VALUE self) { gtk_ui_manager_ensure_update(_SELF(self)); return self; } static void rbuimanager_mark(void *p) { GtkUIManager *manager; GList *node; manager = GTK_UI_MANAGER(p); for (node = gtk_ui_manager_get_action_groups(manager); node; node = g_list_next(node)) { GtkWidget *action_group = node->data; rbgobj_gc_mark_instance(action_group); } rbgobj_gc_mark_instance(gtk_ui_manager_get_accel_group(manager)); } void Init_gtk_uimanager(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS_WITH_GC_FUNC(GTK_TYPE_UI_MANAGER, "UIManager", mGtk, rbuimanager_mark, NULL); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(insert_action_group, 2); RG_DEF_METHOD(remove_action_group, 1); RG_DEF_METHOD(action_groups, 0); RG_DEF_METHOD(accel_group, 0); RG_DEF_METHOD(get_widget, 1); RG_DEF_ALIAS("[]", "get_widget"); RG_DEF_METHOD(get_toplevels, 1); RG_DEF_METHOD(get_action, 1); RG_DEF_METHOD(add_ui, -1); RG_DEF_METHOD(new_merge_id, 0); RG_DEF_METHOD(remove_ui, 1); RG_DEF_METHOD(ensure_update, 0); /* GtkUIManagerItemType */ G_DEF_CLASS(GTK_TYPE_UI_MANAGER_ITEM_TYPE, "ItemType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_UI_MANAGER_ITEM_TYPE, "GTK_UI_MANAGER_"); } ������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkiconview.c�������������������������������������������������0000644�0001750�0001750�00000020131�12257552167�020162� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cIconView #define _SELF(s) (GTK_ICON_VIEW(RVAL2GOBJ(s))) static ID id_model; static ID id_select_path; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE model; rb_scan_args(argc, argv, "01", &model); if (NIL_P(model)){ RBGTK_INITIALIZE(self, gtk_icon_view_new()); } else { G_CHILD_SET(self, id_model, model); RBGTK_INITIALIZE(self, gtk_icon_view_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model)))); } return Qnil; } static VALUE rg_get_path_at_pos(VALUE self, VALUE x, VALUE y) { return GTKTREEPATH2RVAL(gtk_icon_view_get_path_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y))); } static void iview_foreach_func(GtkIconView *iview, GtkTreePath *path, gpointer *func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(iview), GTKTREEPATH2RVAL(path)); } static VALUE rg_selected_each(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_icon_view_selected_foreach(_SELF(self), (GtkIconViewForeachFunc)iview_foreach_func, (gpointer)func); return self; } static VALUE rg_select_path(VALUE self, VALUE path) { G_CHILD_SET(self, id_select_path, path); gtk_icon_view_select_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_unselect_path(VALUE self, VALUE path) { G_CHILD_UNSET(self, id_select_path); gtk_icon_view_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_path_is_selected_p(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_icon_view_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_selected_items(VALUE self) { GList* list = gtk_icon_view_get_selected_items(_SELF(self)); VALUE ret = GLIST2ARY2(list, GTK_TYPE_TREE_PATH); g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL); g_list_free(list); return ret; } static VALUE rg_item_activated(VALUE self, VALUE path) { gtk_icon_view_item_activated(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_create_drag_icon(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_icon_view_create_drag_icon(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_enable_model_drag_dest(VALUE self, VALUE rbtargets, VALUE rbactions) { GtkIconView *icon_view = _SELF(self); GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_icon_view_enable_model_drag_dest(icon_view, targets, n, actions); g_free(targets); return self; } static VALUE rg_enable_model_drag_source(VALUE self, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions) { GtkIconView *icon_view = _SELF(self); 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_icon_view_enable_model_drag_source(icon_view, start_button_mask, targets, n, actions); g_free(targets); return self; } static VALUE rg_cursor(VALUE self) { GtkTreePath* path; GtkCellRenderer* cell; gboolean cursor_set = gtk_icon_view_get_cursor(_SELF(self), &path, &cell); return cursor_set ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil; } static VALUE rg_get_dest_item(VALUE self, VALUE drag_x, VALUE drag_y) { GtkTreePath* path; GtkIconViewDropPosition pos; gboolean item_at_pos = gtk_icon_view_get_dest_item_at_pos(_SELF(self), NUM2INT(drag_x), NUM2INT(drag_y), &path, &pos); return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path), GENUM2RVAL(pos, GTK_TYPE_ICON_VIEW_DROP_POSITION)) : Qnil; } static VALUE rg_drag_dest_item(VALUE self) { GtkTreePath* path; GtkIconViewDropPosition pos; gtk_icon_view_get_drag_dest_item(_SELF(self), &path, &pos); return rb_assoc_new(GTKTREEPATH2RVAL(path), GENUM2RVAL(pos, GTK_TYPE_ICON_VIEW_DROP_POSITION)); } static VALUE rg_get_item(VALUE self, VALUE x, VALUE y) { GtkTreePath* path; GtkCellRenderer* cell; gboolean item_at_pos = gtk_icon_view_get_item_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y), &path, &cell); return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil; } static VALUE rg_visible_range(VALUE self) { GtkTreePath* start_path; GtkTreePath* end_path; gboolean valid_paths = gtk_icon_view_get_visible_range(_SELF(self), &start_path, &end_path); return valid_paths ? rb_assoc_new(GTKTREEPATH2RVAL(start_path), GTKTREEPATH2RVAL(end_path)) : Qnil; } static VALUE rg_scroll_to_path(VALUE self, VALUE path, VALUE use_align, VALUE row_align, VALUE col_align) { gtk_icon_view_scroll_to_path(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2CBOOL(use_align), NUM2DBL(row_align), NUM2DBL(col_align)); return self; } static VALUE rg_set_cursor(VALUE self, VALUE path, VALUE cell, VALUE start_editing) { gtk_icon_view_set_cursor(_SELF(self), RVAL2GTKTREEPATH(path), NIL_P(cell) ? NULL : RVAL2GOBJ(cell), RVAL2CBOOL(start_editing)); return self; } static VALUE rg_set_drag_dest_item(VALUE self, VALUE path, VALUE pos) { gtk_icon_view_set_drag_dest_item(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), RVAL2GENUM(pos, GTK_TYPE_ICON_VIEW_DROP_POSITION)); return self; } static VALUE rg_unset_model_drag_dest(VALUE self) { gtk_icon_view_unset_model_drag_dest(_SELF(self)); return self; } static VALUE rg_unset_model_drag_source(VALUE self) { gtk_icon_view_unset_model_drag_source(_SELF(self)); return self; } void Init_gtk_iconview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_VIEW, "IconView", mGtk); id_model = rb_intern("model"); id_select_path = rb_intern("select_path"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(get_path_at_pos, 2); RG_DEF_ALIAS("get_path", "get_path_at_pos"); RG_DEF_METHOD(selected_each, 0); RG_DEF_METHOD(select_path, 1); RG_DEF_METHOD(unselect_path, 1); RG_DEF_METHOD_P(path_is_selected, 1); RG_DEF_METHOD(selected_items, 0); RG_DEF_METHOD(item_activated, 1); RG_DEF_METHOD(create_drag_icon, 1); RG_DEF_METHOD(enable_model_drag_dest, 2); RG_DEF_METHOD(enable_model_drag_source, 3); RG_DEF_METHOD(cursor, 0); RG_DEF_METHOD(get_dest_item, 2); RG_DEF_METHOD(drag_dest_item, 0); RG_DEF_METHOD(get_item, 2); RG_DEF_METHOD(visible_range, 0); RG_DEF_METHOD(scroll_to_path, 4); RG_DEF_METHOD(set_cursor, 3); RG_DEF_METHOD(set_drag_dest_item, 2); RG_DEF_METHOD(unset_model_drag_dest, 0); RG_DEF_METHOD(unset_model_drag_source, 0); /* GtkIconViewDropPosition */ G_DEF_CLASS(GTK_TYPE_ICON_VIEW_DROP_POSITION, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_ICON_VIEW_DROP_POSITION, "GTK_ICON_VIEW_"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreeview.c�������������������������������������������������0000644�0001750�0001750�00000057100�12257552167�020177� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTreeView #define _SELF(s) (GTK_TREE_VIEW(RVAL2GOBJ(s))) #define TREEVIEW_COL(c) (GTK_TREE_VIEW_COLUMN(RVAL2GOBJ(c))) #define RVAL2CELLRENDERER(c) (GTK_CELL_RENDERER(RVAL2GOBJ(c))) static ID id_model; static ID id_selection; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE model; GtkWidget *widget; if (rb_scan_args(argc, argv, "01", &model) == 1) { G_CHILD_SET(self, id_model, model); widget = gtk_tree_view_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model))); } else { widget = gtk_tree_view_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_selection(VALUE self) { VALUE ret = GOBJ2RVAL(gtk_tree_view_get_selection(_SELF(self))); G_CHILD_SET(self, id_selection, ret); return ret; } static VALUE rg_columns_autosize(VALUE self) { gtk_tree_view_columns_autosize(_SELF(self)); return self; } static VALUE rg_append_column(VALUE self, VALUE column) { G_CHILD_ADD(self, column); return INT2NUM(gtk_tree_view_append_column(_SELF(self), TREEVIEW_COL(column))); } static VALUE rg_remove_column(VALUE self, VALUE column) { G_CHILD_REMOVE(self, column); return INT2NUM(gtk_tree_view_remove_column(_SELF(self), TREEVIEW_COL(column))); } static void cell_data_func(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { iter->user_data3 = model; rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(column), GOBJ2RVAL(cell), GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); } static VALUE rg_insert_column(int argc, VALUE *argv, VALUE self) { VALUE args[4]; rb_scan_args(argc, argv, "22", /* NORMAL ATTRIBUTES DATA_FUNC */ &args[0], /* column position position */ &args[1], /* position title title */ &args[2], /* renderer renderer */ &args[3]); /* attributes */ if (argc == 2) { G_CHILD_ADD(self, args[0]); return INT2NUM(gtk_tree_view_insert_column(_SELF(self), TREEVIEW_COL(args[0]), NUM2INT(args[1]))); } else if (argc == 3) { int ret; VALUE func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_tree_view_insert_column_with_data_func(_SELF(self), NUM2INT(args[0]), RVAL2CSTR(args[1]), RVAL2CELLRENDERER(args[2]), (GtkTreeCellDataFunc)cell_data_func, (gpointer)func, NULL); return INT2NUM(ret); } else if (argc == 4) { int i; int col; int ret; const gchar *name; VALUE ary; GtkCellRenderer* renderer = RVAL2CELLRENDERER(args[2]); GtkTreeViewColumn* column = gtk_tree_view_column_new(); Check_Type(args[3], T_HASH); /* TODO: Should this really be done before we know that everything * below worked without error? */ G_CHILD_ADD(self, args[2]); G_CHILD_ADD(self, args[3]); gtk_tree_view_column_set_title(column, RVAL2CSTR(args[1])); gtk_tree_view_column_pack_start(column, renderer, TRUE); ret = gtk_tree_view_insert_column(_SELF(self), column, NUM2INT(args[0])); ary = rb_funcall(args[3], rb_intern("to_a"), 0); for (i = 0; i < RARRAY_LEN(ary); i++) { VALUE val = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(val)) { name = rb_id2name(SYM2ID(val)); } else { name = RVAL2CSTR(val); } col = NUM2INT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); gtk_tree_view_column_add_attribute(column, renderer, name, col); } return INT2NUM(ret); } else { rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc); } return Qnil; } static VALUE rg_get_column(VALUE self, VALUE num) { return GOBJ2RVAL(gtk_tree_view_get_column(_SELF(self), NUM2INT(num))); } static VALUE rg_columns(VALUE self) { return GLIST2ARYF(gtk_tree_view_get_columns(_SELF(self))); } static VALUE rg_move_column_after(VALUE self, VALUE column, VALUE base_column) { gtk_tree_view_move_column_after(_SELF(self), TREEVIEW_COL(column), NIL_P(base_column) ? NULL : TREEVIEW_COL(base_column)); return self; } static gboolean column_drop_func(GtkTreeView *treeview, GtkTreeViewColumn *column, GtkTreeViewColumn *prev_column, GtkTreeViewColumn *next_column, gpointer func) { return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(treeview), GOBJ2RVAL(column), GOBJ2RVAL(prev_column), GOBJ2RVAL(next_column))); } static VALUE rg_set_column_drag_function(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_set_column_drag_function(_SELF(self), (GtkTreeViewColumnDropFunc)column_drop_func, (gpointer)func, NULL); return self; } static VALUE rg_scroll_to_point(VALUE self, VALUE x, VALUE y) { gtk_tree_view_scroll_to_point(_SELF(self), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_scroll_to_cell(VALUE self, VALUE path, VALUE column, VALUE use_align, VALUE row_align, VALUE col_align) { gtk_tree_view_scroll_to_cell(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), NIL_P(column) ? NULL : TREEVIEW_COL(column), RVAL2CBOOL(use_align), NUM2DBL(row_align), NUM2DBL(col_align)); return self; } static VALUE rg_set_cursor(VALUE self, VALUE path, VALUE focus_column, VALUE start_editing) { gtk_tree_view_set_cursor(_SELF(self), RVAL2GTKTREEPATH(path), NIL_P(focus_column) ? NULL : TREEVIEW_COL(focus_column), RVAL2CBOOL(start_editing)); return self; } static VALUE rg_cursor(VALUE self) { GtkTreePath* path; GtkTreeViewColumn* focus_column; gtk_tree_view_get_cursor(_SELF(self), &path, &focus_column); return rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, GOBJ2RVAL(focus_column)); } static VALUE rg_expand_all(VALUE self) { gtk_tree_view_expand_all(_SELF(self)); return self; } static VALUE rg_collapse_all(VALUE self) { gtk_tree_view_collapse_all(_SELF(self)); return self; } static VALUE rg_expand_row(VALUE self, VALUE path, VALUE open_all) { return CBOOL2RVAL(gtk_tree_view_expand_row(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2CBOOL(open_all))); } static VALUE rg_expand_to_path(VALUE self, VALUE path) { gtk_tree_view_expand_to_path(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_collapse_row(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_tree_view_collapse_row(_SELF(self), RVAL2GTKTREEPATH(path))); } static void mapping_func(GtkTreeView *treeview, GtkTreePath *path, gpointer func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(treeview), GTKTREEPATH2RVAL(path)); } static VALUE rg_map_expanded_rows(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_map_expanded_rows(_SELF(self), (GtkTreeViewMappingFunc)mapping_func, (gpointer)func); return self; } static VALUE rg_row_expanded_p(VALUE self, VALUE path) { return CBOOL2RVAL(gtk_tree_view_row_expanded(_SELF(self), RVAL2GTKTREEPATH(path))); } static VALUE rg_get_path_at_pos(VALUE self, VALUE x, VALUE y) { GtkTreePath* path; GtkTreeViewColumn* column; gint cell_x, cell_y; gboolean ret; ret = gtk_tree_view_get_path_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y), &path, &column, &cell_x, &cell_y); return ret ? rb_ary_new3(4, path ? GTKTREEPATH2RVAL(path) : Qnil, column ? GOBJ2RVAL(column) : Qnil, INT2NUM(cell_x), INT2NUM(cell_y)) : Qnil; } static VALUE rg_get_cell_area(VALUE self, VALUE path, VALUE column) { GdkRectangle rect; gtk_tree_view_get_cell_area(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), NIL_P(column) ? NULL : TREEVIEW_COL(column), &rect); return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE); } static VALUE rg_get_background_area(VALUE self, VALUE path, VALUE column) { GdkRectangle rect; gtk_tree_view_get_background_area(_SELF(self), NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path), NIL_P(column) ? NULL : TREEVIEW_COL(column), &rect); return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE); } static VALUE rg_visible_rect(VALUE self) { GdkRectangle rect; gtk_tree_view_get_visible_rect(_SELF(self), &rect); return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE); } static VALUE rg_visible_range(VALUE self) { GtkTreePath* start_path; GtkTreePath* end_path; gboolean valid_paths = gtk_tree_view_get_visible_range(_SELF(self), &start_path, &end_path); return valid_paths ? rb_assoc_new(GTKTREEPATH2RVAL(start_path), GTKTREEPATH2RVAL(end_path)) : Qnil; } static VALUE rg_bin_window(VALUE self) { return GOBJ2RVAL(gtk_tree_view_get_bin_window(_SELF(self))); } static VALUE rg_widget_to_tree_coords(VALUE self, VALUE wx, VALUE wy) { gint tx, ty; gtk_tree_view_widget_to_tree_coords(_SELF(self), NUM2INT(wx), NUM2INT(wy), &tx, &ty); return rb_ary_new3(2, INT2NUM(tx), INT2NUM(ty)); } static VALUE rg_tree_to_widget_coords(VALUE self, VALUE tx, VALUE ty) { gint wx, wy; gtk_tree_view_tree_to_widget_coords(_SELF(self), NUM2INT(tx), NUM2INT(ty), &wx, &wy); return rb_ary_new3(2, INT2NUM(wx), INT2NUM(wy)); } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_convert_bin_window_to_tree_coords(VALUE self, VALUE bx, VALUE by) { gint tx, ty; gtk_tree_view_convert_bin_window_to_tree_coords(_SELF(self), NUM2INT(bx), NUM2INT(by), &tx, &ty); return rb_ary_new3(2, INT2NUM(tx), INT2NUM(ty)); } static VALUE rg_convert_bin_window_to_widget_coords(VALUE self, VALUE bx, VALUE by) { gint wx, wy; gtk_tree_view_convert_bin_window_to_widget_coords(_SELF(self), NUM2INT(bx), NUM2INT(by), &wx, &wy); return rb_ary_new3(2, INT2NUM(wx), INT2NUM(wy)); } static VALUE rg_convert_tree_to_bin_window_coords(VALUE self, VALUE tx, VALUE ty) { gint bx, by; gtk_tree_view_convert_tree_to_bin_window_coords(_SELF(self), NUM2INT(tx), NUM2INT(ty), &bx, &by); return rb_ary_new3(2, INT2NUM(bx), INT2NUM(by)); } static VALUE rg_convert_tree_to_widget_coords(VALUE self, VALUE tx, VALUE ty) { gint wx, wy; gtk_tree_view_convert_tree_to_widget_coords(_SELF(self), NUM2INT(tx), NUM2INT(ty), &wx, &wy); return rb_ary_new3(2, INT2NUM(wx), INT2NUM(wy)); } static VALUE rg_convert_widget_to_bin_window_coords(VALUE self, VALUE wx, VALUE wy) { gint bx, by; gtk_tree_view_convert_widget_to_bin_window_coords(_SELF(self), NUM2INT(wx), NUM2INT(wy), &bx, &by); return rb_ary_new3(2, INT2NUM(bx), INT2NUM(by)); } static VALUE rg_convert_widget_to_tree_coords(VALUE self, VALUE wx, VALUE wy) { gint tx, ty; gtk_tree_view_convert_widget_to_tree_coords(_SELF(self), NUM2INT(wx), NUM2INT(wy), &tx, &ty); return rb_ary_new3(2, INT2NUM(tx), INT2NUM(ty)); } #endif static VALUE rg_enable_model_drag_dest(VALUE self, VALUE rbtargets, VALUE rbactions) { GtkTreeView *view = _SELF(self); GdkDragAction actions = RVAL2GFLAGS(rbactions, GDK_TYPE_DRAG_ACTION); long n; GtkTargetEntry *targets = RVAL2GTKTARGETENTRIES(rbtargets, &n); gtk_tree_view_enable_model_drag_dest(view, targets, n, actions); g_free(targets); return self; } static VALUE rg_enable_model_drag_source(VALUE self, VALUE rbstart_button_mask, VALUE rbtargets, VALUE rbactions) { GtkTreeView *view = _SELF(self); 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_ACCEPT_NIL(rbtargets, &n); if (targets == NULL) return self; gtk_tree_view_enable_model_drag_source(view, start_button_mask, targets, n, actions); g_free(targets); return self; } static VALUE rg_unset_rows_drag_source(VALUE self) { gtk_tree_view_unset_rows_drag_source(_SELF(self)); return self; } static VALUE rg_unset_rows_drag_dest(VALUE self) { gtk_tree_view_unset_rows_drag_dest(_SELF(self)); return self; } static VALUE rg_set_drag_dest_row(VALUE self, VALUE path, VALUE pos) { gtk_tree_view_set_drag_dest_row(_SELF(self), NIL_P(path)?NULL:RVAL2GTKTREEPATH(path), RVAL2GENUM(pos, GTK_TYPE_TREE_VIEW_DROP_POSITION)); return self; } static VALUE rg_drag_dest_row(VALUE self) { GtkTreePath* path = NULL; GtkTreeViewDropPosition pos; gtk_tree_view_get_drag_dest_row(_SELF(self), &path, &pos); return rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, GENUM2RVAL(pos, GTK_TYPE_TREE_VIEW_DROP_POSITION)); } static VALUE rg_get_dest_row_at_pos(VALUE self, VALUE drag_x, VALUE drag_y) { GtkTreePath* path; GtkTreeViewDropPosition pos; gboolean ret; ret = gtk_tree_view_get_dest_row_at_pos(_SELF(self), NUM2INT(drag_x), NUM2INT(drag_y), &path, &pos); return ret ? rb_ary_new3(2, path ? GTKTREEPATH2RVAL(path) : Qnil, GENUM2RVAL(pos, GTK_TYPE_TREE_VIEW_DROP_POSITION)) : Qnil; } static VALUE rg_create_row_drag_icon(VALUE self, VALUE path) { return GOBJ2RVAL(gtk_tree_view_create_row_drag_icon(_SELF(self), RVAL2GTKTREEPATH(path))); } /* We don't need this. GtkTreeViewSearchEqualFunc gtk_tree_view_get_search_equal_func (GtkTreeView *tree_view); */ static gboolean search_equal_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer func) { iter->user_data3 = model; return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(model), INT2NUM(column), CSTR2RVAL(key), GTKTREEITER2RVAL(iter))); } static VALUE rg_set_search_equal_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_set_search_equal_func(_SELF(self), (GtkTreeViewSearchEqualFunc)search_equal_func, (gpointer)func, NULL); return self; } /* * Optional Signals */ static VALUE treeview_signal_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkTreeView* view = g_value_get_object(&values[0]); GtkTreeIter* iter = g_value_get_boxed(&values[1]); iter->user_data3 = gtk_tree_view_get_model(view); return rb_ary_new3(3, GOBJ2RVAL(view), GTKTREEITER2RVAL(iter), GVAL2RVAL(&values[2])); } static VALUE rg_set_cursor_on_cell(VALUE self, VALUE path, VALUE focus_column, VALUE focus_cell, VALUE start_editing) { gtk_tree_view_set_cursor_on_cell(_SELF(self), RVAL2GTKTREEPATH(path), NIL_P(focus_column) ? NULL : TREEVIEW_COL(focus_column), NIL_P(focus_cell) ? NULL : GTK_CELL_RENDERER(RVAL2GOBJ(focus_cell)), RVAL2CBOOL(start_editing)); return self; } /* How can I implement this? GtkTreeViewRowSeparatorFunc gtk_tree_view_get_row_separator_func (GtkTreeView *tree_view); */ static gboolean row_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { VALUE ret; iter->user_data3 = model; ret = rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); return CBOOL2RVAL(ret); } static VALUE rg_set_row_separator_func(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_tree_view_set_row_separator_func(_SELF(self), row_separator_func, (gpointer)func, (GtkDestroyNotify)NULL); return self; } static VALUE rg_search_entry(VALUE self) { return GOBJ2RVAL(gtk_tree_view_get_search_entry(_SELF(self))); } static VALUE rg_set_search_entry(VALUE self, VALUE entry) { gtk_tree_view_set_search_entry(_SELF(self), RVAL2GOBJ(entry)); return self; } /* Can't define this. GtkTreeViewSearchPositionFunc gtk_tree_view_get_search_position_func (GtkTreeView *tree_view); */ struct callback_arg { VALUE callback; VALUE tree_view; VALUE search_dialog; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; rb_funcall(arg->callback, id_call, 2, arg->tree_view, arg->search_dialog); return Qnil; } static void search_position_func(GtkTreeView *tree_view, GtkWidget *search_dialog, gpointer func) { struct callback_arg arg; arg.callback = (VALUE)func; arg.tree_view = GOBJ2RVAL(tree_view); arg.search_dialog = GOBJ2RVAL(search_dialog); G_PROTECT_CALLBACK(invoke_callback, &arg); } static void remove_callback_reference(gpointer data) { G_CHILD_REMOVE(mGtk, (VALUE)data); } static VALUE rg_set_search_position_func(VALUE self) { VALUE func = rb_block_proc(); G_CHILD_ADD(mGtk, func); gtk_tree_view_set_search_position_func(_SELF(self), (GtkTreeViewSearchPositionFunc)search_position_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; } void Init_gtk_treeview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_VIEW, "TreeView", mGtk); id_selection = rb_intern("selection"); id_model = rb_intern("model"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(selection, 0); RG_DEF_METHOD(columns_autosize, 0); RG_DEF_METHOD(append_column, 1); RG_DEF_METHOD(remove_column, 1); RG_DEF_METHOD(insert_column, -1); RG_DEF_METHOD(get_column, 1); RG_DEF_METHOD(columns, 0); RG_DEF_METHOD(move_column_after, 2); RG_DEF_METHOD(set_column_drag_function, 0); RG_DEF_METHOD(scroll_to_point, 2); RG_DEF_METHOD(scroll_to_cell, 5); RG_DEF_METHOD(set_cursor, 3); RG_DEF_METHOD(cursor, 0); RG_DEF_METHOD(expand_all, 0); RG_DEF_METHOD(collapse_all, 0); RG_DEF_METHOD(expand_row, 2); RG_DEF_METHOD(collapse_row, 1); RG_DEF_METHOD(expand_to_path, 1); RG_DEF_METHOD(map_expanded_rows, 0); RG_DEF_METHOD_P(row_expanded, 1); RG_DEF_METHOD(get_path_at_pos, 2); RG_DEF_ALIAS("get_path", "get_path_at_pos"); RG_DEF_METHOD(get_cell_area, 2); RG_DEF_METHOD(get_background_area, 2); RG_DEF_METHOD(visible_rect, 0); RG_DEF_METHOD(visible_range, 0); RG_DEF_METHOD(bin_window, 0); RG_DEF_METHOD(widget_to_tree_coords, 2); RG_DEF_METHOD(tree_to_widget_coords, 2); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(convert_bin_window_to_tree_coords, 2); RG_DEF_METHOD(convert_bin_window_to_widget_coords, 2); RG_DEF_METHOD(convert_tree_to_bin_window_coords, 2); RG_DEF_METHOD(convert_tree_to_widget_coords, 2); RG_DEF_METHOD(convert_widget_to_bin_window_coords, 2); RG_DEF_METHOD(convert_widget_to_tree_coords, 2); #endif RG_DEF_METHOD(enable_model_drag_dest, 2); RG_DEF_METHOD(enable_model_drag_source, 3); RG_DEF_METHOD(unset_rows_drag_source, 0); RG_DEF_METHOD(unset_rows_drag_dest, 0); RG_DEF_METHOD(set_drag_dest_row, 2); RG_DEF_METHOD(drag_dest_row, 0); RG_DEF_METHOD(get_dest_row_at_pos, 2); RG_DEF_ALIAS("get_dest_row", "get_dest_row_at_pos"); RG_DEF_METHOD(create_row_drag_icon, 1); RG_DEF_METHOD(set_search_equal_func, 0); RG_DEF_METHOD(set_cursor_on_cell, 4); RG_DEF_METHOD(set_row_separator_func, 0); RG_DEF_METHOD(search_entry, 0); RG_DEF_METHOD(set_search_entry, 1); RG_DEF_METHOD(set_search_position_func, 0); /* Constants */ G_DEF_CLASS(GTK_TYPE_TREE_VIEW_DROP_POSITION, "DropPosition", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TREE_VIEW_DROP_POSITION, "GTK_TREE_VIEW_"); /* GtkTreeViewGridLines */ G_DEF_CLASS(GTK_TYPE_TREE_VIEW_GRID_LINES, "GridLines", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TREE_VIEW_GRID_LINES, "GTK_TREE_VIEW_"); /* Option Signals */ G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row-collapsed", (GValToRValSignalFunc)treeview_signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row-expanded", (GValToRValSignalFunc)treeview_signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "test-collapse-row", (GValToRValSignalFunc)treeview_signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "test-expand-row", (GValToRValSignalFunc)treeview_signal_func); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmenu.c�����������������������������������������������������0000644�0001750�0001750�00000011525�12257552167�017312� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cMenu #define _SELF(self) (GTK_MENU(RVAL2GOBJ(self))) #define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_menu_new()); return Qnil; } static VALUE rg_set_screen(VALUE self, VALUE screen) { gtk_menu_set_screen(_SELF(self), GDK_SCREEN(RVAL2GOBJ(screen))); return self; } static VALUE rg_reorder_child(VALUE self, VALUE child, VALUE position) { gtk_menu_reorder_child(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), NUM2INT(position)); return self; } static VALUE rg_attach(VALUE self, VALUE child, VALUE left_attach, VALUE right_attach, VALUE top_attach, VALUE bottom_attach) { gtk_menu_attach(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), NUM2UINT(left_attach), NUM2UINT(right_attach), NUM2UINT(top_attach), NUM2UINT(bottom_attach)); return self; } static void menu_pos_func(GtkMenu *menu, gint *px, gint *py, gboolean *push_in, gpointer data) { VALUE arr = rb_funcall((VALUE)data, id_call, 4, GOBJ2RVAL(menu), INT2FIX(*px), INT2FIX(*py), CBOOL2RVAL(*push_in)); if (TYPE(arr) == T_ARRAY && (RARRAY_LEN(arr) == 2 || RARRAY_LEN(arr) == 3)){ *px = NUM2INT(RARRAY_PTR(arr)[0]); *py = NUM2INT(RARRAY_PTR(arr)[1]); if (RARRAY_LEN(arr) == 3) *push_in = RVAL2CBOOL(RARRAY_PTR(arr)[2]); } else { rb_raise(rb_eArgError, "block should return [x, y, push_in]"); } } /* the proc should return [x, y, push_in] */ static VALUE rg_popup(VALUE self, VALUE pshell, VALUE pitem, VALUE button, VALUE activate_time) { GtkWidget *gpshell = NULL; GtkWidget *gpitem = NULL; GtkMenuPositionFunc pfunc = NULL; gpointer data = NULL; VALUE func; if (rb_block_given_p()) { func = rb_block_proc(); pfunc = (GtkMenuPositionFunc)menu_pos_func; data = (gpointer)func; G_RELATIVE(self, func); } if (!NIL_P(pshell)){ gpshell = RVAL2WIDGET(pshell); } if (!NIL_P(pitem)) { gpitem = RVAL2WIDGET(pitem); } gtk_menu_popup(_SELF(self), gpshell, gpitem, pfunc, data, NUM2UINT(button), NUM2UINT(activate_time)); return self; } static VALUE rg_popdown(VALUE self) { gtk_menu_popdown(_SELF(self)); return self; } static VALUE rg_reposition(VALUE self) { gtk_menu_reposition(_SELF(self)); return self; } static VALUE menu_detacher; static void detach_func(GtkWidget *attach_widget, GtkMenu *menu) { rb_funcall((VALUE)menu_detacher, id_call, 2, GOBJ2RVAL(attach_widget), GOBJ2RVAL(menu)); } static VALUE rg_attach_to_widget(VALUE self, VALUE attach_widget) { menu_detacher = rb_block_proc(); G_RELATIVE(self, menu_detacher); gtk_menu_attach_to_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(attach_widget)), (GtkMenuDetachFunc)detach_func); return self; } static VALUE rg_detach(VALUE self) { gtk_menu_detach(_SELF(self)); return self; } static VALUE rg_s_get_for_attach_widget(G_GNUC_UNUSED VALUE self, VALUE widget) { /* Owned by GTK+ */ return GLIST2ARY(gtk_menu_get_for_attach_widget(GTK_WIDGET(RVAL2GOBJ(widget)))); } void Init_gtk_menu(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU, "Menu", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_screen, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "screen"); RG_DEF_METHOD(reorder_child, 2); RG_DEF_METHOD(attach, 5); RG_DEF_METHOD(popup, 4); RG_DEF_METHOD(popdown, 0); RG_DEF_METHOD(reposition, 0); RG_DEF_METHOD(detach, 0); RG_DEF_SMETHOD(get_for_attach_widget, 1); RG_DEF_METHOD(attach_to_widget, 1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkwindow.c���������������������������������������������������0000644�0001750�0001750�00000036267�12257552167�017667� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2002-2011 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 cWindow #define _SELF(s) (GTK_WINDOW(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg; GtkWindowType tp = GTK_WINDOW_TOPLEVEL; const gchar *title = NULL; GtkWidget* window = NULL; if (rb_scan_args(argc, argv, "01", &arg) == 1) { if (TYPE(arg) == T_STRING) { StringValue(arg); title = RVAL2CSTR(arg); } else { tp = RVAL2GENUM(arg, GTK_TYPE_WINDOW_TYPE); } } window = gtk_window_new(tp); if (title != NULL) gtk_window_set_title(GTK_WINDOW(window), title); RBGTK_INITIALIZE(self, window); return Qnil; } static VALUE rg_set_wmclass(VALUE self, VALUE wmclass_name, VALUE wmclass_class) { gtk_window_set_wmclass(_SELF(self), NIL_P(wmclass_name)?NULL:RVAL2CSTR(wmclass_name), NIL_P(wmclass_class)?NULL:RVAL2CSTR(wmclass_class)); return self; } static VALUE rg_add_accel_group(VALUE self, VALUE accel) { gtk_window_add_accel_group(_SELF(self), GTK_ACCEL_GROUP(RVAL2GOBJ(accel))); G_CHILD_ADD(self, accel); return self; } static VALUE rg_remove_accel_group(VALUE self, VALUE accel) { gtk_window_remove_accel_group(_SELF(self), GTK_ACCEL_GROUP(RVAL2GOBJ(accel))); G_CHILD_REMOVE(self, accel); return self; } static VALUE gwin_activate_focus(VALUE self) { return CBOOL2RVAL(gtk_window_activate_focus(_SELF(self))); } static VALUE gwin_activate_default(VALUE self) { return CBOOL2RVAL(gtk_window_activate_default(_SELF(self))); } static VALUE rg_active_focus(VALUE self) { rb_warning("Gtk::Window#active_focus is deprecated. Use Gtk::Window#activate_focus"); gtk_window_activate_focus(_SELF(self)); return self; } static VALUE rg_active_default(VALUE self) { rb_warning("Gtk::Window#active_default is deprecated. Use Gtk::Window#activate_default"); gtk_window_activate_default(_SELF(self)); return self; } static VALUE rg_set_default_size(VALUE self, VALUE w, VALUE h) { gtk_window_set_default_size(_SELF(self), NUM2INT(w), NUM2INT(h)); return self; } static VALUE rg_set_geometry_hints(VALUE self, VALUE geometry_widget, VALUE geometry, VALUE geom_mask) { gtk_window_set_geometry_hints(_SELF(self), GTK_WIDGET(RVAL2GOBJ(geometry_widget)), (GdkGeometry*)RVAL2BOXED(geometry, GDK_TYPE_GEOMETRY), RVAL2GFLAGS(geom_mask, GDK_TYPE_WINDOW_HINTS)); return self; } static VALUE rg_s_toplevels(G_GNUC_UNUSED VALUE self) { GList* list = gtk_window_list_toplevels(); VALUE ret = GLIST2ARY(list); g_list_foreach(list, (GFunc)g_object_ref, NULL); g_list_free(list); return ret; } static VALUE rg_add_mnemonic(VALUE self, VALUE keyval, VALUE target) { gtk_window_add_mnemonic(_SELF(self), NUM2INT(keyval), GTK_WIDGET(RVAL2GOBJ(target))); return self; } static VALUE rg_remove_mnemonic(VALUE self, VALUE keyval, VALUE target) { gtk_window_remove_mnemonic(_SELF(self), NUM2INT(keyval), GTK_WIDGET(RVAL2GOBJ(target))); return self; } static VALUE rg_mnemonic_activate(VALUE self, VALUE keyval, VALUE modifier) { return CBOOL2RVAL(gtk_window_mnemonic_activate(_SELF(self), NUM2INT(keyval), RVAL2GFLAGS(modifier, GDK_TYPE_MODIFIER_TYPE))); } static VALUE rg_focus(VALUE self) { return GOBJ2RVAL(gtk_window_get_focus(_SELF(self))); } static VALUE rg_set_focus(VALUE self, VALUE win) { gtk_window_set_focus(_SELF(self), NIL_P(win) ? NULL : GTK_WIDGET(RVAL2GOBJ(win))); return self; } static VALUE rg_set_default(VALUE self, VALUE win) { gtk_window_set_default(_SELF(self), NIL_P(win) ? NULL : GTK_WIDGET(RVAL2GOBJ(win))); return self; } static VALUE rg_present(int argc, VALUE *argv, VALUE self) { VALUE timestamp; if (rb_scan_args(argc, argv, "01", ×tamp) == 1) { gtk_window_present_with_time(_SELF(self), NUM2UINT(timestamp)); } else { gtk_window_present(_SELF(self)); } return self; } static VALUE rg_iconify(VALUE self) { gtk_window_iconify(_SELF(self)); return self; } static VALUE rg_deiconify(VALUE self) { gtk_window_deiconify(_SELF(self)); return self; } static VALUE rg_stick(VALUE self) { gtk_window_stick(_SELF(self)); return self; } static VALUE rg_unstick(VALUE self) { gtk_window_unstick(_SELF(self)); return self; } static VALUE rg_maximize(VALUE self) { gtk_window_maximize(_SELF(self)); return self; } static VALUE rg_unmaximize(VALUE self) { gtk_window_unmaximize(_SELF(self)); return self; } static VALUE rg_fullscreen(VALUE self) { gtk_window_fullscreen(_SELF(self)); return self; } static VALUE rg_unfullscreen(VALUE self) { gtk_window_unfullscreen(_SELF(self)); return self; } static VALUE rg_set_keep_above(VALUE self, VALUE setting) { gtk_window_set_keep_above(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_keep_below(VALUE self, VALUE setting) { gtk_window_set_keep_below(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_begin_resize_drag(VALUE self, VALUE edge, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp) { gtk_window_begin_resize_drag(_SELF(self), RVAL2GENUM(edge, GDK_TYPE_WINDOW_EDGE), NUM2INT(button), NUM2INT(root_x), NUM2INT(root_y), NUM2UINT(timestamp)); return self; } static VALUE rg_begin_move_drag(VALUE self, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp) { gtk_window_begin_move_drag(_SELF(self), NUM2INT(button), NUM2INT(root_x), NUM2INT(root_y), NUM2UINT(timestamp)); return self; } static VALUE rg_set_frame_dimensions(VALUE self, VALUE left, VALUE top, VALUE right, VALUE bottom) { gtk_window_set_frame_dimensions(_SELF(self), NUM2INT(left), NUM2INT(top), NUM2INT(right), NUM2INT(bottom)); return self; } static VALUE rg_set_has_frame(VALUE self, VALUE setting) { gtk_window_set_has_frame(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_mnemonic_modifier(VALUE self, VALUE modifier) { gtk_window_set_mnemonic_modifier(_SELF(self), RVAL2GFLAGS(modifier, GDK_TYPE_MODIFIER_TYPE)); return self; } static VALUE rg_s_default_icon_list(G_GNUC_UNUSED VALUE self) { return GLIST2ARYF(gtk_window_get_default_icon_list()); } static VALUE rg_default_size(VALUE self) { int width, height; gtk_window_get_default_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_frame_dimensions(VALUE self) { int left, top, right, bottom; gtk_window_get_frame_dimensions(_SELF(self), &left, &top, &right, &bottom); return rb_ary_new3(4, INT2NUM(left), INT2NUM(top), INT2NUM(right), INT2NUM(bottom)); } static VALUE rg_has_frame_p(VALUE self) { return CBOOL2RVAL(gtk_window_get_has_frame(_SELF(self))); } static VALUE rg_icon_list(VALUE self) { return GLIST2ARYF(gtk_window_get_icon_list(_SELF(self))); } static VALUE rg_mnemonic_modifier(VALUE self) { return GFLAGS2RVAL(gtk_window_get_mnemonic_modifier(_SELF(self)), GDK_TYPE_MODIFIER_TYPE); } static VALUE rg_position(VALUE self) { int root_x, root_y; gtk_window_get_position(_SELF(self), &root_x, &root_y); return rb_ary_new3(2, INT2NUM(root_x), INT2NUM(root_y)); } static VALUE rg_size(VALUE self) { int width, height; gtk_window_get_size(_SELF(self), &width, &height); return rb_ary_new3(2, INT2NUM(width), INT2NUM(height)); } static VALUE rg_group(VALUE self) { return GOBJ2RVAL(gtk_window_get_group(_SELF(self))); } static VALUE rg_move(VALUE self, VALUE x, VALUE y) { gtk_window_move(_SELF(self), NUM2INT(x), NUM2INT(y)); return self; } static VALUE rg_parse_geometry(VALUE self, VALUE geometry) { return CBOOL2RVAL(gtk_window_parse_geometry(_SELF(self), RVAL2CSTR(geometry))); } static VALUE rg_reshow_with_initial_size(VALUE self) { gtk_window_reshow_with_initial_size(_SELF(self)); return self; } static VALUE rg_resize(VALUE self, VALUE width, VALUE height) { gtk_window_resize(_SELF(self), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_s_set_default_icon_list(G_GNUC_UNUSED VALUE self, VALUE rblist) { GList *list = RVAL2GDKPIXBUFGLIST(rblist); gtk_window_set_default_icon_list(list); g_list_free(list); return rblist; } static VALUE rg_s_set_default_icon(VALUE self, VALUE icon_or_filename) { if (TYPE(icon_or_filename) == T_STRING){ GError* err; gboolean ret = gtk_window_set_default_icon_from_file(RVAL2CSTR(icon_or_filename), &err); if (! ret) RAISE_GERROR(err); } else { gtk_window_set_default_icon(GDK_PIXBUF(RVAL2GOBJ(icon_or_filename))); } return self; } static VALUE rg_s_set_default_icon_name(VALUE self, VALUE name) { gtk_window_set_default_icon_name(RVAL2CSTR(name)); return self; } static VALUE gwin_set_icon(VALUE self, VALUE icon_or_filename) { if (TYPE(icon_or_filename) == T_STRING){ GError* err; gboolean ret = gtk_window_set_icon_from_file(_SELF(self), RVAL2CSTR(icon_or_filename), &err); if (! ret) RAISE_GERROR(err); } else { gtk_window_set_icon(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(icon_or_filename))); } return self; } static VALUE rg_set_icon_list(VALUE self, VALUE rblist) { GtkWindow *window = _SELF(self); GList *list = RVAL2GDKPIXBUFGLIST(rblist); gtk_window_set_icon_list(window, list); g_list_free(list); /* TODO: Shouldn't we return self? */ return rblist; } static VALUE rg_s_set_auto_startup_notification(VALUE self, VALUE setting) { gtk_window_set_auto_startup_notification(RVAL2CBOOL(setting)); return self; } /* They are not public methods. static VALUE rg_decorated_window_init(VALUE self) { gtk_decorated_window_init(_SELF(self)); return self; } static VALUE rg_decorated_window_calculate_frame_size(VALUE self) { gtk_decorated_window_calculate_frame_size(_SELF(self)); return self; } static VALUE rg_decorated_window_set_title(VALUE self, VALUE title) { gtk_decorated_window_set_title(_SELF(self), RVAL2CSTR(title)); return self; } static VALUE rg_decorated_window_move_resize_window(VALUE self) { int x, y, width, height; gtk_decorated_window_move_resize_window(_SELF(self), &x, &y, &width, &height); return rb_ary_new3(4, INT2NUM(x), INT2NUM(y), INT2NUM(width), INT2NUM(height)); } */ static void mark_toplevels(G_GNUC_UNUSED void *_) { GList* list = gtk_window_list_toplevels(); GList* p; for (p = list; p; p = g_list_next(p)) rbgobj_gc_mark_instance(p->data); g_list_free(list); } void Init_gtk_window(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WINDOW, "Window", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_wmclass, 2); RG_DEF_METHOD(add_accel_group, 1); RG_DEF_METHOD(remove_accel_group, 1); /* active_(focus|default) are deprecated. Use activate_* instead. */ RG_DEF_METHOD(active_focus, 0); RG_DEF_METHOD(active_default, 0); G_REPLACE_ACTION(RG_TARGET_NAMESPACE, "activate_focus", gwin_activate_focus, 0); G_REPLACE_ACTION(RG_TARGET_NAMESPACE, "activate_default", gwin_activate_default, 0); RG_DEF_METHOD(set_default_size, 2); RG_DEF_METHOD(set_geometry_hints, 3); RG_DEF_SMETHOD(toplevels, 0); RG_DEF_METHOD(add_mnemonic, 2); RG_DEF_METHOD(remove_mnemonic, 2); RG_DEF_METHOD(mnemonic_activate, 2); RG_DEF_METHOD(focus, 0); RG_DEF_METHOD(set_focus, 1); RG_DEF_METHOD(set_default, 1); RG_DEF_METHOD(present, -1); RG_DEF_METHOD(iconify, 0); RG_DEF_METHOD(deiconify, 0); RG_DEF_METHOD(stick, 0); RG_DEF_METHOD(unstick, 0); RG_DEF_METHOD(maximize, 0); RG_DEF_METHOD(unmaximize, 0); RG_DEF_METHOD(fullscreen, 0); RG_DEF_METHOD(unfullscreen, 0); RG_DEF_METHOD(set_keep_above, 1); RG_DEF_METHOD(set_keep_below, 1); RG_DEF_METHOD(begin_resize_drag, 5); RG_DEF_METHOD(begin_move_drag, 4); RG_DEF_METHOD(set_frame_dimensions, 4); RG_DEF_METHOD(set_mnemonic_modifier, 1); RG_DEF_METHOD(default_size, 0); RG_DEF_SMETHOD(default_icon_list, 0); RG_DEF_METHOD(frame_dimensions, 0); RG_DEF_METHOD(set_has_frame, 1); RG_DEF_METHOD_P(has_frame, 0); RG_DEF_METHOD(icon_list, 0); RG_DEF_METHOD(mnemonic_modifier, 0); RG_DEF_METHOD(position, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(group, 0); RG_DEF_METHOD(move, 2); RG_DEF_METHOD(parse_geometry, 1); RG_DEF_METHOD(reshow_with_initial_size, 0); RG_DEF_METHOD(resize, 2); RG_DEF_SMETHOD(set_default_icon_list, 1); RG_DEF_SMETHOD(set_default_icon, 1); RG_DEF_SMETHOD(set_default_icon_name, 1); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "icon", gwin_set_icon, 1); RG_DEF_METHOD(set_icon_list, 1); RG_DEF_SMETHOD(set_auto_startup_notification, 1); /* RG_DEF_METHOD(decorated_window_init, 0); RG_DEF_METHOD(decorated_window_calculate_frame_size, 0); RG_DEF_METHOD(decorated_window_set_title, 1); RG_DEF_METHOD(decorated_window_move_resize_window, 0); */ G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkWindowPosition (from General constants) */ G_DEF_CLASS(GTK_TYPE_WINDOW_POSITION, "Position", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_WINDOW_POSITION, "GTK_WIN_"); /* GtkWindowType (from General constants) */ G_DEF_CLASS(GTK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_WINDOW_TYPE, "GTK_WINDOW_"); { static VALUE toplevels_marker; toplevels_marker = rb_data_object_alloc(rb_cData, NULL, mark_toplevels, NULL); rb_global_variable(&toplevels_marker); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrenderertoggle.c���������������������������������������0000644�0001750�0001750�00000002506�11701304107�022173� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkconst.c����������������������������������������������������0000644�0001750�0001750�00000014441�12257552167�017474� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ G_DEF_CLASS(GTK_TYPE_SCROLL_STEP, "ScrollStep", mGtk); G_DEF_CONSTANTS(mGtk, GTK_TYPE_SCROLL_STEP, "GTK_"); /* 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_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbindingset.c�����������������������������������������������0000644�0001750�0001750�00000013102�11701304107�020443� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkpagesetup.c������������������������������������������������0000644�0001750�0001750�00000013411�12257552167�020337� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cPageSetup #define _SELF(s) (GTK_PAGE_SETUP(RVAL2GOBJ(s))) #define RVAL2SIZE(o) (RVAL2BOXED(o, GTK_TYPE_PAPER_SIZE)) #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_page_setup_new()); return Qnil; } static VALUE rg_dup(VALUE self) { return GOBJ2RVALU(gtk_page_setup_copy(_SELF(self))); } static VALUE rg_orientation(VALUE self) { return GENUM2RVAL(gtk_page_setup_get_orientation(_SELF(self)), GTK_TYPE_PAGE_ORIENTATION); } static VALUE rg_set_orientation(VALUE self, VALUE orientation) { gtk_page_setup_set_orientation(_SELF(self), RVAL2GENUM(orientation, GTK_TYPE_PAGE_ORIENTATION)); return self; } static VALUE rg_paper_size(VALUE self) { return BOXED2RVAL(gtk_page_setup_get_paper_size(_SELF(self)), GTK_TYPE_PAPER_SIZE); } static VALUE rg_set_paper_size(VALUE self, VALUE paper_size) { gtk_page_setup_set_paper_size(_SELF(self), RVAL2SIZE(paper_size)); return self; } static VALUE rg_get_top_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_top_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_set_top_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_top_margin(_SELF(self), NUM2DBL(margin), RVAL2UNIT(unit)); return self; } static VALUE rg_get_bottom_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_bottom_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_set_bottom_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_bottom_margin(_SELF(self), NUM2DBL(margin), RVAL2UNIT(unit)); return self; } static VALUE rg_get_left_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_left_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_set_left_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_left_margin(_SELF(self), NUM2DBL(margin), RVAL2UNIT(unit)); return self; } static VALUE rg_get_right_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_right_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_set_right_margin(VALUE self, VALUE margin, VALUE unit) { gtk_page_setup_set_right_margin(_SELF(self), NUM2DBL(margin), RVAL2UNIT(unit)); return self; } static VALUE rg_set_paper_size_and_default_margins(VALUE self, VALUE size) { gtk_page_setup_set_paper_size_and_default_margins(_SELF(self), RVAL2SIZE(size)); return self; } /* These take orientation, but not margins into consideration */ static VALUE rg_get_paper_width(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_paper_width(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_get_paper_height(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_paper_height(_SELF(self), RVAL2UNIT(unit))); } /* These take orientation, and margins into consideration */ static VALUE rg_get_page_width(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_page_width(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_get_page_height(VALUE self, VALUE unit) { return rb_float_new(gtk_page_setup_get_page_height(_SELF(self), RVAL2UNIT(unit))); } void Init_gtk_page_setup(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP, "PageSetup", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(dup, 0); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(set_orientation, 1); RG_DEF_METHOD(paper_size, 0); RG_DEF_METHOD(set_paper_size, 1); RG_DEF_METHOD(get_top_margin, 1); RG_DEF_METHOD(set_top_margin, 2); RG_DEF_METHOD(get_bottom_margin, 1); RG_DEF_METHOD(set_bottom_margin, 2); RG_DEF_METHOD(get_left_margin, 1); RG_DEF_METHOD(set_left_margin, 2); RG_DEF_METHOD(get_right_margin, 1); RG_DEF_METHOD(set_right_margin, 2); RG_DEF_METHOD(set_paper_size_and_default_margins, 1); /* These take orientation, but not margins into consideration */ RG_DEF_METHOD(get_paper_width, 1); RG_DEF_METHOD(get_paper_height, 1); /* These take orientation, and margins into consideration */ RG_DEF_METHOD(get_page_width, 1); RG_DEF_METHOD(get_page_height, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkscrollbar.c������������������������������������������������0000644�0001750�0001750�00000002235�11701304107�020305� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" void Init_gtk_scrollbar(VALUE mGtk) { G_DEF_CLASS(GTK_TYPE_SCROLLBAR, "Scrollbar", mGtk); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcomboboxentry.c��������������������������������������������0000644�0001750�0001750�00000003734�12257552167�021243� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } void Init_gtk_comboboxentry(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COMBO_BOX_ENTRY, "ComboBoxEntry", mGtk); RG_DEF_METHOD(initialize, -1); } ������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkinput.c����������������������������������������������������0000644�0001750�0001750�00000004526�11701304107�017446� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/gtk2.def��������������������������������������������������������0000644�0001750�0001750�00000001355�11701304107�016455� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������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 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkcolormap.c�������������������������������������������������0000644�0001750�0001750�00000007606�12257552167�020147� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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))); } static VALUE rg_screen(VALUE self) { return GOBJ2RVAL(gdk_colormap_get_screen(_SELF(self))); } 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); RG_DEF_METHOD(screen, 0); RG_DEF_METHOD(colors, 0); } ��������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhruler.c���������������������������������������������������0000644�0001750�0001750�00000002543�11701304107�017625� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHRuler static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_hruler_new()); return Qnil; } void Init_gtk_hruler(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HRULER, "HRuler", mGtk); RG_DEF_METHOD(initialize, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkpagesetupunixdialog.c��������������������������������������0000644�0001750�0001750�00000005061�11701304107�022403� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #ifdef HAVE_GTK_UNIX_PRINT #include <gtk/gtkpagesetupunixdialog.h> #define RG_TARGET_NAMESPACE cPageSetupUnixDialog #define _SELF(s) (GTK_PAGE_SETUP_UNIX_DIALOG(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkWidget *dialog; VALUE title, parent; rb_scan_args(argc, argv, "02", &title, &parent); dialog = gtk_page_setup_unix_dialog_new(RVAL2CSTR_ACCEPT_NIL(title), RVAL2GOBJ(parent)); RBGTK_INITIALIZE(self, dialog); return Qnil; } static VALUE rg_set_page_setup(VALUE self, VALUE page_setup) { gtk_page_setup_unix_dialog_set_page_setup(_SELF(self), RVAL2GOBJ(page_setup)); return self; } static VALUE rg_page_setup(VALUE self) { return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_page_setup(_SELF(self))); } static VALUE rg_set_print_settings(VALUE self, VALUE print_settings) { gtk_page_setup_unix_dialog_set_print_settings(_SELF(self), RVAL2GOBJ(print_settings)); return Qnil; } static VALUE rg_print_settings(VALUE self) { return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_print_settings(_SELF(self))); } #endif void Init_gtk_page_setup_unix_dialog(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP_UNIX_DIALOG, "PageSetupUnixDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_page_setup, 1); RG_DEF_METHOD(page_setup, 0); RG_DEF_METHOD(set_print_settings, 1); RG_DEF_METHOD(print_settings, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkplug.c�����������������������������������������������������0000644�0001750�0001750�00000004702�11701304107�017272� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002 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" #ifdef HAVE_GTK_PLUG_GET_TYPE #define RG_TARGET_NAMESPACE cPlug static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE socket_id; GdkNativeWindow id; if (rb_scan_args(argc, argv, "01", &socket_id) == 0) id = 0; else { #ifdef GDK_NATIVE_WINDOW_POINTER id = GUINT_TO_POINTER(NUM2ULONG(socket_id)); #else id = NUM2UINT(socket_id); #endif } RBGTK_INITIALIZE(self, gtk_plug_new(id)); return Qnil; } /* GtkWidget* gtk_plug_new_for_display (GdkDisplay *display, GdkNativeWindow socket_id); void gtk_plug_construct_for_display (GtkPlug *plug, GdkDisplay *display, GdkNativeWindow socket_id); */ static VALUE rg_construct(VALUE self, VALUE socket_id) { #ifdef GDK_NATIVE_WINDOW_POINTER gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), GUINT_TO_POINTER(NUM2ULONG(socket_id))); #else gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), (guint32)NUM2UINT(socket_id)); #endif return self; } static VALUE rg_id(VALUE self) { GdkNativeWindow id = gtk_plug_get_id(GTK_PLUG(RVAL2GOBJ(self))); #ifdef GDK_NATIVE_WINDOW_POINTER return UINT2NUM(GPOINTER_TO_UINT(id)); #else return UINT2NUM(id); #endif } #endif /* HAVE_GTK_PLUG_GET_TYPE */ void Init_gtk_plug(VALUE mGtk) { #ifdef HAVE_GTK_PLUG_GET_TYPE VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PLUG, "Plug", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(construct, 1); RG_DEF_METHOD(id, 0); #endif } ��������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkborder.c���������������������������������������������������0000644�0001750�0001750�00000005256�12124610262�017607� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkstock.c����������������������������������������������������0000644�0001750�0001750�00000031240�12257552167�017465� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 KUBO Takehiro * * 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 mStock #define Check_Symbol(sym) do { \ if (!SYMBOL_P(sym)) \ rb_raise(rb_eArgError, "invalid argument %s (expect Symbol)", \ rb_class2name(CLASS_OF(sym))); \ } while (0) /* check whether sym is a Symbol or not in advance. */ #define SYM2CSTR(sym) rb_id2name(SYM2ID(sym)) #define CSTR2SYM(str) ID2SYM(rb_intern(str)) static VALUE rg_s_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE stock_id, label, modifier, keyval, translation_domain; GtkStockItem item; rb_scan_args(argc, argv, "23", &stock_id, &label, &modifier, &keyval, &translation_domain); Check_Symbol(stock_id); item.stock_id = (gchar *)SYM2CSTR(stock_id); item.label = (gchar *)RVAL2CSTR(label); item.modifier = NIL_P(modifier) ? 0 : NUM2UINT(modifier); item.keyval = NIL_P(keyval) ? 0 : NUM2UINT(keyval); item.translation_domain = NIL_P(translation_domain) ? NULL : (gchar *)RVAL2CSTR(translation_domain); gtk_stock_add(&item, 1); return Qnil; } static VALUE rg_s_lookup(G_GNUC_UNUSED VALUE self, VALUE stock_id) { GtkStockItem item; Check_Symbol(stock_id); if (gtk_stock_lookup(SYM2CSTR(stock_id), &item)) { return rb_ary_new3(5, CSTR2SYM(item.stock_id), CSTR2RVAL(item.label), UINT2NUM(item.modifier), UINT2NUM(item.keyval), CSTR2RVAL(item.translation_domain)); } rb_raise(rb_eArgError, "no such stock-id: %s", SYM2CSTR(stock_id)); } static VALUE rg_s_ids(G_GNUC_UNUSED VALUE self) { GSList *ids = gtk_stock_list_ids(); GSList *l; VALUE ary = rb_ary_new(); for (l = ids; l != NULL; l = g_slist_next(l)) { rb_ary_push(ary, CSTR2SYM(l->data)); g_free(l->data); } g_slist_free(ids); return ary; } 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_s_set_translate_func(VALUE klass, VALUE domain) { VALUE func = rb_block_proc(); G_RELATIVE(klass, func); gtk_stock_set_translate_func(RVAL2CSTR(domain), (GtkTranslateFunc)translate_func, (gpointer)func, NULL); return Qnil; } void Init_gtk_stock(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "Stock"); rb_undef_method(RG_TARGET_NAMESPACE, "new"); RG_DEF_SMETHOD(add, -1); RG_DEF_SMETHOD(lookup, 1); RG_DEF_SMETHOD(ids, 0); RG_DEF_SMETHOD(set_translate_func, 1); /* Stock IDs (not all are stock items; some are images only) */ rb_define_const(RG_TARGET_NAMESPACE, "ABOUT", CSTR2SYM(GTK_STOCK_ABOUT)); rb_define_const(RG_TARGET_NAMESPACE, "ADD", CSTR2SYM(GTK_STOCK_ADD)); rb_define_const(RG_TARGET_NAMESPACE, "APPLY", CSTR2SYM(GTK_STOCK_APPLY)); rb_define_const(RG_TARGET_NAMESPACE, "BOLD", CSTR2SYM(GTK_STOCK_BOLD)); rb_define_const(RG_TARGET_NAMESPACE, "CANCEL", CSTR2SYM(GTK_STOCK_CANCEL)); #if GTK_CHECK_VERSION(2,16,0) rb_define_const(RG_TARGET_NAMESPACE, "CAPS_LOCK_WARNING", CSTR2SYM(GTK_STOCK_CAPS_LOCK_WARNING)); #endif rb_define_const(RG_TARGET_NAMESPACE, "CDROM", CSTR2SYM(GTK_STOCK_CDROM)); rb_define_const(RG_TARGET_NAMESPACE, "CLEAR", CSTR2SYM(GTK_STOCK_CLEAR)); rb_define_const(RG_TARGET_NAMESPACE, "CLOSE", CSTR2SYM(GTK_STOCK_CLOSE)); rb_define_const(RG_TARGET_NAMESPACE, "COLOR_PICKER", CSTR2SYM(GTK_STOCK_COLOR_PICKER)); rb_define_const(RG_TARGET_NAMESPACE, "CONVERT", CSTR2SYM(GTK_STOCK_CONVERT)); rb_define_const(RG_TARGET_NAMESPACE, "CONNECT", CSTR2SYM(GTK_STOCK_CONNECT)); rb_define_const(RG_TARGET_NAMESPACE, "COPY", CSTR2SYM(GTK_STOCK_COPY)); rb_define_const(RG_TARGET_NAMESPACE, "CUT", CSTR2SYM(GTK_STOCK_CUT)); rb_define_const(RG_TARGET_NAMESPACE, "DELETE", CSTR2SYM(GTK_STOCK_DELETE)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_AUTHENTICATION", CSTR2SYM(GTK_STOCK_DIALOG_AUTHENTICATION)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_ERROR", CSTR2SYM(GTK_STOCK_DIALOG_ERROR)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_INFO", CSTR2SYM(GTK_STOCK_DIALOG_INFO)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_QUESTION", CSTR2SYM(GTK_STOCK_DIALOG_QUESTION)); rb_define_const(RG_TARGET_NAMESPACE, "DIALOG_WARNING", CSTR2SYM(GTK_STOCK_DIALOG_WARNING)); rb_define_const(RG_TARGET_NAMESPACE, "DIRECTORY", CSTR2SYM(GTK_STOCK_DIRECTORY)); #if GTK_CHECK_VERSION(2,12,0) rb_define_const(RG_TARGET_NAMESPACE, "DISCARD", CSTR2SYM(GTK_STOCK_DISCARD)); #endif rb_define_const(RG_TARGET_NAMESPACE, "DISCONNECT", CSTR2SYM(GTK_STOCK_DISCONNECT)); rb_define_const(RG_TARGET_NAMESPACE, "DND", CSTR2SYM(GTK_STOCK_DND)); rb_define_const(RG_TARGET_NAMESPACE, "DND_MULTIPLE", CSTR2SYM(GTK_STOCK_DND_MULTIPLE)); rb_define_const(RG_TARGET_NAMESPACE, "EDIT", CSTR2SYM(GTK_STOCK_EDIT)); rb_define_const(RG_TARGET_NAMESPACE, "FILE", CSTR2SYM(GTK_STOCK_FILE)); rb_define_const(RG_TARGET_NAMESPACE, "EXECUTE", CSTR2SYM(GTK_STOCK_EXECUTE)); rb_define_const(RG_TARGET_NAMESPACE, "FIND", CSTR2SYM(GTK_STOCK_FIND)); rb_define_const(RG_TARGET_NAMESPACE, "FIND_AND_REPLACE", CSTR2SYM(GTK_STOCK_FIND_AND_REPLACE)); rb_define_const(RG_TARGET_NAMESPACE, "FLOPPY", CSTR2SYM(GTK_STOCK_FLOPPY)); rb_define_const(RG_TARGET_NAMESPACE, "FULLSCREEN", CSTR2SYM(GTK_STOCK_FULLSCREEN)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_BOTTOM", CSTR2SYM(GTK_STOCK_GOTO_BOTTOM)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_FIRST", CSTR2SYM(GTK_STOCK_GOTO_FIRST)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_LAST", CSTR2SYM(GTK_STOCK_GOTO_LAST)); rb_define_const(RG_TARGET_NAMESPACE, "GOTO_TOP", CSTR2SYM(GTK_STOCK_GOTO_TOP)); rb_define_const(RG_TARGET_NAMESPACE, "GO_BACK", CSTR2SYM(GTK_STOCK_GO_BACK)); rb_define_const(RG_TARGET_NAMESPACE, "GO_DOWN", CSTR2SYM(GTK_STOCK_GO_DOWN)); rb_define_const(RG_TARGET_NAMESPACE, "GO_FORWARD", CSTR2SYM(GTK_STOCK_GO_FORWARD)); rb_define_const(RG_TARGET_NAMESPACE, "GO_UP", CSTR2SYM(GTK_STOCK_GO_UP)); rb_define_const(RG_TARGET_NAMESPACE, "HARDDISK", CSTR2SYM(GTK_STOCK_HARDDISK)); rb_define_const(RG_TARGET_NAMESPACE, "HELP", CSTR2SYM(GTK_STOCK_HELP)); rb_define_const(RG_TARGET_NAMESPACE, "HOME", CSTR2SYM(GTK_STOCK_HOME)); rb_define_const(RG_TARGET_NAMESPACE, "INDENT", CSTR2SYM(GTK_STOCK_INDENT)); rb_define_const(RG_TARGET_NAMESPACE, "INFO", CSTR2SYM(GTK_STOCK_INFO)); rb_define_const(RG_TARGET_NAMESPACE, "INDEX", CSTR2SYM(GTK_STOCK_INDEX)); rb_define_const(RG_TARGET_NAMESPACE, "ITALIC", CSTR2SYM(GTK_STOCK_ITALIC)); rb_define_const(RG_TARGET_NAMESPACE, "JUMP_TO", CSTR2SYM(GTK_STOCK_JUMP_TO)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_CENTER", CSTR2SYM(GTK_STOCK_JUSTIFY_CENTER)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_FILL", CSTR2SYM(GTK_STOCK_JUSTIFY_FILL)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_LEFT", CSTR2SYM(GTK_STOCK_JUSTIFY_LEFT)); rb_define_const(RG_TARGET_NAMESPACE, "JUSTIFY_RIGHT", CSTR2SYM(GTK_STOCK_JUSTIFY_RIGHT)); rb_define_const(RG_TARGET_NAMESPACE, "LEAVE_FULLSCREEN", CSTR2SYM(GTK_STOCK_LEAVE_FULLSCREEN)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_FORWARD", CSTR2SYM(GTK_STOCK_MEDIA_FORWARD)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_NEXT", CSTR2SYM(GTK_STOCK_MEDIA_NEXT)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_PAUSE", CSTR2SYM(GTK_STOCK_MEDIA_PAUSE)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_PLAY", CSTR2SYM(GTK_STOCK_MEDIA_PLAY)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_PREVIOUS", CSTR2SYM(GTK_STOCK_MEDIA_PREVIOUS)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_RECORD", CSTR2SYM(GTK_STOCK_MEDIA_RECORD)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_REWIND", CSTR2SYM(GTK_STOCK_MEDIA_REWIND)); rb_define_const(RG_TARGET_NAMESPACE, "MEDIA_STOP", CSTR2SYM(GTK_STOCK_MEDIA_STOP)); rb_define_const(RG_TARGET_NAMESPACE, "MISSING_IMAGE", CSTR2SYM(GTK_STOCK_MISSING_IMAGE)); rb_define_const(RG_TARGET_NAMESPACE, "NETWORK", CSTR2SYM(GTK_STOCK_NETWORK)); rb_define_const(RG_TARGET_NAMESPACE, "NEW", CSTR2SYM(GTK_STOCK_NEW)); rb_define_const(RG_TARGET_NAMESPACE, "NO", CSTR2SYM(GTK_STOCK_NO)); rb_define_const(RG_TARGET_NAMESPACE, "OK", CSTR2SYM(GTK_STOCK_OK)); rb_define_const(RG_TARGET_NAMESPACE, "OPEN", CSTR2SYM(GTK_STOCK_OPEN)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_LANDSCAPE", CSTR2SYM(GTK_STOCK_ORIENTATION_LANDSCAPE)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_PORTRAIT", CSTR2SYM(GTK_STOCK_ORIENTATION_PORTRAIT)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_REVERSE_LANDSCAPE", CSTR2SYM(GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE)); rb_define_const(RG_TARGET_NAMESPACE, "ORIENTATION_REVERSE_PORTRAIT", CSTR2SYM(GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT)); #if GTK_CHECK_VERSION(2,14,0) rb_define_const(RG_TARGET_NAMESPACE, "PAGE_SETUP", CSTR2SYM(GTK_STOCK_PAGE_SETUP)); #endif rb_define_const(RG_TARGET_NAMESPACE, "PASTE", CSTR2SYM(GTK_STOCK_PASTE)); rb_define_const(RG_TARGET_NAMESPACE, "PREFERENCES", CSTR2SYM(GTK_STOCK_PREFERENCES)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT", CSTR2SYM(GTK_STOCK_PRINT)); #if GTK_CHECK_VERSION(2,14,0) rb_define_const(RG_TARGET_NAMESPACE, "PRINT_ERROR", CSTR2SYM(GTK_STOCK_PRINT_ERROR)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_PAUSED", CSTR2SYM(GTK_STOCK_PRINT_PAUSED)); #endif rb_define_const(RG_TARGET_NAMESPACE, "PRINT_PREVIEW", CSTR2SYM(GTK_STOCK_PRINT_PREVIEW)); #if GTK_CHECK_VERSION(2,14,0) rb_define_const(RG_TARGET_NAMESPACE, "PRINT_REPORT", CSTR2SYM(GTK_STOCK_PRINT_REPORT)); rb_define_const(RG_TARGET_NAMESPACE, "PRINT_WARNING", CSTR2SYM(GTK_STOCK_PRINT_WARNING)); #endif rb_define_const(RG_TARGET_NAMESPACE, "PROPERTIES", CSTR2SYM(GTK_STOCK_PROPERTIES)); rb_define_const(RG_TARGET_NAMESPACE, "QUIT", CSTR2SYM(GTK_STOCK_QUIT)); rb_define_const(RG_TARGET_NAMESPACE, "REDO", CSTR2SYM(GTK_STOCK_REDO)); rb_define_const(RG_TARGET_NAMESPACE, "REFRESH", CSTR2SYM(GTK_STOCK_REFRESH)); rb_define_const(RG_TARGET_NAMESPACE, "REMOVE", CSTR2SYM(GTK_STOCK_REMOVE)); rb_define_const(RG_TARGET_NAMESPACE, "REVERT_TO_SAVED", CSTR2SYM(GTK_STOCK_REVERT_TO_SAVED)); rb_define_const(RG_TARGET_NAMESPACE, "SAVE", CSTR2SYM(GTK_STOCK_SAVE)); rb_define_const(RG_TARGET_NAMESPACE, "SAVE_AS", CSTR2SYM(GTK_STOCK_SAVE_AS)); rb_define_const(RG_TARGET_NAMESPACE, "SELECT_ALL", CSTR2SYM(GTK_STOCK_SELECT_ALL)); rb_define_const(RG_TARGET_NAMESPACE, "SELECT_COLOR", CSTR2SYM(GTK_STOCK_SELECT_COLOR)); rb_define_const(RG_TARGET_NAMESPACE, "SELECT_FONT", CSTR2SYM(GTK_STOCK_SELECT_FONT)); rb_define_const(RG_TARGET_NAMESPACE, "SORT_ASCENDING", CSTR2SYM(GTK_STOCK_SORT_ASCENDING)); rb_define_const(RG_TARGET_NAMESPACE, "SORT_DESCENDING", CSTR2SYM(GTK_STOCK_SORT_DESCENDING)); rb_define_const(RG_TARGET_NAMESPACE, "SPELL_CHECK", CSTR2SYM(GTK_STOCK_SPELL_CHECK)); rb_define_const(RG_TARGET_NAMESPACE, "STOP", CSTR2SYM(GTK_STOCK_STOP)); rb_define_const(RG_TARGET_NAMESPACE, "STRIKETHROUGH", CSTR2SYM(GTK_STOCK_STRIKETHROUGH)); rb_define_const(RG_TARGET_NAMESPACE, "UNDELETE", CSTR2SYM(GTK_STOCK_UNDELETE)); rb_define_const(RG_TARGET_NAMESPACE, "UNDERLINE", CSTR2SYM(GTK_STOCK_UNDERLINE)); rb_define_const(RG_TARGET_NAMESPACE, "UNDO", CSTR2SYM(GTK_STOCK_UNDO)); rb_define_const(RG_TARGET_NAMESPACE, "UNINDENT", CSTR2SYM(GTK_STOCK_UNINDENT)); rb_define_const(RG_TARGET_NAMESPACE, "YES", CSTR2SYM(GTK_STOCK_YES)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_100", CSTR2SYM(GTK_STOCK_ZOOM_100)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_FIT", CSTR2SYM(GTK_STOCK_ZOOM_FIT)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_IN", CSTR2SYM(GTK_STOCK_ZOOM_IN)); rb_define_const(RG_TARGET_NAMESPACE, "ZOOM_OUT", CSTR2SYM(GTK_STOCK_ZOOM_OUT)); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrenderertext.c�����������������������������������������0000644�0001750�0001750�00000003156�11701304107�021700� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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"); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmessagedialog.c��������������������������������������������0000644�0001750�0001750�00000007001�12257552167�021144� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cMessageDialog #define _SELF(s) (GTK_MESSAGE_DIALOG(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE parent, flags, type, buttons, message; GtkWidget* w; rb_scan_args(argc, argv, "41", &parent, &flags, &type, &buttons, &message); w = gtk_message_dialog_new(NIL_P(parent) ? NULL : GTK_WINDOW(RVAL2GOBJ(parent)), RVAL2GFLAGS(flags, GTK_TYPE_DIALOG_FLAGS), RVAL2GENUM(type, GTK_TYPE_MESSAGE_TYPE), RVAL2GENUM(buttons, GTK_TYPE_BUTTONS_TYPE), "%s", NIL_P(message) ? "": RVAL2CSTR(message)); RBGTK_INITIALIZE(self, w); return Qnil; } /* Don't implement. Use Gtk::MessageDialog#set_markup. GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...); */ static VALUE rg_set_markup(VALUE self, VALUE str) { gtk_message_dialog_set_markup(_SELF(self), RVAL2CSTR(str)); return self; } /* Not needed in Ruby void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog, const gchar *message_format, ...); void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog, const gchar *message_format, ...); */ void Init_gtk_message_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MESSAGE_DIALOG, "MessageDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_markup, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "markup"); /* GtkMessageType */ G_DEF_CLASS(GTK_TYPE_MESSAGE_TYPE, "Type", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_MESSAGE_TYPE, "GTK_MESSAGE_"); /* GtkButtonsType */ G_DEF_CLASS(GTK_TYPE_BUTTONS_TYPE, "ButtonsType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_BUTTONS_TYPE, "GTK_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkdraw.c�����������������������������������������������������0000644�0001750�0001750�00000034543�12257552167�017270� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } 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; } 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; } /* 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; } 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; } 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; } 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))); } 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))); } #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 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))); } #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 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); RG_DEF_METHOD(draw_pixbuf, 11); RG_DEF_METHOD(draw_segments, 2); RG_DEF_METHOD(draw_rectangle, 6); RG_DEF_METHOD(draw_arc, 8); RG_DEF_METHOD(draw_polygon, 3); RG_DEF_METHOD(draw_trapezoids, 2); RG_DEF_METHOD(draw_glyphs, 5); RG_DEF_METHOD(draw_glyphs_transformed, 6); 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); RG_DEF_METHOD(copy_to_image, 7); #ifdef GDK_WINDOWING_X11 RG_DEF_METHOD(xid, 0); #endif #ifdef GDK_WINDOWING_WIN32 RG_DEF_METHOD(handle, 0); #endif RG_DEF_METHOD(display, 0); RG_DEF_METHOD(screen, 0); #ifdef HAVE_RB_CAIRO_H RG_DEF_METHOD(create_cairo_context, 0); #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); } �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmenubar.c��������������������������������������������������0000644�0001750�0001750�00000003041�12257552167�017771� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cMenuBar static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_menu_bar_new()); return Qnil; } void Init_gtk_menu_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_BAR, "MenuBar", mGtk); RG_DEF_METHOD(initialize, 0); /* GtkPackDirection */ G_DEF_CLASS(GTK_TYPE_PACK_DIRECTION, "PackDirection", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PACK_DIRECTION, "GTK_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkradiotoolbutton.c������������������������������������������0000644�0001750�0001750�00000010002�12257552167�021563� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cRadioToolButton #define _SELF(self) (GTK_RADIO_TOOL_BUTTON(RVAL2GOBJ(self))) static VALUE RG_TARGET_NAMESPACE; struct rbgtk_rval2gtkradiotoolbuttongslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbgtk_rval2gtkradiotoolbuttongslist_body(VALUE value) { long i; struct rbgtk_rval2gtkradiotoolbuttongslist_args *args = (struct rbgtk_rval2gtkradiotoolbuttongslist_args *)value; for (i = 0; i < args->n; i++) args->result = g_slist_append(args->result, GTK_RADIO_MENU_ITEM(RVAL2GOBJ(RARRAY_PTR(args->ary)[i]))); return Qnil; } static G_GNUC_NORETURN VALUE rbgtk_rval2gtkradiotoolbuttongslist_rescue(VALUE value) { g_slist_free(((struct rbgtk_rval2gtkradiotoolbuttongslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbgtk_rval2gtkradiotoolbuttongslist(VALUE value) { struct rbgtk_rval2gtkradiotoolbuttongslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbgtk_rval2gtkradiotoolbuttongslist_body, (VALUE)&args, rbgtk_rval2gtkradiotoolbuttongslist_rescue, (VALUE)&args); return args.result; } #define RVAL2GTKRADIOTOOLBUTTONGSLIST(value) rbgtk_rval2gtkradiotoolbuttongslist(value) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE group_or_stock_id, rbstock_id; GtkToolItem *widget; if (rb_scan_args(argc, argv, "02", &group_or_stock_id, &rbstock_id) > 0) { GSList *group = NULL; const gchar *stock_id = TYPE(rbstock_id) == T_SYMBOL ? rb_id2name(SYM2ID(rbstock_id)) : RVAL2CSTR_ACCEPT_NIL(rbstock_id); if (TYPE(group_or_stock_id) == T_ARRAY) /* TODO: This has a potential for leaking. */ group = RVAL2GTKRADIOTOOLBUTTONGSLIST(group_or_stock_id); else if (rb_obj_is_kind_of(group_or_stock_id, RG_TARGET_NAMESPACE)) group = gtk_radio_tool_button_get_group(_SELF(group_or_stock_id)); if (stock_id == NULL) widget = gtk_radio_tool_button_new(group); else widget = gtk_radio_tool_button_new_from_stock(group, stock_id); } else { widget = gtk_radio_tool_button_new(NULL); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rbtn_get_group(VALUE self) { /* Owned by GTK+ */ return GSLIST2ARY(gtk_radio_tool_button_get_group(_SELF(self))); } static VALUE rbtn_set_group(VALUE self, VALUE rbgroup) { GtkRadioToolButton *button = _SELF(self); GSList *group = TYPE(rbgroup) == T_ARRAY ? /* TODO: This might leak. */ RVAL2GTKRADIOTOOLBUTTONGSLIST(rbgroup) : gtk_radio_tool_button_get_group(_SELF(rbgroup)); gtk_radio_tool_button_set_group(button, group); return self; } void Init_gtk_radiotoolbutton(VALUE mGtk) { RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_TOOL_BUTTON, "RadioToolButton", mGtk); RG_DEF_METHOD(initialize, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "group", rbtn_get_group, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "group", rbtn_set_group, 1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrcstyle.c��������������������������������������������������0000644�0001750�0001750�00000011572�11701304107�020013� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cRcStyle #define _SELF(rc) (GTK_RC_STYLE(RVAL2GOBJ(rc))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_rc_style_new()); return Qnil; } static VALUE rg_name(VALUE self) { return CSTR2RVAL(_SELF(self)->name); } static VALUE rg_set_name(VALUE self, VALUE name) { _SELF(self)->name = g_strdup(RVAL2CSTR(name)); return self; } static VALUE rg_bg_pixmap_name(VALUE self, VALUE idx) { int i = NUM2INT(idx); if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); return CSTR2RVAL(_SELF(self)->bg_pixmap_name[i]); } static VALUE rg_set_bg_pixmap_name(VALUE self, VALUE idx, VALUE bg_pixmap_name) { int i = NUM2INT(idx); if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); _SELF(self)->bg_pixmap_name[i] = g_strdup(RVAL2CSTR(bg_pixmap_name)); return self; } static VALUE rg_font_desc(VALUE self) { PangoFontDescription* desc = _SELF(self)->font_desc; return BOXED2RVAL(desc, PANGO_TYPE_FONT_DESCRIPTION); } static VALUE rg_set_font_desc(VALUE self, VALUE font_desc) { _SELF(self)->font_desc = (PangoFontDescription*)RVAL2BOXED(font_desc, PANGO_TYPE_FONT_DESCRIPTION); return self; } static VALUE rg_color_flags(VALUE self, VALUE rb_state_type) { GtkStateType state_type; state_type = RVAL2GTKSTATETYPE(rb_state_type); return GTKRCFLAGS2RVAL(_SELF(self)->color_flags[state_type]); } static VALUE rg_set_color_flags(VALUE self, VALUE rb_state_type, VALUE flags) { GtkStateType state_type; state_type = RVAL2GTKSTATETYPE(rb_state_type); _SELF(self)->color_flags[state_type] = RVAL2GTKRCFLAGS(flags); return self; } #define DEFINE_STYLE_COLOR(type) \ static VALUE \ rcstyle_set_ ## type(VALUE self, VALUE idx, VALUE r, VALUE g, VALUE b) \ { \ GdkColor *color; \ int i = NUM2INT(idx); \ \ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \ color = &(_SELF(self) -> type [i]); \ color->red = NUM2INT(r); \ color->green = NUM2INT(g); \ color->blue = NUM2INT(b); \ return self;\ } \ static VALUE \ rcstyle_ ## type(VALUE self, VALUE idx) \ { \ int i = NUM2INT(idx); \ \ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \ return BOXED2RVAL(&_SELF(self)-> type [i], GDK_TYPE_COLOR); \ } \ DEFINE_STYLE_COLOR(fg); DEFINE_STYLE_COLOR(bg); DEFINE_STYLE_COLOR(text); DEFINE_STYLE_COLOR(base); static VALUE rg_xthickness(VALUE self) { return INT2NUM(_SELF(self)->xthickness); } static VALUE rg_set_xthickness(VALUE self, VALUE xthickness) { _SELF(self)->xthickness = NUM2INT(xthickness); return self; } static VALUE rg_ythickness(VALUE self) { return INT2NUM(_SELF(self)->ythickness); } static VALUE rg_set_ythickness(VALUE self, VALUE ythickness) { _SELF(self)->ythickness = NUM2INT(ythickness); return self; } void Init_gtk_rcstyle(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RC_STYLE, "RcStyle", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(color_flags, 1); RG_DEF_METHOD(set_color_flags, 2); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(set_name, 1); RG_DEF_METHOD(bg_pixmap_name, 1); RG_DEF_METHOD(set_bg_pixmap_name, 2); RG_DEF_METHOD(font_desc, 0); RG_DEF_METHOD(set_font_desc, 1); rb_define_method(RG_TARGET_NAMESPACE, "fg", rcstyle_fg, 1); rb_define_method(RG_TARGET_NAMESPACE, "bg", rcstyle_bg, 1); rb_define_method(RG_TARGET_NAMESPACE, "text", rcstyle_text, 1); rb_define_method(RG_TARGET_NAMESPACE, "base", rcstyle_base, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_fg", rcstyle_set_fg, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_bg", rcstyle_set_bg, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_text", rcstyle_set_text, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_base", rcstyle_set_base, 4); RG_DEF_METHOD(xthickness, 0); RG_DEF_METHOD(ythickness, 0); RG_DEF_METHOD(set_xthickness, 1); RG_DEF_METHOD(set_ythickness, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ��������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbuildable.c������������������������������������������������0000644�0001750�0001750�00000010317�11701304107�020245� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprogressbar.c����������������������������������������������0000644�0001750�0001750�00000005232�11701304107�020653� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cProgressBar static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_progress_bar_new()); return Qnil; } static VALUE rg_pulse(VALUE self) { gtk_progress_bar_pulse(GTK_PROGRESS_BAR(RVAL2GOBJ(self))); return self; } void Init_gtk_progress_bar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PROGRESS_BAR, "ProgressBar", mGtk); /* GtkProgressBarOrientation */ G_DEF_CLASS(GTK_TYPE_PROGRESS_BAR_ORIENTATION, "Orientation", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_PROGRESS_BAR_ORIENTATION, "GTK_PROGRESS_"); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(pulse, 0); /* undef deprecated properties */ rb_undef_method(RG_TARGET_NAMESPACE, "adjustment"); rb_undef_method(RG_TARGET_NAMESPACE, "adjustment="); rb_undef_method(RG_TARGET_NAMESPACE, "set_adjustment"); rb_undef_method(RG_TARGET_NAMESPACE, "bar_style"); rb_undef_method(RG_TARGET_NAMESPACE, "bar_style="); rb_undef_method(RG_TARGET_NAMESPACE, "set_bar_style"); rb_undef_method(RG_TARGET_NAMESPACE, "discrete_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "discrete_blocks="); rb_undef_method(RG_TARGET_NAMESPACE, "set_discrete_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_blocks="); rb_undef_method(RG_TARGET_NAMESPACE, "set_activity_blocks"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_step"); rb_undef_method(RG_TARGET_NAMESPACE, "activity_step="); rb_undef_method(RG_TARGET_NAMESPACE, "set_activity_step"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkalignment.c������������������������������������������������0000644�0001750�0001750�00000005116�12257552167�020323� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } 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; } 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); RG_DEF_METHOD(padding, 0); RG_DEF_METHOD(set_padding, 4); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhscrollbar.c�����������������������������������������������0000644�0001750�0001750�00000003051�11701304107�020452� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHScrollbar static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1; GtkAdjustment *adj = NULL; rb_scan_args(argc, argv, "01", &arg1); if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1)); RBGTK_INITIALIZE(self, gtk_hscrollbar_new(adj)); return Qnil; } void Init_gtk_hscrollbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HSCROLLBAR, "HScrollbar", mGtk); RG_DEF_METHOD(initialize, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkcairo.c����������������������������������������������������0000644�0001750�0001750�00000005426�12257552167�017426� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } 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; } 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; } void Init_gtk_gdk_cairo(void) { RG_DEF_METHOD(set_source_gdk_color, 1); RG_DEF_METHOD(set_source_pixbuf, -1); RG_DEF_METHOD(set_source_pixmap, 3); RG_DEF_METHOD(gdk_rectangle, 1); RG_DEF_METHOD(gdk_region, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtksocket.c���������������������������������������������������0000644�0001750�0001750�00000004100�11701304107�017603� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002 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" #ifdef HAVE_GTK_SOCKET_GET_TYPE #define RG_TARGET_NAMESPACE cSocket #define _SELF(self) GTK_SOCKET(RVAL2GOBJ(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_socket_new()); return Qnil; } static VALUE rg_add_id(VALUE self, VALUE wid) { gtk_socket_add_id(_SELF(self), #ifdef GDK_NATIVE_WINDOW_POINTER GUINT_TO_POINTER(NUM2ULONG(wid)) #else (guint32)NUM2UINT(wid) #endif ); return self; } static VALUE rg_plug_window(VALUE self) { return GOBJ2RVAL(_SELF(self)->plug_window); } static VALUE rg_id(VALUE self) { GdkNativeWindow id = gtk_socket_get_id(_SELF(self)); #ifdef GDK_NATIVE_WINDOW_POINTER return UINT2NUM(GPOINTER_TO_UINT(id)); #else return UINT2NUM(id); #endif } #endif /* HAVE_GTK_SOCKET_GET_TYPE */ void Init_gtk_socket(VALUE mGtk) { #ifdef HAVE_GTK_SOCKET_GET_TYPE VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SOCKET, "Socket", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(plug_window, 0); RG_DEF_METHOD(add_id, 1); RG_DEF_METHOD(id, 0); #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccelgroupentry.c������������������������������������������0000644�0001750�0001750�00000005162�12124610262�021534� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaspectframe.c����������������������������������������������0000644�0001750�0001750�00000004070�11701304107�020613� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextview.c�������������������������������������������������0000644�0001750�0001750�00000024413�12257552167�020225� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTextView #define _SELF(self) (GTK_TEXT_VIEW(RVAL2GOBJ(self))) #define RVAL2BUFFER(b) (GTK_TEXT_BUFFER(RVAL2GOBJ(b))) #define RVAL2MARK(m) (GTK_TEXT_MARK(RVAL2GOBJ(m))) #define RVAL2ITR(i) ((GtkTextIter*)(RVAL2BOXED(i, GTK_TYPE_TEXT_ITER))) #define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER)) static ID id_buffer; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE buffer; GtkWidget* widget; rb_scan_args(argc, argv, "01", &buffer); if (NIL_P(buffer)) widget = gtk_text_view_new(); else { G_CHILD_SET(self, id_buffer, buffer); widget = gtk_text_view_new_with_buffer(RVAL2BUFFER(buffer)); } RBGTK_INITIALIZE(self, widget); return self; } static VALUE textview_set_buffer(VALUE self, VALUE buf) { G_CHILD_SET(self, id_buffer, buf); gtk_text_view_set_buffer(_SELF(self), NIL_P(buf) ? NULL : RVAL2BUFFER(buf)); return self; } static VALUE textview_get_buffer(VALUE self) { VALUE buf = GOBJ2RVAL(gtk_text_view_get_buffer(_SELF(self))); G_CHILD_SET(self, id_buffer, buf); return buf; } static VALUE rg_scroll_to_mark(VALUE self, VALUE mark, VALUE within_margin, VALUE use_align, VALUE xalign, VALUE yalign) { gtk_text_view_scroll_to_mark(_SELF(self), RVAL2MARK(mark), NUM2DBL(within_margin), RVAL2CBOOL(use_align), NUM2DBL(xalign), NUM2DBL(yalign)); return self; } static VALUE rg_scroll_to_iter(VALUE self, VALUE iter, VALUE within_margin, VALUE use_align, VALUE xalign, VALUE yalign) { return CBOOL2RVAL(gtk_text_view_scroll_to_iter(_SELF(self), RVAL2ITR(iter), NUM2DBL(within_margin), RVAL2CBOOL(use_align), NUM2DBL(xalign), NUM2DBL(yalign))); } static VALUE rg_scroll_mark_onscreen(VALUE self, VALUE mark) { gtk_text_view_scroll_mark_onscreen(_SELF(self), RVAL2MARK(mark)); return self; } static VALUE rg_move_mark_onscreen(VALUE self, VALUE mark) { return CBOOL2RVAL(gtk_text_view_move_mark_onscreen(_SELF(self), RVAL2MARK(mark))); } static VALUE rg_place_cursor_onscreen(VALUE self) { return CBOOL2RVAL(gtk_text_view_place_cursor_onscreen(_SELF(self))); } static VALUE rg_visible_rect(VALUE self) { GdkRectangle rect; gtk_text_view_get_visible_rect(_SELF(self), &rect); return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE); } static VALUE rg_get_iter_location(VALUE self, VALUE iter) { GdkRectangle rect; gtk_text_view_get_iter_location(_SELF(self), RVAL2ITR(iter), &rect); return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE); } static VALUE rg_get_line_at_y(VALUE self, VALUE y) { GtkTextIter target_iter; gint line_top; gtk_text_view_get_line_at_y(_SELF(self), &target_iter, NUM2INT(y), &line_top); return rb_ary_new3(2, ITR2RVAL(&target_iter), INT2NUM(line_top)); } static VALUE rg_get_line_yrange(VALUE self, VALUE iter) { int y, height; gtk_text_view_get_line_yrange(_SELF(self), RVAL2ITR(iter), &y, &height); return rb_ary_new3(2, INT2NUM(y), INT2NUM(height)); } static VALUE rg_get_iter_at_location(VALUE self, VALUE x, VALUE y) { GtkTextIter iter; gtk_text_view_get_iter_at_location(_SELF(self), &iter, NUM2INT(x), NUM2INT(y)); return ITR2RVAL(&iter); } static VALUE rg_get_iter_at_position(VALUE self, VALUE x, VALUE y) { GtkTextIter iter; gint trailing; gtk_text_view_get_iter_at_position(_SELF(self), &iter, &trailing, NUM2INT(x), NUM2INT(y)); return rb_assoc_new(ITR2RVAL(&iter), INT2NUM(trailing)); } static VALUE rg_buffer_to_window_coords(VALUE self, VALUE wintype, VALUE buffer_x, VALUE buffer_y) { int window_x, window_y; gtk_text_view_buffer_to_window_coords(_SELF(self), RVAL2GENUM(wintype, GTK_TYPE_TEXT_WINDOW_TYPE), NUM2INT(buffer_x), NUM2INT(buffer_y), &window_x, &window_y); return rb_ary_new3(2, INT2NUM(window_x), INT2NUM(window_y)); } static VALUE rg_window_to_buffer_coords(VALUE self, VALUE wintype, VALUE window_x, VALUE window_y) { int buffer_x, buffer_y; gtk_text_view_window_to_buffer_coords(_SELF(self), RVAL2GENUM(wintype, GTK_TYPE_TEXT_WINDOW_TYPE), NUM2INT(window_x), NUM2INT(window_y), &buffer_x, &buffer_y); return rb_ary_new3(2, INT2NUM(buffer_x), INT2NUM(buffer_y)); } static VALUE rg_get_window(VALUE self, VALUE wintype) { GdkWindow* win = NULL; win = gtk_text_view_get_window(_SELF(self), RVAL2GENUM(wintype, GTK_TYPE_TEXT_WINDOW_TYPE)); return win ? GOBJ2RVAL(win): Qnil; } static VALUE rg_get_window_type(VALUE self, VALUE gdkwin) { return GENUM2RVAL(gtk_text_view_get_window_type(_SELF(self), RVAL2GOBJ(gdkwin)), GTK_TYPE_TEXT_WINDOW_TYPE); } static VALUE rg_set_border_window_size(VALUE self, VALUE wintype, VALUE size) { gtk_text_view_set_border_window_size(_SELF(self), RVAL2GENUM(wintype, GTK_TYPE_TEXT_WINDOW_TYPE), NUM2INT(size)); return self; } static VALUE rg_get_border_window_size(VALUE self, VALUE wintype) { return INT2NUM(gtk_text_view_get_border_window_size( _SELF(self), RVAL2GENUM(wintype, GTK_TYPE_TEXT_WINDOW_TYPE))); } static VALUE rg_forward_display_line(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_forward_display_line(_SELF(self), RVAL2ITR(iter))); } static VALUE rg_backward_display_line(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_backward_display_line(_SELF(self), RVAL2ITR(iter))); } static VALUE rg_forward_display_line_end(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_forward_display_line_end(_SELF(self), RVAL2ITR(iter))); } static VALUE rg_backward_display_line_start(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_backward_display_line_start(_SELF(self), RVAL2ITR(iter))); } static VALUE rg_starts_display_line(VALUE self, VALUE iter) { return CBOOL2RVAL(gtk_text_view_starts_display_line(_SELF(self), RVAL2ITR(iter))); } static VALUE rg_move_visually(VALUE self, VALUE iter, VALUE count) { return CBOOL2RVAL(gtk_text_view_move_visually(_SELF(self), RVAL2ITR(iter), NUM2INT(count))); } static VALUE rg_add_child_at_anchor(VALUE self, VALUE child, VALUE anchor) { G_CHILD_ADD(self, child); gtk_text_view_add_child_at_anchor(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(anchor))); return self; } static VALUE rg_add_child_in_window(VALUE self, VALUE child, VALUE which_window, VALUE xpos, VALUE ypos) { G_CHILD_ADD(self, child); gtk_text_view_add_child_in_window(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), RVAL2GENUM(which_window, GTK_TYPE_TEXT_WINDOW_TYPE), NUM2INT(xpos), NUM2INT(ypos)); return self; } static VALUE rg_move_child(VALUE self, VALUE child, VALUE xpos, VALUE ypos) { G_CHILD_ADD(self, child); gtk_text_view_move_child(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), NUM2INT(xpos), NUM2INT(ypos)); return self; } static VALUE rg_default_attributes(VALUE self) { return BOXED2RVAL(gtk_text_view_get_default_attributes(_SELF(self)), GTK_TYPE_TEXT_ATTRIBUTES); } void Init_gtk_textview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_VIEW, "TextView", mGtk); id_buffer = rb_intern("buffer"); RG_DEF_METHOD(initialize, -1); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "buffer", textview_set_buffer, 1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "buffer", textview_get_buffer, 0); RG_DEF_METHOD(scroll_to_mark, 5); RG_DEF_METHOD(scroll_to_iter, 5); RG_DEF_METHOD(scroll_mark_onscreen, 1); RG_DEF_METHOD(move_mark_onscreen, 1); RG_DEF_METHOD(place_cursor_onscreen, 0); RG_DEF_METHOD(visible_rect, 0); RG_DEF_METHOD(get_iter_location, 1); RG_DEF_METHOD(get_line_at_y, 1); RG_DEF_METHOD(get_line_yrange, 1); RG_DEF_METHOD(get_iter_at_location, 2); RG_DEF_METHOD(get_iter_at_position, 2); RG_DEF_METHOD(buffer_to_window_coords, 3); RG_DEF_METHOD(window_to_buffer_coords, 3); RG_DEF_METHOD(get_window, 1); RG_DEF_METHOD(get_window_type, 1); RG_DEF_METHOD(set_border_window_size, 2); G_DEF_SETTER(RG_TARGET_NAMESPACE, "border_window_size"); RG_DEF_METHOD(get_border_window_size, 1); RG_DEF_METHOD(forward_display_line, 1); RG_DEF_METHOD(backward_display_line, 1); RG_DEF_METHOD(forward_display_line_end, 1); RG_DEF_METHOD(backward_display_line_start, 1); RG_DEF_METHOD(starts_display_line, 1); RG_DEF_METHOD(move_visually, 2); RG_DEF_METHOD(add_child_at_anchor, 2); RG_DEF_METHOD(add_child_in_window, 4); RG_DEF_METHOD(move_child, 3); RG_DEF_METHOD(default_attributes, 0); /* GtkTextWindowType */ G_DEF_CLASS(GTK_TYPE_TEXT_WINDOW_TYPE, "WindowType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TEXT_WINDOW_TYPE, "GTK_TEXT_"); rb_define_const(RG_TARGET_NAMESPACE, "PRIORITY_VALIDATE", INT2FIX(GTK_TEXT_VIEW_PRIORITY_VALIDATE)); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhandlebox.c������������������������������������������������0000644�0001750�0001750�00000003026�11701304107�020265� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHandleBox static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_handle_box_new()); return Qnil; } void Init_gtk_handle_box(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HANDLE_BOX, "HandleBox", mGtk); RG_DEF_METHOD(initialize, 0); rb_undef_method(RG_TARGET_NAMESPACE, "shadow"); rb_undef_method(RG_TARGET_NAMESPACE, "shadow="); rb_undef_method(RG_TARGET_NAMESPACE, "set_shadow"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtklabel.c����������������������������������������������������0000644�0001750�0001750�00000007635�11701304107�017412� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cLabel #define _SELF(s) (GTK_LABEL(RVAL2GOBJ(s))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "02", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ widget = gtk_label_new(NIL_P(label)?NULL:RVAL2CSTR(label)); } else { widget = gtk_label_new_with_mnemonic(NIL_P(label)?NULL:RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_operator_label_set_text_only(VALUE self, VALUE text) { gtk_label_set_text(_SELF(self), RVAL2CSTR(text)); return text; } static VALUE rg_set_text(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; rb_scan_args(argc, argv, "02", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ gtk_label_set_text(_SELF(self), RVAL2CSTR(label)); } else { gtk_label_set_text_with_mnemonic(_SELF(self), RVAL2CSTR(label)); } return self; } static VALUE rg_operator_label_set_markup_only(VALUE self, VALUE text) { gtk_label_set_markup(_SELF(self), RVAL2CSTR(text)); return text; } static VALUE rg_set_markup(int argc, VALUE *argv, VALUE self) { VALUE str, with_mnemonic; rb_scan_args(argc, argv, "02", &str, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ gtk_label_set_markup(_SELF(self), RVAL2CSTR(str)); } else { gtk_label_set_markup_with_mnemonic(_SELF(self), RVAL2CSTR(str)); } return self; } static VALUE rg_layout_offsets(VALUE self) { gint x, y; gtk_label_get_layout_offsets(_SELF(self), &x, &y); return rb_ary_new3(2, INT2NUM(x), INT2NUM(y)); } static VALUE rg_text(VALUE self) { return CSTR2RVAL(gtk_label_get_text(_SELF(self))); } static VALUE rg_select_region(VALUE self, VALUE start_offset, VALUE end_offset) { gtk_label_select_region(_SELF(self), NUM2INT(start_offset), NUM2INT(end_offset)); return self; } static VALUE rg_layout(VALUE self) { return GOBJ2RVAL(gtk_label_get_layout(_SELF(self))); } static VALUE rg_selection_bounds(VALUE self) { gint start, end; gboolean ret = gtk_label_get_selection_bounds(_SELF(self), &start, &end); return ret ? rb_ary_new3(2, INT2NUM(start), INT2NUM(end)) : Qnil; } void Init_gtk_label(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LABEL, "Label", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(text, 0); RG_DEF_METHOD(set_text, -1); RG_DEF_METHOD_OPERATOR("text=", label_set_text_only, 1); RG_DEF_METHOD(set_markup, -1); RG_DEF_METHOD_OPERATOR("markup=", label_set_markup_only, 1); RG_DEF_METHOD(layout_offsets, 0); RG_DEF_METHOD(select_region, 2); RG_DEF_METHOD(layout, 0); RG_DEF_METHOD(selection_bounds, 0); } ���������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkiconsource.c�����������������������������������������������0000644�0001750�0001750�00000010442�11701304107�020472� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cIconSource #define _SELF(s) ((GtkIconSource*)RVAL2BOXED(s, GTK_TYPE_ICON_SOURCE)) static VALUE rg_initialize(VALUE self) { GtkIconSource *icon_source; icon_source = gtk_icon_source_new(); G_INITIALIZE(self, icon_source); return Qnil; } static VALUE rg_direction(VALUE self) { return GENUM2RVAL(gtk_icon_source_get_direction(_SELF(self)), GTK_TYPE_TEXT_DIRECTION); } static VALUE rg_direction_wildcarded_p(VALUE self) { return CBOOL2RVAL(gtk_icon_source_get_direction_wildcarded(_SELF(self))); } static VALUE rg_filename(VALUE self) { return CSTR2RVAL(gtk_icon_source_get_filename(_SELF(self))); } static VALUE rg_pixbuf(VALUE self) { GdkPixbuf *pixbuf; pixbuf = gtk_icon_source_get_pixbuf(_SELF(self)); return pixbuf ? GOBJ2RVAL(pixbuf) : Qnil; } static VALUE rg_size(VALUE self) { return GENUM2RVAL(gtk_icon_source_get_size(_SELF(self)), GTK_TYPE_ICON_SIZE); } static VALUE rg_size_wildcarded_p(VALUE self) { return CBOOL2RVAL(gtk_icon_source_get_size_wildcarded(_SELF(self))); } static VALUE rg_state(VALUE self) { return GENUM2RVAL(gtk_icon_source_get_state(_SELF(self)), GTK_TYPE_STATE_TYPE); } static VALUE rg_state_wildcarded_p(VALUE self) { return CBOOL2RVAL(gtk_icon_source_get_state_wildcarded(_SELF(self))); } static VALUE rg_set_direction(VALUE self, VALUE direction) { gtk_icon_source_set_direction(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_TEXT_DIRECTION)); return self; } static VALUE rg_set_direction_wildcarded(VALUE self, VALUE setting) { gtk_icon_source_set_direction_wildcarded(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_filename(VALUE self, VALUE filename) { gtk_icon_source_set_filename(_SELF(self), RVAL2CSTR(filename)); return self; } static VALUE rg_set_pixbuf(VALUE self, VALUE pixbuf) { gtk_icon_source_set_pixbuf(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf))); return self; } static VALUE rg_set_size(VALUE self, VALUE size) { gtk_icon_source_set_size(_SELF(self), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE)); return self; } static VALUE rg_set_size_wildcarded(VALUE self, VALUE setting) { gtk_icon_source_set_size_wildcarded(_SELF(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_set_state(VALUE self, VALUE state) { gtk_icon_source_set_state(_SELF(self), RVAL2GENUM(state, GTK_TYPE_STATE_TYPE)); return self; } static VALUE rg_set_state_wildcarded(VALUE self, VALUE setting) { gtk_icon_source_set_state_wildcarded(_SELF(self), RVAL2CBOOL(setting)); return self; } void Init_gtk_icon_source(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_SOURCE, "IconSource", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(direction, 0); RG_DEF_METHOD_P(direction_wildcarded, 0); RG_DEF_METHOD(filename, 0); RG_DEF_METHOD(pixbuf, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD_P(size_wildcarded, 0); RG_DEF_METHOD(state, 0); RG_DEF_METHOD_P(state_wildcarded, 0); RG_DEF_METHOD(set_direction, 1); RG_DEF_METHOD(set_direction_wildcarded, 1); RG_DEF_METHOD(set_filename, 1); RG_DEF_METHOD(set_pixbuf, 1); RG_DEF_METHOD(set_size, 1); RG_DEF_METHOD(set_size_wildcarded, 1); RG_DEF_METHOD(set_state, 1); RG_DEF_METHOD(set_state_wildcarded, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkspinner.c��������������������������������������������������0000644�0001750�0001750�00000003023�11701304107�017774� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cSpinner #define _SELF(s) (GTK_SPINNER(RVAL2GOBJ(s))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_spinner_new()); return Qnil; } static VALUE rg_start(VALUE self) { gtk_spinner_start(_SELF(self)); return self; } static VALUE rg_stop(VALUE self) { gtk_spinner_stop(_SELF(self)); return self; } #endif void Init_gtk_spinner(VALUE mGtk) { #if GTK_CHECK_VERSION(2,20,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SPINNER, "Spinner", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(start, 0); RG_DEF_METHOD(stop, 0); #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreerowreference.c�����������������������������������������0000644�0001750�0001750�00000011147�12257552167�021714� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" /*****************************************/ #ifndef GTK_TYPE_TREE_ROW_REFERENCE static GtkTreeRowReference* treerowref_copy(const GtkTreeRowReference *ref) { return (GtkTreeRowReference*)ref; } GType rbgtk_tree_row_reference_get_type() { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("GtkTreeRowReference", (GBoxedCopyFunc)treerowref_copy, (GBoxedFreeFunc)gtk_tree_row_reference_free); return our_type; } GtkTreeRowReference * rbgtk_get_tree_row_reference(VALUE obj) { return (GtkTreeRowReference*)RVAL2BOXED(obj, GTK_TYPE_TREE_ROW_REFERENCE); } #endif /*****************************************/ #define RG_TARGET_NAMESPACE cTreeRowReference #define _SELF(s) RVAL2TREEROWREFERENCE(s) /*****************************************/ static ID id_proxy; static ID id_model; static ID id_path; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE proxy, model, path; GtkTreeRowReference* ref; if (argc == 3){ rb_scan_args(argc, argv, "3", &proxy, &model, &path); G_CHILD_SET(self, id_proxy, proxy); ref = gtk_tree_row_reference_new_proxy(RVAL2GOBJ(proxy), GTK_TREE_MODEL(RVAL2GOBJ(model)), RVAL2GTKTREEPATH(path)); } else { rb_scan_args(argc, argv, "2", &model, &path); ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(RVAL2GOBJ(model)), RVAL2GTKTREEPATH(path)); } if (ref == NULL) rb_raise(rb_eArgError, "Invalid arguments were passed."); G_CHILD_SET(self, id_model, model); G_CHILD_SET(self, id_path, path); G_INITIALIZE(self, ref); return Qnil; } static VALUE rg_path(VALUE self) { VALUE ret = GTKTREEPATH2RVAL(gtk_tree_row_reference_get_path(_SELF(self))); G_CHILD_SET(self, id_path, ret); return ret; } static VALUE rg_model(VALUE self) { VALUE ret = GOBJ2RVAL(gtk_tree_row_reference_get_model(_SELF(self))); G_CHILD_SET(self, id_model, ret); return ret; } static VALUE rg_valid_p(VALUE self) { return CBOOL2RVAL(gtk_tree_row_reference_valid(_SELF(self))); } static VALUE rg_s_inserted(VALUE self, VALUE proxy, VALUE path) { gtk_tree_row_reference_inserted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_s_deleted(VALUE self, VALUE proxy, VALUE path) { gtk_tree_row_reference_deleted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_s_reordered(VALUE self, VALUE rbproxy, VALUE rbpath, VALUE rbiter, VALUE rbnew_order) { GObject *proxy = RVAL2GOBJ(rbproxy); GtkTreePath *path = RVAL2GTKTREEPATH(rbpath); GtkTreeIter *iter = RVAL2GTKTREEITER(rbiter); /* TODO: How do we implement this check? gint columns = gtk_tree_model_get_n_columns(proxy); */ long n; gint *new_order = RVAL2GINTS(rbnew_order, n); /* if (n != columns) { g_free(new_order); rb_raise(rb_eArgError, "new order array must contain same number of elements as the number of columns in the store: %ld != %d", n, columns); } */ gtk_tree_row_reference_reordered(proxy, path, iter, new_order); g_free(new_order); return self; } void Init_gtk_treerowreference(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_ROW_REFERENCE, "TreeRowReference", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(path, 0); RG_DEF_METHOD(model, 0); RG_DEF_METHOD_P(valid, 0); RG_DEF_SMETHOD(inserted, 2); RG_DEF_SMETHOD(deleted, 2); RG_DEF_SMETHOD(reordered, 4); id_proxy = rb_intern("proxy"); id_model = rb_intern("model"); id_path = rb_intern("path"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtk.h���������������������������������������������������������0000644�0001750�0001750�00000011560�11701304107�016407� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ ������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprintoperationpreview.c������������������������������������0000644�0001750�0001750�00000003650�12257552167�023025� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cPrintOperationPreview #define _SELF(s) (GTK_PRINT_OPERATION_PREVIEW(RVAL2GOBJ(s))) static VALUE rg_render_page(VALUE self, VALUE page_number) { gtk_print_operation_preview_render_page(_SELF(self), NUM2INT(page_number)); return self; } static VALUE rg_end_preview(VALUE self) { gtk_print_operation_preview_end_preview(_SELF(self)); return self; } static VALUE rg_selected_p(VALUE self, VALUE page_number) { gboolean selected; selected = gtk_print_operation_preview_is_selected(_SELF(self), NUM2INT(page_number)); return CBOOL2RVAL(selected); } void Init_gtk_print_operation_preview(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINT_OPERATION_PREVIEW, "PrintOperationPreview", mGtk); RG_DEF_METHOD(render_page, 1); RG_DEF_METHOD(end_preview, 0); RG_DEF_METHOD_P(selected, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktoggleaction.c���������������������������������������������0000644�0001750�0001750�00000003623�12257552167�021025� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cToggleAction #define _SELF(self) (GTK_TOGGLE_ACTION(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self, VALUE name, VALUE label, VALUE tooltip, VALUE stock_id) { const gchar *gstockid = NULL; if (TYPE(stock_id) == T_SYMBOL){ gstockid = rb_id2name(SYM2ID(stock_id)); } else if (TYPE(stock_id) == T_STRING){ gstockid = RVAL2CSTR(stock_id); } G_INITIALIZE(self, gtk_toggle_action_new(RVAL2CSTR(name), RVAL2CSTR(label), NIL_P(tooltip) ? NULL : RVAL2CSTR(tooltip), gstockid)); return Qnil; } static VALUE rg_toggled(VALUE self) { gtk_toggle_action_toggled(_SELF(self)); return self; } void Init_gtk_toggle_action(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOGGLE_ACTION, "ToggleAction", mGtk); RG_DEF_METHOD(initialize, 4); RG_DEF_METHOD(toggled, 0); } �������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvolumebutton.c���������������������������������������������0000644�0001750�0001750�00000002716�11701304107�021071� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #if GTK_CHECK_VERSION(2,12,0) #define RG_TARGET_NAMESPACE cVolumeButton static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_volume_button_new()); return Qnil; } #endif void Init_gtk_volumebutton(VALUE mGtk) { #if GTK_CHECK_VERSION(2,12,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VOLUME_BUTTON, "VolumeButton", mGtk); RG_DEF_METHOD(initialize, 0); #endif } ��������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextattributes.c�������������������������������������������0000644�0001750�0001750�00000014302�11701304107�021413� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 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 cTextAttributes #define _SELF(s) ((GtkTextAttributes*)RVAL2BOXED(s, GTK_TYPE_TEXT_ATTRIBUTES)) /***********************************************/ #define ATTR_INT(name)\ static VALUE \ txt_attr_int_ ## name (VALUE self)\ {\ return INT2NUM(_SELF(self)->name);\ }\ static VALUE \ txt_attr_int_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = NUM2INT(val); \ return self;\ } #define ATTR_BOOL(name)\ static VALUE \ txt_attr_bool_ ## name (VALUE self)\ {\ return CBOOL2RVAL(_SELF(self)->name);\ }\ static VALUE \ txt_attr_bool_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2CBOOL(val);\ return self;\ } #define ATTR_FLAGS(name, gtype)\ static VALUE \ txt_attr_flags_ ## name (VALUE self)\ {\ return GFLAGS2RVAL(_SELF(self)->name, gtype);\ }\ static VALUE \ txt_attr_flags_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2GFLAGS(val, gtype);\ return self;\ } #define ATTR_ENUM(name, gtype)\ static VALUE \ txt_attr_enums_ ## name (VALUE self)\ {\ return GENUM2RVAL(_SELF(self)->name, gtype);\ }\ static VALUE \ txt_attr_enums_set_ ## name (VALUE self, VALUE val)\ {\ _SELF(self)->name = RVAL2GENUM(val, gtype);\ return self;\ } #define ATTR_BOXED(name, gtype)\ static VALUE \ txt_attr_boxed_ ## name (VALUE self)\ {\ VALUE val; \ if (_SELF(self)->name == NULL) return Qnil;\ val = BOXED2RVAL(_SELF(self)->name, gtype);\ G_CHILD_SET(self, rb_intern(G_STRINGIFY(name)), val);\ return val;\ }\ static VALUE \ txt_attr_boxed_set_ ## name (VALUE self, VALUE val)\ {\ G_CHILD_SET(self, rb_intern(G_STRINGIFY(name)), val);\ _SELF(self)->name = RVAL2BOXED(val, gtype);\ return self;\ } #define DEFINE_ACCESSOR(gt, type, name) \ rb_define_method(gt, G_STRINGIFY(name), txt_attr_ ## type ## _## name, 0);\ rb_define_method(gt, G_STRINGIFY(set_ ## name), txt_attr_ ## type ## _set_## name, 1); /***********************************************/ static VALUE txt_attr_boxed_appearance(VALUE self) { GtkTextAppearance app = _SELF(self)->appearance; return BOXED2RVAL(&app, GTK_TYPE_TEXT_APPEARANCE); } static VALUE txt_attr_boxed_set_appearance(VALUE self, VALUE val) { GtkTextAppearance* app = (GtkTextAppearance*)RVAL2BOXED(val, GTK_TYPE_TEXT_APPEARANCE); _SELF(self)->appearance = *app; return self; } ATTR_ENUM(justification, GTK_TYPE_JUSTIFICATION); ATTR_ENUM(direction, GTK_TYPE_DIRECTION_TYPE); ATTR_BOXED(font, PANGO_TYPE_FONT_DESCRIPTION); static VALUE txt_attr_double_font_scale(VALUE self) { return rb_float_new(_SELF(self)->font_scale); } static VALUE txt_attr_double_set_font_scale(VALUE self, VALUE val) { _SELF(self)->font_scale = NUM2DBL(val); return self; } ATTR_INT(left_margin); ATTR_INT(indent); ATTR_INT(right_margin); ATTR_INT(pixels_above_lines); ATTR_INT(pixels_below_lines); ATTR_INT(pixels_inside_wrap); ATTR_BOXED(tabs, PANGO_TYPE_TAB_ARRAY); ATTR_ENUM(wrap_mode, GTK_TYPE_WRAP_MODE); ATTR_BOXED(language, PANGO_TYPE_LANGUAGE); ATTR_BOOL(invisible); ATTR_BOOL(bg_full_height); ATTR_BOOL(editable); ATTR_BOOL(realized); /***********************************************/ static VALUE rg_initialize(VALUE self) { GtkTextAttributes *attr; attr = gtk_text_attributes_new(); G_INITIALIZE(self, attr); return Qnil; } static VALUE rg_copy_values(VALUE self, VALUE dest) { gtk_text_attributes_copy_values(_SELF(self), _SELF(dest)); return self; } void Init_gtk_text_attributes(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_ATTRIBUTES, "TextAttributes", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(copy_values, 1); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, appearance); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, justification); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, direction); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, font); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, double, font_scale); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, left_margin); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, indent); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, right_margin); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, pixels_above_lines); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, pixels_below_lines); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, pixels_inside_wrap); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, tabs); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, wrap_mode); DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, language); rb_define_method(RG_TARGET_NAMESPACE, "invisible?", txt_attr_bool_invisible, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_invisible", txt_attr_bool_set_invisible, 1); rb_define_method(RG_TARGET_NAMESPACE, "bg_full_height?", txt_attr_bool_bg_full_height, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_bg_full_height", txt_attr_bool_set_bg_full_height, 1); rb_define_method(RG_TARGET_NAMESPACE, "editable?", txt_attr_bool_editable, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_editable", txt_attr_bool_set_editable, 1); rb_define_method(RG_TARGET_NAMESPACE, "realized?", txt_attr_bool_realized, 0); rb_define_method(RG_TARGET_NAMESPACE, "set_realized", txt_attr_bool_set_realized, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkstyle.c����������������������������������������������������0000644�0001750�0001750�00000057262�12257552167�017516� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cStyle #define _SELF(w) GTK_STYLE(RVAL2GOBJ(w)) #define RVAL2REC(r) (NIL_P(r) ? NULL : (GdkRectangle*)RVAL2BOXED(r, GDK_TYPE_RECTANGLE)) #define RVAL2ICONSOURCE(s) ((GtkIconSource*)RVAL2BOXED(s, GTK_TYPE_ICON_SOURCE)) #define RVAL2STATE(s) (RVAL2GENUM(s, GTK_TYPE_STATE_TYPE)) #define RVAL2SHADOW(s) (RVAL2GENUM(s, GTK_TYPE_SHADOW_TYPE)) #define RVAL2ARROW(s) (RVAL2GENUM(s, GTK_TYPE_ARROW_TYPE)) #define RVAL2GAP(s) (RVAL2GENUM(s, GTK_TYPE_POSITION_TYPE)) #define RVAL2ORI(s) (RVAL2GENUM(s, GTK_TYPE_ORIENTATION)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_style_new()); return Qnil; } static VALUE rg_attached_p(VALUE self) { return CBOOL2RVAL(GTK_STYLE_ATTACHED(_SELF(self))); } static VALUE rg_copy(VALUE self) { return GOBJ2RVAL(gtk_style_copy(_SELF(self))); } static VALUE rg_attach(VALUE self, VALUE win) { return GOBJ2RVAL(gtk_style_attach(_SELF(self), GDK_WINDOW(RVAL2GOBJ(win)))); } static VALUE rg_detach(VALUE self) { gtk_style_detach(_SELF(self)); return self; } static VALUE rg_set_background(VALUE self, VALUE win, VALUE state_type) { gtk_style_set_background(_SELF(self), GDK_WINDOW(RVAL2GOBJ(win)), RVAL2STATE(state_type)); return self; } static VALUE rg_apply_default_background(VALUE self, VALUE gdkwindow, VALUE set_bg, VALUE state_type, VALUE area, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_style_apply_default_background(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2CBOOL(set_bg), RVAL2STATE(state_type), RVAL2REC(area), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_lookup_color(VALUE self, VALUE color_name) { GdkColor color; if (gtk_style_lookup_color(_SELF(self), RVAL2CSTR(color_name), &color)){ return GDKCOLOR2RVAL(&color); } else { return Qnil; } } static VALUE rg_lookup_icon_set(VALUE self, VALUE stock_id) { const gchar *id; GtkIconSet *ret; if (TYPE(stock_id) == T_STRING) { id = RVAL2CSTR(stock_id); } else { id = rb_id2name(SYM2ID(stock_id)); } ret = gtk_style_lookup_icon_set(_SELF(self), id); return BOXED2RVAL(ret, GTK_TYPE_ICON_SET); } static VALUE rg_render_icon(VALUE self, VALUE source, VALUE direction, VALUE state, VALUE size, VALUE widget, VALUE detail) { return GOBJ2RVAL(gtk_style_render_icon(_SELF(self), RVAL2ICONSOURCE(source), RVAL2GENUM(direction, GTK_TYPE_TEXT_DIRECTION), RVAL2STATE(state), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail))); } static VALUE rg_paint_arrow(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE arrow_type, VALUE fill, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_arrow(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), RVAL2ARROW(arrow_type), RVAL2CBOOL(fill), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_box(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_box(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_box_gap(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height, VALUE gap_side, VALUE gap_x, VALUE gap_width) { gtk_paint_box_gap(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height), RVAL2GAP(gap_side), NUM2INT(gap_x), NUM2INT(gap_width)); return self; } static VALUE rg_paint_check(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_check(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_diamond(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_diamond(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_extension(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height, VALUE gap_side) { gtk_paint_extension(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height), RVAL2GAP(gap_side)); return self; } static VALUE rg_paint_flat_box(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_flat_box(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_focus(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_focus(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_handle(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height, VALUE orientation) { gtk_paint_handle(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height), RVAL2ORI(orientation)); return self; } static VALUE rg_paint_hline(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE area, VALUE widget, VALUE detail, VALUE x1, VALUE x2, VALUE y) { gtk_paint_hline(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), NUM2INT(x1), NUM2INT(x2), NUM2INT(y)); return self; } static VALUE rg_paint_option(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_option(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_polygon(VALUE self, VALUE rbwindow, VALUE rbstate_type, VALUE rbshadow_type, VALUE rbarea, VALUE rbwidget, VALUE rbdetail, VALUE rbpoints, VALUE rbfill) { GtkStyle *style = _SELF(self); GdkWindow *window = GDK_WINDOW(RVAL2GOBJ(rbwindow)); GtkStateType state_type = RVAL2STATE(rbstate_type); GtkShadowType shadow_type = RVAL2SHADOW(rbshadow_type); GdkRectangle *area = RVAL2REC(rbarea); GtkWidget *widget = GTK_WIDGET(RVAL2GOBJ(rbwidget)); const gchar *detail = RVAL2CSTR_ACCEPT_NIL(rbdetail); gboolean fill = RVAL2CBOOL(rbfill); long n; GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n); gtk_paint_polygon(style, window, state_type, shadow_type, area, widget, detail, points, n, fill); g_free(points); return self; } static VALUE rg_paint_shadow(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_shadow(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_shadow_gap(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height, VALUE gap_side, VALUE gap_x, VALUE gap_width) { gtk_paint_shadow_gap(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height), RVAL2GAP(gap_side), NUM2INT(gap_x), NUM2INT(gap_width)); return self; } static VALUE rg_paint_slider(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height, VALUE orientation) { gtk_paint_slider(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height), RVAL2ORI(orientation)); return self; } static VALUE rg_paint_tab(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_tab(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_paint_vline(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE area, VALUE widget, VALUE detail, VALUE y1, VALUE y2, VALUE x) { gtk_paint_vline(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(y1), NUM2INT(y2), NUM2INT(x)); return self; } static VALUE rg_paint_expander(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE expander_style) { gtk_paint_expander(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), RVAL2GENUM(expander_style, GTK_TYPE_EXPANDER_STYLE)); return self; } static VALUE rg_paint_layout(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE use_text, VALUE area, VALUE widget, VALUE detail, VALUE x, VALUE y, VALUE layout) { gtk_paint_layout(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2CBOOL(use_text), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), NUM2INT(x), NUM2INT(y), PANGO_LAYOUT(RVAL2GOBJ(layout))); return self; } static VALUE rg_paint_resize_grip(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE area, VALUE widget, VALUE detail, VALUE edge, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_resize_grip(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), NIL_P(detail) ? NULL : RVAL2CSTR(detail), RVAL2GENUM(edge, GDK_TYPE_WINDOW_EDGE), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; } static VALUE rg_s_draw_insertion_cursor(VALUE self, VALUE widget, VALUE drawable, VALUE area, VALUE location, VALUE is_primary, VALUE direction, VALUE draw_arrow) { gtk_draw_insertion_cursor(GTK_WIDGET(RVAL2GOBJ(widget)), GDK_WINDOW(RVAL2GOBJ(drawable)), RVAL2REC(area), RVAL2REC(location), RVAL2CBOOL(is_primary), RVAL2GENUM(direction, GTK_TYPE_TEXT_DIRECTION), RVAL2CBOOL(draw_arrow)); return self; } #define DEFINE_STYLE_COLOR(type) \ static VALUE \ style_set_ ## type(VALUE self, VALUE idx, VALUE r, VALUE g, VALUE b) \ { \ GdkColor *color; \ int i = NUM2INT(idx); \ \ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \ color = &(_SELF(self) -> type [i]); \ color->red = NUM2INT(r); \ color->green = NUM2INT(g); \ color->blue = NUM2INT(b); \ return self; \ } \ static VALUE \ style_ ## type(VALUE self, VALUE idx) \ { \ int i = NUM2INT(idx); \ \ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \ return BOXED2RVAL(&_SELF(self)-> type [i], GDK_TYPE_COLOR); \ } \ DEFINE_STYLE_COLOR(fg); DEFINE_STYLE_COLOR(bg); DEFINE_STYLE_COLOR(light); DEFINE_STYLE_COLOR(dark); DEFINE_STYLE_COLOR(mid); DEFINE_STYLE_COLOR(text); DEFINE_STYLE_COLOR(base); DEFINE_STYLE_COLOR(text_aa); static VALUE rg_black(VALUE self) { return BOXED2RVAL(&_SELF(self)->black, GDK_TYPE_COLOR); } static VALUE rg_set_black(VALUE self, VALUE r, VALUE g, VALUE b) { GdkColor* color = &(_SELF(self)->black); color->red = NUM2INT(r); color->green = NUM2INT(g); color->blue = NUM2INT(b); return self; } static VALUE rg_white(VALUE self) { return BOXED2RVAL(&_SELF(self)->white, GDK_TYPE_COLOR); } static VALUE rg_set_white(VALUE self, VALUE r, VALUE g, VALUE b) { GdkColor* color = &(_SELF(self)->white); color->red = NUM2INT(r); color->green = NUM2INT(g); color->blue = NUM2INT(b); return self; } static VALUE rg_font_desc(VALUE self) { PangoFontDescription* desc = _SELF(self)->font_desc; return BOXED2RVAL(desc, PANGO_TYPE_FONT_DESCRIPTION); } static VALUE rg_set_font_desc(VALUE self, VALUE font_desc) { GtkStyle *style = _SELF(self); if (style->font_desc) pango_font_description_free(style->font_desc); style->font_desc = pango_font_description_copy((PangoFontDescription*)RVAL2BOXED(font_desc, PANGO_TYPE_FONT_DESCRIPTION)); return self; } static VALUE rg_xthickness(VALUE self) { return INT2NUM(_SELF(self)->xthickness); } static VALUE rg_set_xthickness(VALUE self, VALUE xthickness) { _SELF(self)->xthickness = NUM2INT(xthickness); return self; } static VALUE rg_ythickness(VALUE self) { return INT2NUM(_SELF(self)->ythickness); } static VALUE rg_set_ythickness(VALUE self, VALUE ythickness) { _SELF(self)->ythickness = NUM2INT(ythickness); return self; } #define DEFINE_STYLE_GC(type) \ static VALUE \ style_set_ ## type(VALUE self, VALUE idx, VALUE gc) \ { \ int i = NUM2INT(idx); \ \ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \ _SELF(self)-> type [i] = GDK_GC(RVAL2GOBJ(gc));\ return self;\ } \ static VALUE \ style_ ## type(VALUE self, VALUE idx) \ { \ int i = NUM2INT(idx); \ \ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \ return GOBJ2RVAL(_SELF(self)-> type [i]); \ } \ DEFINE_STYLE_GC(fg_gc); DEFINE_STYLE_GC(bg_gc); DEFINE_STYLE_GC(light_gc); DEFINE_STYLE_GC(dark_gc); DEFINE_STYLE_GC(mid_gc); DEFINE_STYLE_GC(text_gc); DEFINE_STYLE_GC(base_gc); DEFINE_STYLE_GC(text_aa_gc); static VALUE rg_black_gc(VALUE self) { return GOBJ2RVAL(_SELF(self)->black_gc); } static VALUE rg_set_black_gc(VALUE self, VALUE gc) { _SELF(self)->black_gc = GDK_GC(RVAL2GOBJ(gc)); return self; } static VALUE rg_white_gc(VALUE self) { return GOBJ2RVAL(_SELF(self)->white_gc); } static VALUE rg_set_white_gc(VALUE self, VALUE gc) { _SELF(self)->white_gc = GDK_GC(RVAL2GOBJ(gc)); return self; } static VALUE rg_bg_pixmap(VALUE self, VALUE idx) { int i = NUM2INT(idx); if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); return GOBJ2RVAL(_SELF(self)->bg_pixmap[i]); } static VALUE rg_set_bg_pixmap(VALUE self, VALUE idx, VALUE bg_pixmap) { int i = NUM2INT(idx); GdkPixmap* pixmap = RVAL2GOBJ(bg_pixmap); g_object_ref(G_OBJECT(pixmap)); if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); _SELF(self)->bg_pixmap[i] = pixmap; return self; } void Init_gtk_style(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_STYLE, "Style", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD_P(attached, 0); RG_DEF_METHOD(copy, 0); RG_DEF_ALIAS("clone", "copy"); RG_DEF_ALIAS("dup", "copy"); RG_DEF_METHOD(attach, 1); RG_DEF_METHOD(detach, 0); RG_DEF_METHOD(set_background, 2); RG_DEF_METHOD(apply_default_background, 8); RG_DEF_METHOD(lookup_color, 1); RG_DEF_METHOD(lookup_icon_set, 1); RG_DEF_METHOD(render_icon, 6); RG_DEF_METHOD(paint_arrow, 12); RG_DEF_METHOD(paint_box, 10); RG_DEF_METHOD(paint_box_gap, 13); RG_DEF_METHOD(paint_check, 10); RG_DEF_METHOD(paint_diamond, 10); RG_DEF_METHOD(paint_extension, 10); RG_DEF_METHOD(paint_flat_box, 10); RG_DEF_METHOD(paint_focus, 9); RG_DEF_METHOD(paint_handle, 11); RG_DEF_METHOD(paint_hline, 8); RG_DEF_METHOD(paint_option, 10); RG_DEF_METHOD(paint_polygon, 8); RG_DEF_METHOD(paint_shadow, 10); RG_DEF_METHOD(paint_shadow_gap, 13); RG_DEF_METHOD(paint_slider, 11); RG_DEF_METHOD(paint_tab, 10); RG_DEF_METHOD(paint_vline, 9); RG_DEF_METHOD(paint_expander, 8); RG_DEF_METHOD(paint_layout, 9); RG_DEF_METHOD(paint_resize_grip, 10); RG_DEF_SMETHOD(draw_insertion_cursor, 7); rb_define_method(RG_TARGET_NAMESPACE, "fg", style_fg, 1); rb_define_method(RG_TARGET_NAMESPACE, "bg", style_bg, 1); rb_define_method(RG_TARGET_NAMESPACE, "light", style_light, 1); rb_define_method(RG_TARGET_NAMESPACE, "dark", style_dark, 1); rb_define_method(RG_TARGET_NAMESPACE, "mid", style_mid, 1); rb_define_method(RG_TARGET_NAMESPACE, "text", style_text, 1); rb_define_method(RG_TARGET_NAMESPACE, "base", style_base, 1); rb_define_method(RG_TARGET_NAMESPACE, "text_aa", style_text_aa, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_fg", style_set_fg, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_bg", style_set_bg, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_light", style_set_light, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_dark", style_set_dark, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_mid", style_set_mid, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_text", style_set_text, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_base", style_set_base, 4); rb_define_method(RG_TARGET_NAMESPACE, "set_text_aa", style_set_text_aa, 4); RG_DEF_METHOD(black, 0); RG_DEF_METHOD(set_black, 3); RG_DEF_METHOD(white, 0); RG_DEF_METHOD(set_white, 3); RG_DEF_METHOD(font_desc, 0); RG_DEF_METHOD(set_font_desc, 1); RG_DEF_METHOD(xthickness, 0); RG_DEF_METHOD(ythickness, 0); RG_DEF_METHOD(set_xthickness, 1); RG_DEF_METHOD(set_ythickness, 1); rb_define_method(RG_TARGET_NAMESPACE, "fg_gc", style_fg_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "bg_gc", style_bg_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "light_gc", style_light_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "dark_gc", style_dark_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "mid_gc", style_mid_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "text_gc", style_text_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "base_gc", style_base_gc, 1); rb_define_method(RG_TARGET_NAMESPACE, "text_aa_gc", style_text_aa_gc, 1); RG_DEF_METHOD(black_gc, 0); RG_DEF_METHOD(white_gc, 0); RG_DEF_METHOD(bg_pixmap, 1); rb_define_method(RG_TARGET_NAMESPACE, "set_fg_gc", style_set_fg_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_bg_gc", style_set_bg_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_light_gc", style_set_light_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_dark_gc", style_set_dark_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_mid_gc", style_set_mid_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_text_gc", style_set_text_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_base_gc", style_set_base_gc, 2); rb_define_method(RG_TARGET_NAMESPACE, "set_text_aa_gc", style_set_text_aa_gc, 2); RG_DEF_METHOD(set_black_gc, 1); RG_DEF_METHOD(set_white_gc, 1); RG_DEF_METHOD(set_bg_pixmap, 2); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccelkey.c�������������������������������������������������0000644�0001750�0001750�00000005666�12124610262�020117� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ��������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktoolbar.c��������������������������������������������������0000644�0001750�0001750�00000027305�12257552167�020013� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cToolbar #define _SELF(self) (GTK_TOOLBAR(RVAL2GOBJ(self))) #define N_RVAL2CSTR(text) (NIL_P(text) ? NULL : RVAL2CSTR(text)) #define N_RVAL2WIDGET(w) (NIL_P(w) ? NULL : GTK_WIDGET(RVAL2GOBJ(w))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_toolbar_new()); return Qnil; } static VALUE rg_append(int argc, VALUE *argv, VALUE self) { GtkWidget* ret = NULL; VALUE type = Qnil; VALUE widget, stock_id, element_type, text, ttext, ptext, icon, func; if (argc > 0) type = argv[0]; if (NIL_P(type) || TYPE(type) == T_STRING){ rb_scan_args(argc, argv, "05", &text, &ttext, &ptext, &icon, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_append_item(_SELF(self), N_RVAL2CSTR(text), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func); } else if (TYPE(type) == T_FIXNUM) { rb_scan_args(argc, argv, "07", &element_type, &widget, &text, &ttext, &ptext, &icon, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_append_element(_SELF(self), RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE), N_RVAL2WIDGET(widget), N_RVAL2CSTR(text), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func); if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) ret = NULL; } else if (TYPE(type) == T_SYMBOL) { rb_scan_args(argc, argv, "13", &stock_id, &ttext, &ptext, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func, -1); } else { rb_scan_args(argc, argv, "12", &widget, &ttext, &ptext); gtk_toolbar_append_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext)); return widget; } return ret ? GOBJ2RVAL(ret) : Qnil; } static VALUE rg_prepend(int argc, VALUE *argv, VALUE self) { GtkWidget* ret = NULL; VALUE type = Qnil; VALUE widget, stock_id, element_type, text, ttext, ptext, icon, func; if (argc > 0) type = argv[0]; if (NIL_P(type) || TYPE(type) == T_STRING){ rb_scan_args(argc, argv, "05", &text, &ttext, &ptext, &icon, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_prepend_item(_SELF(self), N_RVAL2CSTR(text), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func); } else if (TYPE(type) == T_FIXNUM) { rb_scan_args(argc, argv, "07", &element_type, &widget, &text, &ttext, &ptext, &icon, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_prepend_element(_SELF(self), RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE), N_RVAL2WIDGET(widget), N_RVAL2CSTR(text), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func); if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) ret = NULL; } else if (TYPE(type) == T_SYMBOL) { rb_scan_args(argc, argv, "13", &stock_id, &ttext, &ptext, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func, 0); } else { rb_scan_args(argc, argv, "12", &widget, &ttext, &ptext); gtk_toolbar_prepend_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext)); return widget; } return ret ? GOBJ2RVAL(ret) : Qnil; } static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { GtkWidget* ret = NULL; VALUE type = Qnil; VALUE pos, widget, stock_id, element_type, text, ttext, ptext, icon, func; if (argc > 1) type = argv[1]; if (NIL_P(type) || TYPE(type) == T_STRING){ rb_scan_args(argc, argv, "15", &pos, &text, &ttext, &ptext, &icon, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_insert_item(_SELF(self),N_RVAL2CSTR(text), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func, NUM2INT(pos)); } else if (TYPE(type) == T_FIXNUM) { rb_scan_args(argc, argv, "17", &pos, &element_type, &widget, &text, &ttext, &ptext, &icon, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_insert_element(_SELF(self), RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE), N_RVAL2WIDGET(widget), N_RVAL2CSTR(text), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func, NUM2INT(pos)); if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) ret = NULL; } else if (TYPE(type) == T_SYMBOL) { rb_scan_args(argc, argv, "14", &pos, &stock_id, &ttext, &ptext, &func); if (NIL_P(func)) func = rb_block_proc(); G_RELATIVE(self, func); ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), GTK_SIGNAL_FUNC(exec_callback), (gpointer)func, NUM2INT(pos)); } else if (rb_obj_is_kind_of(type, GTYPE2CLASS(GTK_TYPE_TOOL_ITEM))){ rb_scan_args(argc, argv, "20", &pos, &widget); gtk_toolbar_insert(_SELF(self), GTK_TOOL_ITEM(RVAL2GOBJ(widget)), NUM2INT(pos)); return widget; } else { rb_scan_args(argc, argv, "22", &pos, &widget, &ttext, &ptext); gtk_toolbar_insert_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)), N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext), NUM2INT(pos)); return widget; } return ret ? GOBJ2RVAL(ret) : Qnil; } static VALUE rg_item_index(VALUE self, VALUE item) { return INT2NUM(gtk_toolbar_get_item_index(_SELF(self), GTK_TOOL_ITEM(RVAL2GOBJ(item)))); } static VALUE rg_n_items(VALUE self) { return INT2NUM(gtk_toolbar_get_n_items(_SELF(self))); } static VALUE rg_nth_item(VALUE self, VALUE n) { return GOBJ2RVAL(gtk_toolbar_get_nth_item(_SELF(self), NUM2INT(n))); } static VALUE rg_drop_index(VALUE self, VALUE x, VALUE y) { return INT2NUM(gtk_toolbar_get_drop_index(_SELF(self), NUM2INT(x), NUM2INT(y))); } static VALUE rg_set_drop_highlight_item(VALUE self, VALUE item, VALUE index) { gtk_toolbar_set_drop_highlight_item(_SELF(self), GTK_TOOL_ITEM(RVAL2GOBJ(item)), NUM2INT(index)); return self; } static VALUE rg_relief_style(VALUE self) { return GENUM2RVAL(gtk_toolbar_get_relief_style(_SELF(self)), GTK_TYPE_RELIEF_STYLE); } static VALUE rg_append_space(VALUE self) { gtk_toolbar_append_space(_SELF(self)); return self; } static VALUE rg_prepend_space(VALUE self) { gtk_toolbar_prepend_space(_SELF(self)); return self; } static VALUE rg_insert_space(VALUE self, VALUE pos) { gtk_toolbar_insert_space(_SELF(self), NUM2INT(pos)); return self; } static VALUE rg_remove_space(VALUE self, VALUE position) { gtk_toolbar_remove_space(_SELF(self), NUM2INT(position)); return self; } static VALUE rg_unset_icon_size(VALUE self) { gtk_toolbar_unset_icon_size(_SELF(self)); return self; } static VALUE rg_unset_style(VALUE self) { gtk_toolbar_unset_style(_SELF(self)); return self; } void Init_gtk_toolbar(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOLBAR, "Toolbar", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(item_index, 1); RG_DEF_METHOD(n_items, 0); RG_DEF_METHOD(nth_item, 1); RG_DEF_METHOD(drop_index, 2); RG_DEF_METHOD(set_drop_highlight_item, 2); RG_DEF_METHOD(relief_style, 0); RG_DEF_METHOD(append, -1); RG_DEF_METHOD(prepend, -1); RG_DEF_METHOD(insert, -1); RG_DEF_METHOD(append_space, 0); RG_DEF_METHOD(prepend_space, 0); RG_DEF_METHOD(insert_space, 1); RG_DEF_METHOD(remove_space, 1); RG_DEF_METHOD(unset_icon_size, 0); RG_DEF_METHOD(unset_style, 0); /* GtkToolbarChildType */ G_DEF_CLASS(GTK_TYPE_TOOLBAR_CHILD_TYPE, "ChildType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TOOLBAR_CHILD_TYPE, "GTK_TOOLBAR_"); /* GtkToolbarSpaceStyle */ G_DEF_CLASS(GTK_TYPE_TOOLBAR_SPACE_STYLE, "SpaceStyle", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TOOLBAR_SPACE_STYLE, "GTK_TOOLBAR_"); /* GtkToolbarStyle(from Standard Constants) */ G_DEF_CLASS(GTK_TYPE_TOOLBAR_STYLE, "Style", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TOOLBAR_STYLE, "GTK_TOOLBAR_"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkcolor.c����������������������������������������������������0000644�0001750�0001750�00000006535�12124610262�017431� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilechooserwidget.c����������������������������������������0000644�0001750�0001750�00000003301�12257552167�022045� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 cFileChooserWidget static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE action, back; GtkWidget* widget; rb_scan_args(argc, argv, "11", &action, &back); if (NIL_P(back)){ widget = gtk_file_chooser_widget_new(RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION)); } else { widget = gtk_file_chooser_widget_new_with_backend(RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION), RVAL2CSTR(back)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_file_chooser_widget(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_WIDGET, "FileChooserWidget", mGtk); RG_DEF_METHOD(initialize, -1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkkeymap.c���������������������������������������������������0000644�0001750�0001750�00000010733�12257552167�017614� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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()); } 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)))); } 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); RG_DEF_SMETHOD(for_display, 0); 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 } �������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrendererspinner.c��������������������������������������0000644�0001750�0001750�00000002560�11701304107�022370� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } ������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilesel.c��������������������������������������������������0000644�0001750�0001750�00000007166�11701304107�017755� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cFileSelection #define _SELF(self) GTK_FILE_SELECTION(RVAL2GOBJ(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE title; rb_scan_args(argc, argv, "01", &title); RBGTK_INITIALIZE(self, gtk_file_selection_new(NIL_P(title) ? NULL : RVAL2CSTR(title))); return Qnil; } static VALUE rg_complete(VALUE self, VALUE pattern) { gtk_file_selection_complete(_SELF(self), RVAL2CSTR(pattern)); return self; } static VALUE rg_show_fileop_buttons(VALUE self) { gtk_file_selection_show_fileop_buttons(_SELF(self)); return Qnil; } static VALUE rg_hide_fileop_buttons(VALUE self) { gtk_file_selection_hide_fileop_buttons(_SELF(self)); return Qnil; } static VALUE rg_selections(VALUE self) { gchar** ptr = gtk_file_selection_get_selections(_SELF(self)); gchar** selections = ptr; VALUE ary = rb_ary_new(); while(*selections){ rb_ary_push(ary, CSTR2RVAL(*selections)); selections++; } if (ptr) g_strfreev(ptr); return ary; } static VALUE rg_fileop_dialog(VALUE self) { GtkWidget* widget = _SELF(self)->fileop_dialog; return widget ? GOBJ2RVAL(widget) : Qnil; } static VALUE rg_dir_list(VALUE self) { return GOBJ2RVAL(_SELF(self)->dir_list); } static VALUE rg_file_list(VALUE self) { return GOBJ2RVAL(_SELF(self)->file_list); } static VALUE rg_ok_button(VALUE self) { return GOBJ2RVAL(_SELF(self)->ok_button); } static VALUE rg_cancel_button(VALUE self) { return GOBJ2RVAL(_SELF(self)->cancel_button); } static VALUE rg_history_pulldown(VALUE self) { return GOBJ2RVAL(_SELF(self)->history_pulldown); } static VALUE rg_fileop_c_dir(VALUE self) { return GOBJ2RVAL(_SELF(self)->fileop_c_dir); } static VALUE rg_fileop_del_file(VALUE self) { return GOBJ2RVAL(_SELF(self)->fileop_del_file); } static VALUE rg_fileop_ren_file(VALUE self) { return GOBJ2RVAL(_SELF(self)->fileop_ren_file); } void Init_gtk_file_selection(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_SELECTION, "FileSelection", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(complete, 1); RG_DEF_METHOD(show_fileop_buttons, 0); RG_DEF_METHOD(hide_fileop_buttons, 0); RG_DEF_METHOD(selections, 0); RG_DEF_METHOD(fileop_dialog, 0); RG_DEF_METHOD(ok_button, 0); RG_DEF_METHOD(cancel_button, 0); RG_DEF_METHOD(dir_list, 0); RG_DEF_METHOD(file_list, 0); RG_DEF_METHOD(history_pulldown, 0); RG_DEF_METHOD(fileop_c_dir, 0); RG_DEF_METHOD(fileop_del_file, 0); RG_DEF_METHOD(fileop_ren_file, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentinfo.c�����������������������������������������������0000644�0001750�0001750�00000012726�12257552167�020506� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentInfo #define _SELF(self) ((GtkRecentInfo*)RVAL2BOXED(self, GTK_TYPE_RECENT_INFO)) static VALUE rg_uri(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_uri(_SELF(self))); } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_display_name(_SELF(self))); } static VALUE rg_description(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_description(_SELF(self))); } static VALUE rg_mime_type(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_mime_type(_SELF(self))); } static VALUE rg_added(VALUE self) { time_t t = gtk_recent_info_get_added(_SELF(self)); return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t)); } static VALUE rg_modified(VALUE self) { time_t t = gtk_recent_info_get_modified(_SELF(self)); return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t)); } static VALUE rg_visited(VALUE self) { time_t t = gtk_recent_info_get_visited(_SELF(self)); return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t)); } static VALUE rg_private_hint_p(VALUE self) { return CBOOL2RVAL(gtk_recent_info_get_private_hint(_SELF(self))); } static VALUE rg_application_info(VALUE self, VALUE app_name) { const gchar *app_exec; guint count; time_t t; gboolean ret = gtk_recent_info_get_application_info(_SELF(self), RVAL2CSTR(app_name), &app_exec, &count, &t); VALUE ary = rb_ary_new(); if (ret){ rb_ary_push(ary, CSTR2RVAL(app_exec)); rb_ary_push(ary, UINT2NUM(count)); rb_ary_push(ary, rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(t))); } return ary; } static VALUE rg_applications(VALUE self) { gsize i; gsize length; gchar** str = gtk_recent_info_get_applications(_SELF(self), &length); VALUE ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(str[i])); } g_strfreev(str); return ary; } static VALUE rg_last_application(VALUE self) { return CSTR2RVAL(gtk_recent_info_last_application(_SELF(self))); } static VALUE rg_groups(VALUE self) { gsize i; gsize length; gchar** str = gtk_recent_info_get_groups(_SELF(self), &length); VALUE ary = rb_ary_new(); for(i = 0; i < length; i++){ rb_ary_push(ary, CSTR2RVAL(str[i])); } g_strfreev(str); return ary; } static VALUE rg_has_group_p(VALUE self, VALUE group_name) { return CBOOL2RVAL(gtk_recent_info_has_group(_SELF(self), RVAL2CSTR(group_name))); } static VALUE rg_has_application_p(VALUE self, VALUE app_name) { return CBOOL2RVAL(gtk_recent_info_has_application(_SELF(self), RVAL2CSTR(app_name))); } static VALUE rg_get_icon(VALUE self, VALUE size) { return GOBJ2RVAL(gtk_recent_info_get_icon(_SELF(self), NUM2INT(size))); } static VALUE rg_short_name(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_short_name(_SELF(self))); } static VALUE rg_uri_display(VALUE self) { return CSTR2RVAL(gtk_recent_info_get_uri_display(_SELF(self))); } static VALUE rg_age(VALUE self) { return INT2NUM(gtk_recent_info_get_age(_SELF(self))); } static VALUE rg_local_p(VALUE self) { return CBOOL2RVAL(gtk_recent_info_is_local(_SELF(self))); } static VALUE rg_exist_p(VALUE self) { return CBOOL2RVAL(gtk_recent_info_exists(_SELF(self))); } static VALUE rg_operator_ri_match(VALUE self, VALUE other) { return CBOOL2RVAL(gtk_recent_info_match(_SELF(self), _SELF(other))); } void Init_gtk_recent_info(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_INFO, "RecentInfo", mGtk); RG_DEF_METHOD(uri, 0); RG_DEF_METHOD(display_name, 0); RG_DEF_METHOD(description, 0); RG_DEF_METHOD(mime_type, 0); RG_DEF_METHOD(added, 0); RG_DEF_METHOD(modified, 0); RG_DEF_METHOD(visited, 0); RG_DEF_METHOD_P(private_hint, 0); RG_DEF_METHOD(application_info, 1); RG_DEF_METHOD(applications, 0); RG_DEF_METHOD(last_application, 0); RG_DEF_METHOD(groups, 0); RG_DEF_METHOD_P(has_group, 1); RG_DEF_METHOD_P(has_application, 1); RG_DEF_METHOD(get_icon, 1); RG_DEF_METHOD(short_name, 0); RG_DEF_METHOD(uri_display, 0); RG_DEF_METHOD(age, 0); RG_DEF_METHOD_P(local, 0); RG_DEF_METHOD_P(exist, 0); RG_DEF_METHOD_OPERATOR("==", ri_match, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreepath.c�������������������������������������������������0000644�0001750�0001750�00000011133�11701304107�020133� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 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 cTreePath #define _SELF(s) ((GtkTreePath*)RVAL2BOXED(s, GTK_TYPE_TREE_PATH)) static ID id_equal; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE path; GtkTreePath* widget; if (argc == 1) { path = argv[0]; if (TYPE(path) == T_STRING){ widget = gtk_tree_path_new_from_string(RVAL2CSTR(path)); } else { widget = gtk_tree_path_new(); gtk_tree_path_append_index(widget, NUM2INT(path)); } if (widget == NULL) rb_raise(rb_eArgError, "Invalid path %s was passed.", RVAL2CSTR(path)); } else { int i; widget = gtk_tree_path_new(); for (i = 0; i < argc; i++) gtk_tree_path_append_index(widget, NUM2INT(argv[i])); } G_INITIALIZE(self, widget); return Qnil; } static VALUE rg_to_str(VALUE self) { gchar* s = gtk_tree_path_to_string(_SELF(self)); VALUE result = CSTR2RVAL(s); g_free(s); return result; } /* Do we need this ? GtkTreePath* gtk_tree_path_new_first (void); Deprecated #define gtk_tree_path_new_root () */ static VALUE rg_append_index(VALUE self, VALUE index) { gtk_tree_path_append_index(_SELF(self), NUM2INT(index)); return self; } static VALUE rg_prepend_index(VALUE self, VALUE index) { gtk_tree_path_prepend_index(_SELF(self), NUM2INT(index)); return self; } static VALUE rg_depth(VALUE self) { return INT2NUM(gtk_tree_path_get_depth(_SELF(self))); } static VALUE rg_indices(VALUE self) { VALUE ary; gint i, length; gint* indices; length = gtk_tree_path_get_depth(_SELF(self)); indices = gtk_tree_path_get_indices(_SELF(self)); if (indices != NULL) { ary = rb_ary_new2(length); for (i = 0; i < length; i++) { rb_ary_push(ary, INT2NUM(indices[i])); } return ary; } else { return Qnil; } } static VALUE rg_operator_treepath_compare(VALUE self, VALUE other) { return INT2NUM(gtk_tree_path_compare(_SELF(self), _SELF(other))); } static VALUE rg_operator_treepath_equal(VALUE self, VALUE other) { if (!RVAL2CBOOL(rb_funcall(CLASS_OF(self), id_equal, 1, CLASS_OF(other)))) { return Qfalse; } return CBOOL2RVAL(gtk_tree_path_compare(_SELF(self), _SELF(other)) == 0); } static VALUE rg_next_bang(VALUE self) { gtk_tree_path_next(_SELF(self)); return self; } static VALUE rg_prev_bang(VALUE self) { return CBOOL2RVAL(gtk_tree_path_prev(_SELF(self))); } static VALUE rg_up_bang(VALUE self) { return CBOOL2RVAL(gtk_tree_path_up(_SELF(self))); } static VALUE rg_down_bang(VALUE self) { gtk_tree_path_down(_SELF(self)); return Qtrue; } static VALUE rg_ancestor_p(VALUE self, VALUE descendant) { return CBOOL2RVAL(gtk_tree_path_is_ancestor(_SELF(self), _SELF(descendant))); } static VALUE rg_descendant_p(VALUE self, VALUE ancestor) { return CBOOL2RVAL(gtk_tree_path_is_descendant(_SELF(self), _SELF(ancestor))); } void Init_gtk_treepath(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_PATH, "TreePath", mGtk); id_equal = rb_intern("=="); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(to_str, 0); RG_DEF_ALIAS("to_s", "to_str"); RG_DEF_METHOD(append_index, 1); RG_DEF_METHOD(prepend_index, 1); RG_DEF_METHOD(depth, 0); RG_DEF_METHOD(indices, 0); RG_DEF_METHOD_OPERATOR("<=>", treepath_compare, 1); RG_DEF_METHOD_OPERATOR("==", treepath_equal, 1); RG_DEF_METHOD_BANG(next, 0); RG_DEF_METHOD_BANG(prev, 0); RG_DEF_METHOD_BANG(up, 0); RG_DEF_METHOD_BANG(down, 0); RG_DEF_METHOD_P(ancestor, 1); RG_DEF_METHOD_P(descendant, 1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkrgb.c������������������������������������������������������0000644�0001750�0001750�00000014570�11701304107�017061� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } ����������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrendererprogress.c�������������������������������������0000644�0001750�0001750�00000002424�12257552167�022577� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cCellRendererProgress static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_cell_renderer_progress_new()); return Qnil; } void Init_gtk_cellrendererprogress(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_PROGRESS, "CellRendererProgress", mGtk); RG_DEF_METHOD(initialize, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaction.c���������������������������������������������������0000644�0001750�0001750�00000013247�12257552167�017626� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } static VALUE rg_accel_path(VALUE self) { return CSTR2RVAL(gtk_action_get_accel_path(_SELF(self))); } static VALUE rg_accel_closure(VALUE self) { return BOXED2RVAL(gtk_action_get_accel_closure(_SELF(self)), G_TYPE_CLOSURE); } 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); } } void Init_gtk_action(VALUE mGtk) { 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"); RG_DEF_METHOD(accel_path, 0); RG_DEF_METHOD(accel_closure, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreeviewcolumn.c�������������������������������������������0000644�0001750�0001750�00000020406�12257552167�021414� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTreeViewColumn #define _SELF(s) (GTK_TREE_VIEW_COLUMN(RVAL2GOBJ(s))) #define RVAL2CELLRENDERER(c) (GTK_CELL_RENDERER(RVAL2GOBJ(c))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { int i; int col; GtkTreeViewColumn *tvc; GtkCellRenderer *renderer; const gchar *name; VALUE ary, val; tvc = gtk_tree_view_column_new(); if (argc > 0){ gtk_tree_view_column_set_title(tvc, RVAL2CSTR(argv[0])); if (argc > 1) { gtk_tree_view_column_pack_start(tvc, RVAL2CELLRENDERER(argv[1]), TRUE); G_CHILD_ADD(self, argv[1]); } } RBGTK_INITIALIZE(self, tvc); if (argc == 3){ ary = rb_funcall(argv[2], rb_intern("to_a"), 0); renderer = RVAL2CELLRENDERER(argv[1]); for (i = 0; i < RARRAY_LEN(ary); i++) { val = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(val)) { name = rb_id2name(SYM2ID(val)); } else { name = RVAL2CSTR(val); } col = NUM2INT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); gtk_tree_view_column_add_attribute(_SELF(self), renderer, name, col); } } return Qnil; } static VALUE rg_pack_start(VALUE self, VALUE cell, VALUE expand) { G_CHILD_ADD(self, cell); gtk_tree_view_column_pack_start(_SELF(self), RVAL2CELLRENDERER(cell), RVAL2CBOOL(expand)); return self; } static VALUE rg_pack_end(VALUE self, VALUE cell, VALUE expand) { G_CHILD_ADD(self, cell); gtk_tree_view_column_pack_end(_SELF(self), RVAL2CELLRENDERER(cell), RVAL2CBOOL(expand)); return self; } static VALUE rg_clear(VALUE self) { G_CHILD_REMOVE_ALL(self); gtk_tree_view_column_clear(_SELF(self)); return self; } static VALUE rg_cell_renderers(VALUE self) { return GLIST2ARYF(gtk_tree_view_column_get_cell_renderers(_SELF(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_tree_view_column_add_attribute(_SELF(self), RVAL2CELLRENDERER(cell), name, NUM2INT(column)); return self; } static VALUE rg_set_attributes(VALUE self, VALUE renderer, VALUE attributes) { GtkTreeViewColumn *tvc; GtkCellRenderer *grenderer; const gchar *name; int i, col; VALUE ary, val; Check_Type(attributes, T_HASH); tvc = _SELF(self); grenderer = RVAL2CELLRENDERER(renderer); gtk_tree_view_column_clear_attributes(tvc, grenderer); ary = rb_funcall(attributes, rb_intern("to_a"), 0); for (i = 0; i < RARRAY_LEN(ary); i++) { val = RARRAY_PTR(RARRAY_PTR(ary)[i])[0]; if (SYMBOL_P(val)) { name = rb_id2name(SYM2ID(val)); } else { name = RVAL2CSTR(val); } col = NUM2INT(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]); gtk_tree_view_column_add_attribute(tvc, grenderer, name, col); } return self; } static void cell_data_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer func) { iter->user_data3 = model; rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(tree_column), GOBJ2RVAL(cell), GOBJ2RVAL(model), GTKTREEITER2RVAL(iter)); } static VALUE rg_set_cell_data_func(VALUE self, VALUE renderer) { volatile VALUE func = rb_block_proc(); G_RELATIVE(self, func); G_RELATIVE(renderer, func); gtk_tree_view_column_set_cell_data_func(_SELF(self), RVAL2CELLRENDERER(renderer), (GtkTreeCellDataFunc)cell_data_func, (gpointer)func, NULL); return self; } static VALUE rg_clear_attributes(VALUE self, VALUE cell) { gtk_tree_view_column_clear_attributes(_SELF(self), RVAL2CELLRENDERER(cell)); return self; } static VALUE rg_clicked(VALUE self) { gtk_tree_view_column_clicked(_SELF(self)); return self; } static VALUE rg_cell_set_cell_data(VALUE self, VALUE model, VALUE iter, VALUE is_expander, VALUE is_expanded) { gtk_tree_view_column_cell_set_cell_data(_SELF(self), GTK_TREE_MODEL(RVAL2GOBJ(model)), RVAL2GTKTREEITER(iter), RVAL2CBOOL(is_expander), RVAL2CBOOL(is_expanded)); return self; } static VALUE rg_cell_size(VALUE self) { GdkRectangle cell_area; gint x_offset, y_offset, width, height; VALUE cell; /* Is this collect implement for cell_area ? */ cell_area.x = -1; cell_area.y = -1; cell_area.width = -1; cell_area.height = -1; gtk_tree_view_column_cell_get_size(_SELF(self), &cell_area, &x_offset, &y_offset, &width, &height); if (cell_area.x == -1 || cell_area.y == -1 || cell_area.width == -1 || cell_area.height == -1){ cell = Qnil; } else { cell = BOXED2RVAL(&cell_area, GDK_TYPE_RECTANGLE); } return rb_ary_new3(5, cell, x_offset ? INT2NUM(x_offset) : Qnil, y_offset ? INT2NUM(y_offset) : Qnil, width ? INT2NUM(width) : Qnil, height ? INT2NUM(height) : Qnil); } static VALUE rg_cell_is_visible_p(VALUE self) { return CBOOL2RVAL(gtk_tree_view_column_cell_is_visible(_SELF(self))); } static VALUE rg_focus_cell(VALUE self, VALUE renderer) { gtk_tree_view_column_focus_cell(_SELF(self), RVAL2CELLRENDERER(renderer)); return self; } static VALUE rg_queue_resize(VALUE self) { gtk_tree_view_column_queue_resize(_SELF(self)); return self; } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_tree_view(VALUE self) { return GOBJ2RVAL(gtk_tree_view_column_get_tree_view(_SELF(self))); } #endif #if !GTK_CHECK_VERSION(2,18,0) static VALUE rg_sort_column_id(VALUE self) { return INT2NUM(gtk_tree_view_column_get_sort_column_id(_SELF(self))); } static VALUE rg_set_sort_column_id(VALUE self, VALUE id) { gtk_tree_view_column_set_sort_column_id(_SELF(self), NUM2INT(id)); return self; } #endif void Init_gtk_treeviewcolumn(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_VIEW_COLUMN, "TreeViewColumn", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(pack_start, 2); RG_DEF_METHOD(pack_end, 2); RG_DEF_METHOD(clear, 0); RG_DEF_METHOD(cell_renderers, 0); RG_DEF_METHOD(add_attribute, 3); RG_DEF_METHOD(set_attributes, 2); RG_DEF_METHOD(set_cell_data_func, 1); RG_DEF_METHOD(clear_attributes, 1); RG_DEF_METHOD(clicked, 0); RG_DEF_METHOD(cell_set_cell_data, 4); RG_DEF_METHOD(cell_size, 0); RG_DEF_METHOD_P(cell_is_visible, 0); RG_DEF_METHOD(focus_cell, 1); RG_DEF_METHOD(queue_resize, 0); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(tree_view, 0); #endif #if !GTK_CHECK_VERSION(2,18,0) RG_DEF_METHOD(sort_column_id, 0); RG_DEF_METHOD(set_sort_column_id, 1); RG_DEF_ALIAS("sort_column_id=", "set_sort_column_id"); #endif /* GtkTreeViewColumnSizing */ G_DEF_CLASS(GTK_TYPE_TREE_VIEW_COLUMN_SIZING, "Sizing", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TREE_VIEW_COLUMN_SIZING, "GTK_TREE_VIEW_COLUMN_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilechooserbutton.c����������������������������������������0000644�0001750�0001750�00000004113�12257552167�022077� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cFileChooserButton static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE title, action, backend; GtkWidget* widget; rb_scan_args(argc, argv, "12", &title, &action, &backend); if (TYPE(title) == T_STRING) { if (NIL_P(backend)){ widget = gtk_file_chooser_button_new(RVAL2CSTR(title), RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION)); } else { widget = gtk_file_chooser_button_new_with_backend(RVAL2CSTR(title), RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION), RVAL2CSTR(backend)); } } else { widget = gtk_file_chooser_button_new_with_dialog(GTK_WIDGET(RVAL2GOBJ(title))); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_filechooserbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_BUTTON, "FileChooserButton", mGtk); RG_DEF_METHOD(initialize, -1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcolorsel.c�������������������������������������������������0000644�0001750�0001750�00000013117�12257552167�020167� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } 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; } /* 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); RG_DEF_SMETHOD(set_change_palette_hook, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcombobox.c�������������������������������������������������0000644�0001750�0001750�00000010541�12257552167�020153� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } 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; } void Init_gtk_combobox(VALUE mGtk) { 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); RG_DEF_METHOD(active_text, 0); RG_DEF_METHOD(popup_accessible, 0); RG_DEF_METHOD(set_row_separator_func, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkimmulticontext.c�������������������������������������������0000644�0001750�0001750�00000002766�11701304107�021420� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cIMMulticontext #define _SELF(self) (GTK_IM_MULTICONTEXT(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_im_multicontext_new()); return Qnil; } static VALUE rg_append_menuitems(VALUE self, VALUE menushell) { gtk_im_multicontext_append_menuitems(_SELF(self), RVAL2GOBJ(menushell)); return self; } void Init_gtk_im_multicontext(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IM_MULTICONTEXT, "IMMulticontext", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(append_menuitems, 1); } ����������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkruler.c����������������������������������������������������0000644�0001750�0001750�00000004237�11701304107�017457� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cRuler #define _SELF(self) (GTK_RULER(RVAL2GOBJ(self))) static VALUE rg_set_range(VALUE self, VALUE lower, VALUE upper, VALUE position, VALUE max_size) { gtk_ruler_set_range(_SELF(self), NUM2DBL(lower), NUM2DBL(upper), NUM2DBL(position), NUM2DBL(max_size)); return self; } static VALUE rg_range(VALUE self) { gdouble lower, upper, position, max_size; gtk_ruler_get_range(_SELF(self), &lower, &upper, &position, &max_size); return rb_ary_new3(4, rb_float_new(lower), rb_float_new(upper), rb_float_new(position), rb_float_new(max_size)); } static VALUE rg_draw_ticks(VALUE self) { gtk_ruler_draw_ticks(_SELF(self)); return self; } static VALUE rg_draw_pos(VALUE self) { gtk_ruler_draw_pos(_SELF(self)); return self; } void Init_gtk_ruler(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RULER, "Ruler", mGtk); RG_DEF_METHOD(set_range, 4); G_DEF_SETTER(RG_TARGET_NAMESPACE, "range"); RG_DEF_METHOD(range, 0); RG_DEF_METHOD(draw_ticks, 0); RG_DEF_METHOD(draw_pos, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkpixbuf.c���������������������������������������������������0000644�0001750�0001750�00000015007�12257552167�017622� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; rb_warn("Gdk::Pixbuf#render_to_drawable is obsolete. Use Gdk::Drawable#draw_pixbuf instead."); 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); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktooltips.c�������������������������������������������������0000644�0001750�0001750�00000005662�12257552167�020230� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cTooltips #define _SELF(self) (GTK_TOOLTIPS(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_tooltips_new()); return Qnil; } static VALUE rg_enable(VALUE self) { gtk_tooltips_enable(_SELF(self)); return self; } static VALUE rg_disable(VALUE self) { gtk_tooltips_disable(_SELF(self)); return self; } static VALUE rg_set_tip(VALUE self, VALUE win, VALUE text, VALUE priv) { gtk_tooltips_set_tip(_SELF(self), GTK_WIDGET(RVAL2GOBJ(win)), NIL_P(text)?NULL:RVAL2CSTR(text), NIL_P(priv)?NULL:RVAL2CSTR(priv)); return self; } static VALUE rg_s_get_data(G_GNUC_UNUSED VALUE self, VALUE widget) { GtkTooltipsData* data = gtk_tooltips_data_get(GTK_WIDGET(RVAL2GOBJ(widget))); return rb_ary_new3(3, GOBJ2RVAL(data->widget), CSTR2RVAL(data->tip_text), CSTR2RVAL(data->tip_private)); } static VALUE rg_force_window(VALUE self) { gtk_tooltips_force_window(_SELF(self)); return self; } static VALUE rg_s_get_info(G_GNUC_UNUSED VALUE self, VALUE window) { GtkTooltips* tooltips; GtkWidget* current_widget; gboolean ret = gtk_tooltips_get_info_from_tip_window(GTK_WINDOW(RVAL2GOBJ(window)), &tooltips, ¤t_widget); if (ret) return rb_assoc_new(GOBJ2RVAL(tooltips), GOBJ2RVAL(current_widget)); else return Qnil; } void Init_gtk_tooltips(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOLTIPS, "Tooltips", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_tip, 3); RG_DEF_METHOD(enable, 0); RG_DEF_METHOD(disable, 0); RG_DEF_METHOD(force_window, 0); RG_DEF_SMETHOD(get_info, 1); RG_DEF_SMETHOD(get_data, 1); } ������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkentry.c����������������������������������������������������0000644�0001750�0001750�00000006151�12257552167�017506� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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)); } 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))); } 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); RG_DEF_METHOD(set_completion, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "completion"); RG_DEF_METHOD(completion, 0); 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 } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkclipboard.c������������������������������������������������0000644�0001750�0001750�00000027334�12257552167�020312� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 { VALUE display, selection; rb_scan_args(argc, argv, "20", &display, &selection); clipboard = gtk_clipboard_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)), RVAL2ATOM(selection)); } return CLIPBOARD2RVAL(clipboard); } static VALUE rg_display(VALUE self) { return GOBJ2RVAL(gtk_clipboard_get_display(_SELF(self))); } 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; } static VALUE rg_set_image(VALUE self, VALUE pixbuf) { gtk_clipboard_set_image(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf))); return self; } 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; } 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; } 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; } 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; } 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; } static VALUE rg_wait_for_image(VALUE self) { GdkPixbuf* pixbuf = gtk_clipboard_wait_for_image(_SELF(self)); return GOBJ2RVAL(pixbuf); } 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)); } } static VALUE rg_wait_is_text_available_p(VALUE self) { return CBOOL2RVAL(gtk_clipboard_wait_is_text_available(_SELF(self))); } static VALUE rg_wait_is_image_available_p(VALUE self) { return CBOOL2RVAL(gtk_clipboard_wait_is_image_available(_SELF(self))); } 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)))); } 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; } 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; } 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); RG_DEF_METHOD(set_image, 1); RG_DEF_METHOD(request_contents, 1); RG_DEF_METHOD(request_text, 0); RG_DEF_METHOD(request_image, 0); RG_DEF_METHOD(request_targets, 0); RG_DEF_METHOD(request_rich_text, 1); RG_DEF_METHOD(wait_for_contents, 1); RG_DEF_METHOD(wait_for_text, 0); RG_DEF_METHOD(wait_for_image, 0); RG_DEF_METHOD(wait_for_rich_text, 1); RG_DEF_METHOD_P(wait_is_text_available, 0); RG_DEF_METHOD_P(wait_is_image_available, 0); RG_DEF_METHOD_P(wait_is_rich_text_available, 1); RG_DEF_METHOD(wait_for_targets, 0); RG_DEF_METHOD_P(wait_is_target_available, 1); RG_DEF_METHOD(set_can_store, 1); RG_DEF_METHOD(store, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkobject.c���������������������������������������������������0000644�0001750�0001750�00000010153�11701304107�017566� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cObject /* We shouldn't implement it. void gtk_object_sink (GtkObject *object); #define GTK_OBJECT_FLOATING (obj) gtk_object_new is deprecated. Use g_object_new instead. GtkObject* gtk_object_new (GtkType type, const gchar *first_property_name, ...); */ static VALUE rg_type_name(VALUE self) { return CSTR2RVAL(GTK_OBJECT_TYPE_NAME(RVAL2GOBJ(self))); } static VALUE rg_destroy(VALUE self) { gtk_object_destroy(GTK_OBJECT(RVAL2GOBJ(self))); return Qnil; } static VALUE rg_flags(VALUE self) { /* _GtkObject.flags is int32 */ return(INT2FIX(GTK_OBJECT_FLAGS(RVAL2GOBJ(self)))); } static VALUE rg_set_flags(VALUE self, VALUE flags) { GTK_OBJECT_SET_FLAGS(RVAL2GOBJ(self), NUM2INT(flags)); return self; } static VALUE rg_unset_flags(VALUE self, VALUE flags) { GTK_OBJECT_UNSET_FLAGS(RVAL2GOBJ(self), NUM2INT(flags)); return self; } /* Move from Bindings */ static VALUE rg_bindings_activate(VALUE self, VALUE keyval, VALUE modifiers) { return CBOOL2RVAL(gtk_bindings_activate(GTK_OBJECT(RVAL2GOBJ(self)), NUM2UINT(keyval), NUM2UINT(modifiers))); } /* Move from Bindings */ static VALUE rg_s_binding_set(VALUE self) { GType gtype; gpointer gclass; GtkBindingSet* binding_set; Check_Type(self, T_CLASS); gtype = CLASS2GTYPE(self); if (!G_TYPE_IS_CLASSED(gtype)) { rb_raise(rb_eTypeError, "%s is not a classed GType", rb_class2name(self)); } gclass = g_type_class_ref(gtype); if (!gclass) { rb_raise(rb_eRuntimeError, "couldn't get class reference"); } if (!GTK_IS_OBJECT_CLASS(gclass)) { g_type_class_unref(gclass); rb_raise(rb_eTypeError, "%s is not a Gtk Object class", rb_class2name(self)); } binding_set = gtk_binding_set_by_class(gclass); if (!binding_set) { g_type_class_unref(gclass); rb_raise(rb_eRuntimeError, "couldn't get BindingSet from %s", rb_class2name(self)); } g_type_class_unref(gclass); return BOXED2RVAL(binding_set, GTK_TYPE_BINDING_SET); } void Init_gtk_object(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_OBJECT, "Object", mGtk); RG_DEF_SMETHOD(binding_set, 0); RG_DEF_METHOD(type_name, 0); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(set_flags, 1); RG_DEF_METHOD(unset_flags, 1); RG_DEF_METHOD(destroy, 0); RG_DEF_METHOD(bindings_activate, 2); /* GtkObjectFlags */ G_DEF_CLASS(GTK_TYPE_OBJECT_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_OBJECT_FLAGS, "GTK_"); /* undef deprecated properties */ rb_undef_method(RG_TARGET_NAMESPACE, "user_data"); rb_undef_method(RG_TARGET_NAMESPACE, "user_data="); rb_undef_method(RG_TARGET_NAMESPACE, "set_user_data"); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkradiobutton.c����������������������������������������������0000644�0001750�0001750�00000006130�11701304107�020652� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cRadioButton static VALUE RG_TARGET_NAMESPACE; #define _GROUP(s) (NIL_P(s) ? NULL : GTK_RADIO_BUTTON(RVAL2GOBJ(s))) static GtkWidget* create_button(VALUE group, VALUE label, VALUE use_underline) { GtkWidget* widget = NULL; if (TYPE(label) == T_STRING){ if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){ widget = gtk_radio_button_new_with_mnemonic_from_widget(_GROUP(group), RVAL2CSTR(label)); } else { widget = gtk_radio_button_new_with_label_from_widget(_GROUP(group), RVAL2CSTR(label)); } } else if (TYPE(label) == T_SYMBOL){ widget = gtk_radio_button_new_with_label_from_widget(_GROUP(group), rb_id2name(SYM2ID(label))); gtk_button_set_use_stock(GTK_BUTTON(widget), TRUE); } else if (NIL_P(label)){ widget = gtk_radio_button_new_from_widget(_GROUP(group)); } else { rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)", rb_class2name(CLASS_OF(label))); } return widget; } static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE group_or_label, label_or_use_underline, use_underline; GtkWidget *widget; if (rb_scan_args(argc, argv, "03", &group_or_label, &label_or_use_underline, &use_underline) > 0) { if (rb_obj_is_kind_of(group_or_label, RG_TARGET_NAMESPACE)){ widget = create_button(group_or_label, label_or_use_underline, use_underline); } else { widget = create_button(Qnil, group_or_label, label_or_use_underline); } } else { widget = gtk_radio_button_new(NULL); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_group(VALUE self) { /* Owned by GTK+ */ return GSLIST2ARY(gtk_radio_button_get_group(GTK_RADIO_BUTTON(RVAL2GOBJ(self)))); } void Init_gtk_radio_button(VALUE mGtk) { RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RADIO_BUTTON, "RadioButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(group, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkregion.c���������������������������������������������������0000644�0001750�0001750�00000017375�11701304107�017600� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkviewport.c�������������������������������������������������0000644�0001750�0001750�00000003011�11701304107�020172� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cViewport static VALUE rg_initialize(VALUE self, VALUE hadj, VALUE vadj) { GtkAdjustment *h_adj = GTK_ADJUSTMENT(RVAL2GOBJ(hadj)); GtkAdjustment *v_adj = GTK_ADJUSTMENT(RVAL2GOBJ(vadj)); RBGTK_INITIALIZE(self, gtk_viewport_new(h_adj, v_adj)); return Qnil; } void Init_gtk_viewport(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VIEWPORT, "Viewport", mGtk); RG_DEF_METHOD(initialize, 2); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcalendar.c�������������������������������������������������0000644�0001750�0001750�00000010132�12257552167�020110� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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)){ return GFLAGS2RVAL(gtk_calendar_get_display_options(_SELF(self)), GTK_TYPE_CALENDAR_DISPLAY_OPTIONS); } 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; } 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; } 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); RG_DEF_METHOD(set_display_options, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "display_options"); 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_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhbbox.c����������������������������������������������������0000644�0001750�0001750�00000002572�11701304107�017430� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHButtonBox static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_hbutton_box_new()); return Qnil; } void Init_gtk_hbutton_box(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HBUTTON_BOX, "HButtonBox", mGtk); RG_DEF_METHOD(initialize, 0); } ��������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkhbox.c�����������������������������������������������������0000644�0001750�0001750�00000003041�11701304107�017256� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cHBox static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE homogeneous, spacing; rb_scan_args(argc, argv, "02", &homogeneous, &spacing); RBGTK_INITIALIZE(self, gtk_hbox_new(RVAL2CBOOL(homogeneous), (NIL_P(spacing)?0:NUM2INT(spacing)))); return Qnil; } void Init_gtk_hbox(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_HBOX, "HBox", mGtk); RG_DEF_METHOD(initialize, -1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreedragdest.c���������������������������������������������0000644�0001750�0001750�00000002022�11701304107�020771� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" void Init_gtk_treedragdest(VALUE mGtk) { G_DEF_INTERFACE(GTK_TYPE_TREE_DRAG_DEST, "TreeDragDest", mGtk); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkiconset.c��������������������������������������������������0000644�0001750�0001750�00000005537�11701304107�017776� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cIconSet #define _SELF(s) ((GtkIconSet*)RVAL2BOXED(s, GTK_TYPE_ICON_SET)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkIconSet *icon_set; VALUE pixbuf; rb_scan_args(argc, argv, "01", &pixbuf); if(NIL_P(pixbuf)) icon_set = gtk_icon_set_new(); else icon_set = gtk_icon_set_new_from_pixbuf(RVAL2GOBJ(pixbuf)); G_INITIALIZE(self, icon_set); return Qnil; } static VALUE rg_add_source(VALUE self, VALUE source) { gtk_icon_set_add_source(_SELF(self), RVAL2BOXED(source, GTK_TYPE_ICON_SOURCE)); return self; } static VALUE rg_sizes(VALUE self) { GtkIconSize *sizes; gint n_sizes; VALUE result; int n; gtk_icon_set_get_sizes(_SELF(self), &sizes, &n_sizes); result = rb_ary_new(); for(n=0; n<n_sizes; n++, sizes++) rb_ary_push(result, GENUM2RVAL(*sizes, GTK_TYPE_ICON_SIZE)); return result; } static VALUE rg_render_icon(int argc, VALUE *argv, VALUE self) { VALUE style, direction, state, size, widget, detail; rb_scan_args(argc, argv, "42", &style, &direction, &state, &size, &widget, &detail); return GOBJ2RVAL(gtk_icon_set_render_icon(_SELF(self), RVAL2GOBJ(style), RVAL2GENUM(direction, GTK_TYPE_TEXT_DIRECTION), RVAL2GENUM(state, GTK_TYPE_STATE_TYPE), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE), NIL_P(widget) ? NULL : RVAL2GOBJ(widget), NIL_P(detail) ? NULL : RVAL2CSTR(detail))); } void Init_gtk_icon_set(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ICON_SET, "IconSet", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(add_source, 1); RG_DEF_METHOD(sizes, 0); RG_DEF_METHOD(render_icon, -1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkvseparator.c�����������������������������������������������0000644�0001750�0001750�00000002566�11701304107�020517� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cVSeparator static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_vseparator_new()); return Qnil; } void Init_gtk_vseparator(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VSEPARATOR, "VSeparator", mGtk); RG_DEF_METHOD(initialize, 0); } ������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkseparator.c������������������������������������������������0000644�0001750�0001750�00000002235�11701304107�020322� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" void Init_gtk_separator(VALUE mGtk) { G_DEF_CLASS(GTK_TYPE_SEPARATOR, "Separator", mGtk); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreemodel.c������������������������������������������������0000644�0001750�0001750�00000017710�12102213526�020306� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 mTreeModel #define _SELF(s) (GTK_TREE_MODEL(RVAL2GOBJ(s))) static VALUE rg_flags(VALUE self) { return GFLAGS2RVAL(gtk_tree_model_get_flags(_SELF(self)), GTK_TYPE_TREE_MODEL_FLAGS); } static VALUE rg_n_columns(VALUE self) { return INT2NUM(gtk_tree_model_get_n_columns(_SELF(self))); } static VALUE rg_get_column_type(VALUE self, VALUE index) { return GTYPE2CLASS(gtk_tree_model_get_column_type(_SELF(self), NUM2INT(index))); } static VALUE rg_iter_first(VALUE self) { VALUE val = Qnil; GtkTreeIter iter; GtkTreeModel* model = _SELF(self); gboolean ret = (gtk_tree_model_get_iter_first(model, &iter)); iter.user_data3 = model; if (ret) { val = GTKTREEITER2RVAL(&iter); } return val; } static VALUE rg_iter_root(VALUE self) { VALUE val = Qnil; GtkTreeIter iter; GtkTreeModel* model = _SELF(self); gboolean ret = (gtk_tree_model_get_iter_root(model, &iter)); iter.user_data3 = model; if (ret) { val = GTKTREEITER2RVAL(&iter); } return val; } static VALUE rg_iter_next(VALUE self, VALUE iter) { VALUE val = Qnil; gboolean ret = (gtk_tree_model_iter_next(_SELF(self), RVAL2GTKTREEITER(iter))); if (ret) { val = GTKTREEITER2RVAL(&iter); } return val; } static VALUE rg_get_iter(VALUE self, VALUE path) { VALUE val = Qnil; GtkTreeIter iter; gboolean ret; GtkTreeModel* model = _SELF(self); if (TYPE(path) == T_STRING){ ret = gtk_tree_model_get_iter_from_string(model, &iter, RVAL2CSTR(path)); } else { ret = gtk_tree_model_get_iter(model, &iter, RVAL2GTKTREEPATH(path)); } iter.user_data3 = model; if (ret) { val = GTKTREEITER2RVAL(&iter); } return val; } static VALUE rg_get_value(VALUE self, VALUE iter, VALUE column) { GValue value = G_VALUE_INIT; VALUE ret = Qnil; gtk_tree_model_get_value(_SELF(self), RVAL2GTKTREEITER(iter), NUM2INT(column), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } /* These methods may be neededless. void gtk_tree_model_ref_node (GtkTreeModel *tree_model, GtkTreeIter *iter); void gtk_tree_model_unref_node (GtkTreeModel *tree_model, GtkTreeIter *iter); */ /* XXXX void gtk_tree_model_get_valist (GtkTreeModel *tree_model, GtkTreeIter *iter, va_list var_args); */ static gboolean treemodel_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, G_GNUC_UNUSED gpointer func) { iter->user_data3 = model; rb_yield(rb_ary_new3(3, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter))); return FALSE; } static VALUE rg_each(VALUE self) { gtk_tree_model_foreach(_SELF(self), (GtkTreeModelForeachFunc)treemodel_foreach_func, (gpointer)NULL); return self; } static VALUE rg_row_changed(VALUE self, VALUE path, VALUE iter) { gtk_tree_model_row_changed(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_row_inserted(VALUE self, VALUE path, VALUE iter) { gtk_tree_model_row_inserted(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_row_has_child_toggled(VALUE self, VALUE path, VALUE iter) { gtk_tree_model_row_has_child_toggled(_SELF(self), RVAL2GTKTREEPATH(path), RVAL2GTKTREEITER(iter)); return self; } static VALUE rg_row_deleted(VALUE self, VALUE path) { gtk_tree_model_row_deleted(_SELF(self), RVAL2GTKTREEPATH(path)); return self; } static VALUE rg_rows_reordered(VALUE self, VALUE rbpath, VALUE rbiter, VALUE rbnew_order) { GtkTreeModel *proxy = _SELF(self); GtkTreePath *path = RVAL2GTKTREEPATH(rbpath); GtkTreeIter *iter = RVAL2GTKTREEITER(rbiter); gint columns = gtk_tree_model_get_n_columns(proxy); long n; gint *new_order = RVAL2GINTS(rbnew_order, n); if (n != columns) { g_free(new_order); rb_raise(rb_eArgError, "new order array must contain same number of elements as the number of columns in the store: %ld != %d", n, columns); } gtk_tree_model_rows_reordered(proxy, path, iter, new_order); g_free(new_order); return self; } static VALUE rg_iter_is_valid_p(G_GNUC_UNUSED VALUE self, G_GNUC_UNUSED VALUE iter) { return Qtrue; } static VALUE signal_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkTreeModel* model = g_value_get_object(&values[0]); GtkTreePath* path = g_value_get_boxed(&values[1]); GtkTreeIter* iter = g_value_get_boxed(&values[2]); iter->user_data3 = model; return rb_ary_new3(3, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter)); } static VALUE signal_rows_reordered_func(G_GNUC_UNUSED guint num, const GValue *values) { GtkTreeModel* model = g_value_get_object(&values[0]); GtkTreePath* path = g_value_get_boxed(&values[1]); GtkTreeIter* iter = g_value_get_boxed(&values[2]); gint* new_orders = (gint*)g_value_get_pointer(&values[3]); gint len = gtk_tree_model_iter_n_children(model, iter); VALUE orders = Qnil; int i; iter->user_data3 = model; orders = rb_ary_new2(len); for (i = 0; i < len; i++, new_orders++) { rb_ary_push(orders, INT2NUM(*new_orders)); } return rb_ary_new3(4, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter), orders); } void Init_gtk_treemodel(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TREE_MODEL, "TreeModel", mGtk); RG_DEF_METHOD(flags, 0); RG_DEF_METHOD(n_columns, 0); RG_DEF_METHOD(get_column_type, 1); RG_DEF_METHOD(iter_first, 0); RG_DEF_METHOD(iter_root, 0); RG_DEF_METHOD(iter_next, 1); RG_DEF_METHOD(get_iter, 1); RG_DEF_METHOD(get_value, 2); RG_DEF_METHOD(each, 0); RG_DEF_METHOD(row_changed, 2); RG_DEF_METHOD(row_inserted, 2); RG_DEF_METHOD(row_has_child_toggled, 2); RG_DEF_METHOD(row_deleted, 1); RG_DEF_METHOD(rows_reordered, 3); RG_DEF_METHOD_P(iter_is_valid, 1); /* GtkTreeModelFlags */ G_DEF_CLASS(GTK_TYPE_TREE_MODEL_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TREE_MODEL_FLAGS, "GTK_TREE_MODEL_"); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row_changed", (GValToRValSignalFunc)signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row_inserted", (GValToRValSignalFunc)signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row_has_child_toggled", (GValToRValSignalFunc)signal_func); G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "rows_reordered", (GValToRValSignalFunc)signal_rows_reordered_func); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ��������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfontselectiondialog.c��������������������������������������0000644�0001750�0001750�00000005712�11701304107�022361� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 <neilconway@rogers.com> * * 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 cFontSelectionDialog #define _SELF(self) (GTK_FONT_SELECTION_DIALOG(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE title; rb_scan_args(argc, argv, "01", &title); RBGTK_INITIALIZE(self, gtk_font_selection_dialog_new(NIL_P(title) ? NULL : RVAL2CSTR(title))); return Qnil; } static VALUE rg_font_name(VALUE self) { gchar* name = gtk_font_selection_dialog_get_font_name(_SELF(self)); return name ? CSTR2RVAL(name) : Qnil; } static VALUE rg_set_font_name(VALUE self, VALUE fontname) { return CBOOL2RVAL(gtk_font_selection_dialog_set_font_name(_SELF(self), RVAL2CSTR(fontname))); } static VALUE rg_preview_text(VALUE self) { const gchar* text = gtk_font_selection_dialog_get_preview_text(_SELF(self)); return text ? CSTR2RVAL(text) : Qnil; } static VALUE rg_set_preview_text(VALUE self, VALUE text) { gtk_font_selection_dialog_set_preview_text(_SELF(self), RVAL2CSTR(text)); return self; } static VALUE rg_font_selection(VALUE self) { return GOBJ2RVAL(_SELF(self)->fontsel); } static VALUE rg_ok_button(VALUE self) { return GOBJ2RVAL(_SELF(self)->ok_button); } static VALUE rg_cancel_button(VALUE self) { return GOBJ2RVAL(_SELF(self)->cancel_button); } static VALUE rg_apply_button(VALUE self) { return GOBJ2RVAL(_SELF(self)->apply_button); } void Init_gtk_font_selection_dialog(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FONT_SELECTION_DIALOG, "FontSelectionDialog", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(font_name, 0); RG_DEF_METHOD(set_font_name, 1); RG_DEF_METHOD(preview_text, 0); RG_DEF_METHOD(set_preview_text, 1); RG_DEF_METHOD(font_selection, 0); RG_DEF_METHOD(ok_button, 0); RG_DEF_METHOD(cancel_button, 0); RG_DEF_METHOD(apply_button, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfontselection.c��������������������������������������������0000644�0001750�0001750�00000002557�11701304107�021205� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 <neilconway@rogers.com> * * 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 cFontSelection static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_font_selection_new()); return Qnil; } void Init_gtk_font_selection(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_FONT_SELECTION, "FontSelection", mGtk); RG_DEF_METHOD(initialize, 0); rb_undef_method(RG_TARGET_NAMESPACE, "font"); } �������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkpapersize.c������������������������������������������������0000644�0001750�0001750�00000013346�12257552167�020353� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cPaperSize #define _SELF(s) (RVAL2BOXED(s, GTK_TYPE_PAPER_SIZE)) #define SIZE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_PAPER_SIZE)) #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkPaperSize *size; if (argc <= 1) { VALUE name; rb_scan_args(argc, argv, "01", &name); size = gtk_paper_size_new(RVAL2CSTR_ACCEPT_NIL(name)); } else if (argc == 4) { size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]), RVAL2CSTR(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3])); } else if (argc == 5) { size = gtk_paper_size_new_custom(RVAL2CSTR(argv[0]), RVAL2CSTR(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3]), RVAL2UNIT(argv[4])); } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 0, 1, 4 or 5)", argc); } G_INITIALIZE(self, size); return Qnil; } static VALUE rg_operator_equal(VALUE self, VALUE other) { return CBOOL2RVAL(RVAL2CBOOL(rb_equal(rb_obj_class(self), rb_obj_class(other))) && gtk_paper_size_is_equal(_SELF(self), _SELF(other))); } /* The width is always the shortest side, measure in mm */ static VALUE rg_name(VALUE self) { return CSTR2RVAL(gtk_paper_size_get_name(_SELF(self))); } static VALUE rg_display_name(VALUE self) { return CSTR2RVAL(gtk_paper_size_get_display_name(_SELF(self))); } static VALUE rg_ppd_name(VALUE self) { return CSTR2RVAL(gtk_paper_size_get_ppd_name(_SELF(self))); } static VALUE rg_get_width(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_width(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_get_height(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_height(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_custom_p(VALUE self) { return CBOOL2RVAL(gtk_paper_size_is_custom(_SELF(self))); } /* Only for custom sizes: */ static VALUE rg_set_size(VALUE self, VALUE width, VALUE height, VALUE unit) { gtk_paper_size_set_size(_SELF(self), NUM2DBL(width), NUM2DBL(height), RVAL2UNIT(unit)); return self; } static VALUE rg_get_default_top_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_top_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_get_default_bottom_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_bottom_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_get_default_left_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_left_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_get_default_right_margin(VALUE self, VALUE unit) { return rb_float_new(gtk_paper_size_get_default_right_margin(_SELF(self), RVAL2UNIT(unit))); } static VALUE rg_s_default(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(gtk_paper_size_get_default()); } void Init_gtk_paper_size(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PAPER_SIZE, "PaperSize", mGtk); RG_DEF_SMETHOD(default, 0); rb_define_const(RG_TARGET_NAMESPACE, "A3", CSTR2RVAL(GTK_PAPER_NAME_A3)); rb_define_const(RG_TARGET_NAMESPACE, "A4", CSTR2RVAL(GTK_PAPER_NAME_A4)); rb_define_const(RG_TARGET_NAMESPACE, "A5", CSTR2RVAL(GTK_PAPER_NAME_A5)); rb_define_const(RG_TARGET_NAMESPACE, "B5", CSTR2RVAL(GTK_PAPER_NAME_B5)); rb_define_const(RG_TARGET_NAMESPACE, "LETTER", CSTR2RVAL(GTK_PAPER_NAME_LETTER)); rb_define_const(RG_TARGET_NAMESPACE, "EXECUTIVE", CSTR2RVAL(GTK_PAPER_NAME_EXECUTIVE)); rb_define_const(RG_TARGET_NAMESPACE, "LEGAL", CSTR2RVAL(GTK_PAPER_NAME_LEGAL)); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD_OPERATOR("==", equal, 1); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(display_name, 0); RG_DEF_METHOD(ppd_name, 0); RG_DEF_METHOD(get_width, 1); RG_DEF_METHOD(get_height, 1); RG_DEF_METHOD_P(custom, 0); RG_DEF_METHOD(set_size, 3); RG_DEF_METHOD(get_default_top_margin, 1); RG_DEF_METHOD(get_default_bottom_margin, 1); RG_DEF_METHOD(get_default_left_margin, 1); RG_DEF_METHOD(get_default_right_margin, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkUnit */ G_DEF_CLASS(GTK_TYPE_UNIT, "Unit", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_UNIT, "GTK_"); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentaction.c���������������������������������������������0000644�0001750�0001750�00000004577�11701304107�021013� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #if GTK_CHECK_VERSION(2,12,0) #define RG_TARGET_NAMESPACE cRecentAction static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name, label, tooltip, stock_id, manager; rb_scan_args(argc, argv, "23", &name, &label, &tooltip, &stock_id, &manager); if (NIL_P(manager)) { G_INITIALIZE(self, gtk_recent_action_new(RVAL2CSTR(name), RVAL2CSTR(label), NIL_P(tooltip) ? NULL : RVAL2CSTR(tooltip), NIL_P(stock_id) ? NULL : RVAL2CSTR(stock_id))); } else { G_INITIALIZE(self, gtk_recent_action_new_for_manager(RVAL2CSTR(name), RVAL2CSTR(label), NIL_P(tooltip) ? NULL : RVAL2CSTR(tooltip), NIL_P(stock_id) ? NULL : RVAL2CSTR(stock_id), GTK_RECENT_MANAGER(RVAL2GOBJ(manager)))); } return Qnil; } #endif void Init_gtk_recentaction(VALUE mGtk) { #if GTK_CHECK_VERSION(2,12,0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_ACTION, "RecentAction", mGtk); RG_DEF_METHOD(initialize, -1); #endif } ���������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktogglebutton.c���������������������������������������������0000644�0001750�0001750�00000005460�11701304107�021042� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cToggleButton 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_toggle_button_new_with_mnemonic(RVAL2CSTR(label)); } else { widget = gtk_toggle_button_new_with_label(RVAL2CSTR(label)); } } else if (TYPE(label) == T_SYMBOL){ widget = gtk_toggle_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_toggle_button_new(); } RBGTK_INITIALIZE(self, widget); return Qnil; } static VALUE rg_set_mode(VALUE self, VALUE mode) { gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(RVAL2GOBJ(self)), RVAL2CBOOL(mode)); return self; } static VALUE rg_mode_p(VALUE self) { return CBOOL2RVAL(gtk_toggle_button_get_mode(GTK_TOGGLE_BUTTON(RVAL2GOBJ(self)))); } static VALUE rg_toggled(VALUE self) { gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(RVAL2GOBJ(self))); return self; } void Init_gtk_toggle_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOGGLE_BUTTON, "ToggleButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_mode, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "mode"); RG_DEF_METHOD_P(mode, 0); RG_DEF_METHOD(toggled, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrendererspin.c�����������������������������������������0000644�0001750�0001750�00000002473�12257552167�021710� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } void Init_gtk_cellrendererspin(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_SPIN, "CellRendererSpin", mGtk); RG_DEF_METHOD(initialize, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkitem.c�����������������������������������������������������0000644�0001750�0001750�00000003167�11701304107�017265� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cItem /* * Item */ static VALUE rg_select(VALUE self) { gtk_item_select(GTK_ITEM(RVAL2GOBJ(self))); return self; } static VALUE rg_deselect(VALUE self) { gtk_item_deselect(GTK_ITEM(RVAL2GOBJ(self))); return self; } static VALUE rg_toggle(VALUE self) { gtk_item_toggle(GTK_ITEM(RVAL2GOBJ(self))); return self; } void Init_gtk_item(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_ITEM, "Item", mGtk); RG_DEF_METHOD(select, 0); RG_DEF_METHOD(deselect, 0); RG_DEF_METHOD(toggle, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktexttag.c��������������������������������������������������0000644�0001750�0001750�00000004443�11701304107�020005� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * * 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 cTextTag static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE name; rb_scan_args(argc, argv, "01", &name); G_INITIALIZE(self, gtk_text_tag_new(NIL_P(name) ? NULL : RVAL2CSTR(name))); return Qnil; } static VALUE rg_priority(VALUE self) { return INT2NUM(gtk_text_tag_get_priority(GTK_TEXT_TAG(RVAL2GOBJ(self)))); } static VALUE rg_set_priority(VALUE self, VALUE priority) { gtk_text_tag_set_priority(GTK_TEXT_TAG(RVAL2GOBJ(self)), NUM2INT(priority)); return priority; } static VALUE rg_event(VALUE self, VALUE event_object, VALUE event, VALUE iter) { gboolean ret = gtk_text_tag_event(GTK_TEXT_TAG(RVAL2GOBJ(self)), RVAL2GOBJ(event_object), RVAL2GEV(event), (GtkTextIter*)RVAL2BOXED(iter, GTK_TYPE_TEXT_ITER)); return CBOOL2RVAL(ret); } void Init_gtk_texttag(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_TAG, "TextTag", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(priority, 0); RG_DEF_METHOD(set_priority, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "priority"); RG_DEF_METHOD(event, 3); /* GtkWrapMode */ G_DEF_CLASS(GTK_TYPE_WRAP_MODE, "WrapMode", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_WRAP_MODE, "GTK_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccelgroup.c�����������������������������������������������0000644�0001750�0001750�00000014023�12257552167�020466� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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))); } 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); } 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))); } 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); RG_DEF_METHOD(activate, 4); 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); RG_DEF_METHOD(find, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkmenutoolbutton.c�������������������������������������������0000644�0001750�0001750�00000005123�12257552167�021441� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cMenuToolButton #define _SELF(self) (GTK_MENU_TOOL_BUTTON(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkToolItem* item; if (argc == 0){ item = gtk_menu_tool_button_new((GtkWidget*)NULL, (const gchar*)NULL); } else if (TYPE(argv[0]) == T_SYMBOL || TYPE(argv[0]) == T_STRING){ VALUE stock_id; rb_scan_args(argc, argv, "10", &stock_id); if (TYPE(stock_id) == T_SYMBOL){ item = gtk_menu_tool_button_new_from_stock(rb_id2name(SYM2ID(stock_id))); } else { item = gtk_menu_tool_button_new_from_stock(RVAL2CSTR(stock_id)); } } else { VALUE icon_widget, label; rb_scan_args(argc, argv, "11", &icon_widget, &label); item = gtk_menu_tool_button_new(GTK_WIDGET(RVAL2GOBJ(icon_widget)), NIL_P(label) ? (const gchar*)NULL : RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, item); return Qnil; } static VALUE rg_set_arrow_tooltip(int argc, VALUE *argv, VALUE self) { VALUE tooltips, tip_text, tip_private; rb_scan_args(argc, argv, "12", &tooltips, &tip_text, &tip_private); gtk_menu_tool_button_set_arrow_tooltip(_SELF(self), GTK_TOOLTIPS(RVAL2GOBJ(self)), NIL_P(tip_text) ? NULL : RVAL2CSTR(tip_text), NIL_P(tip_private) ? NULL : RVAL2CSTR(tip_private)); return self; } void Init_gtk_menutoolbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_MENU_TOOL_BUTTON, "MenuToolButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(set_arrow_tooltip, -1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkrecentfilter.c���������������������������������������������0000644�0001750�0001750�00000010575�12257552167�021040� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cRecentFilter #define _SELF(self) (GTK_RECENT_FILTER(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_recent_filter_new()); return Qnil; } static VALUE rg_name(VALUE self) { return CSTR2RVAL(gtk_recent_filter_get_name(_SELF(self))); } static VALUE rg_set_name(VALUE self, VALUE name) { gtk_recent_filter_set_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_add_mime_type(VALUE self, VALUE mime_type) { gtk_recent_filter_add_mime_type(_SELF(self), RVAL2CSTR(mime_type)); return self; } static VALUE rg_add_pattern(VALUE self, VALUE pattern) { gtk_recent_filter_add_pattern(_SELF(self), RVAL2CSTR(pattern)); return self; } static VALUE rg_add_pixbuf_formats(VALUE self) { gtk_recent_filter_add_pixbuf_formats(_SELF(self)); return self; } static VALUE rg_add_application(VALUE self, VALUE application) { gtk_recent_filter_add_application(_SELF(self), RVAL2CSTR(application)); return self; } static VALUE rg_add_group(VALUE self, VALUE group) { gtk_recent_filter_add_group(_SELF(self), RVAL2CSTR(group)); return self; } static VALUE rg_add_age(VALUE self, VALUE days) { gtk_recent_filter_add_age(_SELF(self), NUM2INT(days)); return self; } struct callback_arg { VALUE callback; VALUE info; }; static VALUE invoke_callback(VALUE arg_) { struct callback_arg *arg = (struct callback_arg *)arg_; return rb_funcall(arg->callback, id_call, 1, arg->info); } static gboolean filter_func(const GtkRecentFilterInfo *info, gpointer func) { VALUE result; struct callback_arg arg; arg.callback = (VALUE)func; arg.info = BOXED2RVAL((gpointer)info, GTK_TYPE_RECENT_FILTER_INFO); result = G_PROTECT_CALLBACK(invoke_callback, &arg); return NIL_P(rb_errinfo()) ? TRUE : RVAL2CBOOL(result); } static void remove_callback_reference(gpointer data) { G_CHILD_REMOVE(mGtk, (VALUE)data); } static VALUE rg_add_custom(VALUE self, VALUE needed) { VALUE func = rb_block_proc(); G_CHILD_ADD(mGtk, func); gtk_recent_filter_add_custom(_SELF(self), RVAL2GFLAGS(needed, GTK_TYPE_RECENT_FILTER_FLAGS), (GtkRecentFilterFunc)filter_func, (gpointer)func, (GDestroyNotify)remove_callback_reference); return self; } static VALUE rg_needed(VALUE self) { return GFLAGS2RVAL(gtk_recent_filter_get_needed(_SELF(self)), GTK_TYPE_RECENT_FILTER_FLAGS); } static VALUE rg_filter(VALUE self, VALUE filter_info) { return CBOOL2RVAL(gtk_recent_filter_filter(_SELF(self), (GtkRecentFilterInfo*)RVAL2BOXED(filter_info, GTK_TYPE_RECENT_FILTER_INFO))); } void Init_gtk_recent_filter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_RECENT_FILTER, "RecentFilter", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(name, 0); RG_DEF_METHOD(set_name, 1); RG_DEF_METHOD(add_mime_type, 1); RG_DEF_METHOD(add_pattern, 1); RG_DEF_METHOD(add_pixbuf_formats, 0); RG_DEF_METHOD(add_application, 1); RG_DEF_METHOD(add_group, 1); RG_DEF_METHOD(add_age, 1); RG_DEF_METHOD(add_custom, 1); RG_DEF_METHOD(needed, 0); RG_DEF_METHOD(filter, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkRecentFilterFlags */ G_DEF_CLASS(GTK_TYPE_RECENT_FILTER_FLAGS, "Flags", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_RECENT_FILTER_FLAGS, "GTK_RECENT_FILTER_"); } �����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkthreads.c��������������������������������������������������0000644�0001750�0001750�00000003500�11701304107�017730� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkpixmap.c���������������������������������������������������0000644�0001750�0001750�00000017741�12257552167�017632� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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: win = gdk_pixmap_foreign_new_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(arg[0])), RVAL2GDKNATIVEWINDOW(arg[1])); break; case 5: 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 */ 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: win = gdk_pixmap_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1])); 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); } �������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktoolitem.c�������������������������������������������������0000644�0001750�0001750�00000010542�12257552167�020200� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #define RG_TARGET_NAMESPACE cToolItem #define _SELF(self) (GTK_TOOL_ITEM(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_tool_item_new()); return Qnil; } static VALUE rg_set_homogeneous(VALUE self, VALUE homogeneous) { gtk_tool_item_set_homogeneous(_SELF(self), RVAL2CBOOL(homogeneous)); return self; } static VALUE rg_homogeneous_p(VALUE self) { return CBOOL2RVAL(gtk_tool_item_get_homogeneous(_SELF(self))); } static VALUE rg_set_expand(VALUE self, VALUE expand) { gtk_tool_item_set_expand(_SELF(self), RVAL2CBOOL(expand)); return self; } static VALUE rg_expand_p(VALUE self) { return CBOOL2RVAL(gtk_tool_item_get_expand(_SELF(self))); } static VALUE rg_set_tooltip(int argc, VALUE *argv, VALUE self) { VALUE tooltip, tip_text, tip_private; rb_scan_args(argc, argv, "21", &tooltip, &tip_text, &tip_private); gtk_tool_item_set_tooltip(_SELF(self), GTK_TOOLTIPS(RVAL2GOBJ(tooltip)), RVAL2CSTR(tip_text), NIL_P(tip_private) ? NULL : RVAL2CSTR(tip_private)); return self; } static VALUE rg_set_use_drag_window(VALUE self, VALUE use_drag_window) { gtk_tool_item_set_use_drag_window(_SELF(self), RVAL2CBOOL(use_drag_window)); return self; } static VALUE rg_use_drag_window_p(VALUE self) { return CBOOL2RVAL(gtk_tool_item_get_use_drag_window(_SELF(self))); } static VALUE rg_icon_size(VALUE self) { return GENUM2RVAL(gtk_tool_item_get_icon_size(_SELF(self)), GTK_TYPE_ICON_SIZE); } static VALUE rg_orientation(VALUE self) { return GENUM2RVAL(gtk_tool_item_get_orientation(_SELF(self)), GTK_TYPE_ORIENTATION); } static VALUE rg_toolbar_style(VALUE self) { return GENUM2RVAL(gtk_tool_item_get_toolbar_style(_SELF(self)), GTK_TYPE_TOOLBAR_STYLE); } static VALUE rg_relief_style(VALUE self) { return GENUM2RVAL(gtk_tool_item_get_relief_style(_SELF(self)), GTK_TYPE_RELIEF_STYLE); } static VALUE rg_retrieve_proxy_menu_item(VALUE self) { return GOBJ2RVAL(gtk_tool_item_retrieve_proxy_menu_item(_SELF(self))); } static VALUE rg_get_proxy_menu_item(VALUE self, VALUE menu_item_id) { return GOBJ2RVAL(gtk_tool_item_get_proxy_menu_item(_SELF(self), RVAL2CSTR(menu_item_id))); } static VALUE rg_set_proxy_menu_item(VALUE self, VALUE menu_item_id, VALUE menu_item) { gtk_tool_item_set_proxy_menu_item(_SELF(self), RVAL2CSTR(menu_item_id), GTK_WIDGET(RVAL2GOBJ(menu_item))); return self; } static VALUE rg_rebuild_menu(VALUE self) { gtk_tool_item_rebuild_menu(_SELF(self)); return self; } void Init_gtk_toolitem(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TOOL_ITEM, "ToolItem", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(set_homogeneous, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "homogenous"); RG_DEF_METHOD_P(homogeneous, 0); RG_DEF_METHOD(set_expand, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "expand"); RG_DEF_METHOD_P(expand, 0); RG_DEF_METHOD(set_tooltip, -1); RG_DEF_METHOD(set_use_drag_window, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "use_drag_window"); RG_DEF_METHOD_P(use_drag_window, 0); RG_DEF_METHOD(icon_size, 0); RG_DEF_METHOD(orientation, 0); RG_DEF_METHOD(toolbar_style, 0); RG_DEF_METHOD(relief_style, 0); RG_DEF_METHOD(retrieve_proxy_menu_item, 0); RG_DEF_METHOD(get_proxy_menu_item, 1); RG_DEF_METHOD(set_proxy_menu_item, 2); RG_DEF_METHOD(rebuild_menu, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkprinter.c��������������������������������������������������0000644�0001750�0001750�00000010044�11701304107�020002� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #ifdef HAVE_GTK_UNIX_PRINT #include <gtk/gtkprinter.h> #ifndef GTK_TYPE_PRINT_BACKEND #define GTK_TYPE_PRINT_BACKEND (gtk_print_backend_get_type ()) #define GTK_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND, GtkPrintBackend)) GType gtk_print_backend_get_type (void) G_GNUC_CONST; #endif #define RG_TARGET_NAMESPACE cPrinter #define _SELF(s) (GTK_PRINTER(RVAL2GOBJ(s))) static VALUE rg_initialize(VALUE self, VALUE name, VALUE backend, VALUE rb_virtual) { GtkPrinter *printer; printer = gtk_printer_new(RVAL2CSTR(name), GTK_PRINT_BACKEND(RVAL2GOBJ(backend)), RVAL2CBOOL(rb_virtual)); G_INITIALIZE(self, printer); return Qnil; } static VALUE rg_description(VALUE self) { return CSTR2RVAL(gtk_printer_get_description(_SELF(self))); } static VALUE rg_active_p(VALUE self) { return CBOOL2RVAL(gtk_printer_is_default(_SELF(self))); } static VALUE rg_default_p(VALUE self) { return CBOOL2RVAL(gtk_printer_is_default(_SELF(self))); } static VALUE rg_operator_p_compare(VALUE self, VALUE other) { if (rb_obj_is_kind_of(other, GTYPE2CLASS(GTK_TYPE_PRINTER))){ return INT2NUM(gtk_printer_compare(_SELF(self), _SELF(other))); } else { rb_raise(rb_eTypeError, "%s isn't a kind of Gtk::Printer", rb_class2name(other)); } } struct callback_arg { VALUE callback; int argc; VALUE *argv; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; return rb_funcall2(arg->callback, id_call, arg->argc, arg->argv); } static gboolean each_printer(GtkPrinter *printer, gpointer data) { VALUE result; VALUE argv[1]; struct callback_arg arg; argv[0] = GOBJ2RVAL(printer); arg.callback = (VALUE)data; arg.argc = 1; arg.argv = argv; result = G_PROTECT_CALLBACK(invoke_callback, &arg); return NIL_P(rb_errinfo()) ? TRUE : RVAL2CBOOL(result); } static void remove_callback_reference(gpointer data) { VALUE callback = (VALUE)data; G_CHILD_REMOVE(mGtk, callback); } static VALUE rg_s_each(int argc, VALUE *argv, VALUE self) { VALUE wait, block; rb_scan_args(argc, argv, "01", &wait); block = rb_block_proc(); G_CHILD_ADD(mGtk, block); gtk_enumerate_printers(each_printer, (gpointer)block, remove_callback_reference, RVAL2CBOOL(wait)); return self; } #endif void Init_gtk_printer(VALUE mGtk) { #ifdef HAVE_GTK_UNIX_PRINT VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PRINTER, "Printer", mGtk); rb_include_module(RG_TARGET_NAMESPACE, rb_mComparable); G_DEF_CLASS(GTK_TYPE_PRINT_BACKEND, "PrintBackend", mGtk); RG_DEF_SMETHOD(each, -1); RG_DEF_METHOD(initialize, 3); RG_DEF_METHOD(description, 0); RG_DEF_METHOD_P(active, 0); RG_DEF_METHOD_P(default, 0); RG_DEF_METHOD_OPERATOR("<=>", p_compare, 1); G_DEF_CLASS3("GtkPrintBackendCups", "PrintBackendCups", mGtk); G_DEF_CLASS3("GtkPrintBackendFile", "PrintBackendFile", mGtk); G_DEF_CLASS3("GtkPrintBackendLpr", "PrintBackendLpr", mGtk); G_DEF_SETTERS(RG_TARGET_NAMESPACE); #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkscreen.c���������������������������������������������������0000644�0001750�0001750�00000025401�12257552167�017603� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 #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))); } 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))); } static VALUE rg_composited_p(VALUE self) { return CBOOL2RVAL(gdk_screen_is_composited(_SELF(self))); } 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; } #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; } 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; } /* 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 void Init_gtk_gdk_screen(VALUE mGdk) { 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); RG_DEF_METHOD(rgba_colormap, 0); RG_DEF_METHOD(rgba_visual, 0); RG_DEF_METHOD_P(composited, 0); 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); #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); 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); #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 } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextchild.c������������������������������������������������0000644�0001750�0001750�00000003215�11701304107�020311� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2002,2003 Masahiro Sakai * 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" #define RG_TARGET_NAMESPACE cTextChildAnchor #define _SELF(self) GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(self)) static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_text_child_anchor_new()); return Qnil; } static VALUE rg_widgets(VALUE self) { return GLIST2ARYF(gtk_text_child_anchor_get_widgets(_SELF(self))); } static VALUE rg_deleted_p(VALUE self) { return CBOOL2RVAL(gtk_text_child_anchor_get_deleted(_SELF(self))); } void Init_gtk_textchild(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_CHILD_ANCHOR, "TextChildAnchor", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(widgets, 0); RG_DEF_METHOD_P(deleted, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkinvisible.c������������������������������������������������0000644�0001750�0001750�00000003017�12257552167�020327� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cInvisible #define _SELF(s) GTK_INVISIBLE(RVAL2GOBJ(s)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE screen; rb_scan_args(argc, argv, "01", &screen); if (argc == 0){ RBGTK_INITIALIZE(self, gtk_invisible_new()); } else { RBGTK_INITIALIZE(self, gtk_invisible_new_for_screen( GDK_SCREEN(RVAL2GOBJ(screen)))); } return Qnil; } void Init_gtk_invisible(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_INVISIBLE, "Invisible", mGtk); RG_DEF_METHOD(initialize, -1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkpangorenderer.c��������������������������������������������0000644�0001750�0001750�00000007603�12257552167�021163� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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 void Init_gtk_gdk_pangorenderer(VALUE mGdk) { 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); } �����������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkproperty.c�������������������������������������������������0000644�0001750�0001750�00000022556�12416346617�020216� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 { 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); } 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 { 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); } 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 { 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); } 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 { 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); } 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(glong)); j++){ rb_ary_push(ret, INT2FIX(((glong*)rdat)[j])); } } else { for(j = 0; j < (rlen/sizeof(glong)); j++){ rb_ary_push(ret, BOXED2RVAL((GdkAtom)((glong*)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_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcolorbutton.c����������������������������������������������0000644�0001750�0001750�00000002736�12257552167�020724� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } void Init_gtk_colorbutton(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COLOR_BUTTON, "ColorButton", mGtk); RG_DEF_METHOD(initialize, -1); } ����������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtklinkbutton.c�����������������������������������������������0000644�0001750�0001750�00000003752�12257552167�020542� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 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 cLinkButton #define _SELF(self) (GTK_LINK_BUTTON(RVAL2GOBJ(self))) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE uri, label; GtkWidget *widget = NULL; rb_scan_args(argc, argv, "11", &uri, &label); if (NIL_P(label)){ widget = gtk_link_button_new(RVAL2CSTR(uri)); } else { widget = gtk_link_button_new_with_label(RVAL2CSTR(uri), RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } static void link_func(GtkLinkButton *button, const gchar *link, gpointer func) { rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(button), CSTR2RVAL(link)); } static VALUE rg_s_set_uri_hook(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_link_button_set_uri_hook((GtkLinkButtonUriFunc)link_func, (gpointer)func, (GDestroyNotify)NULL); return self; } void Init_gtk_link_button(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_LINK_BUTTON, "LinkButton", mGtk); RG_DEF_METHOD(initialize, -1); RG_DEF_SMETHOD(set_uri_hook, 0); } ����������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtksizegroup.c������������������������������������������������0000644�0001750�0001750�00000004077�12257552167�020401� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2003-2005 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 cSizeGroup #define _SELF(self) (GTK_SIZE_GROUP(RVAL2GOBJ(self))) static VALUE rg_initialize(VALUE self, VALUE mode) { G_INITIALIZE(self, gtk_size_group_new(RVAL2GENUM(mode, GTK_TYPE_SIZE_GROUP_MODE))); return Qnil; } static VALUE rg_add_widget(VALUE self, VALUE widget) { gtk_size_group_add_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget))); return self; } static VALUE rg_remove_widget(VALUE self, VALUE widget) { gtk_size_group_remove_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget))); return self; } static VALUE rg_widgets(VALUE self) { return GSLIST2ARY(gtk_size_group_get_widgets(_SELF(self))); } void Init_gtk_size_group(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_SIZE_GROUP, "SizeGroup", mGtk); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(add_widget, 1); RG_DEF_METHOD(remove_widget, 1); RG_DEF_METHOD(widgets, 0); /* GtkSizeGroupMode */ G_DEF_CLASS(GTK_TYPE_SIZE_GROUP_MODE, "Mode", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SIZE_GROUP_MODE, "GTK_SIZE_GROUP_"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccelmap.c�������������������������������������������������0000644�0001750�0001750�00000007522�12257552167�020115� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); */ 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; } void Init_gtk_accel_map(VALUE mGtk) { 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); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkbbox.c�����������������������������������������������������0000644�0001750�0001750�00000004065�12257552167�017301� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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; } 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)))); } 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); RG_DEF_METHOD(get_child_secondary, 1); /* 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_"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkoptionmenu.c�����������������������������������������������0000644�0001750�0001750�00000004034�11701304107�020516� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cOptionMenu static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_option_menu_new()); return Qnil; } static VALUE rg_remove_menu(VALUE self) { gtk_option_menu_remove_menu(GTK_OPTION_MENU(RVAL2GOBJ(self))); return self; } static VALUE rg_set_history(VALUE self, VALUE index) { gtk_option_menu_set_history(GTK_OPTION_MENU(RVAL2GOBJ(self)), NUM2INT(index)); return self; } static VALUE rg_history(VALUE self) { return INT2NUM(gtk_option_menu_get_history(GTK_OPTION_MENU(RVAL2GOBJ(self)))); } #endif void Init_gtk_option_menu(VALUE mGtk) { #ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_OPTION_MENU, "OptionMenu", mGtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(remove_menu, 0); RG_DEF_METHOD(set_history, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "history"); RG_DEF_METHOD(history, 0); #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktreeiter.c�������������������������������������������������0000644�0001750�0001750�00000016101�12257552167�020164� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 * * 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 cTreeIter #define _SELF(i) ((GtkTreeIter*)RVAL2BOXED(i, GTK_TYPE_TREE_ITER)) void rbgtk_register_treeiter_set_value_func(GType gtype, rbgtkiter_set_value_func func) { rb_hash_aset(treeiter_set_value_table, INT2NUM(gtype), Data_Wrap_Struct(rb_cData, NULL, NULL, func)); } static VALUE rg_first_bang(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; VALUE ret = CBOOL2RVAL(gtk_tree_model_get_iter_first(model, iter)); iter->user_data3 = model; return ret; } static VALUE rg_next_bang(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_next(model, iter); if (! ret){ gtk_tree_model_get_iter_first(model, iter); } iter->user_data3 = model; return CBOOL2RVAL(ret); } static VALUE rg_get_value(VALUE self, VALUE column) { GValue value = G_VALUE_INIT; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; VALUE ret = Qnil; gtk_tree_model_get_value(model, iter, NUM2INT(column), &value); if (G_VALUE_TYPE(&value) != G_TYPE_INVALID){ ret = GVAL2RVAL(&value); g_value_unset(&value); } return ret; } static VALUE rg_first_child(VALUE self) { GtkTreeIter child; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_children(model, &child, iter); child.user_data3 = model; return ret ? GTKTREEITER2RVAL(&child) : Qnil; } static VALUE rg_path(VALUE self) { VALUE retval = Qnil; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; GtkTreePath* path = gtk_tree_model_get_path(model, iter); retval= GTKTREEPATH2RVAL(path); gtk_tree_path_free(path); return retval; } static VALUE rg_has_child_p(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; return CBOOL2RVAL(gtk_tree_model_iter_has_child(model, iter)); } static VALUE rg_n_children(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; return INT2NUM(gtk_tree_model_iter_n_children(model, iter)); } static VALUE rg_nth_child(VALUE self, VALUE n) { GtkTreeIter child; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_nth_child(model, &child, iter, NUM2INT(n)); child.user_data3 = model; return ret ? GTKTREEITER2RVAL(&child) : Qnil; } static VALUE rg_parent(VALUE self) { GtkTreeIter parent; GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gboolean ret = gtk_tree_model_iter_parent(model, &parent, iter); parent.user_data3 = model; return ret ? GTKTREEITER2RVAL(&parent) : Qnil; } static VALUE rg_set_value(VALUE self, VALUE column, VALUE value) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; VALUE obj = rb_hash_aref(treeiter_set_value_table, INT2NUM(G_TYPE_FROM_INSTANCE(model))); rbgtkiter_set_value_func func; GType gtype = gtk_tree_model_get_column_type(model, NUM2INT(column)); GValue gval = G_VALUE_INIT; if (NIL_P(obj)) rb_raise(rb_eTypeError, "Gtk::TreeModel is invalid."); Data_Get_Struct(obj, void, func); g_value_init(&gval, gtype); rbgobj_rvalue_to_gvalue(value, &gval); func(model, iter, NUM2INT(column), &gval); g_value_unset(&gval); return self; } static VALUE rg_operator_treeiter_set_value_eql(VALUE self, VALUE column, VALUE value) { rg_set_value(self, column, value); return value; } static VALUE rg_operator_treeiter_eql(VALUE self, VALUE other) { gint i, num1, num2; GtkTreeIter* iter1 = _SELF(self); GtkTreeIter* iter2; GtkTreeModel* model1; GtkTreeModel* model2; GtkTreePath* path1; GtkTreePath* path2; if (!rb_obj_is_kind_of(other, GTYPE2CLASS(GTK_TYPE_TREE_ITER))) return Qfalse; iter2 = _SELF(other); model1 = (GtkTreeModel*)iter1->user_data3; model2 = (GtkTreeModel*)iter2->user_data3; if (model1 != model2) return Qfalse; num1 = gtk_tree_model_get_n_columns(model1); num2 = gtk_tree_model_get_n_columns(model2); if (num1 != num2) return Qfalse; path1 = gtk_tree_model_get_path(model1, iter1); path2 = gtk_tree_model_get_path(model2, iter2); if (gtk_tree_path_compare(path1, path2) != 0) { gtk_tree_path_free(path1); gtk_tree_path_free(path2); return Qfalse; } else { gtk_tree_path_free(path1); gtk_tree_path_free(path2); } for (i = 0; i < num1; i++){ GValue gval1 = G_VALUE_INIT; GValue gval2 = G_VALUE_INIT; VALUE ret1, ret2; gtk_tree_model_get_value(model1, iter1, i, &gval1); gtk_tree_model_get_value(model2, iter2, i, &gval2); ret1 = GVAL2RVAL(&gval1); ret2 = GVAL2RVAL(&gval2); g_value_unset(&gval1); g_value_unset(&gval2); if (rb_equal(ret1, ret2) == Qfalse) return Qfalse; } return Qtrue; } static VALUE rg_to_str(VALUE self) { GtkTreeIter* iter = _SELF(self); GtkTreeModel* model = (GtkTreeModel*)iter->user_data3; gchar* s = gtk_tree_model_get_string_from_iter (model, iter); VALUE result = CSTR2RVAL(s); g_free(s); return result; } void Init_gtk_treeiter(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_ITER, "TreeIter", mGtk); RG_DEF_METHOD_BANG(first, 0); RG_DEF_METHOD_BANG(next, 0); RG_DEF_METHOD(get_value, 1); RG_DEF_ALIAS("[]", "get_value"); RG_DEF_METHOD(first_child, 0); RG_DEF_METHOD(path, 0); RG_DEF_METHOD_P(has_child, 0); RG_DEF_METHOD(n_children, 0); RG_DEF_METHOD(nth_child, 1); RG_DEF_METHOD(parent, 0); RG_DEF_METHOD(set_value, 2); RG_DEF_METHOD_OPERATOR("[]=", treeiter_set_value_eql, 2); RG_DEF_METHOD_OPERATOR("==", treeiter_eql, 1); RG_DEF_METHOD(to_str, 0); RG_DEF_ALIAS("to_s", "to_str"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkwindowattr.c�����������������������������������������������0000644�0001750�0001750�00000013523�12124610262�020510� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcheckbutton.c����������������������������������������������0000644�0001750�0001750�00000004350�11701304107�020633� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkiconsize.c�������������������������������������������������0000644�0001750�0001750�00000005662�12257552167�020176� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 mIconSize static VALUE rg_m_lookup(G_GNUC_UNUSED VALUE self, VALUE size) { gint width, height; if(gtk_icon_size_lookup(RVAL2GENUM(size, GTK_TYPE_ICON_SIZE), &width, &height)) return rb_ary_new3(2, INT2FIX(width), INT2FIX(height)); else return Qnil; } static VALUE rg_m_lookup_for_settings(G_GNUC_UNUSED VALUE self, VALUE settings, VALUE size) { gint width, height; if(gtk_icon_size_lookup_for_settings(GTK_SETTINGS(RVAL2GOBJ(settings)), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE), &width, &height)) return rb_ary_new3(2, INT2FIX(width), INT2FIX(height)); else return Qnil; } static VALUE rg_m_register(G_GNUC_UNUSED VALUE self, VALUE name, VALUE width, VALUE height) { /* XXXX FIXME This should be GENUM2RVAL */ return INT2FIX(gtk_icon_size_register(RVAL2CSTR(name), NUM2INT(width), NUM2INT(height))); } static VALUE rg_m_register_alias(G_GNUC_UNUSED VALUE self, VALUE alias, VALUE target) { gtk_icon_size_register_alias(RVAL2CSTR(alias), RVAL2GENUM(target, GTK_TYPE_ICON_SIZE)); return Qnil; } static VALUE rg_m_from_name(G_GNUC_UNUSED VALUE self, VALUE name) { return INT2FIX(gtk_icon_size_from_name(RVAL2CSTR(name))); } static VALUE rg_m_get_name(G_GNUC_UNUSED VALUE self, VALUE size) { return CSTR2RVAL(gtk_icon_size_get_name(RVAL2GENUM(size, GTK_TYPE_ICON_SIZE))); } void Init_gtk_icon_size(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGtk, "IconSize"); RG_DEF_MODFUNC(lookup, 1); RG_DEF_MODFUNC(lookup_for_settings, 2); RG_DEF_MODFUNC(register, 3); RG_DEF_MODFUNC(register_alias, 2); RG_DEF_MODFUNC(from_name, 1); RG_DEF_MODFUNC(get_name, 1); /* GtkIconSize */ G_DEF_CLASS(GTK_TYPE_ICON_SIZE, "IconSize", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_ICON_SIZE, "GTK_ICON_SIZE_"); } ������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtktextbuffer.c�����������������������������������������������0000644�0001750�0001750�00000065065�12257552167�020534� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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) 2002,2003 Masahiro Sakai * * 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 cTextBuffer #define _SELF(s) (GTK_TEXT_BUFFER(RVAL2GOBJ(s))) #define RVAL2ITR(i) (GtkTextIter*)RVAL2BOXED(i, GTK_TYPE_TEXT_ITER) #define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER)) #define RVAL2MARK(m) (GTK_TEXT_MARK(RVAL2GOBJ(m))) #define N_RVAL2CSTR(text) (NIL_P(text) ? NULL : RVAL2CSTR(text)) #define RVAL2TAG(t) (GTK_TEXT_TAG(RVAL2GOBJ(t))) #define RVAL2ANCHOR(a) (GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(a))) #define ATOM2RVAL(a) (BOXED2RVAL(a, GDK_TYPE_ATOM)) static ID id_tagtable; static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE table; rb_scan_args(argc, argv, "01", &table); if (NIL_P(table)) G_INITIALIZE(self, gtk_text_buffer_new(NULL)); else { G_CHILD_SET(self, id_tagtable, table); G_INITIALIZE(self, gtk_text_buffer_new(GTK_TEXT_TAG_TABLE(RVAL2GOBJ(table)))); } return Qnil; } static VALUE rg_line_count(VALUE self) { return INT2NUM(gtk_text_buffer_get_line_count(_SELF(self))); } static VALUE rg_char_count(VALUE self) { return INT2NUM(gtk_text_buffer_get_char_count(_SELF(self))); } static VALUE txt_set_text(VALUE self, VALUE text) { StringValue(text); gtk_text_buffer_set_text(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text)); return self; } static VALUE rg_backspace(VALUE self, VALUE iter, VALUE interactive, VALUE default_editable) { return CBOOL2RVAL(gtk_text_buffer_backspace(_SELF(self), RVAL2ITR(iter), RVAL2CBOOL(interactive), RVAL2CBOOL(default_editable))); } static VALUE rg_insert_at_cursor(VALUE self, VALUE text) { StringValue(text); gtk_text_buffer_insert_at_cursor(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text)); return self; } static VALUE rg_insert_interactive(VALUE self, VALUE iter, VALUE text, VALUE editable) { StringValue(text); return CBOOL2RVAL(gtk_text_buffer_insert_interactive(_SELF(self), RVAL2ITR(iter), RSTRING_PTR(text), RSTRING_LEN(text), RVAL2CBOOL(editable))); } static VALUE rg_insert_interactive_at_cursor(VALUE self, VALUE text, VALUE editable) { StringValue(text); return CBOOL2RVAL(gtk_text_buffer_insert_interactive_at_cursor(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text), RVAL2CBOOL(editable))); } static VALUE rg_insert_range(VALUE self, VALUE iter, VALUE start, VALUE end) { gtk_text_buffer_insert_range(_SELF(self), RVAL2ITR(iter), RVAL2ITR(start), RVAL2ITR(end)); return self; } static VALUE rg_insert_range_interactive(VALUE self, VALUE iter, VALUE start, VALUE end, VALUE editable) { return CBOOL2RVAL(gtk_text_buffer_insert_range_interactive(_SELF(self), RVAL2ITR(iter), RVAL2ITR(start), RVAL2ITR(end), RVAL2CBOOL(editable))); } static VALUE rg_delete(VALUE self, VALUE start, VALUE end) { gtk_text_buffer_delete(GTK_TEXT_BUFFER(RVAL2GOBJ(self)), RVAL2ITR(start), RVAL2ITR(end)); return self; } static VALUE rg_delete_interactive(VALUE self, VALUE start, VALUE end, VALUE editable) { return CBOOL2RVAL(gtk_text_buffer_delete_interactive(_SELF(self), RVAL2ITR(start), RVAL2ITR(end), RVAL2CBOOL(editable))); } static VALUE rg_get_text(int argc, VALUE *argv, VALUE self) { VALUE start, end, include_hidden_chars; GtkTextIter start_iter, end_iter; GtkTextBuffer* buffer = _SELF(self); gchar* ret; VALUE result; rb_scan_args(argc, argv, "03", &start, &end, &include_hidden_chars); if (NIL_P(start)) gtk_text_buffer_get_start_iter(buffer, &start_iter); if (NIL_P(end)) gtk_text_buffer_get_end_iter(buffer, &end_iter); if (NIL_P(include_hidden_chars)) include_hidden_chars = Qfalse; ret = gtk_text_buffer_get_text( buffer, NIL_P(start) ? &start_iter : RVAL2ITR(start), NIL_P(end) ? &end_iter : RVAL2ITR(end), RVAL2CBOOL(include_hidden_chars)); result = CSTR2RVAL(ret); g_free(ret); return result; } static VALUE txt_get_text_all(VALUE self) { return rg_get_text(0, NULL, self); } static VALUE rg_get_slice(int argc, VALUE *argv, VALUE self) { VALUE start, end, include_hidden_chars; GtkTextIter start_iter, end_iter; GtkTextBuffer* buffer = _SELF(self); gchar* ret; VALUE result; rb_scan_args(argc, argv, "03", &start, &end, &include_hidden_chars); if (NIL_P(start)) gtk_text_buffer_get_start_iter(buffer, &start_iter); if (NIL_P(end)) gtk_text_buffer_get_end_iter(buffer, &end_iter); if (NIL_P(include_hidden_chars)) include_hidden_chars = Qfalse; ret = gtk_text_buffer_get_slice( buffer, NIL_P(start) ? &start_iter : RVAL2ITR(start), NIL_P(end) ? &end_iter : RVAL2ITR(end), RVAL2CBOOL(include_hidden_chars)); result = CSTR2RVAL(ret); g_free(ret); return result; } static VALUE rg_slice(VALUE self) { return rg_get_slice(0, NULL, self); } static VALUE rg_insert_pixbuf(VALUE self, VALUE iter, VALUE pixbuf) { G_CHILD_ADD(self, iter); G_CHILD_ADD(iter, pixbuf); if (RVAL2CBOOL(ruby_debug)) rb_warning("Gtk::TextBuffer#insert_pixbuf is deprecated. Use Gtk::TextBuffer#insert instead."); gtk_text_buffer_insert_pixbuf(_SELF(self), RVAL2ITR(iter), GDK_PIXBUF(RVAL2GOBJ(pixbuf))); return self; } static VALUE rg_insert_child_anchor(VALUE self, VALUE iter, VALUE anchor) { G_CHILD_ADD(self, iter); G_CHILD_ADD(iter, anchor); if (RVAL2CBOOL(ruby_debug)) rb_warning("Gtk::TextBuffer#insert_child_anchor is deprecated. Use Gtk::TextBuffer#insert instead."); gtk_text_buffer_insert_child_anchor(_SELF(self), RVAL2ITR(iter), GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(anchor))); return self; } static VALUE rg_create_child_anchor(VALUE self, VALUE iter) { VALUE ret = GOBJ2RVAL(gtk_text_buffer_create_child_anchor(_SELF(self), RVAL2ITR(iter))); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_create_mark(VALUE self, VALUE name, VALUE where, VALUE left_gravity) { VALUE ret = GOBJ2RVAL(gtk_text_buffer_create_mark(_SELF(self), NIL_P(name) ? NULL : RVAL2CSTR(name), RVAL2ITR(where), RVAL2CBOOL(left_gravity))); G_CHILD_ADD(self, ret); return ret; } #if GTK_CHECK_VERSION(2,12,0) static VALUE rg_add_mark(VALUE self, VALUE mark, VALUE where) { gtk_text_buffer_add_mark(_SELF(self), RVAL2MARK(mark), RVAL2ITR(where)); return self; } #endif static VALUE rg_delete_mark(VALUE self, VALUE mark) { if (rb_obj_is_kind_of(mark, GTYPE2CLASS(GTK_TYPE_TEXT_MARK))){ G_CHILD_REMOVE(self, mark); gtk_text_buffer_delete_mark(_SELF(self), RVAL2MARK(mark)); } else { G_CHILD_REMOVE(self, GOBJ2RVAL(gtk_text_buffer_get_mark(_SELF(self), RVAL2CSTR(mark)))); gtk_text_buffer_delete_mark_by_name(_SELF(self), RVAL2CSTR(mark)); } return self; } static VALUE rg_get_mark(VALUE self, VALUE name) { return GOBJ2RVAL(gtk_text_buffer_get_mark(_SELF(self), RVAL2CSTR(name))); } /* static VALUE rg_get_insert(VALUE self) { return GOBJ2RVAL(gtk_text_buffer_get_insert(_SELF(self))); } */ static VALUE rg_selection_bound(VALUE self) { return GOBJ2RVAL(gtk_text_buffer_get_selection_bound(_SELF(self))); } static VALUE rg_place_cursor(VALUE self, VALUE where) { gtk_text_buffer_place_cursor(_SELF(self), RVAL2ITR(where)); return self; } static VALUE rg_select_range(VALUE self, VALUE ins, VALUE bound) { gtk_text_buffer_select_range(_SELF(self), RVAL2ITR(ins), RVAL2ITR(bound)); return self; } static VALUE rg_get_iter_at_child_anchor(VALUE self, VALUE anchor) { GtkTextIter iter; gtk_text_buffer_get_iter_at_child_anchor(_SELF(self), &iter, RVAL2ANCHOR(anchor)); return ITR2RVAL(&iter); } static VALUE rg_modified_p(VALUE self) { return CBOOL2RVAL(gtk_text_buffer_get_modified(_SELF(self))); } static VALUE rg_set_modified(VALUE self, VALUE setting) { gtk_text_buffer_set_modified(_SELF(self), RVAL2CBOOL(setting)); return setting; } static VALUE rg_add_selection_clipboard(VALUE self, VALUE clipboard) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_add_selection_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard)); return self; } static VALUE rg_remove_selection_clipboard(VALUE self, VALUE clipboard) { G_CHILD_REMOVE(self, clipboard); gtk_text_buffer_remove_selection_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard)); return self; } static VALUE rg_deserialize(VALUE self, VALUE content_buffer, VALUE format, VALUE iter, VALUE data) { GError* error = NULL; gboolean ret; StringValue(data); ret = gtk_text_buffer_deserialize(_SELF(self), _SELF(content_buffer), RVAL2ATOM(format), RVAL2ITR(iter), (const guint8*)RSTRING_PTR(data), (gsize)RSTRING_LEN(data), &error); if (! ret) RAISE_GERROR(error); return self; } static VALUE rg_deserialize_can_create_tags_p(VALUE self, VALUE format) { return CBOOL2RVAL(gtk_text_buffer_deserialize_get_can_create_tags(_SELF(self), RVAL2ATOM(format))); } static VALUE rg_deserialize_set_can_create_tags(VALUE self, VALUE format, VALUE can_create_tags) { gtk_text_buffer_deserialize_set_can_create_tags(_SELF(self), RVAL2ATOM(format), RVAL2CBOOL(can_create_tags)); return self; } static VALUE rg_deserialize_formats(VALUE self) { gint i; gint n_formats; GdkAtom* atoms = gtk_text_buffer_get_deserialize_formats(_SELF(self), &n_formats); VALUE ary = rb_ary_new(); for (i = 0; i < n_formats; i++){ rb_ary_push(ary, ATOM2RVAL(atoms[i])); } return ary; } static VALUE rg_serialize_formats(VALUE self) { gint i; gint n_formats; GdkAtom* atoms = gtk_text_buffer_get_serialize_formats(_SELF(self), &n_formats); VALUE ary = rb_ary_new(); for (i = 0; i < n_formats; i++){ rb_ary_push(ary, ATOM2RVAL(atoms[i])); } return ary; } struct callback_arg { VALUE callback; int argc; VALUE *argv; }; static VALUE invoke_callback(VALUE data) { struct callback_arg *arg = (struct callback_arg *)data; return rb_funcall2(arg->callback, id_call, arg->argc, arg->argv); } static gboolean deserialize_func(GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GtkTextIter *iter, const guint8 *data, gsize length, gboolean create_tags, gpointer func, G_GNUC_UNUSED GError **error) { VALUE result; VALUE argv[5]; struct callback_arg arg; argv[0] = GOBJ2RVAL(register_buffer); argv[1] = GOBJ2RVAL(content_buffer); argv[2] = ITR2RVAL(iter); argv[3] = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((char*)data, length)); argv[4] = CBOOL2RVAL(create_tags); arg.callback = (VALUE)func; arg.argc = 5; arg.argv = argv; result = G_PROTECT_CALLBACK(invoke_callback, &arg); return NIL_P(rb_errinfo()) ? RVAL2CBOOL(result) : FALSE; } static void remove_callback_reference(gpointer callback) { G_CHILD_REMOVE(mGtk, (VALUE)callback); } static VALUE rg_register_deserialize_format(VALUE self, VALUE mime_type) { VALUE block = rb_block_proc(); GdkAtom atom; G_CHILD_ADD(mGtk, block); atom = gtk_text_buffer_register_deserialize_format(_SELF(self), (const gchar*)RVAL2CSTR(mime_type), (GtkTextBufferDeserializeFunc)deserialize_func, (gpointer)block, (GDestroyNotify)remove_callback_reference); return ATOM2RVAL(atom); } static VALUE rg_register_deserialize_target(VALUE self, VALUE tagset_name) { return ATOM2RVAL(gtk_text_buffer_register_deserialize_tagset(_SELF(self), (const gchar*)(NIL_P(tagset_name) ? NULL : RVAL2CSTR(tagset_name)))); } static guint8* serialize_func(GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GtkTextIter *start, GtkTextIter *end, gsize *length, gpointer func) { VALUE result; VALUE argv[4]; struct callback_arg arg; argv[0] = GOBJ2RVAL(register_buffer); argv[1] = GOBJ2RVAL(content_buffer); argv[2] = ITR2RVAL(start); argv[3] = ITR2RVAL(end); arg.callback = (VALUE)func; arg.argc = 4; arg.argv = argv; /* This should return data as String */ result = G_PROTECT_CALLBACK(invoke_callback, &arg); StringValue(result); *length = RSTRING_LEN(result); return (guint8*)(NIL_P(rb_errinfo()) ? RSTRING_PTR(result) : NULL); } static VALUE rg_register_serialize_format(VALUE self, VALUE mime_type) { VALUE block = rb_block_proc(); GdkAtom atom; G_CHILD_ADD(mGtk, block); atom = gtk_text_buffer_register_serialize_format(_SELF(self), (const gchar*)RVAL2CSTR(mime_type), (GtkTextBufferSerializeFunc)serialize_func, (gpointer)block, (GDestroyNotify)remove_callback_reference); return ATOM2RVAL(atom); } static VALUE rg_register_serialize_target(VALUE self, VALUE tagset_name) { return ATOM2RVAL(gtk_text_buffer_register_serialize_tagset(_SELF(self), NIL_P(tagset_name) ? NULL : RVAL2CSTR(tagset_name))); } static VALUE rg_serialize(VALUE self, VALUE content_buffer, VALUE format, VALUE start, VALUE end) { gsize length; guint8* ret = gtk_text_buffer_serialize(_SELF(self), _SELF(content_buffer), RVAL2ATOM(format), RVAL2ITR(start), RVAL2ITR(end), &length); return RBG_STRING_SET_UTF8_ENCODING(rb_str_new((char*)ret, length)); } static VALUE rg_unregister_deserialize_format(VALUE self, VALUE format) { gtk_text_buffer_unregister_deserialize_format(_SELF(self), RVAL2ATOM(format)); return self; } static VALUE rg_unregister_serialize_format(VALUE self, VALUE format) { gtk_text_buffer_unregister_serialize_format(_SELF(self), RVAL2ATOM(format)); return self; } static VALUE rg_cut_clipboard(VALUE self, VALUE clipboard, VALUE default_editable) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_cut_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard), RVAL2CBOOL(default_editable)); return self; } static VALUE rg_copy_clipboard(VALUE self, VALUE clipboard) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_copy_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard)); return self; } static VALUE rg_paste_clipboard(VALUE self, VALUE clipboard, VALUE location, VALUE default_editable) { G_CHILD_ADD(self, clipboard); gtk_text_buffer_paste_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard), NIL_P(location) ? NULL : RVAL2ITR(location), RVAL2CBOOL(default_editable)); return self; } static VALUE rg_selection_bounds(VALUE self) { GtkTextIter start, end; gboolean ret = gtk_text_buffer_get_selection_bounds(_SELF(self), &start, &end); return rb_ary_new3(3, ITR2RVAL(&start), ITR2RVAL(&end), CBOOL2RVAL(ret)); } static VALUE rg_delete_selection(int argc, VALUE *argv, VALUE self) { VALUE interactive, default_editable; rb_scan_args(argc, argv, "20", &interactive, &default_editable); return CBOOL2RVAL(gtk_text_buffer_delete_selection(_SELF(self), RVAL2CBOOL(interactive), RVAL2CBOOL(default_editable))); } static VALUE rg_end_user_action(VALUE self) { gtk_text_buffer_end_user_action(_SELF(self)); return self; } static VALUE rg_begin_user_action(VALUE self) { gtk_text_buffer_begin_user_action(_SELF(self)); if (rb_block_given_p()) rb_ensure(rb_yield, self, rg_end_user_action, self); return self; } static VALUE rg_start_iter(VALUE self) { GtkTextIter iter; gtk_text_buffer_get_start_iter(_SELF(self), &iter); return ITR2RVAL(&iter); } static VALUE rg_end_iter(VALUE self) { GtkTextIter iter; gtk_text_buffer_get_end_iter(_SELF(self), &iter); return ITR2RVAL(&iter); } static VALUE rg_move_mark(VALUE self, VALUE mark, VALUE where) { if (rb_obj_is_kind_of(mark, GTYPE2CLASS(GTK_TYPE_TEXT_MARK))) gtk_text_buffer_move_mark(_SELF(self), RVAL2MARK(mark), RVAL2ITR(where)); else gtk_text_buffer_move_mark_by_name(_SELF(self), RVAL2CSTR(mark), RVAL2ITR(where)); return self; } static VALUE rg_create_tag(VALUE self, VALUE tag_name, VALUE properties) { GtkTextTag *tag; VALUE ret; tag = gtk_text_tag_new(NIL_P(tag_name) ? (gchar*)NULL : RVAL2CSTR(tag_name)); gtk_text_tag_table_add (gtk_text_buffer_get_tag_table(_SELF(self)), tag); G_SET_PROPERTIES(GOBJ2RVAL(tag), properties); ret = GOBJ2RVAL(tag); G_CHILD_ADD(self, ret); return ret; } static VALUE rg_insert(int argc, VALUE *argv, VALUE self) { VALUE where, value, tags; gint start_offset; GtkTextIter start; int i; rb_scan_args(argc, argv, "2*", &where, &value, &tags); G_CHILD_ADD(self, where); G_CHILD_ADD(self, value); if (rb_obj_is_kind_of(value, GTYPE2CLASS(GDK_TYPE_PIXBUF))){ gtk_text_buffer_insert_pixbuf(_SELF(self), RVAL2ITR(where), GDK_PIXBUF(RVAL2GOBJ(value))); } else if (rb_obj_is_kind_of(value, GTYPE2CLASS(GTK_TYPE_TEXT_CHILD_ANCHOR))){ gtk_text_buffer_insert_child_anchor(_SELF(self), RVAL2ITR(where), GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(value))); } else { start_offset = gtk_text_iter_get_offset(RVAL2ITR(where)); StringValue(value); gtk_text_buffer_insert(_SELF(self), RVAL2ITR(where), RSTRING_PTR(value), RSTRING_LEN(value)); if (RARRAY_LEN(tags) == 0) return self; /* TODO: Do we really want to do this before we know that everything * below passed without any errors? */ G_CHILD_ADD(self, tags); gtk_text_buffer_get_iter_at_offset(_SELF(self), &start, start_offset); for(i = 0; i < RARRAY_LEN(tags); i++) { GtkTextTag *tag; if (rb_obj_is_kind_of(RARRAY_PTR(tags)[i], GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) { tag = RVAL2GOBJ(RARRAY_PTR(tags)[i]); } else { tag = gtk_text_tag_table_lookup(_SELF(self)->tag_table, RVAL2CSTR(RARRAY_PTR(tags)[i])); if (tag == NULL) { g_warning ("%s: no tag with name '%s'!", G_STRLOC, RVAL2CSTR(RARRAY_PTR(tags)[i])); return self; } } gtk_text_buffer_apply_tag(_SELF(self), tag, &start, RVAL2ITR(where)); } } return self; } static VALUE rg_insert_with_tags(int argc, VALUE *argv, VALUE self) { if (RVAL2CBOOL(ruby_debug)) rb_warning("Gtk::TextBuffer#insert_with_tags is deprecated. Use Gtk::TextBuffer#insert instead."); rg_insert(argc, argv, self); return self; } static VALUE rg_apply_tag(VALUE self, VALUE tag, VALUE start, VALUE end) { if (rb_obj_is_kind_of(tag, GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) gtk_text_buffer_apply_tag(_SELF(self), RVAL2TAG(tag), RVAL2ITR(start), RVAL2ITR(end)); else gtk_text_buffer_apply_tag_by_name(_SELF(self), RVAL2CSTR(tag), RVAL2ITR(start), RVAL2ITR(end)); return self; } static VALUE rg_remove_tag(VALUE self, VALUE tag, VALUE start, VALUE end) { if (rb_obj_is_kind_of(tag, GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) gtk_text_buffer_remove_tag(_SELF(self), RVAL2TAG(tag), RVAL2ITR(start), RVAL2ITR(end)); else gtk_text_buffer_remove_tag_by_name(_SELF(self), RVAL2CSTR(tag), RVAL2ITR(start), RVAL2ITR(end)); return self; } static VALUE rg_remove_all_tags(VALUE self, VALUE start, VALUE end) { gtk_text_buffer_remove_all_tags(_SELF(self), RVAL2ITR(start), RVAL2ITR(end)); return self; } static VALUE rg_get_iter_at_line_offset(VALUE self, VALUE line_number, VALUE char_offset) { GtkTextIter iter; gtk_text_buffer_get_iter_at_line_offset(_SELF(self), &iter, NUM2INT(line_number), NUM2INT(char_offset)); return ITR2RVAL(&iter); } static VALUE rg_get_iter_at_line_index(VALUE self, VALUE line_number, VALUE byte_index) { GtkTextIter iter; gtk_text_buffer_get_iter_at_line_index(_SELF(self), &iter, NUM2INT(line_number), NUM2INT(byte_index)); return ITR2RVAL(&iter); } static VALUE rg_get_iter_at_offset(VALUE self, VALUE char_offset) { GtkTextIter iter; gtk_text_buffer_get_iter_at_offset(_SELF(self), &iter, NUM2INT(char_offset)); return ITR2RVAL(&iter); } static VALUE rg_get_iter_at_line(VALUE self, VALUE line_number) { GtkTextIter iter; gtk_text_buffer_get_iter_at_line(_SELF(self), &iter, NUM2INT(line_number)); return ITR2RVAL(&iter); } static VALUE rg_bounds(VALUE self) { GtkTextIter start, end; VALUE result; gtk_text_buffer_get_bounds(_SELF(self), &start, &end); result = rb_ary_new(); rb_ary_push(result, ITR2RVAL(&start)); rb_ary_push(result, ITR2RVAL(&end)); return result; } static VALUE rg_get_iter_at_mark(VALUE self, VALUE mark) { GtkTextIter iter; gtk_text_buffer_get_iter_at_mark(_SELF(self), &iter, RVAL2MARK(mark)); return ITR2RVAL(&iter); } void Init_gtk_textbuffer(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_BUFFER, "TextBuffer", mGtk); id_tagtable = rb_intern("tagtable"); RG_DEF_METHOD(initialize, -1); RG_DEF_METHOD(line_count, 0); RG_DEF_METHOD(char_count, 0); G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "text", txt_set_text, 1); RG_DEF_METHOD(insert, -1); RG_DEF_METHOD(insert_with_tags, -1); RG_DEF_METHOD(backspace, 3); RG_DEF_METHOD(insert_at_cursor, 1); RG_DEF_METHOD(insert_interactive, 3); RG_DEF_METHOD(insert_interactive_at_cursor, 2); RG_DEF_METHOD(insert_range, 3); RG_DEF_METHOD(insert_range_interactive, 4); RG_DEF_METHOD(delete, 2); RG_DEF_METHOD(delete_interactive, 3); RG_DEF_METHOD(get_text, -1); G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "text", txt_get_text_all, 0); RG_DEF_METHOD(get_slice, -1); RG_DEF_METHOD(slice, 0); RG_DEF_METHOD(insert_pixbuf, 2); RG_DEF_METHOD(insert_child_anchor, 2); RG_DEF_METHOD(create_child_anchor, 1); RG_DEF_METHOD(create_mark, 3); #if GTK_CHECK_VERSION(2,12,0) RG_DEF_METHOD(add_mark, 2); #endif RG_DEF_METHOD(delete_mark, 1); RG_DEF_METHOD(get_mark, 1); /* Comment out because this method's name is very bad. Use Gtk::TextBuffer#get_mark("insert") instead. RG_DEF_METHOD(get_insert, 0); */ RG_DEF_METHOD(selection_bound, 0); RG_DEF_METHOD(place_cursor, 1); RG_DEF_METHOD(select_range, 2); RG_DEF_METHOD_P(modified, 0); RG_DEF_METHOD(set_modified, 1); G_DEF_SETTER(RG_TARGET_NAMESPACE, "modified"); RG_DEF_METHOD(add_selection_clipboard, 1); RG_DEF_METHOD(remove_selection_clipboard, 1); RG_DEF_METHOD(deserialize, 4); RG_DEF_METHOD_P(deserialize_can_create_tags, 1); RG_DEF_METHOD(deserialize_set_can_create_tags, 2); RG_DEF_METHOD(deserialize_formats, 0); RG_DEF_METHOD(serialize_formats, 0); RG_DEF_METHOD(register_deserialize_format, 1); RG_DEF_METHOD(register_deserialize_target, 1); RG_DEF_METHOD(register_serialize_format, 1); RG_DEF_METHOD(register_serialize_target, 1); RG_DEF_METHOD(serialize, 4); RG_DEF_METHOD(unregister_deserialize_format, 1); RG_DEF_METHOD(unregister_serialize_format, 1); RG_DEF_METHOD(cut_clipboard, 2); RG_DEF_METHOD(copy_clipboard, 1); RG_DEF_METHOD(paste_clipboard, 3); RG_DEF_METHOD(selection_bounds, 0); RG_DEF_METHOD(delete_selection, -1); RG_DEF_METHOD(begin_user_action, 0); RG_DEF_METHOD(end_user_action, 0); RG_DEF_METHOD(start_iter, 0); RG_DEF_METHOD(end_iter, 0); RG_DEF_METHOD(get_iter_at_line_offset, 2); RG_DEF_METHOD(get_iter_at_line_index, 2); RG_DEF_METHOD(get_iter_at_offset, 1); RG_DEF_METHOD(get_iter_at_line, 1); RG_DEF_METHOD(bounds, 0); RG_DEF_METHOD(get_iter_at_mark, 1); RG_DEF_METHOD(move_mark, 2); RG_DEF_METHOD(get_iter_at_child_anchor, 1); RG_DEF_METHOD(create_tag, 2); RG_DEF_METHOD(apply_tag, 3); RG_DEF_METHOD(remove_tag, 3); RG_DEF_METHOD(remove_all_tags, 2); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcolorselectiondialog.c�������������������������������������0000664�0001750�0001750�00000003400�11740310343�022525� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkfilechooser.c����������������������������������������������0000644�0001750�0001750�00000020210�12257552167�020637� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2005,2006 Ruby-GNOME2 Project Team * Copyright (C) 2004 Seiya Nishizawa, 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 mFileChooser #define _SELF(self) GTK_FILE_CHOOSER(RVAL2GOBJ(self)) #ifdef HAVE_GTK_GTKFILESYSTEM_H /* For error handling */ # define GTK_FILE_SYSTEM_ENABLE_UNSUPPORTED # include <gtk/gtkfilesystem.h> #endif static VALUE gslist2ary_free(GSList* list) { GSList* l; VALUE ary = rb_ary_new(); for (l = list; l != NULL; l = g_slist_next(l)) { rb_ary_push(ary, CSTR2RVAL_FREE(l->data)); } g_slist_free(list); return ary; } static VALUE rg_set_current_name(VALUE self, VALUE name) { /* doc says the awaited string is UTF-8, so use RVAL2CSTR */ gtk_file_chooser_set_current_name(_SELF(self), RVAL2CSTR(name)); return self; } static VALUE rg_filename(VALUE self) { return CSTRFILENAME2RVAL_FREE(gtk_file_chooser_get_filename(_SELF(self))); } static VALUE rg_set_filename(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); gboolean ret = gtk_file_chooser_set_filename(_SELF(self), filename); g_free(filename); if (!ret) rb_raise(rb_eRuntimeError, "Can't set filename"); return self; } static VALUE rg_select_filename(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); gboolean ret = gtk_file_chooser_select_filename(_SELF(self), filename); g_free(filename); return CBOOL2RVAL(ret); } static VALUE rg_unselect_filename(VALUE self, VALUE rbfilename) { gchar *filename = RVAL2CSTRFILENAME(rbfilename); gtk_file_chooser_unselect_filename(_SELF(self), filename); g_free(filename); return self; } static VALUE rg_select_all(VALUE self) { gtk_file_chooser_select_all(_SELF(self)); return self; } static VALUE rg_unselect_all(VALUE self) { gtk_file_chooser_unselect_all(_SELF(self)); return self; } static VALUE rg_filenames(VALUE self) { return CSTRFILENAMEARRAY2RVAL_FREE(gtk_file_chooser_get_filenames(_SELF(self))); } static VALUE rg_set_current_folder(VALUE self, VALUE filename) { gboolean ret = gtk_file_chooser_set_current_folder(_SELF(self), RVAL2CSTR(filename)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set current folder"); return self; } static VALUE rg_current_folder(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_current_folder(_SELF(self))); } static VALUE rg_uri(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_uri(_SELF(self))); } static VALUE rg_set_uri(VALUE self, VALUE uri) { gboolean ret = gtk_file_chooser_set_uri(_SELF(self), RVAL2CSTR(uri)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set uri"); return self; } static VALUE rg_select_uri(VALUE self, VALUE uri) { return CBOOL2RVAL(gtk_file_chooser_select_uri(_SELF(self), RVAL2CSTR(uri))); } static VALUE rg_unselect_uri(VALUE self, VALUE uri) { gtk_file_chooser_unselect_uri(_SELF(self), RVAL2CSTR(uri)); return self; } static VALUE rg_uris(VALUE self) { return gslist2ary_free(gtk_file_chooser_get_uris(_SELF(self))); } static VALUE rg_set_current_folder_uri(VALUE self, VALUE uri) { gboolean ret = gtk_file_chooser_set_current_folder_uri(_SELF(self), RVAL2CSTR(uri)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set current folder uri"); return self; } static VALUE rg_current_folder_uri(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_current_folder_uri(_SELF(self))); } static VALUE rg_preview_filename(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_preview_filename(_SELF(self))); } static VALUE rg_preview_uri(VALUE self) { return CSTR2RVAL_FREE(gtk_file_chooser_get_preview_uri(_SELF(self))); } static VALUE rg_add_filter(VALUE self, VALUE filter) { gtk_file_chooser_add_filter(_SELF(self), GTK_FILE_FILTER(RVAL2GOBJ(filter))); return self; } static VALUE rg_remove_filter(VALUE self, VALUE filter) { gtk_file_chooser_remove_filter(_SELF(self), GTK_FILE_FILTER(RVAL2GOBJ(filter))); return self; } static VALUE rg_filters(VALUE self) { return GSLIST2ARYF(gtk_file_chooser_list_filters(_SELF(self))); } static VALUE rg_add_shortcut_folder(VALUE self, VALUE rbfolder) { gchar *folder = RVAL2CSTRFILENAME(rbfolder); GError *error = NULL; gboolean ret = gtk_file_chooser_add_shortcut_folder(_SELF(self), folder, &error); g_free(folder); if (!ret) RAISE_GERROR(error); return self; } static VALUE rg_remove_shortcut_folder(VALUE self, VALUE rbfolder) { gchar *folder = RVAL2CSTRFILENAME(rbfolder); GError *error = NULL; gboolean ret = gtk_file_chooser_remove_shortcut_folder(_SELF(self), folder, &error); g_free(folder); if (!ret) RAISE_GERROR(error); return self; } static VALUE rg_shortcut_folders(VALUE self) { return CSTRFILENAMEARRAY2RVAL_FREE(gtk_file_chooser_list_shortcut_folders(_SELF(self))); } static VALUE rg_add_shortcut_folder_uri(VALUE self, VALUE uri) { GError *error = NULL; if (! gtk_file_chooser_add_shortcut_folder_uri(_SELF(self), RVAL2CSTR(uri), &error)) RAISE_GERROR(error); return self; } static VALUE rg_remove_shortcut_folder_uri(VALUE self, VALUE uri) { GError *error = NULL; if (! gtk_file_chooser_remove_shortcut_folder_uri(_SELF(self), RVAL2CSTR(uri), &error)) RAISE_GERROR(error); return self; } static VALUE rg_shortcut_folder_uris(VALUE self) { return gslist2ary_free(gtk_file_chooser_list_shortcut_folder_uris(_SELF(self))); } void Init_gtk_file_chooser(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_FILE_CHOOSER, "FileChooser", mGtk); RG_DEF_METHOD(set_current_name, 1); RG_DEF_METHOD(set_filename, 1); RG_DEF_METHOD(filename, 0); RG_DEF_METHOD(select_filename, 1); RG_DEF_METHOD(unselect_filename, 1); RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(unselect_all, 0); RG_DEF_METHOD(filenames, 0); RG_DEF_METHOD(set_current_folder, 1); RG_DEF_METHOD(current_folder, 0); RG_DEF_METHOD(set_uri, 1); RG_DEF_METHOD(uri, 0); RG_DEF_METHOD(select_uri, 1); RG_DEF_METHOD(unselect_uri, 1); RG_DEF_METHOD(uris, 0); RG_DEF_METHOD(set_current_folder_uri, 1); RG_DEF_METHOD(current_folder_uri, 0); RG_DEF_METHOD(preview_filename, 0); RG_DEF_METHOD(preview_uri, 0); RG_DEF_METHOD(add_filter, 1); RG_DEF_METHOD(remove_filter, 1); RG_DEF_METHOD(filters, 0); RG_DEF_METHOD(add_shortcut_folder, 1); RG_DEF_METHOD(remove_shortcut_folder, 1); RG_DEF_METHOD(shortcut_folders, 0); RG_DEF_METHOD(add_shortcut_folder_uri, 1); RG_DEF_METHOD(remove_shortcut_folder_uri, 1); RG_DEF_METHOD(shortcut_folder_uris, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); /* GtkFileChooserAction */ G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_ACTION, "Action", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_FILE_CHOOSER_ACTION, "GTK_FILE_CHOOSER_"); /* GtkFileChooserError */ G_DEF_ERROR(GTK_FILE_CHOOSER_ERROR, "FileChooserError", mGtk, rb_eRuntimeError, GTK_TYPE_FILE_CHOOSER_ERROR); /* GtkFileChooserConfirmation */ G_DEF_CLASS(GTK_TYPE_FILE_CHOOSER_CONFIRMATION, "Confirmation", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_FILE_CHOOSER_CONFIRMATION, "GTK_FILE_CHOOSER_"); G_DEF_CLASS3("GtkFileChooserEmbed", "FileChooserEmbed", mGtk); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkaccellabel.c�����������������������������������������������0000644�0001750�0001750�00000003205�11701304107�020367� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcelllayout.c�����������������������������������������������0000644�0001750�0001750�00000007755�12257552167�020535� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" #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; } void Init_gtk_celllayout(VALUE mGtk) { 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); } �������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcellrendererpixbuf.c���������������������������������������0000644�0001750�0001750�00000002506�11701304107�022207� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkimage.c����������������������������������������������������0000644�0001750�0001750�00000007330�11701304107�017365� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkimcontext.c������������������������������������������������0000644�0001750�0001750�00000007365�11701304107�020345� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 cIMContext #define _SELF(self) (GTK_IM_CONTEXT(RVAL2GOBJ(self))) static VALUE rg_set_client_window(VALUE self, VALUE gdkwindow) { gtk_im_context_set_client_window(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow))); return self; } static VALUE rg_preedit_string(VALUE self) { gchar* str; PangoAttrList* attrs; gint cursor_pos; gtk_im_context_get_preedit_string(_SELF(self), &str, &attrs, &cursor_pos); return rb_ary_new3(3, CSTR2RVAL(str), BOXED2RVAL(attrs, PANGO_TYPE_ATTR_LIST), INT2NUM(cursor_pos)); } static VALUE rg_filter_keypress(VALUE self, VALUE event) { return CBOOL2RVAL(gtk_im_context_filter_keypress(_SELF(self), (GdkEventKey*)RVAL2GEV(event))); } static VALUE rg_focus_in(VALUE self) { gtk_im_context_focus_in(_SELF(self)); return self; } static VALUE rg_focus_out(VALUE self) { gtk_im_context_focus_out(_SELF(self)); return self; } static VALUE rg_reset(VALUE self) { gtk_im_context_reset(_SELF(self)); return self; } static VALUE rg_set_cursor_location(VALUE self, VALUE area) { gtk_im_context_set_cursor_location( _SELF(self), ((GdkRectangle*)RVAL2BOXED(area, GDK_TYPE_RECTANGLE))); return self; } static VALUE rg_set_use_preedit(VALUE self, VALUE use_preedit) { gtk_im_context_set_use_preedit(_SELF(self), RVAL2CBOOL(use_preedit)); return self; } static VALUE rg_set_surrounding(VALUE self, VALUE text, VALUE cursor_index) { StringValue(text); gtk_im_context_set_surrounding(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text), NUM2INT(cursor_index)); return self; } static VALUE rg_surrounding(VALUE self) { gchar* text; gint cursor_index; gboolean result = gtk_im_context_get_surrounding(_SELF(self), &text, &cursor_index); return result ? rb_ary_new3(2, CSTR2RVAL(text), INT2NUM(cursor_index)) : Qnil; } static VALUE rg_delete_surrounding(VALUE self, VALUE offset, VALUE n_chars) { return CBOOL2RVAL(gtk_im_context_delete_surrounding(_SELF(self), NUM2INT(offset), NUM2INT(n_chars))); } void Init_gtk_imcontext(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_IM_CONTEXT, "IMContext", mGtk); RG_DEF_METHOD(set_client_window, 1); RG_DEF_METHOD(preedit_string, 0); /* Is it better to name as "filter_keypress?" ?*/ RG_DEF_METHOD(filter_keypress, 1); RG_DEF_METHOD(focus_in, 0); RG_DEF_METHOD(focus_out, 0); RG_DEF_METHOD(reset, 0); RG_DEF_METHOD(set_cursor_location, 1); RG_DEF_METHOD(set_use_preedit, 1); RG_DEF_METHOD(set_surrounding, 2); RG_DEF_METHOD(surrounding, 0); RG_DEF_METHOD(delete_surrounding, 2); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkconversions.h����������������������������������������������0000644�0001750�0001750�00000003067�11701304107�020703� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkkeyval.c���������������������������������������������������0000644�0001750�0001750�00000006033�11701304107�017575� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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" } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgdkgeometry.c�������������������������������������������������0000644�0001750�0001750�00000014077�12124610262�020146� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/ext/gtk2/rbgtkcombo.c����������������������������������������������������0000644�0001750�0001750�00000006211�11701304107�017417� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/COPYING.LIB��������������������������������������������������������������0000644�0001750�0001750�00000063642�12257552167�015150� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/lib/���������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�014227� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/lib/gtk2.rb��������������������������������������������������������������0000644�0001750�0001750�00000000361�11701304107�015415� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env ruby =begin gtk2.rb Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: gtk2.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2/base' Gtk.init �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/lib/gtk2/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12137115065�015077� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/lib/gtk2/base.rb���������������������������������������������������������0000755�0001750�0001750�00000004625�12137115065�016350� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env ruby =begin gtk2/base.rb Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: base.rb,v 1.6 2007/08/13 11:09:22 ktou Exp $ =end require 'glib2' require 'atk' require 'pango' require 'gdk_pixbuf2' base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/gtk2.so" rescue LoadError require "gtk2.so" end module Gdk LOG_DOMAIN = "Gdk" end if Gdk.cairo_available? module Cairo class Context if method_defined?(:set_source_color) alias_method :set_source_not_gdk_color, :set_source_color def set_source_color(color) if color.is_a?(Gdk::Color) set_source_gdk_color(color) else set_source_not_gdk_color(color) end end else alias_method :set_source_color, :set_source_gdk_color end def source_color=(color) set_source_color(color) color end end end end module Gtk LOG_DOMAIN = "Gtk" class Printer def self.printers(wait = false) printers = [] self.each(wait) {|v| printers << v} printers end end if check_version?(2, 12, 0) class Builder private def canonical_handler_name(name) name.gsub(/[-\s]+/, "_") end def __connect_signals__(connector, object, signal_name, handler_name, connect_object, flags) handler_name = canonical_handler_name(handler_name) if connect_object handler = connect_object.method(handler_name) else handler = connector.call(handler_name) end unless handler $stderr.puts("Undefined handler: #{handler_name}") if $DEBUG return end if flags.after? signal_connect_method = :signal_connect_after else signal_connect_method = :signal_connect end if handler.arity.zero? object.send(signal_connect_method, signal_name) {handler.call} else object.send(signal_connect_method, signal_name, &handler) end end end end end GLib::Log.set_log_domain(Gdk::LOG_DOMAIN) GLib::Log.set_log_domain(Gtk::LOG_DOMAIN) �����������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/README�������������������������������������������������������������������0000644�0001750�0001750�00000001532�12257552167�014356� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Ruby/GTK2 ========= Ruby/GTK2 is a Ruby binding of GTK+-2.10.x. Requirements ------------ Ruby: http://www.ruby-lang.org/ GTK+: http://www.gtk.org/ Pango: http://www.pango.org/ cairo/rcairo: http://cairographics.org/ (optional) Ruby/GLib2, Ruby/ATK, Ruby/Pango: http://ruby-gnome2.sourceforge.net/ Install ------- 0. install ruby-1.9.x or later, GTK+-2.10.x, Ruby/GLib2, Ruby/Pango (and cairo/rcairo). 1. ruby extconf.rb (To use rcairo on Win32, set CAIRO_PATH as a environment variable first) 2. make 3. su 4. make install Copying ------- Copyright (c) 2002-2005 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014734� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/���������������������������������������������������������0000755�0001750�0001750�00000000000�12257552167�016465� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-dash.rb��������������������������������������������0000644�0001750�0001750�00000001415�11701304107�021003� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-dash.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Dash This demo shows how to use GDK and cairo to show dash. From http://cairographics.org/samples/xxx_dash.html. =end require 'common' module Demo class CairoDash < CairoWindow def initialize super('cairo dash') end def draw(cr) dashes = [ 0.20, # in 0.05, # skip 0.05, # ink 0.05, # skip ] offset = -0.2 cr.set_dash(dashes, offset) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.stroke end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-line-join.rb���������������������������������������0000644�0001750�0001750�00000001760�11701304107�021753� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-line-join.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Line Join This demo shows how to use GDK and cairo to set line join. From http://cairographics.org/samples/set_line_join.html. =end require 'common' module Demo class CairoLineJoin < CairoWindow def initialize super('cairo line join') end def draw(cr) cr.set_line_width(0.16) cr.move_to(0.3, 0.33) cr.rel_line_to(0.2, -0.2) cr.rel_line_to(0.2, 0.2) cr.set_line_join(Cairo::LINE_JOIN_MITER) # default cr.stroke cr.move_to(0.3, 0.63) cr.rel_line_to(0.2, -0.2) cr.rel_line_to(0.2, 0.2) cr.set_line_join(Cairo::LINE_JOIN_BEVEL) cr.stroke cr.move_to(0.3, 0.93) cr.rel_line_to(0.2, -0.2) cr.rel_line_to(0.2, 0.2) cr.set_line_join(Cairo::LINE_JOIN_ROUND) cr.stroke end end end ����������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-fs-directory.png�����������������������������������0000644�0001750�0001750�00000003774�11701304107�022701� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���bKGD���{ḷ��IDATx۫W?{fNNB!4Q-^ ""D)O&PJmb4Z&95i697{-e֞ߜ) goΞ={w]k5s;U@?;)ӷϿ?,paM'P 7676Y_7=vx4~׸\9Qs_o?/S?|wߋ@34x˓8QPUTWh %ʎ"'q=  <,q yEWUкFP`;,ϩ/ro_~-7|^ET/YHcAQAxM�7oN8~ wݽ/Pxd:kF6Y^]e2sq ]hyeuD4RUUp1�.X ƠpWoPuEU9*WǕ%VM<u3G\Z߲g^j<[ I}A%,^ 8WЍ8u;�n\_b}m/"* Bwyg?ǎ @S\Xcc-8l8^4'N<3Fk9/~=Ewu㲅n}~?,!"X]>.Zv9^[O|7~GQTm[TCHW"I�*x5 9`aaq6ti_L>y8~a\{-'Z +D*A~6�W^S?чwoajB§?ukA0 ~,Sԇ5k<ǷE[ {`3w??H3g[_UUfg^rBNv!ڝ"jꂣZBqQGg?{sal,B vU2+FwQ3ǞDq,cTD&L`jpoEM+bA /Vxs5d D:NTgE]);1 GɊ4O#]0�\=AZ+ƝW$T;m t}eg bU mJ(Q7+cb,)gJ]tfRDOxIa%m�2A�1Wxigt!2kfi: .4$< ]90Lh6A;@P\.ٕ6L#0q\Gs|fS Xˤ2;V )(VĂ-] -0A\!CfDp MgCV+ }fK2X{(i�UUD﹬,LӪ+}f!Xvb�$O X@N v%%V<!&Rt7DV6T+nP5@Sסb-^*JLh/}":M\y`d]׻$@Aw rzGsu:9RҲ.&u1s4oC6'zd('`\(%S0S# C?F^`h=E@I@)bEƵ@*Hhiu7PZMzV )f�R) X9 @A8^? "Ng` 6-C,VfoXFBj<$i~َP^fʇl+LĖ8\裕[D6͘؀ c>_t[ˮ;aJl-j`AԐ{~G|uU9pULI�.^x  Vh5_|H֍em=5Eg9Ǚӿ�F@nO~OL>p8�sM M|1TҹMBYC"O=6jڟ�oMzy} Qs;[o&$J X*U7 tEIz|=uFM֖cWrޢ>kαs_MGC����IENDB`����ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-fill-and-stroke.rb���������������������������������0000644�0001750�0001750�00000001414�11701304107�023056� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-fill-and-stroke.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Fill And Stroke This demo shows how to use GDK and cairo to fill and stroke. From http://cairographics.org/samples/fill_and_stroke.html. =end require 'common' module Demo class CairoFillAndStroke < CairoWindow def initialize super('cairo fill and stroke') end def draw(cr) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.close_path cr.set_source_rgba(0, 0, 1) cr.fill_preserve cr.set_source_rgba(0, 0, 0) cr.stroke end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-path.rb��������������������������������������������0000644�0001750�0001750�00000001134�11701304107�021016� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-path.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Path This demo shows how to use GDK and cairo to draw path. From http://cairographics.org/samples/path.html. =end require 'common' module Demo class CairoPath < CairoWindow def initialize super('cairo path') end def draw(cr) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.stroke end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/appwindow.rb���������������������������������������������0000644�0001750�0001750�00000016465�11701304107�021014� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: appwindow.rb,v 1.7 2005/03/05 15:01:16 mutoh Exp $ =begin = Application main window Demonstrates a typical application window, with menubar, toolbar, statusbar. =end require 'common' module Demo class AppWindow < BasicWindow def initialize register_stock_icons ## Create toplevel window super('Application Window') table = Gtk::Table.new(1, 4, false) add(table) ## Create the menubar accel_group = Gtk::AccelGroup.new add_accel_group(accel_group) item_factory = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, '<main>', accel_group) # create menu items menuitem_cb = proc do |data, widget| # TODO: Show item-factory's path to menu item dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_CLOSE, "You selected or toggled the menu item \"#{Gtk::ItemFactory.path_from_widget(widget)}\"") # Close dialog on user response dialog.signal_connect('response') do |widget, data| widget.destroy end dialog.show end menu_items = [ ["/_File"], ["/_File/_New", "<StockItem>", "<control>N", Gtk::Stock::NEW, menuitem_cb], ["/_File/_Open", "<StockItem>", "<control>O", Gtk::Stock::OPEN, menuitem_cb], ["/File/_Save", "<StockItem>", "<control>S", Gtk::Stock::SAVE, menuitem_cb], ["/File/Save _As...", "<StockItem>", nil, Gtk::Stock::SAVE, menuitem_cb], ["/File/sep1", "<Separator>", nil, nil, menuitem_cb], ["/File/Quit", "<StockItem>", "<control>Q", Gtk::Stock::QUIT, menuitem_cb], ["/_Preferences"], ["/_Preferences/_Color"], ["/_Preferences/Color/_Red", "<RadioItem>", nil, nil, menuitem_cb], ["/_Preferences/Color/_Green", "/Preferences/Color/Red", nil, nil, menuitem_cb], ["/_Preferences/Color/_Blue", "/Preferences/Color/Red", nil, nil, menuitem_cb], ["/Preferences/_Shape"], ["/Preferences/Shape/_Square", "<RadioItem>", nil, nil, menuitem_cb], ["/Preferences/Shape/_Rectangle", "/Preferences/Shape/Square", nil, nil, menuitem_cb], ["/Preferences/Shape/_Oval", "/Preferences/Shape/Square", nil, nil, menuitem_cb], # If you wanted this to be right justified you would use # "<LastBranch>", not "<Branch>". Right justified help menu # items are generally considered a bad idea now days. ["/_Help"], ["/Help/_About", "<Item>", nil, nil, Proc.new{about_cb}], ] item_factory.create_items(menu_items) table.attach(item_factory.get_widget('<main>'), # X direction # Y direction 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) ## Create the toolbar toolbar = Gtk::Toolbar.new # toolbar.set_toolbar_style(Gtk::Toolbar::BOTH) toolbar.append(Gtk::Stock::OPEN, "This is a demo button with an 'open' icon" ) do toolbar_cb end toolbar.append(Gtk::Stock::QUIT, "This is a demo button with an 'quit' icon" ) do toolbar_cb end toolbar.append_space toolbar.append(:demo_gtk_logo, "This is a demo button with an 'gtk' icon" ) do toolbar_cb end table.attach(toolbar, # X direction # Y direction 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) ## Create document sw = Gtk::ScrolledWindow.new sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) sw.shadow_type = Gtk::SHADOW_IN table.attach(sw, # X direction # Y direction 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) set_default_size(200, 200) contents = Gtk::TextView.new sw.add(contents) ## Create statusbar statusbar = Gtk::Statusbar.new table.attach(statusbar, # X direction # Y direction 0, 1, 3, 4, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) # Show text widget info in the statusbar buffer = contents.buffer buffer.signal_connect('changed') do |buffer| update_statusbar(buffer, statusbar) end # cursor moved buffer.signal_connect('mark_set') do |buffer, iter, mark| update_statusbar(buffer, statusbar) end end def toolbar_cb(*args) dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_CLOSE, "You selected a toolbar button") # Close dialog on user response dialog.signal_connect('response') do |widget, data| widget.destroy end dialog.show end def about_cb(*args) unless Gtk.check_version?(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" return end authors = ["Peter Mattis", "Spencer Kimball", "Josh MacDonald", "and many more..."] documentors = ["Owen Taylor", "Tony Gale", "Mattias Clasen <mclasen@redhat.com>", "and many more..."] license = %Q[ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the Gnome Library; see the file COPYING.LIB.If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ] transparent = Gdk::Pixbuf.new(Demo.find_file("gtk-logo-rgb.gif")).add_alpha(true, 0xff, 0xff, 0xff) Gtk::AboutDialog.set_email_hook {|about, link| puts "send mail to #{link}" } Gtk::AboutDialog.set_url_hook {|about, link| puts "show url #{link}" } Gtk::AboutDialog.show(self, :name => "GTK+ Code Demos", :version => Gtk::VERSION.join("."), :copyright => "(C) 1997-2004 The GTK+ Team", :license => license, :website => "http://www.gtk.org", :comments => "Program to demonstrate GTK+ functions.", :authors => authors, :documenters => documentors, :logo => transparent) end def update_statusbar(buffer, statusbar) statusbar.pop(0) iter = buffer.get_iter_at_mark(buffer.get_mark('insert')) statusbar.push(0, "Cursor at row #{iter.line} column #{iter.line_offset} - #{buffer.char_count} chars in document") end def register_stock_icons # Register our stock items Gtk::Stock.add(:demo_gtk_logo, '_GTK!') # Add out custom icon factory to the list of defaults factory = Gtk::IconFactory.new factory.add_default filename = Demo.find_file('gtk-logo-rgb.gif') pixbuf = Gdk::Pixbuf.new(filename) transparent = pixbuf.add_alpha(true, 0xff, 0xff, 0xff) icon_set = Gtk::IconSet.new(transparent) factory.add('demo_gtk_logo', icon_set) end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/button_box.rb��������������������������������������������0000644�0001750�0001750�00000004325�11701304107�021157� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: button_box.rb,v 1.3 2005/02/12 23:02:43 kzys Exp $ =begin = Button Boxes The Button Box widgets are used to arrange buttons with padding. =end require 'common' module Demo class ButtonBox < BasicWindow def initialize super('Button Boxes') set_border_width(10) main_vbox = Gtk::VBox.new(false, 0) add(main_vbox) frame_horiz = Gtk::Frame.new('Horizontal Button Boxes') main_vbox.pack_start(frame_horiz, true, true, 10) vbox = Gtk::VBox.new(false, 0) vbox.set_border_width(10) frame_horiz.add(vbox) vbox.pack_start(create_bbox(true, 'Spread', 40, Gtk::ButtonBox::SPREAD), true, true, 0) vbox.pack_start(create_bbox(true, 'Edge', 40, Gtk::ButtonBox::EDGE), true, true, 5) vbox.pack_start(create_bbox(true, 'Start', 40, Gtk::ButtonBox::START), true, true, 5) vbox.pack_start(create_bbox(true, 'End', 40, Gtk::ButtonBox::END), true, true, 5) frame_vert = Gtk::Frame.new('Vertical Button Boxes') main_vbox.pack_start(frame_vert, true, true, 10) hbox = Gtk::HBox.new(false, 0) hbox.set_border_width(10) frame_vert.add(hbox) hbox.pack_start(create_bbox(false, 'Spread', 30, Gtk::ButtonBox::SPREAD), true, true, 0) hbox.pack_start(create_bbox(false, 'Edge', 30, Gtk::ButtonBox::EDGE), true, true, 5) hbox.pack_start(create_bbox(false, 'Start', 30, Gtk::ButtonBox::START), true, true, 5) hbox.pack_start(create_bbox(false, 'End', 30, Gtk::ButtonBox::END), true, true, 5) end def create_bbox(horizontal, title, spacing, layout) frame = Gtk::Frame.new(title) bbox = if horizontal Gtk::HButtonBox.new else Gtk::VButtonBox.new end bbox.set_border_width(5) frame.add(bbox) bbox.layout_style = layout bbox.set_spacing(spacing) [Gtk::Stock::OK, Gtk::Stock::CANCEL, Gtk::Stock::HELP].each do |stock| button = Gtk::Button.new(stock) bbox.add(button) end return frame end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-curve-rectangle.rb���������������������������������0000644�0001750�0001750�00000004646�11701304107�023163� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-curve-rectangle.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Curve Rectangle This demo shows how to use GDK and cairo to draw curve rectangle. From http://cairographics.org/samples/curve_rectangle.html. =end require 'common' module Demo class CairoCurveRectangle < CairoWindow # a custom shape, that could be wrapped in a function X0 = 0.1 #< parameters like Cairo::Context#rectangle Y0 = 0.1 RECT_WIDTH = 0.8 RECT_HEIGHT = 0.8 RADIUS = 0.4 #< and an approximate curvature radius X1 = X0 + RECT_WIDTH Y1 = Y0 + RECT_HEIGHT def initialize super('cairo curve rectangle') end def draw(cr) return if (RECT_WIDTH <= 0 || RECT_HEIGHT <= 0) if (RECT_WIDTH / 2 < RADIUS) if (RECT_HEIGHT / 2 < RADIUS) cr.move_to(X0, (Y0 + Y1) / 2) cr.curve_to(X0 ,Y0, X0, Y0, (X0 + X1) / 2, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, (Y0 + Y1) / 2) cr.curve_to(X1, Y1, X1, Y1, (X1 + X0) / 2, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, (Y0 + Y1) / 2) else cr.move_to(X0, Y0 + RADIUS) cr.curve_to(X0 ,Y0, X0, Y0, (X0 + X1) / 2, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, Y0 + RADIUS) cr.line_to(X1 , Y1 - RADIUS) cr.curve_to(X1, Y1, X1, Y1, (X1 + X0) / 2, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS) end else if (RECT_HEIGHT / 2 < RADIUS) cr.move_to(X0, (Y0 + Y1) / 2) cr.curve_to(X0, Y0, X0 , Y0, X0 + RADIUS, Y0) cr.line_to(X1 - RADIUS, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, (Y0 + Y1) / 2) cr.curve_to(X1, Y1, X1, Y1, X1 - RADIUS, Y1) cr.line_to(X0 + RADIUS, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, (Y0 + Y1) / 2) else cr.move_to(X0, Y0 + RADIUS) cr.curve_to(X0 , Y0, X0 , Y0, X0 + RADIUS, Y0) cr.line_to(X1 - RADIUS, Y0) cr.curve_to(X1, Y0, X1, Y0, X1, Y0 + RADIUS) cr.line_to(X1 , Y1 - RADIUS) cr.curve_to(X1, Y1, X1, Y1, X1 - RADIUS, Y1) cr.line_to(X0 + RADIUS, Y1) cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS) end end cr.close_path cr.set_source_rgba(0.5,0.5,1) cr.fill_preserve cr.set_source_rgba(0.5, 0, 0, 0.5) cr.stroke end end end ������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/demo.ui��������������������������������������������������0000644�0001750�0001750�00000027402�11701304107�017733� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> <interface> <object class="GtkListStore" id="liststore1"> <columns> <column type="gchararray"/> <column type="gchararray"/> <column type="gint"/> <column type="gchararray"/> </columns> <data> <row> <col id="0">John</col> <col id="1">Doe</col> <col id="2">25</col> <col id="3">This is the John Doe row</col> </row> <row> <col id="0">Mary</col> <col id="1">Dole</col> <col id="2">50</col> <col id="3">This is the Mary Dole row</col> </row> </data> </object> <object class="GtkUIManager" id="uimanager"> <child> <object class="GtkActionGroup" id="DefaultActions"> <child> <object class="GtkAction" id="Copy"> <property name="name">Copy</property> <property name="tooltip" translatable="yes">Copy selected object into the clipboard</property> <property name="stock_id">gtk-copy</property> </object> </child> <child> <object class="GtkAction" id="Cut"> <property name="name">Cut</property> <property name="tooltip" translatable="yes">Cut selected object into the clipboard</property> <property name="stock_id">gtk-cut</property> </object> </child> <child> <object class="GtkAction" id="EditMenu"> <property name="name">EditMenu</property> <property name="label" translatable="yes">_Edit</property> </object> </child> <child> <object class="GtkAction" id="FileMenu"> <property name="name">FileMenu</property> <property name="label" translatable="yes">_File</property> </object> </child> <child> <object class="GtkAction" id="New"> <property name="name">New</property> <property name="tooltip" translatable="yes">Create a new file</property> <property name="stock_id">gtk-new</property> </object> </child> <child> <object class="GtkAction" id="Open"> <property name="name">Open</property> <property name="tooltip" translatable="yes">Open a file</property> <property name="stock_id">gtk-open</property> </object> </child> <child> <object class="GtkAction" id="Paste"> <property name="name">Paste</property> <property name="tooltip" translatable="yes">Paste object from the Clipboard</property> <property name="stock_id">gtk-paste</property> </object> </child> <child> <object class="GtkAction" id="Quit"> <property name="name">Quit</property> <property name="tooltip" translatable="yes">Quit the program</property> <property name="stock_id">gtk-quit</property> <signal handler="quit_activate" name="activate"/> </object> </child> <child> <object class="GtkAction" id="Save"> <property name="name">Save</property> <property name="is_important">True</property> <property name="tooltip" translatable="yes">Save a file</property> <property name="stock_id">gtk-save</property> </object> </child> <child> <object class="GtkAction" id="SaveAs"> <property name="name">SaveAs</property> <property name="tooltip" translatable="yes">Save with a different name</property> <property name="stock_id">gtk-save-as</property> </object> </child> <child> <object class="GtkAction" id="HelpMenu"> <property name="name">HelpMenu</property> <property name="label" translatable="yes">_Help</property> </object> </child> <child> <object class="GtkAction" id="About"> <property name="name">About</property> <property name="stock_id">gtk-about</property> <signal handler="about_activate" name="activate"/> </object> <accelerator key="F1"/> </child> </object> </child> <ui> <menubar name="menubar1"> <menu action="FileMenu" name="FileMenu"> <menuitem action="New" name="New"/> <menuitem action="Open" name="Open"/> <menuitem action="Save" name="Save"/> <menuitem action="SaveAs" name="SaveAs"/> <separator/> <menuitem action="Quit" name="Quit"/> </menu> <menu action="EditMenu"> <menuitem action="Copy" name="Copy"/> <menuitem action="Cut" name="Cut"/> <menuitem action="Paste" name="Paste"/> </menu> <menu action="HelpMenu" name="HelpMenu"> <menuitem action="About" name="About"/> </menu> </menubar> <toolbar name="toolbar1"> <toolitem action="New" name="New"/> <toolitem action="Open" name="Open"/> <toolitem action="Save" name="Save"/> <separator/> <toolitem action="Copy" name="Copy"/> <toolitem action="Cut" name="Cut"/> <toolitem action="Paste" name="Paste"/> </toolbar> </ui> </object> <object class="GtkAboutDialog" id="aboutdialog1"> <property name="program-name" translatable="yes">GtkBuilder demo</property> <accessibility> <relation target="window1" type="subwindow-of"/> </accessibility> </object> <object class="GtkWindow" id="window1"> <property name="default_height">250</property> <property name="default_width">440</property> <property name="title">GtkBuilder demo</property> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> <child> <object constructor="uimanager" class="GtkMenuBar" id="menubar1"> <property name="visible">True</property> <child internal-child="accessible"> <object class="AtkObject" id="a11y-menubar"> <property name="AtkObject::accessible-name">The menubar</property> </object> </child> </object> <packing> <property name="expand">False</property> </packing> </child> <child> <object constructor="uimanager" class="GtkToolbar" id="toolbar1"> <property name="visible">True</property> <child internal-child="accessible"> <object class="AtkObject" id="a11y-toolbar"> <property name="AtkObject::accessible-name">The toolbar</property> </object> </child> </object> <packing> <property name="expand">False</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkScrolledWindow" id="scrolledwindow1"> <property name="hscrollbar_policy">automatic</property> <property name="shadow_type">in</property> <property name="visible">True</property> <property name="vscrollbar_policy">automatic</property> <child> <object class="GtkTreeView" id="treeview1"> <property name="visible">True</property> <property name="model">liststore1</property> <property name="tooltip-column">3</property> <child internal-child="accessible"> <object class="AtkObject" id="a11y-treeview"> <property name="AtkObject::accessible-name">Name list</property> <property name="AtkObject::accessible-description"> A list of person with name, surname and age columns </property> </object> </child> <child> <object class="GtkTreeViewColumn" id="column1"> <property name="title">Name</property> <child> <object class="GtkCellRendererText" id="renderer1"/> <attributes> <attribute name="text">0</attribute> </attributes> </child> </object> </child> <child> <object class="GtkTreeViewColumn" id="column2"> <property name="title">Surname</property> <child> <object class="GtkCellRendererText" id="renderer2"/> <attributes> <attribute name="text">1</attribute> </attributes> </child> </object> </child> <child> <object class="GtkTreeViewColumn" id="column3"> <property name="title">Age</property> <child> <object class="GtkCellRendererText" id="renderer3"/> <attributes> <attribute name="text">2</attribute> </attributes> </child> </object> </child> </object> </child> <accessibility> <action action_name="move-cursor" description="Move the cursor to select another person."/> </accessibility> </object> <packing> <property name="position">2</property> </packing> </child> <child> <object class="GtkStatusbar" id="statusbar1"> <property name="visible">True</property> </object> <packing> <property name="expand">False</property> <property name="position">3</property> </packing> </child> </object> </child> </object> </interface> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/stock_browser.rb�����������������������������������������0000644�0001750�0001750�00000013650�11701304107�021663� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: stock_browser.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Stock Item and Icon Browser This source code for this demo doesn't demonstrate anything particularly useful in applications. The purpose of the 'demo' is just to provide a handy place to browse the available stock icons and stock items. =end require 'common' module Demo class StockBrowser < BasicWindow Item = Struct.new('Item', :stock_id, :label, :modifier, :keyval, :translation_domain) ItemInfo = Struct.new('ItemInfo', :id, :item, :small_icon, :const, :accel_str) ItemDisplay = Struct.new('ItemDisplay', :type_label, :const_label, :id_label, :label_accel_label, :icon_image) def initialize super('Stock Icons and Items') set_default_size(-1, 500) self.border_width = 8 hbox = Gtk::HBox.new(false, 8) add(hbox) sw = Gtk::ScrolledWindow.new sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC) hbox.pack_start(sw, false, false, 0) model = create_model treeview = Gtk::TreeView.new(model) sw.add(treeview) column = Gtk::TreeViewColumn.new column.title = 'Const' cell_renderer = Gtk::CellRendererPixbuf.new column.pack_start(cell_renderer, false) column.set_attributes(cell_renderer, "stock_id" => 1) cell_renderer = Gtk::CellRendererText.new column.pack_start(cell_renderer, true) column.set_cell_data_func(cell_renderer) do |column, cell, model, iter| cell.text = iter[0].const end treeview.append_column(column) cell_renderer = Gtk::CellRendererText.new treeview.insert_column(-1, 'Label', cell_renderer) do |col, cell, model, iter| info = iter[0] cell.text = info.item.label if info end cell_renderer = Gtk::CellRendererText.new treeview.insert_column(-1, 'Accel', cell_renderer) do |col, cell, model, iter| info = iter[0] cell.text = info.accel_str if info end cell_renderer = Gtk::CellRendererText.new treeview.insert_column(-1, 'ID', cell_renderer) do |col, cell, model, iter| info = iter[0] cell.text = info.id if info end align = Gtk::Alignment.new(0.5, 0.0, 0.0, 0.0) hbox.pack_end(align, false, false, 0) frame = Gtk::Frame.new('Selected Item') align.add(frame) vbox = Gtk::VBox.new(false, 8) vbox.border_width = 4 frame.add(vbox) display = ItemDisplay.new class << treeview @display = nil attr_accessor :display end treeview.display = display display.type_label = Gtk::Label.new display.const_label = Gtk::Label.new display.id_label = Gtk::Label.new display.label_accel_label = Gtk::Label.new display.icon_image = Gtk::Image.new # empty image vbox.pack_start(display.type_label, false, false, 0) vbox.pack_start(display.icon_image, false, false, 0) vbox.pack_start(display.label_accel_label, false, false, 0) vbox.pack_start(display.const_label, false, false, 0) vbox.pack_start(display.id_label, false, false, 0) selection = treeview.selection selection.mode = Gtk::SELECTION_SINGLE selection.signal_connect('changed') do |s| selection_changed(s) end end def create_model store = Gtk::ListStore.new(ItemInfo, String, String, String) list_ids = Gtk::Stock.ids list_ids.sort! do |a, b| a.to_s <=> b.to_s end list_ids.each do |stock_id| info = ItemInfo.new info.id = stock_id begin info.item = Item.new(*Gtk::Stock.lookup(stock_id)) rescue ArgumentError info.item = Item.new end # only show icons for stock IDs that have default icons icon_set = Gtk::IconFactory.lookup_default(info.id.to_s) if icon_set # See what sizes this stock icon really exists at sizes = icon_set.sizes # Use menu size if it exists, otherwise first size found size = sizes.find do |s| s == Gtk::IconSize::MENU end || sizes.first info.small_icon = render_icon(info.id, size, '') unless size == Gtk::IconSize::MENU # Make the result the proper size for our thumbnail w, h = Gtk::IconSize.lookup(size) scaled = info.small_icon.scale(w, h, Gdk::Pixbuf::INTERP_BILINEAR) info.small_icon = scaled end else info.small_icon = nil end if info.item.keyval info.accel_str = Gtk::Accelerator.to_name(info.item.keyval, info.item.modifier) else info.accel_str = '' end info.const = id_to_const(info.id) iter = store.append iter[0] = info iter[1] = info.id end return store end def selection_changed(selection) treeview = selection.tree_view display = treeview.display iter = selection.selected info = iter[0] display.type_label.label = if info.small_icon and info.item.label 'Icon and Item' elsif info.small_icon 'Icon Only' elsif info.item.label 'Item Only' else '???????' end display.const_label.label = info.const display.id_label.label = info.id if info.item.label str = "%s %s" % [info.item.label, info.accel_str] display.label_accel_label.set_text(str, true) else display.label_accel_label.set_text('') end if info.small_icon display.icon_image.set(info.id, get_largest_size(info.id)) else display.icon_image.pixbuf = nil end end def get_largest_size(symbol) set = Gtk::IconFactory.lookup_default(symbol.id2name) best_size = Gtk::IconSize::INVALID best_pixels = 0 sizes = set.sizes sizes.collect! do |i| width, height = Gtk::IconSize.lookup(i) [i, width * height] end return (sizes.max do |a, b| a[1] <=> b[1] end)[0] end def id_to_const(id) const = '' s = id.id2name if s =~ /^gtk-/ const += 'Gtk::Stock::' s[0,4] = '' end const += s.upcase.gsub(/-/, '_') const end end end ����������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-long-lines.rb��������������������������������������0000644�0001750�0001750�00000001635�11701304107�022137� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-long-lines.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Long Lines This demo shows how to use GDK and cairo to show long lines. From http://cairographics.org/samples/xxx_long_liens.html. =end require 'common' module Demo class CairoLongLines < CairoWindow def initialize super('cairo long lines') end def draw(cr) cr.move_to(0.1, -50) cr.line_to(0.1, 50) cr.set_source_rgba(1, 0, 0) cr.stroke cr.move_to(0.2, -60) cr.line_to(0.2, 60) cr.set_source_rgba(1, 1, 0) cr.stroke cr.move_to(0.3, -70) cr.line_to(0.3, 70) cr.set_source_rgba(0, 1, 0) cr.stroke cr.move_to(0.4, -80) cr.line_to(0.4, 80) cr.set_source_rgba(0, 0, 1) cr.stroke end end end ���������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/changedisplay.rb�����������������������������������������0000644�0001750�0001750�00000026332�11701304107�021611� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: changedisplay.rb,v 1.6 2005/07/30 11:22:15 mutoh Exp $ =begin = Change Display Demonstrates migrating a window between different displays and screens. A display is a mouse and keyboard with some number of associated monitors. A screen is a set of monitors grouped into a single physical work area. The neat thing about having multiple displays is that they can be on a completely separate computers, as long as there is a network connection to the computer where the application is running. Only some of the windowing systems where GTK+ runs have the concept of multiple displays and screens. (The X Window System is the main example.) Other windowing systems can only handle one keyboard and mouse, and combine all monitors into a single screen. This is a moderately complex example, and demonstrates: - Tracking the currently open displays and screens - Changing the screen for a window - Letting the user choose a window by clicking on it - Using Gtk::ListStore and Gtk::TreeView - Using Gtk::Dialog =end require 'common' module Demo class ChangeDisplay < Gtk::Dialog # These enumerations provide symbolic names for the columns # in the two GtkListStore models. DISPLAY_COLUMN_NAME, DISPLAY_COLUMN_DISPLAY = 0, 1 SCREEN_COLUMN_NUMBER, SCREEN_COLUMN_SCREEN = 0, 1 # Main entry point. If the dialog for this demo doesn't yet exist, creates # it. Otherwise, destroys it. def initialize @size_group = nil @display_model = nil @screen_model = nil @screen_selection = nil @current_display = nil @current_screen = nil super('Change Screen or display', nil, # parent Gtk::Dialog::NO_SEPARATOR, [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE], ['Change', Gtk::Dialog::RESPONSE_OK]) set_default_size(300, 400) signal_connect('response') do |dialog, response_id| if response_id == Gtk::Dialog::RESPONSE_OK if Gtk.check_version?(2, 2, 0) query_change_display else puts "This sample requires GTK+ 2.2.0 or later" end else destroy # Gtk.main_quit? end end signal_connect('destroy') do end unless Gtk.check_version?(2, 2, 0) vbox.add(Gtk::Label.new("This sample requires GTK+ 2.2.0 or later")) return end vbox = Gtk::VBox.new(false, 5) vbox.set_border_width(8) self.vbox.pack_start(vbox, true, true) @size_group = Gtk::SizeGroup.new(Gtk::SizeGroup::HORIZONTAL) frame = create_display_frame vbox.pack_start(frame, true, true) frame = create_screen_frame vbox.pack_start(frame, true, true) initialize_displays end # Adds all currently open displays to our list of displays, # and set up a signal connection so that we'll be notified # when displays are opened in the future as well. def initialize_displays manager = Gdk::DisplayManager.get manager.displays.each do |display| add_display(display) end handler_id = manager.signal_connect('display_opened') do |display| add_display(display) end signal_connect('destroy') do manager.signal_handler_disconnect(handler_id) end end # Fills in the screen list based on the current display def fill_screens @screen_model.clear if @current_display n_screens = @current_display.n_screens n_screens.times do |i| iter = @screen_model.append iter.set_value(SCREEN_COLUMN_NUMBER, i) iter.set_value(SCREEN_COLUMN_SCREEN, @current_display.get_screen(i)) if i == 0 @screen_selection.select_iter(iter) end end end end # Creates the 'Display' frame in the main window. def create_display_frame frame, tree_view, button_vbox = create_frame('Display') button = left_align_button_new('_Open...') button.signal_connect('clicked') do open_display_cb end button_vbox.pack_start(button, false, false, 0) button = left_align_button_new('_Close') button.signal_connect('clicked') do if @current_display @current_display.close end end button_vbox.pack_start(button, false, false, 0) @display_model = Gtk::ListStore.new(String, Gdk::Display) tree_view.model = @display_model column = Gtk::TreeViewColumn.new('Name', Gtk::CellRendererText.new, {'text' => DISPLAY_COLUMN_NAME}) tree_view.append_column(column) selection = tree_view.selection selection.signal_connect('changed') do display_changed_cb(selection) end return frame end # Creates the 'Screen' frame in the main window. def create_screen_frame frame, tree_view, button_vbox = create_frame('Screen') @screen_model = Gtk::ListStore.new(Integer, Gdk::Screen) tree_view.model = @screen_model column = Gtk::TreeViewColumn.new('Number', Gtk::CellRendererText.new, {'text' => SCREEN_COLUMN_NUMBER}) tree_view.append_column(column) @screen_selection = tree_view.selection @screen_selection.signal_connect('changed') do |selection| @current_screen = if iter = selection.selected iter.get_value(SCREEN_COLUMN_SCREEN) else nil end end return frame end # This function is used both for creating the 'Display' and # 'Screen' frames, since they have a similar structure. The # caller hooks up the right context for the value returned # in tree_view, and packs any relevant buttons into button_vbox. def create_frame(title) frame = Gtk::Frame.new(title) hbox = Gtk::HBox.new(false, 8) hbox.set_border_width(8) frame.add(hbox) scrollwin = Gtk::ScrolledWindow.new scrollwin.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC) scrollwin.shadow_type = Gtk::SHADOW_IN hbox.pack_start(scrollwin, true, true) tree_view = Gtk::TreeView.new tree_view.headers_visible = false scrollwin.add(tree_view) selection = tree_view.selection selection.mode = Gtk::SELECTION_BROWSE button_vbox = Gtk::VBox.new(false, 5) hbox.pack_start(button_vbox, false, false) @size_group.add_widget(button_vbox) return frame, tree_view, button_vbox end # If we have a stack of buttons, it often looks better if their contents # are left-aligned, rather than centered. This function creates a button # and left-aligns it contents. def left_align_button_new(label) button = Gtk::Button.new(label, true) button.child.set_alignment(0.0, 0.5) return button end # Prompts the user for a toplevel window to move, and then moves # that window to the currently selected display def query_change_display screen = self.window.screen toplevel = query_for_toplevel(screen, "Please select the toplevel\n"+ "to move to the new screen") if toplevel toplevel.screen = @current_screen else screen.display.beep end end # Asks the user to click on a window, then waits for them click # the mouse. When the mouse is released, returns the toplevel # window under the pointer, or nil, if there is none. def query_for_toplevel(screen, prompt) toplevel = nil display = screen.display popup = Gtk::Window.new(Gtk::Window::POPUP) popup.screen = screen popup.modal = true popup.window_position = Gtk::Window::POS_CENTER frame = Gtk::Frame.new frame.set_shadow_type(Gtk::SHADOW_OUT) popup.add(frame) label = Gtk::Label.new(prompt) label.set_padding(10, 10) frame.add(label) popup.show_all # TODO: Gdk::Cursor.new(screen.display, Gdk::Cursor::CROSSHAIR) cursor = Gdk::Cursor.new(Gdk::Cursor::CROSSHAIR) if Gdk::pointer_grab(popup.window, false, Gdk::Event::BUTTON_RELEASE_MASK, nil, cursor, Gdk::Event::CURRENT_TIME) == Gdk::GRAB_SUCCESS clicked = false popup.signal_connect('button-release-event') do clicked = true end # Process events until clicked is set by button_release_event_cb. # We pass in may_block = true since we want to wait if there # are no events currently. until clicked Gtk.main_iteration # TODO: GLib::main_context_iteration(nil, true) toplevel = find_toplevel_at_pointer(screen.display) if toplevel == popup toplevel = nil end end popup.destroy Gdk.flush # Really release the grab return toplevel end end # Finds the toplevel window under the mouse pointer, if any. def find_toplevel_at_pointer(display) pointer_window, x, y = display.window_at_pointer # The user data field of a GdkWindow is used to store a pointer # to the widget that created it. if pointer_window widget = pointer_window.user_data end return (if widget widget.toplevel else nil end) end # Called when the user clicks on 'Open...' in the display # frame. Prompts for a new display, and then opens a connection # to that display. def open_display_cb dialog = Gtk::Dialog.new('Open Display', self, Gtk::Dialog::MODAL, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK]) dialog.default_response = Gtk::Dialog::RESPONSE_OK display_entry = Gtk::Entry.new display_entry.activates_default = true dialog_label = Gtk::Label.new("Please enter the name of\nthe new display\n") dialog.vbox.add(dialog_label) dialog.vbox.add(display_entry) display_entry.grab_focus dialog.vbox.show_all result = nil until result response_id = dialog.run break if response_id != Gtk::Dialog::RESPONSE_OK new_screen_name = display_entry.text unless new_screen_name.empty? begin result = Gdk::Dispaly.open(new_screen_name) rescue dialog_label.text = "Can't open display :\n\t%s\nplease try another one\n" % [new_screen_name] end end end dialog.destroy end # Called when the selected row in the display list changes. # Updates info.current_display, then refills the list of # screens. def display_changed_cb(selection) @current_display = if iter = selection.selected iter.get_value(DISPLAY_COLUMN_DISPLAY) else nil end fill_screens end # Adds a new display to our list of displays, and connects # to the 'closed' signal so that we can remove it from the # list of displays again. def add_display(display) iter = @display_model.append iter.set_value(DISPLAY_COLUMN_NAME, display.name) iter.set_value(DISPLAY_COLUMN_DISPLAY, display) handler_id = display.signal_connect('closed') do display_closed_cb(display) end signal_connect('destroy') do display.signal_handler_disconnect(handler_id) end end # Called when one of the currently open displays is closed. # Remove it from our list of displays. def display_closed_cb(display) @display_model.each do |model, path, iter| tmp_display = iter.get_value( DISPLAY_COLUMN_DISPLAY) if tmp_display == display @display_model.remove(iter) break end end end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-arc-negative.rb������������������������������������0000644�0001750�0001750�00000002162�11701304107�022431� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-arc-negative.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Arc Negative This demo shows how to use GDK and cairo to draw arc in negative. From http://cairographics.org/samples/arc_negative.html. =end require 'common' module Demo class CairoArcNegative < CairoWindow CENTER_X = 0.5 CENTER_Y = 0.5 RADIUS = 0.4 ANGLE1 = 45.0 * (Math::PI / 180.0) # angles are specified ANGLE2 = 180.0 * (Math::PI / 180.0) # in radians def initialize super('cairo arc_negative') end def draw(cr) cr.arc_negative(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2) cr.stroke # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI) cr.fill cr.set_line_width(0.03) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE1) cr.line_to(CENTER_X, CENTER_Y) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE2, ANGLE2) cr.line_to(CENTER_X, CENTER_Y) cr.stroke end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/panes.rb�������������������������������������������������0000644�0001750�0001750�00000007506�11701304107�020106� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: panes.rb,v 1.5 2005/02/12 23:06:07 kzys Exp $ =begin = Paned Widgets The Gtk::HPaned and Gtk::VPaned Widgets divide their content area into two panes with a divider in between that the user can adjust. A separate child is placed into each pane. There are a number of options that can be set for each pane. This test contains both a horizontal (HPaned) and a vertical (VPaned) widget, and allows you to adjust the options for each side of each widget. =end require 'common' module Demo class Panes < BasicWindow def initialize super('Panes') self.border_width = 0 vbox = Gtk::VBox.new(false, 0) add(vbox) vpaned = Gtk::VPaned.new vbox.pack_start(vpaned, true, true, 0) vpaned.border_width = 5 hpaned = Gtk::HPaned.new vpaned.add1(hpaned) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN frame.set_size_request(60, 60) hpaned.add1(frame) button = Gtk::Button.new('_Hi there', true) frame.add(button) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN frame.set_size_request(80, 60) hpaned.add2(frame) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN frame.set_size_request(60, 80) vpaned.add2(frame) # Now create toggle buttons to control sizing vbox.pack_start(create_pane_options(hpaned, 'Horizontal', 'Left', 'Right'), false, false, 0) vbox.pack_start(create_pane_options(vpaned, 'Vertical', 'Top', 'Bottom'), false, false, 0) end def create_pane_options(paned, frame_label, label1, label2) frame = Gtk::Frame.new(frame_label) frame.border_width = 4 table = Gtk::Table.new(3, 2, true) frame.add(table) label = Gtk::Label.new(label1) table.attach_defaults(label, 0, 1, 0, 1) check_button = Gtk::CheckButton.new('_Resize', true) table.attach_defaults(check_button, 0, 1, 1, 2) check_button.signal_connect('toggled') do toggle_resize(paned.child1) end check_button = Gtk::CheckButton.new('_Shrink', true) table.attach_defaults(check_button, 0, 1, 2, 3) check_button.active = true check_button.signal_connect('toggled') do toggle_shrink(paned.child1) end label = Gtk::Label.new(label2) table.attach_defaults(label, 1, 2, 0, 1) check_button = Gtk::CheckButton.new('_Resize') table.attach_defaults(check_button, 1, 2, 1, 2) check_button.active = true check_button.signal_connect('toggled') do toggle_resize(paned.child2) end check_button = Gtk::CheckButton.new('_Shrink') table.attach_defaults(check_button, 1, 2, 2, 3) check_button.active = true check_button.signal_connect('toggled') do toggle_shrink(paned.child2) end return frame end def toggle_resize(child) paned = child.parent is_child1 = (child == paned.child1) resize = if is_child1 paned.child1_resize? else paned.child2_resize? end shrink = if is_child1 paned.child1_shrink? else paned.child2_shrink? end child.parent.remove(child) if is_child1 paned.pack1(child, !resize, shrink) else paned.pack2(child, !resize, shrink) end end def toggle_shrink(child) paned = child.parent is_child1 = (child == paned.child1) resize = if is_child1 paned.child1_resize? else paned.child2_resize? end shrink = if is_child1 paned.child1_shrink? else paned.child2_shrink? end child.parent.remove(child) if is_child1 paned.pack1(child, resize, !shrink) else paned.pack2(child, resize, !shrink) end end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-text-align-center.rb�������������������������������0000644�0001750�0001750�00000002236�11701304107�023420� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-text-align-center.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Text Align Center This demo shows how to use GDK and cairo to show text in center. From http://cairographics.org/samples/text_align_center.html. =end require 'common' module Demo class CairoTextAlignCenter < CairoWindow TEXT = "Ruby" def initialize super('cairo text align center') end def draw(cr) cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL) cr.set_font_size(0.2) extents = cr.text_extents(TEXT) x = 0.5 - (extents.width / 2 + extents.x_bearing) y = 0.5 - (extents.height / 2 + extents.y_bearing) cr.move_to(x, y) cr.show_text(TEXT) # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(x, y, 0.05, 0, 2 * Math::PI) cr.fill cr.move_to(0.5, 0) cr.rel_line_to(0, 1) cr.move_to(0, 0.5) cr.rel_line_to(1, 0) cr.stroke end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/textview.rb����������������������������������������������0000644�0001750�0001750�00000036105�11701304107�020654� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: textview.rb,v 1.8 2005/02/06 18:25:13 kzys Exp $ =begin = Text Widget/Multiple Views The Gtk::TextView widget displays a Gtk::TextBuffer. One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews. This demo has two views displaying a single buffer, and shows off the widget's text formatting features. =end require 'common' module Demo class TextView < BasicWindow GRAY50_WIDTH = 2 GRAY50_HEIGHT = 2 GRAY50_BITS = [0x02, 0x01].pack("c") @@nest_window = nil def initialize super("TextView Window") set_default_size(450, 450) set_title("TextView") set_border_width(0) vpaned = Gtk::VPaned.new vpaned.set_border_width(5) add(vpaned) ## # For convenience, we just use the autocreated buffer from # the first text view; you could also create the buffer # by itself with Gtk::TextBuffer.new, then later create # a view widget. # view1 = Gtk::TextView.new buffer = view1.buffer view2 = Gtk::TextView.new(buffer) sw = Gtk::ScrolledWindow.new(nil, nil) sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vpaned.add1(sw) sw.add(view1) sw = Gtk::ScrolledWindow.new(nil, nil) sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vpaned.add2(sw) sw.add(view2) create_tags(buffer) insert_text(buffer) attach_widgets(view1) attach_widgets(view2) vpaned.show_all self.show end def create_tags(buffer) ## # Create a bunch of tags. Note that it's also possible to # create tags with Gtk::TextTag.new then add them to the # tag table for the buffer, Gtk::TextBuffer#create_tag is # just a convenience function. Also note that you don't have # to give tags a name; pass NULL for the name to create an # anonymous tag. # # In any real app, another useful optimization would be to create # a Gtk::TextTagTable in advance, and reuse the same tag table for # all the buffers with the same tag set, instead of creating # new copies of the same tags for every buffer. # # Tags are assigned default priorities in order of addition to the # tag table. That is, tags created later that affect the same text # property affected by an earlier tag will override the earlier # tag. You can modify tag priorities with # Gtk::TextTag#set_priority. # buffer.create_tag('heading', 'weight' => Pango::FontDescription::WEIGHT_BOLD, 'size' => 15 * Pango::SCALE) buffer.create_tag("italic", "style" => Pango::FontDescription::STYLE_ITALIC) buffer.create_tag("bold", "weight" => Pango::FontDescription::WEIGHT_BOLD) buffer.create_tag("big", # points times the PANGO_SCALE factor "size" => 20 * Pango::SCALE) buffer.create_tag("xx-small", "scale" => Pango::AttrScale::XX_SMALL) buffer.create_tag("x-large", "scale" => Pango::AttrScale::X_LARGE) buffer.create_tag("monospace", "family" => "monospace") buffer.create_tag("blue_foreground", "foreground" => "blue") buffer.create_tag("red_background", "background" => "red") stipple = Gdk::Pixmap.create_from_data(nil, GRAY50_BITS, GRAY50_WIDTH, GRAY50_HEIGHT) buffer.create_tag("background_stipple", "background_stipple" => stipple) buffer.create_tag("foreground_stipple", "foreground_stipple" => stipple) buffer.create_tag("big_gap_before_line", "pixels_above_lines" => 30) buffer.create_tag("big_gap_after_line", "pixels_below_lines" => 30) buffer.create_tag("double_spaced_line", "pixels_inside_wrap" => 10) buffer.create_tag("not_editable", "editable" => false) buffer.create_tag("word_wrap", "wrap_mode" => Gtk::TextTag::WRAP_WORD) buffer.create_tag("char_wrap", "wrap_mode" => Gtk::TextTag::WRAP_CHAR) buffer.create_tag("no_wrap", "wrap_mode" => Gtk::TextTag::WRAP_NONE) buffer.create_tag("center", "justification" => Gtk::JUSTIFY_CENTER) buffer.create_tag("right_justify", "justification" => Gtk::JUSTIFY_RIGHT) buffer.create_tag("wide_margins", "left_margin" => 50, "right_margin" => 50) buffer.create_tag("strikethrough", "strikethrough" => true) buffer.create_tag("underline", "underline" => Pango::AttrUnderline::SINGLE) buffer.create_tag("double_underline", "underline" => Pango::AttrUnderline::DOUBLE) buffer.create_tag("superscript", "rise" => 10 * Pango::SCALE, # 10 pixels "size" => 8 * Pango::SCALE) # 8 points buffer.create_tag("subscript", "rise" => -10 * Pango::SCALE, # 10 pixels "size" => 8 * Pango::SCALE) # 8 points buffer.create_tag("rtl_quote", "wrap_mode" => Gtk::TextTag::WRAP_WORD, "direction" => Gtk::Widget::TEXT_DIR_RTL, "indent" => 30, "left_margin" => 20, "right_margin" => 20) end def insert_text(buffer) ## # Demo.find_file looks in the the current directory first, # so you can run gtk-demo without installing GTK, then looks # in the location where the file is installed. # filename = Demo.find_file("gtk-logo-rgb.gif") pixbuf = Gdk::Pixbuf.new(filename) if filename unless pixbuf $stderr.print "Failed to load image file gtk-logo-rgb.gif\n" exit 1 end scaled = pixbuf.scale(32, 32, Gdk::Pixbuf::INTERP_BILINEAR) pixbuf = scaled ## # get start of buffer; each insertion will revalidate the # iterator to point to just after the inserted text. # iter = buffer.get_iter_at_offset(0) buffer.insert(iter, "The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n") buffer.insert(iter, "Font styles. ", 'heading') buffer.insert(iter, "For example, you can have ") buffer.insert(iter, "italic", "italic") buffer.insert(iter, ", ") buffer.insert(iter, "bold", "bold") buffer.insert(iter, ", or ") buffer.insert(iter, "monospace(typewriter)", "monospace") buffer.insert(iter, ", or ") buffer.insert(iter, "big", "big") buffer.insert(iter, " text. ") buffer.insert(iter, "It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as ") buffer.insert(iter, "xx-small", "xx-small") buffer.insert(iter, " or ") buffer.insert(iter, "x-large", "x-large") buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n") buffer.insert(iter, "Colors. ", "heading") buffer.insert(iter, "Colors such as ") buffer.insert(iter, "a blue foreground", "blue_foreground") buffer.insert(iter, " or ") buffer.insert(iter, "a red background", "red_background") buffer.insert(iter, " or even ") buffer.insert(iter, "a stippled red background", "red_background", "background_stipple") buffer.insert(iter, " or ") buffer.insert(iter, "a stippled blue foreground on solid red background", "blue_foreground", "red_background", "foreground_stipple") buffer.insert(iter, "(select that to read it) can be used.\n\n") buffer.insert(iter, "Underline, strikethrough, and rise. ", "heading") buffer.insert(iter, "Strikethrough", "strikethrough") buffer.insert(iter, ", ") buffer.insert(iter, "underline", "underline") buffer.insert(iter, ", ") buffer.insert(iter, "double underline", "double_underline") buffer.insert(iter, ", ") buffer.insert(iter, "superscript", "superscript") buffer.insert(iter, ", and ") buffer.insert(iter, "subscript", "subscript") buffer.insert(iter, " are all supported.\n\n") buffer.insert(iter, "Images. ", "heading") buffer.insert(iter, "The buffer can have images in it: ") buffer.insert(iter, pixbuf) buffer.insert(iter, pixbuf) buffer.insert(iter, pixbuf) buffer.insert(iter, " for example.\n\n") buffer.insert(iter, "Spacing. ", "heading") buffer.insert(iter, "You can adjust the amount of space before each line.\n") buffer.insert(iter, "This line has a whole lot of space before it.\n", "big_gap_before_line", "wide_margins") buffer.insert(iter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", "big_gap_after_line", "wide_margins") buffer.insert(iter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", "double_spaced_line", "wide_margins") buffer.insert(iter, "Also note that those lines have extra-wide margins.\n\n") buffer.insert(iter, "Editability. ", "heading") buffer.insert(iter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", "not_editable") buffer.insert(iter, "Wrapping. ", "heading") buffer.insert(iter, "This line(and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n") buffer.insert(iter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", "char_wrap") buffer.insert(iter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", "no_wrap") buffer.insert(iter, "Justification. ", "heading") buffer.insert(iter, "\nThis line has center justification.\n", "center") buffer.insert(iter, "This line has right justification.\n", "right_justify") buffer.insert(iter, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", "wide_margins") buffer.insert(iter, "Internationalization. ", "heading") buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n") buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n") buffer.insert(iter, "??? ??? ???? ?? ???? ???????? ????? ?? ???? ?????? ??????? ??????? ?? ???? ?????? ?? ????? ?? ??????? ????? ??????? ??? ?????? ????? ?????? ????? ???? ?? ?????? ?????? ?? ???????? ?????? ????? ?? ???? ???? ????????? ???????. ???? ???? ??? ???????? ????? ?? »????????« ?? ???????.\n\n", "rtl_quote") buffer.insert(iter, "You can put widgets in the buffer: Here's a button: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " and a menu: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " and a scale: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " and an animation: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, " finally a text entry: ") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, ".\n") buffer.insert(iter, "\n\nThis demo doesn't demonstrate all the Gtk::TextBuffer features; it leaves out, for example: invisible/hidden text(doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...") # Apply word_wrap tag to whole buffer buf_start, buf_end = buffer.bounds buffer.apply_tag("word_wrap", buf_start, buf_end) end def find_anchor(iter) while iter.forward_char do return true if iter.child_anchor end return false end def attach_widgets(text_view) buffer = text_view.buffer; iter = buffer.start_iter i = 0; while find_anchor(iter) do anchor = iter.child_anchor if i == 0 widget = Gtk::Button.new("Click Me") widget.signal_connect('clicked') { |button| if @@nest_window and ! @@nest_window.destroyed? @@nest_window.present break end buffer = Gtk::TextBuffer.new iter = buffer.start_iter buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n") anchor = buffer.create_child_anchor(iter) buffer.insert(iter, "\nDon't do this in real applications, please.\n") view = Gtk::TextView.new(buffer) recursive_attach_view(0, view, anchor) @@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL) sw = Gtk::ScrolledWindow.new(nil, nil) sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) @@nest_window.add(sw) sw.add(view) @@nest_window.set_default_size(300, 400) @@nest_window.show_all } elsif i == 1 menu = Gtk::Menu.new widget = Gtk::OptionMenu.new menu_item = Gtk::MenuItem.new("Option 1") menu.append(menu_item) menu_item = Gtk::MenuItem.new("Option 2") menu.append(menu_item) menu_item = Gtk::MenuItem.new("Option 3") menu.append(menu_item) widget.menu = menu elsif i == 2 widget = Gtk::HScale.new widget.set_range(0, 100) widget.set_size_request(70, -1) elsif i == 3 filename = Demo.find_file("floppybuddy.gif") widget = Gtk::Image.new(filename) elsif i == 4 widget = Gtk::Entry.new else #widget = nil; avoids a compiler warning #g_assert_not_reached ; end text_view.add_child_at_anchor(widget, anchor) widget.show_all i += 1 end end def recursive_attach_view(depth, view, anchor) return if depth > 4 child_view = Gtk::TextView.new(view.buffer) # Event box is to add a black border around each child view event_box = Gtk::EventBox.new color = Gdk::Color.parse("black") event_box.modify_bg(Gtk::STATE_NORMAL, color) align = Gtk::Alignment.new(0.5, 0.5, 1.0, 1.0) align.set_border_width(1) event_box.add(align) align.add(child_view) view.add_child_at_anchor(event_box, anchor) recursive_attach_view(depth + 1, child_view, anchor) end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/background.jpg�������������������������������������������0000644�0001750�0001750�00000053313�11701304107�021271� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������JFIF��H�H���Created with The GIMP�C�    $.' ",#(7),01444'9=82<.342�C  2!!22222222222222222222222222222222222222222222222222�"����������������8��!1AQ"a2q#BR3rbC���������������������������1� ��?�T[C GzFh ʎ^<MipIЯ;椑!w{رPI�[lG"!tI<T$ߚY>h| lFT{(v4 TQ|Q ¡KHylmUw$"G4dvEL C1�H2;ށY $=3Y4pVM'UDkYR#B@X㘧X"A8$rB Kиd֩1`Np˛MTDL~)oϊ%%FQ"-ó<P \(@E/zg[}ST-ɌpD* $EV$~7U ` {U-yZTꍻk :ԃD!7@`5{~(1`vֲ0ݤ}N[ͰPb"7"1� rf�V $Oo~Pe5'Hq��TfڠXEgU27?)7fW]ۉ?mos9� hb$CYQG-3]:sRH;սXf$}YڶB[Pr$G N,T4hx>iFER*@=sb;k|*(O>(P$S a<t6*DS ߚT@;"\!S@E@G�dՍq`s@@ݫJ&ƪ~)E! ,XS, ̉Su!`TɅ%B{R\2FDkT'DQ le& &Ew?T(LaقME!G*@u&cemT,H恀~(E9#Q@ fl=! Ȭ-#(2!I@ V0 n` 9ɍ Ѣ�[{KHBOK[p+�[`WE-Y- H[ުbDI;&QEQ(t钺9qɨC*WsҪ"�c7,D@@rLh @] LQXdP,<�P B& Z P& <c1#S?S$޵Tlf4c'ЅTnHrŦ8)D sF%x"Gs�q�— c5*�0#tr?b3*J�k n'{B%*}FG6"H�,@-8F<Rym V03۰C\D[2P5{Q饦{4꭮#"j9w.-g r<ʹtzKmB0HAl=vN.Y,%c\w==Vf HrQ2f8[vBā̞h$Y S"5�n1SܼQ܊o"2*4 m!c Ь�l�<� y !\Dn%W0 Ŷt^rٸՒԉ%&*,DjEUHGN+>N<2UpX<M* 3yL [mld,Tƀdi/qE !LQK�@ R`i�EQb`y?&<P5=*C=L UFcF<}UAȂXU�qSwz.$̝D ; T  d|vYXA'asAX�y4 Lֹ~!|SPYTdA>K&v^*=Fse{]t߭e-胯WeqM@~t{ u-ҳqmAjX&O5@W ڝyp*ʾ;hrI =C!9g(ǚ 3X:46P c h46P1:H�d{ EDnH:XE; Pn-� OZxB2Ց1�#�>H1Hӏ(3b]0H:TɽԶ(L#ɥZùa{im-ZKPm?.ucʁRKT-[npX3 k-9\x CSnDS�ڣNrQ(~(`K UuQv)aseTI2)e+a{$W>৐;U ߎi+P꣰t= :{p8ULZ*k$My N_q&�^MFy:N嶽Ř0PtUBuH=Ywz̈%)Pzp<AgywL@(wS@0ځd aL`-2jwZ@ qOyBYg/Q?¬]/P׽xtҵ͖-#Iw~Է]Oh=97km\\},j*wGQԶ[D?JW5ŷlJ]ck�>X!\\'jt9 W\*i$ ' WOhl/K{@`d~h`@2y)�K,-UB} ) c梳gdbDH)B�@M>GYh -剃<^e{ZgMm-HU'Pfh P#9g; 'GH؊e]V._%DkTo�bvh:` cMs\`Ph99 ~ᕰ@=A[%Ǹ:*)>cE lF܍H2'4l<:+^%m9ƷLtU@QIJ) r?={. ?[p9-7Mmn:b].ۻY!wU ˃ <�]zFڤ*2'B2cnRދ9b7ⅲ}H=sxs@m*-W[;1 ~p *ΉhX悳75,4$x5FPg114 1ދLS.:> Pˤvu9"t4Od|ċi,H"=1K2R{οXu2OĞ>k)!8wTPd yb`5^S[rqgg4�[CkԎ2vڨ+dL FKb*=v*YXD I~@A}R΢�V٠mȂb5qU@}5V�cځllKx@U@-r7'g$h?5 ˘�S\zxxs3UhQDe&vf1(HCl6Si@8("o[캤KxUn[Sy`椷K=5%pvhnUd hB TsZ+'.40Lc�wGqj�ȝ ,nط[>ªbuAඡ@&;P"1P@*"I<,CL~G�uInkF -S)wü zfڵZv ?W0Xb}؏hIKVГ6>dOl@#�Ku h?{HDH #E@*K 11As Y v,�V�mP fl(]*?o\[}: P;-KKA ?;eFIրImRAPǽrݫCI~5pYeK}g@ v ӕB$w!| e r1 S1v3(* #=b'KS�IrNKyTn�ތfU"u:�~( [H/RI2I317)ڏbOo`L{(i3tk J+;!Ҵq*!yـLB+�cڟ#&c*& РGQ@B'Qa0=I6t&d 䊨,nط[>ªbuAඡ@&;TR*I$)}21dy~T>6:Tkx0`2|; ~nͫ]5`p>jLn &*)݈DTo 0+0#cDH6̴9P̶aT@D 9 Tx[;b�N eJb`vlU2 ~Ojnbq۲31F5ŷӮ ð^ jAszFThĝh E$ { -ڴ?`q?Q 6^'{b 9T,NZqojXֹ`m< v!m+�;zmw$UXȘR[{ i.9Z:nap+q#KGdx^=EИT\׮qz{Nxa�ڼuze6Ŷq֦ rO�›*qle5�\(UQ�u|Q޵K\r} A(83,g[;GޑW�ӑ8 ==:M$GP)v(@sW SG$=C1ԁ$fi_UMmVD�Ӻgp-dDk5' A(=TqY�$ַm3  U fv"qS*`Bݏ?OyZP=c&g3h LE Ŏ,s1kY N(6*< 7X sO>ɓ'A- EIv o+ DLbk7S 3LAQLWitτ! >aIڃ*=T5[ ?K�([f{P)9?jֹ`m< v!m+�;zmw$U)%[`5ȗ bz_{4xN] Omz hyW W]gSl[i'jj*^ w$�)|Gk0Pc\P�͜}QUh0']η=\@T G42; A2ɌuHKaTxqM9P܃ڭcJ <lQTu mŽ)D=Y˥p?ybI3t3]HOqA-fP.xi dO;wDF#\rޢ�ޡԨ{J81{'k*CNF 􂋬ξcܚA$F5UFpX7Hf׶\6vKq>)A m>P f� {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1<M;_KL5Pq`5_?[=Ktt2D EH/�HUIpI9h,shO$ Fd储iBKezC)l/'~)S|^a?_Afn^'.Qq%\T�2n{�8Wu�2B|Wu�t"Sw1ITD Fb'Sڠc1.fx&w1@'O`)Ƃ#$dij�Oon襋E�٥F;$I1_vY<E8dGo#31>ոu=O4�ޡԨ{J81{'k*CNF 􂋬ξcܚA$F5UFpX7Hf׶\6vKq>)A m>P f� {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1<M;_KL5Pq`5_?[=Ktt2D EH/�HUPw-P!QCʢf3T�@ʎ!W�wH#d+]c@|\ !Gj[SA�'#D~P/( ɥH;PAF`Z vyjpl€|ВN)Iv6cm:Z`B&Zyt/?w拐Yic&cUq?<� )mۋ61Qd%N4gL)chu gP:~2xdFA{Qw|W$�5g�E3 ^#F&YZGV']4: *nՒ7s&-+{Vo]{"c ztjFڿU>\�EtonsE�Z*?UGlbR.w :W%D&1Q{z MHwwn8^Z l)$5 Z|S?�4!-+V( \ĉ1Y%wi-ALU]ax�X-+r}6UOj �RVia*JݲOrP% Yై5@팪b;H@2\" e�(PHzWp"ډ1t8;,++\c5O4 t6B:4Urv(qU<- r>;QM'<_IϨ lg( $ncof6ӥ�*e B^~hP:f5QqS�ݸ.3l QBTsFtœ f9WPyE�k :'&OmtzyLXzS>N;iReUq/En~ہ@үQY-qL3q2k/\ A⹺wf׻q&893,H␲Rg,4UWP\P@B2b`KF_o�imP/к#gAUSX<Es9'lR3) ?{xȀmƧE6#7XZ.�V@`'#jnji:&�,/@~шP-dO44h#z}ARc VP$@ĒGi XM0VGeGg+u b00yДkpu'cEܐn =v́dm'M̖2<\!-_NB+ &/e'`+&5f" *T[i;=CHTs7qbX[>ˀ<�8fŲI&gj Gڎ0YV  U�P{2a汶 2y �5T[]?LL3$�r; j95PP�X2�Z3q'PҰiR/{�{@Ы@H�9l* @TfX !e)ɢ2ϘXi@*d1YP0,>f_u$# F` yrN>ؤg%R~)U 2ۍNPlG n2,]V!)R.NG~ G:ɊtLkY_$*[v$h a=iF. @'02IcX$ӥ@ ?j5`ANy�WǸ`a-)N⋹!f{M#x۞Oڛ ,dyB[9?4WrA#T#[<I, ֲ&k]@�o56b`lzirAT" Wm )eT{ ]P. D ߵY`ix �kBhHHaHBC.91<)" <Oz'lZ b3>M*n@)Ҥ:Ivs)P'FbΦ˾D.8ԽhDT)OHKA�ƝL|Q�=*i0 vMf�[4" EbqT,,xb!x[a<D2'(#%3eZݫaS'D̙4f}ǹ?%uqٝS\Ȑ�4)jSJB$~ kL=b#@H9";$m7w+"�کa<{UC2~iY.O�/mݐ~+ ypQqN)ٶU0S W%܄ɀ'QXH�zGf|m'4RK62B5E{IaU�[kوe= P%]@j(ESxI삋vJ@|+L6~ 1e6(   " owh<恇I# @�,@=蝰Yh'4 e*J$j+_sTt{@:.QRnn>P;%?!-RO�v'1G0�Y/i5nFg#G _ @'zk2V6;_@a,kĚ/̷Qw7&Z FFPAb-j4@�<SELtluALsi&yg {, ΅Tf[h3yAC}P8<QvǝVV@E)ard}5D1%tLmSUEzŢg0&l6P@`ѡ۟(S2H/z܋aSk-ir8 TVBځɚ{zc{,6MHExP\.HE:|0@27KP'2v{ճ|g�h#ˉh3$j&L9&I �LzP nNl@@4w6ǓHL  3U�s#=su-vlXP"#f0H;zt鬄y5a @g=L6q[sOڧZཆݴ!Chyz^29HPݣ2#EtȚ!qg_2d3�I�Ћc7``-鮇ҨXvۯ@\DB%~M]Ph2EE.kXUA3s?514I�@L�=2=ѳš#m3ͦ慜-/:Qm~ @�GquZwQZ{ˍ'4W{ԗ1NU_{z{Op=C�?Sq{Fn|@Gl]L#Tӭ7r.N*+ft)Q[- j&iMI+4["1_)tApH#`L-@RES6;LYmHb9"(yʶv5bvɣk:oK^(\SZ5R+z1eH$(_[mp�ԫQU˄%c@td]�2םW+YqU{ޙPl, k6M` $qP`Is"r ko}@�z'dZ|f~jii.uML5酏L ^x>b;^f1Vjjl^^ ~sEGӴ0R:q:WL¬€2 X7fAjı8vbnԅ!53ж�"<RT Umo6cڵ7oV`|df"džMJ9 Ub9=-r֡)`)0&55<5@]D=kpl? -rZDRPpuUM#`l�sk m7ʆkV@5HΪ 1<$P"LGv(Iv,< 2+9lڊ>p�@WC)"Kh�wUIk,1se[P; KK;d 5U7L[NA^.L)Gi�2$p/ AUE(ñ:2.�kvRfL6&IX80$ʑW׹E۷Qvy[iQӲ-[>3?5Q4:v&&A|ǦO<d1u/T3FlN55qԶF//s?Qǣ{youC޸t+sCrwaVB@\ ۵bX `;T]1p p7AF?jBk][UvȀxM+IbA.zkI$NU*w1$ދPx*бh[ʨ�=MP$tSӶn87YԋuQ5�xS.9ʬI933�m {nU<X!k-NSJ"�Z۳è� U@EٰĘd~ X2vkdXk�Ee8.h<4-SqM|,mUL S%˶s$W$IN�Qb<g) '0inam@v�z ,I88vZE;A-"g敭T(x2, 9iپ5�me"ک&( $ܑ@E,1 2)%vP͍$P}@Wd|GX<)<O@eTlT%fpҫH+UN#_z|KHhC⢕Ifo�Gmb Vă][2�H&&UbIԡUGbзeU-P#3�ze-IcV鮧lrqn~Ekob\sm Yrff d >5y"B0[ĝE⵷gkP�a1+{ ds i�p]GTy>h[Li(~Y'T q588*4H>Kmq@I�3?PIi8QdyDS"*+N"`ڀ$YĒq$qYR촋kwnx NLDOsA*\')BvQJ}(hB/;$@ؖhl@$a@@UB<hT@�@P(>Ak-솝"c(arFB{&rV:QHRn(2N5飻!Mh@qAD1}o` �4$R]Ndn>*_='@J;gm753ikǓiDYLfO}TSnB! Nк!bL;UwpKiPhj`chTA rA>&Icj}GC@#7sN s^bm#gt�1O4Taʏ$UCV䝘nР(9:8Q.�oLs!Ar#u%dVwOg7ٮ{6LY().ZN�4&>*a 梪O4 +@Y?]�#Hb&!'Fnx NLDOsA*\')BvQJ}(hB/;$@ؖhl@$a@@UB<hT@�@P(>Ak-솝"c(arFB{&rV:QHRn(2N5飻!Mh@qAD1}o` �4$R]Ndn>*_='@J;gm753ikǓiDYLfO}TSnB! Nк!bL;UwpKiPPKr@ :pf}ܓM)wA;m-#tm#(w{xp o\ޟfw'@*S6[ޙY\E(UTJ2Di46 {UF V ʼnf*:IHM1gGu5l"FB0Ŷ8&GbPJj&fh vbp5!*1\CR}G$t<R8RwPvcb"iTj%cT@1H-bCxm+q�9f2|gbRhX pYⰸ.gT00NLs$AC؈05-ğxQuEf{Yn3 f](�Рӧ_K6Ð"MTYz+ǦKhLAwd"ɮqh{vQnAm|�ڢO1hf-0�?VmqTڸVt\TNɉ<wlp)+@%T rE_$ 8̡W lVg4ت4*"7F2w@a&˭-@MP)vgrt3`H H]l߯ieTRaUQ�5A3/O&8HȃCm!@T``X>fi d4cftwQMsV)9d*Nc [cM2l4v �4ffH`'f)\Rn0=y4='rI'C+cjq'z�'f6'>")[;i[eN "-y1bFTT3DA&h}CB(aR5kV`~$$p?4PỸ�fPT!Ʃ`" >hYsm4IOdIX ?zP$ (ղ@?+*ǙQ2i~4V�.C\=D*# @1X;k"2mРF̬@S}SNŷ1ʠP"a@;a.޳΢M *b?ZկF%}dɬTO H*, !j'SL>#ǓAmEQZiK*O>!mL Dl(S:קҪɮvMr?�yu�O&uC7aAzt-xdž2-4 M%3yk�V}DZIf 9KjGj�qp8xJ)LAuv"~yn(#{e*P*O 4~Xk Z`+hjSB?P`8 ,fA�Ld(AfcrcTH4, $觲O$I(fcj LIcj(b4H��!݀ Ѭ[L5I6hP#fVw)SbۈYeP(|@LD\|zYQJ&PD±fڭjףhHvvqo'Qm D9a#q+*;z4Ŧp 9'B椑!w{رPI�[lG"!tI<T$ߚY>h| lFT{(v4 TQ|Q ¡KHylmUw$"G4dvEL C1�H2;ށY $=3Y4pVM'UDkYR#B@X㘧X"A8$rB Kиd֩1`Np˛MTDL~)oϊ%%FQ"-ó<P \(@E/zg[}ST-ɌpD* $EV$~7U ` {U-yZTꍻk :ԃD!7@`5{~(1`vֲ0ݤ}N[ͰPb"7"1� rf�V $Oo~Pe5'Hq��TfڠXEgU27?)7fW]ۉ?mos9� hb$CYQG-3]:sRH;սXf$}YڶB[Pr$G N,T4hx>iFER*@=sb;k|*(O>(P$S a<t6*DS ߚT@;"\!S@E@G�dՍq`s@@ݫJ&ƪ~)E! ,XS, ̉Su!`TɅ%B{R\2FDkT'DQ le& &Ew?T(LaقME!G*@u&cemT,H恀~(E9#Q@ fl=! Ȭ-#(2!I@ V0 n` 9ɍ Ѣ�[{KHBOK[p+�[`WE-Y- H[ުbDI;&QEQ(t钺9qɨC*WsҪ"�c7,D@@rLh @] LQXdP,<�P B& Z P& <c1#S?S$޵Tlf4c'ЅTnHrŦ8)D sF%x"Gs�q�— c5*�0#tr?b3*J�k n'{B%*}FG6"H�,@-8F<Rym V03۰C\D[2P5{Q饦{4꭮#"j9w.-g r<ʹtzKmB0HAl=vN.Y,%c\w==Vf HrQ2f8[vBā̞h$Y S"5�n1SܼQ܊o"2*4 m!c Ь�l�<� y !\Dn%W0 Ŷt^rٸՒԉ%&*,DjEUHGN+>N<2UpX<M* 3yL [mld,Tƀdi/qE !LQK�@ R`i�EQb`y?&<P5=*C=L UFcF<}UAȂXU�qSwz.$̝D ; T  d|vYXA'asAX�y4 Lֹ~!|SPYTdA>K&v^*=Fse{]t߭e-胯WeqM@~t{ u-ҳqmAjX&O5@W ڝyp*ʾ;hrI =C!9g(ǚ 3X:46P c h46P1:H�d{ EDnH:XE; Pn-� OZxB2Ց1�#�>H1Hӏ(3b]0H:TɽԶ(L#ɥZùa{im-ZKPm?.ucʁRKT-[npX3 k-9\x CSnDS�ڣNrQ(~(`K UuQv)aseTI2)e+a{$W>৐;U ߎi+P꣰t= :{p8ULZ*k$My N_q&�^MFy:N嶽Ř0PtUBuH=Ywz̈%)Pzp<AgywL@(wS@0ځd aL`-2jwZ@ qOyBYg/Q?¬]/P׽xtҵ͖-#Iw~Է]Oh=97km\\},j*wGQԶ[D?JW5ŷlJ]ck�>X!\\'jt9 W\*i$ ' WOhl/K{@`d~h`@2y)�K,-UB} ) c梳gdbDH)B�@M>GYh -剃<^e{ZgMm-HU'Pfh P#9g; 'GH؊e]V._%DkTo�bvh:` cMs\`Ph99 ~ᕰ@=A[%Ǹ:*)>cE lF܍H2'4l<:+^%m9ƷLtU@QIJ) r?={. ?[p9-7Mmn:b].ۻY!wU ˃ <�]zFڤ*2'B2cnRދ9b7ⅲ}H=sxs@m*-W[;1 ~p *ΉhX悳75,4$x5FPg114 1ދLS.:> Pˤvu9"t4Od|ċi,H"=1K2R{οXu2OĞ>k)!8wTPd yb`5^S[rqgg4�[CkԎ2vڨ+dL FKb*=v*YXD I~@A}R΢�V٠mȂb5qU@}5V�cځllKx@U@-r7'g$h?5 ˘�S\zxxs3UhQDe&vf1(HCl6Si@8("o[캤KxUn[Sy`椷K=5%pvhnUd hB TsZ+'.40Lc�wGqj�ȝ ,nط[>ªbuAඡ@&;P"1P@*"I<,CL~G�uInkF -S)wü zfڵZv ?W0Xb}؏hIKVГ6>dOl@#�Ku h?{HDH #E@*K 11As Y v,�V�mP fl(]*?o\[}: P;-KKA ?;eFIրImRAPǽrݫCI~5pYeK}g@ v ӕB$w!| e r1 S1v3(* #=b'KS�IrNKyTn�ތfU"u:�~( [H/RI2I317)ڏbOo`L{(i3tk J+;!Ҵq*!yـLB+�cڟ#&c*& РGQ@B'Qa0=I6t&d 䊨,nط[>ªbuAඡ@&;TR*I$)}21dy~T>6:Tkx0`2|; ~nͫ]5`p>jLn &*)݈DTo 0+0#cDH6̴9P̶aT@D 9 Tx[;b�N eJb`vlU2 ~Ojnbq۲31F5ŷӮ ð^ jAszFThĝh E$ { -ڴ?`q?Q 6^'{b 9T,NZqojXֹ`m< v!m+�;zmw$UXȘR[{ i.9Z:nap+q#KGdx^=EИT\׮qz{Nxa�ڼuze6Ŷq֦ rO�›*qle5�\(UQ�u|Q޵K\r} A(83,g[;GޑW�ӑ8 ==:M$GP)v(@sW SG$=C1ԁ$fi_UMmVD�Ӻgp-dDk5' A(=TqY�$ַm3  U fv"qS*`Bݏ?OyZP=c&g3h LE Ŏ,s1kY N(6*< 7X sO>ɓ'A- EIv o+ DLbk7S 3LAQLWitτ! >aIڃ*=T5[ ?K�([f{P)9?jֹ`m< v!m+�;zmw$U)%[`5ȗ bz_{4xN] Omz hyW W]gSl[i'jj*^ w$�)|Gk0Pc\P�͜}QUh0']η=\@T G42; A2ɌuHKaTxqM9P܃ڭcJ <lQTu mŽ)D=Y˥p?ybI3t3]HOqA-fP.xi dO;wDF#\rޢ�ޡԨ{J81{'k*CNF 􂋬ξcܚA$F5UFpX7Hf׶\6vKq>)A m>P f� {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1<M;_KL5Pq`5_?[=Ktt2D EH/�HUIpI9h,shO$ Fd储iBKezC)l/'~)S|^a?_Afn^'.Qq%\T�2n{�8Wu�2B|Wu�t"Sw1ITD Fb'Sڠc1.fx&w1@'O`)Ƃ#$dij�Oon襋E�٥F;$I1_vY<E8dGo#31>ոu=O4�ޡԨ{J81{'k*CNF 􂋬ξcܚA$F5UFpX7Hf׶\6vKq>)A m>P f� {(^>PH>)L<9ղXAYE_VITT̘biQQ=z|,2P*P\dR[y$N⢂(Y$qvE-?޶6n\8}^womc Ѵ{y1<M;_KL5Pq`5_?[=Ktt2D EH/�HUPw-P!QCʢf3T�@ʎ!W�wH#d+]c@|\ !Gj[SA�'#D~P/( ɥH;PAF`Z vyjpl€|ВN)Iv6cm:Z`B&Zyt/?w拐Yic&cUq?<� )mۋ61Qd%N4gL)chu gP:~2xdFA{Qw|W$�5g�E3 ^#F&YZGV']4: *nՒ7s&-+{Vo]{"c ztjFڿU>\�EtonsE�Z*?UGlbR.w :W%D&1Q{z MHwwn8^Z l)$5 Z|S?�4!-+V( \ĉ1Y%wi-ALU]ax�X-+r}6UOj �RVia*JݲOrP% Yై5@팪b;H@2\" e�(PHzWp"ډ1t8;,++\c5O4 t6B:4Urv(qU<- r>;QM'<_IϨ lg( $ncof6ӥ�*e B^~hP:f5QqS�ݸ.3l QBTsFtœ f9WPyE�k :'&OmtzyLXzS>N;iReUq/En~ہ@үQY-qL3q2k/\ A⹺wf׻q&893,H␲Rg,4UWP\P@B2b`KF_o�imP/к#gAUSX<Es9'lR3) ?{xȀmƧE6#7XZ.�V@`'#jnji:&�,/@~шP-dO44h#z}ARc VP$@ĒGi XM0VGeGg+u b00yДkpu'cEܐn =v́dm'M̖2<\!-_NB+ &/e'`+&5f" *T[i;=CHTs7qbX[>ˀ<�8fŲI&gj Gڎ0YV  U�P{2a汶 2y �5T[]?LL3$�r; j95PP�X2�Z3q'PҰiR/{�{@Ы@H�9l* @TfX !e)ɢ2ϘXi@*d1YP0,>f_u$# F` yrN>ؤg%R~)U 2ۍNPlG n2,]V!)R.NG~ G:ɊtLkY_$*[v$h a=iF. @'02IcX$ӥ@ ?j5`ANy�WǸ`a-)N⋹!f{M#x۞Oڛ ,dyB[9?4WrA#T���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-fill-and-stroke2.rb��������������������������������0000644�0001750�0001750�00000001650�11701304107�023142� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-fill-and-stroke2.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Fill And Stroke2 This demo shows how to use GDK and cairo to fill and stroke. From http://cairographics.org/samples/fill_and_stroke2.html. =end require 'common' module Demo class CairoFillAndStroke2 < CairoWindow def initialize super('cairo fill and stroke2') end def draw(cr) cr.move_to(0.5, 0.1) cr.line_to(0.9, 0.9) cr.rel_line_to(-0.4, 0.0) cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5) cr.close_path cr.move_to(0.25, 0.1) cr.rel_line_to(0.2, 0.2) cr.rel_line_to(-0.2, 0.2) cr.rel_line_to(-0.2, -0.2) cr.close_path cr.set_source_rgba(0, 0, 1) cr.fill_preserve cr.set_source_rgba(0, 0, 0) cr.stroke end end end ����������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-arc.rb���������������������������������������������0000644�0001750�0001750�00000002061�11701304107�020627� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-arc.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Arc This demo shows how to use GDK and cairo to draw arc. From http://cairographics.org/samples/arc.html. =end require 'common' module Demo class CairoArc < CairoWindow CENTER_X = 0.5 CENTER_Y = 0.5 RADIUS = 0.4 ANGLE1 = 45.0 * (Math::PI / 180.0) # angles are specified ANGLE2 = 180.0 * (Math::PI / 180.0) # in radians def initialize super('cairo arc') end def draw(cr) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2) cr.stroke # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI) cr.fill cr.set_line_width(0.03) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE1) cr.line_to(CENTER_X, CENTER_Y) cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE2, ANGLE2) cr.line_to(CENTER_X, CENTER_Y) cr.stroke end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-operator.rb����������������������������������������0000644�0001750�0001750�00000005024�11701304107�021717� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-operator.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Operator This demo shows how to use GDK and cairo to use Cairo::OPERATOR_* From http://cairographics.org/samples/operator_add.html, http://cairographics.org/samples/operator_atop.html, http://cairographics.org/samples/operator_atop_reverse.html, http://cairographics.org/samples/operator_in.html, http://cairographics.org/samples/operator_in_reverse.html, http://cairographics.org/samples/operator_out.html, http://cairographics.org/samples/operator_out_reverse.html, http://cairographics.org/samples/operator_over.html, http://cairographics.org/samples/operator_over_reverse.html, http://cairographics.org/samples/operator_saturate.html and http://cairographics.org/samples/operator_xor.html =end require 'common' module Demo class CairoOperator < CairoWindow def initialize super('cairo operator') @operator = Cairo::OPERATOR_ADD set_default_size(400, 400) @drawing_area = child remove(@drawing_area) vbox = Gtk::VBox.new vbox.pack_start(@drawing_area, true, true) vbox.pack_start(operator_selector, false, false) add(vbox) end def draw(cr) cr.save do image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") cr.translate(0.5, 0.5) cr.rotate(-45 * Math::PI / 180) cr.scale(0.8 / image.width, 0.8 / image.height) cr.translate(-0.5 * image.width, -0.5 * image.height) cr.set_source(image, 0.0, 0.0) cr.paint end cr.set_operator(@operator) cr.set_source_rgba(1, 0, 0, 0.5) cr.rectangle(0.2, 0.2, 0.5, 0.5) cr.fill cr.set_source_rgba(0, 1, 0) cr.rectangle(0.4, 0.4, 0.4, 0.4) cr.fill cr.set_source_rgba(0, 0, 1) cr.rectangle(0.6, 0.6, 0.3, 0.3) cr.fill end def operator_selector combo = Gtk::ComboBox.new operators = [] Cairo.constants.each do |name| operators << name if /^OPERATOR_/ =~ name end operators.sort.each_with_index do |name, i| combo.append_text(name.to_s) combo.set_active(i) if Cairo.const_get(name) == @operator end combo.signal_connect("changed") do |widget| text = widget.active_text @operator = Cairo.const_get(text) if text @drawing_area.queue_draw end combo end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/list_store.rb��������������������������������������������0000644�0001750�0001750�00000011042�11701304107�021155� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: list_store.rb,v 1.5 2005/02/06 18:25:13 kzys Exp $ =begin = Tree View/List Store The Gtk::ListStore is used to store data in list form, to be used later on by a Gtk::TreeView to display it. This demo builds a simple Gtk::ListStore and displays it. See the Stock Browser demo for a more advanced example. =end require 'common' module Demo class ListStore < BasicWindow Bug = Struct.new('Bug', :fixed, :number, :severity, :description) COLUMN_FIXED, COLUMN_NUMBER, COLUMN_SEVERITY, COLUMN_DESCRIPTION, NUM_COLUMNS = *(0..5).to_a DATA = [ [ false, 60482, 'Normal', 'scrollable notebooks and hidden tabs' ], [ false, 60620, 'Critical', 'gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe' ], [ false, 50214, 'Major', 'Xft support does not clean up correctly' ], [ true, 52877, 'Major', 'GtkFileSelection needs a refresh method. ' ], [ false, 56070, 'Normal', "Can't click button after setting in sensitive" ], [ true, 56355, 'Normal', 'GtkLabel - Not all changes propagate correctly' ], [ false, 50055, 'Normal', 'Rework width/height computations for TreeView' ], [ false, 58278, 'Normal', "gtk_dialog_set_response_sensitive doesn't work" ], [ false, 55767, 'Normal', 'Getters for all setters' ], [ false, 56925, 'Normal', 'Gtkcalender size' ], [ false, 56221, 'Normal', 'Selectable label needs right-click copy menu' ], [ true, 50939, 'Normal', 'Add shift clicking to GtkTextView' ], [ false, 6112, 'Enhancement','netscape-like collapsable toolbars' ], [ false, 1, 'Normal', 'First bug :=)' ], ].collect do |ary| Bug.new(*ary) end def initialize super('GtkListStore demo') self.border_width = 8 vbox = Gtk::VBox.new(false, 8) add(vbox) label = Gtk::Label.new('This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).') vbox.pack_start(label, false, false, 0) sw = Gtk::ScrolledWindow.new(nil, nil) sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC) vbox.pack_start(sw, true, true, 0) # create tree model model = create_model # create tree view treeview = Gtk::TreeView.new(model) treeview.rules_hint = true treeview.search_column = COLUMN_DESCRIPTION sw.add(treeview) # add columns to the tree view add_columns(treeview) set_default_size(280, 250) end def create_model # create list store store = Gtk::ListStore.new(TrueClass, Integer, String, String) # add data to the list store DATA.each do |bug| iter = store.append bug.each_with_index do |value, index| iter[index] = value end end return store end def add_columns(treeview) # column for fixed toggles renderer = Gtk::CellRendererToggle.new renderer.signal_connect('toggled') do |cell, path| fixed_toggled(treeview.model, path) end column = Gtk::TreeViewColumn.new('Fixed?', renderer, 'active' => COLUMN_FIXED) # set this column to a fixed sizing (of 50 pixels) column.sizing = Gtk::TreeViewColumn::FIXED column.fixed_width = 50 treeview.append_column(column) # column for bug numbers renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new('Bug number', renderer, 'text' => COLUMN_NUMBER) column.set_sort_column_id(COLUMN_NUMBER) treeview.append_column(column) # column for severities renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new('Severity', renderer, 'text' => COLUMN_SEVERITY) column.set_sort_column_id(COLUMN_SEVERITY) treeview.append_column(column) # column for description renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new('Description', renderer, 'text' => COLUMN_DESCRIPTION) column.set_sort_column_id(COLUMN_DESCRIPTION) treeview.append_column(column) end def fixed_toggled(model, path_str) path = Gtk::TreePath.new(path_str) # get toggled iter iter = model.get_iter(path) fixed =iter[COLUMN_FIXED] # do something with the value fixed ^= 1 # set new value iter[COLUMN_FIXED] = fixed end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-applets.png����������������������������������������0000644�0001750�0001750�00000006022�11701304107�021724� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�� a���bKGD������ pHYs��`��`zxE���tIME (�� IDATxYuګg㐢9ҖdkMіI@ӒF 'P q^b=F I6<Yk I @L٢hQ#҈Ԉξw5}(e<) ={#qs$L.KgK v�\&H a-'r#pUVW cs1,'og])6˽~ @c[ : (&POsp3_:z|dxp4Ȓ4':NZeMo}ߘ]XY3B|y@.ρ|sy޽_$,H( �<ϱ]vX[>G/nN(9&P*/=ra0**,!!IRB_쯹 +baGRR/dS*?{ķ+}5,)nj]R7 4%Mb$%NRUS/.Cȥw}TT*S)K覉a訪,ɿ$4!c8!c8ŕ;%l3j>?w\R*)U*eR4Q5EQd.$邕}(8ˆLKzk}}^o| Ǟ{_꺎ii J ib)2 ,S)Ұt+N9voinʲhF ,Q*WɃYӻ໱/ ,QT$uMes;B6x@Ldp edY)2cPUwH2xId Y\'N*$2YzRra/ۥ'}x"K3,#R,,f4%C|&+!4#R$EcyI(Wpz`Rӿ*2 {AަXS#it2EDa@xv| €(KӘ$Iӄ4MIqyxq7/ӱ]TMR.?݌mj8ꮰQݕw\s|}K" C(&j54z^z;Flj☡a\Ͽ/xAډHdOA@{xظݱpm ױ|;>( g}}3gޣ^gV\,rIݮ= +]iE!Bs=<z�Hx wq/* XKg].`$Y_N8ΰ;mۢcXOǶc:.高9u0 x9TUMA&d]o0zR$Ii9<дnV5x>_feNt=/~SJ uD*] U(Cǧ/ֱ]xg"e]iJr|qXZ\4?ȓ?JLN& <feeO ek h 9b3tM])q?:faee޹O#IRV6(L.XE۲ xϳ4χSm;N,^_KW]klSSSkjىYZ^ Gⶽ{'L|6M66[Uk<<cSorǬoawl0$c4579vɓBGr|-[y ߐGOlx0>>]CܵGf׮a'2,bychl!{>A!I8V==X6M�{8*f9 xWJ%Iqˬ?ÿ4X= I,ϒ)aF1AA1iS2M8V#lľW_}N`nvCCyȲ Ο'==? ʪ!q#2%äJ�ozw}yusl^[[[a RNZ1l{ &'%BR 45$&Ŭq% $ } ZZ\4c>{`˲fFFF5A (lvnzSo�}͖mwszr;B�Ak*"$ i"+2*aP_K˫/ߚ8juj'F!%{T;%IUUZa*W):r0體 RVjhɩ19nZoO>.^n(HpZFFmfQ{l CM쯡j*#JwKt72�y?\v♶ ' m멅# V,ˆg C3TEsuM!YQU)#m+_܈?%! @C^>kR(uc3e՞]lA_x)n/o�+uhZQ`Q,<liOU cg7yA|52�7]B9p @xq bo?ڧE~p{ ցtc Ř5.a[A}/ ef b\GYD@6$-<E/E,E=<VD8q//.!<+dM`PV<}Cvwb}HB&*za+9B{z4zQ$Pr8C7ze^)|oթ {y շX~o$QajmӢ "EBbxvPZs|EkS؎%_X{.^52* @NwB�hJiO{]XdZ8'Z O YG2Ad;@zooAk����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-fs-regular.png�������������������������������������0000644�0001750�0001750�00000003403�11701304107�022323� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���4���̓���bKGD������C��IDATx՚KoWC4³*HtEʢ,RB+O]Y#P%XtQHx4< MTv`ĵӅ3;wSP+d߹w|?5w,N`u wP(|b(cccrQ_{@*VܺuKDDfffފ@Jr,bQdttW8%R!"H* ="ɰyf._ �X Mlݺu^G\-[044DkkSЗ۷oϋ~abb�LM6q :::J~y58yGww77~M85Bs&0 J%sccc\zRĆ ݜ:u {`O&hDhڪy_#GP,QY={| �Ju.D>/_N.X\�8q߸dF<zlP=QpF_]+!JQT�i<8v.`B.rT�z*j"U* |t/7,6`*y�5SumۦYE8x2ո(fhnnv"(Tbd�2&=S_+W.t67ѬEĚ@{}I9'ۿe$,1q>veO|jTytXD)U|</4_UF Tݫ4db###tvv&y&ʦMτ2<]_9wcb@رcr٢ VX$c\D(eF{xb*B"p -Z 1tX\ȴ>DWDX<xŋd>L2,\kI5 $;w͛׆2.Nf`%X!+"ݻϟ%AH~:--UH*(HI|hDbg.\8ϲe^@$fۘML&@H)RT,ʈ5F6%B LNd׮ŋ5HB8i\LNZsZzp\B^'ĶCzXHk. $p?ԜkqUUx$!U}fr1IRcbDgYjM2 [j\Lb&-[IaWJ !vOgwe+l$k KYbbqR"S\4Bgck(Y(Da:khhrָ%Mk!~^|QFљ8؊ð)/ǡCd'B##tiFK(n&6MBJ&S(Ξ=Ú5%$Z%sypn)MCg9n[rp0'C/[ܫ*"ўXOnQ|b"̙_Xv]rzPv۞!Bx߾rO-r}ŵopkJnϟ?GW (Lpzh˸[Xӧfݺ=$0;--u34rps=٩WÇIC\ڀL.~}]rIeޅ)!<Zx{#55 fdffgON<4 eܽ'lW^Yo_G`9>Т�.!k)0CHP*MZ0/dm(C@e����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/rotated_text.rb������������������������������������������0000644�0001750�0001750�00000006173�11701304107�021505� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: rotated_text.rb,v 1.2 2005/03/05 15:01:16 mutoh Exp $ =begin = Rotated Text This demo shows how to use GDK and Pango to draw rotated and transformed text. The use of Gdk::PangoRenderer in this example is a somewhat advanced technique; most applications can simply use Gdk::Drawable#draw_layout. We use it here mostly because that allows us to work in user coordinates - that is, coordinates prior to the application of the transformation matrix, rather than device coordinates. As of GTK+-2.6, the ability to draw transformed and anti-aliased graphics as shown in this example is only present for text. With GTK+-2.8, a new graphics system called "Cairo" will be introduced that provides these capabilities and many more for all types of graphics. =end require 'common' module Demo class RotatedText < BasicWindow RADIUS = 150 N_WORDS = 10 FONT = "Sans Bold 27" def initialize super('Rotated Text') unless Gtk.check_version?(2, 6, 0) add(Gtk::Label.new("This sample requires GTK+ 2.6.0 or later")) return end drawing_area = Gtk::DrawingArea.new add(drawing_area) drawing_area.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(65535, 65535, 65535)) drawing_area.signal_connect("expose_event") do matrix = Pango::Matrix.new # Get the default renderer for the screen, and set it up for drawing renderer = Gdk::PangoRenderer.get_default(drawing_area.screen) renderer.drawable = drawing_area.window renderer.gc = style.black_gc width = drawing_area.allocation.width height = drawing_area.allocation.height # Set up a transformation matrix so that the user space coordinates for # the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS] # We first center, then change the scale device_radius = [width, height].min / 2.0 matrix.translate!(device_radius + (width - 2 * device_radius) / 2.0, device_radius + (height - 2 * device_radius) / 2.0) matrix.scale!(device_radius / RADIUS, device_radius / RADIUS) # Create a PangoLayout, set the font and text context = Gdk::Pango.context layout = Pango::Layout.new(context) layout.text = "Text" layout.font_description = Pango::FontDescription.new(FONT) # Draw the layout N_WORDS times in a circle (0...N_WORDS).each do |i| rotated_matrix = matrix.dup angle = 360 * i / N_WORDS.to_f # Gradient from red at angle == 60 to blue at angle == 300 red = 65535 * (1 + Math.cos((angle - 60) * Math::PI / 180.0)) / 2 color = Gdk::Color.new(red, 0, 65535 - red) renderer.set_override_color(Pango::Renderer::PART_FOREGROUND, color) rotated_matrix.rotate!(angle) context.matrix = rotated_matrix # Inform Pango to re-layout the text with the new transformation matrix layout.context_changed width, height = layout.size renderer.draw_layout(layout, - width / 2, - RADIUS * Pango::SCALE) end # Clean up default renderer, since it is shared renderer.set_override_color(Gdk::PangoRenderer::PART_FOREGROUND, nil) renderer.drawable = nil renderer.gc = nil end end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-text.rb��������������������������������������������0000644�0001750�0001750�00000002060�11701304107�021045� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-text.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Text This demo shows how to use GDK and cairo to show text. From http://cairographics.org/samples/text.html. =end require 'common' module Demo class CairoText < CairoWindow def initialize super('cairo text') end def draw(cr) cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD) cr.set_font_size(0.35) cr.move_to(0.04, 0.53) cr.show_text("Hello") cr.move_to(0.27, 0.65) cr.text_path("void") cr.set_source_rgba(0.5, 0.5, 1) cr.fill_preserve cr.set_source_rgba(0, 0, 0) cr.set_line_width(0.01) cr.stroke # draw helping lines cr.set_source_rgba(1,0.2,0.2, 0.6) cr.arc(0.04, 0.53, 0.02, 0, 2 * Math::PI) cr.arc(0.27, 0.65, 0.02, 0, 2 * Math::PI) cr.fill end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-clip.rb��������������������������������������������0000644�0001750�0001750�00000001316�11701304107�021013� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-clip.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Clip This demo shows how to use GDK and cairo to use clip. From http://cairographics.org/samples/clip.html. =end require 'common' module Demo class CairoClip < CairoWindow def initialize super('cairo clip') end def draw(cr) cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI) cr.clip cr.new_path cr.rectangle(0, 0, 1, 1) cr.fill cr.set_source_rgba(0, 1, 0) cr.move_to(0, 0) cr.line_to(1, 1) cr.move_to(1, 0) cr.line_to(0, 1) cr.stroke end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-image.rb�������������������������������������������0000644�0001750�0001750�00000002402�11701304107�021143� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-image.rb,v 1.2 2005/10/16 12:07:32 mutoh Exp $ =begin = cairo/Image This demo shows how to use GDK and cairo to show image. From http://cairographics.org/samples/image.html. =end require 'common' module Demo class CairoImage < CairoWindow def initialize super('cairo gradient') end def draw(cr) cr.save do loader = Gdk::PixbufLoader.new File.open("background.jpg", "rb") do |f| loader.last_write(f.read) end pixbuf = loader.pixbuf cr.translate(0.5, 0.5) cr.rotate(45 * Math::PI / 180) cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height) cr.translate(-0.5 * pixbuf.width, -0.5 * pixbuf.height) cr.set_source_pixbuf(pixbuf, 0, 0) cr.paint end cr.save do image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") cr.translate(0.5, 0.5) cr.rotate(60 * Math::PI / 180) cr.scale(0.8 / image.width, 0.8 / image.height) cr.translate(-0.5 * image.width, -0.5 * image.height) cr.set_source(image, 0, 0) cr.paint end end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/clipboard.rb���������������������������������������������0000644�0001750�0001750�00000003734�11701304107�020736� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # $Id: clipboard.rb,v 1.3 2005/07/28 14:30:38 mutoh Exp $ =begin = Clipboard GtkClipboard is used for clipboard handling. This demo shows how to copy and paste text to and from the clipboard. =end require 'common' module Demo class Clipboard < Demo::BasicWindow def initialize super('Clipboard') unless Gtk.check_version?(2, 2, 0) add(Gtk::Label.new("This sample requires GTK+ 2.2.0 or later")) return end vbox = Gtk::VBox.new(false, 0) vbox.border_width = 8 add(vbox) label = Gtk::Label.new(%Q["Copy" will copy the text\nin the entry to the clipboard]) vbox.pack_start(label, false, false, 0) hbox = Gtk::HBox.new(false, 0) hbox.border_width = 8 vbox.pack_start(hbox, false, false, 0) # Create the first entry entry = Gtk::Entry.new hbox.pack_start(entry, true, true, 0) # Create the button button = Gtk::Button.new(Gtk::Stock::COPY) hbox.pack_start(button, false, false, 0) button.signal_connect('clicked', entry) do |w, e| clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD) clipboard.text = e.text end label = Gtk::Label.new(%Q["Paste" will paste the text from the clipboard to the entry]) vbox.pack_start(label, false, false, 0) hbox = Gtk::HBox.new(false, 4) hbox.border_width = 8 vbox.pack_start(hbox, false, false, 0) # Create the second entry entry = Gtk::Entry.new hbox.pack_start(entry, true, true, 0) # Create the button button = Gtk::Button.new(Gtk::Stock::PASTE) hbox.pack_start(button, false, false, 0) button.signal_connect('clicked', entry) do |w, e| clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD) clipboard.request_text do |board, text, data| e.text = text end end end end end ������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-curve-to.rb����������������������������������������0000644�0001750�0001750�00000001532�11701304107�021630� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-curve-to.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Curve To This demo shows how to use GDK and cairo to draw curve. From http://cairographics.org/samples/curve_to.html. =end require 'common' module Demo class CairoCurveTo < CairoWindow X = 0.1 Y = 0.5 X1 = 0.4 Y1 = 0.9 X2 = 0.6 Y2 = 0.1 X3 = 0.9 Y3 = 0.5 def initialize super('cairo curve to') end def draw(cr) cr.move_to(X, Y) cr.curve_to(X1, Y1, X2, Y2, X3, Y3) cr.stroke cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.set_line_width(0.03) cr.move_to(X, Y) cr.line_to(X1, Y1) cr.move_to(X2, Y2) cr.line_to(X3, Y3) cr.stroke end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/colorsel.rb����������������������������������������������0000644�0001750�0001750�00000003761�11701304107�020621� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: colorsel.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $ =begin = Color Selector Gtk::ColorSelection lets the user choose a color. Gtk::ColorSelectionDialog is a prebuilt dialog containing a Gtk::ColorSelection. =end require 'common' module Demo class ColorSel < BasicWindow def initialize super('Color Selection') @color = Gdk::Color.new(0, 0, 65535) set_border_width(8) vbox = Gtk::VBox.new(false, 0) vbox.set_border_width(8) add(vbox) ## Create the color swatch area @frame = Gtk::Frame.new @frame.set_shadow_type(Gtk::SHADOW_IN) vbox.pack_start(@frame, true, true, 0) @da = Gtk::DrawingArea.new @da.signal_connect('expose_event') do |widget, event| if widget.window style = widget.style widget.window.draw_rectangle(style.bg_gc(Gtk::STATE_NORMAL), true, event.area.x, event.area.y, event.area.width, event.area.height) end end # set a minimum size @da.set_size_request(200, 200) # set the color @da.modify_bg(Gtk::STATE_NORMAL, @color) @frame.add(@da) alignment = Gtk::Alignment.new(1.0, 0.5, 0.0, 0.0) button = Gtk::Button.new('_Change the above color', true) alignment.add(button) vbox.pack_start(alignment, false, false, 0) button.signal_connect('clicked') do change_color_callback end end def change_color_callback dialog = Gtk::ColorSelectionDialog.new('Changing color') dialog.set_transient_for(self) colorsel = dialog.colorsel colorsel.set_previous_color(@color) colorsel.set_current_color(@color) colorsel.set_has_palette(true) response = dialog.run if response == Gtk::Dialog::RESPONSE_OK @color = colorsel.current_color @da.modify_bg(Gtk::STATE_NORMAL, @color) end dialog.destroy end end end ���������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/sizegroup.rb���������������������������������������������0000644�0001750�0001750�00000007016�11701304107�021023� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: sizegroup.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Size Groups Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk::Table widget. Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a Gtk::SizeGroup to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include the Gtk::FILL flag. =end require 'common' module Demo class SizeGroup < Gtk::Dialog def initialize super('GtkSizeGroup', nil, 0, [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE]) color_options = %w(Red Green Blue) dash_options = %w(Solid Dashed Dotted) end_options = %w(Square Round Arrow) set_resizable(false) signal_connect('response') do destroy end vbox = Gtk::VBox.new(false, 5) self.vbox.pack_start(vbox, true, true, 0) vbox.set_border_width(5) size_group = Gtk::SizeGroup.new(Gtk::SizeGroup::HORIZONTAL) ## Create one frame holding color options frame = Gtk::Frame.new('Color Options') vbox.pack_start(frame, true, true, 0) table = Gtk::Table.new(2, 2, false) table.set_border_width(5) table.set_row_spacings(5) table.set_column_spacings(10) frame.add(table) add_row(table, 0, size_group, '_Foreground', color_options) add_row(table, 1, size_group, '_Background', color_options) ## And another frame holding line style options frame = Gtk::Frame.new('Line Options') vbox.pack_start(frame, false, false, 0) table = Gtk::Table.new(2, 2, false) table.set_border_width(5) table.set_row_spacings(5) table.set_column_spacings(10) frame.add(table) add_row(table, 0, size_group, '_Dashing', dash_options) add_row(table, 1, size_group, '_Line ends', end_options) # And a check button to turn grouping on and off check_button = Gtk::CheckButton.new('_Enable grouping', true) vbox.pack_start(check_button, false, false, 0) check_button.set_active(true) check_button.signal_connect('toggled', size_group) do |check_button, size_group| new_mode = if check_button.active? Gtk::SizeGroup::HORIZONTAL else Gtk::SizeGroup::VERTICAL end size_group.set_mode(new_mode) end end def add_row(table, row, size_group, label_text, options) label = Gtk::Label.new(label_text, true) label.set_alignment(0, 1) table.attach(label, 0, 1, row, row + 1, Gtk::EXPAND | Gtk::FILL, 0, 0, 0) option_menu = create_option_menu(options) label.set_mnemonic_widget(option_menu) size_group.add_widget(option_menu) table.attach(option_menu, 1, 2, row, row + 1, 0, 0, 0, 0) end def create_option_menu(strings) menu = Gtk::Menu.new strings.each do |str| menu_item = Gtk::MenuItem.new(str) menu_item.show menu.append(menu_item) end option_menu = Gtk::OptionMenu.new option_menu.set_menu(menu) return option_menu end end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-pattern-fill.rb������������������������������������0000644�0001750�0001750�00000003705�11701304107�022471� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-pattern-fill.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Pattern Fill This demo shows how to use GDK and cairo to fill by pattern. From http://cairographics.org/samples/pattern_fill.html. =end require 'common' module Demo class CairoPatternFill < CairoWindow X_FUZZ = 0.08 Y_FUZZ = 0.08 X_INNER_RADIUS = 0.3 Y_INNER_RADIUS = 0.2 X_OUTER_RADIUS = 0.45 Y_OUTER_RADIUS = 0.35 SPIKES = 10 TEXT = "Ruby!" def initialize super('cairo pattern fill') end def draw(cr) srand(45) cr.set_line_width(0.01) x = y = nil 0.step(SPIKES * 2 - 1, 2) do |i| x = x_position(i, X_INNER_RADIUS) y = y_position(i, Y_INNER_RADIUS) if (i == 0) cr.move_to(x, y) else cr.line_to(x, y) end i += 1 x = x_position(i, X_OUTER_RADIUS) y = y_position(i, Y_OUTER_RADIUS) cr.line_to(x, y) end cr.close_path cr.stroke cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD) cr.move_to(x - 0.5, y) cr.set_font_size(0.1) cr.text_path(TEXT) cr.set_source_rgba(1, 0, 0.5) cr.fill cr.set_font_size(0.2) extents = cr.text_extents(TEXT) x = 0.5 - (extents.width / 2 + extents.x_bearing) y = 0.5 - (extents.height / 2 + extents.y_bearing) cr.move_to(x, y) cr.text_path(TEXT) cr.set_source_rgba(1, 0, 0) cr.stroke end def x_position(i, radius) 0.5 + Math.cos(Math::PI * i / SPIKES) * radius + rand * X_FUZZ end def y_position(i, radius) 0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ end end end �����������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/main.rb��������������������������������������������������0000755�0001750�0001750�00000023333�12257552167�017745� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /usr/bin/env ruby =begin main.rb - Main class of gtk-demo. Copyright (c) 2003-2013 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: main.rb,v 1.20 2007/07/09 13:21:54 ggc Exp $ =end require 'gtk2' $:.unshift(File.dirname(__FILE__)) module Demo class Main < Gtk::Window TITLE_COLUMN, FILENAME_COLUMN, CLASS_COLUMN, ITALIC_COLUMN = 0, 1, 2, 3 def initialize super() @current_file = nil @info_buffer = Gtk::TextBuffer.new @source_buffer = Gtk::TextBuffer.new set_title('Ruby/GTK+ Code Demos') signal_connect('destroy') do Gtk.main_quit end signal_connect("key_press_event") do |widget, event| if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q destroy true else false end end hbox = Gtk::HBox.new add(hbox) tree = create_tree scrolled_window = Gtk::ScrolledWindow.new scrolled_window.add(tree) hbox.pack_start(scrolled_window, false, false, 0) notebook = Gtk::Notebook.new hbox.pack_start(notebook, true, true, 0) notebook.append_page(create_text(@info_buffer, false), Gtk::Label.new('_Info', true)) notebook.append_page(create_text(@source_buffer, true), Gtk::Label.new('_Source', true)) @info_buffer.create_tag('title', {'font' => 'Sans 18'}) @source_buffer.create_tag('comment', {'foreground' => 'red'}) @source_buffer.create_tag('const', {'foreground' => 'ForestGreen'}) @source_buffer.create_tag('string', { 'foreground' => 'RosyBrown', 'weight' => Pango::FontDescription::WEIGHT_BOLD }) @source_buffer.create_tag('reserved', {'foreground' => 'purple'}) end def script_info(path) title = nil klass = nil depend = nil file = File.open(path) file.each do |ln| if not title and ln =~ /^=\s+(.*)$/ title = $1 if title =~ /^(.*)\((.+?)\)$/ title = $1 depend = $2 end elsif not klass and ln =~ /\s*class\s+([A-Z][A-Za-z0-9_]*)/ klass = $1 end if title and klass break end end if not klass raise "File not found: #{path}." end return title, klass.intern, depend end def generate_index base_dir = File.dirname(__FILE__) # Target scripts scripts = Dir.glob(File.join(base_dir, '*.rb')) # Generate index tree children = {} index = [] not_script_base_names = %w(common.rb main.rb) scripts.each do |fn| base_name = File.basename(fn) next if not_script_base_names.include?(base_name) title, klass, depend = script_info(fn) if depend and not Gtk.const_defined?(depend) next end if title =~ %r{^(.+?)/(.+)$} parent = $1 child = $2 unless children[parent] children[parent] = [] index += [[parent, nil, nil, []]] end children[parent] += [[child, fn, klass]] else index += [[title, fn, klass]] end end # Sort children children.each_key do |parent| children[parent].sort! do |a, b| a[0] <=> b[0] end end # Expand children index.collect! do |row| if row[3] row[3] = children[row[0]] end row end index.sort! do |a, b| a[0] <=> b[0] end index end def create_tree model = Gtk::TreeStore.new(String, String, String, TrueClass) tree_view = Gtk::TreeView.new tree_view.set_model(model) selection = tree_view.selection selection.set_mode(Gtk::SELECTION_BROWSE) tree_view.set_size_request(200, -1) append_children(model, generate_index) cell = Gtk::CellRendererText.new cell.style = Pango::FontDescription::STYLE_ITALIC column = Gtk::TreeViewColumn.new("Widget (double click for demo)", cell, { 'text' => TITLE_COLUMN, 'style_set' => ITALIC_COLUMN, }) tree_view.append_column(column) selection.signal_connect('changed') do |selection| iter = selection.selected load_file(iter.get_value(FILENAME_COLUMN)) if iter end tree_view.signal_connect('row_activated') do |tree_view, path, column| row_activated_cb(tree_view.model, path) end tree_view.expand_all return tree_view end def append_children(model, source, parent = nil) source.each do |title, filename, klass, children| iter = model.append(parent) [title, filename, klass].each_with_index do |value, i| if value iter.set_value(i, value) end end iter.set_value(ITALIC_COLUMN, false) if children append_children(model, children, iter) end end end def row_activated_cb(model, path) iter = model.get_iter(path) iter.set_value(ITALIC_COLUMN, true) lib = iter.get_value(FILENAME_COLUMN) if lib require(lib) klass = Demo.const_get(iter.get_value(CLASS_COLUMN)) window = klass.new window.signal_connect('destroy') do iter.set_value(ITALIC_COLUMN, false) end window.show_all @window = window end end def create_text(buffer, is_source) scrolled_window = Gtk::ScrolledWindow.new scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) scrolled_window.set_shadow_type(Gtk::SHADOW_IN) text_view = Gtk::TextView.new text_view.set_buffer(buffer) text_view.set_editable(false) text_view.set_cursor_visible(false) scrolled_window.add(text_view) if is_source font_desc = Pango::FontDescription.new('Monospace 12') text_view.modify_font(font_desc) text_view.set_wrap_mode(Gtk::TextTag::WRAP_NONE) else text_view.set_wrap_mode(Gtk::TextTag::WRAP_WORD) text_view.set_pixels_above_lines(2) text_view.set_pixels_below_lines(2) end return scrolled_window end def fontify(start_iter = @source_buffer.start_iter, end_iter = @source_buffer.end_iter) str = @source_buffer.get_text(start_iter, end_iter, true) tokenizer = RubyTokonizer.new tokenizer.tokenize(str, start_iter.offset) do |tag, start, last| @source_buffer.apply_tag(tag.to_s, @source_buffer.get_iter_at_offset(start), @source_buffer.get_iter_at_offset(last)) end end def load_file(filename) if filename == @current_file return end @info_buffer.delete(*@info_buffer.bounds) @source_buffer.delete(*@source_buffer.bounds) file = begin File.open(filename) rescue $stderr.puts "Cannot open: #{$!}" if $DEBUG return end start = @info_buffer.get_iter_at_offset(0) state = :before_header file.each do |line| case state when :before_header if line =~ /^=begin$/ state = :in_header end when :in_header if line =~ /^=end$/ state = :body start = @source_buffer.get_iter_at_offset(0) elsif line =~ /^=\s+(.*)$/ title = $1 title.gsub!(/\s*\(.*\)$/, '') # Delete depend field last = start @info_buffer.insert(last, title) start = last.clone start.backward_chars(title.length) @info_buffer.apply_tag('title', start, last) start = last else @info_buffer.insert(start, line) end when :body # Reading program body @source_buffer.insert(start, line) end end fontify @current_file = filename end end class RubyTokonizer RESERVED_WORDS = %w(begin end module class def if then else while unless do case when require yield) RESERVED_WORDS_PATTERN = Regexp.compile(/(^|\s+)(#{RESERVED_WORDS.collect do |pat| Regexp.quote(pat) end.join('|')})(\s+|$)/) def tokenize(str, index = 0) until str.empty? tag = nil case str when /".+?"/, /'.+?'/ tag = :string when /#.*$/ tag = :comment when RESERVED_WORDS_PATTERN tag = :reserved when /[A-Z][A-Za-z0-9_]+/ tag = :const end if tag tokenize($~.pre_match, index) do |*args| yield(*args) end yield(tag, index + $~.begin(0), index + $~.end(0)) index += (str.length - $~.post_match.length) str = $~.post_match else index += str.length str = '' end end end end end target = ARGV.shift if target Demo::INDEX.each do |title, filename, klass_symbol, children| if target == filename or target == klass_symbol.id2name require filename window = Demo.const_get(klass_symbol).new window.show_all class << window def quit Gtk.main_quit end end break end end else main = Demo::Main.new main.set_default_size(600, 400) main.show_all end Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-self-intersect.rb����������������������������������0000644�0001750�0001750�00000001377�11701304107�023022� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-self-intersect.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Self Intersect This demo shows how to use GDK and cairo to show cross. From http://cairographics.org/samples/xxx_self_intersect.html. =end require 'common' module Demo class CairoSelfIntersect < CairoWindow def initialize super('cairo self intersect') end def draw(cr) cr.move_to(0.3, 0.3) cr.line_to(0.7, 0.3) cr.line_to(0.5, 0.3) cr.line_to(0.5, 0.7) cr.set_line_width(0.22) cr.set_line_cap(Cairo::LINE_CAP_ROUND) cr.set_line_join(Cairo::LINE_JOIN_ROUND) cr.stroke end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/expander.rb����������������������������������������������0000644�0001750�0001750�00000002045�11701304107�020577� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # $Id: expander.rb,v 1.2 2005/02/25 17:09:25 kzys Exp $ =begin = Expander (Expander) GtkExpander allows to provide additional content that is initially hidden. This is also known as "disclosure triangle". =end require 'common' module Demo class Expander < Gtk::Dialog def initialize super('GtkExpander', nil, # parent 0, [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE]) self.resizable = false signal_connect('response') do self.destroy end vbox = Gtk::VBox.new(false, 5) self.vbox.pack_start(vbox, true, true) vbox.border_width = 5 label = Gtk::Label.new('Expander demo. CLick on the triangle for details.') vbox.pack_start(label, false, false) # Create the expander expander = Gtk::Expander.new('Details') vbox.pack_start(expander, false, false) expander.add(Gtk::Label.new('Details can be shown or hidden.')) end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/alphatest.png��������������������������������������������0000644�0001750�0001750�00000063641�11701304107�021150� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��|�����B}>���gAMA��|Q��� cHRM��o?��r��$����m_��j��<��Wm��g,IDATxb?(`�i0 F(>� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 9]:= �h`3Z� G[`Q02�@�G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(`��-G(R�@,Q0 F~8.�h Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F� v(C D,�R @Z``d"ڭ` �b?,SLWRdh$7|4CH4 UPvfdd3 gm0$riUR=7 (Y^`�8FXrpIgt((� O�bm(F5@ qE7B+:`eD(ʠN< $uG"=X!܋@\?`|kn  c$Fp@'FF \SxIg*ZcR�@�{  ȿHhr uj45cac1#iUQ4}E;D-T2?,H͋U^$&,#, ta|HwTgF( � |X!0F.W"ˀ@c)!L6 aAFF<P/!<4ӃF yѷĨ+^ 9?G\02+RiQ0 H��4>J˙{Ie`*z .opf N{ e\0Vy02BZxh y/ƚ:$-8* t? S<a![&^(�@9k(u09 u)#*F{hnhR9@+Ѐ_?D1 ,5i0�N!<XAm-{D �wF( �@ `�[װ~||4/ogD-� p/LXja>#\?:3AP\u`<A!5^VDi<n0@=3!cMiQ0 �*l-+F(ǀqb1/T/:d3-˄-u!n }Bqp�_U^iay`0@Da*!+Qg4!. A&FJFPE!Ȩ!$a̓` �hZ[`*u�.#&۠6 iC&h=#h2aQ@?T7#dx4{c!%=dѳ0 p _?t`@@�ѻ\2 -|X 䌃ܒ&zApË?{5P;@9{9`0j8?hyHψfO!v;1C#mǃ9l�%(�I[V9Vu`31LBc-ry8,x4eWLy T[Dž  4nX\V00lUπ%SxaĈψXv(�e gވ l8=؆z`4 ] +LjY]GV#<2dXFeD 3 =x|)&pt<XI02|7ף`�h[M<f5neCh6Bp+�7�ّ  o@7Ka B?lmqV(`eofZ CDT` yuw~G( �@V@ dBe<#t=dw$na-$c3e~lXi;P�TIxdoWqIz>&j024M j-у]'`U`a&D�@]࣏`zlC<G9@IG,򯮙g@xkEmϝ9'$W`VZ9l[A4ňH3sIgh}< Fy� rH ,[I0 NJapXX|?F%xrg\KeaC-a󌈉WpI[t'z%P_ 4&!|H d- E]ߎQ@�xQ$uH3`z`-˄aj1@E+1�W|мu@f�t=>Ȓm"v`a [tz5#R,CSϸd@z+0@Y[K¿PQ0 h �h#NXvB}vQKA10�i.J=G--|:nh+a $pCw"nGŶ,;<uL� bHȠ;,8>؊ {>WVOv3V|VON˙ , >.[=6#7 F�4PC:-{I3t`�p?Rw|Z�ctC[H4,n',�Z7xҎNdufѕ@Jh?�M'7!$Q]R�Ң@,7sj7踂l ѥ!L1`+`L ޾mrژ3hn!db5qNiO!=,98-'@;>Ⱦ]ٟX{ft< &]hA9]ƭ< ^(p 931q@MPy NrynX̤ Y]eyjD"4#v84`sK.#�@ |X|=0g"ҁ.M74T@LjÍ "K PnX9 WdL#t <&$ԁydElYv_Ԍ!Cr;VOpW02, K U@75�ő)fA갫$[eO)ӌqotg|FYHe#RflQgD3tUB!R<@X]0w .dZ+i t%aK*#}HQLzU?HsYL%5B##rL!@Fd7 TXoNxt2]A X0v ]ЍrK|2J^r� z vhl4<2@W댈$= $0‰.9L`Y Np�1@/Jeu,ldY*\v|Q7=� {P z0(Ԟ t;l?tfEtd+Z`aT4<@:m�s2*D! Hص 7@F8#Al+!U2x !U Ԇ< RCVTbP ^ π-SoB3tP*PqJ <Pq t<C kÇ2$Π3 ׻ ^(�@}Y`=fǷN26OʝWMB7؀~baj=^@.'le̙b�Evq eCe|ѡ'r'�qg#)g@w4~΅e@lN rF<`đ N|[sa!d@ umHzNs"!1vtov^`}_f/~dKƿ#< @F{Eo6K�ŧ4/Ā2~f0zL A`K`|6o_E #� �yW@횎tԤ"BEA(yI#Hy86;$PR%뱣gw1R̻5 @BB(p~==QVqqxs*42"�E ӂ?lɁS}=n_ugS$$,ǮUۧȶ.o\1__ x7A#%_^O*Vv@ajuSa '}eGM0Y I%j*S\}L9Ȩ _7WӻxxRz; ­bSl'S=iOj^Za¿w(@ީ [ hk#ࣴ,,^BY#UPI7aLo>6`퟼RBFB6Vy;l? ~C4Y9v*J1Q.Q!ɦ;v2XXAѥgN+Y :,C[J[u/~~q! QRP2IjvoMgҁD9 N'ygdI0-z7lB,z|!}i8i| ['D!sf}n{SA7q0R-l i!=Ǚz"ub e52,FsE݃p?;bv+$|o'6<ȳׄ+i v/YA0wTЍ $`de@]*H ;+ƉKrJ Djι/tXe{X;(;o>N4U4p;Z(̀m[#҆3/mb�wSD|<n^08B-EDܝjq,/_i [XkB\K\!;nSD.az}&qG\&@"pu{D&bsFXfd?8%Ī�|/.ˀgF"<TWi1*,5`In)PU1m)/@#\\6FV>nS� Ԥ`f2,c?.z$'K'~ +�naJ?(�HI2/IW` tձr FD9$5i@QPWx?c8d?R ^f`VΩ].n?:r!l 8'P֩٠Bco!4aSx\ئgFjdf6 Zӟp`@ HόyZ&0Tk fϻE-̜Z|'t"-eRP4QM;p{aY"` @SGRPCBÚ)ᣨЋi` -/ 3YX>*Izn�=0 #p$F3,HV& (,&X=$q˯`` [D y _.sXI[Old?]ʓe{4o~_[G܈ .ݔ)杓.%%hClD=ӂƫ֫ _m (u dd~N7{sQ3->s m7S  XVQ+`Xʎ}SWDI!P"1I` hl#]OFAXà,ǘL\ @0Uևn}m4#Ĵ~BVmId~.6`n?de @޵ ,l$vXXG`D ,RQ@4ugύ?w1ŭ=פ-!*Gr]O̽Q.XN}1* D= LdjP+cHsCHr; {ܯ Ur5(Vtv$[&;䟝<2%uM;Y*1|ɲ| ]"ISf}5Pp0nTdNPA:wG"3Iji܏K*NxH o"=TXgH:| = qah3p�`gg\pǪ&yi+$$jIdzjIo{{6l}t41I/Z[/ې)-,F}~m5 K)8 19P@{eYKw$I0E @"+T�]q<]oV=dzeC�Lp67TIJʎ2xgbӟ G߅}!35tgnko0L}oRę1,qJ'^mh')! $"%;)د,s$9(N5Ԥ.bC uYemb쵴`ox %�ygo0 Ca# 4l� =;P2� 0+q+zO wGsX'?}I ER#܎!*K^|AUY6$գ[ٜIBi /$٣{͵(ѥBh*&iӴNݲo~SƘ�7 _Q&`� v.o]S}kf�HSC-@;J*W0C6p%�A2p-@C:Jՠ+y|ڮO&jq@^ѼV|M;}�/Js`2JlOЦA2m@ tH,0=s�9g;' hD}';_,O)x_J)`m琿gZQS}=IS;x*!1k@'-I`|(Fh2N,& 3X-Wtp;'}e'<)[TӨ架9]j�aU E2Ĭ4hWUB-.$sϬ39!}x'v@;iȴ(O4 J$Z{{eK+Gy< qa(lo +`c [!SЩ?RN{qv?r ߃݂_Q ZBՁfm"u6x-{z{gJFUL<~q"d%)mFPg-:d>f2Foy'T;UosEn@_/|e?Ø٠m<>21V$Pܳ)Ti]vӱ cۤ qFw 2$Wʝh9{4$):pVY|31unWȻ#bǫkj% lw<,fFo ax< }F7_^熧 'ڂ04<_?*ȍpC8,Z´KМ-W)|FeB%<CUDxW.$?u\2Ō}K @lYwE7 ڕyA=U''<3)('ME7 GLdjj&/"0QtœP| �;#Q k%�yWp@ I5|ہ+ w!/|.wؐ_W|F'1,Rd2/4&H),$LDf^(rH U ǣH]::_hܙ,Bsi}X'QOɬ3܄Fj/ Ȳn; SXE ޓ<WFf`N1cN:ro(J""Ah 9CE>wfEVm!Aչ3Q4zhKv<ڍah4+0ð @T4,Ai#K iqPdYz/:r|X&Rz3^/Dډ䃇A*z XZhh(Nêp9'6=RXa& drѣ*Ct{=}2; {B`2UāWR I{m)lGKR\E7lulw̱* @Q&B҉uԕxS1wC[2=kTDTSapZi>Ydҧ]{#o]W�a&.FCtD=[ZI&8a1!1!>},Q KN?. u{iDF+A;=�lˣ{4_C^ P1Skdx/<9L.I0=eyyN)[3 k 'PY_em#|P\ Ң~VDP0iIp+:C,Z{/4Ts1av)f PI@ap#R0N>*E1]#e:< na`bLX“ 0JDWu&9/v~?s2*H}6=/ %ɦ"3ԨGf BuDLk;. s|'ج 0pB"l`Z+)xeӢi~}vވz)@2,02q;0kg;Z fG3'SQTL{e&vIвLEcr8^a?G6zXT&BISg=�0 B0%&L9 c{ @!A҄ ``ÿU@#3;2,fN ӋW:vsRHbldiHV4{( @Xa\jYd}jG<{ %=> eMg땓 m]E29.ckGaaXNfũf)9rS]1+ZA,tG&# k(L fvl+L)\PGa 6=QTdp $6LvyWP>~?w70oa /FFVٗ6*U<Qϗ;mqgab*}׋0a>N2@g*NNLw _H9TAKexa4%a}ߘrH)$ID"ؽZD_7=7ucI>TE"+G,7IG+{$o";?ӛ"1Ϡ\1^)S$>NԴG^b F+7�]!k6(Y2.1>oG�rea5$H>R*ie[bv;znW4CN@JyEo+ -2&MilǁMOW:}[{ QQOL0N DXB %h<K4úzMz,FV."!L A>+J@Y&8tyno@ $l >b5d8>}Ԋ'2N@uO#q9بjUS6S):OF@ y raX &_E#LIL 4֬M~#k܉< b" ,H )OSMceaYCDktLmup [D):�*7'B'%iBE<^E% g)؄jJ;9ֻFd; Eh}4zT%1+f CESwGo,;gFL=/钱<W/c]&ۧ|j�Z^E( ΢m^[`S3Ȅ= ahق(驨X�m GpbgFu<oAzsR-Օ;<ÊZy~Q҉ƙ&\-mqIܑR xmׁAhe 8rNt=w]-} &| }<[nW7 fuWRWŖ .[}(RiS|<D]=\}ةB.U GpRP$qHH`\:4T7G�` _ڷפ4):i")"J .�yW0 җ/޼, trzr3M 0_G[C tN|Q;X`8J/"4řI3(z<e^[&rSTvz g#̱Ñ"ۥ'A6sx$w .!Xɒ y2FTW h E}"VI=?@wh3ٽh�̳gE?3 q़>*z(6F4.*+& !"ѣ19 @ d3 gԾD FT&״>_!Qq {F,`_ OL_ϥ_n;tfUՠ !KFJ˧jlCH2w&~yJ!�.W�JFJ9YLcsWrfjӗ6g LX4͹Z)cĻCn9`@ExbDx�s t htgZZF蟀8Ja]RJI ).I&P�I"#f#a>Wڵ�\lf ye|>QUYd"U]8|a}</fp?*'zx)7>k+yV(rrKzɒ=2Ç1u½jTn:᬴sR'p*T/KYTŒgBߔ"x Mn*$TO p=9k@ @l,l? J /QKG[UmN/\5XvU|+[>r\@] $R/c]Nj QEp`fYA'�ja<6+Ʈocƭ U, K( &h:#(wU�%">*r�KylI!iؖ\_s4LNxɍάh[&3:I�a* 0[ |ҨABDO+g{v;Ql9 IJS͆`�uhJ’Նb8:}YWdoulA�rdWb5wWV_pVW XdґR?Lm)CZďyg$tux)OAr:dV^ g(XRҰ-R'T4ц\iǟXx%6y!diϰ18GsV3?oȻa(/:@b ŗ1`(}ֲsb=0oZE{۝|Vy03X9j_)�sy~viBesG)oe =ssA#TI !s2nn9Iy^]Zd=]z$}3+2ۈ]"Ɠ+k@ `*:%[{N#{8)[rҳG*ߙvE54*=̆[[N*<E0ȥ4!CRcwlٝ^/�];0 ňs ^�#'=D'N1 qV !2MDn__fk Tþp4c06R(XJ74lrCL627s V&nͮ=ѳF3 P8Á> W?k4o0SV -12JE#j Xg,Tº<3GHӏ.3WTzatM.[Ł0lYK0xž$ ;]H.@k̇�] 0 t`>$@Gk?/Ikg g>ˈ~]EpoWbpdAui,=/MlzJS tEAd=""2 19ak *!`D:lf,>T1GFc6 : 70#+ZD8d-hMO?x2!fY{BտLgZP|z |Uu#D٣RҐ*mW�'Jr\<7�]0 Q( 蘀)-2%Cc%t.DZ-)/A;6lrрg5'']^Q$D gcnj}*oxH;ū<,K&kg}7cd1{~,_eO(دN;-EZ$cYŞaG|Àm I&dJ1dRj!.r&$|/s|szR.؄C=0Ke6PhƠ'!w_58S$':E1st}a B;c V`h)bKq]:p"qȎ[YvjݏYf̳$=kX)MެH,4u[~%srЈU{W˦퐺0I+$,+zy{#%w{|`�[3Ɛi%+nx"2i:hM @VJuGX`%i/3H4P!a >5ZSr{4tA1}5Ii,_K";OA4>Pw80 LG>03&�2&NQ DBU!MrGr}1eYa\wvqd6̞9OYW{D5J/qfRK߬nRo'W])8*Y*8N.(q9on]ʳ6 kWdԥP5U<QƧO1nX*Q 382|<7p8\T5m_! 4*@(A!\G d#1n8%&071c;aaV 5�%{0 rď�>>]M  z$t?R&obDO|(�y#vR X׃Z@& 6Z0psH,gfu@|g@/TC#Z(/80zN!ۜ4 LaW .$?ZIO\guЂO@wM[ 1`q sn(<[V*sa);T?LئFDs/#-ȇaڅȆ5OEp#Q?\�@�a t T@KAܱ=ŽD.q ?-?}5c4+iA(]i@aH?lv͊4t XnC;$,p@7KUlj{;wpv4iRh;q /I'3k݌z -D@@&ʷG5(BjyhΜNʢҜa@tr~ YhEJn6 $#EUJ?8JH(^}?5k+8uЯΒk% Z"�]0 sF`؅-x cp&X#m'G>IDqDnq 33+9XtA f-to.c w=7r4-j9kNz+HGCIx$=HrqEoxI=EԊKZu JiF(~Hi(j_r:SEZ񰝩 VƱw|B:z@:J[G*I^C>!{<Dd^,1koȻv#aj$1 p 0Kd&`J*#'ɉRqI8J5C+kL˂9w>.{ӒOrFrnj1pPsޜ\OBwqSK^QB >s,L8hFf+ Tgw':/ra{M$ ,`UI�5!P.)Z*o׷1ȝ'5Q`ݐ4>V\?ŭ6o mnA2kΟ�]10 4 /aeGB06 x;?`gbd&>@-T0!*U(Nj_ KGMRs$M~s2C1.Eُ˘}(M=^zucKvGڛV>v|9M.O x׳_m7*˂H:-,dvkpBQ>Y&7M34"�54.J0K׏O,\j1 uZ j֋4z<PU1b>{eJ{5ρ A-8W݋ mbo:X"53P1 % Is|9 (~~ŀ߽y$Lej/-|(?&vY%gp >+Nq<w$d2e}r& WYTaAT;xdz-6GFaT1~lv3i�haSePX͇$Њ-֨ CH̞RTzeA9@G4Pf۳e:"`b^CH:W*NB9jldcz\HIEdw=�5@CǿܒpEPElUr-`%H>ne>v(�[@]& e-;G4k$_zkmH :, +r=%`oͨݳJO; z>Oۦ!u`02/w ]e:D0—ZGI;/`o* 7[xXEib2 s+t >y9LÏZ@Tț �gv20Zѳ۫ؿ @vv|X5c@�@CG/ı+�\ !K5�La 3ȁ$:tjQj}O9c~G6$PSa"~(SrNfG-89hPˀvяv/@ [\3S&HK؆*B@:ڗQ0E"^Sq tEZҐn@Z+DzA|h UY=뫴4o`,G3E [ zhGEY9b[�4T8ȀmE$#j2C0>#@%`+Ax1@k$`%#8i+J{]r vG�<_^;stQ#p-;0w1 9?vBeEgqMcjFt-ms!5-`1BVdvV@A„{$FX9 *@P8 0yąe C9!® 6L:={!\`Cag̓@̇,2'@oGfVaq;2,*X:5p" xd��>G.G.8t ,GBpaeo u0Xh H1*a~6/F QpCeB IpH]?7юT};Ia״B,z-a%٥Ѝj~IV3A+j"Nć,e 2$�)j [x'j˫E;nUrZ%7&o "ZXc3@0RF J"D -]`u4,@2AMbi4Ej/t4/s VbrˇP _0BfXm†l\�#M4y#_,ht #J^�aqD+f'- w4s ?1zآ ڮ "C`>m3=KP }HA>` �aZ9Kۧ"Ō1{xǀ.h993B%jg͋H^+:a,nvA`a@q &3DhfD\ 1k�VpwAkDpOYP�z*,)&<9%DhCZC{#e�4\ |\l?ZKdgN}+zsB@k0gr }BjT!bPF{5}"]ZY7O!N6`-K�i~ϬHFÊ'$3g�=ps?lh O瑋~b)3B!ﰞa/)*-Qcహ(֤!f!Hσ Vb/!2B8lk,c abBK�p %M?κSn#C @ 59aqĀ=b@� 1_⒃ #xJ;@AG S8ց_.5~�Y{!<nB[Di=@>lP�Z־cF+hyX>ubdޑcdY 6F*a711X x*ek@eO>x'J;g@ LOܔa7E<,`eWǐPt$ڏ5+ ͺ@[9 r ́!oE=@{F@�uo(>0*&Fx&X%݋SKZ)/G((j;Lȣds!M7b3Pm"r /eM@A#9-EN#�PlKpfY'h7,S`�`a ,Z KN]h?Z@C]5ݲ3L6c3! 1^LB2Ƚc4,:r[�4ᏂQ0 1(l;j ,AsC{݈qd]=HZc! H{B GSaQ? +�Q@5�,e%#|3bt)І5H;pQF<NoD*;#|ƙsM#�h? F(&0OCo]tdVBG(Y|]SG)## 9|o)@|� F Q0 F�Ub@: ?P;#$d1 G"vm(d2tXRaO`� F'mG(TGy g@7WB7sl/@̪{W] u�l?|2R}>t�@�`�FfeȜpAl‡&`ECT#(k푶@%jzy�-G(T3yO89 P c&`4b:�v"GYHG�Q@1n?i*;={<ƏybB)RC �h? F(x q%[baxv  z ?`@EnciZK,#�*Q0 FUj_tfHMa0@o_ފ>ƀ|C*W~:Š�4ZQ0 3>e@) ro Ϣ^.AїOJBb2@6o1 Q?|=j)[t//�Q@5�lr|#DyX Zy8p3u1ݶw3v2"] ,rk= �@(j`Bs`&,F l,rqpkrRc8ԀXw/@6U7W H8 끅Q��4ZQ0  \!fa As�gawe@� gW*ТTi_5Zc�=Q@uPvLX q^(Ȏ,hg@rw0s*� 1l+Ew0�Q@P~ :g�BVVR5_rM7^ueʘ1gP/D\�)o6X ]=8@�`lYЋt |Ն/+_):,y`둚K ߡ�-G(`��`�h`�h`�h`�h`�h`�h`�h`�pwm &uHb10 "7'~gx|9u~>}~$Rۥ]'c<N7O0T 5MÎ߱qk$m =o;m =3Od! ,5cN\,ǹPc.,.Ͻv. f* RQ9 SIu(p!JRƫ~G9`lx_jgәm~liw>kxyYkZz62 6 CY#d?^fLe8\F`Ẇ[y_dA }7o/ػAa%xeli?ɱ#;\y4> Ye©Poly%(cE3'!Opnǁ6*VWKSr\8dbuܫ=9=~' v�`NiHą*+çï6mv¨r^25ı38vu墜N94;,j4"d0i᷊֭C'})FQ?�Cj[Gε铖r,S� WBڡr U4e|iF}sn7MH_&##Us}V+_Wu5 ݼ0ֽ}G�n�kCਓ]UKgFkuyn$O\%#uD\'I%JpX'w97uoswkxݚ[%| {G։DUjuk8#�9V�;9@uG3rY:1П[sPdD NK(ڡNR֩0&�EUC)U]]5nm OZWZީh)bHY [JLL([v!q3@6P!FDWO./4�W8!ہM_<K;Ĥ\�[!/|-yr܀-챥%R�𹟁pFqi{�ܚ � C{桂^ۢWQ旂(90q$'mOdEػĤ:{պӽ:NXawbIoZ�?!XM"�e }��0Ti'$MtĿy/ ]n`"TݦDt'B}p#H#B_o6eT4>@E9\q:e @��Owjc;tSkJ=|&ՇaT\$Dy<_ܞ&2\cR[O>xԫoZ]ruq q0IYbbyEJo1� _Jӷu$fv$3I)a}7E u **s"D>7@G;hO|G$:qkG֝ӽ*HߵOؽQ`q��AN&iK\dBD)W 3aHnIɘc%! ")= \]+36u׶b.AL% C+}vߋ؁jbK$ pXձY=3BծA++-tk ?8ӹN�)+'=?$(a3?JnZ^Hئ$Sc!KhrQR\_'_|ӌ#-][�r`_?:<ҡ݊ 37 Pshu0ܝ�V}(~ ӹuW2`=qjm4 6%�<N rZq; g4\cgAO{$�1@!C]H[ .` Z[xS*vvP7ݓ0)'_!X:L2"$M"avm0lDxT%Tmuu 7�1�@םY!:1+l{CI\ɔDT%_[jtĚK %⩈4截{@"볳nf;&R R]>: 1{҃@=01-4bZ2/)Wr3 L/:PKT@NwАB)&U^yj\`s WEGߐ LR[\~MzÜP^*60"[ �rI�O]A}F4"΋$K7)$t5(2;Mb;AU씲]C&>pyԷuqq]1Su6vNeN` �1 � k'A%.: Vl/L2f6 IwjmobH t=QLc/]d 6U)Kj̣[UVӉlu4g_:_lBjK�rZ# lRR tR]myא*srL?E"?}KlsE*&uqC4bLi CCNܓwo{Sdr_iH,_9atO8-=-j0A'|nٴoQ=+SoeJigg {kMx^=^ 4Sot6n3.Ԩ. �5X| K�`u7C2F@1Ǘ $} cK#o褙LQQa;�A܈ m'1Q4h2s$3[8cfvfM|[6#�9�ڵixlm?_:TLS 2d.\*bsXRt~i5/<-Mj i58$Ѷ|ؚGQj')!�b=d(`� ? F(� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 F(!� F Q0 F(!� �V0,$iaX _..b>ik1rNEo穴F'oG~VgOx^Wduuu2]>>٪3-yib<6g-�wg@AjB&60MPs|הRW>';S@A|ZSzN)@uECui .W͎ .Tt).#QQ[(.*j μ8BwBpŸb&~i[� -IsmL y }EВe#@7w[Sx|r}ۿ,-�*C;sh|hnkM͗Vȧi9d| Q>qgqq� Az[4 e5'Fn,F,Dj؀BS #3 S3NS[bɷ#,NwC}yGS?8nb;q 'qF>9cbgKVZKMAt1`wTSk.GzT{*/$|QIFi;Q_Wftwvunb"bۄBͼ՞^KJO�re�t@tKb5ע׿t;t]> \E;Ap1<vsqd$8GuVҳDtU *_`k<%T :ڸ Y +. ~n@qͰ3|+F�Au 50d`qf"B.xQNH$T$c[M2>pKη&3@^Rwՙ2nu q��Az[{E A|yA)I)$O L{�SqOeIv!vgD9tIN [91"4Ǧhd;[[.)� [C̯6 *Tj@]<mZx6[ȩᦙ5@U΁ 0p(\ 8]ۻĒ,rkwk /�a\aH\mЉie^5sDA4\ϜK4# MSKTOÉ�Ki={b)4�s-mv}r6ަԘ</t @~�� :Av(}o`lcuHDl�~BPwݞxns;'c<Pܚۊ*')gرp&.c1aU2n{_{+H�Au`:tKV^~-" ~ǿ8Q JiɄۧ v6n^HJ#߹)+p6vM*is'ٯMPGjIESiuY|ӗ8o8� ۩Re=dH�rR, -d5Guy*RU#SELgw$Sу1E޳U. {s#jR}tS"!d ](]W� $`j#htWNyRdmph6M"MBy%UYbZԶ)-#sŤ)!ԈP]՚JqO ^S`%jz"&S R).Zk* tsI-@$BojœRx1+\qF(j(#!"DUJ7|I(J!ǁF� zoBalB5=V5.>63mҏ |]ktw[jRl.u!'ˌh\0@.EGL/ gx81l> X?cS!QC <d9TyD�1waQ0ҡ2r~`_:O$@PCxz d U=GjDn5nݳ66CGrhrw#ܢSNsq!"ݐF-5=Zï�0v&rSG?[NǚtNFdHq+3&o4%*0qo#)5Typݯˤ$uO a!Io6D㻙 zxN'{F(`��4ЧeQ0 F(�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F�Q0 F� zVN5@?)f"RiaPM.Oˀ,|\lri%9z釥Ef`6jZF�(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@(`�@:NQ0 F(�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#� `Q0 ��h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#�h? F(#��Dp]����IENDB`�����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/floppybuddy.gif������������������������������������������0000644�0001750�0001750�00000012140�11701304107�021471� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89aP�F�����  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~�ぁ��=v{! NETSCAPE2.0�! ��,����L�>�� H*\ȰÇ#JHŋ3jȱǏ CIdA�(S\rɅ�NjI̗ cJϞ@H� 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gN�AȚkhq8S)5Hgf>�$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#�! ��,����L�>�� H*\ȰÇ#JHŋ3jȱǏ CIdA�(S\rɅ�NjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P �vX(Dːյj7)֩VU{n*4YR{5*ʹ ,�hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(�ǁd`]&L%Db'\~ rуxvڌ�Ԉҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T�!This GIF file was assembled by CDavis with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. �! ��,����L�>�� H*\ȰÇ#JHŋ3jȱǏ CIdA�(S\rɅ�NjI̗ cJϞ@H� 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gN�AȚkhq8S)5Hgf>�$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#�! ��,����L�>�� H*\ȰÇ#JHŋ3jȱǏ CIdA�(S\rɅ�NjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P �vX(Dːյj7)֩VU{n*4YR{5*ʹ ,�hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(�ǁd`]&L%Db'\~ rуxvڌ�Ԉҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T�!This space for rent...�! ��,����L�>�� H*\ȰÇ#JHŋ3jȱǏ CIdA�(S\rɅ�NjI̗ cJϞ@H� 2hJ2rD)@*0.O[vDٕ@Xsjj׶l6$٫w5mW)9-͢{,ҁEgu8 5|bSCJ%x3|Cf ۸Icqhq}vmBN-8(U/gys_9qٵ^?9yï>d|p_M6~ϕv(ބ`.} W!*I؅І9gN�AȚkhq8S)5Hgf>�$JBHL:mh:QIe!I6 $0JY$dHX'umAh긑*9|jB昉aрx&be1aJYziviJ:*A*=ҫꚔ,Bk$KO9Ūl}<WL%*QMi.W~HS•;Rvն;m_2xn~).kn2zk0 .9,o[.fw#�! ��,����L�>�� H*\ȰÇ#JHŋ3jȱǏ CIdA�(S\rɅ�NjI̗ cJϞ@&΃EE4eSF@TL}Z 4TIb͚P �vX(Dːյj7)֩VU{n*4YR{5*ʹ ,�hq |PJ|]x'ФsWZ_Sޙ'[}u[[E%č_O|9sϥ.PassSWo8yguh` w%V"h rY]ɗփvN(�ǁd`]&L%Db'\~ rуxvڌ�Ԉҍ&x!AjFd("6DP8%JUqE[V``)eH_qy&[kx'QG)"}y~`1Uh!;)ZބNNf꒤v*iI+¤ҨhꥄVkj*t뎵*+Od!U_Dlv5`u]6k؎4-MfҷyfbnWJ5Ӣc$K~n 7G,T�!This GIF file was assembled with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set�;��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/printing.rb����������������������������������������������0000644�0001750�0001750�00000007226�11701304107�020631� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2008 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. =begin = Printing Gtk::PrintOperation offers a simple API to support printing in a cross-platform way. =end require 'common' module Demo class Printing < BasicWindow Data = Struct.new(:font_size, :lines_per_page, :lines, :n_pages) HEADER_HEIGHT = 10 * 72 / 25.4 HEADER_GAP = 3 * 72 / 25.4 def initialize super('Printing') button = Gtk::Button.new("Print...") button.signal_connect("clicked") do begin run_print_operation rescue dialog = Gtk::MessageDialog.new(self, :destroy_with_parent, :error, :close, $!.message) dialog.signal_connect("response") do dialog.destroy true end dialog.show end true end add(button) end private def run_print_operation operation = Gtk::PrintOperation.new data = Data.new data.font_size = 12.0 operation.signal_connect("begin-print") do |_operation, context| on_begin_print(_operation, context, data) end operation.signal_connect("draw-page") do |_operation, context, page_number| on_draw_page(_operation, context, page_number, data) end operation.signal_connect("end-print") do |_operation, context| on_end_print(_operation, context, data) end operation.use_full_page = false operation.unit = :points operation.run(:print_dialog, self) end def on_begin_print(operation, context, data) height = context.height - HEADER_HEIGHT - HEADER_GAP data.lines_per_page = (height / data.font_size).floor data.lines = File.readlines(__FILE__) data.n_pages = (data.lines.size - 1) / data.lines_per_page + 1 operation.set_n_pages(data.n_pages) end def on_draw_page(operation, context, page_number, data) cr = context.cairo_context draw_header(cr, operation, context, page_number, data) draw_body(cr, operation, context, page_number, data) end def draw_header(cr, operation, context, page_number, data) width = context.width cr.rectangle(0, 0, width, HEADER_HEIGHT) cr.set_source_rgb(0.8, 0.8, 0.8) cr.fill_preserve cr.set_source_rgb(0, 0, 0) cr.line_width = 1 cr.stroke layout = context.create_pango_layout layout.font_description = "sans 14" layout.text = File.basename(__FILE__) text_width, text_height = layout.pixel_size if (text_width > width) layout.width = width layout.ellipsize = :start text_width, text_height = layout.pixel_size end y = (HEADER_HEIGHT - text_height) / 2 cr.move_to((width - text_width) / 2, y) cr.show_pango_layout(layout) layout.text = "#{page_number + 1}/#{data.n_pages}" layout.width = -1 text_width, text_height = layout.pixel_size cr.move_to(width - text_width - 4, y) cr.show_pango_layout(layout) end def draw_body(cr, operation, context, page_number, data) layout = context.create_pango_layout description = Pango::FontDescription.new("monosapce") description.size = data.font_size * Pango::SCALE layout.font_description = description cr.move_to(0, HEADER_HEIGHT + HEADER_GAP) start_line = page_number * data.lines_per_page data.lines[start_line, data.lines_per_page].each do |line| layout.text = line cr.show_pango_layout(layout) cr.rel_move_to(0, data.font_size) end end def on_end_print(operation, context, data) end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-gimp.png�������������������������������������������0000644�0001750�0001750�00000006522�11701304107�021215� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�1_�� IDATxYk]u>{9w޶gllc#<l 6!U$}j#Q鿤CUßHi$-@m9²9af<߹s=g?V}qK$"5[;}k}k>ǯ_Qܹu7up,+ k, !]?w @u ܴry=>ّ/$~IDhxm~Gȱ=fR.w'{ˡC"_"#acv*KDv ܂VK6Wztl0[; . 9<ckGn΍lR;y介~ &/xԙ ~w:$\":An(EFW~#AcR)ĭ4�\�OKs{&R@*=tӪW|B$BDp-xgp7zK~RH �ѢrW\OBy񟟞Ǔ4++ݟ<w �?d�ͣ6w㈽RiGJ 4?z3 �k�%ItŲ5+e*{ϲ_8lIpx~E75#;}w!$rK*d� � 0;K3@_[=f?,wu4]T.&+DUt鏮7-_I TRi怡Y,&/V}aYk ydЎBD)@PPt"h"V έ|`ǝ*ǴցTZ!n=~+ �i%eNf):6"{oy/Y&׵Z VLJ�L2Sҳ̊\wwW_d00ɍ5C)4X'~Α)/�|*+h0C7熆wF⸭]ρ0 84PRBq[[w78Ji)װ)1a6H)a03ac`6Fhc'HLlw/�ڝ7mWv>~xWQ,Z`olRZ2-v hJC g@ 0`O\�!8 �3v3X 0zE_s]^fvy\o<ЦMz^0o-[~ c8ȤDIdR!,j9ic��_[6#)�fݼaÆm޼!!Dqbb?=ȶKF|/b``�{ޏ5kǐJǖ-[ƪP*VR1Z[Jz3WpdTMdldS*wx===m۶GǽfIo&q<?ժxWh~~vi^{m?8رcꫯBJVR R*( h֒Ʊ='�20�I.gN;HCyQyBvr''=Z vڅF3'`Fm<3={e&$A;IIJ({f0$GV (�mb� 0V:@rhrrB,_ѣGP,šs@>q߃a֭\SOhnRf}uՙ0l�#٩T*�-u�M08O*ܝ=== fFehZ(J(9ϝ93'0n~i(��RJT 8{}Π^  &VfX &fgseג3|߇Ð(Bp hPڇo}+ex~ԅSHJkZm IښU@Bf�Ü_Lkqaya!mU'mhـ=`6`f,? Vl$j ApY)rԇs1ro}c}ɞi4˲waE{{zz0 Q.GbCZITPy>=erJkLL]TIq3|fnqTux+ֺZT (ðJa I\C�YV AAlIHc뚶p�2z y5@4<5}nב˦pM?qx^R{dyZIΜG&SHrk@+ĄnNF sqnb}3VZZkRv;[�P!`i��f�[`f9;;{xHISiFJ* CiTJ0;W<.^Z@d-(B�/Stz@n/5̘jg<9덎]` ۼqL |,H6ՆBT,T*7BO="Sgr0}SK0H3zjSU^<oO^tif "" ;Bl)JS^k1"JarrQP `<yAW*Bjyos)BsEv+?3gΨ4M;qw8#G$K!.==c�30V <g88IfzՌ[֦#JIUqunM=FI=zٳgZ922^z%@ދt (@?`0�@ yV$Όx ܹ^xA)֗_~a OkkBc}"x����"0�z�Jό2ʲad|hTڲ^jT*e `xx}ޑbZcsF .*$3]ߋ-zLV5^T:? tJKς�.vtN�喈իWyCD#eu*QeW<ȮaAv_l ɥJ6nkjHE"B7uߙjlc%uM\"ukLZ UדdwV2u:i6n:|:8VD;'1}EB0ǬtE۝(>uWu~NLW̧0iOR����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-image-pattern.rb�����������������������������������0000644�0001750�0001750�00000002000�11701304107�022610� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-image-pattern.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Image Pattern This demo shows how to use GDK and cairo to use image pattern. From http://cairographics.org/samples/imagepattern.html. =end require 'common' module Demo class CairoImagePattern < CairoWindow def initialize super('cairo image pattern') end def draw(cr) image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") pattern = Cairo::SurfacePattern.new(image) pattern.set_extend(Cairo::EXTEND_REPEAT) cr.translate(0.5, 0.5) cr.rotate(Math::PI / 4) cr.scale(1 / Math.sqrt(2), 1 / Math.sqrt(2)) cr.translate(-0.5, -0.5) matrix = Cairo::Matrix.scale(image.width * 5, image.height * 5) pattern.set_matrix(matrix) cr.set_source(pattern) cr.rectangle(0, 0, 1.0, 1.0) cr.fill end end end ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/builder.rb�����������������������������������������������0000644�0001750�0001750�00000002213�11701304107�020414� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2008 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # =begin = Interface Builder Demonstrates an interface loaded from a XML description. =end require 'common' module Demo class Dialog < Demo::BasicWindow def initialize super('Interface Builder') available = Gtk.check_version?(2, 12, 0) if available label = Gtk::Label.new("Build an interface from XML description.") else label = Gtk::Label.new("You need GTK+ >= 2.12.0 to run this demo.") end add(label) return unless available @builder = Gtk::Builder.new filename = File.join(File.dirname(__FILE__), "demo.ui") @builder << filename @builder.connect_signals {|name| method(name)} @window = @builder["window1"] @window.show_all signal_connect("destroy") do @window.destroy unless @window.destroyed? end end private def quit_activate @window.destroy destroy unless destroyed? end def about_activate dialog = @builder["aboutdialog1"] dialog.run dialog.hide end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-foot.png�������������������������������������������0000644�0001750�0001750�00000005544�11701304107�021233� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���/���0���#���gAMA�1_�� IDATxYkly=wfvvfܗ)QŪl#HqdmT i4N A(n� ] l<8v*#%RDY$MJ>?2T ,T\0s _e/ׇ o>Н:qj^ڷo߉mXpd WMjo1W[?kll,cСT*5:6M$eW2o�b x3}3}xgPUjI3&c�+wM& rտ%v{v$+Q):ښNƘU�OdΑ/R7ODzHKR"xDb!zKAHiY�0 RedLU(fyQݵr]] Cj6ѪU!J-a�>奂�Jz|q 琈E0ym{A=J|7xx#luS6}Wz6#gޘ%r[%-Mi|Zov,e |YQp"�z}_wԪ_hUvyc ѦY|)B&_; q�իtMb\^cϏ& G�}F+�8nu;hdhp6Zbe�w7%5 3 3j`*-n�xw�-�8ph$Rwmcg.#\ٚmd몂g Kdj,J(*}k_z�~'H^sk#-dz7vq5_VONKF8%5*'Qc]Xi�o<GGV4Pyz[l}єNjƽ$O?)#" �::Bͪ?OK iTADZ*pz0 m[6V 1YQ O|mKO_g^Ԇ|6<J{[󇦮AWU Z[-吞_ R\|B,/%+&S)?5Jia~dk?#-ȭ:YLC^%zRO$`42e� <33=ͭ[}؍??-eu=O#+m+-,Ǒp]ӐH_w '59ᇾwCW*m#רْ<4485<<|<l +U`DQpG] D2Jŕ<$Y2�6axpu'-Xc?pw, rŹ46 <,0 n+V*yzxoG|gN<{+jJ.,ha@T"&14,An4Xdu/1y~yq �m37)ة'bQ0i DD\B *519;AUrjmJ y< �i7 <koL`@7D!([N4(-C[1s<5;yc0Q�Gɻ|� Gz뵪NETy g3P@=?u)K- =u$ ڨM u]3 bRs(t9JJ:/2�giжGiımPRoy� ?I@znAnURtNN(R6 ԛONm�`~u_߇wzq׶Tn5`A` ?eA6<�Zqe!(ԗ[bz&*R]�Y[ö-Z."[(a>iٟĥûo岹#vD�P0Ƕ`Yoo<W'o-_nLAYAPi�͘K˯F M%M,ˢ+"~y^=3,ўAOVuV_\w>zVYT?/l$,D!�M%c-V0̟lV+T%drL\�0y?mlВ'FGL%4D2IEM MF>Oy3׳ݽ}X|wo_o,l bi��uS/#[(=948Ǡ`zz{a[aYGPIg,# Hu^-Cm�]X_;+{>VWU mX0, ϣ4C<ЪW`Y"Fni|e̤Pk� $>\|r=N"6  C�JYǒb!ǶZ@MC#\V˫V)c=vjn̻ [5 VIa[xAqD1׶ XYZ�d2gr[�AWfD/Wk3GiZeyx'�eBD1D8%kkeL%OO<^-Fޜ$ 1-;єdhF$EmS'eQ]Ӊm0M,g2x8v,~7|/jf0ֽ%ю^0l8$-I (J=j;.XaZbMo;MC| -Q8<< <e^N}g8E�D ~|F=q}??vnhA7"tW|/? C󽽞߯* 樕F����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/images.rb������������������������������������������������0000644�0001750�0001750�00000012610�11701304107�020235� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: images.rb,v 1.5 2006/04/08 12:30:03 mutoh Exp $ =begin = Images Gtk::Image is used to display an image; the image can be in a number of formats. Typically, you load an image into a Gdk::Pixbuf, then display the pixbuf. This demo code shows some of the more obscure cases, in the simple case a call to Gtk::Image.new is all you need. If you want to put image data in your program as a String variable, use the make-inline-pixbuf program that comes with GTK+. This way you won't need to depend on loading external files, your application binary can be self-contained. =end require 'common' module Demo class Images < BasicWindow def initialize @pixbuf_loader = nil @load_timeout = 0 @image_stream = nil super('Images') signal_connect('destroy') do cleanup_callback end self.border_width = 8 vbox = Gtk::VBox.new(false, 8) vbox.border_width = 8 add(vbox) label = Gtk::Label.new label.set_markup('<u>Image loaded from a file</u>') vbox.pack_start(label, false, false, 0) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN # The alignment keeps the frame from growing when users resize # the window align = Gtk::Alignment.new(0.5, 0.5, 0, 0) align.add(frame) vbox.pack_start(align, false, false, 0) # demo_find_file looks in the the current directory first, # so you can run gtk-demo without installing GTK, then looks # in the location where the file is installed. pixbuf = nil begin filename = Demo.find_file('gtk-logo-rgb.gif') pixbuf = Gdk::Pixbuf.new(filename) rescue # This code shows off error handling. You can just use # Gtk::Image.new instead if you don't want to report # errors to the user. If the file doesn't load when using # Gtk::Image.new, a 'missing image' icon will # be displayed instead. dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::ERROR, Gtk::MessageDialog::BUTTONS_CLOSE, "Unable to open image file 'gtk-logo-rgb.gif': #{$1}") dialog.signal_connect('response') do |widget, data| widget.destroy end dialog.show end image = Gtk::Image.new(pixbuf) frame.add(image) # Animation label = Gtk::Label.new label.set_markup('<u>Animation loaded from a file</u>') vbox.pack_start(label, false, false, 0) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN # The alignment keeps the frame from growing when users resize # the window align = Gtk::Alignment.new(0.5, 0.5, 0, 0) align.add(frame) vbox.pack_start(align, false, false, 0) filename = Demo.find_file('floppybuddy.gif') image = Gtk::Image.new(filename) frame.add(image) # Progressive label = Gtk::Label.new label.set_markup('<u>Progressive image loading</u>') vbox.pack_start(label, false, false, 0) frame = Gtk::Frame.new(nil) frame.shadow_type = Gtk::SHADOW_IN # The alignment keeps the frame from growing when users resize # the window align = Gtk::Alignment.new(0.5, 0.5, 0, 0) align.add(frame) vbox.pack_start(align, false, false, 0) # Create an empty image for now; the progressive loader # will create the pixbuf and fill it in. image = Gtk::Image.new frame.add(image) start_progressive_loading(image) # Sensitivity control button = Gtk::ToggleButton.new('_Insensitive', true) vbox.pack_start(button, false, false, 0) button.signal_connect('toggled') do |widget| vbox.children.each do |widget| if widget != button widget.sensitive = ! button.active? end end end end def start_progressive_loading(image) @load_timeout = Gtk.timeout_add(150) do progressive_timeout(image) end end def progressive_timeout(image) if @image_stream buf = @image_stream.read(256) @pixbuf_loader.write(buf) if @image_stream.eof? @image_stream.close @image_stream = nil @pixbuf_loader.close @pixbuf_loader = nil end else filename = Demo.find_file('alphatest.png') @image_stream = File.open(filename, 'rb') if @pixbuf_loader != nil @pixbuf_loader.close @pixbuf_loader = nil end @pixbuf_loader = Gdk::PixbufLoader.new @pixbuf_loader.signal_connect('area_prepared') do |loader| pixbuf = loader.pixbuf # Avoid displaying random memory contents, since the pixbuf # isn't filled in yet. pixbuf.fill!(0xaaaaaaff) image.pixbuf = pixbuf end @pixbuf_loader.signal_connect('area_updated') do # We know the pixbuf inside the Gtk::Image has changed, but the image # itself doesn't know this; so queue a redraw. If we wanted to be # really efficient, we could use a drawing area or something # instead of a Gtk::Image, so we could control the exact position of # the pixbuf on the display, then we could queue a draw for only # the updated area of the image. image.queue_draw end end # leave timeout installed return true end def cleanup_callback @pixbuf_loader.close if @pixbuf_loader @pixbuf_loader = nil if @load_timeout != 0 Gtk.timeout_remove(@load_timeout) end end end end ������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-calendar.png���������������������������������������0000644�0001750�0001750�00000005303�11701304107�022026� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�1_�� zIDATx]lWwvvwNvc7֤}B"TDAVT臢ҨQ Ayh)BB R>ѠTb'󹉿];wwfa7N*Du5;wN;Nnn�0;x}?&Ex @twRJ"T!@QW @ a H_(yJ6'C""a$ BuZ BiM* *=ܪD;Ϗw�eBB E*es8N2H)A6/O^ZJ)[?J%#/hl34*aH(ω|>*c76 $2'\O6.8y}B1aᅊmsu'X �aHB|rןP(J(^)RԑR�DJNDΗ^ac_kG-VVW6�l �|#bhm!ne~ye9FhfA^G#7)rp$^<|] QJ"py2 KV^o $ʈ� C;Qؐ{Iȥnc2}8ڭ;�rk � �LdGui 8ƃ@ "�Z!&7ֽ@^xO,k*)-l ]o[fMCz8@oܸ K;7ę v(d6LJx�h-`�Oˌ]5MdU`PHw@1c; 9D5#M@.}@<GY8uO=ؠӢ $aϣ*eV]cqu)PC!*P7ˁhѱy-^ẅ́%?zU?b(_+N[FV#puq]J\Nòe}7z@?PJ53䍮rۇ;wFYwmr2",BnƺZLdE;5[mb$VFrfD3<ù9v؉m۸!Sˋt)J2  ssKI 3"6OXJk9 qleݺ} Y` c}IdH*\++!4Pfňhfjs36u2hɱ\mHX{/-iD#J$̰RY T[0`H& d2ܗ1.:+TP\/ȢKL{r)�2x�g7=@.gYܕN{Rmݕ!`<+�͛BJ7<8-M1wѼ<ҋı?ίӧI KIO:ʥK,MN2[pQXdfP(Ɉt21>7vg):?yyF+C ? lSKl =˓R)/fYZ)JgDeYZXbbGF@o84ށX5e!J:OS)N)<DB KsIjb3uknHL-mۨ:=S׹z*Rܽ|`=t*Eya,C  �!Z opݘhoT8xv}nH%mݿ=yW{KDbm&#�T]8X[7ˁ뢠Fkc;$N(jA7@.kF)`6If^r 'J0x]<G 3W˞={rXV˧ ho6dZHI)7H ĔW5LzYGG>w3ccdYv 180H+Mm֢@QNtR|'C^_Cgzt%eTkÐZ25;5эIXخh&BrĻt[jEZjc'ak*ͮa1yKTu]T%onl(r  ~ضrC�4d'Ƅ:o!:zGcXd&zI} !ҩh+-G7 I4[=`ŵ $Mce_ܿ'F{1>7wccۀ^k1.Z\10ŁNVd�f9v)c|t=< 3ccL̔1E94y0nz�z=Du:3<Q$" SW4;jfy1*QXc34vۉ@j1/Eƣ`ǀX_9\)ە+J3.333Mݼ7M!$hb/}R_&'Oͺ2]tjKvqNl|"DLرdl/eG2&&M֌1A[zNmɹ2F�jm«+�Wq3m<􇊽ItLy\0T[śdK]_ht[^ oƍQaPH͎71Xy L2[||šh[^? Ğ����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-gmush.png������������������������������������������0000644�0001750�0001750�00000006254�11701304107�021406� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�1_�� cIDATx[$YNU{{qlbK"1R2QL B ͑xKH<8h`@/+lǻk{޹LwOwuu9UU }|O/}O ĭh(.]X}[W; <_^qƜȄX02#Lcŕ+kzk\Gw}?Ǔp2&N1iFuvIuvr;\{ |鯭4ӉQXd֐KRg5֊VCFϾ'CLXpzWGɬa0걺&=Y*_K+ǎ羓c̘I(c9\{k-)vGC$h 88K__xWWgW't-" <yDKf-&K1YF"R{BٌXŀڃz斾 oE c-ibL6CzRJY `a4M '!;8OJZ6ՠh<&M#sl~ c>.XLvb+Ng0Ƣ2Eeh8kqIz]T2Gd6%"@nY>| `oFX^=vxƚek-ΝEj @f22kU|a�s <5d$Z-~@RcF޴,:ۼ|GzrTfIZ!|: 8p 91a@Jߗx�+6][=Ӧj>pOn_" bc3?ϛukO!DQkuffZlnl> RiΟybҌԦh2 Gl.hxW^wMDŽ " C(Bk &;;=]u4 ֮T*:œqfKssdWw>?v۝}tZ$nR*?x {!koƯ-?ܳ{rHNSGvIRa8  ~#&qL$R0ers7h$NXťuV$J&WrX._M9<|ߗ~K)58ILb,Zn#ʼn�i$ J}y`1j s*qȷomR)v{sp/oH?[~qX!RJj*RqOiA)d2A)E$ycZs 9GZ%X\gqao.κ<=stؗŷD>Rz{�D)>t|cDQDE$IB) jlr!.-h68r mh6:O|=|?k8VۯGkY$ Ks$Ii2 DQD(A0;3#8~|޲Gfnрtww|LN\B<[?~+? q;h6xO|| \),T*cPJ!GUG @NI!:>rC t]qB̀f3'�G'~~OwָcJBeH)B0L}BCkspFYufm_]^!t�uG/4GK9RT*8Bnׅ!ֲHE0Dx<RzD⯟},BxX~+~u<P3� n?z['uO'M(2Ԟ˲ c Z^V?Y,F/\UU=˜J)%iN.$2sŠdg4b}y@<\]'ڼ2|-Ȁ�7Eh>2c}U/dxkR1뽑V@D¿)i>ed!0 ihQJM H)WIFfIoZGn&js\*x-'FkHd$v>iRΎ1fZE'2zkܠ9Ph-'PX,0Okb–IL&&;|7W 9rUˣ_ρmw#$I SZk8- $sV2[�/H)d$J8<gYyFAeq)t>1Sŗ <.diZOZ_rљ#Ϝ9R 9HӔ4M}cJGQV[l4K`MI&|^B�»x<J)M|Pumsn:i.ݻ],`�_40(]DkMXkL&qp8LkN^J/]4E:Qɀ|衇YgRrhŋiPHqovP~OaFž^fBt=4hNmv~[oY}Ef]oW^ybV*I(vQZz`0ts98_ ΋ tC �Т_$gyfKJy[eN-իWqh4N{^_l $D&ͭ(?N-SOZCZm�aHe4 իW˯n(ƥ\aiKk̀WD4- 0 ,NXU\_\ﯔXLe]GqJk@q^xVNb.?o^j2hgT=q~-*I,$&q!Do^-/y*ˁ-e@$"EyO ʖ8ɣ\M}ٟJJ!P�H B*zg@<++|~_/+ݟ[Rв4=}5{eRҺ.]7Rm)Ź $ݒv����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/drawingarea.rb�������������������������������������������0000644�0001750�0001750�00000015217�11701304107�021262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: drawingarea.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Drawing Area Gtk::DrawingArea is a blank area where you can draw custom displays of various kinds. This demo has two drawing areas. The checkerboard area shows how you can just draw something; all you have to do is write a signal handler for expose_event, as shown here. The 'scribble' area is a bit more advanced, and shows how to handle events such as button presses and mouse motion. Click the mouse and drag in the scribble area to draw squiggles. Resize the window to clear the area. =end require 'common' module Demo class DrawingArea < BasicWindow def initialize # Pixmap for scribble area, to store current scribbles @pixmap = nil super('Drawing Area') self.border_width = 8 vbox = Gtk::VBox.new(false, 8) vbox.border_width = 8 add(vbox) ## Create the checkerboard area label = Gtk::Label.new label.set_markup('<u>Checkerboard pattern</u>') vbox.pack_start(label, false, false, 0) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN vbox.pack_start(frame, true, true, 0) da = Gtk::DrawingArea.new # set a minimum size da.set_size_request(100, 100) frame.add(da) da.signal_connect('expose_event') do |widget, event| checkerboard_expose(widget) end ## Create the scribble area label = Gtk::Label.new label.set_markup('<u>Scribble area</u>') vbox.pack_start(label, false, false, 0) frame = Gtk::Frame.new frame.shadow_type = Gtk::SHADOW_IN vbox.pack_start(frame, true, true, 0) da = Gtk::DrawingArea.new # set a minimum size da.set_size_request(100, 100) frame.add(da) # Signals used to handle backing pixmap da.signal_connect('expose_event') do |*args| scribble_expose_event(*args) end da.signal_connect('configure_event') do |widget, event| scribble_configure_event(widget) end # Event signals da.signal_connect('motion_notify_event') do |*args| scribble_motion_notify_event(*args) end da.signal_connect('button_press_event') do |*args| scribble_button_press_event(*args) end # Ask to receive events the drawing area doesn't normally # subscribe to da.events |= (Gdk::Event::LEAVE_NOTIFY_MASK | Gdk::Event::BUTTON_PRESS_MASK | Gdk::Event::POINTER_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK) end # Create a new pixmap of the appropriate size to store our scribbles def scribble_configure_event(widget) @pixmap = Gdk::Pixmap.new(self.window, widget.allocation.width, widget.allocation.height, -1) # Initialize the pixmap to white @pixmap.draw_rectangle(widget.style.white_gc, true, 0, 0, widget.allocation.width, widget.allocation.height) # We've handled the configure event, no need for further processing. return true end CHECK_SIZE = 10 SPACING = 2 def checkerboard_expose(da) # At the start of an expose handler, a clip region of event.area # is set on the window, and event.area has been cleared to the # widget's background color. The docs for # gdk_window_begin_paint_region give more details on how this # works. # It would be a bit more efficient to keep these # GC's around instead of recreating on each expose, but # this is the lazy/slow way. gc1 = Gdk::GC.new(da.window) gc1.rgb_fg_color = Gdk::Color.new(30000, 0, 30000) gc2 = Gdk::GC.new(da.window) gc2.rgb_fg_color = Gdk::Color.new(65535, 65535, 65535) xcount = 0 SPACING.step(da.allocation.width, CHECK_SIZE + SPACING) do |i| ycount = xcount % 2; # start with even/odd depending on row SPACING.step(da.allocation.height, CHECK_SIZE + SPACING) do |j| gc = if ycount % 2 == 1 gc1 else gc2 end # If we're outside event.area, this will do nothing. # It might be mildly more efficient if we handled # the clipping ourselves, but again we're feeling lazy. da.window.draw_rectangle(gc, true, i, j, CHECK_SIZE, CHECK_SIZE) ycount += 1 end xcount += 1 end # return true because we've handled this event, so no # further processing is required. # return true end # Redraw the screen from the pixmap def scribble_expose_event(widget, event) # We use the 'foreground GC' for the widget since it already exists, # but honestly any GC would work. The only thing to worry about # is whether the GC has an inappropriate clip region set. widget.window.draw_drawable(widget.style.fg_gc(widget.state), @pixmap, # Only copy the area that was exposed. event.area.x, event.area.y, event.area.x, event.area.y, event.area.width, event.area.height) return false end def draw_brush(widget, x, y) update_rect = Gdk::Rectangle.new(x - 3, y - 3, 6, 6) # Paint to the pixmap, where we store our state @pixmap.draw_rectangle(widget.style.black_gc, true, update_rect.x, update_rect.y, update_rect.width, update_rect.height) # Now invalidate the affected region of the drawing area. widget.window.invalidate(update_rect, false) end def scribble_button_press_event(widget, event) unless @pixmap # paranoia check, in case we haven't gotten a configure event return false end if event.button == 1 draw_brush(widget, event.x, event.y) end # We've handled the event, stop processing return true end def scribble_motion_notify_event(widget, event) unless @pixmap # paranoia check, in case we haven't gotten a configure event return false end # This call is very important; it requests the next motion event. # If you don't call Gdk::Window#pointer you'll only get # a single motion event. The reason is that we specified # Gdk::POINTER_MOTION_HINT_MASK to Gtk::Widget#set_events. # If we hadn't specified that, we could just use event.x, event.y # as the pointer location. But we'd also get deluged in events. # By requesting the next event as we handle the current one, # we avoid getting a huge number of events faster than we # can cope. win, x, y, state = event.window.pointer if (state & Gdk::Window::BUTTON1_MASK) != 0 draw_brush(widget, x, y) end # We've handled it, stop processing return true end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/menus.rb�������������������������������������������������0000644�0001750�0001750�00000011211�11701304107�020113� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: menus.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $ =begin = Menus There are several widgets involved in displaying menus. The Gtk::MenuBar widget is a horizontal menu bar, which normally appears at the top of an application. The Gtk::Menu widget is the actual menu that pops up. Both Gtk::MenuBar and Gtk::Menu are subclasses of Gtk::MenuShell; a Gtk::MenuShell contains menu items (Gtk::MenuItem). Each menu item contains text and/or images and can be selected by the user. There are several kinds of menu item, including plain Gtk::MenuItem, Gtk::CheckMenuItem which can be checked/unchecked, Gtk::RadioMenuItem which is a check menu item that's in a mutually exclusive group, Gtk::SeparatorMenuItem which is a separator bar, Gtk::TearoffMenuItem which allows a Gtk::Menu to be torn off, and Gtk::ImageMenuItem which can place a Gtk::Image or other widget next to the menu text. A Gtk::MenuItem can have a submenu, which is simply a Gtk::Menu to pop up when the menu item is selected. Typically, all menu items in a menu bar have submenus. The Gtk::OptionMenu widget is a button that pops up a Gtk::Menu when clicked. It's used inside dialogs and such. Gtk::ItemFactory provides a higher-level interface for creating menu bars and menus; while you can construct menus manually, most people don't do that. There's a separate demo for Gtk::ItemFactory. =end require 'common' module Demo class Menus < BasicWindow def initialize super('menus') self.border_width = 0 accel_group = Gtk::AccelGroup.new add_accel_group(accel_group) box1 = Gtk::VBox.new(false, 0) add(box1) menubar = Gtk::MenuBar.new box1.pack_start(menubar, false, true, 0) menu = create_menu(2, true) menuitem = Gtk::MenuItem.new("test\nline2") menuitem.submenu = menu menubar.append(menuitem) menuitem.show menuitem = Gtk::MenuItem.new('foo') menuitem.submenu = create_menu(3, true) menubar.append(menuitem) menuitem.show menuitem = Gtk::MenuItem.new('bar') menuitem.submenu = create_menu(4, true) menuitem.right_justified = true menubar.append(menuitem) menuitem.show box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, true, true, 0) box2.show menu = create_menu(1, false) # menu.accel_group = accel_group menuitem = Gtk::SeparatorMenuItem.new menu.append(menuitem) menuitem.show menuitem = Gtk::CheckMenuItem.new('Accelerate Me') menu.append(menuitem) menuitem.show menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F1, 0, Gtk::ACCEL_VISIBLE) menuitem = Gtk::CheckMenuItem.new('Accelerator Locked') menu.append(menuitem) menuitem.show menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F2, 0, Gtk::ACCEL_VISIBLE | Gtk::ACCEL_LOCKED) menuitem = Gtk::CheckMenuItem.new('Accelerators Frozen') menu.append(menuitem) menuitem.show menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F2, 0, Gtk::ACCEL_VISIBLE) menuitem.add_accelerator('activate', accel_group, Gdk::Keyval::GDK_F3, 0, Gtk::ACCEL_VISIBLE) optionmenu = Gtk::OptionMenu.new optionmenu.menu = menu optionmenu.history = 3 box2.pack_start(optionmenu, true, true, 0) optionmenu.show separator = Gtk::HSeparator.new box1.pack_start(separator, false, true, 0) separator.show box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) box2.show button = Gtk::Button.new('close') button.signal_connect('clicked') do quit end box2.pack_start(button, true, true, 0) button.flags = Gtk::Widget::CAN_DEFAULT button.grab_default button.show end def create_menu (depth, tearoff) if depth < 1 return nil end menu = Gtk::Menu.new group = nil if tearoff menuitem = Gtk::TearoffMenuItem.new menu.append(menuitem) menuitem.show end 5.times do |i| buf = sprintf('item %2d - %d', depth, i + 1) menuitem = Gtk::RadioMenuItem.new(buf) group = menuitem.group menu.append(menuitem) menuitem.show if i == 3 menuitem.sensitive = false end if submenu = create_menu(depth - 1, true) menuitem.submenu = submenu end end menu.show return menu end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/apple-red.png��������������������������������������������0000644�0001750�0001750�00000006731�11701304107�021031� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�� a�� IDATx[]Wyk9s8 N)JڄڨB>pE WK R@@@BqS+8v3sk}>31^|֞9e{^tvy_Tz߇} r޽cksM?p<p+E>*ܾ֏ W]vfgvw>yv!'+_dLom]aD֭G7L#ͯ굿>tbލW-,.{�>E,&+֬h /ڳ{^>߄z;?/ ;po}U.tKGŇf6)o]EZ91|}~ W--7C4 ;%씍ozۍ! g|aNgnMo,VKU!@0G|׶nڱk5pJog&;W5B8tpao;[6:�׽O\ 2R wͮr|Ο=ZEB|[aղ,ꭿw~x VmB)Fhcݷ}\In}GSefc"vԪg/-3j"`wogpr>Aqow;7O ̄ & AXA۰ض8pS9pMNwnmჃja~n,v?s{v}7ُOP v4!tTUMOh[( 0 :4uȢ(;'yn9?Scbጙ!|'/͛7+Wu_իNH)D^'jFĪBĐ,h.%49 0ofH_ CSv&/ʁnzhɖtJ?ܽ�^q6]^~ӣ&5)G1!@2 ĺۖzf r\饊6?7=_ޓwַ/;w'W7y'^jc wzCDqbO1H!޴a f曖cP26,dhRЀص0hO~ί{r/VOMVl^}5#�ey_\3*1D7*Jx*4+Dƨ$",X^SxAJpǏvpǏ8Gݍ׮YmeM޲zr\ǎ1?L NɈq X4L Iz!u$Dw!P!X(3J⺫~w>*;o; fLթѦO{ A?MtzU:z47"qsHNDS@8ɜn5A75e<3atH` _ v:,~J;I`U"* af#Pp wD0US"Vka`9zT5^W/8Ognl?�P2⠥Qs8;A T"J9%3^]vݫ )%@_jBxɘ9w'fT(0 -/lpaAAi#aEN0NKm7]E;tz`@~$Zɘ`xD^1CQƱoN@pu,@z%jS6:ઔEk)e  "`h "TFPv,GbrJ>5ZS TP'4Q�uGlb*-+18ʨ>L Uǣ",*V1�,E, *U;Ή@&D "Ǐљ&}a5\ )"JF0U3 sh БB+isa+  J)-M:&Xɸ "y4âd-TrD@�#Ȱ(q@S<ܶwŧULЛYE*J.D B#%Cdb`#j0#qZUT)h}7kCPK V�fZaoI@PB iA ֩#  F Q>JdŽP1IP"XTlXE"ia<FoyF ж} 󐾴g$HFAQW\%SPpCU bQ2-PXj %D OXpma<[{ K/E꺦rB[9FE2�gT(>"Z@<hsaЎgyhCL_) LMttzb|[{v0Fԕ*A"E" 'U(G3.ElPSZsD %;١B1rch&3Ԅ%$D9FbwƓ9<g쵸^aPuXd &dWY5CIK!k_R2m$*F ,BiI)1=zO~ 2D^g%�pk.630-Q BGQr0Â-*cZA*mCiZv;`dH= K1TޕiMG d7 MiQ-i("݀̒9Z"&̠1({[]� +�++lHѽ/noRm6R bN[Z)֕A%< " 13 2ptPرЉQ2\1yFGϭN]rtw<#oZ7S7vQ"RȪB.ք֜R mLVF6ѴhFUY?y0gt`|8B7.<e@`xB 3SLMdҨV#KA4#1%zi F)Z*{ ӈ@8%땏=}xNJuS]DlIiAQBFHl*8U(({y`S lgtϰx�x)^ \l\;=ӛzi' y�f&梵?e[ӫЌ<Q_t{2ZfW0Z..^\ pnp`sE.F|QcGNXtr!c"kdYyo�V^jW1ʥ(VV1Z">63{;ydb vXs<2N80qY?fza\!9zTr;O�97c2~ie8]щblE˜ |\����IENDB`���������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-clip-rectangle.rb����������������������������������0000644�0001750�0001750�00000001423�11701304107�022754� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-clip-rectangle.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Clip Rectangle This demo shows how to use GDK and cairo to clip as rectangle. From http://cairographics.org/samples/xxx_clip_rectangle.html. =end require 'common' module Demo class CairoClipRectangle < CairoWindow def initialize super('cairo clip rectangle') end def draw(cr) cr.new_path cr.move_to(0.25, 0.25) cr.line_to(0.25, 0.75) cr.line_to(0.75, 0.75) cr.line_to(0.75, 0.25) cr.line_to(0.25, 0.25) cr.close_path cr.clip cr.move_to(0, 0) cr.line_to(1, 1) cr.stroke end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/ruby-gnome2-logo.png�������������������������������������0000644�0001750�0001750�00000016040�11701304107�022256� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���P���P������bKGD������ pHYs�� �� ~���tIME (1��IDATxwXT׾{f 0�)6@XcIbTSǣѓ)7on<&1ĘfII`b%XPБiLS PL<뙙WoW?Sԟ?Z/m\, 9|Y))vX]@dDFQ#Kr /w^ƺeIvI �" ��ʃdm}ϛ)]T}lMIɓ6}c|qc&%9]p(՝;*/w'ys…'2U�˲2y7fJٗbxa` ?eM4RWq??uҕ"G$2E}͙Z J.jirW0}+j5r8dd,a ]OGY5Ĩ x8%es320yz�*UDIqqbv]+M@b<M}q@QNRiӓ :\�(:G}+VEuni0vzH$p5yj D�6|�s#U2Aܬ7@1 8.'N`ڵQ%Ĩ}HG|>0+k H~aV+\VkZ�]c�6s-3׭GxL  8%HQ4-�̞q4fOhJJg'4RGeetJ�00@]#�f/:cȈ eᬨi8bYBX"t�pߪg 0R&@*W[QU9κ:pZ-t<`_�w[<K_ˋ__NZl;!(ITHyy V+ l/X��N'(aX]#LݢO6q�P,\nlrT*Q<Z�9m ݕ�yaϯm>?q Pa xc"'OoؠP6}`GX[ V W]\ՠNw�p�p* zw82 �fp�N. g1NE,MLX?l(.z9<57e\T*۱#vhhɘQTpr`*>  bфL;a @N+&vPPj4"<k/.�>:ŽOVcb}|!Dp W^I �.�!P6xh?��,�BBdуR4}/!TZAj`o�p]-XxGHRFrtRBe'N-ʸ^faxaX-D qJ,N\ #Gx**S�53pWz}=)o[ !4{ALx�q@ר�$-|X54:,NRpOx4F:,?Y p �#L ^w 4ժB!h;ajeRfЃ٠rtl}�*�rgܩL>jнuX�8"mTƨu3|;@駰xv{ ?M>wB2 ]nj��.�i|-&v� Z0Ng <�|�U#N JQD*�F,Rbvp�޶y<Գ� iؗpԷ=|Ww4nh͎ ��Bxl.i{Epw�P3ca }v�Ct�`C{hY/� y<$:rҟx`ʦw,=.oO<g-,􍠠q$&1*}o?~~1P@�~"gևD,Rp)�W�do|ɣDz;�JxKeҼB2z ë'ek0gi%.}^ZyPѫW%+n_Zt�h.5zO !uCݶ *x,_.?<oS\YB3 <G�!� c''3tѼuwmCF^kDqל1rc!(.7/\.:z3[FL7;gY?8<Bq2o�[PB|' �HACG~+V;濞%0r`;H&Tvnz;�Iow}S{Y$"{F\6Ԑ3/HE]3gr~5 Fץ99һ| R @ �@+"Aq}haJ/K߭/_e>qnjd  \N ǫ|徢~\ŝ^V+*7hu#XpV")'Bk(W~v`C~:,U7L/w|h�z"OHx-*9߳ᠴ1,_DK$`ihKJ9P� vGD�J"C9Nxsfa� (~/9@s>${rl~n1EfYە32-9;X4hW1'v0~ ج,>p�7pp#�¦N%SIQ?ӬVKcƏ;~b923|}3>s {n%Y]v͆ h`̥Q�B�ЄP HuyR��]�ULՔHtTbL >zƬQ � dNL &[Spp?ry.},۽Cdݫ6t>Ze]}LÂc'Μ@L\.s� M\PFr:Q4{vvYك-R%?+yzyjk'O 6V ]yAאړr1~CIOeVoh(11!JT a@x`ih5LU˃Y.8xض<9k-Hw&XP37@~{!z?%oC*OzDa KȌ Ď!C #@3�!B? �Kgn^ h۝0 3xo5@bbǤ7oO Tg�|cc]zQk g 1%K?>BRR@9i޵vBu mۆc\b|g֮XVgjԣ1"ޞ-Q^X,~ 4e;f5>ck4DŌQ==iWY3{\Ck5Ho ws^pT=\tjF~j_rGESX.,a{mj C˟̽~JDr 0p ZY z亓eq7q-36IiOe'N0|6l_淬?=\s(JV0 d Rx�M::m~ە+6r9ܞȠ9hV{YֆU?Lz)R{T uO,Ayt`@vv~_TCA}Y0fje2)}_?fYN$Bsl `}쎏o78.q}ѩ�.r_gqufqFlѩ٭%Ill+x]h:(k]Zg'!`aR2W_�őc_:֬uu[<x[ |4tuU>zLު�՗r}:}FQ 0�gJO 7uXv4|D"~ Z `ϩOQ,KH.}F'PڅrSr,D:xOU̞RB_X8vlZy=҃kZa5㠮A\8iGO�BS*m 17 RTf򈯳z?|.nGѶz 0O^HD' 4ju!p8@XeHoӎN5'O|~U'ѽ'Չz {[6[zbJ <H^={z;xV+eepTV¥R, Ph ´4""CA]]N9n4mڡ}>xnFHr, 6F+iX,8n-lv6Z*ubu:P*s2TNŋ |y<u^h(bi=޶j N8kk,.Ӂ(gI ))hZq d+!ɉknx!'b[@N!=/κڵM~H(�gq1\uu�uSJȩjuDGcS3zZk^rhOmqxVYbYUWM [}<T }stw@Dwh=Rx8 K Ͳt᪮n3x (E�8B]PLT|HKsDޒ΢3 _oQeGu��6:pz BZv^W605@LVe.`@�צs8Tk׃:) nk{P*NJ|k/XlÄ)-Fa phߴ , drM"P�<+VED OO} kGUXHAM5ٳ8r?=X,m,N"품𜐤čCg/z_۬zƘ[k4Cg&j횫�\GQq??Tԫ3xe9 e?k L0܇[sy;}r9ʠ9 ڑ҉.t㥵q�.ȣixMļ/wVxbBy/e'NIL*cb&3 2<w˕WN 3�1��H"Mؼ,ܹ+͋5т�8.]HѴSPCx7Eiw`7@KA yTn8/"@�V&z^v#RSpe`a7& 8z!I_ߞH_dcN}P's緼7=V 7Pk�8Pb,OmyZxC!e"$%7(<__P f 66"pvGy7@7Jy5Oeq32�oyk}>yޯ�mHdٱ>qJ?1ASZ<<<ヌɓ>/l2i4pj5|XI&A ྖe}RMC�V�#Ny|ƛ4GgXd W}%7N_~8|RMwO8p&}>3u5@5E^bHbn*JS\ BxB)muu<IeK8EiC[/�) =pL6ǢFHD])5ï'Nnz=MgN:z?ekl)-Np/++Fa@I  4TV'ESC?ޏx#HV6@J�b � 6^Q n30w||HĒN1휥ə>@^vOCz5uy|J;]GHkO8��]\ۛ?ZHTG9iUk w&rsAli�@-'5; [ ߽լaC07O z S��f�H8F_o}5m_Vu.^}a4JSXJl, '\�@`eutp7%<ܳ_ `ܧսY zn\uZ,H&K5#\,j(*p�oLqVmge-{+Y'w M8txu,p[M%o" M'້pW ?(#a_�-{w֔lyf)ZpI/ �Fm/:n{:(�PTn!mogYÈDe,1Nq4}󉊮0}:]I|{$^WI_Zjj&5ﮇz��h6rk;f!o )_} &@�qv\8gH.@�H=u}Ktu:DZjUɥOn074s8]ER\p�(( (>+ҳ@(fi=cP֦K� `@7a=^{xyB v&_[)�|aZQ2*X~ pe�~F\ �%D3 }81fi\GGf7窋 !a4DpMVnL�fU@TT8(h2֯7ӢOoV'&0$LR }JTZr:.%RJ+acz����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/tree_store.rb��������������������������������������������0000644�0001750�0001750�00000016403�11701304107�021147� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: tree_store.rb,v 1.7 2005/02/06 18:25:13 kzys Exp $ =begin = Tree View/Tree Store The Gtk::TreeStore is used to store data in tree form, to be used later on by a Gtk::TreeView to display it. This demo builds a simple Gtk::TreeStore and displays it. If you're new to the GtkTreeView widgets and associates, look into the Gtk::ListStore example first. =end require 'common' module Demo class TreeStore < BasicWindow # TreeItem structure TreeItem = Struct.new('TreeItem', :label, :alex, :havoc, :tim, :owen, :dave, :world_holiday) # shared by the European hackers # columns ( HOLIDAY_NAME_COLUMN, ALEX_COLUMN, HAVOC_COLUMN, TIM_COLUMN, OWEN_COLUMN, DAVE_COLUMN, VISIBLE_COLUMN, WORLD_COLUMN, NUM_COLUMNS, ) = *(0..9).to_a # tree data TOPLEVEL = [ ['January', [ ["New Years Day", true, true, true, true, false, true], ["Presidential Inauguration", false, true, false, true, false, false], ["Martin Luther King Jr. day", false, true, false, true, false, false], ] ], ['February', [ ["Presidents' Day", false, true, false, true, false, false], ["Groundhog Day", false, false, false, false, false, false], ["Valentine's Day", false, false, false, false, true, true], ] ], ['March', [ ["National Tree Planting Day", false, false, false, false, false, false], [ "St Patrick's Day", false, false, false, false, false, true], ] ], ['April', [ [ "April Fools' Day", false, false, false, false, false, true ], [ "Army Day", false, false, false, false, false, false ], [ "Earth Day", false, false, false, false, false, true ], [ "Administrative Professionals' Day", false, false, false, false, false, false ], ]], ['May', [ [ "Nurses' Day", false, false, false, false, false, false ], [ "National Day of Prayer", false, false, false, false, false, false ], [ "Mothers' Day", false, false, false, false, false, true ], [ "Armed Forces Day", false, false, false, false, false, false ], [ "Memorial Day", true, true, true, true, false, true ], ] ], ['June', [ [ "June Fathers' Day", false, false, false, false, false, true ], [ "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false ], [ "Flag Day", false, true, false, true, false, false ], ] ], ['July', [ [ "Parents' Day", false, false, false, false, false, true ], [ "Independence Day", false, true, false, true, false, false ], ] ], ['August', [ [ "Air Force Day", false, false, false, false, false, false ], [ "Coast Guard Day", false, false, false, false, false, false ], [ "Friendship Day", false, false, false, false, false, false ], ] ], ['September', [ [ "Grandparents' Day", false, false, false, false, false, true ], [ "Citizenship Day or Constitution Day", false, false, false, false, false, false ], [ "Labor Day", true, true, true, true, false, true ], ] ], ['October', [ [ "National Children's Day", false, false, false, false, false, false ], [ "Bosses' Day", false, false, false, false, false, false ], [ "Sweetest Day", false, false, false, false, false, false ], [ "Mother-in-Law's Day", false, false, false, false, false, false ], [ "Navy Day", false, false, false, false, false, false ], [ "Columbus Day", false, true, false, true, false, false ], [ "Halloween", false, false, false, false, false, true ], ] ], ['November', [ [ "Marine Corps Day", false, false, false, false, false, false ], [ "Veterans' Day", true, true, true, true, false, true ], [ "Thanksgiving", false, true, false, true, false, false ], ] ], ['December', [ [ 'Pearl Harbor Remembrance Day', false, false, false, false, false, false ], [ 'Christmas', true, true, true, true, false, true ], [ 'Kwanzaa', false, false, false, false, false, false ], ] ], ].collect do |month_name, holidays| [ month_name, holidays.collect do |args| TreeItem.new(args) end, ] end def initialize # create window, etc super('Card planning sheet') vbox = Gtk::VBox.new(false, 8) vbox.border_width = 8 add(vbox) vbox.pack_start(Gtk::Label.new("Jonathan's Holiday Card Planning Sheet"), false, false, 0) sw = Gtk::ScrolledWindow.new(nil, nil) sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vbox.pack_start(sw, true, true, 0) # create model model = create_model # create tree view treeview = Gtk::TreeView.new(model) treeview.rules_hint = true treeview.selection.mode = Gtk::SELECTION_MULTIPLE add_columns(treeview) sw.add(treeview) # expand all rows after the treeview widget has been realized treeview.signal_connect('realize') do treeview.expand_all end set_default_size(650, 400) end def create_model # create tree store model = Gtk::TreeStore.new(String, TrueClass, TrueClass, TrueClass, TrueClass, TrueClass, TrueClass, TrueClass) # add data to the tree store TOPLEVEL.each do |month_name, holidays| iter = model.append(nil) iter[HOLIDAY_NAME_COLUMN] = month_name (ALEX_COLUMN..DAVE_COLUMN).each do |index| iter[index] = false end # add children holidays.each do |holiday| child_iter = model.append(iter) child_iter[HOLIDAY_NAME_COLUMN] = holiday.label[0] %w(alex havoc tim owen dave).each_with_index do |person, i| child_iter[ALEX_COLUMN + i] = holiday[person] end child_iter[VISIBLE_COLUMN] = true child_iter[WORLD_COLUMN] = holiday.world_holiday end end return model end def add_columns(treeview) model = treeview.model # column for holiday names renderer = Gtk::CellRendererText.new renderer.xalign = 0.0 col_offset = treeview.insert_column(-1, 'Holiday', renderer, 'text' => HOLIDAY_NAME_COLUMN) column = treeview.get_column(col_offset - 1) column.clickable = true [ ['Alex', true ], ['Havoc', false], ['Tim', true ], ['Owen', false], ['Dave', false], ].each_with_index do |args, i| person, european = *args renderer = Gtk::CellRendererToggle.new renderer.xalign = 0.0 eval(%Q[def renderer.column; #{ALEX_COLUMN + i}; end]) renderer.signal_connect('toggled') do |cell, path| item_toggled(cell, path, model) end attributes = { 'active' => (ALEX_COLUMN + i), 'visible' => VISIBLE_COLUMN, } if european attributes['activatable'] = WORLD_COLUMN end col_offset = treeview.insert_column(-1, person, renderer, attributes) column = treeview.get_column(col_offset - 1) column.sizing = Gtk::TreeViewColumn::FIXED column.fixed_width = 50 column.clickable = true end end def item_toggled (cell, path_str, model) path = Gtk::TreePath.new(path_str) column = cell.column # get toggled iter iter = model.get_iter(path) toggle_item = iter[column] # do something with the value toggle_item ^= 1 # set new value iter[column] = toggle_item end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/dialog.rb������������������������������������������������0000644�0001750�0001750�00000007353�11701304107�020237� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: dialog.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Dialog and Message Boxes Dialog widgets are used to pop up a transient window for user feedback. =end require 'common' module Demo class Dialog < Demo::BasicWindow def initialize @count = 1 super('Dialogs') set_border_width(8) frame = Gtk::Frame.new('Dialogs') add(frame) vbox = Gtk::VBox.new(false, 8) vbox.set_border_width(8) frame.add(vbox) # Standard message dialog hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, false, 0) button = Gtk::Button.new('_Message Dialog', true) button.signal_connect('clicked') do message_dialog_clicked end hbox.pack_start(button, false, false, 0) vbox.pack_start(Gtk::HSeparator.new, false, false, 0) # Interactive dialog hbox = Gtk::HBox.new(false, 8) vbox.pack_start(hbox, false, false, 0) vbox2 = Gtk::VBox.new(false, 0) button = Gtk::Button.new('_Interactive Dialog') button.signal_connect('clicked') do interactive_dialog_clicked end hbox.pack_start(vbox2, false, false, 0) vbox2.pack_start(button, false, false, 0) table = Gtk::Table.new(2, 2, false) table.set_row_spacings(4) table.set_column_spacings(4) hbox.pack_start(table, false, false, 0) label = Gtk::Label.new('_Entry 1', true) table.attach_defaults(label, 0, 1, 0, 1) @entry1 = Gtk::Entry.new table.attach_defaults(@entry1, 1, 2, 0, 1) label.set_mnemonic_widget(@entry1) label = Gtk::Label.new('E_ntry 2', true) table.attach_defaults(label, 0, 1, 1, 2) @entry2 = Gtk::Entry.new table.attach_defaults(@entry2, 1, 2, 1, 2) label.set_mnemonic_widget(@entry2) end def message_dialog_clicked dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::MODAL | Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_OK, <<EOS) This message box has been popped up the following number of times: #{@count} EOS dialog.run dialog.destroy @count += 1 end def interactive_dialog_clicked dialog = Gtk::Dialog.new('Interactive Dialog', self, Gtk::Dialog::MODAL | Gtk::Dialog::DESTROY_WITH_PARENT, [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK], ["_Non-stock Button", Gtk::Dialog::RESPONSE_CANCEL] ) hbox = Gtk::HBox.new(false, 0) hbox.set_border_width(8) dialog.vbox.pack_start(hbox, false, false, 0) stock = Gtk::Image.new(Gtk::Stock::DIALOG_QUESTION, Gtk::IconSize::DIALOG) hbox.pack_start(stock, false, false, 0) table = Gtk::Table.new(2, 2, false) table.set_row_spacings(4) table.set_column_spacings(4) hbox.pack_start(table, true, true, 0) label = Gtk::Label.new('_Entry 1', true) table.attach_defaults(label, 0, 1, 0, 1) local_entry1 = Gtk::Entry.new local_entry1.text = @entry1.text table.attach_defaults(local_entry1, 1, 2, 0, 1) label.set_mnemonic_widget(local_entry1) label = Gtk::Label.new('E_ntry 2', true) table.attach_defaults(label, 0, 1, 1, 2) local_entry2 = Gtk::Entry.new local_entry2.text = @entry2.text table.attach_defaults(local_entry2, 1, 2, 1, 2) label.set_mnemonic_widget(local_entry2) hbox.show_all response = dialog.run if response == Gtk::Dialog::RESPONSE_OK @entry1.text = local_entry1.text @entry2.text = local_entry2.text end dialog.destroy end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/common.rb������������������������������������������������0000644�0001750�0001750�00000003725�12257552167�020311� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin common.rb - Common class for gtk-demo. Copyright (c) 2003-2005 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: common.rb,v 1.9 2005/10/15 03:41:36 mutoh Exp $ =end require 'gtk2' module Demo def self.find_file(basename) file_load_paths = [ File.dirname(__FILE__), "/usr/share/gtk-2.0/demo", "/usr/local/share/gtk-2.0/demo", ] file_load_paths.each do |dirname| path = File.join(dirname, basename) if File.exist?(path) return path end end raise "#{basename}: No such file or directory" end class BasicWindow < Gtk::Window def initialize(title = nil) super(Gtk::Window::TOPLEVEL) if title set_title("#{title} in Ruby/GTK") end signal_connect("key_press_event") do |widget, event| if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q destroy true else false end end signal_connect("delete_event") do |widget, event| quit end end def quit destroy true end end class CairoWindow < BasicWindow def initialize(title=nil) super unless Gdk.cairo_available? add_cairo_require_label return end drawing_area = Gtk::DrawingArea.new add(drawing_area) drawing_area.signal_connect("expose_event") do |widget, event| cr = widget.window.create_cairo_context cr.scale(*widget.window.size) cr.set_line_width(0.04) cr.save do cr.set_source_color(Gdk::Color.new(65535, 65535, 65535)) cr.gdk_rectangle(Gdk::Rectangle.new(0, 0, 1, 1)) cr.fill end draw(cr) end end def add_cairo_require_label message = "This sample requires GTK+ 2.8.0 or later and cairo support" add(Gtk::Label.new(message)) end def draw(cr) raise "not implemented" end end end �������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/README���������������������������������������������������0000644�0001750�0001750�00000000110�11701304107�017313� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gtk-demo for Ruby/GTK To run, do ruby main.rb in this directory. ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/editable_cells.rb����������������������������������������0000644�0001750�0001750�00000010226�11701304107�021724� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: editable_cells.rb,v 1.7 2005/02/06 18:25:13 kzys Exp $ =begin = Tree View/Editable Cells This demo demonstrates the use of editable cells in a Gtk::TreeView. If you're new to the Gtk::TreeView widgets and associates, look into the Gtk::ListStore example first. =end require 'common' module Demo class EditableCells < BasicWindow Item = Struct.new('Item', :number, :product, :editable) COLUMN_NUMBER, COLUMN_PRODUCT, COLUMN_EDITABLE, NUM_COLUMNS = *(0..4).to_a def initialize super('Shopping list') self.border_width = 5 vbox = Gtk::VBox.new(false, 5) add(vbox) vbox.pack_start(Gtk::Label.new('Shopping list (you can edit the cells!)'), false, false, 0) sw = Gtk::ScrolledWindow.new sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vbox.pack_start(sw, true, true, 0) # create model model = create_model # create tree view treeview = Gtk::TreeView.new(model) treeview.rules_hint = true treeview.selection.mode = Gtk::SELECTION_SINGLE add_columns(treeview) sw.add(treeview) # some buttons hbox = Gtk::HBox.new(true, 4) vbox.pack_start(hbox, false, false, 0) button = Gtk::Button.new('Add item') button.signal_connect('clicked') do add_item(model) end hbox.pack_start(button, true, true, 0) button = Gtk::Button.new('Remove item') button.signal_connect('clicked') do remove_item(treeview) end hbox.pack_start(button, true, true, 0) set_default_size(320, 200) end def create_model # create array @articles = [] add_items # create list store model = Gtk::ListStore.new(Integer, String, TrueClass) # add items @articles.each do |article| iter = model.append article.each_with_index do |value, index| iter.set_value(index, value) end end return model end def add_items item = Item.new(3, 'bottles of coke', true) @articles.push(item) item = Item.new(5, 'packages of noodles', true) @articles.push(item) item = Item.new(2, 'packages of chocolate chip cookies', true) @articles.push(item) item = Item.new(1, 'can vanilla ice cream', true) @articles.push(item) item = Item.new(6, 'eggs', true) @articles.push(item) end def add_columns(treeview) model = treeview.model # number column renderer = Gtk::CellRendererText.new renderer.signal_connect('edited') do |*args| cell_edited(*args.push(model)) end treeview.insert_column(-1, 'Number', renderer, { :text => COLUMN_NUMBER, :editable => COLUMN_EDITABLE, }) def renderer.column COLUMN_NUMBER end # product column renderer = Gtk::CellRendererText.new renderer.signal_connect('edited') do |*args| cell_edited(*args.push(model)) end def renderer.column COLUMN_PRODUCT end treeview.insert_column(-1, 'Product', renderer, { :text => COLUMN_PRODUCT, :editable => COLUMN_EDITABLE, }) end def cell_edited(cell, path_string, new_text, model) path = Gtk::TreePath.new(path_string) column = cell.column iter = model.get_iter(path) case column when COLUMN_NUMBER i = iter.path.indices[0] @articles[i].number = new_text.to_i iter.set_value(column, @articles[i].number) when COLUMN_PRODUCT i = iter.path.indices[0] @articles[i].product = new_text iter.set_value(column, @articles[i].product) end end def add_item(model) foo = Item.new(0, 'Description here', true) @articles.concat([foo]) iter = model.append foo.each_with_index do |value, index| iter.set_value(index, value) end end def remove_item(treeview) model = treeview.model selection = treeview.selection if iter = selection.selected @articles.delete_at(iter.path.indices[0]) model.remove(iter) end end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/entry_completion.rb��������������������������������������0000644�0001750�0001750�00000003041�11701304107�022360� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # $Id: entry_completion.rb,v 1.3 2005/02/25 17:09:24 kzys Exp $ =begin = Entry Completion (EntryCompletion) GtkEntryCompletion provides a mechanism for adding support for completion in GtkEntry. =end require 'common' module Demo class EntryCompletion < Gtk::Dialog def initialize super('GtkEntryCompletion', nil, # parent 0, [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE]) self.resizable = false signal_connect('response') do self.destroy end vbox = Gtk::VBox.new(false, 5) self.vbox.pack_start(vbox, true, true) vbox.border_width = 5 label = Gtk::Label.new label.markup = 'Completion demo, try writing <b>total</b> or <b>gnome</b> for example' vbox.pack_start(label, false, false) # Create our entry entry = Gtk::Entry.new vbox.pack_start(entry, false, false) # Create the completion object completion = Gtk::EntryCompletion.new # Assign the completion to the entry entry.completion = completion # Create a tree model and use it as the completion model completion.model = create_completion_model # Use model column 0 as the text column completion.text_column = 0 end def create_completion_model store = Gtk::ListStore.new(String) %w(GNOME total totally).each do |word| iter = store.append iter[0] = word end store end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-clip-image.rb��������������������������������������0000644�0001750�0001750�00000002315�11701304107�022073� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-clip-image.rb,v 1.2 2005/10/16 12:07:32 mutoh Exp $ =begin = cairo/Clip Image This demo shows how to use GDK and cairo to use clip for image. From http://cairographics.org/samples/clip_image.html. =end require 'common' module Demo class CairoClipImage < CairoWindow def initialize super('cairo clip image') end def draw(cr) cr.save do cr.arc(0.5, 0.5, 0.4, 0, 2 * Math::PI) cr.clip cr.new_path loader = Gdk::PixbufLoader.new File.open("background.jpg", "rb") do |f| loader.last_write(f.read) end pixbuf = loader.pixbuf cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height) cr.set_source_pixbuf(pixbuf, 0, 0) cr.paint end cr.save do cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI) cr.clip cr.new_path image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png") cr.scale(1.0 / image.width, 1.0 / image.height) cr.set_source(image, 0, 0) cr.paint end end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gtk-logo-rgb.gif�����������������������������������������0000644�0001750�0001750�00000014433�11701304107�021432� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89ak����󪫹ԏƹ/L\lux 4# "7x:Z5d Y$]'+4 ."dܻҼ-E76Z7nNdlG7]9<E$.,d `jn'$2H*XDMM7,>$7L 5(4=`-LE*48  ; &M=r2fpz$L-M>v!C %</eo{,D9MG '=WW +T,[43\,  7gOkw1UøDVr =!2kFZ&Rl #4Td\ھ؍Jm ,~($;DL&p,X%I 5'iU!):FA9GDj<HNL91>e)<9 H FE,)7 IKj)%6#&89;4P 4E&@<G[L%7)\4T**b4^d"f)G#X$*TLZ'' 9CA5?Jo3&o' <,T25<V\+}/ 9Ƴԑ|& Hעɻo6|B\Vr7WOxgt\NrOT^BZY_-1:A@$,ڒGF;<Xժ<<59 D1r4ֵ58+.(,Fd&+r+;?]z<9<\JhNTJlH24&*ƈ4,/37t"F$t*%|!4,<X "H88i'79<ҜRtXV~<]b[+ax^6LFtSj9yz^nFtnnL,����k����H*\ȰÇ#JHŋ3jȱǏ CIɓ \yR@/Y4s`f4�T D@j\YF0B .`Ƞt)I 8tD#* pku$'NH1B ,ZXubDZw#+dс,l`P 9tpD7!8`Pfj͈/LJ /l Hܸ!9zgmi843 @AlvbeEgǎ=K%!#%AhՀCoi`SpC~P�A %HWtmvCǠ|>4ޕpA YhPJ,A~(t,0C&Η"Cwa9 ۔ @5qGZpX@QH"\6eSdX:�bR\T 2AdvP0CM p% pRBYDMwlBL h6l5zP10abK%qE9JY@+,6儳G[j72YЀtVa-:#,4!*}51a "mBNh[V0vC0A TIZp&: *L(",h:1B�[?8[;B: L֭;n|pΗ$#F*`EuY >CF9BCJ7 C#(0BB�G@fCd6tuCsyNDWA[zv'%Ԡ7\]凇sS��QTa[`hR".Ye-d, BӡJAqAv`0@i,UA<@\b'^ʐcDƝQPp6" zk|U)<K)\ *ŊaI O6Sع~E�J�EMNUe-RrJӊ(!'AT6 {Zڎun7*٣ě{C.H`R%@0<�1R DMM-NCS| '4Y?`؄U&[W4B�f #\jֽY`؇(@hM\0OwK$]b!֕`!, nxC qP_z'n#XHG 7B,j !Vc 9́lbtAAn Td FFj쩠HF&m :.f |BwCt@ ,\|u@׃xD#o HFD x 4C<pƻ1!p] 4mljC別Ƃ hP26/:#DI 34p;G"q>L\A #(y B !.PB>0\&n`Cbv`->`k0A a@ @H�#!~"Y> RWۂ&Q>TzGJWX(c%-%JP xjb[R? E|@$@:\c @AVpOX�Ān~I{i"NЁ x"P#` Xo6(nK IVG7@2ˆAREp I! .X `+c,AC?qQrO~% otDAyiBڇ ^N @$$ి",C.tR$$�` d4(t&v  Եk]fv^Ć>xS#U <1`"7{N#ȠS5쌷<C!8Bm "RtHJH%E…=pSt=4`BP 1ZR+;€K4lbHt@vuAmK $119` "-� hd*[&FK $�j 4`$HafPA'ǻ$[ \R~I-<Vm%8C-q?XE @Ct a]6r"=N{ׄ8-@\Pѷxɳf6`@ҰRS9Y"D� Ԑ|sv.OK eg1@ لP<-]d ) $�@mYyL5�P�=]-hKZ3!)\ޣ)au(Ff#Z{~�ݏ7PtpX` Wއ{v 6 & U'!u R l~x /!C< sE@W4 qe  ` eGyQZ |j` ctPmPhs�fBz%X5�iUe}G @Yp @O@jC� ` v&] Mr]o` | 7Rn1i6AZyѕ6�\XbUڠܵ ~0DVR@cf _w&(>�\pA {ݐH$Ћ$KGZPP֠I$Ӈqy8hwum WЇ~�C PK VZo!A @HWl{!q` [s r|Eݵ �F ыK@o2}ѵrpq #<Ƹ t@~EAM)^o`un "ems H�` p y|pqЀ~0[$x_H~47U` 6�r `6Pr_#Wt < 3@27UtPcA}x !0U�6�``` gW `dO@2@}YRPct&j 16`|px `O ) l9j2$ mIZa0o @|~ ؚG~ p P @A $0o밓{ UplJ/ n  X.Lm~ߐQr`Y �rĠ UQq.҃)8iJ@RtًAG `6P%; ]ʀR b l�Rܠ j0mov~飊@j`H` %FAȐ _hbUwФ叛 {Xm kjtrPtʦ ڐAY`Đ lb)Z!7pqeq" Y|4Un``p`pj6 f` UC`r '�/yH[W5 O w�h*ʰ<$oq�Q"}PUTJ(FS% `ZdZ%0.Apg2 �OG`. ZlmخK6e!7 °`GW֤N:Щp.7^Xv{ZRnpl&fAp Y ͺ(d",+ 嚮ٕf_! c+ɛؓ`ЭI [m3$+~@sz]WBP!K yڀ&XVJ ^PkmW[Zi ZbG+4`>2\l!GP (+`Ep[hXWR7+["yfo 2 !g] Q D`|G^f7} 1˛ٖu> !�0h}j`km˚Z|tp%o&ЅUj au[m~ / , (V$P{`�w% Q 7`` kqC6pgxv7ً[f0ʶ f2%`)7b`Wt A$0f⢐c YY& `H7p !�`&PܲwɎP #\)`Ƥ  v WTL3[k<t.0;lv-�djQ4Rರ .rY|g @gtU` < �Hm` `Kx%`lhz+F\b^wŌ `pJ'29͟HuQŷ$PҾTm /*ѤoA*]yКߋܕ�lɜ# pJZ�/" V l`ϰOyŊ;Zw kO %ƀ/r"Lxն xͱѾApy <;e& �Gh 8]%5[A% *ӬIьV` q eu0@p]h4˭1~}HZ@ -�o@j0טo[yP%VGGl.{پP   i ` 0�`tr�%-i_jj`�R t{*� r1 ǐ͌~l&Ϛ}k) +Z\yo ؁o~"g\K� Pr i=@ bV�{\zxz5))9 -GxS"\b`H[&A@T\<biO"-r: Dj"!) )) .=r!>UP lbzˋ؈T7 Mo! ΜMǰ DMrI 7נZ^h% ;\X;�L3٬ -됡^m k6)!�F@ GE4t<YԺ(`]"� q knsN KZ`" `beW<C+eGYG�3�BR0%qj%Ɛ*c 0JRx%xv RP`@%Ux`$ھ%+0 PEtWgȈKG\0Q�kp[B5Mjl,L҆ 2@ S AQR Lu�2nA|лP9k<Bueth r�k&A\j-ES!+eK~ňWoZuu~0Cq玥  Qo`%A]b� �Or�zC_@ .<1TǏH A@Q A0�Q3sY\Dx^�<QD-^Ęq"4Jи`cHaZ88RB }hSL; 1 F)xė4EZrʀ LUƢɜQ aP8q! mʴc 7nQBM}ZLbAF <,laQŌ-kݷϨ=}@/?Nj֭]5 �;�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/item_factory.rb������������������������������������������0000644�0001750�0001750�00000005341�11701304107�021460� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: item_factory.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $ =begin = Item Factory The Gtk::ItemFactory object allows the easy creation of menus from an array of descriptions of menu items. =end require 'common' module Demo class ItemFactory < BasicWindow def initialize super('Item Factory') accel_group = Gtk::AccelGroup.new item_factory = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, '<main>', accel_group) add_accel_group(accel_group) set_border_width(0) ifactory_cb = proc do |data, widget| puts "ItemFactory: activated \"#{Gtk::ItemFactory.path_from_widget(widget)}\"" end menu_items = [ ['/_File'], ['/File/tearoff1', '<Tearoff>', nil, nil, ifactory_cb], ['/File/_New', '<Item>', '<control>N', nil, ifactory_cb], ['/File/_Open', '<Item>', '<control>O', nil, ifactory_cb], ['/File/_Save', '<Item>', '<control>S', nil, ifactory_cb], ['/File/Save _As...', '<Item>', nil, nil, ifactory_cb], ['/File/sep1', '<Separator>'], ['/File/_Quit', '<Item>', '<control>Q', nil, ifactory_cb], ['/_Preferences'], ['/_Preferences/_Color'], [ '/_Preferences/Color/_Red', '<RadioItem>', nil, nil, ifactory_cb], ['/_Preferences/Color/_Green', '/Preferences/Color/Red', nil, nil, ifactory_cb], ['/_Preferences/Color/_Blue', '/Preferences/Color/Red', nil, nil, ifactory_cb], ['/_Preferences/_Shape'], ['/_Preferences/Shape/_Square', '<RadioItem>', nil, nil, ifactory_cb], [ '/_Preferences/Shape/_Rectangle', '/Preferences/Shape/Square', nil, nil, ifactory_cb], [ '/_Preferences/Shape/_Oval', '/Preferences/Shape/Rectangle', nil, nil, ifactory_cb], [ '/_Help', '<LastBranch>'], [ '/Help/_About', '<Item>', nil, nil, ifactory_cb], ] item_factory.create_items(menu_items) item_factory.get_item('/Preferences/Shape/Oval').set_active(true) box1 = Gtk::VBox.new(false, 0) add(box1) box1.pack_start(item_factory.get_widget('<main>'), false, false, 0) label = Gtk::Label.new("Type\n<alt>\nto start") label.set_size_request(200, 200) label.set_alignment(0.5, 0.5) box1.pack_start(label, true, true, 0) separator = Gtk::HSeparator.new box1.pack_start(separator) box2 = Gtk::VBox.new(false, 10) box2.set_border_width(10) box1.pack_start(box2, false, true, 0) button = Gtk::Button.new('close') # TODO: Need signal_connect_swapped? button.signal_connect('clicked') do quit end box2.pack_start(button, true, true, 0) button.set_flags(Gtk::Widget::CAN_DEFAULT) button.grab_default end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnome-gsame.png������������������������������������������0000644�0001750�0001750�00000010247�11701304107�021354� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�1_��^IDATxYdWy[{U3ӳ3a0+f1F !HI<DDx"ED(&Q$DP 2Ǟ===յ};[֝xp{K__K?)qtmgFk7N7qzy>7x,g~S�woߟk03֫6Y,bMWr?[?;j1񪴜S|�zoY|쳷S;s%>sj\3Җ\+A {?+%�y2 P/=S .>٘cƘ2j;_ 'VF;k wN;njYo9-dG-ӿw?ӟ=B()9 4&0L.~$%KL(K�~| _ѹ|h#B4xۍKx`Fi猆F?Ikm�!qcQ%7 BY`x)uJRc�|'g8w:{S@6s:.&R0 =y;zRJß[޲t_}&[i؋.Yo</^*[@{w��\ ?j]`*sL16GU0!u['<_k?v=gڟTJ=${냷}yzj(@$iIewgv7#O?wn} /$3QHmd *�ȹM0QaIJDpS[1(=<γ3n$&q!/~mo[(J|SGij +-?̉BJv1V%Sr*�A5q*87d*#ֆ̒:5%yl�VF(J|÷1X.QMp4`hL`<h~膉jeo3 EAtTH(UFt=Tj i-֤<NGhK?ѳ}jDGZv9s7.R"h ©+ih:N!T˜+jh;Mdq[?3/ȯ0~ёjcay#N$`&4? "�INfcn'2k@VDǑ(ԩ7 2!TjHcj$0ƒ-읟\-7. al ]Bi>KU!Ejg;*sf[)y@�E ^G٠L^B6v@$9J@YJ@cp@hs;}jP `8V\Ib+~fժR9֘0r#?chEb5USб2wdЙBDEF(ՠ-4ƶu ra"nR͜>Y1U @2q{78asC^,yr\ģ'\kW!WbJCvFdIJjDS2B #l\S8IMJV@]e߳83<MYv%$O?;LRVgfwŷqJ +VEe zNaeB1:rɓtI<C&nF/c/\.<PZ0<g{.tۗ:񕑗}՜;*^[g`-HZ�h̤vcosaEW 1J2P7i4:ШiC1 $IA�IEЍ"_FF댽ӫLݜjg/>lu2mu6ZYÿvW녙th6jLLX{wNgy=;wd#lm'Y,}T[ 6NsD:bj^tG)ǟ{Mo󙝇{.[Fxt+(M AElZET'�12nF/"QlҜ02J+%Am D)C~l"oKm! dn[yǹOyԣ%!)RjV)5jK)kRJ8L]" i昭nil M3"݄"OZVc6F.[#7UPxSDq[kSkmbst!D@<ߪv:;f4ZG(9Α) /Í#$'eZbkAx>.v^ @^޶ֶMkmZ+1Ba1BITn+$:vgjT3p$(c'h3Mr&&4 HPiz6%t �N;jZkT!Xp55afvVhCE4Mb"Ռ7N:!hk3\ Jr$PF;* 6|k1L5!D0?9uY>@1nRIiĒ:6/ʉ Ɉ2ֶhQ8r\g*h^1b!D`�E`3U @=v޴V0M "I $ 2.f[ `uu{W[Bkg^ ,hkB$Z;֎$W|?Ԭ7pGj<N$$tC&{.TV^8q_:i[5iX!LZYqЏr|vajvŚ~jqS\l9ٻf VpymՋbyι< R�H&(s+; /2aM0`k}sݿ(X]p4B 6st7Ԛթ/\PFB $LXܹ|ѣ_>z}أO<,mFWu̥O]{l#3-R=И^ZI+~`6t kur>dZ֒8Ɋ3T̬\3*_;w.6?:p`f9zDgnĮKk)ԆfBXJ Zztx{n޿w5g1IT+dy&,#I0 |$[7 n[H^ѷΏN8%>Zq^sw~) !zvb(pd:H(4IyFRE IZQ=.TZpZ%^+x:򖛿!If)I>3\Gh)cTZ)cGQz@զ2rGKkkHuNIApn˅^R7a@ݡ.QuԽ];vuZ!T}jQNRT+UfXC 0&' B?LKRnsu^\yJ yv~1qFCbðpq1 !B@K)m!)W.|;}?QS 4,JV~ okwN33^zb8)q]Yx2a%b !TVTRqr)egi9#o$4Ea,Q<ׄQ\|+eƽ®z@$GIL/c&J~TN\^VmR1h!e/4OQ ]$q]_x^Dh1'{&o f@&`%4j.)!DF 4n)4ιJڻ0n^@eB'qa_|9?R5-oL Jkgѣ␰4`aaA�}l6fxӾVn_LLy^8 +)," �}MR�]gU/mCCҀ/ \Ky�lA[_/M-uǽv%Jy#�҄Dv @tpPKQq?66*y |tKRRUVen~bՊ5.emmqAI}y`=Nm+_ϾNiJg3ޤW e)q+|%Ķ;^s1a����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/pixbufs.rb�����������������������������������������������0000644�0001750�0001750�00000011356�11701304107�020456� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: pixbufs.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $ =begin = Pixbufs A Gdk::Pixbuf represents an image, normally in RGB or RGBA format. Pixbufs are normally used to load files from disk and perform image scaling. This demo is not all that educational, but looks cool. It was written by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows off how to use Gtk::DrawingArea to do a simple animation. Look at the Image demo for additional pixbuf usage examples. =end require 'common' module Demo class Pixbufs < BasicWindow FRAME_DELAY = 50 BACKGROUND_NAME = 'background.jpg' IMAGE_NAMES = [ 'apple-red.png', 'gnome-applets.png', 'gnome-calendar.png', 'gnome-foot.png', 'gnome-gmush.png', 'gnome-gimp.png', 'gnome-gsame.png', 'gnu-keys.png', 'ruby-gnome2-logo.png' ] CYCLE_LEN = 60 def initialize super('Pixbufs') set_resizable(false) @background = nil @frame = nil @frame_num = 0 @images = [] begin load_pixbufs set_size_request(@background.width, @background.height) @frame = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB, false, 8, @background.width, @background.height) @da = Gtk::DrawingArea.new @da.signal_connect('expose_event') do |w, e| expose_cb(w, e) end add(@da) timeout_id = Gtk.timeout_add(FRAME_DELAY) do timeout end signal_connect('destroy') do Gtk.timeout_remove(timeout_id) end rescue dialog = Gtk::MessageDialog.new(self, Gtk::Dialog::DESTROY_WITH_PARENT, Gtk::MessageDialog::ERROR, Gtk::MessageDialog::BUTTONS_CLOSE, "Failed to load an image: #{$!.message}") dialog.signal_connect('response') do dialog.destroy end dialog.show end end def load_pixbufs # Loads the images for the demo if @background return # already loaded earlier end # demo_find_file() looks in the the current directory first, # so you can run gtk-demo without installing GTK, then looks # in the location where the file is installed. # filename = Demo.find_file(BACKGROUND_NAME) @background = Gdk::Pixbuf.new(filename) IMAGE_NAMES.each_with_index do |basename, i| filename = Demo.find_file(basename) @images[i] = Gdk::Pixbuf.new(filename) end end def expose_cb(widget, event) rowstride = @frame.rowstride pixels = @frame.pixels pixels[0, rowstride * event.area.y + event.area.x * 3] = '' Gdk::RGB.draw_rgb_image(widget.window, widget.style.black_gc, event.area.x, event.area.y, event.area.width, event.area.height, Gdk::RGB::Dither::NORMAL, pixels, rowstride, event.area.x, event.area.y) true end # Timeout handler to regenerate the frame def timeout @background.copy_area(0, 0, @background.width, @background.height, @frame, 0, 0) f = Float(@frame_num % CYCLE_LEN) / CYCLE_LEN; xmid = @background.width / 2.0 ymid = @background.height / 2.0 radius = [xmid, ymid].min / 2.0 @images.each_with_index do |image, i| ang = 2.0 * Math::PI * Float(i) / IMAGE_NAMES.length - f * 2.0 * Math::PI r = radius + (radius / 3.0) * Math.sin(f * 2.0 * Math::PI) xpos = (xmid + r * Math.cos(ang) - image.width / 2.0 + 0.5).floor ypos = (ymid + r * Math.sin(ang) - image.height / 2.0 + 0.5).floor k = if (i & 1) == 1 Math.sin(f * 2.0 * Math::PI) else Math.cos(f * 2.0 * Math::PI) end k = [0.25, 2.0 * k * k].max r1 = Gdk::Rectangle.new(xpos, ypos, image.width * k, image.height * k) r2 = Gdk::Rectangle.new(0, 0, @background.width, @background.height) dest = r1.intersect(r2) if dest @frame.composite!(image, dest.x, dest.y, dest.width, dest.height, xpos, ypos, k, k, Gdk::Pixbuf::INTERP_NEAREST, if (i & 1) == 1 [ 127, (255 * Math.sin(f * 2.0 * Math::PI)).abs ].max else [ 127, (255 * Math.cos(f * 2.0 * Math::PI)).abs ].max end) end end @da.queue_draw @frame_num += 1 true end end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-line-cap.rb����������������������������������������0000644�0001750�0001750�00000002261�11701304107�021554� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-line-cap.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Line Cap This demo shows how to use GDK and cairo to set line cap. From http://cairographics.org/samples/set_line_cap.html. =end require 'common' module Demo class CairoLineCap < CairoWindow def initialize super('cairo line cap') end def draw(cr) cr.set_line_width(0.12) cr.set_line_cap(Cairo::LINE_CAP_BUTT) # default cr.move_to(0.25, 0.2) cr.line_to(0.25, 0.8) cr.stroke cr.set_line_cap(Cairo::LINE_CAP_ROUND) cr.move_to(0.5, 0.2) cr.line_to(0.5, 0.8) cr.stroke cr.set_line_cap(Cairo::LINE_CAP_SQUARE) cr.move_to(0.75, 0.2) cr.line_to(0.75, 0.8) cr.stroke # draw helping lines cr.set_source_rgba(1, 0.2, 0.2) cr.set_line_width(0.01) cr.move_to(0.25, 0.2) cr.line_to(0.25, 0.8) cr.move_to(0.5, 0.2) cr.line_to(0.5, 0.8) cr.move_to(0.75, 0.2) cr.line_to(0.75, 0.8) cr.stroke end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/hypertext.rb���������������������������������������������0000644�0001750�0001750�00000015056�11701304107�021033� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2003-2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: hypertext.rb,v 1.2 2005/12/01 09:27:01 ktou Exp $ =begin = Text Widget/Hypertext Usually, tags modify the appearance of text in the view, e.g. making it bold or colored or underlined. But tags are not restricted to appearance. They can also affect the behavior of mouse and key presses, as this demo shows. =end require 'common' module Demo class Hypertext < BasicWindow def initialize super('Hypertext') @hand_cursor = Gdk::Cursor.new(Gdk::Cursor::HAND2) @regular_cursor = Gdk::Cursor.new(Gdk::Cursor::XTERM) @hovering = false set_default_size(450, 450) self.border_width = 0 view = Gtk::TextView.new view.wrap_mode = Gtk::TextTag::WRAP_WORD view.signal_connect('key-press-event') do |*args| key_press_event(*args) end view.signal_connect('event-after') do |*args| event_after(*args) end view.signal_connect('motion-notify-event') do |*args| motion_notify_event(*args) end view.signal_connect('visibility-notify-event') do |*args| visibility_notify_event(*args) end buffer = view.buffer sw = Gtk::ScrolledWindow.new sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) add(sw) sw.add(view) show_page(buffer, 1) end # Inserts a piece of text into the buffer, giving it the usual # appearance of a hyperlink in a web browser: blue and underlined. # Additionally, attaches some data on the tag, to make it recognizable # as a link. def insert_link(buffer, iter, text, page) tag = buffer.create_tag(nil, { 'foreground' => 'blue', 'underline' => Pango::AttrUnderline::SINGLE, }) tag.page = page buffer.insert(iter, text, tag) print("Insert #{tag}:#{page}\n") end # Fills the buffer with text and interspersed links. In any real # hypertext app, this method would parse a file to identify the links. def show_page(buffer, page) puts buffer.text = '' iter = buffer.get_iter_at_offset(0) case page when 1 buffer.insert(iter, 'Some text ot show that simple ') insert_link(buffer, iter, 'hypertext', 3) buffer.insert(iter, ' can easily be realized with ') insert_link(buffer, iter, 'tags', 2) buffer.insert(iter, '.') when 2 buffer.insert(iter, %Q[A tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text insid the tag bold. However, the tag concept is more general than that; tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things.]) buffer.insert(iter, "\n") insert_link(buffer, iter, 'Go back', 1) when 3 tag = buffer.create_tag(nil, { 'weight' => Pango::FontDescription::WEIGHT_BOLD }) buffer.insert(iter, "hypertext:\n", tag); buffer.insert(iter, %Q[machine-readable text that is not sequential but is organized so that related items of information are connected.\n]) insert_link(buffer, iter, 'Go back', 1) end end # Looks at all tags covering the position of iter in the text view, # and if one of them is a link, follow it by showing the page identified # by the data attached to it. def follow_if_link(text_view, iter) tags = iter.tags tags.each do |tag| print("Follow #{tag}:#{tag.page}\n") if tag.page show_page(text_view.buffer, tag.page) break end end end # Links can be activated by pressing Enter. def key_press_event(text_view, event) case event.keyval when Gdk::Keyval::GDK_Return, Gdk::Keyval::GDK_KP_Enter buffer = text_view.buffer iter = buffer.get_iter_at_mark(buffer.get_mark("insert")) follow_if_link(text_view, iter) end false end # Links can also be activated by clicking. def event_after(text_view, event) unless event.kind_of?(Gdk::EventButton) and event.button == 1 return false end buffer = text_view.buffer # we shouldn't follow a link if the user has selected something range = buffer.selection_bounds if range and range[0].offset != range[1].offset return false end x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET, event.x, event.y) iter = text_view.get_iter_at_location(x, y) follow_if_link(text_view, iter) end # Looks at all tags covering the position (x, y) in the text view, # and if one of them is a link, change the cursor to the "hands" cursor # typically used by web browsers. def set_cursor_if_appropriate(text_view, x, y) buffer = text_view.buffer iter = text_view.get_iter_at_location(x, y) hovering = false tags = iter.tags tags.each do |t| if t.page hovering = true break end end if hovering != @hovering @hovering = hovering window = text_view.get_window(Gtk::TextView::WINDOW_TEXT) window.cursor = if @hovering @hand_cursor else @regular_cursor end end end # Update the cursor image if the pointer moved. def motion_notify_event(text_view, event) x, y = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET, event.x, event.y) set_cursor_if_appropriate(text_view, x, y) text_view.window.pointer false end # Also update the cursor image if the window becomes visible # (e.g. when a window covering it got iconified). def visibility_notify_event (text_view, event) window, wx, wy = text_view.window.pointer bx, by = text_view.window_to_buffer_coords(Gtk::TextView::WINDOW_WIDGET, wx, wy) set_cursor_if_appropriate(text_view, bx, by) false end end end module Gtk class TextTag attr_accessor :page end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-gradient.rb����������������������������������������0000644�0001750�0001750�00000001642�11701304107�021663� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-gradient.rb,v 1.2 2005/10/12 15:23:49 ktou Exp $ =begin = cairo/Gradient This demo shows how to use GDK and cairo to gradient. From http://cairographics.org/samples/gradient.html. =end require 'common' module Demo class CairoGradient < CairoWindow def initialize super('cairo gradient') end def draw(cr) pat = Cairo::LinearPattern.new(0.0, 0.0, 0.0, 1.0) pat.add_color_stop_rgb(1, 0, 0, 0) pat.add_color_stop_rgb(0, 1, 0, 0) cr.rectangle(0, 0, 1, 1) cr.set_source(pat) cr.fill pat = Cairo::RadialPattern.new(0.45, 0.4, 0.1, 0.4, 0.4, 0.5) pat.add_color_stop_rgba(0, 1, 1, 1, 0.8) pat.add_color_stop_rgba(1, 0, 0, 0) cr.set_source(pat) cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI) cr.fill end end end ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/cairo-text-extents.rb������������������������������������0000644�0001750�0001750�00000002151�11701304107�022536� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: cairo-text-extents.rb,v 1.1 2005/10/12 05:38:30 ktou Exp $ =begin = cairo/Text Extents This demo shows how to use GDK and cairo to show text extents. From http://cairographics.org/samples/text.html. =end require 'common' module Demo class CairoTextExtents < CairoWindow TEXT = "Ruby" def initialize super('cairo text') end def draw(cr) cr.select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL) cr.set_font_size(0.3) extents = cr.text_extents(TEXT) x = 0.1 y = 0.6 cr.move_to(x, y) cr.show_text(TEXT) # draw helping lines cr.set_source_rgba(1, 0.2, 0.2, 0.6) cr.arc(x, y, 0.05, 0, 2 * Math::PI) cr.fill cr.move_to(x, y) cr.rel_line_to(0, -extents.height) cr.rel_line_to(extents.width, 0) cr.rel_line_to(extents.x_bearing, -extents.y_bearing) cr.stroke end end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/iconview.rb����������������������������������������������0000644�0001750�0001750�00000006511�11701304107�020616� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (c) 2005 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. # # $Id: iconview.rb,v 1.7 2007/08/05 15:41:31 mutoh Exp $ =begin = Icon View (IconView) The Gtk::IconView widget is used to display and manipulate icons. It uses a Gtk::TreeModel for data storage, so the list store example might be helpful. =end $KCODE="u" require 'common' module Demo class IconView < Demo::BasicWindow COL_PATH, COL_DISPLAY_NAME, COL_IS_DIR, COL_PIXBUF = (0..3).to_a def fill_store @store.clear Dir.glob(File.join(@parent, "*")).each do |path| is_dir = FileTest.directory?(path) iter = @store.append # set COL_DISPLAY_NAME first because changing an iter will trigger the # sort function; if we set something else first, the value of # COL_DISPLAY_NAME for this row will be "nil" and the sort function will fail puts path #puts GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8") #puts File.basename(GLib.convert(GLib.filename_to_utf8(path), "Shift_JIS", "UTF-8")) # iter[COL_DISPLAY_NAME] = File.basename(GLib.filename_to_utf8(path)) iter[COL_DISPLAY_NAME] = GLib.filename_to_utf8(path) iter[COL_PATH] = path iter[COL_IS_DIR] = is_dir iter[COL_PIXBUF] = is_dir ? @folder_pixbuf : @file_pixbuf end end def initialize super('Gtk::IconView demo') @file_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-regular.png")) @folder_pixbuf = Gdk::Pixbuf.new(Demo.find_file("gnome-fs-directory.png")) @store = Gtk::ListStore.new(String, String, TrueClass, Gdk::Pixbuf) @parent = "/" @store.set_default_sort_func do |a, b| if !a[COL_IS_DIR] and b[COL_IS_DIR] 1 elsif a[COL_IS_DIR] and !b[COL_IS_DIR] -1 else a[COL_DISPLAY_NAME] <=> b[COL_DISPLAY_NAME] end end @store.set_sort_column_id(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SORT_ASCENDING) fill_store set_default_size(650, 400) set_border_width(8) vbox = Gtk::VBox.new(false, 0) add(vbox) toolbar = Gtk::Toolbar.new vbox.pack_start(toolbar, false, false, 0) up_button = Gtk::ToolButton.new(Gtk::Stock::GO_UP) up_button.important = true up_button.sensitive = false toolbar.insert(-1, up_button) up_button.signal_connect("clicked") do @parent = File.dirname(@parent) fill_store up_button.sensitive = @parent != "/" end home_button = Gtk::ToolButton.new(Gtk::Stock::HOME) home_button.important = true toolbar.insert(-1, home_button) home_button.signal_connect("clicked") do @parent = GLib.home_dir fill_store up_button.sensitive = true end sw = Gtk::ScrolledWindow.new sw.shadow_type = Gtk::SHADOW_ETCHED_IN sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vbox.pack_start(sw, true, true, 0) iconview = Gtk::IconView.new(@store) iconview.selection_mode = Gtk::SELECTION_MULTIPLE iconview.text_column = COL_DISPLAY_NAME iconview.pixbuf_column = COL_PIXBUF iconview.signal_connect("item_activated") do |iview, path| iter = @store.get_iter(path) if iter[COL_DISPLAY_NAME] @parent = iter[COL_PATH] fill_store up_button.sensitive = true end end sw.add(iconview) iconview.grab_focus end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/gtk-demo/gnu-keys.png���������������������������������������������0000644�0001750�0001750�00000007414�11701304107�020721� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W���gAMA�� a��IDATxkt]e゙[rr-M&i4IoŦC;DgPQTTguleP^Ҧ-msk~9Im}y|)̗:~yy}.qK\2C^Fd"弋Kt᪵UrL+ͷRu-Y<eo0ov׶`/pp�]dŗ\5|d%ϙnH#YmkF}߯z�C>VV^zU+W (=ݽo `L-(`Fy9&NaYV왳vmۏ:/L/zef�B01o2jy_8Pϱup H)B0qm_[ ȿV;@V(\{^fr(6 IG{x3cKս( �*H$|)T4h?]ȂeneY9kjx4Jbd+W^y%լhB L  [|aIl2F~~+&OG @Uө|A< _ 8nSOn$I1UfV^~<`wn~ t4'8͞-ZXYyށT�{߽ۿ_qǎR\RȬJ Il[8y%e^UQ5Mc_EVvϕxK"yn /﮻iK,554k>+cY=\mOw0 xmO~/P Be``}r!ʊ)- 3�blя[i%hF*$LcuTcP⒊;>u{)j0%yyB` p㉸퇿]WWWwBǁQ`rJn'7†jB4E4Lo߫4kp$/w]MP5b$q|tb嗱kҲr=elt_="GeG7tM0M'߽;~rt]G"IA4¡0hhlzFF 3:$ccc$IFc8z9zG BB&Mرc<.馛)/+W||f9pEQP <.ӿxb&8ҊoRinm&77Jj-_Ƽy9s4gΝ"JY8R"}qʦa&j`A4Mlذk\k  ԾZolDUUt]_}}RL7^L@G>2EUPu.+ZJBz{zof$6JEE% ;.' ˪g΂HC "Yz@0H__/CA=ơCعs'K,acض͑#u}ctL%Oxɼ@QQQov(G&]]]]Pe1HSPX+0LښhhlॗvHũcH.iiiq,*QUΞսGbYA�x|;w$;7p(*斪yϝxd0 x _bf/H_y_|'<9Bcǎ8y3˙;gPs &pl}G3RK v5V�>3tZ͆O~7^/f(=>.\wI àa&M/}TM#;+#?EQQ*̟;˗zΎNod*Iii2~n}.**gdh+HOjo.a 7\rY"&6>55<.<ץ-?žp7QZVi o=B:==Xu,KpUܱAR{`?wE 'OP6ן"#QtM! 12CʛKco}wc) R0u #<p'YZ]t|{E g+xt&8c;6ф@5B0LnN:Ar,M"1F*&J.x H L2e[oJY :P‘,n0_-[HL)iD?Q3z(BA8`j�ESR0!z{HI#`ɤQFBz(B$̚e5wϚ5+0!w#lsa0 [}P8Pmh ;֭?&eJDx" JUU;~;n<E =mH$kckC'm4kc VlX3aض }ΝyxZJ[9TẁiooA _S3=_m!T<W**"]@vvvQeu-+VЅH)I ]$R Z[i863 #e\b*A$ $I,4L`ptM14t= ntCÕ.RJEA7 2V=`H1<8x HtM�Vg…|u\ҙ4D|4yc4V2P* 2VvrܬvnaߧDFQq(B:]Fckm g;l^?6oLē M87k,EH/|AH븨Bœkc-Q]өYZC$>%'4 U?>D"Yy_?? ,kf:ōm[+k&�pmTTT,]=[(x3SE_8R88I*"@+_FW\=|v4 ,\W M -郵ugsrm7d mݽ횪B<r-/<!p7]t\|Oj v>P@(hB;u…5?=x'uyjS_kOYpݡ:+>6M>۾d;O5;{}#6//o<xmMӌ)||?UUUkgho#8ؙ eNq3Z\/ g_~K TϩryAT[Qeύ&e,7\d�>Y''UTTT3L'lK}ACRJ%A kBg[ԌT4hzo>JhBkVjUSÙL DUU;?vTaYvȡc=gN7=='yiT]m-mV 3Kh�qCowL&0 NCDz.L\Τ/y۽e˗rsM5.b$ Dcx}k+V.Ng{cC#4y/x'QV]ʫYZZꍌ Y{Q~WRnaswkwD"&w?K\{;$誂����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/�������������������������������������������������������������0000755�0001750�0001750�00000000000�11740310343�015671� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/button2.rb���������������������������������������������������0000644�0001750�0001750�00000001161�11701304107�017610� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/local/bin/ruby =begin button2.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: button2.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::Button sample") button1 = Gtk::Button.new("_HELLO") button2 = Gtk::Button.new("_HELLO", false) button3 = Gtk::Button.new(Gtk::Stock::QUIT) button3.signal_connect("clicked"){ Gtk.main_quit } box = Gtk::VBox.new box.add(button1) box.add(button2) box.add(button3) window.add(box).set_default_size(100,100).show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/statusicon.rb������������������������������������������������0000644�0001750�0001750�00000006044�11701304107�020414� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin status_icon.rb - Gtk::StatusIcon sample. This sample refers gtk/tests/teststatusicon.c of GTK+-2.10.x. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: statusicon.rb,v 1.1 2006/11/17 18:12:41 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 10, 0) puts "This sample requires GTK+ 2.10.0 or later" puts str exit end class StatusIconSample < Gtk::StatusIcon STATUS_INFO = 0 STATUS_QUESTION = 1 def initialize super @status = STATUS_INFO update_icon set_blinking(true) signal_connect("activate"){ icon_activated } signal_connect("popup-menu"){|w, button, activate_time| menu = Gtk::Menu.new checkmenuitem = Gtk::CheckMenuItem.new("Blink") checkmenuitem.active = blinking? checkmenuitem.signal_connect("activate"){|w| set_blinking(w.active?) } menu.append(checkmenuitem) menuitem = Gtk::MenuItem.new("Quit") menuitem.signal_connect("activate"){ set_visible(false) Gtk.main_quit } menu.append(menuitem) menu.show_all menu.popup(nil, nil, button, activate_time) } timeout_func end def update_icon if @status == STATUS_INFO set_icon_name(Gtk::Stock::DIALOG_INFO) set_tooltip("Some Information ...") else set_icon_name(Gtk::Stock::DIALOG_QUESTION) set_tooltip("Some Question ...") end end def timeout_func GLib::Timeout.add(2000) { if @status == STATUS_INFO @status = STATUS_QUESTION else @status = STATUS_INFO end update_icon true } end def icon_activated unless @dialog @dialog = Gtk::MessageDialog.new(nil, 0, Gtk::MessageDialog::QUESTION, Gtk::MessageDialog::BUTTONS_CLOSE, "You wanna test the status icon?") @dialog.window_position = Gtk::Window::POS_CENTER @dialog.signal_connect("response"){ @dialog.hide } @dialog.signal_connect("delete_event"){ @dialog.hide_on_delete } toggle = Gtk::ToggleButton.new("_Show the icon") @dialog.vbox.pack_end(toggle, true, true, 6) toggle.active = visible? toggle.signal_connect("toggled"){|w| set_visible(w.active?) } toggle = Gtk::ToggleButton.new("_Blink the icon") @dialog.vbox.pack_end(toggle, true, true, 6) toggle.active = blinking? toggle.signal_connect("toggled"){|w| set_blinking(w.active?) } toggle = Gtk::ToggleButton.new("_Change the icon") @dialog.vbox.pack_end(toggle, true, true, 6) toggle.active = (@timeout != 0) toggle.signal_connect("toggled"){ if @timeout and @timeout > 0 GLib::Source.remove(@timeout) @timeout = 0 else @timeout = timeout_func end } end @dialog.show_all @dialog.present end end StatusIconSample.new Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/print.rb�����������������������������������������������������0000644�0001750�0001750�00000015673�11701304107�017364� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin print.rb - Gtk::Print* sample Copyright (C) 2007 Mathieu Blondel This program is licenced under the same licence as Ruby-GNOME2. $Id: print.rb,v 1.1 2007/08/05 15:41:31 mutoh Exp $ =end require 'gtk2' # Values returned by a Pango::Layout or set in a Pango::Layout # are always multiple of Pango::SCALE. Those are convenience methods to # deal with that. class Pango::Layout def size_in_points self.size.collect { |v| v / Pango::SCALE } end def width_in_points self.size[0] / Pango::SCALE end def height_in_points self.size[1] / Pango::SCALE end def width_in_points=(width) self.width = width * Pango::SCALE end end class Print < Gtk::PrintOperation FONT = Pango::FontDescription.new("sans 12") FONT_SMALL = Pango::FontDescription.new("sans 8") FONT_SIZE = 12 FONT_SMALL_SIZE = 8 def initialize (parent_window, text) super() @parent_window = parent_window @text = text # with this option disabled, the origin is the the upper left corner # *taking into consideration margins* ! self.use_full_page = false self.unit = Gtk::PaperSize::UNIT_POINTS # set default paper size page_setup = Gtk::PageSetup.new paper_size = Gtk::PaperSize.new(Gtk::PaperSize.default) page_setup.paper_size_and_default_margins = paper_size self.default_page_setup = page_setup # show a progress bar self.show_progress = true # You must choose between "paginate" and "begin-print". # "begin-print" is emitted only once and "paginate" is emitted # until the block returns true. # In both cases, you must set the number of pages at the end with # Gtk::PrintOperation#n_pages= signal_connect("begin-print") do |pop, context| puts "calls begin-print" cr = context.cairo_context paragraphs = @text.split("\n") layouts = [] paragraphs.each do |para| layouts << create_layout(cr, para) end # distribute paragraph layouts among pages @page_layouts = [] curr_height = 0 n_pages = 0 layouts.each do |layout| height = layout.height_in_points if curr_height + height > real_page_height n_pages += 1 curr_height = 0 end @page_layouts[n_pages] ||= [] @page_layouts[n_pages] << layout curr_height += height end pop.n_pages = n_pages + 1 end signal_connect("draw-page") do |pop, context, page_num| puts "calls draw-page %d" % page_num cr = context.cairo_context x, y = [0,0] # this means we start at the upper left margin if @page_layouts[page_num] @page_layouts[page_num].each do |layout| cr.move_to(x,y) cr.show_pango_layout(layout) y += layout.height_in_points end total_pages = @page_layouts.length else total_pages = 1 end # page_num starts at 0 draw_footer(cr, page_num + 1, total_pages) end end def run_print_dialog res = run(ACTION_PRINT_DIALOG, @parent_window) case res when RESULT_ERROR puts "error" when RESULT_CANCEL puts "cancelled" when RESULT_APPLY puts "applied" when RESULT_IN_PROGRESS puts "in progress" end end def run_preview res = run(ACTION_PREVIEW, @parent_window) end private def page_height setup = self.default_page_setup # this takes margins into consideration, contrary to get_paper_height setup.get_page_height(Gtk::PaperSize::UNIT_POINTS) end def page_width setup = self.default_page_setup width = setup.get_page_width(Gtk::PaperSize::UNIT_POINTS) end def real_page_height page_height - footer_height end def footer_height 5 * FONT_SMALL_SIZE end def create_layout(cr, text) layout = cr.create_pango_layout layout.width_in_points = page_width layout.font_description = FONT layout.wrap = Pango::Layout::WRAP_CHAR layout.ellipsize = Pango::Layout::ELLIPSIZE_NONE layout.single_paragraph_mode = false layout.text = text layout end def draw_footer(cr, nth_page, total_page) layout = cr.create_pango_layout layout.alignment = Pango::Layout::ALIGN_RIGHT layout.font_description = FONT_SMALL layout.text = "Page %d/%d" % [nth_page, total_page] + "\n" + \ Time.now.strftime("Printed on %Y/%m/%d at %H:%M") + "\n" + \ "Powered by Ruby-GNOME2!" width, height = layout.size_in_points x, y = [page_width, page_height] x -= width y -= height cr.move_to(x, y) cr.show_pango_layout(layout) cr.rel_move_to(width, -2) cr.rel_line_to(-page_width, 0) cr.stroke end end class Window < Gtk::Window def initialize super signal_connect("delete-event") { Gtk.main_quit } set_default_size(600, 600) @textview = Gtk::TextView.new @textview.wrap_mode = Gtk::TextTag::WRAP_WORD hbox = Gtk::HBox.new page_setup_button = Gtk::Button.new page_setup_button.label = "Page setup" page_setup_button.signal_connect("clicked") do @page_setup = Print::run_page_setup_dialog(self, # parent window @page_setup) end print_preview_button = Gtk::Button.new(Gtk::Stock::PRINT_PREVIEW) print_preview_button.signal_connect("clicked") do printop = Print.new(self, @textview.buffer.text) printop.default_page_setup = @page_setup if @page_setup printop.run_preview end print_button = Gtk::Button.new(Gtk::Stock::PRINT) print_button.signal_connect("clicked") do printop = Print.new(self, @textview.buffer.text) printop.default_page_setup = @page_setup if @page_setup printop.run_print_dialog end [page_setup_button, print_preview_button, print_button].each do |b| hbox.pack_start(b, true, true) # expand, fill end scrollbar = Gtk::VScrollbar.new vbox = Gtk::VBox.new scroll = Gtk::ScrolledWindow.new.add(@textview) scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vbox.pack_start(scroll) vbox.pack_end(hbox, false, false) add(vbox) show_all end end Window.new Gtk.main ���������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/menu.rb������������������������������������������������������0000644�0001750�0001750�00000003306�11701304107�017162� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin menu.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: menu.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' def create_menu(depth) return nil if depth < 1 menu = Gtk::Menu.new group = nil submenu = nil for i in 0..4 buf = sprintf("item %2d - %d", depth, i + 1) menuitem = Gtk::RadioMenuItem.new(group, buf) group = menuitem.group menu.append(menuitem) if depth > 1 menuitem.set_submenu create_menu(depth - 1) end end menu end window = Gtk::Window.new("menus") window.signal_connect("destroy") do Gtk.main_quit end window.border_width = 0 box1 = Gtk::VBox.new(false, 0) window.add(box1) menubar = Gtk::MenuBar.new box1.pack_start(menubar, false, true, 0) menu = create_menu(2) menuitem = Gtk::MenuItem.new("test\nline2") menuitem.set_submenu(menu) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("foo") menuitem.set_submenu(create_menu(3)) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("bar") menuitem.set_submenu(create_menu(4)) menubar.append(menuitem) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, true, true, 0) optionmenu = Gtk::OptionMenu.new optionmenu.set_menu(create_menu(1)) optionmenu.set_history(4) box2.pack_start(optionmenu, true, true, 0) separator = Gtk::HSeparator.new box1.pack_start(separator, false, true, 0) box2 = Gtk::HBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked") do window.destroy end box2.pack_start(button, true, true, 0) window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/listview.rb��������������������������������������������������0000644�0001750�0001750�00000003760�11701304107�020070� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin listview.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: listview.rb,v 1.11 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::ListStore sample") window.border_width = 0 box1 = Gtk::VBox.new(false, 0) window.add(box1) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, true, true, 0) scrolled_win = Gtk::ScrolledWindow.new scrolled_win.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC) box2.pack_start(scrolled_win, true, true, 0) data = [ "hello", "world", "blah", "foo", "bar", "argh", "spencer", "is a", "wussy", "programmer" ] model = Gtk::ListStore.new(String) column = Gtk::TreeViewColumn.new("Data", Gtk::CellRendererText.new, {:text => 0}) treeview = Gtk::TreeView.new(model) treeview.append_column(column) treeview.selection.set_mode(Gtk::SELECTION_SINGLE) scrolled_win.add_with_viewport(treeview) data.each do |v| iter = model.append iter[0] = v end button = Gtk::Button.new("add") button.set_flags(Gtk::Widget::CAN_FOCUS) i = 0 button.signal_connect("clicked") do iter = model.append iter[0] = "add item #{i}" i += 1 end box2.pack_start(button, false, true, 0) button = Gtk::Button.new("remove") button.set_flags(Gtk::Widget::CAN_FOCUS) button.signal_connect("clicked") do iter = treeview.selection.selected model.remove(iter) if iter end box2.pack_start(button, false, true, 0) separator = Gtk::HSeparator.new box1.pack_start(separator, false, true, 0) separator.show box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(button, true, true, 0) button.set_flags(Gtk::Widget::CAN_DEFAULT) button.grab_default window.set_default_size(300, 300) window.show_all Gtk.main ����������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/dialog2.rb���������������������������������������������������0000644�0001750�0001750�00000002041�11701304107�017532� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin dialog2.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: dialog2.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::Dialog sample2") button = Gtk::Button.new("Create Dialog") button.signal_connect("clicked") do dialog = Gtk::Dialog.new("Gtk::Dialog Sample 2", window, Gtk::Dialog::MODAL|Gtk::Dialog::NO_SEPARATOR, [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK], [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL]) dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample 2")) dialog.set_default_size(300, 300) dialog.vbox.show_all result = dialog.run case result when Gtk::Dialog::RESPONSE_OK p "OK" when Gtk::Dialog::RESPONSE_CANCEL p "Cancel" end dialog.destroy end window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/entry.rb�����������������������������������������������������0000644�0001750�0001750�00000001132�11701304107�017352� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin entry.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: entry.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("entry") window.border_width = 0 box1 = Gtk::VBox.new(false, 10) window.add(box1) entry = Gtk::Entry.new box1.add(entry) box1.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked") do Gtk.main_quit end box1.add(button) window.show_all entry.text = "hello world" Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/uimanager2.rb������������������������������������������������0000644�0001750�0001750�00000005151�11701304107�020250� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin uimanager2.rb - Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: uimanager2.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end callback = Proc.new {|actiongroup, action| puts "`#{action.name}' is clicked. " if action.is_a? Gtk::ToggleAction puts "active? = #{action.active?}" end } callback_quit = Proc.new { p "Quit is called." Gtk.main_quit } callback_radio = Proc.new {|action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" } actions = [ ["FileMenu", nil, "_File"], ["PreferencesMenu", nil, "_Preferences"], ["ColorMenu", nil, "_Color"], ["ShapeMenu", nil, "_Shape"], ["HelpMenu", nil, "_Help"], ["New", Gtk::Stock::NEW, "_New", "<control>N", "Create a new file", callback], ["Open", Gtk::Stock::OPEN, "_Open", "<control>O", "Open a file", callback], ["Save", Gtk::Stock::SAVE, "_Save", "<control>S", "Save current file", callback], ["SaveAs", Gtk::Stock::SAVE, "Save _As...", nil, "Save to a file", callback], ["Quit", Gtk::Stock::QUIT, "_Quit", "<control>Q", "Quit", callback_quit], ["About", nil, "_About", "<control>A", "About", callback], ["Logo", "demo-gtk-logo", nil, nil, "GTK+", callback] ] toggle_actions = [ ["Bold", Gtk::Stock::BOLD, "_Bold", "<control>B", "Bold", callback, true] ] color_radio_actions = [ ["Red", nil, "_Red", "<control>R", "Blood", 0], ["Green", nil, "_Green", "<control>G", "Grass", 1], ["Blue", nil, "_Blue", "<control>B", "Sky", 2] ] shape_radio_actions = [ ["Square", nil, "_Square", "<control>S", "Square", 0], ["Rectangle", nil, "_Rectangle", "<control>R", "Rectangle", 1], ["Oval", nil, "_Oval", "<control>O", "Egg", 2] ] window = Gtk::Window.new("Gtk::UIManager sample2") window.signal_connect("destroy"){Gtk.main_quit} actiongroup = Gtk::ActionGroup.new("Actions") actiongroup.add_actions(actions) actiongroup.add_toggle_actions(toggle_actions) actiongroup.add_radio_actions(color_radio_actions, 1) do |action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" end actiongroup.add_radio_actions(shape_radio_actions, 2, callback_radio) uimanager = Gtk::UIManager.new uimanager.insert_action_group(actiongroup, 0) window.add_accel_group(uimanager.accel_group) uimanager.add_ui("./uimanager2.xml") vbox = Gtk::VBox.new vbox.pack_start(uimanager["/MenuBar"], false, false) vbox.pack_start(Gtk::Label.new("Gtk::UIManager Sample")) window.add(vbox) window.set_default_size(100, 100).show_all Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/label.rb�����������������������������������������������������0000644�0001750�0001750�00000002042�11701304107�017271� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin label.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: label.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' win = Gtk::Window.new("Gtk::Label sample") win.signal_connect("destroy"){Gtk.main_quit} label1 = Gtk::Label.new("_Not Use Mnemonic") label1.selectable = true label2 = Gtk::Label.new("_Use Mnemonic", true) label3 = Gtk::Label.new.set_markup(%Q[<markup><span size="xx-large" weight="bold" foreground="blue"><u>Ruby-GNOME2</u></span> is <span foreground="red" size="x-large"><i>cool</i></span>!</markup>], true) label4 = Gtk::Label.new.set_markup(%Q[<span foreground="#999900">_Not Use Mnemonic</span>]) label5 = Gtk::Label.new.set_markup(%Q[<span foreground="#009999">_Use Mnemonic</span>], true) box = Gtk::VBox.new box.add(label1) box.add(label2) box.add(label3) box.add(label4) box.add(label5) win.add(box).show_all # This can be called after realized only. label1.select_region(3, 8) Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/aboutdialog2.rb����������������������������������������������0000644�0001750�0001750�00000002566�11701304107�020601� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin aboutdialog2.rb - Ruby/GTK sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: aboutdialog2.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end Gtk::AboutDialog.set_email_hook {|about, link| p "email_hook" p link } Gtk::AboutDialog.set_url_hook {|about, link| p "url_hook" p link } Gtk::AboutDialog.show(nil, "artists" => ["Artist 1 <no1@foo.bar.com>", "Artist 2 <no2@foo.bar.com>"], "authors" => ["Author 1 <no1@foo.bar.com>", "Author 2 <no2@foo.bar.com>"], "comments" => "This is a sample script for Gtk::AboutDialog", "copyright" => "Copyright (C) 2005 Ruby-GNOME2 Project", "documenters" => ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"], "license" => "This program is licenced under the same licence as Ruby-GNOME2.", "logo_icon_name" => "gtk-home", "program_name" => "Gtk::AboutDialog sample", "translator_credits" => "Translator 1 <no1@foo.bar.com>\nTranslator 2 <no2@foo.bar.com>\n", "version" => "1.0.0", "website" => "http://ruby-gnome2.sourceforge.jp", "website_label" => "Ruby-GNOME2 Project Website" ) Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/aboutdialog.rb�����������������������������������������������0000644�0001750�0001750�00000002355�11701304107�020513� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin aboutdialog.rb - Ruby/GTK sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: aboutdialog.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end Gtk::AboutDialog.set_email_hook {|about, link| p "email_hook" p link } Gtk::AboutDialog.set_url_hook {|about, link| p "url_hook" p link } a = Gtk::AboutDialog.new a.artists = ["Artist 1 <no1@foo.bar.com>", "Artist 2 <no2@foo.bar.com>"] a.authors = ["Author 1 <no1@foo.bar.com>", "Author 2 <no2@foo.bar.com>"] a.comments = "This is a sample script for Gtk::AboutDialog" a.copyright = "Copyright (C) 2005 Ruby-GNOME2 Project" a.documenters = ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"] a.license = "This program is licenced under the same licence as Ruby-GNOME2." a.logo = Gdk::Pixbuf.new("gnome-logo-icon.png") a.program_name = "Gtk::AboutDialog sample" a.translator_credits = "Translator 1\nTranslator 2\n" a.version = "1.0.0" a.website = "http://ruby-gnome2.sourceforge.jp" a.website_label = "Ruby-GNOME2 Project Website" p a.run �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/itemfactory2.rb����������������������������������������������0000644�0001750�0001750�00000004554�11701304107�020634� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin itemfactory2.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. *NOTE* Gtk::ItemFactory has been deprecated. Use Gtk::UIManager instead. $Id: itemfactory2.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' puts "Deprecated. Use Gtk::UIManager instead." window = Gtk::Window.new("Gtk::ItemFactory2") window.signal_connect("destroy") do Gtk.main_quit end window.signal_connect("delete_event") do Gtk.main_quit end accelgroup = Gtk::AccelGroup.new window.add_accel_group(accelgroup) ifp = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, "<main>", accelgroup) ifp.create_item("/_Stock") ifp.create_item("/_Stock/_New", "<StockItem>", "<control>N", Gtk::Stock::NEW, 1) do |v, _| p "StockItem #{v}" end item = ifp.create_item("/_Stock/_Open", "<StockItem>", "<control>O", Gtk::Stock::OPEN, 2) do |v, _| p "StockItem #{v}" end ifp.create_item("/_Stock/_Quit", "<StockItem>", "<control>Q", Gtk::Stock::QUIT, 3) do |v, _| p "Quit" Gtk.main_quit end ifp.create_item("/_Item") ifp.create_item("/_Item/Item_1", "<Item>"){p "Item1"} ifp.create_item("/_Item/Item_2", "<Item>"){p "Item2"} ifp.create_item("/_Check") ifp.create_item("/_Check/Check_1", "<CheckItem>"){p "Check1"} ifp.create_item("/_Check/Check_2", "<CheckItem>"){p "Check2"} ifp.create_item("/_Toggle") ifp.create_item("/_Toggle/Toggle_1", "<ToggleItem>", nil, nil, 1){|v, _| p "Toggle#{v}"} ifp.create_item("/_Toggle/Toggle_2", "<ToggleItem>", nil, nil, 2){|v, _| p "Toggle#{v}"} ifp.create_item("/_Radio") ifp.create_item("/_Radio/Radio_1", "<RadioItem>", nil, nil, 1){|v, _| p "Radio#{v}"} ifp.create_item("/_Radio/Radio_2", "/Radio/Radio1", nil, nil, 2){|v, _| p "Radio#{v}"} ifp.create_item("/_Radio/Radio_3", "/Radio/Radio1", nil, nil, 3){|v, _| p "Radio#{v}"} ifp.create_item("/_Misc", "<LastBranch>") ifp.create_item("/_Misc/Tearoff", "<Tearoff>") ifp.create_item("/_Misc/Title", "<Title>") ifp.create_item("/_Misc/Seperator", "<Separator>") ifp.create_item("/_Misc/Image", "<ImageItem>", "", Gdk::Pixbuf.new("gnome-logo-icon.png")) do p "ImageItem" end ifp.get_widget("/Stock/Open").sensitive = false vbox = Gtk::VBox.new vbox.add(ifp.get_widget("<main>")) vbox.add(Gtk::Label.new("Gtk::ItemFactory sample").set_size_request(400, 200)) window.add(vbox) window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/tooltips.rb��������������������������������������������������0000644�0001750�0001750�00000015356�11701304107�020103� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin tooltips.rb - Demonstrates the new tooltip API of Gtk+ 2.12; rg2 translation from gtk/tests/testtooltips.c. Copyright (c) 2007 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: tooltips.rb,v 1.1 2007/07/10 13:17:34 ggc Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 12, 0) puts "This sample requires GTK+ 2.12.0 or later" puts str exit end def treeview_query_tooltip(treeview, keyboard_tip, x, y, tooltip) if keyboard_tip # Keyboard mode path, = treeview.cursor if not path return false end else bin_x, bin_y = treeview.convert_widget_to_bin_window_coords(x, y) # Mouse mode path, = treeview.get_path_at_pos(bin_x, bin_y) if not path return false end end data = treeview.model.get_value(treeview.model.get_iter(path), 0) tooltip.markup = "<b>Path #{path}:</b> #{data}" return true end def textview_query_tooltip(textview, keyboard_tip, x, y, tooltip, tag) if keyboard_tip iter = textview.buffer.get_iter_at_offset(textview.buffer.cursor_position) else bx, by = textview.window_to_buffer_coords(Gtk::TextView::WINDOW_TEXT, x, y) iter, = textview.get_iter_at_position(bx, by) end if iter.has_tag?(tag) tooltip.text = 'Tooltip on text tag' return true else return false end end def drawingarea_query_tooltip(keyboard_tip, x, y, tooltip, rectangles) if keyboard_tip return false end for r in rectangles if r.x < x && x < r.x + 50 && r.y < y && y < r.y + 50 tooltip.markup = r.tooltip return true end end return false end Gtk.init window = Gtk::Window.new(Gtk::Window::TOPLEVEL) window.title = 'Tooltips test' window.border_width = 10 window.signal_connect('delete-event') { Gtk.main_quit } box = Gtk::VBox.new(false, 3) window.add(box) # A check button using the tooltip-markup property button = Gtk::CheckButton.new('This one uses the tooltip-markup property') button.tooltip_text = 'Hello, I am a static tooltip.' box.pack_start(button, false, false, 0) raise if button.tooltip_text != 'Hello, I am a static tooltip.' raise if button.tooltip_markup != 'Hello, I am a static tooltip.' # A check button using the query-tooltip signal button = Gtk::CheckButton.new('I use the query-tooltip signal') button.has_tooltip = true button.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| tooltip.markup = widget.label tooltip.set_icon_from_stock(Gtk::Stock::DELETE, Gtk::IconSize::MENU) true } box.pack_start(button, false, false, 0) # A label label = Gtk::Label.new('I am just a label') label.selectable = false label.tooltip_text = 'Label & and tooltip' box.pack_start(label, false, false, 0) raise if label.tooltip_text != "Label & and tooltip" raise if label.tooltip_markup != "Label & and tooltip" # A selectable label label = Gtk::Label.new('I am a selectable label') label.selectable = true label.tooltip_markup = '<b>Another</b> Label tooltip' box.pack_start(label, false, false, 0) raise if label.tooltip_text != 'Another Label tooltip' raise if label.tooltip_markup != '<b>Another</b> Label tooltip' # Another one, with a custom tooltip window button = Gtk::CheckButton.new('This one has a custom tooltip window!') box.pack_start(button, false, false, 0) tooltip_window = Gtk::Window.new(Gtk::Window::POPUP) tooltip_button = Gtk::Label.new('blaat!') tooltip_window.add(tooltip_button) tooltip_button.show button.tooltip_window = tooltip_window button.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| widget.tooltip_window.modify_bg(Gtk::StateType::NORMAL, Gdk::Color.new(0, 65535, 0)) true } button.has_tooltip = true # An insensitive button button = Gtk::Button.new('This one is insensitive') button.sensitive = false button.tooltip_text = 'Insensitive!' box.pack_start(button, false, false, 0) # Tree view store = Gtk::TreeStore.new(String) iter = store.insert(nil, 0, ['File Manager']) iter = store.insert(nil, 0, ['Gossip']) iter = store.insert(nil, 0, ['System Settings']) iter = store.insert(nil, 0, ['The GIMP']) iter = store.insert(nil, 0, ['Terminal']) iter = store.insert(nil, 0, ['Word Processor']) treeview = Gtk::TreeView.new(store) treeview.set_size_request(200, 240) treeview.append_column(Gtk::TreeViewColumn.new('Test', Gtk::CellRendererText.new, { :text => 0 })) treeview.has_tooltip = true treeview.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| treeview_query_tooltip(widget, keyboard_tip, x, y, tooltip) } treeview.selection.signal_connect('changed') { treeview.trigger_tooltip_query } # Set a tooltip on the column column = treeview.get_column(0) column.clickable = true #column.button.tooltip_text = 'Header' .button not available box.pack_start(treeview, false, false, 2) # Text view buffer = Gtk::TextBuffer.new buffer.insert(buffer.end_iter, 'Hello, the text ') tag = buffer.create_tag('bold', { 'weight' => Pango::WEIGHT_BOLD }) buffer.insert(buffer.end_iter, 'in bold', tag) buffer.insert(buffer.end_iter, ' has a tooltip!') textview = Gtk::TextView.new(buffer) textview.set_size_request(200, 50) textview.has_tooltip = true textview.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| textview_query_tooltip(widget, keyboard_tip, x, y, tooltip, tag) } box.pack_start(textview, false, false, 2) # Drawing area if Gdk.cairo_available? Rectangle = Struct.new("Rectangle", :x, :y, :r, :g, :b, :tooltip) rectangles = [ Rectangle.new(10, 10, 0.0, 0.0, 0.9, "Blue box!"), Rectangle.new(200, 170, 1.0, 0.0, 0.0, "Red thing"), Rectangle.new(100, 50, 0.8, 0.8, 0.0, "Yellow thing") ] drawingarea = Gtk::DrawingArea.new drawingarea.set_size_request(320, 240) drawingarea.has_tooltip = true drawingarea.signal_connect('expose_event') { cr = drawingarea.window.create_cairo_context cr.rectangle(0, 0, drawingarea.allocation.width, drawingarea.allocation.height) cr.set_source_rgb(1.0, 1.0, 1.0) cr.fill rectangles.each { |r| cr.rectangle(r.x, r.y, 50, 50) cr.set_source_rgb(r.r, r.g, r.b) cr.stroke cr.rectangle(r.x, r.y, 50, 50) cr.set_source_rgba(r.r, r.g, r.b, 0.5) cr.fill } } drawingarea.signal_connect('query-tooltip') { |widget, x, y, keyboard_tip, tooltip| drawingarea_query_tooltip(keyboard_tip, x, y, tooltip, rectangles) } box.pack_start(drawingarea, false, false, 2) else warn "Part of this sample needs Cairo support. Make sure your ruby-gtk2 is compiled with Cairo support, and rcairo is installed." end window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/window.rb����������������������������������������������������0000644�0001750�0001750�00000001003�11701304107�017515� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin window.rb - Gtk::Window sample. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: window.rb,v 1.9 2006/10/21 16:58:00 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::Window sample") window.signal_connect("destroy"){Gtk.main_quit} button = Gtk::Button.new("Hello World") button.signal_connect("clicked") do puts "hello world" Gtk.main_quit end window.add(button) window.show_all Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/drawing.rb���������������������������������������������������0000644�0001750�0001750�00000003662�11701304107�017656� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin drawing.rb - Gtk::Drawing sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: drawing.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class Canvas < Gtk::DrawingArea def initialize super signal_connect("expose_event") { |w,e| expose_event(w,e) } signal_connect("configure_event") { |w, e| configure_event(w,e) } @buffer = nil @bgc = nil end def expose_event(w,e) unless @buffer.nil? rec = e.area w.window.draw_drawable(@bgc, @buffer, rec.x, rec.y, rec.x, rec.y, rec.width, rec.height) end false end def clear(b = @buffer) return if b.nil? g = b.size @bgc = self.style.bg_gc(self.state) if @bgc.nil? if (g[0] > 0 && g[1] > 0) b.draw_rectangle(@bgc, true, 0,0, g[0], g[1]) end end def configure_event(w,e) g = w.window.geometry if (g[2] > 0 && g[3] > 0) b = Gdk::Pixmap::new(w.window, g[2], g[3], -1) clear(b) if not @buffer.nil? g = @buffer.size b.draw_drawable(@bgc, @buffer, 0, 0, 0, 0, g[0], g[1]) end @buffer = b end true end end class A < Canvas def initialize super signal_connect("button_press_event") { |w,e| pressed(w,e) } set_events(Gdk::Event::BUTTON_PRESS_MASK) end def pressed(widget, ev) if not @last.nil? @buffer.draw_line(widget.style.fg_gc(widget.state), @last.x, @last.y, ev.x, ev.y) x1,x2 = if (@last.x < ev.x) then [@last.x, ev.x] else [ev.x, @last.x] end y1,y2 = if (@last.y < ev.y) then [@last.y, ev.y] else [ev.y, @last.y] end widget.queue_draw_area(x1, y1, x2 - x1 + 1, y2 - y1 + 1) end @last = nil @last = ev true end end window = Gtk::Window.new("drawing test") window.signal_connect("destroy") { Gtk.main_quit } canvas = A.new window.add(canvas) window.show_all Gtk::main ������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/radiobutton.rb�����������������������������������������������0000644�0001750�0001750�00000001771�11701304107�020554� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin radiobutton.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: radiobutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::RadioButton sample") window.signal_connect("destroy"){Gtk.main_quit} box1 = Gtk::VBox.new window.add(box1) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.add(box2) button1 = Gtk::RadioButton.new("_button1") button2 = Gtk::RadioButton.new(button1, "_button2", false) button3 = Gtk::RadioButton.new(button1, Gtk::Stock::QUIT) box2.add(button1).add(button2).add(button3) box1.add(Gtk::HSeparator.new) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.add(box2) close = Gtk::Button.new("close") close.signal_connect("clicked") do Gtk.main_quit end box2.add(close) close.can_default = true close.grab_default window.signal_connect("destroy"){Gtk.main_quit} window.show_all Gtk.main �������ruby-gnome2-all-2.2.5/gtk2/sample/misc/test.xpm�����������������������������������������������������0000644�0001750�0001750�00000003767�11701304107�017411� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 20 19 66 2", /* colors */ ".. c None", ".# c #000000", ".a c #dfdfdf", ".b c #7f7f7f", ".c c #006f6f", ".d c #00efef", ".e c #009f9f", ".f c #004040", ".g c #00bfbf", ".h c #ff0000", ".i c #ffffff", ".j c #7f0000", ".k c #007070", ".l c #00ffff", ".m c #00a0a0", ".n c #004f4f", ".o c #00cfcf", ".p c #8f8f8f", ".q c #6f6f6f", ".r c #a0a0a0", ".s c #7f7f00", ".t c #007f7f", ".u c #5f5f5f", ".v c #707070", ".w c #00f0f0", ".x c #009090", ".y c #ffff00", ".z c #0000ff", ".A c #00afaf", ".B c #00d0d0", ".C c #00dfdf", ".D c #005f5f", ".E c #00b0b0", ".F c #001010", ".G c #00c0c0", ".H c #000f0f", ".I c #00007f", ".J c #005050", ".K c #002f2f", ".L c #dfcfcf", ".M c #dfd0d0", ".N c #006060", ".O c #00e0e0", ".P c #00ff00", ".Q c #002020", ".R c #dfc0c0", ".S c #008080", ".T c #001f1f", ".U c #003f3f", ".V c #007f00", ".W c #00000f", ".X c #000010", ".Y c #00001f", ".Z c #000020", ".0 c #00002f", ".1 c #000030", ".2 c #00003f", ".3 c #000040", ".4 c #00004f", ".5 c #000050", ".6 c #00005f", ".7 c #000060", ".8 c #00006f", ".9 c #000070", "#. c #7f7f80", "## c #9f9f9f", /* pixels */ "........................................", "........................................", "........................................", ".......................#.#.#............", ".....................#.......#...#......", "...............................#.#......", ".......#.#.#.................#.#.#......", ".....#.y.i.y.#.#.#.#.#.#.#..............", ".....#.i.y.i.y.i.y.i.y.i.#..............", ".....#.y.i.y.i.y.i.y.i.y.#..............", ".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....", ".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......", ".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........", ".....#.y.#.s.s.s.s.s.s.s.s.s.#..........", ".....#.#.s.s.s.s.s.s.s.s.s.#............", ".....#.#.#.#.#.#.#.#.#.#.#..............", "........................................", "........................................", "........................................" }; ���������ruby-gnome2-all-2.2.5/gtk2/sample/misc/gc.rb��������������������������������������������������������0000644�0001750�0001750�00000004316�11701304107�016611� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin gc.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: gc.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gdk::GC sample") window.set_default_size(300, 300) window.app_paintable = true window.realize drawable = window.window gc = Gdk::GC.new(drawable) red = Gdk::Color.new(65535, 0, 0) green = Gdk::Color.new(0, 65535, 0) colormap = Gdk::Colormap.system colormap.alloc_color(red, false, true) colormap.alloc_color(green, false, true) window.signal_connect("expose-event") do |win, evt| gc.set_foreground(red) gc.set_background(green) gc.set_line_attributes(5, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 10, 150, 10) gc.set_line_attributes(5, Gdk::GC::LINE_ON_OFF_DASH, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 30, 150, 30) gc.set_line_attributes(5, Gdk::GC::LINE_DOUBLE_DASH, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 50, 150, 50) gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 100, 120, 100) gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_BUTT, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 140, 120, 140) gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_ROUND, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 180, 120, 180) gc.set_line_attributes(30, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_PROJECTING, Gdk::GC::JOIN_MITER) drawable.draw_line(gc, 20, 220, 120, 220) gc.set_line_attributes(40, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER) drawable.draw_lines(gc, [[200, 80], [220, 30], [280, 50]]) gc.set_line_attributes(40, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_ROUND) drawable.draw_lines(gc, [[200, 170], [220, 120], [280, 140]]) gc.set_line_attributes(40, Gdk::GC::LINE_SOLID, Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_BEVEL) drawable.draw_lines(gc, [[200, 260], [220, 210], [280, 230]]) end window.show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/settings.rb��������������������������������������������������0000644�0001750�0001750�00000002736�11701304107�020064� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin setting.rb - Gtk::Settings sample script. Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: settings.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' spec = GLib::Param::Int.new("integer", # name "Integer", # nick "Integer integer", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE| GLib::Param::WRITABLE) enum = GLib::Param::Enum.new("enum", # name "Enum", # nick "Enum enum", # blurb GLib::Type["GdkCursorType"], #type Gdk::Cursor::ARROW, #default GLib::Param::READABLE| GLib::Param::WRITABLE) flags = GLib::Param::Flags.new("flags", # name "Flags", # nick "Flags flags", # blurb GLib::Type["GdkEventMask"], #type Gdk::Event::LEAVE_NOTIFY_MASK, #default GLib::Param::READABLE| GLib::Param::WRITABLE) p Gtk::Settings.rc_property_parse_color(spec, "{2222,44444,65535}").to_a p Gtk::Settings.rc_property_parse_enum(enum, "watch") p Gtk::Settings.rc_property_parse_flags(flags, "(scroll-mask|structure-mask)") p Gtk::Settings.rc_property_parse_requisition(spec, "{100, 200}") p Gtk::Settings.rc_property_parse_border(spec, "{100, 200, 300, 400}").to_a ����������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/entrycompletion.rb�������������������������������������������0000644�0001750�0001750�00000001471�11701304107�021452� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin entrycompletion.rb - Ruby/GTK sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. Enter "G", "t" on the entry box. $Id: entrycompletion.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end window = Gtk::Window.new window.set_default_size(200, 200) entry = Gtk::Entry.new completion = Gtk::EntryCompletion.new entry.completion = completion model = Gtk::ListStore.new(String) ["GNOME", "total", "totally"].each do |v| iter = model.append iter[0] = v end completion.model = model completion.text_column = 0 window.add(entry).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/dnd.rb�������������������������������������������������������0000644�0001750�0001750�00000003664�11701304107�016772� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin dnd.rb - Drag and Drop sample script. Copyright (C) 2002-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: dnd.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class SrcWindow < Gtk::Window def initialize super("Source Window") @label = Gtk::Label.new("Drag here!") add(@label) set_default_size(100, 100) Gtk::Drag.source_set(self, Gdk::Window::BUTTON1_MASK | Gdk::Window::BUTTON2_MASK, [["test", Gtk::Drag::TARGET_SAME_APP, 12345]], Gdk::DragContext::ACTION_COPY | Gdk::DragContext::ACTION_MOVE) signal_connect("drag_data_get") do |widget, context, selection_data, info, time| # selection_data.set("text/uri-list", 8, "hoge.txt") selection_data.set(Gdk::Selection::TYPE_STRING, "hoge.txt") end end end class DestWindow < Gtk::Window def initialize super("Dest Window") @label = Gtk::Label.new("Drop here!") add(@label) set_default_size(100, 100) Gtk::Drag.dest_set(self, Gtk::Drag::DEST_DEFAULT_MOTION | Gtk::Drag::DEST_DEFAULT_HIGHLIGHT, [["test", Gtk::Drag::TARGET_SAME_APP, 12345]], Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE) signal_connect("drag-data-received") do |w, dc, x, y, selectiondata, info, time| dc.targets.each do |target| if target.name == "test" || selectiondata.type == Gdk::Selection::TYPE_STRING puts selectiondata.data end end end signal_connect("drag-drop") do |w, dc, x, y, time| Gtk::Drag.get_data(w, dc, dc.targets[0], time) end end end win1 = SrcWindow.new win2 = DestWindow.new win1.show_all.signal_connect("destroy"){Gtk.main_quit} win2.show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ����������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/infobar.rb���������������������������������������������������0000775�0001750�0001750�00000000725�11740310343�017647� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'gtk2' label=Gtk::Label.new.show info=Gtk::InfoBar.new info.no_show_all=true info.content_area.add(label) info.add_button(Gtk::Stock::OK, Gtk::ResponseType::OK) info.signal_connect('response'){|info, response| info.hide} w=Gtk::Window.new w.add(info) w.show_all w.signal_connect("delete_event"){Gtk.main_quit} GLib::Timeout.add_seconds(1){ label.text='ERROR' info.message_type=Gtk::MessageType::ERROR info.show false } Gtk.main �������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/buttonbox.rb�������������������������������������������������0000644�0001750�0001750�00000004130�11701304107�020236� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin buttonbox.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: buttonbox.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' def create_bbox_window(horizontal, title, pos, spacing, layout) window = Gtk::Window.new(title) window.signal_connect("delete_event") do window.destroy end box1 = Gtk::VBox.new(false, 0) window.add(box1) if horizontal window.set_default_size(550, 60) window.move(150, pos) bbox = Gtk::HButtonBox.new else window.set_default_size(150, 400) window.move(pos, 200) bbox = Gtk::VButtonBox.new end bbox.layout_style = layout bbox.spacing = spacing box1.border_width = 25 box1.pack_start(bbox, true, true, 0) button = Gtk::Button.new("OK") bbox.add(button) button.signal_connect("clicked") do window.destroy end button = Gtk::Button.new("Cancel") bbox.add(button) button.signal_connect("clicked") do window.destroy end button = Gtk::Button.new("Help") bbox.add(button) window.show_all end def test_hbbox create_bbox_window(true, "Spread", 50, 40, Gtk::ButtonBox::SPREAD) create_bbox_window(true, "Edge", 250, 40, Gtk::ButtonBox::EDGE) create_bbox_window(true, "Start", 450, 40, Gtk::ButtonBox::START) create_bbox_window(true, "End", 650, 15, Gtk::ButtonBox::END) end def test_vbbox create_bbox_window(false, "Spread", 50, 40, Gtk::ButtonBox::SPREAD) create_bbox_window(false, "Edge", 250, 40, Gtk::ButtonBox::EDGE) create_bbox_window(false, "Start", 450, 40, Gtk::ButtonBox::START) create_bbox_window(false, "End", 650, 15, Gtk::ButtonBox::END) end window = Gtk::Window.new("button box") window.signal_connect("delete_event") do Gtk.main_quit end window.border_width = 20 bbox = Gtk::HButtonBox.new window.add(bbox) button = Gtk::Button.new("Horizontal") button.signal_connect("clicked") do test_hbbox end bbox.add(button) button = Gtk::Button.new("Vertical") button.signal_connect("clicked") do test_vbbox end bbox.add(button) window.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/combo_check.rb�����������������������������������������������0000644�0001750�0001750�00000003014�11701304107�020446� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin combo_check.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: combo_check.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("entry") window.border_width = 0 box1 = Gtk::VBox.new window.add(box1) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2) entry = Gtk::Entry.new entry.text = "hello world" entry.select_region(0, -1) box2.pack_start(entry) # # Gtk::Combo has been deprecated. Use Gtk::ComboBox instead. # cb = Gtk::Combo.new cb.set_popdown_strings(["item0", "item1 item1", "item2 item2 item2", "item3 item3 item3 item3", "item4 item4 item4 item4 item4", "item5 item5 item5 item5 item5 item5", "item6 item6 item6 item6 item6", "item7 item7 item7 item7", "item8 item8 item8", "item9 item9"]) cb.entry.set_text("hello world") cb.entry.select_region(0, -1) box2.pack_start(cb, true, true, 0) check = Gtk::CheckButton.new("Editable") box2.pack_start(check, false, true, 0) check.signal_connect("toggled") do cb.entry.set_editable(check.active?) entry.set_editable(check.active?) end check.state = 0 box1.pack_start(Gtk::HSeparator.new) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2) button = Gtk::Button.new("close") button.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(button) button.can_default = true button.grab_default window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/drag-move.rb�������������������������������������������������0000644�0001750�0001750�00000005041�11701304107�020075� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin drag-move.rb - Move widget by drag sample script. Copyright (C) 2006 Kouhei Sutou This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: drag-move.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class DraggableWidget < Gtk::EventBox def initialize super set_visible_window(false) @dragging = false @drag_button = 1 set_button_press_event set_button_release_event set_motion_notify_event end def layout parent end def move(x, y) if layout layout.move(self, x, y) true else false end end def dragging? @dragging end private def set_button_press_event signal_connect("button_press_event") do |widget, event| if event.button == @drag_button Gtk.grab_add(widget) x, y, w, h = widget.allocation.to_a drag_start(x, y, event.x_root, event.y_root) else false end end end def set_motion_notify_event signal_connect("motion_notify_event") do |widget, event| if dragging? drag_motion(event.x_root, event.y_root) else false end end end def set_button_release_event signal_connect("button_release_event") do |widget, event| if event.button == @drag_button Gtk.grab_remove(widget) drag_end else false end end end def set_drag_move_position_event signal_connect("drag_move_position") do |widget, x, y| if layout layout.move(widget, x, y) true else false end end end def drag_start(x, y, base_x, base_y) @dragging = true @drag_x = x @drag_y = y @drag_base_x = base_x @drag_base_y = base_y true end def drag_motion(base_x, base_y) delta_x = base_x - @drag_base_x delta_y = base_y - @drag_base_y if delta_x != 0 and delta_y != 0 move(@drag_x + delta_x, @drag_y + delta_y) else false end end def drag_end @dragging = false true end end window = Gtk::Window.new("Draggable Widget sample") window.signal_connect("destroy"){Gtk.main_quit} layout = Gtk::Layout.new draggable_widget = DraggableWidget.new draggable_widget.set_size_request(50, 50) layout.put(draggable_widget, 75, 75) draggable_widget.signal_connect("expose_event") do |widget, event| x, y, w, h = widget.allocation.to_a fg = Gdk::GC.new(widget.window) widget.window.draw_arc(fg, true, x, y, w, h, 0 * 64, 360 * 64) false end window.add(layout) window.show_all Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/filechooser.rb�����������������������������������������������0000644�0001750�0001750�00000002324�11701304107�020517� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin filechooser.rb - Ruby/GTK2 sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: filechooser.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk2" if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end dialog = Gtk::FileChooserDialog.new("Gtk::FileChooser sample", nil, Gtk::FileChooser::ACTION_OPEN, "gnome-vfs", [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT], [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL] ) extra_button = Gtk::Button.new("Extra button") extra_button.signal_connect("clicked") do puts "extra button is clicked" end dialog.extra_widget = extra_button filter_rb = Gtk::FileFilter.new filter_rb.name = "Ruby Scripts" filter_rb.add_pattern("*.rb") filter_rb.add_pattern("*.rbw") dialog.add_filter(filter_rb) filter_c = Gtk::FileFilter.new filter_c.name = "C sources" filter_c.add_pattern("*.[c|h]") dialog.add_filter(filter_c) dialog.add_shortcut_folder("/tmp") if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT puts "filename = #{dialog.filename}" puts "uri = #{dialog.uri}" end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/dndtreeview.rb�����������������������������������������������0000644�0001750�0001750�00000002755�11701304107�020545� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin dndtreeview.rb - Drag and Drop sample script. Copyright (C) 2003-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: dndtreeview.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class TestWindow < Gtk::Window attr_reader :list TARGET_TABLE = [["GTK_TREE_MODEL_ROW", 0, 0]] def initialize() super("Drag and Drop Gtk::TreeView") set_default_size(300,128) signal_connect("destroy") { Gtk.main_quit } data = [["Hello", "KON-NI-CHIWA"], ["Goodbye", "SAYO-NARA"], ["Good morning", "OHA-YO-GOZAI-MASU"], ["Good evening", "KON-BAN-WA"]] model = Gtk::ListStore.new(String, String) view = Gtk::TreeView.new(model) renderer = Gtk::CellRendererText.new col1 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 0}) col2 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 1}) view.append_column(col1) view.append_column(col2) data.each do |v1, v2| iter = model.append iter.set_value(0, v1) iter.set_value(1, v2) end view.enable_model_drag_source(Gdk::Window::BUTTON1_MASK, TARGET_TABLE, Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE) view.enable_model_drag_dest(TARGET_TABLE, Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE) add(view) end end win = TestWindow.new.show_all Gtk.main �������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/style_property.rb��������������������������������������������0000755�0001750�0001750�00000003200�11701304107�021316� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin style_property.rb - Ruby/GTK2 sample script. Copyright (c) 2004,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: style_property.rb,v 1.4 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class MyButton < Gtk::Button type_register def initialize(label = nil) # When type_register() is used. # super is equivalent to GLib::Object#initialize. super("label" => label) end install_style_property(GLib::Param::Int.new("foo", # name "Foo", # nick "FOO", # blurb 0, #min 100, #max 5, #default GLib::Param::READABLE | GLib::Param::WRITABLE)) do |pspec, str| p pspec, str str.to_i + 10 #return the converted value. end install_style_property(GLib::Param::Enum.new("bar", # name "Bar", # nick "BAR", # blurb GLib::Type["GdkCursorType"], #Enum type Gdk::Cursor::ARROW, #default GLib::Param::READABLE | GLib::Param::WRITABLE)) do |pspec, str| p pspec, str if str.strip! == "boat" Gdk::Cursor::BOAT else pspec.default end end end Gtk::RC.parse("./style_property.rc") win = Gtk::Window.new("Gtk::RC sample") b = MyButton.new("Hello") b.signal_connect("clicked"){ Gtk.main_quit } p MyButton.style_properties win.set_default_size(100, 100) win.add(b).show_all win.signal_connect("destroy"){ Gtk.main_quit } # You need to call them after "Gtk::Widget#show" # (Or in expose event). p b.style_get_property("foo") p cursor = b.style_get_property("bar") Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/frame.rb�����������������������������������������������������0000644�0001750�0001750�00000002676�11701304107�017321� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin frame.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: frame.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("buttons") window.signal_connect("destroy") do Gtk.main_quit end window.border_width = 0 box1 = Gtk::VBox.new(false, 0) window.add(box1) box2 = Gtk::HBox.new(false, 5) box2.border_width = 10 box1.pack_start(box2, true, true, 0) label = Gtk::Label.new("Hello World") frame = Gtk::Frame.new("Frame 1") box2.pack_start(frame, true, true, 0) box3 = Gtk::VBox.new(false, 5) box3.border_width = 5 frame.add(box3) button = Gtk::Button.new("switch") button.signal_connect("clicked") do label.reparent(box3) end box3.pack_start(button, false, true, 0) box3.pack_start(label, false, true, 0) frame = Gtk::Frame.new("Frame 2") box2.pack_start(frame, true, true, 0) box4 = Gtk::VBox.new(false, 5) box4.border_width = 5 frame.add(box4) button = Gtk::Button.new("switch") button.signal_connect("clicked") do label.reparent(box4) end box4.pack_start(button, false, true, 0) separator = Gtk::HSeparator.new box1.pack_start(separator, false, true, 0) box2 = Gtk::HBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(button) window.show_all Gtk.main ������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/scalebutton.rb�����������������������������������������������0000644�0001750�0001750�00000001234�11701304107�020537� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin scalebutton.rb - Very simple Gtk::ScaleButton example. Copyright (c) 2007 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: scalebutton.rb,v 1.1 2007/07/12 14:04:54 ggc Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 12, 0) puts "This sample requires GTK+ 2.12.0 or later" puts str exit end window = Gtk::Window.new window.add(scale = Gtk::ScaleButton.new(Gtk::IconSize::BUTTON)) scale.set_icons(['gtk-goto-bottom', 'gtk-goto-top', 'gtk-execute']) scale.signal_connect('value-changed') { |widget, value| puts "value changed: #{value}" } window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/recentchooserdialog.rb���������������������������������������0000644�0001750�0001750�00000002753�11701304107�022246� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin recentchooserdialog.rb - Ruby/GTK2 sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: recentchooserdialog.rb,v 1.2 2006/11/15 23:46:13 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 10, 0) puts "This sample requires GTK+ 2.10.0 or later" puts str exit end dialog = Gtk::RecentChooserDialog.new("Recent Chooser Dialog Sample", nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) dialog.signal_connect("response") do |widget, response| case response when Gtk::Dialog::RESPONSE_ACCEPT info = dialog.current_item if info puts "----" puts info.uri puts info.display_name puts info.description puts info.mime_type puts info.added puts info.modified puts info.visited puts info.private_hint? p info.application_info("gedit") p info.applications puts info.last_application p info.groups puts info.has_group?("web") puts info.has_application?("gedit") puts info.get_icon(64) puts info.short_name puts info.uri_display puts info.age puts info.local? puts info.exist? end else p "Close" dialog.destroy Gtk.main_quit end end dialog.show_all Gtk.main ���������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/helloworld.rb������������������������������������������������0000644�0001750�0001750�00000001235�11701304107�020370� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin helloworld.rb - Ruby/GTK2 first sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: helloworld.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' button = Gtk::Button.new("Hello World") button.signal_connect("clicked") { puts "Hello World" } window = Gtk::Window.new("Hello World sample") window.signal_connect("delete_event") { puts "delete event occurred" #true false } window.signal_connect("destroy") { puts "destroy event occurred" Gtk.main_quit } window.border_width = 10 window.add(button) window.show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/stock.rb�����������������������������������������������������0000644�0001750�0001750�00000001434�11701304107�017341� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin stock.rb - Gtk::Stock sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: stock.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::Stock sample") window.signal_connect("destroy"){Gtk.main_quit} stocks = Gtk::Stock.constants.sort image = Gtk::Image.new label = Gtk::Label.new button = Gtk::Button.new("Click!") cnt = 0 button.signal_connect("clicked") do stock_name = "Gtk::Stock::#{stocks[cnt]}" label.set_text(stock_name) image.set(eval(stock_name), Gtk::IconSize::DIALOG) if cnt < stocks.size - 1 cnt += 1 else cnt = 0 end end box = Gtk::VBox.new.add(image).add(label).add(button) window.add(box).set_default_size(200,200).show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/treemodelfilter.rb�������������������������������������������0000644�0001750�0001750�00000002505�11701304107�021404� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin treemodelfilter.rb - Gtk::TreeModelFilter sample Copyright (c) 2004,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: treemodelfilter.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end ls = Gtk::ListStore.new(String, Integer) column1 = Gtk::TreeViewColumn.new("data1", Gtk::CellRendererText.new, {:text => 0}) column2 = Gtk::TreeViewColumn.new("data2", Gtk::CellRendererText.new, {:text => 1}) mf = Gtk::TreeModelFilter.new(ls) mf.set_visible_func do |model, iter| /a/ =~ iter[0] end mf.set_modify_func(String, String) do |model, iter, column| child_iter = model.convert_iter_to_child_iter(iter) if column == 0 child_iter[0] else "#{child_iter[1]} * 2 = #{child_iter[1] * 2}" end end treeview = Gtk::TreeView.new(mf) treeview.append_column(column1) treeview.append_column(column2) [ ["aaa", 1], ["aab", 2], ["aac", 3], ["bba", 4], ["bbb", 5], ["bbc", 6] ].each do |str, num| iter = ls.append iter[0] = str iter[1] = num end win = Gtk::Window.new("Gtk::TreeModelFilter sample") win.signal_connect("destroy"){Gtk.main_quit} win.add(treeview).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/misc_button.rb�����������������������������������������������0000644�0001750�0001750�00000002667�11701304107�020555� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin misc_button.rb - Ruby/GTK sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: misc_button.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end box = Gtk::VBox.new #Gtk::ColorButton colorbutton = Gtk::ColorButton.new colorbutton.signal_connect("color-set") do p colorbutton.color.to_a end box.add(colorbutton) #Gtk::FontButton fontbutton = Gtk::FontButton.new fontbutton.signal_connect("font-set") do p fontbutton.font_name end box.add(fontbutton) #Gtk::FileChooserButton(GTK+-2.6.0 or later) if str = Gtk.check_version(2, 6, 0) puts "Gtk::FileChooserButton requires GTK+ 2.6.0 or later" else filebutton = Gtk::FileChooserButton.new("Gtk::FileChooserButton", Gtk::FileChooser::ACTION_OPEN) filebutton.filename = GLib.home_dir filebutton.signal_connect("current-folder-changed") do |w, e| p filebutton.filename end box.add(filebutton) end #Quit quitbutton = Gtk::Button.new("Quit") quitbutton.signal_connect("clicked") do Gtk.main_quit end box.add(quitbutton) Gtk::Window.new.add(box).set_default_size(200, 100).show_all Gtk.main �������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/threads.rb���������������������������������������������������0000644�0001750�0001750�00000002525�11701304107�017652� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin threads.rb - Ruby/GTK2 sample script. Copyright (c) 2003-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: threads.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' require 'thread' label = Gtk::Label.new Thread.new { (0...1000).each { |cnt| p "A:" + cnt.to_s label.label = "A:" + cnt.to_s sleep(2) } } start_button = Gtk::Button.new("start") stop_button = Gtk::Button.new("stop") start_button.signal_connect("clicked") do start_button.sensitive=false @th = Thread.new { (0...10).each { |cnt| p "B:" + cnt.to_s label.label = "B:" + cnt.to_s sleep(2) } @th = nil start_button.sensitive = true start_button.grab_focus stop_button.sensitive = false } stop_button.sensitive = true stop_button.grab_focus end stop_button.signal_connect("clicked") do if @th @th.kill puts "killed" @th = nil start_button.sensitive = true start_button.grab_focus stop_button.sensitive = false end end stop_button.sensitive = false box = Gtk::VBox.new. set_size_request(100,100) box << label << start_button << stop_button win = Gtk::Window.new << box win.show_all.signal_connect("delete_event") do p "Exiting..." Gtk.main_quit Thread.list.each {|t| t.kill } end Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/xbm_cursor.rb������������������������������������������������0000644�0001750�0001750�00000003123�11701304107�020376� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin xbm_cursor.rb - Gdk::Cursor sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: xbm_cursor.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' cursor_bits = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xe0, 0x78, 0x00, 0xe0, 0x70, 0x00, 0xe0, 0x70, 0x00, 0xe0, 0x38, 0x00, 0xe0, 0x1f, 0x00, 0xe0, 0x1d, 0x00, 0xe0, 0x38, 0x00, 0xe0, 0x78, 0x00, 0xe0, 0xf0, 0x00, 0xf0, 0xf3, 0x01, 0xf0, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].pack("c*") cursor_mask_bits = [ 0x63, 0x8e, 0x0f, 0x67, 0x8e, 0x0f, 0x06, 0xc6, 0x07, 0x04, 0x00, 0x00, 0xf0, 0x3f, 0x08, 0xe7, 0x78, 0x0e, 0xe7, 0x70, 0x0f, 0xe4, 0x70, 0x03, 0xe0, 0x38, 0x00, 0xe7, 0x1f, 0x0c, 0xe7, 0x1d, 0x0f, 0xe0, 0x38, 0x0e, 0xe0, 0x78, 0x08, 0xe7, 0xf0, 0x00, 0xf7, 0xf3, 0x01, 0xf0, 0xe3, 0x01, 0x04, 0x00, 0x00, 0x46, 0x24, 0x06, 0x67, 0x66, 0x0e, 0x67, 0x66, 0x0e].pack("c*") window = Gtk::Window.new("Gdk::Cursor sample") window.signal_connect("destroy"){Gtk.main_quit} window.realize source = Gdk::Pixmap.create_from_data(window.window, cursor_bits, 19, 19) mask = Gdk::Pixmap.create_from_data(window.window, cursor_mask_bits, 19, 19) fg = Gdk::Color.new(65535, 0, 0) bg = Gdk::Color.new(65535, 65535, 0) cursor = Gdk::Cursor.new(source, mask, fg, bg, 10, 10) window.window.set_cursor(cursor) window.add(Gtk::Label.new("Put your cursor on this window.")) window.set_default_size(200, 100).show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/rgtk+cairo.rb������������������������������������������������0000644�0001750�0001750�00000002003�11701304107�020247� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin rgtk+cairo.rb - Ruby/GTK2 using Ruby/Cairo sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. Heavily inspired from png.rb example of rcairo. $Id: rgtk+cairo.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' require 'cairo' w = Gtk::Window.new.add(vb = Gtk::VBox.new) vb.add(da = Gtk::DrawingArea.new) da.set_size_request(200, 200) da.signal_connect('expose-event') { |widget, event| cr = widget.window.create_cairo_context # fill background with white cr.set_source_rgba(1.0, 1.0, 1.0) cr.paint # create shape cr.move_to(50, 50) cr.curve_to(100, 25, 100, 75, 150, 50) cr.line_to(150, 150) cr.line_to(50, 150) cr.close_path cr.set_source_rgb(0.0, 0.0, 0.0) cr.fill_preserve cr.set_source_rgb(1.0, 0.0, 0.0) cr.set_line_join(Cairo::LINE_JOIN_MITER) cr.set_line_width(4) cr.stroke } w.signal_connect("destroy"){Gtk.main_quit} w.show_all Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/button.rb����������������������������������������������������0000644�0001750�0001750�00000003167�11701304107�017536� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin button.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: button.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("buttons") window.border_width = 0 box1 = Gtk::VBox.new(false, 0) window.add(box1) table = Gtk::Table.new(3, 3, false) table.set_row_spacings(5) table.set_column_spacings(5) table.set_border_width(10) box1.pack_start(table, true, true, 0) button = [] 0.upto(8) do |i| button.push Gtk::Button.new("button"+(i+1).to_s) end 0.upto(8) do |i| button[i].signal_connect("clicked") do |w| p [i] j = (i + 1) % 9 if button[j].visible? button[j].hide else button[j].show end end button[i].show end table.attach(button[0], 0, 1, 0, 1, nil, nil, 0, 0) table.attach(button[1], 1, 2, 1, 2, nil, nil, 0, 0) table.attach(button[2], 2, 3, 2, 3, nil, nil, 0, 0) table.attach(button[3], 0, 1, 2, 3, nil, nil, 0, 0) table.attach(button[4], 2, 3, 0, 1, nil, nil, 0, 0) table.attach(button[5], 1, 2, 2, 3, nil, nil, 0, 0) table.attach(button[6], 1, 2, 0, 1, nil, nil, 0, 0) table.attach(button[7], 2, 3, 1, 2, nil, nil, 0, 0) table.attach(button[8], 0, 1, 1, 2, nil, nil, 0, 0) separator = Gtk::HSeparator.new box1.pack_start(separator, false, true, 0) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) close = Gtk::Button.new("close") close.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(close, true, true, 0) close.can_default = true close.grab_default window.show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/cursor.rb����������������������������������������������������0000644�0001750�0001750�00000001320�11701304107�017525� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin cursor.rb - Gdk::Cursor sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: cursor.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gdk::Cursor sample") window.realize button = Gtk::Button.new("Click!") button.use_underline = false cursors = Gdk::Cursor::Type.values - [Gdk::Cursor::CURSOR_IS_PIXMAP] cnt = 0 button.signal_connect('clicked') do cursor = cursors[cnt] p cursor.inspect button.set_label(cursor.inspect) window.window.set_cursor(Gdk::Cursor.new(cursor)) cnt += 1 cnt = 0 if cnt == cursors.size end window.add(button) window.set_default_size(400,100).show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/colorselection.rb��������������������������������������������0000644�0001750�0001750�00000001205�11701304107�021236� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin colorselection.rb - Gtk::ColorSelection sample script. Copyright (C) 2005,2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: colorselection.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' settings = Gtk::Settings.default # You can save the palette to use right click on the palette. Gtk::ColorSelection.set_change_palette_hook{|screen, colors| puts strs = Gtk::ColorSelection.palette_to_string(colors) settings.gtk_color_palette = strs } a = Gtk::ColorSelection.new a.has_palette = true Gtk::Window.new.add(a).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/checkbutton.rb�����������������������������������������������0000644�0001750�0001750�00000001671�11701304107�020532� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin checkbutton.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: checkbutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("check buttons") window.border_width = 0 box1 = Gtk::VBox.new window.add(box1) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2) button1 = Gtk::CheckButton.new("_button1") button2 = Gtk::CheckButton.new("_button2", false) button3 = Gtk::CheckButton.new(Gtk::Stock::QUIT) box2.add(button1) box2.add(button2) box2.add(button3) box1.pack_start(Gtk::HSeparator.new) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2) close = Gtk::Button.new("close") close.signal_connect("clicked") do Gtk.main_quit end box2.pack_start(close) close.can_default = true close.grab_default window.show_all Gtk.main �����������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/expander.rb��������������������������������������������������0000644�0001750�0001750�00000001132�11701304107�020017� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin expander.rb - Ruby/GTK2 sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: expander.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' expander = Gtk::Expander.new("Expander Sample") expander.expanded = true button = Gtk::Button.new("Hide this button.") button.signal_connect("clicked") do expander.expanded = false end button.set_size_request(200, 200) expander.add(button) Gtk::Window.new.add(expander).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/image.rb�����������������������������������������������������0000644�0001750�0001750�00000001437�11701304107�017303� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin image.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: image.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Image") window.signal_connect("destroy") do Gtk.main_quit end window.border_width = 0 box1 = Gtk::VBox.new(false, 10) box1.border_width = 10 button = Gtk::Button.new box1.add(button) label = Gtk::Label.new("Gtk::Image\ntest") image = Gtk::Image.new("test.xpm") box2 = Gtk::HBox.new(false, 5).add(image).add(label) button.add(box2) box1.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked") do Gtk.main_quit end box1.add(button) window.add(box1).show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/keyboard_grab.rb���������������������������������������������0000644�0001750�0001750�00000001424�11701304107�021010� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin keyboard_grab.rb - Gdk::Window#keyboard_grab/ungrab sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME. $Date: 2006/06/17 13:18:12 $ $Id: keyboard_grab.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Keyboard Grab/Ungrab sample") button1 = Gtk::Button.new("Grab Keyboard!") button2 = Gtk::Button.new("Ungrab Keyboard!") button1.signal_connect('clicked') do Gdk.keyboard_grab(window.window, true, Gdk::Event::CURRENT_TIME) end button2.signal_connect('clicked') do Gdk.keyboard_ungrab(Gdk::Event::CURRENT_TIME) end window.add(Gtk::VBox.new.add(button1).add(button2)) window.set_default_size(200,100).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/treeview.rb��������������������������������������������������0000644�0001750�0001750�00000003615�11701304107�020053� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin treeview.rb - Gtk::TreeView sample Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: treeview.rb,v 1.8 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::TreeView sample") # Create data model = Gtk::TreeStore.new(String, String, Gdk::Color, Float, Gdk::Pixbuf) # column 1 root_iter = model.append(nil) root_iter[0] = "Root" root_iter[1] = "red" root_iter[2] = Gdk::Color.new(0, 65535, 0) root_iter[3] = 5.0 # column 2 root_iter[4] = window.render_icon(Gtk::Stock::NEW, Gtk::IconSize::DIALOG, "icon1") child_iter1 = model.append(root_iter) child_iter1[0] = "Child_Iter1" child_iter1[1] = "green" child_iter1[2] = Gdk::Color.new(65535, 0, 0) child_iter1[3] = 3.0 # column 2 child_iter1[4] = window.render_icon(Gtk::Stock::OPEN, Gtk::IconSize::MENU, "icon2") child_iter2 = model.append(root_iter) child_iter2[0] = "Child_Iter2" child_iter2[1] = "yellow" child_iter2[2] = Gdk::Color.new(0, 0, 65535) child_iter2[3] = 0.9 # column 2 child_iter2[4] = window.render_icon(Gtk::Stock::QUIT, Gtk::IconSize::BUTTON, "icon3") # Create view tv = Gtk::TreeView.new(model) # column 1 renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new("Gtk::CellRenderText", renderer, { :text => 0, :background => 1, :foreground_gdk => 2, :scale => 3, }) tv.append_column(column) # column 2 renderer = Gtk::CellRendererPixbuf.new column = Gtk::TreeViewColumn.new("Gtk::CellRenderPixbuf", renderer, { :pixbuf => 4 }) tv.append_column(column) window.add(tv).set_default_size(300, 300).show_all window.signal_connect("destroy"){Gtk.main_quit} Gtk.main �������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/bindings.rb��������������������������������������������������0000644�0001750�0001750�00000005412�11701304107�020013� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin bindings.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: bindings.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end =begin Usage: bindings.rb <filename> Following key bindings are effective in the TextView area. <space> : scroll down by one page <backspace> : scroll up by one page j : move cursor donw by one line k : move cursor up by one line clicking buttons cause following effect "space" : same as pressing <space> in text view area. "back_space" : same as pressing <backspace> in text view area. "cancel j/k" : disable 'j' and 'k' binding =end require 'gtk2' class Pager < Gtk::TextView type_register # widget's key binding can be defined like this binding_set.add_signal(Gdk::Keyval::GDK_space, 0, "move_cursor", Gtk::MOVEMENT_PAGES, 1, false) binding_set.add_signal(Gdk::Keyval::GDK_BackSpace, 0, "move_cursor", Gtk::MOVEMENT_PAGES, -1, false) def initialize(path) @path = path super() @buffer = self.buffer load set_editable(false) set_size_request(400, 400) end def load open(@path).read.each_line do |line| @buffer.insert_at_cursor(line) end @buffer.place_cursor(@buffer.start_iter) end end path = ARGV[0] || __FILE__ window = Gtk::Window.new window.name = "pager_window" sw = Gtk::ScrolledWindow.new vbox = Gtk::VBox.new hbox = Gtk::HBox.new pager = Pager.new(path) hbox.add(button1 = Gtk::Button.new("space")) hbox.add(button2 = Gtk::Button.new("back_space")) hbox.add(button3 = Gtk::Button.new("cancel j/k")) button1.signal_connect("clicked") do Pager.binding_set.activate(Gdk::Keyval::GDK_space, 0, pager) end button2.signal_connect("clicked") do pager.bindings_activate(Gdk::Keyval::GDK_BackSpace, 0) end # Key bindings can be attached to any widget by # Gtk::BindingSet#add_path # see RC Files section of GTK+ documentation for more detail. bset = Gtk::BindingSet.new("j_and_k") bset.add_signal(Gdk::Keyval::GDK_j, 0, "move_cursor", Gtk::MOVEMENT_DISPLAY_LINES, 1, false) bset.add_signal(Gdk::Keyval::GDK_k, 0, "move_cursor", Gtk::MOVEMENT_DISPLAY_LINES, -1, false) bset.add_path(Gtk::PathType::WIDGET, "pager_window.*.Pager", Gtk::PathPriorityType::APPLICATION) button3.signal_connect("clicked") do bset.entry_clear(Gdk::Keyval::GDK_j, 0) bset.entry_clear(Gdk::Keyval::GDK_k, 0) end sw.add(pager) vbox.add(hbox).add(sw) window.add(vbox) window.show_all pager.grab_focus window.signal_connect("destroy") { Gtk.main_quit } Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/t-gtksocket.rb�����������������������������������������������0000644�0001750�0001750�00000003311�11701304107�020451� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin Sample script using Gtk::Socket and Gtk::Plug. $ ruby t-gtksocket.rb Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only. Copyright (c) 2003-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: t-gtksocket.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class MyGtkSocket < Gtk::Window def initialize super("Gtk::Socket Test") set_window_position(Gtk::Window::POS_CENTER) signal_connect("delete_event"){Gtk::main_quit} @buttons = [] 6.times {|n| @buttons << Gtk::Button.new("Plug #{n}") @buttons.last.signal_connect("clicked"){ plug(n) } } @table = Gtk::Table.new(1, 2) @table.set_size_request(320, 200) add(@table) @vbox = Gtk::VBox.new(true, 5) @buttons.each{|b| @vbox.add(b) } @vbox.set_size_request(150, 190) @table.attach(@vbox, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 5, 5) @socket = Gtk::Socket.new @table.attach(@socket, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL, 5, 5) @socket.set_size_request(150, 150) show_all @xid = @socket.id @pid = 0 end def plug(arg) if @pid != 0 Process.kill("SIGKILL", @pid) Process.waitpid(@pid) begin @table.remove(@socket) unless @socket.destroyed? rescue ArgumentError # socket has been destroyed because child process finished unexpectedly end @socket = Gtk::Socket.new @table.attach(@socket, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL, 5, 5) @socket.set_size_request(150, 190) @socket.show @xid = @socket.id end @pid = fork { exec "ruby t-gtkplug.rb -x #{@xid} Plug#{arg}" } end end MyGtkSocket.new Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/pangorenderer.rb���������������������������������������������0000644�0001750�0001750�00000003342�11701304107�021051� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin pangorenderer.rb - Ruby/GTK sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: pangorenderer.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' RADIUS = 80 N_WORDS = 16 if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end win = Gtk::Window.new("Gdk::PangoRenderer sample") win.signal_connect("destroy"){Gtk.main_quit} win.set_default_size(400, 400) win.realize matrix = Pango::Matrix.new renderer = Gdk::PangoRenderer.default renderer.drawable = win.window renderer.gc = Gdk::GC.new(win.window) width, height = win.size device_radius = [width, height].min / 6.0 matrix.translate!(device_radius + (width - 2 * device_radius) / 2.0, device_radius + (height - 2 * device_radius) / 2.0) matrix.scale!(device_radius / RADIUS, device_radius / RADIUS) context = Gdk::Pango.context layout = Pango::Layout.new(context) layout.text = "Ruby-GNOME2" layout.font_description = Pango::FontDescription.new("Sans Bold 14") background = Gdk::Color.new(65535, 65535, 65535) Gdk::Colormap.system.alloc_color(background, false, true) win.window.background = background win.signal_connect("expose_event") do (0...N_WORDS).each do |i| rotated_matrix = matrix.dup angle = 360 * i / N_WORDS.to_f color = Gdk::Color.new(65535 * rand, 65535 * rand, 65535 * rand) renderer.set_override_color(Pango::Renderer::PART_FOREGROUND, color) rotated_matrix.rotate!(angle) context.set_matrix(rotated_matrix) layout.context_changed width, height = layout.size renderer.draw_layout(layout, width / 2, RADIUS * Pango::SCALE) end end win.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/pointer_grab.rb����������������������������������������������0000644�0001750�0001750�00000001713�11701304107�020671� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin pointer_grab.rb - Gdk::Window#pointer_grab/ungrab sample script. Copyright (C) 2001-2006 Masao Mutoh<mutoh@highway.ne.jp> This program is licenced under the same licence as Ruby-GNOME. $Date: 2006/06/17 13:18:12 $ $Id: pointer_grab.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Pointer grab/ungrab sample") cursor = Gdk::Cursor.new(Gdk::Cursor::WATCH) button1 = Gtk::Button.new("Grab Window!") button2 = Gtk::Button.new("Ungrab Window!") button1.signal_connect('clicked') do Gdk.pointer_grab(window.window, true, Gdk::Event::BUTTON_PRESS_MASK, window.window, cursor, Gdk::Event::CURRENT_TIME) p Gdk.pointer_is_grabbed? end button2.signal_connect('clicked') do Gdk.pointer_ungrab(Gdk::Event::CURRENT_TIME) p Gdk.pointer_is_grabbed? end window.add(Gtk::VBox.new.add(button1).add(button2)) window.set_default_size(200,100).show_all window.signal_connect("destroy"){Gtk.main_quit} Gtk.main �����������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/mouse-gesture.rb���������������������������������������������0000644�0001750�0001750�00000023674�11701304107�021034� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin mouse-gesture.rb - mouse gesture sample script. Copyright (C) 2005,2006 Kouhei Sutou This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: mouse-gesture.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' unless Gdk.cairo_available? STDERR.puts("need cairo and rcairo support for this sample") exit 1 end class GestureProcessor DEFAULT_THRESHOLD = 16 DEFAULT_SKEW_THRESHOLD_ANGLE = 30 attr_accessor :threshold, :skew_threshold_angle attr_reader :motions def initialize(threshold=nil, skew_threshold_angle=nil) @threshold = threshold || DEFAULT_THRESHOLD @skew_threshold_angle = skew_threshold_angle @skew_threshold_angle ||= DEFAULT_SKEW_THRESHOLD_ANGLE reset end def started? @started end MOTIONS = %w(L R U D UL UR LL LR) def available_motion?(motion) MOTIONS.include?(motion) end def start(x, y) @prev_x = @x = x @prev_y = @y = y @started = true @motions = [] end def update_position(x, y) mx = x - @prev_x my = y - @prev_y motion = judge_motion(mx, my) if motion @prev_x = @x = x @prev_y = @y = y if @motions.last == motion false else @motions << motion true end else false end end def reset @started = false @x = @y = -1 @motions = [] end def to_a @motions end def position [@x, @y] end private def judge_motion(mx, my) mxa = mx.abs mya = my.abs distance = Math.sqrt(mxa ** 2 + mya ** 2) upper_theta = (45 + @skew_threshold_angle) * (Math::PI / 180.0) lower_theta = (45 - @skew_threshold_angle) * (Math::PI / 180.0) if distance > @threshold and mya < Math.tan(upper_theta) * mxa and mya > Math.tan(lower_theta) * mxa judge_corner_motion(mx, my) elsif mxa > @threshold or mya > @threshold judge_cross_motion(mx, my) else nil end end def judge_corner_motion(mx, my) if mx < 0 if my < 0 "UL" else "LL" end else if my < 0 "UR" else "LR" end end end def judge_cross_motion(mx, my) if mx.abs > my.abs if mx < 0 "L" else "R" end else if my < 0 "U" else "D" end end end end class Gesture < Gtk::EventBox DEFAULT_BACK_RGBA = [0.2, 0.2, 0.2, 0.5] DEFAULT_LINE_RGBA = [1, 0, 0, 1] DEFAULT_NEXT_RGBA = [0, 1, 0, 0.8] DEFAULT_CURRENT_RGBA = [1, 0, 1, 0.8] def initialize(conf={}) super() set_visible_window(false) conf ||= {} @back_rgba = conf[:back_rgba] || DEFAULT_BACK_RGBA @line_rgba = conf[:line_rgba] || DEFAULT_LINE_RGBA @next_rgba = conf[:next_rgba] || DEFAULT_NEXT_RGBA @current_rgba = conf[:current_rgba] || DEFAULT_CURRENT_RGBA @processor = GestureProcessor.new(conf[:threshold], conf[:skew_threshold_angle]) @actions = [] set_expose_event set_motion_notify_event set_button_release_event end def add_action(sequence, action=Proc.new) invalid_motion = sequence.find do |motion| not @processor.available_motion?(motion) end raise "invalid motion: #{invalid_motion}" if invalid_motion @actions << [sequence, action] end def start(widget, button, x, y, base_x, base_y) Gtk.grab_add(self) @widget = widget @button = button @processor.start(x, y) @base_x = base_x @base_y = base_y @cr = window.create_cairo_context @cr.set_source_rgba(@line_rgba) @cr.move_to(x, y) end private def perform_action act = action act.call(@widget) if act @processor.reset end def action motions = @processor.motions @actions.each do |sequence, act| return act if sequence == motions end nil end def available_motions motions = @processor.motions @actions.collect do |sequence, act| if sequence == motions sequence.last else nil end end.compact.uniq end def next_available_motions motions = @processor.motions @actions.collect do |sequence, act| if sequence[0..-2] == motions sequence.last else nil end end.compact.uniq end def match? not action.nil? end def set_expose_event signal_connect("expose_event") do |widget, event| if @processor.started? cr = widget.window.create_cairo_context cr.rectangle(*widget.allocation.to_a) cr.set_source_rgba(@back_rgba) cr.fill cr.set_source_rgba(@next_rgba) draw_available_marks(cr, next_available_motions) if action cr.set_source_rgba(@current_rgba) draw_mark(cr, *@processor.position) end @cr.stroke_preserve true else false end end end def draw_mark(cr, x=nil, y=nil, radius=nil) x ||= @processor.position[0] y ||= @processor.position[1] radius ||= @processor.threshold cr.save do cr.translate(x, y) cr.scale(radius, radius) cr.arc(0, 0, 0.5, 0, 2 * Math::PI) cr.fill end end def draw_available_marks(cr, motions) motions.each do |motion| adjust_x = calc_position_ratio(motion, %w(R), %w(L), %w(UR LR), %w(UL LL)) adjust_y = calc_position_ratio(motion, %w(D), %w(U), %w(LR LL), %w(UR UL)) threshold = @processor.threshold x, y = @processor.position x += threshold * adjust_x y += threshold * adjust_y draw_mark(cr, x, y, threshold) end end def calc_position_ratio(motion, inc, dec, inc_skew, dec_skew) case motion when *inc 1 when *inc_skew 1 / Math.sqrt(2) when *dec -1 when *dec_skew -1 / Math.sqrt(2) else 0 end end def set_motion_notify_event signal_connect("motion_notify_event") do |widget, event| if @processor.started? x = @base_x + event.x y = @base_y + event.y @cr.line_to(x, y) @cr.save do if @processor.update_position(x, y) queue_draw end end @cr.stroke_preserve true else false end end end def set_button_release_event signal_connect("button_release_event") do |widget, event| if event.button == @button and @processor.started? Gtk.grab_remove(self) perform_action hide true else false end end end end class GesturedWidget < Gtk::EventBox DEFAULT_GESTURE_BUTTON = 3 def initialize(gesture_button=nil) super() set_visible_window(false) @gesture_button = gesture_button || DEFAULT_GESTURE_BUTTON set_button_press_event end def layout parent end def gesture(x, y, base_x, base_y) if layout layout.gesture(self, @gesture_button, x, y, base_x, base_y) end end private def set_button_press_event signal_connect("button_press_event") do |widget, event| if event.button == @gesture_button x, y, w, h = widget.allocation.to_a gesture(x + event.x, y + event.y, x, y) else false end end end end class Layout < Gtk::Layout def initialize() super() @gesture = Gesture.new() put(@gesture, 0, 0) end def gesture(widget, button, x, y, base_x, base_y) remove(@gesture) put(@gesture, 0, 0) _, _, w, h = allocation.to_a @gesture.set_size_request(w, h) @gesture.show @gesture.start(widget, button, x, y, base_x, base_y) end def add_gesture_action(sequence, action=Proc.new) @gesture.add_action(sequence, action) end end window = Gtk::Window.new("Mouse Gesture sample") layout = Layout.new gestured_widget = GesturedWidget.new gestured_widget.set_size_request(50, 50) gestured_widget.signal_connect("expose_event") do |widget, event| x, y, w, h = widget.allocation.to_a cr = widget.window.create_cairo_context cr.set_source_rgba([0.8, 0.8, 0.3, 1]) cr.translate(x, y) cr.scale(w, h) cr.arc(0.5, 0.5, 0.5, -0.1, 360) cr.fill false end layout.put(gestured_widget, 75, 75) gestured_widget2 = GesturedWidget.new gestured_widget2.set_size_request(100, 50) gestured_widget2.signal_connect("expose_event") do |widget, event| x, y, w, h = widget.allocation.to_a cr = widget.window.create_cairo_context cr.set_source_rgba([0.3, 0.3, 0.8, 1]) cr.translate(x, y) cr.scale(w, h) cr.arc(0.5, 0.5, 0.5, -0.1, 360) cr.fill false end layout.put(gestured_widget2, 0, 25) # gesture handlers expand_size = 20 expand_left = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x - expand_size, y) widget.set_size_request(w + expand_size, h) end expand_right = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x, y) widget.set_size_request(w + expand_size, h) end expand_top = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x, y - expand_size) widget.set_size_request(w, h + expand_size) end expand_bottom = Proc.new do |widget| x = layout.child_get_property(widget, :x) y = layout.child_get_property(widget, :y) w, h = widget.size_request layout.move(widget, x, y) widget.set_size_request(w, h + expand_size) end layout.add_gesture_action(["L"]) do |widget| expand_left.call(widget) end layout.add_gesture_action(["U"]) do |widget| expand_top.call(widget) end layout.add_gesture_action(["LL"]) do |widget| expand_left.call(widget) expand_bottom.call(widget) end layout.add_gesture_action(["R", "LR"]) do |widget| expand_right.call(widget) expand_bottom.call(widget) expand_right.call(widget) end window.add(layout) window.signal_connect("destroy"){Gtk.main_quit} window.show_all Gtk.main ��������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/properties.rb������������������������������������������������0000755�0001750�0001750�00000004321�11701304107�020413� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin properties.rb - GLib::Object#properties and Gtk::Container#child_properties sample script. Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: properties.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class MyButton < Gtk::Button type_register def initialize(label = nil) # XXX: # When type_register() is used. # super is equivalent to GLib::Object#initialize. super("label" => label) @fuga = 0 @hoge = 0 end # define new property "fuga" install_property(GLib::Param::Int.new("fuga", # name "Fuga", # nick "fuga fuga", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE | GLib::Param::WRITABLE)) # define new property "hoge" install_child_property(GLib::Param::Int.new("hoge", # name "Hoge", # nick "hoge hoge", # blurb 0, # min 10000, # max 0, # default GLib::Param::READABLE | GLib::Param::WRITABLE)) # implementation of the property "fuga" def fuga puts "MyButton#fuga is called" @fuga end def fuga=(arg) puts "MyButton#fuga= is called" @fuga = arg notify("fuga") end # implementation of the property "hoge" def get_hoge(child) puts "MyButton#get_hoge is called" @hoge end def set_hoge(child, arg) puts "MyButton#set_hoge is called" @hoge = arg end end b = MyButton.new("Hello") p b p b.label p b.gtype p MyButton.properties p b.get_property("fuga") b.set_property("fuga", 1) p b.get_property("fuga") p MyButton.child_properties p child = b.child p b.child_get_property(child, "hoge") b.child_set_property(child, "hoge", 2) p b.child_get_property(child, "hoge") p MyButton.ancestors ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/itemfactory.rb�����������������������������������������������0000644�0001750�0001750�00000005323�11701304107�020545� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin itemfactory.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. *NOTE* Gtk::ItemFactory has been deprecated. Use Gtk::UIManager instead. $Id: itemfactory.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' puts "Deprecated. Use Gtk::UIManager instead." window = Gtk::Window.new("Gtk::ItemFactory") window.signal_connect("destroy") do Gtk.main_quit end window.signal_connect("delete_event") do Gtk.main_quit end accelgroup = Gtk::AccelGroup.new window.add_accel_group(accelgroup) ifp = Gtk::ItemFactory.new(Gtk::ItemFactory::TYPE_MENU_BAR, "<main>", accelgroup) cal_stock = Proc.new {|d, item| p "StockItem, #{d}"} cal_quit = Proc.new{p "Quit"; Gtk.main_quit} cal_check = Proc.new {|d, item| p "CheckItem, #{d}"} cal_toggle = Proc.new {|d, item| p "ToggleItem, #{d}"} cal_radio = Proc.new {|d, item| p "RadioItem, #{d}"} cal_misc = Proc.new {|d, item| p "Misc #{d}"} ifp.create_items([ ["/_Stock"], ["/_Stock/_New", "<StockItem>", "<control>N", Gtk::Stock::NEW, cal_stock, 1], ["/_Stock/_Open", "<StockItem>", "<control>O", Gtk::Stock::OPEN, cal_stock, 2], ["/_Stock/_Quit", "<StockItem>", "<control>Q", Gtk::Stock::QUIT, cal_quit], ["/_Check"], ["/_Check/Check_1", "<CheckItem>", "", "", cal_check, 1], ["/_Check/Check_2", "<CheckItem>", "", "", cal_check, 2], ["/_Toggle"], ["/_Toggle/Toggle_1", "<ToggleItem>", "", "", cal_toggle, 1], ["/_Toggle/Toggle_2", "<ToggleItem>", "", "", cal_toggle, 2], ["/_Toggle/Toggle_3", "<ToggleItem>", "", "", cal_toggle, 3], ["/_Radio", "<Branch>"], ["/_Radio/Radio_1", "<RadioItem>", nil, nil, cal_radio, 1], ["/_Radio/Radio_2", "/Radio/Radio1", nil, nil, cal_radio, 2], ["/_Radio/Radio_3", "/Radio/Radio1", nil, nil, cal_radio, 3], ["/_Misc", "<LastBranch>"], ["/_Misc/Tearoff", "<Tearoff>"], ["/_Misc/Title", "<Title>"], ["/_Misc/Image", "<ImageItem>", "", Gdk::Pixbuf.new("gnome-logo-icon.png"), cal_misc, 1], ["/_Misc/Separator", "<Separator>"], ["/_Misc/Item", "<Item>", nil, nil, cal_misc, 2] ]) ifp.get_widget("/Stock/Open").sensitive = false ifp.delete_item("/Toggle/Toggle2") vbox = Gtk::VBox.new vbox.add(ifp.get_widget("<main>")) vbox.add(Gtk::Label.new("Gtk::ItemFactory sample").set_size_request(400, 200)) window.add(vbox) window.show_all Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/cairo-pong.rb������������������������������������������������0000755�0001750�0001750�00000010636�11701304107�020263� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin cairo-pong.rb - Ruby/GTK with cairo sample script. Original: gtkcairo sample by Evan Martins. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: cairo-pong.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require "gtk2" unless Gdk.cairo_available? raise "GTK+ 2.8.0 or later and cairo support are required." end module Pong class CenteredItem attr_accessor :x, :y attr_reader :width, :height def initialize(x, y, width, height) @x = x @y = y @width = width @height = height end def min_x @x - @width / 2 end def max_x @x + @width / 2 end def min_y @y - @height / 2 end def max_y @y + @height / 2 end end class CenteredCircle < CenteredItem def draw(cr) cr.translate(min_x, min_y) cr.scale(@width, @height) cr.arc(0.5, 0.5, 0.5, 0, 2 * Math::PI) cr.fill end end class CenteredRect < CenteredItem def draw(cr) cr.translate(min_x, min_y) cr.scale(@width, @height) cr.rectangle(0, 0, 1, 1) cr.fill end end class Ball < CenteredCircle attr_accessor :dx, :dy def initialize(dx=0.02, dy=0.02) super(0.8, 0.5, 0.04, 0.04) @dx = dx @dy = dy end def update @x += @dx @y += @dy # ball bouncing if max_y > 1 @y = 1 - (max_y - 1) @dy *= -1 elsif min_y < 0 @y -= min_y @dy *= -1 end if max_x > 1 @x = 1 - (max_x - 1) @dx *= -1 elsif min_x < 0 @x -= min_x @dx *= -1 end end end class Paddle < CenteredRect def initialize(field, x, y) super(x, y, 0.05, 0.3) @field = field end def update(ball) # is the ball coming towards us? if (ball.x < @x and ball.dx > 0) or (ball.x > @x and ball.dx < 0) # move to intercept it @y = ball.y end end def ball_hit?(ball) ball.y > min_y and ball.y < max_y end def update_ball(ball) if ball_hit?(ball) if ball.min_x < @x and ball.max_x > min_x # hit our left side ball.x -= (ball.max_x - min_x) ball.dx = -ball.dx elsif ball.max_x > @x and ball.min_x < max_x # hit our right side ball.x += (max_x - ball.min_x) ball.dx = -ball.dx end end end end class Field attr_accessor :width, :height def initialize(margin=0.05) @margin = margin @left_paddle = Paddle.new(self, @margin, 0.5) @right_paddle = Paddle.new(self, 1 - @margin, 0.7) @paddles = [@left_paddle, @right_paddle] @ball = Ball.new end def update @paddles.each do |paddle| paddle.update(@ball) end @ball.update @paddles.each do |paddle| paddle.update_ball(@ball) end end def draw(cr) cr.set_source_rgba(1, 1, 1) cr.rectangle(0, 0, 1, 1) cr.fill cr.save do cr.set_source_rgba(0.8, 0.8, 0.8, 0.8) cr.set_line_join(Cairo::LINE_JOIN_ROUND) @paddles.each do |paddle| cr.save {paddle.draw(cr)} end end cr.set_source_rgba(0, 0, 0) cr.save {@ball.draw(cr)} end end class Window < Gtk::Window def initialize(speed=30) super() @speed = speed self.title = 'Pong Demonstration' signal_connect('destroy') { Gtk.main_quit } signal_connect("key_press_event") do |widget, event| if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q destroy true else false end end set_default_size(260, 200) @field = Field.new @drawing_area = Gtk::DrawingArea.new set_expose_event vb = Gtk::VBox.new(false, 5) vb.border_width = 10 vb.pack_start(@drawing_area, true, true, 0) vb.show_all add(vb) Gtk.timeout_add(@speed) do @field.update @drawing_area.queue_draw unless @drawing_area.destroyed? end end def set_expose_event @drawing_area.signal_connect('expose_event') do |widget, event| cr = widget.window.create_cairo_context cr.scale(*widget.window.size) @field.draw(cr) end end end end Pong::Window.new.show_all Gtk.main ��������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/combobox.rb��������������������������������������������������0000644�0001750�0001750�00000003522�11701304107�020026� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin combobox.rb - Ruby/GTK sample script. Copyright (c) 2004-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: combobox.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end window = Gtk::Window.new("Gtk::ComboBox sample") window.signal_connect("destroy"){Gtk.main_quit} # # Text only # combo1 = Gtk::ComboBox.new ["foo", "bar", "fuga", "hoge"].each do |val| combo1.append_text(val) end combo1.active = 1 combo1.signal_connect("changed") do p "combo1: #{combo1.active}, #{combo1.active_iter[0]}" end # # Icon and text # model = Gtk::ListStore.new(Gdk::Pixbuf, String) [[Gtk::Stock::QUIT, "quit"], [Gtk::Stock::CANCEL, "cancel"], [Gtk::Stock::OK, "ok"]].each do |stock, name| iter = model.append iter[0] = window.render_icon(stock, Gtk::IconSize::MENU, "icon") iter[1] = name end combo2 = Gtk::ComboBox.new(model) # column 1 renderer = Gtk::CellRendererPixbuf.new combo2.pack_start(renderer, false) combo2.set_attributes(renderer, :pixbuf => 0) # column 2 renderer = Gtk::CellRendererText.new combo2.pack_start(renderer, true) combo2.set_attributes(renderer, :text => 1) combo2.active = 2 combo2.signal_connect("changed") do p "combo2: #{combo2.active}, #{combo2.active_iter[1]}" end # # Gtk::ComboBoxEntry # combo3 = Gtk::ComboBoxEntry.new ["foo", "bar", "fuga", "hoge"].each do |val| combo3.append_text(val) end combo3.active = 1 combo3.signal_connect("changed") do if combo3.active_iter p "combo3: #{combo3.active}, #{combo3.active_iter[0]}" end end # Show main window vbox = Gtk::VBox.new vbox.add(combo1).add(combo2).add(combo3) window.add(vbox).show_all Gtk.main ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/composited-windows.rb����������������������������������������0000644�0001750�0001750�00000007171�11701304107�022060� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin composited-windows.rb - Sample script translated from http://library.gnome.org/devel/gdk/unstable/gdk-Windows.html#composited-window-example Copyright (c) 2008 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. =end require 'gtk2' if str = Gtk.check_version(2, 12, 0) puts "This sample requires GTK+ 2.12.0 or later." puts str exit end unless Gdk.cairo_available? puts "This sample requires Cairo support." exit end Gtk.init # Make the widgets button = Gtk::Button.new("A Button") event = Gtk::EventBox.new window = Gtk::Window.new(Gtk::Window::TOPLEVEL) # Put a red background on the window window.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.parse("red")) # Set the colourmap for the event box. Must be done before the event box is realised. event.colormap = event.screen.rgba_colormap # Set our event box to have a fully-transparent background # drawn on it. Currently there is no way to simply tell GTK+ # that "transparency" is the background colour for a widget. event.app_paintable = true event.signal_connect('expose-event') do |widget, event| # This function simply draws a transparency onto a widget on the area # for which it receives expose events. This is intended to give the # event box a "transparent" background. # # In order for this to work properly, the widget must have an RGBA # colourmap. The widget should also be set as app-paintable since it # doesn't make sense for GTK+ to draw a background if we are drawing it # (and because GTK+ might actually replace our transparency with its # default background colour). # cr = widget.window.create_cairo_context cr.operator = Cairo::OPERATOR_CLEAR cr.gdk_region(event.region) cr.fill false end # Put them inside one another window.border_width = 10 window.add(event) event.add(button) # Realize and show everything window.show_all # Set the event box GdkWindow to be composited. # Obviously must be performed after event box is realised. event.window.composited = true # Set up the compositing handler. # Note that we do _after_ so that the normal (red) background is drawn # by gtk before our compositing occurs. # window.signal_connect_after('expose-event') do |widget, event| # This function performs the actual compositing of the event box onto # the already-existing background of the window at 50% normal opacity. # # In this case we do not want app-paintable to be set on the widget # since we want it to draw its own (red) background. Because of this, # however, we must ensure that we use #signal_connect_after so that # this handler is called after the red has been drawn. If it was # called before then GTK would just blindly paint over our work. # # Note: if the child window has children, then you need a cairo 1.16 # feature to make this work correctly. # # get our child (in this case, the event box) child = widget.child # create a cairo context to draw to the window cr = widget.window.create_cairo_context # the source data is the (composited) event box # NOTICE: next line generates a GTK warning, it is maybe a GTK problem, it is tracked # at http://bugzilla.gnome.org/show_bug.cgi?id=526965 cr.set_source_pixmap(child.window, child.allocation.x, child.allocation.y) # draw no more than our expose event intersects our child region = Gdk::Region.new(Gdk::Rectangle.new(child.allocation.x, child.allocation.y, child.allocation.width, child.allocation.height)) region.intersect(event.region) cr.gdk_region(region) cr.clip # composite, with a 50% opacity cr.operator = Cairo::OPERATOR_OVER cr.paint(0.5) false end Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/uimanager.rb�������������������������������������������������0000644�0001750�0001750�00000010012�11701304107�020156� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin uimanager.rb - Copyright (C) 2004-2006 Masao Mutoh Original version is demos/gtk-demo/ui_manager.c. This program is licenced under the same licence as Ruby-GNOME2. $Id: uimanager.rb,v 1.6 2007/07/12 14:53:09 ggc Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 4, 0) puts "This sample requires GTK+ 2.4.0 or later" puts str exit end if not Gtk.check_version(2, 12, 0) recentmenuitem = "<menuitem name='recent' action='recent'/>" else recentmenuitem = "" end ui_info = %Q[ <ui> <menubar name='MenuBar'> <menu action='FileMenu'> <menuitem action='New'/> <menuitem action='Open'/> #{recentmenuitem} <menuitem action='Save'/> <menuitem action='SaveAs'/> <separator/> <menuitem action='Quit'/> </menu> <menu action='PreferencesMenu'> <menu action='ColorMenu'> <menuitem action='Red'/> <menuitem action='Green'/> <menuitem action='Blue'/> </menu> <menu action='ShapeMenu'> <menuitem action='Square'/> <menuitem action='Rectangle'/> <menuitem action='Oval'/> </menu> <menuitem action='Bold'/> </menu> <menu action='HelpMenu'> <menuitem action='About'/> </menu> </menubar> <toolbar name='ToolBar'> <toolitem action='Open'/> <toolitem action='Quit'/> <separator action='Sep1'/> <toolitem action='Logo'/> </toolbar> </ui>] callback = Proc.new {|actiongroup, action| puts "`#{action.name}' is clicked. " if action.is_a? Gtk::ToggleAction puts "active? = #{action.active?}" end } callback_quit = Proc.new { p "Quit is called." Gtk.main_quit } callback_radio = Proc.new {|action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" } actions = [ ["FileMenu", nil, "_File"], ["PreferencesMenu", nil, "_Preferences"], ["ColorMenu", nil, "_Color"], ["ShapeMenu", nil, "_Shape"], ["HelpMenu", nil, "_Help"], ["New", Gtk::Stock::NEW, "_New", "<control>N", "Create a new file", callback], ["Open", Gtk::Stock::OPEN, "_Open", "<control>O", "Open a file", callback], ["Save", Gtk::Stock::SAVE, "_Save", "<control>S", "Save current file", callback], ["SaveAs", Gtk::Stock::SAVE, "Save _As...", nil, "Save to a file", callback], ["Quit", Gtk::Stock::QUIT, "_Quit", "<control>Q", "Quit", callback_quit], ["About", nil, "_About", "<control>A", "About", callback], ["Logo", "demo-gtk-logo", nil, nil, "GTK+", callback] ] toggle_actions = [ ["Bold", Gtk::Stock::BOLD, "_Bold", "<control>B", "Bold", callback, true] ] color_radio_actions = [ ["Red", nil, "_Red", "<control>R", "Blood", 0], ["Green", nil, "_Green", "<control>G", "Grass", 1], ["Blue", nil, "_Blue", "<control>B", "Sky", 2] ] shape_radio_actions = [ ["Square", nil, "_Square", "<control>S", "Square", 0], ["Rectangle", nil, "_Rectangle", "<control>R", "Rectangle", 1], ["Oval", nil, "_Oval", "<control>O", "Egg", 2] ] window = Gtk::Window.new("Gtk::UIManager sample") actiongroup = Gtk::ActionGroup.new("Actions") actiongroup.add_actions(actions) actiongroup.add_toggle_actions(toggle_actions) actiongroup.add_radio_actions(color_radio_actions, 1) do |action, current| puts "action = `#{action.name}'" puts "current = `#{current.name}'" end actiongroup.add_radio_actions(shape_radio_actions, 2, callback_radio) if not Gtk.check_version(2, 12, 0) action = Gtk::RecentAction.new('recent', 'Open Recent', nil, 'gtk-open') [ 'item-activated', 'activate' ].each { |signal| action.signal_connect(signal) { |action| puts "`Recent' #{signal}, uri=#{action.current_uri || 'no item selected'}" } } actiongroup.add_action(action) end uimanager = Gtk::UIManager.new uimanager.insert_action_group(actiongroup, 0) window.add_accel_group(uimanager.accel_group) uimanager.add_ui(ui_info) vbox = Gtk::VBox.new vbox.pack_start(uimanager["/MenuBar"], false, false) vbox.pack_start(Gtk::Label.new("Gtk::UIManager Sample")) window.add(vbox) window.set_default_size(100, 100).show_all window.signal_connect("destroy"){Gtk.main_quit} Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/togglebutton.rb����������������������������������������������0000644�0001750�0001750�00000001366�11701304107�020737� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin togglebutton.rb - Ruby/GTK sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: togglebutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::ToggleButton sample") window.border_width = 10 box = Gtk::VBox.new(false, 10) window.add(box) button1 = Gtk::ToggleButton.new("_button1") button2 = Gtk::ToggleButton.new("_button2", false) button3 = Gtk::ToggleButton.new(Gtk::Stock::QUIT) box.add(button1).add(button2).add(button3) box.pack_start(Gtk::HSeparator.new) close = Gtk::Button.new("close") close.signal_connect("clicked") do Gtk.main_quit end box.add(close) window.show_all Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/dialog.rb����������������������������������������������������0000644�0001750�0001750�00000002256�11701304107�017460� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin dialog.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: dialog.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::Dialog sample") button = Gtk::Button.new("Create Dialog") button.signal_connect("clicked") do dialog = Gtk::Dialog.new dialog.title = "Gtk::Dialog Sample" dialog.transient_for = window dialog.set_default_size(300, 300) dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample")) dialog.add_button("OK", Gtk::Dialog::RESPONSE_OK) dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL) dialog.add_button(Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE) dialog.set_default_response(Gtk::Dialog::RESPONSE_CANCEL) dialog.signal_connect("response") do |widget, response| case response when Gtk::Dialog::RESPONSE_OK p "OK" when Gtk::Dialog::RESPONSE_CANCEL p "Cancel" when Gtk::Dialog::RESPONSE_CLOSE p "Close" dialog.destroy end end dialog.show_all end window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit} Gtk.main ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/t-gtkplug.rb�������������������������������������������������0000644�0001750�0001750�00000002620�11701304107�020132� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin Sample script using Gtk::Socket and Gtk::Plug. $ ruby t-gtksocket.rb Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only. Copyright (c) 2003-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: t-gtkplug.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class MyGtkPlug def initialize(xid, plug) plug = "Button" if plug.nil? if xid.nil? @window = Gtk::Window.new("Gtk::Plug Test") @window.set_default_size(250, 50) else @window = Gtk::Plug.new(xid.to_i) end @window.window_position = Gtk::Window::POS_CENTER @window.signal_connect("delete_event"){Gtk.main_quit} @vbox = Gtk::VBox.new(true, 5) @window.add(@vbox) @button1 = Gtk::Button.new(plug) @button1.signal_connect("clicked"){ $stderr.puts plug} @button2 = Gtk::Button.new("Exit") @button2.signal_connect("clicked"){Gtk.main_quit} # Exit button to test an unexpected end of child process by Gtk::Socket @vbox.add(@button1) @vbox.add(@button2) @window.show_all end end xid = nil ARGV.each_index { |i| arg = ARGV.at(i) if arg == "-x" if arg.length > 2 xid = arg[2..-1] else xid = ARGV.at(i + 1) ARGV.delete_at(i + 1) end xid = nil if xid.to_i <= 0 ARGV.delete_at(i) end } MyGtkPlug.new(xid, ARGV.shift) Gtk.main ����������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/alpha-demo.rb������������������������������������������������0000755�0001750�0001750�00000003346�11701304107�020234� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin alpha-demo.rb - alpha blended window sample script. (need xcompmgr) Original: alphademo.py by Mike Hearn (*1) and David Trowbridge (*2) * (1) http://plan99.net/~mike/blog/2006/06/05/alpha-blended-windows-in-python/ * (2) http://david.navi.cx/blog/?p=91 Translated to Ruby by Juergen Mangler <juergen.mangler@univie.ac.at> Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: alpha-demo.rb,v 1.1 2007/01/06 03:55:44 ktou Exp $ =end require 'gtk2' require 'cairo' class AlphaDemo < Gtk::Window def initialize() super() set_app_paintable(true) set_title("AlphaDemo") set_decorated(false) set_default_size(200, 220) signal_connect("delete_event") do Gtk.main_quit end set_double_buffered(false) signal_connect('expose-event') do |widget, event| cr = widget.window.create_cairo_context rgba = [1.0, 1.0, 1.0] rgba << 0.0 if @supports_alpha cr.set_source_rgba(rgba) cr.set_operator(Cairo::OPERATOR_SOURCE) cr.paint twidth, theight = widget.size cr.set_source_rgba(1.0, 0.2, 0.2, 0.6) radius = [twidth, theight].min.to_f / 2 - 0.8 cr.arc(twidth.to_f / 2, theight.to_f / 2, radius, 0, 2.0 * Math::PI) cr.fill_preserve cr.stroke end signal_connect('screen-changed') do |widget, old_screen| screen_changed(widget, old_screen) end screen_changed(self) end def screen_changed(widget,old_screen=nil) tcolormap = widget.screen.rgba_colormap @supports_alpha = !tcolormap.nil? tcolormap ||= widget.screen.rgb_colormap widget.set_colormap(tcolormap) end end alpha = AlphaDemo.new alpha.show Gtk.main() ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/tree_combo.rb������������������������������������������������0000644�0001750�0001750�00000003713�11701304107�020336� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin tree_combo.rb - Gtk::TreeView and Gtk::CellRendererCombo sample script. Copyright (C) 2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: tree_combo.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end T_APPLICATION = 0 T_COMBO_TEXT_COLUMN = 1 T_COMBO_MODEL = 2 T_COMBO_HAS_ENTRY = 3 T_COMBO_EDITABLE = 4 T_COMBO_TEXT = 5 # The COMPUTER combo model combo_model = Gtk::ListStore.new(String) ["Ruby", "Perl", "Python", "Java"].each do |v| iter = combo_model.append iter[0] = v end # The table model. model = Gtk::ListStore.new(String, # T_APPLICATION Integer, # T_COMBO_TEXT_COLUMN Gtk::ListStore, # T_COMBO_MODEL TrueClass, # T_COMBO_HAS_ENTRY TrueClass, # T_COMBO_EDITABLE String) # T_COMBO_TEXT view = Gtk::TreeView.new(model) # 1st column(Text) trenderer = Gtk::CellRendererText.new tcol = Gtk::TreeViewColumn.new("Application", trenderer, :text => T_APPLICATION) view.append_column(tcol) # 2nd column(Combo) crenderer = Gtk::CellRendererCombo.new crenderer.signal_connect("edited") do |renderer, path, text| model.get_iter(path)[T_COMBO_TEXT] = text end ccol = Gtk::TreeViewColumn.new("Language", crenderer, :text_column => T_COMBO_TEXT_COLUMN, :model => T_COMBO_MODEL, :has_entry => T_COMBO_HAS_ENTRY, :editable => T_COMBO_EDITABLE, :text => T_COMBO_TEXT) view.append_column(ccol) # Create rows. (1..2).each do |v| iter = model.append iter[T_APPLICATION] = "application #{v}" iter[T_COMBO_MODEL] = combo_model iter[T_COMBO_HAS_ENTRY] = false iter[T_COMBO_EDITABLE] = true iter[T_COMBO_TEXT] = combo_model.get_iter("0")[0] end win = Gtk::Window.new win.signal_connect("delete_event"){ Gtk.main_quit } win.add(view).show_all Gtk.main �����������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/tree_progress.rb���������������������������������������������0000644�0001750�0001750�00000002425�11701304107�021102� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin tree_progress.rb - Gtk::TreeView and Gtk::CellRendererProgress sample script. Copyright (C) 2004-2006 Darren Willis, Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: tree_progress.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 6, 0) puts "This sample requires GTK+ 2.6.0 or later" puts str exit end win = Gtk::Window.new("Gtk::CellRendererProgress sample") win.set_default_size(300, 50) model = Gtk::ListStore.new(String, Float) view = Gtk::TreeView.new(model) prog = model.append prog[0] = "bar 1" prog[1] = 50 prog1 = model.append prog1[0] = "bar 2" prog1[1] = 5 prog2 = model.append prog2[0] = "bar 3" prog2[1] = 10 arenderer = Gtk::CellRendererText.new acol = Gtk::TreeViewColumn.new("words", arenderer, :text => 0) view.append_column(acol) prenderer = Gtk::CellRendererProgress.new pcol = Gtk::TreeViewColumn.new("Progress", prenderer, :value => 1) view.append_column(pcol) win.signal_connect("delete_event"){ Gtk.main_quit } win.add(view) win.show_all dir = 1 thr = Thread.new do loop { prog2[1] += dir if prog2[1] > 100 prog2[1] = 100 dir = - dir end if prog2[1] < 0 prog2[1] = 0 dir = - dir end sleep 0.01 } end Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/gnome-logo-icon.png������������������������������������������0000644�0001750�0001750�00000006022�11701304107�021366� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���0���0���W��� pHYs�� �� ~���tIME !??G�� IDATxmpnt@MIH͒]ܠ@"@Q8M@iE Ji+`U)*kkR-[B[Xmi$Vc /BD /aþI͋f_<3$ϹynKR7ѣG;` hDb#+cƌq*1J BΝ;ګk>!w*7Bzz=!b!e\RC%%n%% 1#R붅 B :)J)QvPXXX~> =JOdBK#SLq~sD'[J]_f~v!O`lycǽ<q"΢5BHJӡ6$&&չsqcK>9%ͬP^�%95Ms�4|(;NJ+0 �ސ__K@HQ)zo^uu^)X>/D{n˗ԧOo wy aO!)D?><B4H!m3Oǔ ШFnwnB hг7m͚�g!1߾;@LS>&iqgaqG@zDaH)RH֬^n�pKBb4ΝX eA%Ü՞aR!+ !(<R3YdPJr0짔"Ô0gU˕YZ?R*gfeAu˗Uyyî->B4.ȑ#ti+&xJ)-[+:)-n޼e z>,k*V)k(JOCi½5P6>UJPJlBH/P~>~Cr!d%gb@%X',<(bζY!hXB`QTdt96,<�_pR=,3H-6~/옹|HDdž \)Uo� !R#&i.COO掯/23j) @îkY`5UL!<Q.d0"GJ9똏wD4Ο?AW44G ^3w4Tl�lG~5Jy=% |ttii)2�$.Ko؀R !Ē<A҅kn1?<<T ,LhؔTN:q)I&'JsoD$#=uԴhS'HNMgG](95*@A,y3IMOSƧ-]`ОBw"N녤tzGF */"ƴLihk=..Ν` dўB#\0@BJF;`"=%Hb w�WUUս|ܵ4]tq$f:2R!IHH`c=@w8cM7ck8kd6c0$pE~ Gll6<9�Ԣ%-|3^pu�Xr&RX0#mZ(=pBĞB��R5#A~eU%+- ?-9WEEAEs !BBG[ ugVZuSu,"L&RO6kmFtk%esz8ܰEʻAŢaɶ;c^ &{ޝ/혬5S�ئ \jȴN xَ 69^?x@! dONz0Tܱ XcqCaO6lDNKg 1 * OooGLݳC+ B17\ꬿ)!^_ruz:E7[w/ucfiy'Lro ̠"}Ŝ{gs8}+uzozoBT^ćۦlS=gA`Ac,? B\+Z͡o#tq8s+[A1bq\Hw0om| ϯmHK R8ߴI�FXϮA]e`O2b_؀_9k&`͡t]y뙿Йu%wW5JF%%s/.]eoɞn^܊u !?M4Jn�eG u-w{[̡D#)KkeXp_@kmސB(yiO\5-Vf.p?s`K;@4ȏem,/eqQH_evg 깸iOoc8d6rw!aitu]Nw5=m9נn +d:K,P:Z :^r Dp[v@4r |2"'- oeϞwR‹[dƴA"6<Mk5,@Nm]|i7k{|깸wkoev?uwv3Oi)潸5#۟7v6\UHMon$(+)"ϒR:vwe7BQO{H[x!: go<~ϱ$^oNE^4 50tNo ER@Ms[et<" c(>":s^`ۏDBE2%<,u$NG] ͜?,k>#X.?2>;GȎET %;yZ!w`/$@T|uX-= ]54ů=|xd|ε!,{SWQ;-:#^R|GcԽ{uo''ZǜUnJ |ڪxՕ݋: @s[ӈT+Y0R<e[=29ɬǘPą> ÜWwXtÌJ/Ƶԇz?Gq)I����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/gdkscreen.rb�������������������������������������������������0000644�0001750�0001750�00000001266�11701304107�020166� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin gdkscreen.rb - Gdk::Screen sample script. Copyright (C) 2004-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: gdkscreen.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' screen = Gdk::Screen.default settings_map = [ "gtk-double-click-time", "gtk-dnd-drag-threshold", "gtk-can-change-accels", "gtk-color-palette", "gtk-font-name", "gtk-icon-sizes", "gtk-key-theme-name", "gtk-toolbar-style", "gtk-toolbar-icon-size", "gtk-im-preedit-style", "gtk-im-status-style", "gtk-cursor-blink", "gtk-cursor-blink-time", "gtk-theme-name" ] settings_map.each do |v| puts "#{v}: #{screen.get_setting(v)}" end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/style_property.rc��������������������������������������������0000644�0001750�0001750�00000000730�11701304107�021321� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* style_property.rc - Ruby/GTK sample rc file for style_property.rb. Copyright (c) 2004 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: style_property.rc,v 1.1 2004/01/25 15:52:38 mutoh Exp $ */ style "test-default" { bg[NORMAL] = { 0.80, 0.80, 0.40 } MyButton::focus-line-width = 3 MyButton::focus-line-pattern = "\10\2" MyButton::foo = 30 MyButton::bar = boat } class "MyButton" style "test-default" ����������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/linkbutton.rb������������������������������������������������0000644�0001750�0001750�00000001642�11701304107�020410� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin linkbutton.rb - Gtk::LinkButton sample. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: linkbutton.rb,v 1.1 2006/10/21 16:58:00 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::LinkButton sample") window.signal_connect("destroy"){Gtk.main_quit} vbox = Gtk::VBox.new # URI only button1 = Gtk::LinkButton.new("http://ruby-gnome2.sourceforge.jp/") button1.signal_connect("clicked") do puts button1.uri end vbox.pack_start(button1) # URI with a label button2 = Gtk::LinkButton.new("http://ruby-gnome2.sourceforge.jp/", "Ruby-GNOME2 Website") button2.signal_connect("clicked") do puts button2.uri end # Global setting instead of using clicked signals. Gtk::LinkButton.set_uri_hook {|button, link| puts "set_uri_hook: " + link } vbox.pack_start(button2) window.add(vbox) window.show_all Gtk.main ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/calendar.rb��������������������������������������������������0000644�0001750�0001750�00000002753�11701304107�017774� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin calendar.rb - Gtk::Calendar sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: calendar.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' cal = Gtk::Calendar.new w = Gtk::Window.new("Calendar sample") w.add(cal).show_all.signal_connect('delete_event') do Gtk.main_quit end date = Time.new cal.select_month(date.month, date.year) cal.select_day(date.day) cal.mark_day(date.day) #cal.clear_marks cal.display_options(Gtk::Calendar::SHOW_HEADING | Gtk::Calendar::SHOW_DAY_NAMES | Gtk::Calendar::NO_MONTH_CHANGE | Gtk::Calendar::SHOW_WEEK_NUMBERS | Gtk::Calendar::WEEK_START_MONDAY) year, month, day = cal.date puts "this is #{month} #{day}, #{year}" cal.signal_connect('day_selected') do year, month, day = cal.date puts "selected day: #{day}" end cal.signal_connect('month_changed') do year, month, day = cal.date puts "changed month: #{month}" end cal.signal_connect('day_selected_double_click') do year, month, day = cal.date puts "dclicked day: #{day}" end cal.signal_connect('prev_month') do year, month, day = cal.date puts "prev month: #{month}" end cal.signal_connect('next_month') do year, month, day = cal.date puts "next_month: #{month}" end cal.signal_connect('prev_year') do year, month, day = cal.date puts "prev_year: #{year}" end cal.signal_connect('next_year') do year, month, day = cal.date puts "next year: #{year}" end Gtk.main ���������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/textbuffer_serialize.rb��������������������������������������0000644�0001750�0001750�00000010516�11701304107�022444� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin textbuffer_serialize.rb - Ruby/GTK sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: textbuffer_serialize.rb,v 1.1 2006/11/23 08:39:13 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 10, 0) puts "This sample requires GTK+ 2.10.0 or later" puts str exit end current_folder = ENV['HOME'] || "." file_name = "serialized.dat" textview = Gtk::TextView.new textview.set_size_request(600, 400) buffer = textview.buffer buffer.text = DATA.read format = buffer.serialize_formats[0] buffer.register_serialize_target(nil) buffer.register_deserialize_target(nil) window = Gtk::Window.new("Gtk::TextBuffer Serialize Demo") vbox = Gtk::VBox.new serialize_button = Gtk::FileChooserButton.new("Serialize to a file", Gtk::FileChooser::ACTION_OPEN) deserialize_button = Gtk::FileChooserButton.new("Serialize to a file", Gtk::FileChooser::ACTION_OPEN) serialize_button.current_folder = current_folder deserialize_button.current_folder = current_folder toolbar = Gtk::Toolbar.new toolbar.append(Gtk::Stock::OPEN, "Deserialize from a file") do dialog = Gtk::FileChooserDialog.new("Deserialize from a file", window, Gtk::FileChooser::ACTION_OPEN, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) dialog.filename = File.expand_path(file_name) if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT file_name = dialog.filename File.open(file_name, "rb") {|io| buffer.delete(buffer.start_iter, buffer.end_iter) buffer.deserialize(buffer, format, buffer.start_iter, io.read) } end dialog.destroy end toolbar.append(Gtk::Stock::SAVE, "Serialize to a file") do dialog = Gtk::FileChooserDialog.new("Serialize from a file", window, Gtk::FileChooser::ACTION_SAVE, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) dialog.current_name = file_name if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT file_name = dialog.filename File.open(file_name, "wb") {|io| io.write(buffer.serialize(buffer, format, buffer.start_iter, buffer.end_iter)) } end dialog.destroy end toolbar.append(Gtk::Stock::CLEAR, "Clear all") do buffer.delete(buffer.start_iter, buffer.end_iter) end toolbar.append_space toolbar.append(Gtk::Stock::SELECT_COLOR, "Color the region") do dialog = Gtk::ColorSelectionDialog.new("Color the region") if dialog.run == Gtk::Dialog::RESPONSE_OK bounds = buffer.selection_bounds color = dialog.colorsel.current_color tag_name = color.to_a.inspect unless tag = buffer.tag_table.lookup(tag_name) tag = Gtk::TextTag.new(tag_name).set_foreground_gdk(color) end buffer.tag_table.add(tag) buffer.apply_tag(tag, bounds[0], bounds[1]) end dialog.destroy end toolbar.append(Gtk::Stock::SELECT_FONT, "Set a font to the region") do dialog = Gtk::FontSelectionDialog.new("Set font to the region") if dialog.run == Gtk::Dialog::RESPONSE_OK bounds = buffer.selection_bounds font = dialog.font_name unless tag = buffer.tag_table.lookup(font) tag = Gtk::TextTag.new(font).set_font(font) end buffer.tag_table.add(tag) buffer.apply_tag(tag, bounds[0], bounds[1]) end dialog.destroy end toolbar.append_space toolbar.append(Gtk::Stock::QUIT, "Quit this application") do Gtk.main_quit end vbox.pack_start(toolbar, false, false).add(Gtk::ScrolledWindow.new.add(textview)) window.add(vbox) window.show_all window.signal_connect("destroy") { Gtk.main_quit } Gtk.main __END__ This is a sample script for rich text serialization/deserialization. 1. Edit this text using font/color buttons. 2. Click save button and save this text (= serialize this as rich text to a file) 3. Click clear button and clear this text buffer. 4. Click load button and load the file which you save (= deserialize this). ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/toolbar.rb���������������������������������������������������0000644�0001750�0001750�00000002735�11701304107�017665� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin toolbar.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: toolbar.rb,v 1.11 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' window = Gtk::Window.new("Gtk::Toolbar sample") window.signal_connect("destroy") do Gtk.main_quit end toolbar = Gtk::Toolbar.new toolbar.append("Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal", Gtk::Image.new("test.xpm")) do toolbar.orientation = Gtk::ORIENTATION_HORIZONTAL end toolbar.append("Vertical", "Vertical toolbar layout", "Toolbar/Vertical", Gtk::Image.new("test.xpm")) do toolbar.orientation = Gtk::ORIENTATION_VERTICAL end toolbar.append_space toolbar.append("Icons", "Only show toolbar icons", "Toolbar/IconsOnly", Gtk::Image.new("test.xpm")) do toolbar.toolbar_style = Gtk::Toolbar::ICONS end toolbar.append("Text", "Only show toolbar text", "Toolbar/TextOnly", Gtk::Image.new("test.xpm")) do toolbar.toolbar_style = Gtk::Toolbar::TEXT end toolbar.append("Both", "Show toolbar icons and text", "Toolbar/Both", Gtk::Image.new("test.xpm")) do toolbar.toolbar_style = Gtk::Toolbar::BOTH end toolbar.append_space toolbar.append("Enable", "Enable tooltips",nil, Gtk::Image.new("test.xpm")) do toolbar.tooltips = true end toolbar.append("Disable", "Disable tooltips",nil, Gtk::Image.new("test.xpm")) do toolbar.tooltips = false end window.add(toolbar) window.show_all Gtk.main �����������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/fileselection.rb���������������������������������������������0000644�0001750�0001750�00000001173�11701304107�021043� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin fileselection.rb - Ruby/GTK2 sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: fileselection.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' puts "Deprecated. Use Gtk::FileChooserDialog instead." window = Gtk::FileSelection.new("file selection dialog") window.window_position = Gtk::Window::POS_MOUSE window.border_width = 0 ret = window.run if ret == Gtk::Dialog::RESPONSE_OK puts "OK" puts window.filename elsif ret == Gtk::Dialog::RESPONSE_CANCEL puts "CANCEL" puts window.filename end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/iconview.rb��������������������������������������������������0000644�0001750�0001750�00000001524�11701304107�020041� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin iconview.rb - Ruby/GTK2 sample script. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: iconview.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' TEXT_COLUMN = 0 PIXBUF_COLUMN = 1 model = Gtk::ListStore.new(String, Gdk::Pixbuf) iv = Gtk::IconView.new(model) iv.text_column = TEXT_COLUMN iv.pixbuf_column = PIXBUF_COLUMN Dir.glob("../gtk-demo/gnome*.png").each do |f| iter = model.append iter[TEXT_COLUMN] = File.basename(f) iter[PIXBUF_COLUMN] = Gdk::Pixbuf.new(f) end iv.signal_connect("item_activated") do |iv, path| iter = model.get_iter(path) p iter [0] end win = Gtk::Window.new("Gtk::IconView sample") win.signal_connect("destroy"){Gtk.main_quit} win.add(iv).set_default_size(300,300).show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/to_drawable.rb�����������������������������������������������0000644�0001750�0001750�00000001554�11701304107�020504� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin to_drawable.rb - Gdk::Pixbuf(GDK methods) sample script. Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: to_drawable.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' filename = ARGV[0] unless filename puts "ruby #{$0} filename" exit(1) end pixbuf = Gdk::Pixbuf.new(filename) w = Gtk::Window.new("Drawable sample") w.realize w.signal_connect('delete-event') do Gtk.main_quit end d = Gtk::DrawingArea.new gc = Gdk::GC.new(w.window) d.signal_connect('expose-event') do |w, e| unless e.count > 0 width = w.allocation.width height = w.allocation.height pixbuf = pixbuf.scale(width, height) d.window.draw_pixbuf(gc, pixbuf, 0, 0, 0, 0, width, height, Gdk::RGB::DITHER_NORMAL, 0, 0) end true end w.add(d) w.show_all Gtk.main ����������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/uimanager2.xml�����������������������������������������������0000644�0001750�0001750�00000001576�11701304107�020454� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <ui> <menubar name='MenuBar'> <menu action='FileMenu'> <menuitem action='New'/> <menuitem action='Open'/> <menuitem action='Save'/> <menuitem action='SaveAs'/> <separator/> <menuitem action='Quit'/> </menu> <menu action='PreferencesMenu'> <menu action='ColorMenu'> <menuitem action='Red'/> <menuitem action='Green'/> <menuitem action='Blue'/> </menu> <menu action='ShapeMenu'> <menuitem action='Square'/> <menuitem action='Rectangle'/> <menuitem action='Oval'/> </menu> <menuitem action='Bold'/> </menu> <menu action='HelpMenu'> <menuitem action='About'/> </menu> </menubar> <toolbar name='ToolBar'> <toolitem action='Open'/> <toolitem action='Quit'/> <separator action='Sep1'/> <toolitem action='Logo'/> </toolbar> </ui> ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/misc/assistant.rb�������������������������������������������������0000755�0001750�0001750�00000023017�11701304107�020233� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin test-assistant.rb - Ruby/GTK version of testassistant.c from gtk+ 2.10 sources. Guillaume Cottenceau for the ruby-gnome2 project. Copyright (c) 2005,2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: assistant.rb,v 1.1 2006/11/23 08:39:12 mutoh Exp $ =end require 'gtk2' if str = Gtk.check_version(2, 10, 0) puts "This sample requires GTK+ 2.10.0 or later" puts str exit end class AssistantRunner def initialize @simple_assistant = nil @generous_assistant = nil @selected_branch = "A" @nonlinear_assistant = nil @full_featured_assistant = nil end def run_simple_assistant @simple_assistant = run_assistant(@simple_assistant, :create_simple_assistant) end def run_generous_assistant @generous_assistant = run_assistant(@generous_assistant, :create_generous_assistant) end def run_nonlinear_assistant @nonlinear_assistant = run_assistant(@nonlinear_assistant, :create_nonlinear_assistant) end def run_full_featured_assistant @full_featured_assistant = run_assistant(@full_featured_assistant, :create_full_featured_assistant) end private def run_assistant(assistant, assistant_create_method) assistant ||= send(assistant_create_method) if !assistant.visible? assistant.show else assistant.destroy assistant = nil end assistant end def add_completion_test_page(assistant, text, visible, complete) page = Gtk::VBox.new(0, 0) check = Gtk::CheckButton.new("Complete") page.add(Gtk::Label.new(text)) page.add(check) check.active = complete check.signal_connect('toggled') do complete = check.active? assistant.set_page_complete(page, complete) end page.show_all if visible assistant.append_page(page) assistant.set_page_title(page, text) assistant.set_page_complete(page, complete) page end def create_test_page(text) Gtk::Label.new(text) end def prepare_cb(assistant, page) if page.is_a?(Gtk::Label) puts "prepare: #{page.text}" elsif assistant.get_page_type(page) == Gtk::Assistant::PAGE_PROGRESS progress = page.child assistant.set_page_complete(page, false) progress.fraction = 0.0 Gtk.timeout_add(300) do page = assistant.get_nth_page(assistant.current_page) progress = page.child value = progress.fraction = progress.fraction + 0.1 continue = value < 1.0 assistant.set_page_complete(page, true) unless continue continue end else puts "prepare: #{assistant.current_page}" end end def create_simple_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect('cancel') do puts "cancel" assistant.hide end assistant.signal_connect('close') do puts "close" assistant.hide end assistant.signal_connect('apply') do puts "apply" end assistant.signal_connect('prepare') do |_assistant, page| prepare_cb(_assistant, page) end page = create_test_page("Page 1") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 1") assistant.set_page_complete(page, true) page = create_test_page("Page 2") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 2") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) end def create_generous_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect('cancel') do puts "cancel" assistant.hide end assistant.signal_connect('close') do puts "close" assistant.hide end assistant.signal_connect('apply') do puts "apply" end assistant.signal_connect('prepare') do|_assistant, page| prepare_cb(_assistant, page) end page = create_test_page("Introduction") page.show assistant.append_page(page) assistant.set_page_title(page, "Introduction") assistant.set_page_type(page, :intro) assistant.set_page_complete(page, true) page = add_completion_test_page(assistant, "Content", true, false) next_page = add_completion_test_page(assistant, "More Content", true, true) check = Gtk::CheckButton.new("Next page visible"); check.active = true check.signal_connect('toggled') do puts "beuh" next_page.visible = check.active? end check.show page.add(check) add_completion_test_page(assistant, "Even More Content", true, true) page = create_test_page("Confirmation") page.show assistant.append_page(page) assistant.set_page_title(page, "Confirmation") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) page = Gtk::Alignment.new(0.5, 0.5, 0.9, 0.0) page.add(Gtk::ProgressBar.new) page.show_all assistant.append_page(page) assistant.set_page_title(page, "Progress") assistant.set_page_type(page, :progress) assistant.set_page_complete(page, true) page = create_test_page("Summary") page.show assistant.append_page(page) assistant.set_page_title(page, "Summary") assistant.set_page_type(page, :summary) assistant.set_page_complete(page, true) end def create_nonlinear_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect('cancel') do puts "cancel" assistant.hide end assistant.signal_connect('close') do puts "close" assistant.hide end assistant.signal_connect('apply') do puts "apply" end assistant.signal_connect('prepare') do |_assistant, page| prepare_cb(_assistant, page) end assistant.set_forward_page_func do |current_page| retval = -1 if current_page == 0 if @selected_branch == 'A' retval = 1 else retval = 2 end elsif current_page == 1 || current_page == 2 retval = 3 end retval end page = Gtk::VBox.new(false, 6) button = Gtk::RadioButton.new('branch A') page.pack_start(button, false, false, 0) button.signal_connect('toggled') do @selected_branch = 'A' end button.active = true button = Gtk::RadioButton.new(button, 'branch B') page.pack_start(button, false, false, 0) button.signal_connect('toggled') do @selected_branch = 'B' end page.show_all assistant.append_page(page) assistant.set_page_title(page, "Page 1") assistant.set_page_complete(page, true) page = create_test_page("Page 2A") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 2A") assistant.set_page_complete(page, true) page = create_test_page("Page 2B") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 2B") assistant.set_page_complete(page, true) page = create_test_page("Confirmation") page.show assistant.append_page(page) assistant.set_page_title(page, "Confirmation") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) end def create_full_featured_assistant assistant = Gtk::Assistant.new assistant.set_default_size(400, 300) assistant.signal_connect('cancel') do puts "cancel" assistant.hide end assistant.signal_connect('close') do puts "close" assistant.hide end assistant.signal_connect('apply') do puts "apply" end assistant.signal_connect('prepare') do |_assistant, page| prepare_cb(_assistant, page) end button = Gtk::Button.new(Gtk::Stock::STOP) button.show assistant.add_action_widget(button) page = create_test_page("Page 1") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 1") assistant.set_page_complete(page, true) #- set a side image pixbuf = page.render_icon(Gtk::Stock::DIALOG_WARNING, :dialog) assistant.set_page_side_image(page, pixbuf) #- set a header image pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog) assistant.set_page_header_image(page, pixbuf) page = create_test_page("Invisible page") assistant.append_page(page) page = create_test_page("Page 3") page.show assistant.append_page(page) assistant.set_page_title(page, "Page 3") assistant.set_page_type(page, :confirm) assistant.set_page_complete(page, true) #- set a header image pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog) assistant.set_page_header_image(page, pixbuf) assistant end end runner = AssistantRunner.new buttons = [ [ 'simple assistant', proc { runner.run_simple_assistant } ], [ 'generous assistant', proc { runner.run_generous_assistant } ], [ 'nonlinear assistant', proc { runner.run_nonlinear_assistant } ], [ 'full featured assistant', proc { runner.run_full_featured_assistant } ], ] if ENV['RTL'] Gtk::Widget.default_direction = Gtk::Widget::TEXT_DIR_RTL end window = Gtk::Window.new(Gtk::Window::TOPLEVEL) window.signal_connect('destroy') { Gtk.main_quit } window.signal_connect('delete-event') { false } box = Gtk::VBox.new(false, 6) window.add(box) buttons.each do |label, callback| button = Gtk::Button.new(label) button.signal_connect('clicked') do callback.call end box.pack_start(button, true, true, 0) end window.show_all Gtk.main �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/����������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�016421� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/pixmap.rb�������������������������������������������������0000644�0001750�0001750�00000003313�11701304107�020244� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header pixmap.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/18 17:13:32 $ $Id: pixmap.rb,v 1.5 2005/07/18 17:13:32 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class PixmapSample < SampleWindow def initialize super("pixmap") vbox = Gtk::VBox.new(false, 0) add(vbox) button = Gtk::Button.new vbox.pack_start(button, false, false, 10) label = Gtk::Label.new("Pixmap\ntest") boxbutton = Gtk::HBox.new(false, 0) boxbutton.border_width = 2 boxbutton.add(Gtk::Image.new("test.xpm")) boxbutton.add(label) button.add(boxbutton) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, false, 10) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/fontselection.rb������������������������������������������0000644�0001750�0001750�00000003005�11701304107�021620� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header fontselection.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: fontselection.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by Neil Conway <neilconway@rogers.com> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class FontSelectionSample < Gtk::FontSelectionDialog include Sample extend SampleClass def initialize super('Font Selection Dialog') set_window_position(Gtk::Window::POS_MOUSE) signal_connect('destroy') { destroy } ok_button.signal_connect('clicked') { puts font_name destroy } cancel_button.signal_connect('clicked') { destroy } end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/menu.rb���������������������������������������������������0000644�0001750�0001750�00000003376�11701304107�017723� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header menu.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: menu.rb,v 1.6 2005/07/18 17:13:32 mutoh Exp $ =end require 'sample' class MenuSample < SampleWindow def initialize super("menus") signal_connect("delete_event") do true end box = Gtk::VBox.new(false, 10) add(box) menubar = Gtk::MenuBar.new box.pack_start(menubar, false, true, 0) menu = create_menu(2, true) menuitem = Gtk::MenuItem.new("test\nline2") menuitem.set_submenu(menu) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("foo") menuitem.set_submenu(create_menu(3, true)) menubar.append(menuitem) menuitem = Gtk::MenuItem.new("bar") menuitem.set_submenu(create_menu(4, true)) menuitem.right_justified = true menubar.append(menuitem) optionmenu = Gtk::OptionMenu.new optionmenu.set_menu(create_menu(1, false)) optionmenu.history = 4 box.add(optionmenu) box.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} box.add(button) button.set_flags(Gtk::Widget::CAN_DEFAULT) button.grab_default end private def create_menu(depth, tearoff) return nil if depth < 1 menu = Gtk::Menu.new group = nil if tearoff then menuitem = Gtk::TearoffMenuItem.new menu.append(menuitem) end for i in 0..4 j = i + 1 buf = sprintf("item %2d - %d", depth, j) menuitem = Gtk::RadioMenuItem.new(group, buf) group = menuitem.group menu.append(menuitem) menuitem.set_sensitive(false) if i == 3 submenu = create_menu(depth - 1, true) menuitem.set_submenu(submenu) unless submenu.nil? end menu end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/entry.rb��������������������������������������������������0000644�0001750�0001750�00000003270�11701304107�020111� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header entry.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002,2003 Ruby-GNOME2 Project Team $Id: entry.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class EntrySample < SampleWindow def initialize cbitems = [ "item0", "item1 item1", "item2 item2 item2", "item3 item3 item3 item3", "item4 item4 item4 item4 item4", "item5 item5 item5 item5 item5 item5", "item6 item6 item6 item6 item6", "item7 item7 item7 item7", "item8 item8 item8", "item9 item9" ] super("entry") box = Gtk::VBox.new(false, 5) add(box) entry = Gtk::Entry.new entry.text = "hello world" entry.select_region(0, 5) box.add(entry) cb = Gtk::Combo.new cb.set_popdown_strings(cbitems) cb.entry.text = "hello world" cb.entry.select_region(0, -1) box.add(cb) editable_check = Gtk::CheckButton.new("Editable") box.add(editable_check) editable_check.signal_connect("toggled"){ entry.editable = editable_check.active? } editable_check.active = true visible_check = Gtk::CheckButton.new("Visible") box.add(visible_check) visible_check.signal_connect("toggled"){ entry.visibility = visible_check.active? } visible_check.active = true sensitive_check = Gtk::CheckButton.new("Sensitive") box.add(sensitive_check) sensitive_check.signal_connect("toggled"){ entry.sensitive = sensitive_check.active? } sensitive_check.active = true box.pack_start(Gtk::HSeparator.new, false, true, 5) button = Gtk::Button.new("close") button.signal_connect("clicked"){ destroy } box.add(button) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/3DRings.xpm�����������������������������������������������0000644�0001750�0001750�00000007504�11701304107�020426� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * DRings_xpm[] = { "48 48 65 1", " c None", ". c #104010404103", "X c #1040208130C2", "o c #104014515144", "O c #000010402081", "+ c #1040104030C2", "@ c #208120815144", "# c #28A241035965", "$ c #30C230C26185", "% c #208130C24103", "& c #104010402081", "* c #104000002081", "= c #000010401040", "- c #492441036185", "; c #596559659E79", ": c #30C220815144", "> c #0820186128A2", ", c #000000001040", "< c #2081104030C2", "1 c #514459659658", "2 c #514455556185", "3 c #104000001040", "4 c #000008200000", "5 c #618569A6AEBA", "6 c #618569A69658", "7 c #410345148E38", "8 c #104020814103", "9 c #79E782079658", "0 c #208120814103", "q c #596571C69E79", "w c #4103514471C6", "e c #2081208130C2", "r c #6185618571C6", "t c #28A228A25965", "y c #596561858617", "u c #96589E79BEFB", "i c #28A230C271C6", "p c #38E345145144", "a c #79E78207A699", "s c #30C2492469A6", "d c #410330C25965", "f c #410351446185", "g c #AEBAAAAAD75C", "h c #38E338E34103", "j c #EFBEEBADEFBE", "k c #208130C25144", "l c #9658A289DF7D", "z c #208110404103", "x c #28A228A26185", "c c #8E388A28BEFB", "v c #208118612081", "b c #38E3451479E7", "n c #4924618579E7", "m c #86178617B6DA", "M c #30C220814103", "N c #104030C25144", "B c #4103410371C6", "V c #86178A28D75C", "C c #DF7DDB6CE79D", "Z c #BEFBC30BD75C", "A c #410330C271C6", "S c #30C228A230C2", "D c #082008201861", "F c #186130C238E3", "G c #0000208130C2", " .Xo ", " O+O@#$% ", " &*=+X-;: ", " >&=,=<11#2 ", " +O34,X567& ", " 8X+=,90q9w. ", " +e<>3r tyu-& ", " Xi%.= paus+ ", " Od-@= fga$h ", " @y7X, Xrjak ", " 2:eaw+ $ag;@ ", " .X@8@k@o@X+ +pl9tO ", " +zX@x$$isikt8o02crv ", " 8@%ip7757ywbs$Ohn6#. ", " &0%$p7r215ybw1pzp2-0= ", " 8tk$#yw21665n;1+%-p$O ", " O<e7pbryq5am9ay6XMpM>3& ", " 9.NtpBw16amclVcm1t%kX*88 ", " +&etd7r6y9ulgglm6>e>3s@83 ", " +0k$y-y69cgCCCZVam%+#ik8X ", " O&oi$d725amgCjCZu962ybtx8+p ", " &X0x$sBym9VZCCCZca;yBbi%08& ", " =++@sApMy5muZZgum6y2wds:>+& ", " #tp;1;yB#i25cVucma5;w-pti@8& ", " .#2alumnBp:@1r59y9y6ywBS$%0X+= ", " %$wmZVu;#tX8X07r1656y2wbp$k@%@OD ", " 0Byc9a;h%0>&D&hBrr2r1bwB-AF:0<&*= ", " kBf;yr#@X+&<%MkhsBwBwpsB#Bktkt8+Oh ", " xt7B-t8*,3O.X00:$i#dBd#bptFek0X.+* ", " Xt#b#@=, =&O+X0Ft%ibsp$p$ki%l5sX&= ", " &<kvX&4 +O*&<X0e:%$pAti%:edugn0= ", " +X@&+, V,O&>+Xt>tktktv0%@k;Cls+ ", " =+O*4*X:p;9cy3&&8ve0FMtt$ee0>z7cZ6k ", " D=D4,=.k$sBs$ee=+X0Fk%-#t%0X&O0nu9bG ", " ,,434*&ze@F<eeeeee><tdhdSMe<&&XAaawx ", " 4,4,=+><peeeeee&=<%M%$hSF0X&O&kw5r%Z ", " D&vSFMF<>&D =0S-2i& ", " +>puB> >0h7s. ", " SM5VqM &0t#$8 ", " XpVV70 &0kMk. ", " XdyB%z *X<%@+ ", " &k$b0X+=8X08o ", " &e:e+=*X.X+& ", " +X.O+X0O.=, ", " +>&+0>3&* ", " &X0k+O, ", " >v,3 ", " "}; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/savedposition.rb������������������������������������������0000644�0001750�0001750�00000004265�11701304107�021644� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin savedposition.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: savedposition.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class SavedPositionSample < SampleWindow Pos = [ 0, 0 ] def initialize super("Saved Position") move(Pos[0], Pos[1]) set_default_size(200, 100) set_border_width = 5 vbox = Gtk::VBox.new add(vbox) hbox1 = Gtk::HBox.new hbox1.border_width = 5 vbox.add(hbox1) label = Gtk::Label.new("X Origin : ") label.set_alignment(0, 0.5) hbox1.add(label) x_label = Gtk::Label.new("") hbox1.add(x_label) hbox2 = Gtk::HBox.new hbox2.set_border_width(5) vbox.add(hbox2) label = Gtk::Label.new("Y Origin : ") label.set_alignment(0, 0.5) hbox2.add(label) y_label = Gtk::Label.new("") hbox2.add(y_label) signal_connect("configure_event") do x, y = window.root_origin Pos[0] = x Pos[1] = y x_label.text = x.to_s y_label.text = y.to_s false end vbox.pack_start(Gtk::HSeparator.new, false, true, 10) button = Gtk::Button.new("Close") button.signal_connect("clicked"){destroy} vbox.add(button) button.can_default = true button.grab_default end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/rulers.rb�������������������������������������������������0000644�0001750�0001750�00000001775�11701304107�020274� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header rulers.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: rulers.rb,v 1.9 2005/07/18 17:13:33 mutoh Exp $ =end require 'sample' class RulerSample < SampleWindow def initialize super("rulers") set_default_size(300, 300) set_events(Gdk::Event::POINTER_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK) table = Gtk::Table.new(2, 2, false) add(table) hruler = Gtk::HRuler.new hruler.metric = Gtk::CENTIMETERS hruler.set_range(100, 0, 0, 20) vruler = Gtk::VRuler.new vruler.set_range(5, 15, 0, 20) signal_connect("motion_notify_event"){ |w, e| vruler.signal_emit("motion_notify_event", e) } table.attach(hruler, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::FILL, 0, 0) signal_connect("motion_notify_event"){ |w, e| hruler.signal_emit("motion_notify_event", e) } table.attach(vruler, 0, 1, 1, 2, Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) end end ���ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/check-y.xpm�����������������������������������������������0000644�0001750�0001750�00000000533�11701304107�020473� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 10 9 5 1", /* colors */ ". c None", "# c #000000", "i c #ff0fff", "y c #ff1f00", "# c #9f9f9f", /* pixels */ "..........", "........yy", ".......yy.", "......yy..", ".yyy.yy...", "..yyyy....", "...yy.....", "..........", "..........", }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/testgtkrc�������������������������������������������������0000644�0001750�0001750�00000006216�11701304107�020363� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..." # # include "rc-file" # # style <name> [= <name>] # { # <option> # } # # widget <widget_set> style <style_name> # widget_class <widget_class_set> style <style_name> # testgtkrc2 sets all the buttons in the main window to blue by default include "testgtkrc2" #include "/usr/local/share/themes/Pixmap/gtk/gtkrc" #include "/usr/local/share/themes/Redmond95/gtk/gtkrc" #include "/usr/local/share/themes/Metal/gtk/gtkrc" #include "/usr/local/share/themes/Notif/gtk/gtkrc" #include "/usr/local/share/themes/Default/gtk/gtkrc" #pixmap_path "." style "defaultfont" { # fontset = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*,*" font = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,*" } # common default class "GtkWidget" style "defaultfont" style "window" { # bg_pixmap[NORMAL] = "marble.xpm" } style "scale" { fg[NORMAL] = { 1.0, 0, 0 } bg_pixmap[NORMAL] = "<parent>" } style "button" = "default" { # fg[PRELIGHT] = { 1.0, 1.0, 1.0 } # bg[PRELIGHT] = { 0, 0, 0.75 } # bg[PRELIGHT] = { 0.75, 0, 0x00 } } style "toggle_button" = "button" { fg[NORMAL] = { 1.0, 0, 0 } fg[ACTIVE] = { 1.0, 0, 0 } # bg_pixmap[ACTIVE] = "check-y.xpm" # bg_pixmap[NORMAL] = "check-n.xpm" } style "text" { bg_pixmap[NORMAL] = "marble.xpm" text[NORMAL] = { 1.0, 1.0, 1.0 } fg[NORMAL] = { 1.0, 1.0, 1.0 } base[NORMAL] = { 0.0, 0.0, 0.0 } } style "slider" { fg[NORMAL] = { 1.0, 1.0, 1.0 } bg[NORMAL] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0 ,0.0, 0.5 } bg[PRELIGHT] = { 0.75 ,0.75, 1.0 } } style "ruler" { font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*' } style "curve" { fg[NORMAL] = { 58000, 0, 0 } # red } style "red-bar" { bg[PRELIGHT] = { 0.95, .55, 0.55 } } # override testgtk2, introduce the green color in the button list style 'button_list' = 'button' { font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" bg[PRELIGHT] = { 0, 0.75, 0x00 } } widget "main window.*GtkScrolledWindow.*GtkButton*" style "button_list" class "GtkScrollbar" style "red-bar" widget_class "GtkWindow" style "window" widget_class "GtkDialog" style "window" widget_class "GtkFileSelection" style "window" widget_class "*Gtk*Scale" style "scale" widget_class "*GtkCheckButton*" style "toggle_button" widget_class "*GtkRadioButton*" style "toggle_button" widget_class "*GtkButton*" style "button" widget_class "*Ruler" style "ruler" widget_class "*GtkText" style "text" widget "*GtkCurve" style "curve" binding "test1" { bind "<ctrl>1" { "debug-msg" ("jup!") } } binding "test2" { bind "<ctrl>1" { "debug-msg" ("hallo and") "debug-msg" ("huhu") } } # possible priorities are (in ascending order): # lowest # gtk (used by gtk for internal class bindings) # application (for hard coded bindings on application basis) # rc (used implicitel by rc files) # highest class "GtkCList" binding "test1" # implicit : rc #class "GtkWindow" binding : highest "test2" # override "rc" priority binding "clist-test" { bind "j" { "scroll-vertical" (step-backward, 0.0) } bind "k" { "scroll-vertical" (step-forward, 0.0) } } class "GtkCList" binding "clist-test" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/testgtk.rb������������������������������������������������0000644�0001750�0001750�00000011021�11701304107�020426� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin header testgtk.rb - testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2006 Ruby-GNOME2 Project Team $Id: testgtk.rb,v 1.16 2006/06/17 13:18:12 mutoh Exp $ Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end $:.unshift(File.dirname(__FILE__)) require 'gtk2' require 'sample' require 'button' require 'checkbutton' require 'togglebutton' require 'radiobutton' require 'buttonbox' require 'toolbar' require 'statusbar' require 'reparent' require 'pixmap' require 'tooltips' require 'labels' require 'layout' require 'menu' require 'scrolledwindow' require 'entry' require 'spinbutton' require 'colorselect' require 'dialog' require 'range' require 'rulers' require 'notebook' require 'shapedwindow' require 'wmhints' require 'progressbar' require 'gammacurve' require 'savedposition' require 'filesel' require 'fontselection' # # Main Window # def create_main_window buttons = [ ["button box", ButtonBoxSample], ["buttons", ButtonSample], ["check buttons", CheckButtonSample], ["color selection", ColorSelectionSample], ["dialog", DialogSample], ["entry", EntrySample], ["file selection", FileSelectionSample], ["font selection", FontSelectionSample], ["gamma curve", GammaCurveSample], ["labels", LabelSample], ["layout", LayoutSample], ["menus", MenuSample], ["notebook", NotebookSample], ["pixmap", PixmapSample], ["progress bar", ProgressBarSample], ["radio buttons", RadioButtonSample], ["range controls", RangeSample], ["reparent", ReparentSample], ["rulers", RulerSample], ["saved position", SavedPositionSample], ["scrolled windows", ScrolledWindowSample], ["shapes", ShapesSample], ["spinbutton", SpinButtonSample], ["statusbar", StatusbarSample], ["toggle buttons", ToggleButtonSample], ["toolbar", ToolbarSample], ["tooltips", TooltipsSample], ["WM hints", WMHintsSample], ] nbuttons = buttons.size window = Gtk::Window.new window.name = "main window" window.set_default_size(200, 400) window.move(20, 20) window.signal_connect("destroy"){Gtk.main_quit} box1 = Gtk::VBox.new(false, 0) window.add(box1) label = Gtk::Label.new("Gtk+ v#{Gtk::MAJOR_VERSION}.#{Gtk::MINOR_VERSION}.#{Gtk::MICRO_VERSION}") box1.pack_start(label, false, false, 0) label = Gtk::Label.new("Ruby/GTK2 v#{Gtk::BINDING_VERSION.join(".")}") box1.pack_start(label, false, false, 0) scrolled_window = Gtk::ScrolledWindow.new(nil, nil) scrolled_window.border_width = 10 scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) box1.pack_start(scrolled_window, true, true, 0) box2 = Gtk::VBox.new(false, 0) box2.border_width = 10 scrolled_window.add_with_viewport(box2); box2.focus_vadjustment = scrolled_window.vadjustment buttons.each do |title, sample_class| button = Gtk::Button.new(title) unless sample_class.nil? button.signal_connect("clicked"){|obj| sample_class.invoke } else button.sensitive = false end box2.pack_start(button, true, true, 0) end box1.pack_start(Gtk::HSeparator.new, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked") do window.destroy Gtk.main_quit end box1.pack_start(button, false, true, 5) window.show_all end def main srand Gtk::RC.parse("testgtkrc") create_main_window Gtk.main end if $DEBUG $stderr.sync = true Thread.start do loop do STDERR.print("+") GC.start sleep(1) end end $stderr.puts("#{$0}: started GC-thread for debugging.") # timeout Gtk.timeout_add(1000) do $stderr.print("*") true end end main puts("#{$0}: done.") ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/tooltips.rb�����������������������������������������������0000644�0001750�0001750�00000002162�11701304107�020624� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin tooltips.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: tooltips.rb,v 1.6 2005/07/21 17:47:19 mutoh Exp $ =end require 'sample' class TooltipsSample < SampleWindow def initialize super("Tooltips") set_default_size(200, -1) set_border_width(5) tooltips = Gtk::Tooltips.new button = Gtk::ToggleButton.new("button1") tooltips.set_tip(button,"This is button 1", "ContextHelp/buttons/1") button2 = Gtk::ToggleButton.new("button2") tooltips.set_tip(button2, "This is button 2. This is also a really long tooltip which probably won't fit on a single line and will therefore need to be wrapped. Hopefully the wrapping will work correctly.", "ContextHelp/buttons/2_long") vbox = Gtk::VBox.new(false, 10) vbox.add(button) vbox.add(button2) vbox.add(Gtk::HSeparator.new) button4 = Gtk::Button.new("close") button4.signal_connect("clicked"){destroy} vbox.pack_start(button4) tooltips.set_tip(button4, "Push this button to close window", "ContextHelp/buttons/Close") add(vbox) end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/marble.xpm������������������������������������������������0000644�0001750�0001750�00001115707�11701304107�020425� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *granite07[] = { /* width height num_colors chars_per_pixel */ " 384 384 16 1", /* colors */ ". c #000000", "# c #111111", "a c #222222", "b c #333333", "c c #444444", "d c #555555", "e c #666666", "f c #777777", "g c #888888", "h c #999999", "i c #aaaaaa", "j c #bbbbbb", "k c #cccccc", "l c #dddddd", "m c #eeeeee", "n c #ffffff", /* pixels */ "aacfedbbcbbaaaaaaaaabaabaaaaabcbcbbbabbchfdcccbbabbbaaabaabcbaa#aa#######a#aaaabcddeefhec##dgbabbaaadabbcfbaa##########aaabbaaa#a#####a#aa###a#aaabbbbcbbbccdedaaaaa#aaaaa#a#abaaabbabbbeddbbaaaaaca##a#aaaba########aaaadcababbabdehd.##.a######.cgdcb###b##.##.##aaaaa####abcba######a##aac#a##a####aa#aa##babbbcfccbbbcdccccecbbbcbbbcdccddcbcdfeecbhhjihhgffc.aaa####.#######aaaaaaaabbaaaaa", "aaacedccbbcbaaaaaa#bbaabbbaaaabcaabbbbbbafhfccbbbbbbabacbacbaaaaa##########a###abbcdeghhhcagb#ababaaccbacdfca#a####aa###aaaaabaaa#####aca#aabaababbcccccccbcdfdaaaa###aaaaaaaaaaabbbbbbccccccbbcbcaaa##aaaaabaaaa###abdaccceebaaaabehja####a######..#aeec#bb##########aa#####abba#########aaca########aa#aa###aaaabddbbbbbbbbbbccbbabbbbabbabbabcbcbcefhfeddccefhhijheecb#...a####aaaaaaaabaaaaa", "aaabccccccdbabcbaaa#aaaaaaaaaaabbabbbbbccabefdccabcbbabacccbaaabaa######a######aaabceiiiihije#bbabbaaeaabcedcaabaa########aaaabaa##a###ab#aabcababbccccccdeeeecc#a##a##aaaaaaaaaabbbbbbbcccbbbdcbbcdaa#a#aabbaaaaa###acbaa#bccaa#abcfig.#######.#######acddgefdda#######a########a#######aaaaaa#a######aaaa#####aaacdcbabbaaabbbcaaaaaaaaabbbaaabbaabbbcbcbabbabcdeefghjkjgc#..####aaaaaaaaaaaa#", "#aaaaaacbccbcabbbaaaaaabcaaaaabbbbbbabbbcbaabffccbccbccbbcbaaaabaaaa#aa#aa##a#aaaaabbikkjhijicabbbcc#faaacdebcbda#########aaaaaaaaa####aa##cacccabcccdccccdddfdcbaa##a##abbbabccbbcbbbccccaaa#abbaaba#a##abbbbbaaaaaaaaaaccaaca##aabcfic.###aa#######a####bddeeddb####.##.###aaa#########aaaa###aa####aaaa#######aabdbbbbcabbbaaaa#aaaaaaaaabaaabbbaabbbbdbbaaabccccccdcefhhkhda##aaaa#a#aaaaa##", "#aaabaabcecbaa##bcaaaaaaaababbabaaabbabbaabb#chhfdccccbcbecaaabaaaaaaaaaa####aaaaaaabdgjkkijijdabbdcabfaabcecbbec###########a#aaaabaa#######abbaaaadddedddeeefeccaa###a#aabcccdcbcbbbbccbbbbaaaaa#aabbaaaabbbbbbaaaaaaabbbbbaaa####acegha##a#aabbb####a##adccdedbcc#######.###a###a#######aaa#a#aa##..#aa#########abdbaabbabbbaa###aaaaaaaaaaaaacbaaababbdbabbabcbbcbcbccbbdegjkgb#aa#aa#aaaaaaa", "##aa#aabccccaaaaaaaa#aaaaaabbaabbbaaaaabbbcbbcfhhgfcccbbbbccbaabbaaaaaaabaa#aaaabaaaabbcehkljjdabacccbgbaaccdb#adea#########aa#abaaaaa#####ac#ba##accdedddefffeaba##a#aaaaacccccccbbbcccaabaaaaaaaaa#aaaaabcbbaaa#bbbbaaefccdbaaa#aaacdei##aa##aabbbaaa#a#cdcccccbcea.#########bbaaa######a###a#aaaa.#aaba####.###abcbaaabaabbbaa###aaaaaaaaaaaabbaaaaaaaaaaababcbbcbbaabbbdddeghheba##ab#abaa##", "#####bbaaaaabaaaaa##aa#adccaabaaabbbbabbabbbabccbccfdbccbbbbbcaabcaabaaabbaaaaaaaaaaaabbbcglli#accbbbddgabcddbbaacea#a##########aaa#aaa##aaaa####aabcddeeefffgdbbaaaa###baabbbbbbcdabdcbcaaabaaaaaaa#aaaaaabcbbbbadfbbbaejhhebbccaaaaaccfi.aba##abaaaba####ecbbccba#fc.####.##.bba#a#######aaaaaaaaaaa##aaaa######abcdaa#aaaabaaa###aaaaabaaabbbaaba##aaababcbbcbbbbbcbaaabbccccddgggeb#aadca###", "#####bcaaaaaabcbaaa#aaaabcccaaaaaaabaaabbbbbbbaacbabeeddddccbcbbcccbabaaaabaabaaaaaaaaabbbbglmdbcbaabebdgdbcecbbaabdbaa#########aabbaaaa#aa#a##a#aabbdceeedccdcbbaaaaa##aaabbcbbbabaaabbababbaaaa#aaaaaaaabcdccbbbabcbbbcfijfbcdcabb#abcbif#abb##aaabaaaa##fcccbbcaa#db#..##.##.aaa#########ab#aaaaaa#aabaaaaa#####abdbbaaaabbaaaa###b#a#aaaabaaaaaaaaaaaaaabbabbbbaabbbaaaabbbbbbbceffecccbaa##", "#####abaaaaa#accbbbbaaabaaaaaaaaaaadcbaabbabbbabbdcaacgfddddcdddcadfcaaaabcbbabaaaaaabcabbbdjliacbababcbdfcdeeaaaaaabba########a##aa#aabaa##a######abddeggca#bcbaaaaaa####aaaaaabbbbbcbbbbbaaa##a#aaaaaaaabcbccbbaaaabaabfgfiecccccbbaaaccicbbbcbaaabaaabb#ceccccdca##aacdb######aaa###a###aabaaaaaa#aabca#abba#####abca##aaaaaaaaa##a##aaaaaaabaaaaaaabaaaacbcbacdbaaabaaaaaabaaaaabbcddccbaa##", "####aa#aaaaaaabccbabbaaaaaaaaaaaaabfaaabbcbbbbbabdebaabdffddedefedccecccdcbbbbbccbccbbbbbbccekldaabaaabccbfaaaaaaaaaaaba########aaaaaaaaba##aaa###aabbccfgfaababbbaaaaa#aabbaabaaccaabcccbcbaa##aaaaaabaabbbccbbbaabbbbbbdddghdbbbcccb#abcdebcccbaabbbabbcbaecddddbaa##.#acdeca#######a#aaaaaaaaaaaaaaabba##abba####aacba##aaaaaaaaaaaaa##aba#abaaaaaaabaaaabbbbbbcbabbaabbaaaaabaaaaaaaaccbaa##", ".####aa#aabaa##bccbaabbbba#aaaaabbaefdaabbbbccbbbaddaaabadeeffhhhffdedddeecbbbbcccbbabcbabbcfjjlkeaaaaacdadcaa#aaaaaaa#ab######ba#aaabbabcaa#aa###babcddcedba##acbaaaaaa#ababbbacbbbcccdfffbaa#aaaacbaabcbabccbbcbbbbbbcbbccedbbbccdccbaabcgb#bccbbbababbbcccdededcb#a####...addcba##aabbbbbbbbaaaaabba#aaa##abba####abbaa###a#aa#aa##aaa#a##abaaaaaaaaabababbcdbcb#baaaaaaaaaaaaaaaaaa#aaaaa###", "######a##aaaaaa#accbaaabbbaaa#aaababdcaaabbbbcccbbbdbabbbacdccgecadbbbcdccddeddcccccbaabcbbcgjhhjgeb#aacdcccaa#aa#aaa#a#aaa##aaaaa#aaabbaabb#aa###aabccddeccbbbaabcbbbcbbb#aacbbadbabcccddbaaa#aaaaabbbbabbbbcdbbbabbcddcbbbccaabbbccbbaaaadi##abbbbbbbaabbbacdeedbd######aa####bceda#aabbabaaaaaaaaba#aaaaa#aabaaa###acaaaa####aa##aaaaaaaa#aaaaaaaaaaababaaaaabcaaaaaaabbcbaaaaaaaaa###aaaa###", "##########aabaa#accbbabbbbbba##aaaabbcbbbbbbbbcbaaabdbbbbbbddccbbbbaaaabbabbbbcefefdcbaadbcddje#debgfbabecdc####aa##a###a#aa#aa##a##aaabbcabbaa###aabbcceedbcbaaaabdcccbabaaabbbbabbccbbaaaaaa#aaaaaaaabbbbbcbccabcccccdcccbbbbabbababbba#abfe#aaaaaaaabccbbaaaedddc######adcaaaa##dfcaaaaaaaaaa#aaaaa##aabcaaabbaa#aaab###aa###aaaaaaaaaaaa##aaaaaaaaaabaaabaaabcabaaaaaaabcbaabaaa##a###aa####", "#########aaaaaaabbcbbbbabcbaacbaa##aaabaaabccccccbaabecabbbcddbacdeba#aaaaabaaabbdfgedcbaccdcgica#aadghdbddd#aa#aaa#a###aaaabaa#####aaaaabbbbbba#aaabccceecbddbaa#bbccabcbbbbbacccdbbdabbaaaaaaa#aaaa#aabbbbcccdcbcbbccccccbcaababbdbabbba#bbgaabaaa#aaacccdcddbeedba#a##a#aba#aaaa##decbaaba#aaa###a#a###abba#bba###aaba####a####aaaaaaaaaaaa#aaabbbaaabbaabbaabbaaa#aa#a#abbaabbbaaa#aaaa#####", "############aaaaaaacbbbbbbbaa#aaa#a##aaaaaaaacbbbbbbabdcabbbcdbaccdba#aaaaaababbcbbdddedccddefihaa#aaahiiiffd#aaaa#abaa##aaaaacaa##a#bcaaaabbbcaaaabccdddecabaaaaacbbbabbccccccbbdbdfdaabbaaa###a#aaaaaaaabbbbbbbaaabdcddccbbbbabbbccaabbbaabfdaaabaa#aa##aabbbbbddba##aa#a#aa##aaaaaabcdbbaaa##aa#####a#aaabbaaaaa##abb######aa###aaaaaaaaaaaaaaaaabaaaaaaaabbbbaaabaaa#aaaaaaabbbaaaaaaaaa####", "###########aa#aa#aaaccabbaaaaaaabb#######a#aaabcbbbabbaeebbccbcbacdaaa##a#aabbbbccbbcbcdegifdfgifba##aaaagigha#aaaaabbaaaaaaaaabaaa##acaaaaabbbbbbabcdddefeba####abbaabccccbbbcbadcbcbaabba#aaaa#aaaaaababacccbaadbabbccedcccbbccbbabaaaaa##ade###abba#aa##abbba#cebb.#a####.#a#aaaaaaaaacfca#aaa###aa###abaabaaaaaaaabbaa#######aaaaa#aa#aaaaaaaaaaababdaaabbbbbababaaaaaa#aaaaaabbaaabaaaaa###", "##########a#aaabaaaaccaaaaaaabaaaaaaba###a##abaaabbababaccbcbbcccaaba#a###aaabbccdccccccdeegggfigaabb#aaa#fffcba#abbaaaaaaaaaaa#abba##aaa##aabbbcbbbbcdeegfeb####aabaabacbbbcbccaabbabaaaaaaa##aa#aaaaababbabbcbcdbbcccbddcdcccabcbbababba###afba#aabba#acaaabbbbaddb##aa####.####aabbaaaabffcaaaaaa##a##bcabbaaaaaaabbbc#a#a#######aaaaa#####a##ababbbbbaaaabbcbaaaaaaaaaaa#aaaaaabaaababaaaaa#", "#######a#####a#aaaaabcbaaaaaa#aabaaaaaa###abbabaaaaaccaaabdbccbccbaaca#####accddcccccccddeeefikjeabcca#a#abfifbaa#abbbbbaaaaaaaaa#bbba#bcaaaaaaaccbcccceffeccaa##aaabbbcabbacbddbbaabdbaaaaaaaaaaaaaaabbbaabbbbbbbbbcbbccccdcdcccabbbbbaaba###dcaaaabbaaabaabcbccaadba#aaa########aaaa##aaaacgdbaaaa####cfffda#a#aaaabbdbaa#aaa########aaaa#aa##aaabbabbbaaabbbaaaaaabaaaaaaaa#aaaaabaaaaaaaaa#a", "a###########aaaaaaaabbaabaaa###abaaa#a##a###a#aaaaabacaaabccbbbcbbbcbb####a#bdfbbccccccdefecdgiiddaabbaaaabacfeaaaaaabcccbaaaaaaabaaacaa##aaaaaaabccddcfgfgbabaaa#aaabbcccbccbcddbbacabbbbbbbbaaacbaaaabcbabbbbbcbbcbccbccdccdccdcbaabbbaabaaade#aa#baaabaa##abbcbacdb#.#abbccc#.##aaa####aa#aeeaaaaaaabbabddfgfba#aabcd#aaaa########aa##a##aaaaaababbaabbbbbabccbababaaaaaaa##a#aaaabbaaaaaaaa#", "#a###a######aaaaaaaacdaaaaaaaa#aaaaaaaaaa#####a###abbbbaaaaccbbbcbbbbaa#aaaaaeecabcccbccdedcdfgigeaaaacbaaabaacbaaaaaaabcbbbaaaaaaaaabccaaaaaaaaaacccceffffbabb#a####aaaabcccccddcdedbbbbaabcabbbccbccbcbcbbbbbbbbbcecbccccceccccdccbbaaaaaaabce#bbaaa###aaa##ababcacda#abb##a#######a#########bfdca#abcbaabaabcffddbabdc#aaaaa##########aa####aaaaaaabbabbbbbbbcbbbcbaaaaaaaa#aa#aaaaaabaa##b##", "##a#########aabaaaabcdbabaaaaa##aaaaabaaba######a##ababbbbbabbbbcbcdddbbaa#abceecabccccccdddfedgjgdbaaabaaabbbaaba#aabaabaccaaaaaaaabbccbbbaaabaaabcddefgfebbbb#aa####aaaabbcccccbbfeccbbbaaababbbbbbbccba#abbbabbcdccdcbddcddcccdcddcbaaaaaabcfbadaa#######a#abbacbbcc###a#a########a######a##aabdcabccbbababaaaacdfededbbaa#aa##aa######ba#aa#aaabbabaababcbbcbcbbbabbaaaaaaaa##aaabaaacba#a##", "##########a#abaaaaabbbcbbbcaa###a#aaaaa##aba#######aaaaaabbdccbaabccdddecaaaabccdbbacccddcdefdfgiifcba#bbaaabbaaaababbbbbbbabbaabaaaacbbbcbbaaaaaaaceeeefffbaaaa###a##aaaabbcbbbddcddddcbcbbaaabbbbababbabaaabababbbbcccdccddcddccccdecaaaa#abccfbbaaa#######aabbaacabe###a#aa#a#a##.aa#######a#aa#cfeecdcccccabbbabacggcabbaaabbaaaa####aabb#aaaabbababbbbbbcccbbbbbcccbbbaaaa#aaaaaababbaaaa##", "######a####abcbaaaaabbccbcbaa###a##aaa##a###aa######aaaaaabdgebaaabbbccacbaaaaabbbaaabccddcdeeffgigbaaaaaabaabcaaababbbbaabbacbaaabbaaaababccbabbabbdffefhdcaaa###aaabba#aababcbdeeccceccccbababbbbabbabbaaaaaabbaabbcbcccccdcddddccccdcaaaababcdeaba#####.###aaabaab#b####a####a##aa#b########aaaaabedddcccccaaaabbcabeaaaabbccbaaa#abbaaabbbaaaabbbaaacbcbcbbdccbaabbacbbbbbaaaaaaaaabbaa#####", "######aaa#abbcbaaaaabdccbbaaa#######aaa#####aaa##a#a##aaaababcbbaaaaabdebbbaaa##aaaaaaaabccddeefggieaaaaaaaacabaabbbabbbbaaaabbaaaaaaabbbabbccbaabbbdfgghebbbaa#####abba#aabbbcbccdcbbbcddcccbbbabbabbbabbabaaaaaaacbbabcbbccccddddccbcccaaaaaabbdcbc##########aaacbbaa####a####aa###a#aa###aaa###abbceddedcccbaaaacccdca##a#abbbabaaaabaaabbba#aabbbbbbccbbbbaaacccbbcbbaaabbbbbbabaaabaaaa####", "#######aa#aaccabbabaabdecbb#a########aaaa####aaa#aba##a#aaaaaaabbdcaabdcbcaacb####abb#abaabccdeffghfdabaaaa#acbbbbcbabcabcbaaaabbbabaaaabbbbbcccbbbccdfedccbbb#########aaaababbacccbcbbbddbdcccccbbbbaaaabbaabbaaaaabaabbbbccdcceedccccacbaaaabbbbddb####aa######aabbaa####a####aa#aa###a#####aa#aabbddeccddccbbbabbbbceb###aa#aaaaaa##aa####aaaa#abbbbbccacccbaa#accbbbbbaaababbabaaaaaaaaa####", "##a#####aaaaaabbbbabacdddccaa########aa#a#####aaa#aa#aaaaaaaaaaaabcabbcbbbbababa###baaaaaaabccdeeehifbabaaa###abbcbbcaccbcbbbaabbbbabaaabbbbbbbbcccccddbccbbbbba#######aaabbbaabbcccbdcbbdbbddcdcccbabaabaaaaaaaaaaaaaaaabbcccddecccbbacccbbbaabbbceca############aaaaa#############a#############aaaaabccddcbbbabbbbbbba#####a##a####aaa#######aaa#babaabbcbaaa##abbbaabbcbbbbaaaaaaaabbaaa####", "#########abaaabbabbbbbddeccca##aa######a#aa####bbaaaaaaaaaaaaaaaaaabccbcccebacfdb#####aaaaaaabcdddcfgfccbaa##a##abcbbcbbdcccccabbabaababbbbbbbbbbcdccddbabbbbbba########aaababbbacdccccaabcbbcabddddbbaaabbabbbaaaaaaaaabbbddcddecbccbbbdcbabbbaabbcda#############abaaaa############a####bb##a####aaaaabcffdcccbbbbbbbb#######aaa###aaaa#######aabaaaabbcbaaaaaaaa#aaaaaabbccbbaaaaaabbbaaa####", "#########aaabbabcbbbbbdddcbaaaaa###############aabaaaa#aaaaaaaaaaabbabbdefffccbba###aa##aaaaaabcdceecggdcbbaa##aa#aacbb#bcdddddabbbbbabbbabbbbbbbccfeedbbbbbbcbba#a#####a#acababbbdcbcbabbabaabaabeedcaaaaaaaabcbbaaaaaaabbcdfdddccbbbbcbccbabbbaaabcda########a#aaaaaaa#aa#####aaabaaaaaaacb##aaa#aaababbcdefddbbcbccbaa#####aaaaaaaab##a########aa#abbcccbaaaaaa###aaaaabaabccbbbaaaaaaaaa####", "########aaaaaaabbbbbbcdedbbbbabaa##########aa###bbb###a##aaaaaaabbaabbbdfeedb##a#a##aa###aaabbbbccdefbfecbbbaaa####a#adb#acdecdfcbaabcbbbbcbbbbbbcdeffbcccabbcdbbba#a###a#aabaaaaaccccbaaaaabbbbaabdfedaaaababbbbbaaaaaaababbcedcccbbbbaccccbaaaccbbabeb######aaaaa#aaa###a######aaaaaaabacbca#aaaaaabbbbccdegfeccccccbcbaaa#####aaaa#aaaaa###a###aaaabbbcccb##a#aaa#aaaaaaaabbdeddcbabaaaaa####", "#########a#aabbbbbbbbdddccbbba#aaaa##aa##a####a#bba#a#a#aaaabaabbbabbeedeeefdaaaa#####bb##aaabbabcddehgifffdcbaaaa#aa#aaaaaccdeddcabbbcbbbccbabbccdceeecdcaaaabbcccaaaaaaaaaaaaaabacdddbaabaabbbbcccccfdbaabbaabbcaaaaaaababbcccccbbbbbbbccbcca#acbbbbbda#####aaaa####ab##a######aaaaaaabaccbaaaaabbbbbbccceffcdeedcbbbbaaaa#aaaaaaaaa#aaabaaaaaa##aaaabbbcbbcbaa#####aaaaaabbbcccddcbbaaaaa####", "##########a#aabbcbcbbcecccbbbabaaaaaa#####a#aaaabbaa##ba#acaaababbbbbbbcdcfgdbbbaa####aba##aaaabbbccdfefhfgedecaaa##abaaaaacbabebbbbbbbbcccbcbbbbddbedbddcaaaaaabdccaaba#aaaaaa#bbbbbaddccaaabcbbdcbbcbddabbbbbbbccaaaaaaaaabcddcbbbbbbbbbbbbbbaaaabbaabe#########a####bb#aa#####aa#aaaabccdbbbbabbcbbbccccdccbaaeffdbca#aaaa#aaaaaaa#aaaaabaaaa#aaaabaabbccbbcceb#bcaaaaaaaabbbbcdcbbbaaaaa####", "#######aa#aaaaabbccbbcdccddcabaaaaaaaaa###aaa#aabcaaa#bba#aabaabbbbbbabcccdfedcaa##aaa######aaaabbbbcdddghhgfedcbaaaa#aaaaabcbbbccbbbbbbbcbccdcccccbeebccbbbaaaaaccccccba#aaaaaaabaaabbbddbbbbcccbcccbaceeacbbbcbccbaaabbabbbbceccbbbbbabbbbbbbab#aabbbbcc#.######a####.bcbcba####aaaa#bedccbbbbbbbaabccddedaaaaa##beeda#aaaaaaaaaaaaaaaaaaaaabba##babbabbbbcbbbccccbbaaaaabbabaabddcbbbaaaa####", "##########aaaabbbbccccbcddddbaaaa##a#a#a###aaaa#baabbaaaaaaaabbbabcbaabccbddfebaaba#ba######aaaabbbbbcddfiiigggedbaaaaaaaaaabcbabccbbbbbbbcccddddccceecccccbbaaaabccddbbba#aaaaaaaaabcbbbcccdccbcbabcbabceecbabbbbbbaaaabaabbbcddbbbbbbbbaabbbcbbbbaaabcbdc########..####ccccba#abbaaaabddbabbbcabbbbcccceeca###aaa##aaa##a#aaaaaaaaaaaaaaaaaaaaa##aabcbbbbbbbccbbbbcddaaaaacbaaaabddbbaaaaaa###", "############aaabbabcddccdbcdcbcbbbaaaaa##a##aaaa##abaaabaaaaaaabbaacaabddabcefc#aabaaa###a####aaabbbbbbddgihhfffgeaaaaaaaaaaaaabbbcbbbbbbbbbcddeeedceccdcccccaaaaabcbddbaa#a#ab#aaacbbbbbbddebbbbccbbbabbbedbaaaaaaaaaaaabbabbccecbbbbccbbbbaabbbbcc#aaabbcc######a#####.bccabbacbababaabdcabbbabbabbbcbdecabaa##aaaa####aaaaba##aaaaabaaababa##aa#aaabbbbbbbbcbbbbacbedbaaa#bbaaaabcbbbbaaaa#aa", "#######a####aaaaabaabbcccbabbbbbbbcbaaa######a#aa######aaaa#aaa#acbbbabeeebabddbaaabaa####aa#a#aababbbbbcehhgeeffdca##aaaaaaaaaabbbbabbbbbbcdcdddfgfhcbbcbbbcbaaaaabcccdbba###baaaabcbbaabcdeecaaabbbbbbaabddecaaaaaaaabbbbbbbccfcbcbbbbbbbaaaaabbbcca#aabacc#######a####acdcbbbbbbaaaabbccaabbbbbbbabbceecabb#aa#aaaa#######aaa##aaaaaaabbaaaaaaaaaaaabbbaabccbbcbaaacgdaaaa#aababbbabbbbaaaaa#", "###a#####a#aaaaaabcbacbbddcaaabbbbbbbaaaaaa##a#####a####aaaaa#aaabdbcbbedefcaaabaaaaabaaa#a##abaaaaababbbcfgggfeefea##aaaaaaaaaaabcbbbbbbbbcdcdddefgeabbbbaabccaabaaceddeeaaa##aaaaaabbbabbcdedbabbbaaaaaaaacfecaaaaabaabbbbbbcdfdbccbbbbbaaaaaabbbcdbaa#aabdb#########a#acdcccbaaab#aabccbbbbbbabbbceedccbcbbaaaa#baa#a###a#a##aa###aaaabaaaaaaaa##aaaabbaaabcbbbbbabbdfeaaaa#ababbcbbaabaaaaaa", "#####a#####aaaaaabbbbbbbcddcbabccaaabbaaaaa#a##a##a######aaaaaabaaaaacbbbffeaaaababbabbbbbaa##bbaaaabbbbcccghghgeffbaaabbaaaaaabbabccbbbbbbcdddefggecccbabaaabbbacbabbdddecbaa####aabaababbcccdcabaa#aaa###abceedcaaaaabbbbccddefdccdccbcbbaaaaabbccdccdb#abbd###a#####a#a#cddcccaaaaaaaaabccbbbbdeefbba##aabaaa#aaaaaa#aa###aaa##a####aaaaaaaaaaaa##aaaabacbabbbbbcbbbbcfgbaaa#aa#abbab#aaaabba", "##########abaaabbbbbcbcdcccdcbbbcbbbbbba#aaaaa#a############aa#aaaaaaababbdeaaaacbbbbbddcbaaa##abaaaabbbbcccghhhedecababcbaaaaaababcbbbbbccbddceggffecccbbbaaabca#aaaadddedcb#a##aaaabbbabbbbcccdd###aaaa#aa##bcefeddcddccefdddfdcccccccccbbaaaaaabccccdddaabbda########ab##bbbddcbbaa#aaaabcbbbcdddccaaaaa#abaaaaaaaaaa#aa#aaaabaa#####aaaaaaaa#######aabaacbabbbbbbcbbbbdfbbaaaa###baabaabaaba", "###########aaaabbcbbbcccbddbcdccbbbbcabbaaaaaaaaa###a##aa###aaaabaaababbccbbdb#abccabddbbbba#aaaabdbbaabbbbcdehihbaabbbbcdcbbbbaababbedcbbaccdddeeefedabbabaaa#aaa#aa#beeeeffca###aaabbbcbbbbbbcced#a###a##aaa#abffgfedcccfhcbdebcbccdccccbbaaaaaabbcccccddbaabdcb#.#aa#aaa##abdddcbbbaaababbbbbcbdbabbbbbb##ababbbaaaaa#aa#aa##aaa######ababaaa#####a#aabcbbbabbbbbbcccbbbeabcbba###aaaaaaaaaab", "b#########aaaaababbbbabbbbdebcccccbbbabaaaaaaaaaaaa########aa#abbaaabbabbdbcbbbaaadcbcbdbabba##aa##abcb#aaabcdcfhgdabbbccdcbcbbbbbbabcgdcbdbbdedeeehfgdbbbbbaaaa#aaa#abddddgeedcaaaaaabbbdccccccbceeaa###a###aaaacfghhgedccggefbccccccccccbbbbbbaabbcccccccdaabaaccb#aaa###a##adedccbcbaaabbbbcbbcddbaaabbbbaadbbaabbaaa##abaaa#aaaaaaaa#aaabaa########abbadccaaabbbcccccbbdcbcbbba###aaaaaaaabb", "aa##########aaabbbbbbbaabbaccbceeebbaabbaabaaabbbbaaa###aaaba#aabaaaaababbccggcbaabccbbbccbca##aaaabdbbabbabbcdddghbabbccddcbbbcbbbbbccgfcbccceddddeddedddcbababaaaaaa#accdeffedbaaaaaaaacccccbbbccffb#a#####aaaaabfhgghhhhgghecbccbccccccccbbbbaaabbbbcbbbcdcbbabbcb#####abca#abccccccabbbbbbbbbdddbaaaaabab#cdba#aabaaaaaaaa#aaa#a#aa#####aaaa#######aabbbbccbbbabbdeddcbbeaabbcb###aaaaaaaaab", "baaa######a#aaabaabdbbcbabbaccccedaaaaaaaaaaaaaaadbaa#aaaa##aaaaaaaaabbbcbcccdbaaaaabdcbacbcdcaaaaaaaabaaccbbccdddhgcabcccdecbcbbcbbabadedbbcdedcddeeccdddeeedcbbcbaabbbabbcddddec#aaaaaabbcccccbccdffc##a##a#aaaaaafheffhgeccefcbbcbcccccccbbbbaaabbbbccbbddedbabbcc.##a##abc###cdcccbcbbbabbbaddccababbbaaabaddba##aaaaaa#aaa#a#aaaaa##aa##aaaa#######abbbbccbcbbbbdefeeccecaaaaa####aabaaaaaa", "bb#a########aabbbaaababcccdaacdbbaba#aaaaaa#aaa##acaa###aa#aaaaaaaaaaabcdcccaaaaaaaaadbcbbbbacc###aaaaaaaacbbccdcdfggbbbcccdecccddcbbbacdfdbcdebbbcccdcccccdcbefccbaaaaabcbbccabdfcaaaaaaabbdddccccccefe##a##aaaaaaaadfghhhdbbcccccbcbbccdccbbbcaaaabbbbdccddeeba#bbda######.acabbddccabcbbbbbbbddccaaaaaaaaaaabdca#a#aaa#aaaaa##a#aaaaa##aa##aaa#a##a##abbbbccbbdbbccefffeccd#a########abaaaaaa", "aa##########aaaaabaabbaaccdcaacbbaab####aaaa#aaaaaa#a####abaaaaaaabcaaabddcacda#aaabacbbbbddddcbaaa##aaaaa#abbdcccdegfbbcdcdefccddccccbcbbfdccecabccbcbbbcdddcbffdcccb#aacbaabcbbeecaa#aaaabcedddccccddfeb#####aaaaaabbehhfcccbcccccbbccccccbcbcbbaaabbbcdcceddcbbabba########bcbbcdcbbbbbbbbaacccccaaaaaaaaaaaabcba####aba##aaaaaa#aaaaaa##a#aaaaaaa#aaabaabbcbbbbbbbdffffeeeaa########aabcaaaa", "aba#a#aa####aaaaabbabbabbaccaaabaaaa#######a####aaaaa####aaa#bbaaaabaaacbddcbccaaaaaaaaaaacdeabcbba#a###a#aaabccccdeegfcbcdddeedcdccddccccfedddcbbccbbbbbbccddedecccdca#aaaaaaabacedcddcbabaabccccccccceccd####aaaaaabaacdghhfecccccbbccccccccbcbbbaabbbcccccddcddceaca########cdccdccbbbbbbbbbccbcdcaaaaaaaaaaaaaaba#####aaaaaaa###aaaaa##a####aaaa###aabbbbbbccbdbbbcdefffgaa#a#######aabaaaaa", "aa#####aa###aaababbccccbbbbcbaaababa#######a#aabaaaaaa####aa#abbaaaabbaabbdcbbcdbbbbaaaaaabcddbcbba#####a#aaabcdccceefhgbbdcceeeeccccccddeefeeecccacccbcbabbccdefdbcebaaaabaababbbcdcdfffdabbbbbcccccccecade#aa#aabaaaabaackijkidbbbcbccccccccbcbbbbaabbccccccccddegfdaa#######ceedcbbcaacccccbcccccbaaaaaaaaaabaaaaaaaaa####aaa.baa######aaaa####baaa#aaaabbbbbccdcbbcddedfgfb##########abbaaa#", "#a########aaaaaaccbbcdcccbbbba#aaaaaa#####aa#aaab#aaaa#.###aa#aabababcbabaccbccdedaaaa#aaaaabccacbaa#a######aacbcccdffhigeccccdeedddccbcddffdefcbabbbcdecbabbbbcddecddbbaaabbabbbcccddeeffabbabbbbcccccdecdedb#a#aaabbaaaaahifgikfcbcccccccccccbbaaabbcbbbccbbbbcccdhea#a#####aedfebccccbbcbcccccccbaaaaaabaa#aaaaaaaaaba#b###aaa#b#######a####aa##abbbabaaabbbbbcdecbbcdedefghc#########abcedcb", "a############a#abcbbbcddccbbbcaaaaaa#a####a#a###ba#aa#######aaba#bbbbbccaabcccddeebaaaa##aaaabaaabaaaa#####a#aaaabcbdeggihfccccdddffdcbcccdfcbcbbbbbbccbbbbabaabcdfebcbbca##aabbbbcdcdfffeeaabbbccbbcccdeeddeed##aaabaaaaachgcccfijebbcccccccccbbaaaaabbbaabbaabbcbbcfecaaa#aaadcddbbdcccabbcccbbbabbaaaa#aaa###aaaaaaaaaaaaa##aaaaba######a######a#abbbbbbabbcbbbddcabcddddefgfa########aacedcc", "#######aaa#####aaaccccddcdcccbbaaaaa####a####a#aaaa#aa#######abaaabbccacdaadccdddccba#aa#bbaaabaaabaaaaaa#aaaaaababbbdeffiiebcccdddeedcccdcfbcbbbbaabcbbbbbbaaaabcdeefeeddedbaaabcbdccefffffabbbbbbbbbcdcdddddefbaabbbbabaeidccddcejgbbccccccccbbbbaaabaaaaabaaabccccdffebaabbaaddcc#cdccabcccccbbbbbaaaaa#aaaa##aa#aaaaaaaaabaaaba#b##a####a#a#a##a#aabbabbaabbbbddecbbdcccddeega.##.#a##aab###", "#########a#####ababccbbbdcccccabbb##aaaaaa#aaaaa##aaaaaa#..###aaaaaaccbbdcbbccdbccdaa##a#a#aaaaaa#ba###a#a#aaaaaaabbbcdeefhgeccedbbcdedeedgebbbbbbbbcdcbbbaabaaabacccddccccbdcaabbadddeefffgfbabbbbccccccccdddbggbaabbbbabhefcccddddihdccccccccbbbababaaa###aa#aabbbcdeeffa.##abcfedabccbcccabcbbbbbbabaaaaa###aaaaaaaabaaaaaaaaaaaaba#######aaab#####aaabaaaabbbaceffecbccddccdec#####.##aa#aa#", "#aa########a####abbccbbccdcccbbbbba#a##aaaaabaa#aa####aaba#.##baaaabccdabdbabbbbbcccbaa####aaaaaaa#aaaa######aaaabbabccdfeehihfggfdbceedddeddfdccbbcbbbbbbbbbbaaabaccccbbccdddecababedefffffhgdaaabccbcccccdddbfhfbbbcbbackdeeccdddccfhgbccccbbbaabaaabba#####a#aabbbdeddeda.###aeddcbaaccccccccbbbbbabaaaaaaaaaa##aba##abbaaaaaaaaaab######aa##aa###aaabbbaaaaabbbeffffdcdcdeffda######.###aaa#", "#aaa############aabcdcbcdcfedeecbbaba##aaaaabaa###b#a##aaaa####abaaacdcaacdaacbcaaaaaaaabc##aaaabaaaaaa######aaaaabbbdddeddfhhhhhhfcccffffdbaabcbdbabbbbbbbbbbaaaaabbcccbbbbcfdedbbadeddeefdefhffecbbcbcccccceddgibbbbbbdecccbbccccddddhidccccbbaacaaabba########aabccedddeda####cdcecbccccddddcbbbbbabbaaa#a#####a#######abaaaaaaa#aaaa#a##aaaa#a####aabaaaaaaaaabccddfgfddefge################", "##aaaaa#aa######aaabdccbccdeefebbaccb###aaabcbaa########aa######aaba#bdbbbcabbbbbbaaba##aba#####ababaaa##a#a##aaaabbcddedddeeefhghfddccdhecbbbaaaababbbabbabcbaaaaaabbccbbbbbbeefdbbbddbddffdggihiebbbcbbcccccedeicbcbbcdccccccccddddddcfifccbbbbabbabbbaaa####aa#aabcedddefeb##.bdcdeccbcccdddcbabbbbaaaaaa#aa############abaa#aaaaa#aaaaaaaaaa#######aabaaaaaaaabbabbcefgecbcc############a#a#", "##aaaa####aa##a##aaabcdcbbccdcdccbcaba##aaaabbbaa#aa#a####a######aabaaabaaaaaaaabbba#aa###a##a###abbbaa#aaaa#a##aabbcededddddeghggcdfedffddcbbbaaabbbbbccabbbbbcaaaaabccbbbbbbeccefdbcdbcbcefefhgghdbbcbcccccccdcefedbadccbbcccccddddddddeggcbbbaacaabbbaaa######aaaabdcdeedefbaa#deddcdcbbcdedccbbbcbaaaaaa##################aaaaa#aa##abaaaa#aaa#aa##aaaaaaaaaabaabbacdbacbaaba###############", "##a#aaa####aa##a##aaabbbbbcdeccbbaaaaabbaaabbaabaa###aaaa#########aaab#aaaaaaaaabbaaaa#a#a#aa#a#aabaaaa###abb##aaaaabcdeeddefghhhebbbfebbdddccbbbbbaaabdcbcbcbacbaaabbabcbbcccddbbcefecdcbbbcddehgggcbbcbcccccccdddffbbdbbbbbccccddddddddddegcbbaabaaabbbaaa######aaabbbcdefdeca#ddedcdddbacadedccbbbbbabaaaa###############.####aaa##a###a##aaa#aaa#abaabaaaaaaaaaaaaabcdbaaaa#a########a##a###", "a##a#aaaa#####aaaaaaabcccbbcdebbaaba#a#bbaaabbaaaa####aaa#####aa#abaaaaaaaabaaaaaabbbaaaaaa#aaaaaababaaa####aaaaaaaabcddddefedhhgbbbbcefbcdedcedabbbababbbcbbbbbbaaabbaabbbbbcbcddbbbcdcebbbbdcabehhebbbbcccccccceddhfddbbbbbccccddddddddddcdfdaaaaaababbaaaaaaaaaaabbbbccddcdfededffddddcbcabcddccbbcbbaaaaa#####################aa##a#a#######aa###aaaaaa###aaaaaaaaaabbccaabaaaa######a######", "aaaabaa##aa####aaaaaabbccccbcccaabbba#a##aaaabbb######aaaaba##aaaaababb##aaaaaa#aabaaaa#aaa#aabaaaaaacbaa####aaaaaaabcdeddefefhheabbbbbdfgfgedcfaaabbbbbbaaaaaacabaa#baaabbabaabbdeeeccabdccbbbcaachifbbbcccccbcccddejkeabbbbccccddddddddddccceebabbaabaaaaaaa#aaaabbbcbbcccddefgedfedddcccbaabcdcccbcbcaabaaaa########.##.########aa###a########aaaaa#a###a###aaaaaaaaababccaabaa#########aa#a#", "##aaaacb########aaaaabbbbcccbdcddbbcbc#aaaca##a#aba######abca#aaaa#aa###aa###aaaaaabbaaa#a###aaaaaaa##bcbba###a#aaaabbceedddehgfdaaabaccbfhiihffcaaaaccbaaaaaaacabaaabbaabcbbbbbbbcbdeffedfdb#acaabafjgbbcbcccbccccdefiicbbbbacccddddddddccccbbcfbbbbbabaaaaaaaaaabbbcbbbbccccdegfecfdbaabdabbbbcccdcccbbbbaaaa###################a#aa##a#a##a####a#aaaaa###########aaaaaabbbbbaabaa#######aa###", "###aaacba#######abaabbdcbbcdcbbefcbabcbbaaaaa####aa#a#a#a#a##aaab###a#aa####abb#a#aacbaa####aaaaaaa#aaabdcbaaaaaaaaabaceefeeffffbaaabbabccehigfeeddefdbabaaaaabbbabaabaaaaabbbbbbabccbabdedda##aaabbachhbbcbccccbbcccdeghebbbaccddddddddddccccbacecbabaaaaaa#aaaaabbbccbbbbcccdcdgfdfebbbbbcccbcbcddccccccbbaaaaa################aabbaaaa####aa###a##aba#############aaaaabbbddbbaba##########.#", "####aaaba#######aaaaabdfdbbcccbbdebbaaaab#aaa#a###aa###aaa###aba#####aaa#####aba#aaa#baaa#####aaaaa###aabcccaabbbbbcbbbdfffgeccebaaabbbbcbbeffedccfghhebaaaaaabbaaaaaaaabaabbabbbbbacbbbbcbdda####abbabghabbbccccbbccddddghdaabcddddeedddddcccbbabdfdaaaaa##aaaaaabccccccbbccddcbefdffdcbbbcdccbbccddcccccbbbaaaa################bbccbaabaa#aaaaaa#aabba##a#########a#aaaaabbccbcabaa###########", "#####aaaba#######aaacccefcccbcdccbcbbaaaaa#abcba#########aaaaaaa######aaaa####aa##aaa#aaaaaaa##aaaaa##aaaccddcccdddddcceeffdccdccbaaaaabbbbcfggdddfffggfebaaaaaaaaaabaaabccbbbbbbbabccbbbbbcbdb###aabbbbghbacccccccccccdddfigdbcddddddeddddcccbbbabbfeabaa#####aaaabcccccbcbdddecegfffcccabbccccbbccdcccccbbbbaaaa############a#aaaababaaaaaaa#aaa##aaaa#aaa##########aaaaaabbcccbbdba#########.", "#####aaaaa######aaabddefcccbabdccccbaaaaaa###aaa######aaabaabbba#######aaaa####a###aaaaaa#a##a#aaaaaaaaaabcddddcdeeedefgfefecdaabbaaaaabbbbbadfebcfdfgffeeecaaaaaaabaaacabdbaaabbbcdcbbbbbbbbccb#a###abbaegcabccccdcccccdddcfihfdccdddddddddcccbaaaaaddbaa######aaabccccbcbccdddhfcfgecccbbbbcbccbccbccbcccbbbbaaaa#a##########aaaaaabccbcba#aa#aa#aaaaa#aaaaa###########aaaabbaddedaa##a#.#####", "####aaaaaa#######cffdabcbcdcbbadfbcbbaa###a#aaa#aaaaaaabaaaababaa#######a##a#########aaa##aa##aa#aaaaaaaaabdeddccddddddffeeeec#a#aaabbbaaabbbcggdcfeeeeegfdccbabccbbaaabbbcaaaaabbbcdbbbbccbbbdbaaa###abbccebabbccccbcccccddcdfhjhedddddddddccbbaaaaaabdda#######aaabbddccbbdddedccdgeeedccbbccdccbccbcbccccbbbaaaaa#########.##aaabbaabbbcbaaa###aaaaaaa#a#a#a########aaaaabbaccddeb###########", "########aaa######acddbabcbbcccabcddcaabbaaa##aaaaaabbbcaaaabbaaaaaba########aaa#aa###aaa###aa##abaaaaaacbbbcdffeddeccdffffeddbaaaa#abbaaaabaabegebdfeddeffeddddcdddcabbacbcbccbaabbacccbcdbbbcdb#aa##aabbbbbffbbccccbccccccdddedfkkidddddddcccbbaaaaabbabdb#a#####abcccdbccccddfcccdfgeedccbbbcbccccbbabbcccbbbbbbaaa############a#a#aaaacacbaaa####aaa#aa###a##a######aaabaabbbbbbdfa##########", "#################abbcbaacccccbccaacbcaaaaaaaaaaaaaaabccabbbbaaab##bb######a#aba##aa##aaaaa##a#a#acabbbacdcbcddffffdgeefefeddcb#a##aaaaabaaaaaaddfdcfdccccccdcbcbcccecbbabccdddddcbbbbccccccbbbceb#aa###aaaabbfgbacccbcccdcdddeedgjkihccddcccccbbaaaabaabaadca####aabbcccbcddccefdcdeeeedddcacbccccccbabaaabbbbbbbaaaa###########.#####aaaabacbba##aaaaaaa####a####a######abbabbcbcbcdb###a##.##.", "###########aa#####bdbaaaaccddbbdcba#bbaa##aa#aaaabbbbbbaaabaaaaba##aa.####aaa##a#aaaaaabbbaa#####abaabbbbbccdddeefeffddefdccaa####aaaaaaaaaabaeefdedeccbabbbdddbbccccabbbbbbbbcdcccbcccccccccbaaaa#a####aaaabacgcabbcccdddefffedgijfehdcccccccbbbaa#aaaaaaabcbaaaaaabbccdcdddefgecddeefedccbbbabccbbbbaaaaaabbbbaaaaaa################aaabcbabbaa#aaaaa#aaa###a####a####aaabaabcbbbcbba###aa####", "############a#####abaaaaaabddccbcdddbaaaa###aaaabaaabbbaaaabbabba###b######aa######a##aacbcbba##a##babbccccdddddeeefgfeedccdb####a#aaaaaaaaaaadefedecbabbbbbcddddbcddcaabaaaaaabbbbbaabbccdcccbbbcb#a##aa#aaabbbfdbbccddddeffffefggeedjhedcdcccbbaaaaaaaaaaabbcaaaaabbcdcccdeefgdcccdefeccbbbbbbbccbbbbaaaaaaabbbaaaaa#######aa######aaabbbcab#a#aaaaaaaa#a##a#####abaaa#abaabbbbbbdccc####aa#.#", "###aaa###a#a#a####aabaaaaaabdbbbcecdcbaaaaaaaa#aaaaaaaaaaaaabccbb###a########a#a#aaaaa##aaaabca#a##aabbccccccdcccbbbbcbcabbbb#a#a#a#aaaabaaaabbeffddeabcbbbbcccccdccbbbaaaaa#abaaaaaaaaaababbbbbcbb#a##a##a#aaaabefcbdeeddeffffffeddfbchjieccccbbbaaaaaaaaaaaacfcabbbbcdddcdehggffeeddgfecbbccbbbccbcbbaaaaaaaaabaaa######a##aaa####aaaaaaabbaa##aaaaaaa#aaaa#####aabbaaaabbbbbbccccddbaaaa####.", "####aaaaa#aaaa#aaaaaaabbaaabccbbbcddbbdcbaaaaaabaaaaaabbbbaaaaabaaa###############aaaaa##a#aaaaaaaaaaabbccccdcbbbaaaaaaaabaaa#######aaaaabbbabaacffffbbbbbbbbbbbbccccbaaaaaaaaaaaa##aaaaaaabbccca#######aa###aaaabcgfcdeeefgggggggeffcbbehkjebbcbbaa##aaaa#aaaadheabbbcdddcegfbccdfffgggedccccbbbbbabbbaaaaaaaaabaaaaaa######aaaaa#aa##aaaabaaaaaaaaaaaaa##aaa##aaa#acbaaabababbcccdecbaaaa###a#", "#######a###abaaaaaaaaaaabbdccccbbbceefebcaaaaaa#aaaaaabbbcccaabaaa###aaa#######a###aaaba##aaaaaaa#aaaabccccccbbbaaaaaaaaabaa###a###a#aaaaacbababa#eeedbbbbcddbcbccbccccaaaaaaaa#a#aaaaaaaabbbbcba########aa####aabbbghdeeegggggghggfedbbbcdikgbbbbbaa#aaaaaaaaaabheaabccddegdccccdddccfffddbbabbbcbbbbbbbbbbbaaaaaaaa########a###aaaa#a#abaaaaaaaaaaabbabaaaaaaa#a##ccaaaaaaaaaabcccbacaaabaa###", "##a#aa#####aaaaaaaaaa#aabbbabbcbbabcdeedcbbbaaaaaaabbbccdddccccbbccbdcbcca########aa####aa##a#aaa###aabbccdccbbbaaaaaabaaaaa#########aaaaabcaaabaa#dfcccbcccbcccccdccccdbbaaaaaa###aaaaaaabbbcb######aa###aaaa###abbcfheeffghhghhijifcbbbbbehjhcbbba##aaaa##aaa##afgdbbcefecdcdccddddddeedcbabbcbbabbcbbbaaaaaaaabaa######a#a#a###aaaa#aaabaaaaa#aaaaaaaaaaaaaaaa#a#bcaaaaabaaaaabbcccbcabbbaaa#", "aaaaaaaaaa#aaaaaaaaaaaa#abaa#aaaaaaaaabcbbaabbbabbbbccddddddefdbcdccdecddcaa##aab######baaaa##ab###aaaabbbcccbbaaaaaaaaaaaaaa########aaaaaacdbaabaa#dcabccdddcccccdeeddddddbaaaaaa###aaaaabbbca#a#########a###a##aaabcegefgfhhggiiihddbbccbbfegihfb###aaaaa#aaaa##adgfefecbddccccddcedccefdcbabcdcaabbbbbbbaaaaaaaaaa#a####aaa#aa###aaaabaaaa#aaaaaaa#aaa##aaabaa##abcbaaa#aaaaaaabbbbdddbbbaaaa", "aaaabbabaaaaabaaaaa#a#aaa#abaaaaabaaaaaaaaababbbbccdddeeefdfffedccbbbbcccccaaaaacb#abaab#aaba#aaa###a#aaaabccbaaaa##aaa#abaa###a##a#aa#aaaaacca#abaaadbabddddfededcbbcaaabcddcaaaaaa###aabbbcdca######a####aa##aaaaabbcdkgghhhhhgiigecabbbccffedgiida#aaaaaaa#aaaaaabfecbccccbbbabbbddddddccbaaacdcbbcbbbbbbbaaaaaaaaa##################baaaaaaaa######aa#aaaaa#a##abbbbaaaaabbaaaababbddcbbbbaa", "aaaaabcccbbbaabaaaaa#aaaaa#aaaaaaaaaaaaabaaabaaabbbcdffefgffdcccdddcccccbaabaaacbab#aa##aaabb#a#a##aaaaaaabbbcaaa###aaaa#aaa#a###aaa#abaaaaaacccbaaaabcbaaccbbdccbbbababba#abccbaaaaaaaaaabdeabaa##########aa####aaaabbceghghhihiihhgcbbbbbbegdcdedhhdd#aaaaaaaaaaaaabdccccccaaabbbbcddddfeffdbbabcbbbbbbbbbaaaaaa###a#########aa#######acbaaa#####aaaa##aaaaaaaaa#a#aaaaaaaaaabbbbaabbccddbbbba", "aaaababbbccbbcbaaaaaa#aaabba#aaaaabaaaaababbbbbaaaaaa#aabbcaaabbbbbbbbbcbaaaaaabaaaa####a##aaaa######aaaaaabbbbb#######a#aaa#a###a##a#aaa#aaacbbcbabbabcabbbcddbaaabbaaaa##aaaabbaaaaaaaabbcdbaaa###########a####aaaaabbbcfihghhhihhhdabbbbbbeeccccbdehfaa##aaaa#aaaaaabedccbaaaabcdcddcbfeffddeedccbbbbbbabbaaaaa#############aa########ababaa###aaaaa###aaaaaaaaa##abaaaaabbbbbbbbbbbbcdffabaa", "aaaaabbacbbbabaaaa#aaa#aaaacba###aaabaaaaaababaaaaaaaaaa##aaaaaaaaababbccc###aabaaaa##a##aaaaa#aa##aa#abaaaacccb##a#a#a#aaaaa####aaaa###a#aa#ababdbbbabcbabbbbbbbbbcbbaaaaaaaaaaba#a###aaacbcdaaaa#########.#####aaaaaabbccfkjgfhhifdfdaaababbffcbbbbbacgda#aaaaaaaaaaaaaddcba#aabccccdbbdeefeddfdfecbbacaaaabbaa##############aaaaa#######a#aa###aaa####aaaaaabaaaaaaaba#aaababbbcccddddgihcabb", "baaaaababccccbbaaa##aaaaaaa#cddb#####aabbbbaaaaaaaaaaa#####aaa##aa#aabadedca#abbaaaaaa####aaaa#a#aaaaa##aababcbca#aaaa#####aa###a#aa##aaaaa#a#aaacbaabbbcbabcccbbbbcbabba#aaaaaaaa#bbaaaaabbadb###################aaaaaabacbgkkihhggfedaaaaaaaceecbaaaaabffgeca#aaaaaa###acdca#aaacbbccbcbeeefffdabdfecabaaababbaa#a##########aaaaaa#######abaa##aaaa#####aaaaaaaaaaaaaabaaabaabbbbbcdegghffdabb", "bbaaaaaabbcccccbbaaaaaaabaaaabccca###aabcceebaaaaaaaaaaa#a##a#####aa#aaaddbbaaabaaaaaaaaaaaaabb##abb#aaaaaaabcbba##aaa###aaa#########a#aaaaaaaaaaaaaabbbccbaabccbcbbbbbaaaaaaaaa##aaabaaaaccbed#################.##aaa#aaaaacekljihhhdbaaaaaaabdeedbaaaaaabceffdaaaaa#####abdd##abbbbccccbcedfeddbbbbdddbbaaababaaa#################aa#aa.###aa##ba##aa###aaaaaaabaaaaabaaaaababbabbbdfhjifeecba", "bbbaaababaabbcccbaaaaaa#aaaaa#aaba##aaabcbbccbaaaaaaaaaaaaa#aa####aaaaaabccbaaa#aaaabaabaaaa#abdca#acaaaaabaabbaba#aaaaaaabba##aaaaaaaaaaaa##a#aabbbbbbbccbbbacbcbabbbbbaaa#aaa##aaaaaacbccccdbbba#a########a#.####aaaaabaaaaafklljhfcaaaaaaaa#dcgfcbbaaabccccdggcbaaaaa#aaaacdaabbbbbbbbcbddeeddccccbbcecbaaaaaaaa#a##############aaa##a####aa##b###aa#aaaaaaaaaaaaaa#aabaaaaaabaabbdggghhfbdeb", "bbabbaaaaaabbcbccbabba#aaaa##a#aaa#a#aaabbabbbaaaaaabbabaaaa#a#####aaaaaadcba###aaaaaaaaaaaaaaabbaa#abaaaabbbcbaa#aaaaaaaaaaaa#aaaaaaaaaa#aaaaaaaabbbbbbbcbababbbcbbbbaaaa###a###aaaaaaaccddcddbaaba#aaaa####a#.#.#aaaaabbaaa##djlljc#aaaaaaaa#afdfebaaaabccccddegfdbaabbbbbbabddbbbbbbbbbadceedcdcccbbabdebaaaa#aaa#############aaaaaa#ab####a##ba#####aaaaaaaaaaaaaaaaaaaaaaaaaabcdfebbbabbbcc", "ecabbaaaaababcdcccbbbcdbaaaabbaa#aaaa##aabcbbbaabaaabbaabaaa#aa###aaaaaabecbaa#a#a#aaaaaaaaaa#aaaaaaaaaaaabbcbaa###aaaaabaaaaaaa#a####aaa#aabaaaaaabbbbbbdcbbabbbcbbaaaaa####aaa#aa###aaabcccccbaabbba##a####aa#####aaaabaaaaa##ahlkfa#aaaaaaa##fbbecaaaabccbcdddceghecbbccccbbbccddbbabaa#ccedddddccbbaaacfbaa#a##a############a##aaaaaaaaa##a###ca#aa###aaaaaaaaabaaaacabbaaabbbbddea###aaaabc", "abbcbbbbaaaabbccbbbbaaaa#a#aaaabcaaaaaa#aabbbbaabaaccbbabaaaaaaaaaaaabbabdcbaaaaa###aaaaaaaa#aaaaaabbbaabbbabaa#aaaaaa#aaacbbaaa##aa##aaaaabcbaaaaabacbccccabaabaacbcbaaa####aaaaa####aaaabdccdba#abbaaa#######a######aaaaaba#####dljfa#aaaaaaa#ddaadcbccbbbbccccdccehihfddccccccbbdfaaaabbbceefedddcbbbbaaaecaaaaa##a###a####a##a##aaaaaa####a###ba#aa###aaaaaaaaabbbbacbbbbbaaacccdd#####aaaab", "babbbcccbbbaacdbccbbbaaaaa######aaaaaaaa##abbbbabaaabbaaaaaaaaaaaa##abbbdcccbaa#aa#####aa#aaaaaaaaaaabcbabbabaa##aaaaaab#accbaaaaa#aaaaaaabcddbaaaaabbbccccbaabbbbaabbbbaa###aaaaa#####a#abceeeaaa#aaaaba#######a#######aaaaaaa###.cgjgb#aaaaaaaafcaacdcdcbcbbcbbccdeefeeghfeccccbcddc#aabaaaeffeccccbbbbbaaacdcaaba##aa##a#aa#aaaa#aa###a####a####b#a##aaaaaaaaaaaaabbbbcababbbbcdddeb#a#####aa", "bacbbcddcbbbbacddccbabbaaaaaa#a##aaaaaa####aabbaaaaaaabaaaaabaaaaaaaaabbcccbbabaaaaa#a#aaaaaaaaaaaaaaaabbccbbba##aaa#aaaaaabbbaaaa#aaa##abbaabbcbaabbcccccbbbbbabbbabbbbaa#############aaabbcedbaaaaaa#aaa######a########a#aaaa##a##adhjc#aaaaaaacdb##bddcbbbbaabbccefgecceffgfcbceccedabbaaacffdccbbbbbbbbbaabccbbaaa#aa####a###aaaaa#a##bb##a###ab##a###aaaaaaaaaaabaaabbbcbcbbbcefeb#####aa#a", "aaccbcddcbbabcbcddcbbbcbaaaaaaaa#aaaabaa##a#aaaa##aaaaaaaaaaaaaa#aaaaaaaaabbccaaaaaaa#aaabbaaaaaaaaaa##aabccccbaa#aaaa#abaaaaaaaaaaaaaabbbbaabbaccbddedcbbbbbabbbcbcbbcaaaa############a#aacbcba##aaaaaa#aaa#a###########a###aaaaa####adid#aaaaa##eca##addcbbaaaabbcddefddefddgiedccccffbaaaaaefeccbbbbbbbbbaabacdbbba####aa#a##a##aaaaaaccbba###.aa#aa#ba#a#aa#aaaaabbabcbccbcbcccegc######ba#a", "abcbbccdedcbbbabdddcbabbbbbaa##aa#aaabaa######aaaaaaaaaaaaaaa#aa#######aa#aabcbbaaaaaaaaabcaaa###abaaa#aaabcbcb#aa##aa#abbaaaaaaaabbcaaaaaabbgecbbbbccbbbbbabcabbcbbbbaaaaa##############aaabaaaa#aaba#######a###########ba#aaa#aaa###aabffcaaaaaabeb####cdcbaaaaaaabbccdeffeeegihfddddffcaaaabefeccaabbbbbbbaaaabdba#aa####aaaaa###aaaacccbbba#######aaaa#aa#a##aabbbbbbbccccccccddgf#aa##a#aaa", "aabcdddddddbbbccabcdccbaaaaaa#####bbaaaa#######aaaaaaa###a#####a#########aaaacbbbaaaa#accdddba#a#aaaaaaaaabbbcbaaaaa#aaaabaaaaabba#bdaaaaabeecbbcbcbccbbbbabbbbbbbabbbbaa#aa####a########aaaaacaabaabaa#######aa########abbbbaa##aaaa###aaegfb#aa##dcaaaabddbaaa##a##aaabcdfgffgiggfffedefea#aabffccbaaabbaaabaaaaacbaaaaaaa####a##aaaaaabbabaaa##aa##aaaaa######aabcbaabbccccbbddedeeaaaaa#baaa", "aabbdeedeedddaccbbbcbcccbaaaaaabbaccaaa#a#aa###aa#aaaa#########aa#a#####a##babbbbbcbbcfdccccbbaabaaaaabaabbbccbbaaaaaaaaaabaaaaaaaaacfcaaabcbbaaababbcaabbbabbbbbaaacbabaaa####a##.########a#abd##baaaaaa##.###aa#######abbadb#a#########aaeiib####bca#aabadcba########aabccdgghgfeddddeedegdaaabdedbbaaabbabbaaaaa#cbaaaaaaaa#a##a#aaa#abbbbaaa#aa##aaaaaaa#####aaabaabbbbccbbbcdecef######acaa", "baabcccddedddbacccbccdcbbbbaa####aa##aaa###a###aaaa#a#####aaaa#a#aaa###aaaaabbbbbabcgjfdccbbbaaaaaaaaaaaabbacccba###aaaaaaab##aaaabbbdfdbaabdecbbbabaabbbbbbbbbbbbababbaaaaaa######.########a#acdb#aaaaaaa######aa######abbccb####aa######afiifa###bca#aaaabcbba#a######aaabcdeefcbcedccccceffaaaaacdbaaabbbaabbabaaabcbbaaaaaaaaa##a#a##abbaaaa#ba##aaa###a####aaaaaaaaaaccbbbcccdeff.######aaa", "a#aabbbcdeddcccbcccccdcbbabaaaa##a###aa#a#a#####aa##a###a##aaa####aa#a#a#aaabbaabbbbbffdccbbbabbaaaabbbbbabcbbbaaa##aaaaaaaaa###aabcbbcdfdaacebbbbbaaabbbbbbbbbaaaaabbabaaaa###aa############abcdcaaaabbaaa######aa#####abbbdc#############adghf###cdaa##aaaabbaa##.##.##aaabcdecedbbcdecbbbccebaabacdaaaaabbbbbbbaaaaabdcbaaabaaaaa##aa#aaabaaa#bcaaaaaa###aa#a#a#aaaaaaaaababccdceec##########", "###bbbbcdeddddcccccbccbccbbbaaa#####.#a##aa######a##aaaa###aaaaa##a###aaaaaabbbbbbbccddcdcbbbbbcdbbbadecccccbcb###a###aaaabaaaa###accbbccfhcacbbbabbabbbbbbbbaaabbbaabbbaa####aa#########.####aabcbaaaabbaaaa#####a#####aabacfb###############dhhc.ddb###a###bbca#.#....##aaabcdccecbbccedbbcccedbabbdcbaaaaaaaabaaabaaaacccaabaaaaaaaaaaa#abaaabbcaaaaaa###########aaaaaaababbbceeda.#####a###a", "#baaabbcdeddddddddbbcccbcbbbbaaaa################aaababba####aaaaaa###aaaaaaabbaabbdecbccccccbbbccccbcbbbcbbddeeca###aaaabccaaaaaa##abbbbcdedbbabbaaaaabbbbbbbbaaaaaaabbaa#######aaa##########aabbbaaabbaabaaa########aaaaaabdfb####aa#########cghhceba###a##aabaa#.....###aaabcdceebbbbbddcbccbcdcabcedbbaaaaaaaabaaaaaa#cddbbbaaaaaaaaaaaaaaaaccbaaaaaba#a#a######a##a#aaaaaaccdeed####aa####a", "aaabaabccceeddeedcabbbcbbcbbbbbbaaaaa#########a##aaaaabbcbaa#aa#aaaaa#aaaaaaaaaaabbcddcbbbbbbbbbbbbbabbbbbbaabbdgfba#aaaaabbaaa##aaaaaabbbcceedaaaaabbabbbabbbbbbaaaaaabba#######aba#########a##abbcaabcbaabbba########aabbaabddca#aaaaa#########adjhaaa#aa#####aaa#...####aaabbcccfdabbbbbddcccbbccacffccbaaaaaaaaababaaa##bccccbabaaaaaa#aaaaabdcaabbaaaaa#########a#a#aaa###bcddhga####aa####", "##aabbbbcdffeddeebdcbbbbbcbbcbcbaaaaaa##.##aa######aabbbbaaaa#aaaaaaa##aaabb#aaaaacddfbcbabbccbccbbbaabbaaba#abadfdbbaaaabcaaaaaaaaabbbababbceedaaaabbabbbbbbbbbbaaaaaaaaa##.#####aa#########aaa#aacdabbbaaaaaaaa#######bbbbccdcddbaabbaaa####aa###bhgea#######.##aaa#####aaaababbbcebababbabdeccbbbceffeecbaaaaaaaaabaaaaaaa#bcccbbbbaaaaaaababbbbbaaaabaaa#######a##a#aa#aaaaabddhg###########", "#a#aaabcdddffdddeeedbbbbbcbbbbcbbbaabaaa#a##a##aacaaaaaaaaaa#a##aaaaacdaaaabaaaa#accdeaaaaabbbbccbbbbaaaaabbbababcdddcccbbaaaa#aaaabbbaaaaaabdeeeaaaaaababbbbbbaaaaaaaaaaaa###a####ba####a####aaaaaabecaa######aaa#####a#ababccccbcbabaaaaaaa###a####dijdb########a#a###aa##a#abbbbddbaaaaabbabdddcfeffffeccbbaaaaa#aaaaaaaaaa#abccbcabaaaaaaaabbaaababaaaaa#aaaa###aaa#aaaaaaaaabchga#####aaa##", "#a#a###abccdddefdeeecbbbbbbaabbbbbbbbba#########abaa#aaaaaaa##a#aaaaaccbaaabbabbcbbccfbcaaaababbbbbaaaaaaaaaaaabbbabbabaabaaa#aaaaaabbabaaa#abcdfea#aaaabbbbaaaaaaaaaaaaaaaa#######bba##########aaaabcedbb#######aa#####a##abdcbbccbaaaaaa#aaaaa#aa###bgjjga#######aba#aadba##aabbbccbaaaaabbaaabedffeffffdcbbaaaaaaaaaaaaaaaa#aaaccbbbaaaaaaaaaaaababbbaaaa#aaa#####aaaaaaaaaaabbbghc#####aaaaa", "a##a#aa#aabccbdfgeefeccababbbaabaabbbaa#a##.######aaaaaaabba##aa##abbbcbcbbccacbbdedgheccbbabbaaaaaaaaabbaaaaaaaaaaaaaaaaaacbbba#ababbbbaaaaaaabdeeca#aabcbaaaaaaaa#aaabaaaaa####.##ba###########aaabbceeba########a#########cbbbabbbaaa#aa#aaaaaaaaa###djkjb#b#..#abbcaaabcba##aaabbcaaa#aaaaabaacfffffedffccbaaaaaaaaaaaaaaaaaaaabcbbaaaaaa##aaaaabaaabaa#aaaaaaa#a#a#a#aaaabbbbccgc######aaa#", "##aaaaaa##aaccbaeihfgggcbabbbaaaaacbbceceeca########aaaaaabaaaaaaaabbbdcccdebbcbbabacedecbbbabaa#aaaaaabbbbaaaaaaaaaa#aaaaa#abbbbacbbbbbbaaaaaaaccddbbbbbbbaaaaaaaaa##aaa#a##a#####aa#############aaabbceeea########a########aaaaaaaabbaa###a###aaa######agjkhgfb.#aabddaaaaaaa###aabdb##b###aaaaa#cffffeeeeeccbaaaaa#aaaaaaaaaaaaaabcbaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabbbbbdfeba####aaa#", "#a#aaaaa###aacca#cjjhhjebcbaa##a##acegebdcbdb#.#cbcaaaaaaaaaaaaaaaaaabbcdgiecbbaaabbbcbcdcbbbbbaaaa#aabaabcbaaaaa#aa#aa#aaa###aaaaaa####a###aaaabcddbcbbbaaaaaaa#aaaa#aaaaa##a#####baa#.#######a##aabbcdddffa##.####aa##.####aaaaaaaaaabaaa###########a####chhiihc..ceffbabaaabaaaaabccaacc###aaccbbegfffededdccbaa#a#aaaaaaaaaaaaaaaabcbbaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabcccefeaaa###aa#a", "aaa#abaaaa##aaba##eiiikhccbddefeeffgecccdccdeffefddc#aaaba#aaabaabbaaaabcdhfbbbbaaacdecbbaabbbcbbbbaaaabbbbbbaaaaaa#######a###aaa#aaaaa######aaaaaccbcbaaaaaaa####aa##aaaaa#####a##############a##aaabcccccdfb##.#####a######aaa#aaaaaaaaaaa##########aaa##.#aejjifb#cffacbbbaaa#acbbcc##ddda##cddeefgfffeedddcabbaa#aaaaaaaaaaaaaaaaaaacbbaaaaaaabbabbbcaabaaaabbabbbbabbbbbbbbbbbdfc####a##aa#", "#aaa#a#a##a####b###dgkkjgccfiifdfdeeccddddcdcccccbca#aa##aa#aaaaabbbaababeggdbaaaaadfcbbbbbbcccbabcbaaaaabcabbbcbaaaaaa##########a#a########aa##a#accbbaaa#########aa###aaaa###aaa####.#########b##aabcbbcddfb###############aaaa###abbaaba#aaa#########aa#####djjjifbcebccdcba#bbacbcb##addccdcdeeefgfffeecbccbbbaaaaaaaa#aaaaaaaaaaaaaabbaaaaaaabaabbbbbaabababbbbbbbbbccccbbbbcced####a###aa#", "a##aaaaaaaaa#a#ba..#agkgfecfikgddcccdcccbcccbcbcbbdba##bccaaa#bbccccbaabbefffcaaaabdfbbbbbbbbccaaabaaaaaaabcbbbabbbbaaaa#######aaa############aa###abbaaa####a############a####a#######.#####a##aaa####aaaacfa#######..######aaaa###a#cdcbbbabcbaa#aab#########.chiiihfcddeghhgdccdabdaa#addcddceefeeffeeeedbbcccbbaaaaa#aaaaaaaaaaaaaaaaabbbbaaaaaaabaabbaaaababbbbbbbcccdccdcbbceea####aa###aa", "a####aaaabaaabbab#.#aaeecdhfijfcccddcccbbbbccbbbccaaa###.a#abccccbcbcbbbbbff#a###abcebabbbbccbcaabbaaaaabccbbbbbbbbbbbaaa#aa####aa##############aaaa#ababaa##############a#a######a####################aabbcacaaab#####.#.##abbaa###aaabcacbcaaaaaaa#aa#########.bgihiifcdgijjjiidaaabe#a#bdcbccccddddddecdecbbbccbbaaaaa##aabbaaaaaaaaaaabbbbbabbbaaaabbbbbaaabbbbbbbccdddedddefeffa####a#####a", "#######aaaaaaaaaa#.#abcdaahkkjgbbcccbbbbbcbbcbbbbaaaa#a######abddedccccbbacffcbb##acccacdcabbdccdbabaaaa#abbbbbaabbbbcba###a############.##.###########ababaa##################a##a###.################aaabcbcdbbbaa##.#.#.#aabaa###abcdcaabaa####aa#aabbb###a###.#bgjhacegijjjjjjhedfgea##cbbbccbbbcccccdcccbbbccaabaaaaaaaaaaaaaaaaaaaaaabcbabaaabaaabbbbbaababbbbbbccddddedffceedb######aa###", "aaa#a####a##aaa##a.##acda#cejjfdbbbbbabcbaabbcbbaa#aaa##a#a###baecbdfedddefhhgefea#cedbafecbbcbecbbccbbbbabbbbbbbccabbcdcaa####################.#######aaaaca##########################.########a######aaaaccccbbca#a########aaaa####bedcaabaa##aaaabaaabc########..#figefhikjihhhhiijiihd##bbcdbcccbcccddebcbbbbcdbaaaaaaaaaaaaaaaa#aaaaaabbcbbbbbbbabbbbbbbabbbbbccddedeedffa###a#####aaaaaaa#", "###aa############a#.##bccbbbbehhaabbbaaabbabbcbaba#aaa#######becdda#fgecddeehghegdabdecaabedbcaacbbddbbbbbbcbbbbbbdbaaccccba#########a################aaaaabcaba###############################a#####.###aaaabccbcb##a######aab##a###accbca#b#####aaaaaaaaa###.####...diihiiihfgeffeffhijid##ddcdccccccddddccbbaabddcaaaaaaabaaaaaaaaaaaaaaabbcbbabbababbbbbbbabbcbccdddedefc.##########aa#aaaa#", "#aaaaa#aaa##a######.#abbccaaaabgfb#ababa#aaaacbaaaaabbbab####edeefeccgedcddehhfacebadecaaaabcccbbbbcbabbbbbcbbcbccccccabccdb#######abb###a##############aaaacbccba##########a######.########a###a#########aabcceccb###a#####aaaa##aaaaacbb##ac######aaaaa##aaa#######..diihffffffdeddddefiigaaeddddbbcdddccdccbaaabcedbbbaababaaaaaaaaaaaaaaaabdcbaabbababbbbbbbbbbbbcceeegc.#############aaaaaa", "aabcbbaaaaaaaa########bbcdbaaaaaffa#aaaaa#aaabbaaaabcdeddabaefcdddefcgfddddeghcccffddbaaabbbbbccbccdbcbabbbbbbcbbbbbdcabbbddb########bca#a#######a##a###aaaaaaabdbaa#aaa####aca##...###aa####a##a########aaabbbdecc##aaa############aa#abba##a#########aa#aaaaa########.bgiedcccdccccccccdhigdeeeeedcdddccbcebaaaaaaceebbbbbbbababaaaaaaaaaaaabcccccfedcbbbbbbbbbbbbabcfffe############a###aaaaa", "a#aaedbbbbaaa#a#######abddca#aaaadcaa##aa####aabababbbccccfggcbcccccfgeccccdddffedfecddcbbbbccbbccdcddbbbbbbcbbbaabbcc#abaacba########aa##..#######aa####aaaaa###bbaaa#aaaaa#cc###a.####aa##aaa#########aaabbbbadcdaaabba##########a#aa#bbaa##a#######a#aa#aaaaaa#######.ageccbbbbbbbbbbbcbehigffeedddddccbcccbbaaa#accdcbbbbbbaaaaaaaaaaaaaabbcbccdbaadfdcbbbbbbbcbcefccba#################aaa#", "#aaacbaabbcbbbaa#######abcca##aaabbcba########abbaaabaabccdcbabbbccbcedccccccccccccedbbcdbbbccbcbbcbcbbbbbbbbbbabbbbcccbbaaaaaa##a####a#aa####.#####aa##a#aaaaa##abbcaaaabbbabcaaa#.#.###aa#a##a########aaabccabbddbaabaa####.##.aaaaaa##bba##############aaaa##a########.#bddbbbbbbbbbaaaaabfhhgfeedddccbccbdabaaabbbccddcbbbbbbaaaaaaaaaaabacbbcceb#a#babcbbbbbbcbce##.####################aa#", "aaaaaa#aaaababba#######abcccb#a#aaacddb######aaaaa#aaaaabbbbbbbcbbbbcdcbcbccbccccddbababcccccccccbbbbaaabbbbccbdcbbbbabcbbaa######aa#aaa############aa#####aaaaa#acbabaa#baabbcb#a##.#####baaa#########aaaabcdcccccbaaaa##########abaaa###aa##############a####aaa########.##dcbbbbbbbaaaaaaaabghgffedccccccbbcabbaaabbcbdedbbbbbbaaaaaaaaaabaaabccdecbcabbbcbbbbbcbeea###aa####################", "aaaaaaaaaaaaaa##########acceeba###bbbcda#######a####aaaaabbbabbabbbbbcccccccccbcbbcdcbaabbcbcccccbbbbbcabbbbddegebbbbbbbcaaaaa#########a######aba#####aa#####abaaaabcbb#aa##abaaba#####a##aaaaa######aaaaaaacccccbccaa##a#######aa#aabaa##aaa####aa########a#aaaaaa###########addcbbbaaaaaaaaaa#fieeeddcccbbbbbaaabaabbaaabdedcccbaaaabaaaaabbaabbbcdebaaccbbdddcbbcdc#aaaa###########.########b", "aaaaa#aaa#aa#############abcdfdaaaabcdf###aaaa##a#####aaaaabbccabbaaaabbbcccccbcbabbccbbbbbbbbbbbccbbcccbbbcdcdedecabbbbaaaaaaa########abb##aa#aaabaa#aba###a#aa#aabcccbabb###aa#aaa######aa##aa######aaaaaaaccccdaba###########aaa#aaba#aaaa#aa##a########aca##aaa######a######cffaaaaaaaaaaaaa#ehfeeedcbbbbbbcbaabbbbbbbaadeeefedcbaabbabbccbabbdcbcaabdcccccceedffb##aa####################a#", "aaaaa###aaaaaa#####.####aabccfgbaabbcfeda##aaabaaaaaa#aaaaaaaccbccbaaabcccbbccbbbbbbcbbbbbbbcbbbbbcabcccbababccdeccbabbbbaaaaa#aa########aaaaaaaabedaa##a#aaabaaaaabaccbaaaca###aaaaaa#####a###aa###a##aaa#aaaccbbabaa############aaaaaaaaaaaaa#########a##acdaabaaaa############acecaaaaaaaaaaaaafhffeddcbbabbcbbabbbbbbbbaabbdeddfeddbabbbdcabbabbababbbcbcbccddffcdaaaa##a###################", "aa#a#####aa#aaaa#########abcdcfeaaacbdccfcbbbdddbbbbbaaaaa#aaaabcbaabbbcccbbbcbbcccccccccbbcbcccbbbbbcccbbabbacddedcaabbabaaaaa##aa########cb##aa#cfdaa##aaababbbbaaaabbbbaabaaa#abaaa#####a#bbaaaa##a##aaaaaabbccdaaaaa#####bb#####aa##aaaaaaaa############aabbbbaaaa##aa##########deaaa###aaaaabcgiggddccccccccabbbbbabbaba#aabcaacccccbbcdbaacbbabbbbabcbcdddd####abaa#a##a#a#aa############a", "aaa#####aa#a#aaaaaaa######abccdfa#bbcddbcccdcdaaccdecbbbbbbbaabccbaaabbcccbbbccbccccddccccccddccbbbbbbcccbbbbbcccdddbabbbabaaaa########.####bba##a#aca###aaaaaaaaaaaaaabbbaabaabaaabba#######ababba.##aaaaaaaaabcdcb#aaaa#####a##########aaaaaa#a####aaaa##.##abbba#aab#aba#aa#a#####cgeaa####aa#aabfiigdccccbccccbbbbaabbbbaaaaaabccbbccccdabcbccaaaaabbbccdebdbaaaaaaaaa#a######aaaaa#########", "#aa#a###aaa####aa##a#####aabbbbeb#abbceeba#a####aaaba##cdbbbcccdccbbbbbbccbbabcbbbcbcddccccccddddddccdcabbbcbccbbbddcbbbbbbbaaaa#########.####aaa####a#a#aaaaaaaaaaaaaabbbbaaabaaaaaaba####a#.a##ab##.a##a##aaaabbddb##aa#####aa######.##aaaaaa#aa####a#aaa###abbb###acaacaaaa##a#####bff###a##aaa#aacghhfccbcbcbbcbbbbbbbcaaaabababbdccccddbbccccaaaaaabbccee##aaaabbacaaaa######aaa#aaaaaaa###", "#aaa##########aaaaa########bbbbbea#babcea#a######aaa####bccddcddedcccccccccbcbccbbbcbcddddcccbbbcccdefedcbaacbbcbbbbbbbbababaaaa############.###aa#a##aaa#aaaaaacbba##abbcbaaa#aaa#aa#########a#######a##aa#a#abbcbcc#a############aa####aaaaaaaaaa#######aa###aabaa##bbaaaa#a##aa######dea#####aaaaaa#behhdccbccacbbbbbbbcbbbaabbabbbcdcccdddbbbba#aaaaabbddb#######bcaaaaaa######aaaabbbaaaaaa", "aa#aa##########aaa########aabbbbbedbaabddcb#aaaa#aaaa####cccaacdeeggecccccccbbabbbbbbbbccddcccbbbbcbcddeedcbaaabbabbbbcbbbabaaaa###########.#####aba#######aaaaaabbba#aabbbbaa###aa##a#####.#a#.#.####aa##aa#aaabccbca#aa#..########a######aaa##aaa#########aaa#aaaaaabcaaaa##a##a###a#a#bdb#aaaaaaaaaaabcfhfccccabbcbbbbcbcbbbaabaabbabcddcdcccbba##a#a#abddb########aaaaa#aaa####aaaaaaaabbaaa", "aaa#aa##########aa#a#a#######abbabgebaabacca#ba#aaabaa#########a##bdeddeedddcbbbbbbbcbabacdddcccccbbbcdcdcdcabbbbbbababbbccbabaa###############aaabb####aa##aaaaabbbaaaa#abbbaa###aaaa###a###a##....###a##aa##aaabbbca##aa#.#######aaa##aa######aaa#########abaabaaaaaacbaaaaaa##a###a##a#afb##a##aabbbaaaaeggecebcbbbabbbcbbabaabbbbbbabbdddccccccabaaaaaaccc#####a#aaaa#a#####aaaaaaabbbaaabaa", "aaaaa############aa#a########.#abbcffcabbceccaaaaaaaaa###a###aa#######aaeebccccccbbbbcbbccbdddccccccbbbccbbbbbbbcbbabbbbbccbbbbaaa########.#aaa#a##aba#aa##aaabbbabbbaaa###abaaa#########aa##a############aa###aabcc#aa#aaa#######.##aaba#aaaaaa##aaaaa######baaaaaaa#aaaaaaaaaa###aaaaaa###ebaaaaaaaaaaaaabbfhgedbbbbbcbbbbbbabbbbbbbabbbbddecbcbbbbbbcbbbceaa#####aabca#a#a#a##a#aaaaaabbbbbaa", "aaaaaaa####aaaa#aa###########..#aabdddbbcccccaaaaaaaaaa##a##aaa###aa#####eddedddcddccbccbccccbbcbbcedbbcccccbbbbbbbbababbbcbbcbaaaaa############a#a#aa#aaaaabbaabaabaaa#aaa#abaaa#######aaaa#a###########.#aab##aacc#aa####a######..##aa#aaabbaaa##aaaaaaabbaabaccbaa###aaaaaaaaaa##aaaaa##a#ccbaaaaaa###aaaadgggfeababbcbcbcbbaabbbbaaabbbccddbcbbbbbcdccccca#a#a###aaaaaaaaaaaa#aaaaaaababccba", "aaabaaa#a#######a#aaa####aa###.###bcdcbcbabddbaacbbababaa#a##aaaa#aa#aacdccbddddddbbbbbaa#aaa######bfggfdcccbabbbbabaaabcbccabbaaaa#########a#aaaaa#######aabaaabbabbaa####aaaabaaa##aa##aaa#b####.#########abb#aaee##a###.##.##.###..####abccccbaaaaaaaaabcdaabbccba##a#aa#aaaaa#a#aa#aaaaaaaabebaaaaa#a##aabbfghhgedaaabbbccababcccbbbaabccbcccbbcbbcdcdcaaa########aaaaaaaaaaa#aaaaaaababbccb", "abaaaaaaaaaa######aaa########aa####bbccbbaabceaa#cbbbbbba#a##aaaa#aa###debacb#aacabaa##aa###########.#afhgeecbccbbbabaacbcccbbbbbbaa#a#########aa#aaaa####aaaaaabbbbbbbaa###aaabbba###a##aaa###.#######ba##aaadbaabeaa##aa#..###.##########abaaabdbaaababababbaabddbaa##aaaaaaaaaaa#aaaaaaaaaaa#aecaaaaa#aa#aaabdghhhfecccbcbbabbacccccbbbbbcbbbbbcbabbdcbcba########aaabaaaa##a###aaaaaaaaaabbb", "baaabbaaaaaaaaaaaa###########aaa####acccbaaaabcbcabbbbbbba#####aaaba#acbcaa#aaaa#abaa############.#####.dhihgeefccbbbbaabccbbbbbbaaaa##########a#aa#aa####aaa#aabaabcbbaa####a#aaaa###a#aaa################abbeebbbdd##a#######..####.######aaaaabcbbbbbbbbbbb#abcccbaaa#aaa#aaaaaa###aaabaaaaaaa#bcbaaaaaaaaaaaabehhhfedaaabaaabbccccbabbbbccbbabccbbbdcbbaaa#######a#aabaaaaa#aabaaaaaaaaaaabb", "bbaaaaaaaaaaaaaaaaaaa#########a#a####bbcbaaaaabeecbbaaabbaba###a#aaa##cedb#aaabaaaaa##a#########.##.###a#bfgedeffdccccbaaacdccccbbaa###########aaa######aaba###aabaabbbaaaa#####aa#a##abbaa####.##.####aaa#acbddddfega#a#######.######.##a#aaaa#aaaaaaaabccddebaba#bcba##aaaaaaaaab#aaaaabbbcaabaaaaccaaaaaaaabaabbehhfgebaaaaaaacdcccaabbcbbcbbbbbcdcbbcaaa#a######aa#abbaaaaaa#abbaaaaa#aaaaab", "bbbaaaaabbbaaabaa#aaaa###.#######a####abb#aa#a#cfecaabbaaaba#######aaa#bddcdaaabaaaa#a#aa######.########ba.a####bfddcccbbacdccccccaa############aaa######adb###aaaaaaabaaaaaa###aaaa##abaaa#####..#####aaaaabbcdeedfgd#aa########.#######a##aa#aaaa#a###a#abeedecc##aaba#aaaaaaaa#bbaaaaabbbbaaaaaaaaaccbaabaaababbadgggfdb#aaaaaabcbbbbbbccccdcaabbcdcccbaaa#######aaaaaaaa##aa###aaaaaaaaaaaba", "bbbbaa#aaaabaaaaaaaaaba#a######.#######abbbca##acdedcaabca#a#.###a######bddcfcaabaaa##a##a#####...##aa####a####a#abbccddcbbddedccccbaa####a######aaa#####acb###aaaaaaaaaaaaaa###########aaa####.####a##aaaaacdeceeeedc##aa########..#########aaaaa##a###aaaaaabcdedcb##aa#aaaaaaaaacbaaaaabbbbaaaaaaaaadfdaabaaaabbbbcdggfebaaaaaaacccbbbbbbccdcccbbbdcecba#####a####abbaaa#######a#aaabbaabaabb", "bbaacbabaabaaaabbaaabbaabb#.####.#######abbcba#aabecdbaccaa#a#.##aa##a###acacecbaaaaaa##########..######..abaa#aa####aceeddceggeddccbaa##########a#aaaa##aaa##a##aaaaaaaaaaaaa#########aaa####a#aaa####aaaabbdffffgebca#ab#######.#..#aa######aa###aa####aaaa#baabbdcc##b##aaaaaaaaabaaaaaabbbbaaaaaaaabcegcabaababbbbabgfgfdaaaaaabbabbbabbbcdddbcbccccdbaaa#a##a###aaaaaaa#########abbbbccbaab", "baaabbaaababaabbaaaaaaaaaaa##############abbaa##aadd##abbaaaa#.##aaa##a####aabcbaaa#aaa###a######..####.#..cdcbbbaa###abdcdedfghffddcbba###########aaaaaaaaaaaaaaaaaaaaaaa#aaaa########a#aaa#####aaa#a#aabbccddghhhfcca#aa##########...##########aa#aa###aaa##aaaa#a#bb####aaaaba#a#aaaaaaaabbcbbaaabaaabbefdabaabbbbbbbbfgggfdcaaaaabbbbbbbccdbdbcbcccbcbba##aaaaaa###aa#aaaa########bbabbbbaaa", "aa#a#aaaaaaaaaaaaaaaaaabbabaa#######.#.####aaaaaaabdeb#aababaa####aaa#abba#####aaaaa###a##bdba##a######....acdbabbaaaa#####cddaeggffedcba##########aaaa###aaa#abaaaababaaaaaaaaa##a###abaaaa###.#bbaaaaabdcddeefhhifdda#bb#aa##aa######..########ab##a###a##a#aaaa#abaabaaa#aaaaaaaaaaaa#aaaababbbbaaaaaaabcffbbbabaabbbaacefggdba#aabbbbcbacddccecbbbcccbba##aaaaaaaaaaa#a##a#a#######aaaabaa#a", "ba###aaaaa#cbaaaaa#abababa#a################aabbbbbbbea#aaabbaa#####a##adc##aaaaaaba##a####a########.#####...aca###########.####cffdcdecaaa#######aaabaa##aaaaaaa#aaabbbaaaaaabaaaba##babba######accbbbbbfccdeegdgfggeb#dc#####aaa#####...#######aaaa#aa##a#aaabaaa#bbaaaaa##aaaaaaaaaaaaaaabaabbbbbaaaaababbegdbbaaababbaabffffecb#aabbbbcbbcdddecbaabcbaaba#aaaaaaaaaaaaa###a########a#abbaabc", "a#######a###aa#abaaaabbccba###.##############abcbcbbcbea#aaaaaaa#######.##ba#a#aa#a#a#a##a####.###########..###ba##############a#aeedbadfcdddcbb##aaaaaaa#aa#aaaa#aaccbbbaabbbbbabcbbcdccb######abcdbddeeefddddb#afdcfebdca#####aaa######.#####aaca####abaa#aa#abcb#accaaaa##aa#aabbaaaaaaaaaaaabbbaaaaaaabbbbbgdbaaabbbbaaaccffgfdcaabbccccccddddfcbaaaaaaaaa#aaabbaaaaaa#a#aab####aa##aaa#bcc#", "aa###########aa#aaaaabbabbaaaa##..###########abdcccccbcdcaaaaaa#a##########aabb#abaa##########...#.########.######################.bfdaaccefddddbaaaaaaaaaaaaaa#aaababcccbbbbbccbbcddcabca####aaacdcabeggfdda.##.#cc#aefdbaaa###aaa###.##.####aaaaa#a###abd##a###ababbdc#aa#aaaaaaaabaaaaaaaaaaabbcbbaaaaaaabbbbgfbaaabbbbaabbbcefffddbabbcdccccedcabaaaaaaaaaaaaaaaaaaaaaaaaaaa#####aaa#aaaaaaa", "aaaa##########a######.#a#abbaa##########a####abdedcccccccba##########a######aaaa#abaaaaa#######..################aa#aa###############ddabedcgededbbbaabbabaaaaaaaaaaabbccccccbccdddba###abacbbcccba####aaaaaaaa##.###acfcaaa##aa#a############aa#####a#a##aea#aaa#aabbcda##aaa#aa#aaaaaaabaaaaaaababcbaaaaaaaabbbgfbabbbabaabcdcbdefffdbbcccccccdda#aaaaaaa##abaabbaaaaaaaabbbaaaa####a##aaaabaa", "aaaaabaa#######a###a##.###abbaa###############acdeccbbccdga##########a######.#aabaaaaaaaaa#a############.###aa###aaaaa###############.cdbbdefhhhfdccccbbbaaabaaaabbbbbccccdddcdccdb#####bbcbcddba####aa####a#a#####.##aedaaaa###aaa#######..#########a###a#bbbbbaaabbbbaba#aaaaaaa#aa#aaaabbaaababbabccbaaaabaabbbggdabbbbcbbbddcbcbdffdcaccccacccd#aaaaaaaaaa#abbbaaaaaaaabbabbabaa#aa####aabaa", "aaaa#aaa##########a###.##aaaaaaa####.##aa#####abccdcaabccffa##########a###aa####aabaaabaa#aaa####a######..###a#####aaa############aa###bdddeeddfgfeeeddcabaaabbbbbbbbbbcdddddeeeecaa####abbaaaa#######a#a########.###aaadaaaa#####aa########.#..##.##a######aaabbba#bbca##a###aaaaaaaaaaaabbaaaabbbaabddcaaaaaaaaabfgdaaabbbabdacdbcbdfffdbbdccbc#cbaa##aaaaaaa#aaaaaababaaaa#abbaaaaa#aaaaaaa#a", "###a#aaaaaaa######accbaaab#####aaaa####a#######accccabacccfe##.############aa####aa###aaa#aa####.#########.##########a############abca##bfcfabbbcaafffffdbbbbbbbbbabbcccdeeedefcaaaaaa##aaaaaaaa################a#.###abbcaa#aa#aaaaa#######....########aa####a#abba#bbbbaaaaaaaaaaaaaaaaaaabcabbbbbbabeedaaaaaaaaacfgecaabbabbacdbabcffffccccdda##aaaaaaaaababaaaaaaabaaaaaaaaaabaabaa##abb####", "a########aaa#######cddebba########aaaaaa#######abccccbabcdefea#.########aaaaabb##aaa#####aaa##.....#.##.##############a#####.#####aabcbaabfc######.afggggcbbbcbcccbbbccceeeeffhgccbaaa#aaabbaa#a######aaa########a#.##aacdba##ab#aabb##.#.####...########aa#####aaaaaaaabbaaaaaaaaaaaaaaaaaaccbabbbbbbabefdaaaaaaaaabeffabaaababdedabbcfffecccddaaaaaaaaababaaaa#aaaabbbaaaaaaaabbaaa#aa##ba###b", "#####aa#####aaaabbaaaacdb.#a#########aaa########abcbbbbbcdeeeefc.######aaaabaacbaaaaa##########..#..#....##############a###########abbbba#bd#a######aabbcfedccdddccccdddeeeeefgiedeebaaaaaabaaaa#aaaaa#aaaa###########aabcca##aabaaabba#....#....##.###.#aaa#######a#abaabbaaaaaaaaaaaaaaaaaaddbbbabaabbbddaaaaaaaa##adfecbbbbacddedbbccdffdccddaaa#aaa#bbaabca##a#aaabbaaaaaaaaaaaabb#aaaa###a#", "####aaba######aa#abbaaaba###aa#############.####aabcabcbbdegfebc.########abbbaaaaaaaaaa#########.....#.#.######.#######aa#####.#.##aaabbbbbc##a#######..##ehfeeeedddcedeffeeeeehf#abcecccbabbbbbaabaaaaaaaa########a###aacdba#aaaabaaaaa#..##..##.#..####aaa##a####aa#aaaabaaaaaaaaaaa#aaaaaabeeccbababbbbbaaaaaaaaaaaabcffbbbbcdccdcbbbcdfgfedcabaaaa##bbababa#####abbaaaaaaaaaaaaaaaa#aaaaaa##", "#a###aabaaaa###ba###ab##ba###a#############..###aaabcaabbdedefgb####aaa###aaaaaaaaabaaaa###########...#.############################aabbbadcaaa#####.######bfhhgggffffffffeeeefhhcaa##acfffeedddbaabaaaabaa########a####abebaaaa#a#a#aa############.###..#aa##a###aba##aaaaba#aaaaaaaaaaaaaaaaccdcdcbbbbabbbaaaaaaaaaaaaacfeaabbbbccdabccbdfffed#aaaaabaaaaaa#aa###aaaaabaaaaaaaaaaaaaaaaaaaaa##", "###aaa#aaaa#a##.a##a#aba#aa###########.#.#....####abcbbbbccdffegb...##aa###abaaaaaaaa#a#aa#######aaa###.####.#####################a##abbcfda#aaa###########.#acfhihhhijiiiihgfhhgcaaaa#..acccddccecccbaaabcb#######aa###abcdbaaaaa#aaa#aa##########.##########aa##aaa#aaaa########aaaaaabaaabbaaababaacbbabbbaaaaaabaaaaa#cefdabbbabbcbbbccdfggeb#aaaaaa###aaa#a###aabbaaaaaaaaa#aaaaaaaaaaaaaa#", "#aaaaaaaaaa##aaaaaaaa#aaaaaa##.###aa###.###...####aabdbbabbcfeced.#########aaaba#aaaaaa##ca#######aaaa######.########.########a#####aaabdhgfeaaaa#############.#aaba#addfghiiiiheb###aaaa###.####bdbcdcdcbbca##a##a##a##aabbdbaa####aaaaaaa#############a#.##aaaaaaaaa##aaa##a#a#acbaabbabbbaaaaaaaabbbbbaabbbaaaabaaaaa#a#bfgebaaababbbbbbbcggfeaaaaaaaaaaaaaaaa####aabaaaba###aaaabaaaaaaaaaaa", "a##ba#abaaaaaaaa####aa###bbaa##.#######b#####.#.###aacbbaabcdeccc##.########aabbba#a##aaa#bba######aaaaa#################.######aa##aabbfhhihdabaa##############aa######.##a#bgfb###aaaaaa########cbacccdfeecaa###aa##a#aaabcdbab##ababaaaaa##########aaa#####aaaaaaaa#a#aaba##aabfdaa#aaaaabbbabaaababdbbbbbbbbbbbbbaaaaaaa#dffcbaabbbbbbbbbcefgdba#abaaaaaaaaa#aa##abbbaaacba##a###aaaaaa##aaa", "aaaaaaaaaaaaaaaaaa#####a##aaaa########ab##.####..###aadccbbacdcaa###.######aabaaabb#aaaa###############aa#####a#####.##############aabbbehhhfcaaaa#####.########aaaa##aaa##a#.#caa####aa##########cdbbbbbcedefdcbbaa##aaaababbdbaaaaaaaaa#aba#########aa######aaaaaa#a#aa##aaa##addbbaaaaa#aaaaabaaaaaaccccdcbbabbbcbaabaaaaa#cfgdbabbbbabbbbbcfgedda#aaaaaaaaaab#a##aabbbaaaba#aa###a#aaaaaa#aa", "aaaaaabaaaaaaaa#accb#########babaa###aaa##.##a##.####abcbccabdeaaab#..######aaaaaaa#####################aaa####a#####.############aaaabdgihgcbaaa################aaaaaaaaa#aa###a######a##########dbaaaaaaaacbcefgfddcccddegdcbdbaabaaaaaaaaaaa######aaa####aaaaaaaaa#############aaaaaaaaaaaacaaaaaaaaabbbbdeccdccbbbbaabaaaaabefecbbbabbbbcbcegededcaabaaaabaaaaaa##aabbbaaaa#aa#aaa#bbaaaaa#a", "a##a#aaaaaa###aa#bbcbaa##aaa#aaaca##abb########a#####aacbbccbdeaaaba#########aaa##a#a####.################ba#########.##..######.bbabaaehhhgbaaaa#################aab#aabaa#aa###a##########a.###.ab#aa#abababbbcbcdcaacecccdefdc##abaaaaa##aa########aaba#aaa#a#aaaaba#a#aa#a##.##abaaaaaaaaabbabbaaaaaaaaaaccbbbcdbbbbaaabbbabbdgfdbbbabcbcccdddeeedcaaaaaaaabaaaaa##aabbaaaaa##aa####aaaaaaa#", "####aaaaaaa######abbcca##aaaaa##abbabba#a#####aaa######aabccedfaaaab#########aaa###.#######################b########.#ba#...##.#acbccccfgggebaaaa##a###############aababaaaa#a##a#a####a##a########c#aaaaaaaabbaaaaabccdebabbbdgeaaabbbaaaaa##a#######aaab##a##aaaaaabaaa###aaaa####ba#a##aaaaaabbaaaaabbaaaaacbbbcbbbcbbaaabbbbcbcfgecbcbbbccddccceddccaaaaaa#bbaaaaaaaaaaaa#aaa##a#aa#a#aa####", "##a###aaaaa#######aaaaaaaaaaaaa#aabbcaaaaa#a###aa########aabeeea###aaa#######aabb#####a######.#######aa##.######aaaabedccbbb##bbbbaabbbbccdeaa##a##a########aaa#####aabbbba#a#aaa#a####a###########caba###ababbbaabbabcdcddcbabehcaaaaaaaaaa############ab##aaaaaaaaaaaaaa#baaaaa###bb#a##aaaabbbbbaaaaabbbaabbbbcccbabbbaaaabbccccbfffcccbccccbccccddeedaab#aaaabaaabaaabaaa###aaa###bb##a#####", "aaaa##aaaaa#aa#######a#abbaaaab######aaaaa#aaaa#aa#######aabdefb#aaa#bc#######abcb#####a#################aa#a..###aabcdfffggfdcbbbbbaaaaaabdeaaa###########aaaa#####aabbbbbaaa#aaa#####aa#a##.#####aaaaaa##abaabcbbbaaabaabbbbcdefaaaabaaaaaa##a######aaa######aaaaa#aaaaaa##aaaa###aa#aaabbbabbaabbaaaaaaaabbbbbacccbaaaaaabbccdccdefegffdccecbccccdeeddcbaaaaaaabbbcbaaabaaaaaa#######aa######", "#aaaa##aaaa#############abaaaaaba##aaaaaaaabaaaaaba#####a##abdgca#aaadeb########bba#####aa#aaaaaa###aaa#ab#aa#.###.#acfhfddgccbaa#aaaaaa#abcfaaaa#######aaabbaaa#####aaaaaaaaa#aaaaa#aaaa##########aaaa#aa##aaa#acccabaaba#a###acdbaaaaaaaaaaa###a##.##aaaa###a###aaaaaaaaa###aaaa#abb#aaaabbbbbbbabaaaaaaaaaacbbbccbbbbaabaaacccccdfdbdfgeefcddabccbcedddccbbaaaaaabbbababbaa#aaaa#a##ab##a####", "##aaaa#############aa#####abaaabda##abaaaababbaaaaba####aa#abbdeaaaaaadf###############a#aaabbbbba#aa#aaaa#baba.#accbffffgddcbbaa#####aa##acfeabaaaaa###aabcdcbba######aaaaaaaaaaaaaaa#aaa##########dbaa########bbdcaab#abaaa##abceaaaa#a#aaaaaa#a###.######a#####aabaabb#aa#####a#bcbaaaaa#aaaabbbbbaaaaaaaaaaccccbccabacaaaabceeeeggdcdfffccccca#bbcbddeccccca#abbbbbbbaaabaaa#a#aaaaab#######", "##aaaa####.##########baaa##aaaaabda#aaaabbaaccbaaaa#####aaaaabbcbbaaabdgfe###aaa#######a##aaabbabbb#a#a#aabdceeedcabcaeddcfhecdb#########aacdhcbccbbbbbbbbdehhedba##aaaabbbbbaaaaaabbaaaaaaa########cba#######a#abbda#aabcbaa##aabceaaa######aaa##aa########aaa##aaaaaa#aaa###.###aabaaa#aaa#aa##abbbaa#baaaaaaabbbbbbdbbabaaaacaddacbbbbddccccbbda#cbbcdcddeccccbaabbbbca#aabaaaaaaaaaaaaa#####", "#aa###a####.##########aa#a##aaabaccaba#aabbaccbaaaaaaaaaaaaaabbccabaabeffeebbcb#.####.#aaabbaabbccccccccdddcec.#aaaaaaadccbbcccca.#######aabdhecdddeeeddeefecbbeedcaaaaabbbbbbabbbbcbbaaaaaaaaaba##aba####a####aacdccaa#ccbbaa##aabcdaa########a##aa########aaaa##aaaaa##aaa#########aaa##aa#aba#aabbbaaaaaa#aaaaaabaaaccbaaaaabccababbbb###bcbcbbecabbccdcddcdcccaaababbbbaaaaaaaa#aaaaaaaaa###", "#aa#aa##########a######a#####aaaaabc#abaaaabbcbbaa#a##aa#baaabbbbbabbcfffgghebdcbbacacbbbbbbbcbccdccfdaaabdedcaaabaaaaacccbbbbbbcb########abcfgedeffeeeegfcbbcbadgdddaabbbbbbbbbbcccccbbaabababbbaacbaa#########abcccbabccbbbaa##aabcb#a#######aa######a#a##abbbbabaa###a#aa########.bbaaa#aaaaaa#aaabbbccbaaaaabbbbbbbaaaaaaaaabbbccccaaa###bcdbabcbbbabcdddcbddccbbaaaabcccabaaaa#aabaaaaaaba#", "#aaaaa#######a####a###aa##.###aaaaabc#abaaabbcbba###aa####a#aaabbbaabcdcdeccdecccccba##aaabbaaaaaa##beaaabacfdeaabdecb#bdcbbbbbbaca#######abcdegeeeeffgfdabbccddeehhhfdbbbddeeccdcccdccbbbbbbcccbcca##a###a########aa#.aceccbbaa#aa#acb###.#####aa#####aba###abcdcbcbaaaaaaa#####a###bc#abaaaa#aaa#ababbbbccbaaaaabbcccbcbaaaaaabccdacccb#a###abddbbbbbbabbcebcbbdcccbbaabbabcabaaaaabcbaaaa#aaa", "aaaaaaaaaaa####aa#####aaaaa.###a#aaaccaaabaabccaa##aa#######aaaaaaaaadc##abaaaaa###a#######a#########cb#aaaacdddb#bbdda#becbbbbbbac#######abceffhffffda##babcccdeeddbddeecdcdebdeeccdddeddcccdeba#b###aa##a#########a###bedbbbbaa#a##aca###.#####aa####aaa####bbcdddbaaaaaaaaa#######adbbabaaa##aaaaaaacbabbccbaabaabbccccaaabbcbdcbcecccaa#a#a#adcabbbbbcbbcbccaabccdcbbbbcacbaabbaabcbaaaabaab", "bdbaaaabbaaaa#aa##a#aba#############abcaabababcba##aa#########aaaaaaabdb##aaaaaa###a##################b####aaccdeaabcbbaaeddbabbbabb#######bdfhghhgda###aabbcccecbbbdcccefdbbcbcb#eefgghggfeegdaa##a###aa#######aaa#####bedcabbaa#####acb##########a##aaaa####acbccccaaabaabbbba####a##dbba#aaaaa##aaaabdababbccbabaabbcddcbacbbccdacdbba#####aaaabcbbbbbbbccbbababbcddcbabbbabaaabcaaabaaacabaa", "aacdbaa##.##a##aa#aa#aba###.#########abca##aabbbca#..###########aaa##aab######aaaa#########aaa#a###aa#######aaccdfbabbaaaeeddbbcbbbdbaa#abcdfhjigca######abccbadb###cfbcbbecabbba#begfhggddcggdbbaaa##############a#aa#.cddccbaaaa#####ab##########aaaaaba####accbbbbaaabaabbbabb#######aba###aaa#aa#aaabcaaaaabccbabbcccdedcbdbbacdcdccaa##a#aaaaabcbbbbbacccbaaaabaccccbaaaaaaaabbbbaaaaababba", "aababbaa#####a##a##a###a####.##########aba###abbbbba####.#.#######a###aab######aa#a#########aaa#####aaaaa#####bbceebbbba#ceedccedcegdcbcddedbcbed#######aabccdbdda##adeeb##abbaaaaacbadeddfdghdcbbbaaa###########abbbcdbbdcbbca##aa#####bd###.#.###aaaaaaaba##abbbbbbbaaaaaaaabbaaa#######aa###aaa#aaaaaabcaabb##abcbbaabcedccdcbaaccccba####a#aaababcbaaaabbccbbaaababccbaa##aa##aaabaaaaaaabaa", "aabaaaaa#a#####a###aa##########..######aaba####aaaabb#.###############aaab##.###a#a#######aaaaaaaaa#a#aa###a##aacdceddfgfcfffgdccdeeefggdbaabbbbdcaa###aaabbcddeb##a#adfeaaaaaaaaa#bbaaccbeedhecbabbaaa#########.adccbcdbdbbcbba#######a#cda########abbaaaba##abbacbbaabaaaaabaaaaaa########aba##aaaaaaaaabcaaa#a##abca#aaabdefecbaadbbbaa##aa#aaaaaabdcbaaaaabcbaa#aaaabbbaaaaaaaaaaaaaaaaaaaaa", "aaabbaaa#########a##aaa###########.##.##aaaa#####aa#cba################abcb.####aaaaaa##aaaabbabaabbbaaa##aaaaaccgghggecdfihhg#a####a#a#abbccccacdcabbbbbacccdfeba#####aaaaaaa###a#ababbccadcgedccbaaa############ccbabccbcacabaa#####a#bacd###.####aaaaaaa###aaabbccaaaaaabbabbaaaa###.##..#bbb###aaaa#aaaaaaa########a#aabccceecbbdbbbbaa#aaaaaabbaadccbaabaabba#####aaaabaabaaa##aaba#aaa#aaa", "aaaa#aa##############bba##########..#.############aaaaaa#####.##########abca..####abaaaaabbbcccbbccddbbabbbbbcdefebdfd##a#.bedaa#########aabbbcbcddddcbbbcdeffd#########aaaaaaaa#aa#baaabcbacegedbbaaa##########bcdbaabbcccbbbaaaaa#####abbcca####.##aaa####aaabbcccdbaaaaaaabaaaaaaaa####.###abba##aaaa#aa##a############aaaa##cfebdcabcb###a##aaaabbabacbaaaaaba#a####aaa#aaaaaaa####aaaaaaaaa", "abbaaaa####a##########aa###################aaa####abaa#a################aabc#.#####aaaabbbcdddcdfffefgffeddfgdcdcb####aaaa###bb#######a##aabacdcddbdccacdefecc#a##a#####aaaaaaaaaa##aaaaabbbabfgdcbaa########aaacbbbbabbbbcdaba##a#####a#abccda####aaaaa#aaa#abaaaccbbbaaaababbaa##aaa#########bbba##abaa#####aa#a##aaa#a###aaa##defdcabbbaa##aa#aaaabbbaaccaaaaab######aaba#aaaaab####abaaaaaaa", "aaabaaa#################abba###############aaaaa##aaaaa#a###############aacaca.#####aabbbbccddfda#adeca#####b###aa#aa#aaaa##aaba#a####aa#aabccdccedebaacccb####aaaa###a###abaaabaaaaa#aaaaaababdgdbb##########cabbdbbbaaaaaccaaaaaaa##aaa##acdc#.#aaaaa##a##aabaa#ccaaabaabbaaacbb##abaa######..abca##aaaa#####aa#aaaaaa######abaabdggcaaa#aaaaaaaaaaacba##bbaaaabba#aa#aaaaa##aaaba###aa#aaaaa#", "#########.#################aaaa#.#.##aaa###aaa##aaa##a##aa###############abbbba#.##.#aabbbbcefc####...#####aa#####aa###aa####aa#######a#aaacbacbbdddbbccdfecbcc###aa####aa#aaaaaa###aaaaaaa##aaacfdaaa#####aaaabbabbbbaaabbabbaaa###aaaaaaa#abce..##ababc####aaaaabdaabbbbbbaaabbbaaa#a##.#######abaa#aaaba##aaaaa#a##aaa###aaa##ababehcaaaa##aaaaaaaadc####abaaaaaba###aaaaaaa###aaaaa#aaa#####", "####a######################aab#....##aacaaa#aabbaaaaa#####a##############aabbbcb##.###abbcceca###################aaaaaa#a#aa##a#aaaaaabaabbbbbacaaabbabaafddcbcb###aaa#aab##aaaa######a#######a##cfeaaa#####abcbbbbaaaaaabbabba###aaaaa#aaaabaaee#.##ddaaa####aaaaacaaabdcbbbbaabaaba#aa##.#######aaaa#aaabaaaaaaa##aaa#a##a#aaaaaaabbcgebbba#aaaaabaabbaba###aaaaabbaaaaaaaa#aaa##aa#a##baa#a##", "####a##aa##################aabda#.#####bcaa#abaabaaaaaa###################aaabcdb.####bbbdea##########.###########aaaaa##aaaaa##aaabbbbcbccbbaaaaaaaabbbaaaacdcbbbaaaaaaaabaa#aaa################abecaa####aadcabcaaaaaaabbaab#####aab#aaaaabaaade#..#ca.#a####abcbbb#abbccaaabbbabbbb#a############aa#aaaaaaaaaacaa##aaa##a#aaaaaacabccfebbbbaaaaabbbbaaba####ababacbaaabaaaa##a#aaaaaa##aaa###", "#####aaaa###.#a######a#######aab##..####abbbbbbbbaaa#aaa####aaaaa##########aabddea.###abda#################a#########a#####aaa###aaabbcdcbdbbaaaaaaaaabbbaaaaacddcbaaaa###abaa######..############abeda###ababbbccbaa#aaaaaabaa##a###ab#aa#aaaaaacec##ab.########babbaaaabbababababbcda###############a#aa###aaabcbbaaaaa###aaaa#ababbcdcdecaabaaababbaaa#######aaabbbbaaaaaabaaaa######a#aaaaa#", "a#######aa#a######aa#a#aaa###aaac#########abddccbbaaaaaaa####aa#aa########.abehghhc##abca##aaa##################################a#aabccb#aabaaaaaabbbaaaaaabaaabbbdba#aa###aaa##################aa#abefccaabbbcbabbaaaa#aaaaaaaa#aa###abaa##aaaabbcfdaba.#a######bacc##aaaabaababaabcbca##.#####a#####a#aaa#####aaaaab##aa##aaaa#aaaabccebbffbaaaaaabcaa###a#####bbbbbbbaaaaabaa#aa######aa#aa#a", "#baa#aaaaa###a#a#aaaaaaa####b#aaba#########aacbdcccaaa##a###aaa#aa##########bbfikjicacc###aa#aaaa#############a###################aaabccca##aaaaaabbaaaaabbbbaa#aabcbbaa####a#################a#aabaabdfbdcccbbbbbbbbaaaaaaaabbaaaaa#a#aaa#aaaaaabbcfdbb#######a#aaac##a#ababaaaabbcdaaaa##########a#aaaa#a#aa##a#aaaaaa#aaaaaaaaaaabbccdcaaegcbaaaaacaa#####a####bbbbbbbaaaabba##a###aaaaaa####", "####aa#aaaa##a#aaaaaaaaa##a#####aba##########aadcbbba####a####a#aa##########abcdfhiigc#a##aaaaaaaa#aa#####################a#######aadccccaba##aa#abaaaabbbcaabaaba#aaaaaa####a###a#a###.#####acbbcbaabcehfdccccbbbbbbbaaaaaaabaaaaaabaaaa###a#aaaabbcddca####.#####aa##aaacbabbbbaabcba#bc############aaa##aa##aaaaa#baaaaaa#aaaaaaaabccdeba#cgfbaaabca#a###aa#a###bcbbbbbbaabbba##b###aaaa#a###", "###a#aaaaa#aa######aaaaaaaa######aaaa#######a##aaaa####.###aaaaa#a###########abacdhiiga##abbaaaaaaaa##############a########a##a##abbcabc#abbaaaaaaaaaaaaaacaaabaa###a###aa###a###aaa########bbbbcbbbbddceihebbcbbbbbabbaaaaaaaa#aaaaaab#a#####aaaabbcccfb#.########aa##abaaaaaaabbaaaabbcbc#####a######ba##aaa###aa###aa##abbaa#aaaabbbdcccbbabdhebcbaaaaa####a#####accbbbbcbaacba#aa###a#aaa###", "#a####a#aaaaa#aaaaaaaaaaaaaa#######aba#######a####ab########aaaa##a#a##.#..#####aehhjihb#abacba#aaaaaa############a#a########aa#aabdcc####abaa##a##aaaaaa#ababa#a##aaaa#######a#aaaaaaaa##aacaabcccbcbabbcghgdbbabbbccba##aaaaaaaaaaaabaaa####aaaabcbcdccaa#########.##aaaaaaaaabababbabaa#######a#a##abbba#a######a###aa#aaaaaabbaabbcdbbbbabbadffbbaaaaaa#a##a####aabcbbbccabbabaaaba##baaaa##", "##aa###a#aaa#a##aaabbaaaaaaaaa##aa###a#############bba#.###aa#aaaaaa#######.####adfehjif###aaaaaaaabbaaa#a########aaa###a######abbbbcca.###a###########a###aa###a#############aaabbbbbaaceb#aaabbbccbaaabbbdggdcbbabbbbaa###aaaaaaaaaaba#aa#a###aabbbbcdc#####aa#######aaaabbbaaabbbbbbba#aa#######a##aabbaa#######aa###aa#aaaaaabbbbbccaaccbbbccdfgedaaaaaaaaaaaa##aaaccbcccbbccba##aa##abaaa##", "########a#aaaaa#aaaaaaaaaaaaa#aa#ba###########a####aaaaa#.##aaaaaaa##a#a########bbceeijfc####bbababaaaaaaa#########aa##a#aaaaabbadcccba####.############aaa#aa#############a##abbabbbaa##ceaaa#aaaabbbaaaaabbdgfbbbbbabba####aaaaaa#aaaaa#####a#aabbbccdccca#aaaa######aaaaababbaaabcabba##ba##a##a#aaaaaaaaa#######a#a##aaaaaaaabbbcccaabbddcaabbabdffdbbbaaa#aa####aabbccbbcbbddbaaa####acbaa#", "#######aa#a#aabbaaaaabaaaaaaaaaa##aa#a#############abaaaa####abb###aaa#a########babcfhiiea###acbbabbaaaaaaaaa####aaba#aaaaa#aaabaccbcbaa###############aaaa###a##############aabaaaaaa####bbbabaaaabbbbaaaabbbcffbbbbbbbbaa##aa##a###aaaa####aa##aabccefcadda##aaaabb#aaaaaaaaaabbbbbbbba##abb######aaaabbba###############aa#aabbcccbabbaabdccccaabacfggccbaaaaaa##a#aabccbbcaabdbacba####bbaaa", "aaa####aaaaaaaaaaaaababaaaaaaaaaaa#aa##############abbbbaaaaa##bbbaaaaaaa######ab#bccehiic###abcaabbbaaaa#aaaaaaaa#aaaaaaaaabcbccacba########.##########aa###############a#aaa#aa#a##a#####acbddcbaaabbbbbaaaabbefcbbbabaaaaaaaa######aaa###aa#####abcdghedcbbbbbcccdcbbaaaaaaaabbbbbbabaa#.acca#a###aaaaaaa########a##a###aaabbcdcaaaaaabbaccddaaaaacaadggfdbaaaaa#aaaaaabccbbaacbaababaaaabbaa", "aaa#a#####aaaaaabaaaabbbaaa#aaaaaaa###aa#######.#a###abbbaabbbbaaaaaaaaaaaa####a##ababchie###aabbbaaaaaa#aaaaa#aaaaaaaaaaaabccccbccb####a#############aa######.###########aa###aa#aaaa#a###abcccdbbbbaaaabbaaaabbceebbaabbaaaaa#########aaa##aa#####acdfdefebcddcbbdffdcbaabbaabbbbbcdbbaaa##abca#####aaaa#a##a#aa####a#a##aabbdedaaaaaa#aaccbeda#aabbaaaacefgfdbaaaa#aaaaabcccbccabaaabbaaaacc#", "##a##aa###aaabbbaaaaabcbaaa#aaaaaaa#a##########a#####aabbaaabaabaaaaaabcccca########aaacfhc##aaabccba#aaaaaabbaaa##abbababbcccbeecba#####a########a####a#a#####.##########b######a##a##aa###aababaaabbaaaaabaaaaaabdfcababbaaaa##############.#######bddcbdeffcbbba##dihdcbaaaaacaabbbdcaaabaa#aba#####aaa######aa##a###aa#abcdccdb#aa###aaaccdcbaaaaaaabbaaabehhebaaaaaaabaccbcbbbaaaaaaaaaaacb", "a##aa#####aaaabbbaaaaaababaaa#abaaa#############.###aaaabcaabaaaabbbbacdedaaaa######a##bccdccaaaaaacdcaaababbbaababbbccbcbbcdcceedc####a##a###########a#aaa######..####.####.###aa######abbaaaabaaaaaaaaaaaaaaaaaaaacfeedbbaa############.######aaaa#abbaaaaccbabaaa###igdccbbbaaaaaaabcbabcbcb##a######a####a#aaaaa####aaaacb#abdcaaa#a###a#acddcbaabaaaaaaaaadfhhedaaabbabbcccbbaaaaaaaaaaaaaa", "ba##a##a#aaaaa#aaabaaaaaaacaabcbaaaa#aa#########.#########aaaaaa##ababdefcab#aa########aabdfgbaaaaaacdcaaabaaaaabbbbabbcbbbcccddaaaa####aa#aa########a#aa#########..##.##..###.###aaba###aaaaa#abaaaaaaa#aa#aaaaaa#aaaegdcbbbaa###########.######aaa##aaaaab#abaaaaaa#.febaaabcccbcbbcbbaaadbcecbaa#####a#aaaaa###aaa#aaaaabaaaabccaaaaaa#aa###adbbbcbbaaaabaaaabbchifbabcccabbccaacbaaa##a#aaba", "#ba########a###aaaaaaa#a#aaa#abaaaaabaa##a#aa###############aab####aaaaabccaaa##a#.#####abcdfb#aaaaaaaaabaabbbcbbbbbababbcdddfedcb#a##aaa#aaaaa###aaaa##aaa##.######.###.###########a#########aaaabbaaaaaaa###aaa##a###bfedcbbaaa############a####a######a#aaabcbbbaaa#gdaaa###bcddcecccca#addefgfddca###a##aaaaaaa##aabaacb####bbdcaaaaaa#aa###ccbbbccbaaaaaaaaabaadhieabaabbccdcbabbaa#####aaa", "#aab####aa###aaaaaaaaaaaaaaaa#aaaaaaa#####aaa#a##.############aa#abaaaaaaabaaaaa########abccdfcaaaaaaabbbaa#abbcbbaacabbbbcddecdcc####aaa#aaaaa#aaaaaaa##aaaa###..######.#####a########aaa#a####aaaaa#aaaaa########aa####dedbbbaaa##############a###a#####ababccbaaaaa#gcaaaa####bdebbbbbca#bddcbaabccaa##a##aa#aaaaaaabbaca####abdbaaaaaaaaaa#a#ccbbbbbbbaaabbaabba#adhgcbaccccccdccba######aaa", "a##aa#a###aaaaaaaaaaaaaaaaaaaaaaaaa#aa###aaaaa###.#############a##abababbaaaaaba######aaabbcddhcaaab##baaababaabaaabbabbbbcdddffeeb###aaabcaaaaaaaa###aaa#aa####.######a#######b#####aaacb#######ababaa#aaa##aa########a#aaeecbbbaa##################a##a##bbaabb#aaaa#cd#aaaaaaaace.aaa#bdccdcaaabcacbaba###aaaaaaaabaabccaa#aaabbd#aaaaaaaaaaa#bcccbbbcbbaaaaaaabbaabbhidbbcccbdeddaaa#aa#aa#a", "aaaa#aaaa##aaaaaaaaaa#aaaaaaaaaaa######aa#aaa####..#########.###aaabbbcbbbaaaaaaba#####aabbcccegcbaaaaaaaacbaabbaaabaaaabcccdeeffddaaaaabcbbbcfffecdcba#abb#############aa#a##acbbcba#bbaa########aabba###a##########aa#aaa#eedccbaaa#####a#a###########aaa#aaa#bcaaaaaafaaaaaaaaacfa##a#aaaba#abaaccbcbbccbaaaaaaabbbbbbaaaa#a#abccc#aaaaabaaaaaadcbbbcbcabbbbaaaaabaaccfjgbccbcccccaa##aabaa#a", "#a#aa#aabbaa#aaaaaa##abaaaaaaaaa##aaabaa##aa#a###.#.##############aabbbcacbaca#aaca#####aabbccdeedbaabbaaaabbabababaaaabbccdddffedffb###bbccefebccbdeda#aaabbaaa#######aaaaa###aabcca#adaaa#####aba#aaaa##aa################.cedcbbbbaaaaaaaaa##a######aa####aa#bbaaaaaadc#aaaaaabbee####abaaa#aa##abaaabbabdcccdcbbaccbcb##aaaaabbcdbaaaaababaaaacbccbbccbaaabbbbaabababadjiedccccbbbaaaa#aa#a#", "aaaaa###aaaa##aaaaa####abaa#aaa#a###aaaa######aa#################a##abbbcccbbbaaabba##.#aabbbbddedd#aacb#aaaaaaaaaaaaabbbccdddggffghecbbaabbbddabaa#aaaabaaa#bbbaaaaa##a##aba###aaabb##bbaa####aaaa###########a########.#####aaeecbaabbaaaaaaaaaaaaaa###aaa##a##aa###aaabeabaaaaaabchca###a#aa#a###a##aa####bca#abdecbcdbaaba#aaabbdcaaaaaaaabbaaaaccbbbccdbabaaabbbabbbabacjkjgfdccbaaaabbaaa##", "#a#aaaa###caa#####aaadb#aaa#aaaa#aaa##aaa###aaaa#a####a##a######a#a##aabbbbabba##aabaa##aaaabacdececaaaba#aaaabaaaa#aaaaccdeeefgeeefbcbbbcbbbcbaaaaaaabaaaaaa##abba##a#####aaa###aaaa##.#ba##.###aa############.##.#############dedcbaabbaaaaaaabaa###a###aa##aa#aaaaaaa#dbbbbbbbaacgg#b####a####a##aaabaaabbcaa#abacdcaaaabaaaaabbccaaaaaaaabbbbcbabcacccccbabbaabbbabcbbaaejklhfcbcbbaaaa#aaaa", "####aaaaa##aaaaabaaaaabbaaa##aaaa###aabbaa###aa#aaaa###aa#######aa#a##bcccaaabbaa#acaa###aaaabbcdcdcbaabaaaaaabaa##aaaabbccdfffghffdaabbaabccddbabaaaaaaaaaaaaaaaaa##a#######a####aaa###.aba######a#################a############bfedbaabbbbbaaaaabaa##a#########abbbba##dcbabbbaaabcgdc#####aabaa###a#bbbbbbbbbbaaabbcbbabbbaaaabbbdebaabbbaabcbbbbacbabbabbbbabbbaababbbbbghillgcbbbbbaabbaaa#", "###aaaaaaccdcaaaaaaba##aaaaa##aabaabaaab########aaaba####a###a##aaaaaabccbba##bbba#bca###aaaaabdcddcda#abaaabaaaaccaaabbbccefgfghffaaaabbaaabefbcbaaaaaaaaaaaabaaaa##aa#########a########aaa###a##############.##.#.############a#abdebabcdcbbcbaabba############acdea#abecbaabbbaabbdfc##aaaa#a#aaa##abbbcaba#adebaecabbaccdcbbabbcbdddbabbbabccccbbacbbbbbabccbbbbbaaaabcbcfijjkjfddcbabdebaaa", "db#bdccbbcb##aabbbbaa###aaabbbbaccaaaabca####.#####baba##a#aaaaa#aba#accbbbbaaaaaaaacbaaaaaaaaacccdccc##abaabbaaabdbabbcccdffffhggbaaaaabdbaaaababbaaaaa#a#a#aaaaba#a#a################aabaaaaa###########.#####...#####.##.####aaaa#bedcccaaaaabbaaaaa##a#####aaaaddaabdebabbbbbabbbbgcaa#a#aaaa###aaabdaddabaadcfdfgdacbaabcbbbcccbdcdffdacdcedccbbbacbbbbcccccbbbbabacabbdgigbbgjjedcbbbccaaa", "#bbbaaaaaabaaabbbea#aaa#abbbbabaaaaaaaaba#############b####aaaaaabaa###abbbbbaaaaaaaacbaaaaaaabbcccccdd##cbcbcaaaaaaabcdeffgggiigabbbbbaabcaaaaaaaaaaaaaa#aaa##aaaaaaa################aaba###baaaa#######.#####....#########.#a##aa##a#adfca###abbaaaaaaa#####a####bdbacfdaaaaaabbaacedfa#aa#########abefeddcccdebccfggfedaaccbacddecdccdeddccefddcccccccabaabbabaabbaabacbbhijgdbacfkjeedcba#a#", "###aaaaa#abbaaaaaaa#a####bcaaaba###a#aaaa######a####aa######aaababaaaa##aabbaaaaaaaaabcaabbaaaaabcbccccbcbaaaaababbcccdefgfgghkgbaabbcbccbaaaaaabaaaaaaaa#aaaa#aaaaaaaaa####a########aaabba#aaaa#####a#.###.######.#####.####.##a#abaaa#aaddaaabbaaaaaaaa#########aabgggfbaaaaaabbbabbcfea#a#####aa##afghhfggghhgccddffhfffcccbccdfgeeeceec#aabcddcdddccebaaabaaabaaacbbbb#ejhjgbbceceikibbceba#", "aaa##a#aabbabbaaaaaaab####bc#aaaa#aaaaaa#ab##aaaa##a#aa######aa#baaaaaaaaaaaaaaaa#aaaaacbaabaaaabbcccccdbaaaabbbbccddeeefeegjheb#a#aabaccdcaaaaaaabbabaa#aa##aaaaaaaaaaaa#######a###aaaabba#abaa####..###.###.####..#####.#######aa##ba#####bcbaaabbaaaaaa########abdfggebabaaaaaabbbbbchfaaa######abbfegggefgghgffeecefggfhheecdddeeefdcefcabaabccbaabcbcbaaaaaaabbabbbbbbfghggdbcbcbbgkjfbbecb", "#aa#a###aababbbaaaaaaac###.acaaaba#aba####ac#aba###aaaaaaa#aa##a#a########aaaaa#aaaaabbbbbaabbaaabbbccccebaaaabbccddddedegggfhbaaa##aaabcccaaa#aaabbbbcbaaa#####aaaaaa#aaaaa#####a###aaaaaabbdaaa########...##.###..########.#####aa#aba###a#accbaaaaaaa#######aaaaabccdeeccbbaabaabbbbegfgeca#####adefffefgggfghggfeeccegihijigedbccfeceddfeaaabcacbbaaabbaaabaaaabbbbbcbchgghfgdabbaa#bgkjgcdd", "d#a#a####aaaabbbabaaaaaa####abaabaaaaaaa###acdbaa#a###aaaaaaaa###########aa#a####aaa#abbbbbaabaaaaaabcbccdaaaaabccddeefefhgefgbaaaaaaabaabbaa##ababbaaabcca#aa#aaaaaa##aabaaa####a####aacba#bcb#aa#.####.#...##.##..################a########a#adbaaaabaa#aa##aaaaabbbcdeddddcbabebbcbbffeefdec##adeeefeffefghgghghhgfedfheabfghhfdcegecbbbbccaaaabcaaaaaabaaabaabbbbabbcdfffgffffabbbbbcabgkjec", "cdaa##aa#aaababbbaabbaaaa####bbabcaaaaaaa##.acaaaaaaaa#aaaaa#ba###########aaa#a###aaaababbaabaaaaaaaabcccdgbbbccccddeffefgfeffbaa###a#aaaaaa#aaaaaaabbbccaaabaaaaa##a###aaabfd#####aaaabbaba#aa########.###.##.###############################bacedcbbbbabaaaaaaaaabcccccddedddbbdeecdefeededdeeffdegffeddefgfgggggcb##abbca###bbefeefeddcdcbeeaaaaab#a###babbbbbababcbccfgfeeefegcbaaabbca#afkh", "gdcbaaaaaabbbaaabaaabbbbaaa###bbcbaa#aaaa#####a###aaaaaa#aaa#aaaaa##a#####a#aa#aa#a#aaaabbaaacaaabaaaabccdfgddddddccdfhhffddfbaaa####aaaaaaa##a#aaaaaabbdb#aaaaba#a#######aacegdbaa#aaabaabbb########.#.##.##..#...####.#######################babedededcbaaaaaaaaabccddeedefecfffeeffddddddeddeeeddeggfddeeffbaaaaaaaabdb#baa#a##cbdfeaaabbcdfbaaaaa####a##abbbbaabbbbdcgfgeeedeefabba#aaaaaabg", "gjgccbaaaaabbbbbbbbaacbaaaaa###aaaaaaaaaaa####aaa#####aaa##aaa#a#a#######aaaaaa##aaaaaaaabba#acaacbaaa#acccfgdefefcdecfhhddbcaaa#a#####aaa#aa###aaaaaaabbeebaaaaaaa####.###aaacdcbaaaa#aaabba#############.#.#.#...###########..###############aacddeeededceeedccefggfgggfedggghfdfecdddccccddeeeeefddfffddddbabbbaaaaabefcdb#aa##aaabcaaaaa#bdgb#abaa#######ba#bbaabaaeegfgfeeeecfcaaa#aa#aaaa#", "#bgifcbaaabbbcbbbbaabbbaba#a#aa##aaaaaaaa######aaaa##a#aabaaaaaaaaabaaaba##aaba###aaaaaaaaabbabbabaa#a#abcceffeecb#cddeeggcdb##a##aa##aa#########aaaaaaa#bedaaaaaa##########abaa#aaaaaa#aaabaa#####a####################..######.#a##.#########aabcccbcda##afgggffdbbbabdhheghifedddeecbccdcdefffeeffdfggfdbaaaaa#aababbacdddb#bb#aaa#a####ababbdebbbaaa####a#babbaaacddfgffeefeeddcbabbaaaa#aaa", "a##ehiecbbbccdccbbbbaabbaaa#aaa##aabaaaaaaa####aaaa#####aaba#aabcbbbaabbba##abaaa######aa#abbacbaaaaaaaaabcccdfcaa##bbbbceabaa######aa##a##aa####aaaaaaaa#abaaaaaa###a######abbbaba##aaa#a####aaa###a############.########################a####aa#dcddcdb#a#dedeedcaa#baacgegiifedddddddcdddefeffggfgeedbba#aaaabbaabaaaaabceebbdaaaaa######aaaaabdddb#aaaaaabacbbbaabdfffgfgfeeeeddgcbaaaaa####", "#b##adiifdbcefedccccbaabaaaa#aaaaaaaaaaaaaaaa##abaa######aabbaabbcbbaaaaaaa#abaaa#######aaaaabcca#aaa##aaaabbccc#########a###aa##a###aa########aaa##aaa#aaa#aa#aba##a#######aabbabcaa#ababbca##aa####a#####a.#########################a###a##acba.ddeecccba#cfeeedcaaaaabccbaigfeeeddddcbcdcddfeffggeedaabaaaabaaabbabaaaaa##cffedeaa#a#aaa#aaaaaa#abfebabaaaaaacadcaaffecffffgfffeeggaaabaa####", "#caaa#.ahjgffefgggffecbbbabaaaaaaaa#aaaaaaaaababaa#aa#a#aaaabaaaacccaaaaaa#a#aaabaa######aaababaaaaaaaaa#aaaabccb####aaa##ab###aa#####a#a####.#aabaaaa########a##aba########acbbaaaaaaaaaabbbaaa################a###a####aa############aaccb#adcbbdddccbcdebdedccba#a#aabdcbaggeeddedcbbbccdeeffffhggfcbaaaabbbcaabaaaba####a#debceea#aaabaaaaaba#aaa#cfgcaa##aabcbcbdffedfeeeefefeedhcaaaa#a###", "####aa##.behhgfeeeddefedbbbbaaabaaaaabaaaaaaaabaaaa#aaaa#a#abbaaabbcbbaaaaaaaaaaaba####aa#aaabaaaa##a#aa#a#aaabbcc.##ab##aabca##aaaa############aabaaaaa#a#a#####aaa#bb#.####bccbaa##aaaa###aaaaa######a#######bbabba####bb###a#a###a###bcccccdcdccddcbbabcdcddccba####bdddb#bdcecdedcbbbbbcceeeeehhcdaaaababcbcaaaaabaaa#####ab#aabb###bb##abcaa###a##adfeba###aabaaefefffedddeedefefhbaaa###.#", "#####aaaa###chikjiigedcegcccbabbaaaaaabbaaaaabaa#aaa#a#a##aaaaaaaaabaa#aaaaaaabbbaa######aaaaabaaaaaa##aaba##aaabab.###aaaaaabaa#aa#a#############a###aaba########aa#cbb####abcbaaa##aaa#a######a#.####aa###bbccbbdccbaaabb###a#aaaaa###cbbbaccccbbcccaaaabbccccbbaaa#accdcb##bacgeeedccccbccdeeefggebdaaaaabbbbbbaaabaa#####a#a#aa#####aaaa##ca#####a####beeca#b#abadgefffedeedfdcffeff#a#a###.", "..######a#aaadd#acdhihecdgecbcaa#aa####ba#aaa##aa##aaa###aaaaaaa##ababaaa#aaaaabbbaa######aaaaaaaabaaaa##baa##a#a#b######aaaaaaaaa#################a#aa#bcb#####aba##a######bbbcbaabcaa#################a#abcdbdefededcbcbaa##aaa#a###bcbababbccbbbbbcaaaaabcccbaabaaaabcdbba###bhhfhgeddccbccddfhhhfbbaaaaaabbbccaaaabaa####aa#a#####b####aa#aa#ab###a##aaabefd#a#abbfgfeeeeeedeeddefggbaaa####", "##.######aaba#abaaaabeiiebceddcbaaaaa###aaba#########a##aaaaaaaa###aaaaaaaaabaabbbbaaa###aaaaabbbaaabbaaaaa###a###bb#####aa###########a######a#####aa#baaaba##abcedcbaa##a##bcccbaaaddccaa##############a##bbceffgfededdedcbaa#a#aaa#bcabaaabbbccbbbbbbaaaabbcbbbbaaaaabbcda#a##ehgfeeeeecddbcddfhhgcbbbbbbaaaabcbbbaaaaa###.#a#a#a####aaa###aa##a########aabbbedbacfegggfeeefeddccddgihdaaa####", "##.###a####aaaa#bacbaa#chidccdfdbbabaaa#ababaaa###a###aa#aaaaaaaaaba#aaaabccccbcccccabb###aabaabbbcbaabaa########aaab.####aaa##################a####b##aaaabb#aacdddcbb#######bccaaaabdbba#####aa#a#########abccccccddcffhigcbaaa#aa#acaabaabbbbaaabbbbbaaaabbbbaaaaaabcccdda#a#higheddefedeecdffffeeaaabbbbaaabcbaabaaaa#########a####aaaa######a#######aaabdcbadgfdeddegfgfeedcccccehigaaa####", "###########aa#####aacdb##ejgcbbfedcaaaaaacbabaa#####aaaa#aaaaaaaaaaa##abbbbbbaaabbcddddbccdcccbababaaaaaab#########aba..####aa###################aa########aa##aaaabbbba##a####ccaababdaa#aa#####aa##########aaaaabbccdfgjjihdcaa#aaaacbaabbababbaabbbabaabbbbbbbbbbbbbcccddebadhggfffeeffffeeeffdccddaaaabaaabbabbbbaaaa######..######aaaaaa#a###a#aaa###aaaccc#ceggedddcffffedcbabccdfgebaa###", "#########aabaaa####a#aabbachjgbacdedcccbabaaaaaaa#####aa#######aaaaaa#aaaaaaabaaaabbccdccddcbbbabaaaaaabbaa########aabb.#######a##################aaa##########aa##abaaaaa######bbaaaaba#a#a#.##.#a#aa###aa###aaaaaabcddgijijjigeba#abdcbbcdcabbbbaabbabaaabbbbaaabbbbbcacddee#dfeeeffeccdghhfffebccccaaaaababbbbaaabba#a########.###a##aaaa##aa##aaaaa####aababbddceggfedcdffedcbaabcdeeffaaaa#", "#######a#aaaaaa#a#####aaaabcdiibaaacecddcbaaaaaaaaaa##aaa########a#aa###aaaaaaaaaaaaabcccbbaaaaaaaaabaabbaaa######aaaaca.###.##a#a####a########aaaaaaa##...###a###a##a#aaaa#####bdaaaaaa########a########a##a##aaaaabbbbegfeedeghgeccddeeefgcbbaaaabbbbaaaabbbaababbbbcccbceeebegdddeffedbdeiihecbcbdbaabaaababcbbaaabaaa#a#.############aaaa##b#a##aaaaa##aabbbbccdceghgeddefedcaaaaccdedfaaaa#", "########bcaaaaa##########aaaa#gidaaabedcccbbbaabdbaa####aba#a#############aaaa###aaaaaaacbbaaaaabbabbbbbcbbabaa######aabb..##.####aa#aaa######aaaaaaa####a#.####aa##ba#aaaba#####dbaaaaa######aaa#aa######aa###aaa#aaabccebabaabbdfhhhgfghggdbaaabbcaaabbaaabaaaaaaabccccccedchigdcdddcedccabghdbaaabcaaabaaaaabbbbcbbaa##a########a##.#aaaaaaaaa#aaaaaaaca#acbbbbbcccdefeddeecdcbaababcfdfeaa##", "########baaaaba#aaaa#####a####aciib#aacdddbabbaabbb#aa#####aa#############aaaa##aaaabaaaabaa##aabababbbbccbbbcb#######aaaa#...##.#####aa########aaaaa######a############a#aaaab##abbaaaa#######cb############aa#aa#aaaaabaaa#######bfhigihhfbaabaaaaaabaaaabbaaaabaaaccbccdcchiihhdbcddcddccbbeeaaaabbbaaaababaabbbeeeaa#####.###.aaaa#aaaaaa#aaa#aaaaaa#bbadccbbbbccccbcddddcbcccbaaaaddddge###", "########a##abbaaa#########a#aaabcfjhaaabcdecaabaaaaaaa#######a########a#aa#abaa#####aaabaabaa##ba#abbccbaccaaca########abcb..######################aa###ceb#######aaa#####a#aaa###acaa#aa#######b############a#a##aaaaaabaa########abacfhhfcbbaaaabaaabaaaaccaaaaaaaacbcbbcffgfgcegeddeddcdccbcd#aaababbbaaababcaabaaccba########a#abaa##aaaa##aaaaaaaaaababcbbbaccbbcbccdddcbbbcbbcbbadcdeehd##", "########bb####aaba#########a####aabfjfbbcbcfdbabaaaaaaba######aa######aaaaaaaaa##a#####aaa######aaaabacbbaaabaa#########aadc...#######.##########aaaaaa#ddeb#a####aaaabeb######a###bbaaaa##b####aa#.##########a#a#a#aaaabaaa##b###.adbaabeecbaaaaaababaaaaabcabaaaabbbbbcdcfgeddgbbggeedddcccccc####aabaaaaabbaabaaa#acda############aaaaaa#aaabaaaaaaaaaabcbabbbabcbbbbcddccbcbbbabbbbccdfggf#a", "aaaa####bc##a#aaaaaaa###.#####.####aciiecccbceebaabbabbb######a#a####a##aaaaaaa########aaa#######aaabcbbabbaaaaa#########acfc..####.#.###.###aa###a#a#aaabcaaaa###aaaa##########a##bdcaaaa#ba###baa##########aaa####aaa#bbababdcbaacbbbaaaabbaaa##aaaaaaa#aabbbaaabbbbbbcdcccddcdec#adfedddcccbe#####aaaaaaaaaabbbaaa#bdb##.#######.####aaaaa###aaaaa##aaabccbbbaababbbbbcdccccbcbbbcbbbdcefghc#", "########a#####aa#bbaaaba######...####adhifegfddfdcabccbaa###aaaaaaa######aaaa##aa##a###b##########aa#aaaaaabaaa######a###abdfb..#######.##.#####aaa#a###baaa####aaa#########a####a#bddcbaaaa####aaaa####ad##aaaaaa#######abadddccccdcba##a#ababa###aaaaaaaaabaaabbbbbcbbcbbccdccbaba##afedddccbfa######a#aaaaaabbabaaaaab#####.##..#..a###aaaaa#aabbaaaaaabcccbbbabbbbbbbbddccbbcbbbcbbcfdeeffha", "##############aababaaaa##########.##.#..chjjhjifffdeccdbaa#aaa###aa#####.##aa#######.#######a#########aaaaaaaaaac########acchc.....#..###########aa##aa#abaaa##aba##a######aaaa##a##bdcbaaaa#####a#aa###bd###aaaa#aa##a####adgdcbbcddbb###aaa#a#####aaa##aaa##abbaabbbbcbbbcccddeccc#a#bhggfedaec##########aa#aaababaaaaaa#####.##.##.####aaaaaaaaaaaaaaaabdcbbbababbabbbabddcbbbbbbccbbdifdefge", "a###a##########abb#aaab#a#######...#####.##a#acgkigfeefdcaaa##aa#aaba####..######.#a###a#aa#aa##.#######aaaaaa##ba#####aaabbeha...###.###.#######a##aaa#aaa#a#aaaa###aa#a###aa###a###cdcaaa######a#####abb####aaaaa####a####deebbbccdbba##aaa#aa####aabaa#a#aabbbaaaaabcbcbbccbcedbba###cdffffeefba###########aaaaaabcaba#####.####.#######a#aaaaaaaaaaaaacdccabbababbabbaabcccbbbbbbbccdeeedefh", "f#######aa##a##aaa#aa#bba#########..############afkjgfgfeeeba#aaa##a#######.####.#.#####abbbaa##########aaaa##a#a#######abbcdhe#...######.##a####aa#a###aa#a#aaaaa######aaa###########bdbbaaa####a######aa##.##aaab####aabdecdcbaabbbaba##aaa#########abaaa##abbbaaaaabbbcdbaccbcebaa####adghfedeeba#############aaaaabbcb##########.######aa#aaaaaaa###bcdccbbabbbacbaabbbbbbdcccbbbbbcccccddeh", "hc#####aa######aa####aaaa#####a###.......##aa##a###gijhhhggeb##baaaa####...#####.#..a###acccaaa##########aa#####aaa####aacdddhf#..###.#..####aaaaaaaaaa###a#aa#aaaaa#####aabb##########cecaaa####a##############aabb##aabacddbcbbabbbaaaaaaaa##a#######baaaaa#abbaaa#abbbabcbbbcdgd####a##adcgfecdeb######a########aaaa#baaba########.######aaaaabbbbbbcbccbbbbbbbbbaaaaabbbbbbccbcbbbbcccccdeed", "egb##baaaaa####a##aa#aaa#a#######.#..###.###########adfilkhfca#abaaa#####..##....#....###bbccaa##a##aa####aaaaa##a##a##abbcfhjfb#..#####.######aaaaaaa######aa##a#abbbba###aba#aa#######cecaaaa###a#.#######aa##aa#aa###aaabcbcbbcbbaaabb##aaaaa#######abaaaaaabbaaa#abbbbbabbabdfeaaaa##a#ca#eecccfcaaaaaaaaa#a#a######aaaaabca########a####aaaabababbbbbbbbbbbbbbbaaaaaaabababccccbcccdccbdffd", "cfhd#acaaaa##a#######a#a##a###a##.....######.##########bddjkidca#########..###....######acaacbbb#a###ab##aaaaaaaaaaaaa#aabcfgejfa#.###a######a##aaaa#aaa#a###aa##a#abbcba#####aa####a###aeedbaaa##aa####...#aaaa#bcaccbaaaabcdccabcbbbaaca#aaaaa#########aaaaaaabaaaaabbbbbbbaaabbecbbcaaaaaa#adecccedcaaaaaaaaa##a###########abaa######a####aaaabdbbbbbbbaabbbbbabbaaaaaaaabbaabccbccbccdccdefg", "fedfea#a####a##a#a#######a####a#.##..#.####...########aaaaaeikhea#####################aaacbabbdfdbbaa#aaabbcbbaabaaaaaaabcdfbbeica..#a########aabaaaaaba#a###aa#######aaa#####aaa#.aa###adffdbaaa##ca####.#########abbcdeeeefcdcbabbbbbaacbbaaaaaa##a##a##baa##aa###aaaabbabbaabaadfb#bbbbbaa###feccbeecbbabaabaaaaaaa#aa###a####a########a##aaaaabbbbbbcbabbaaaaaabbbaaaaaaabbbabccccccddddeeee", "fggehdaaa######a##########aaaaa#.##.####..#..##.#######aabbaadjljgda.#################aaaccbccddcccccccccccccdcbbccbcbaabbcfdcbgf#...#aa######abcbaaaaabaaaaa############.##aa##a########dffedcbaa#cc##########a####bbbbcdffeedaaabbbbbcbabbaaaaaaa#######abaaaaaaaaaaaabbabbaa#a#bdcbbbaaaaa###cfeeehhecabbbbbbaaaaaa##aaa##a###a########aa#aaaa#bbcbbbabbbbaaaaabbbbbabaaaaaaaabbbbbcccddddeee", "edehhg#aaa######a#a#####a##abbaa###.###################aaabbcaacjllkhbaa#######a######bbaefddddcbbbaaaababefeedddccffdccdfgeeeefec#...#ab#.####abccbbba#aaaaaa###########..###a##########bfdfdccaaacfb.######aababaaaccccbdffebbbbcbbaacccbabbabaaaa######aaaaaaaaab#aaabaaaabaaaabbeffcaaaa####aeeeefiihfcabbbbbbabaaaaaaaa##a######aaaa####abbabbabcbaaaaccbbbbbbbbcbcaaaaaaaaaaaacbbcdddddede", "eefgghcaa#######a##aa######abbbcc#.############.###a#aaaaaaaaccbafjllkjecbaaaaaaaa##aabcccgefeecccbba#aaaa.acffffffcacdccbbbfffefda#.##########aabcedba##aa#a#####a#####..#####aa###.####bceecccbaabdfa##aabbbaabbbbdcbbccdcceebabbbaaabcdcbbbbbaaaa######a##aaaaaaacaaaaabbaba###acdeegcbbb#####aeffgfgijkgcbbbbbbbbabbaaaaa##a#aaa#abaaaa##aacdbabbccbaaa#bbbbaabaabccbaaaabbaaaaabbbccdeedddd", "deeffdfd#####a######a#######aaaca#a############bdca###aca##aaaceddfijjnligdcbbcbaaaaabcddchgedddbccaaa#aaaaa##accfbbbaa####bdhfedhd#.###########bbcccdba###aaa#####a##a#.#####a####.####.#abedebdcbbcfe#####adcbcddbbdbaaacbcbccbbbaaa#bbcbbbbbbaba#a############aaaaaaaaaabaaaaaaabdfcccbbba#####aceffgiijihedccbbbbbabbaaaaaaaaaaaaaaaaa#####aabaaabbbaaaaaabbaabbbbbcabaaaaaaaaabbbbcccdddddd", "ddddecbdca###a###a##baa#aa##abaaba#a###.#####.#aabaaa#aaa##aa#acdhilmklmlmkheegecbbbbccbcefgedcdcbbbbaaaaa#aba#a#cdabcbaaa#achihggfa############abdb#bcaa##aaa#########a###.######..########beddecbcdffc###.#acdfffdabcca#aabacbbbbbaa#abbbbbbbbbaa#############a#aaa#baaaaaba###aaadfd#babacababbbcegfhhiihgfdddcccbbbaabbaaaaaaaaaaba#aaa###a#aaaaaaaaaaaabbabbaabaaabcbbbaaaaaaababbccdddddcd", "deddddcacaba###a####aaaaaa#aaaa#aaa###aa#########a##aa#aaa##aba#.cfehhjkjllmllihfedcccbbdefgdcccecbbbccbaaaaaaaaabdbbbcbaaaabhjjhggea#.####a##a#accaa#cdaa#aaa#.#############a##a##.###a####.cedccccefbbaa#####deffeaacdaaaa#aabbbbbaaaaaabbaaabbaba#####a.###a###a#a#aaaaaaa#a##aaacdecaaaabaa#aa#bdgfeeefhhfdccccddcbbaaababaaa##aaaaaaaaa###aaaaaaaaaaaaaaaabbaaababbbbabbbaaaaaabbbbcdcdccdd", "dddcccdbbbcba#bb#aa###aa##a##a####a##.####aaa##a#aa##a#a#ba######.fffkjlhkkljmmmlieeddccefaeeeccdedbcdccbcbaaaaaabaccbccaaaabeijjigieba.#######aacbaa#accaaaaa##########a#a###aaa#############decabdeeeaba###..adeddcaabcbba##aabbbaaaaaaaaaaaaaaaaa#####a###########aa#abaaaa##a#abbcdeba#b#aa#####cefedcbbdeedcccdddcbbbaabbaaaaaaaaaaabaaa###aaaa#aaaaa###aaaaaaaaaabbbaabbcbaaaaaabcccccccdd", "ddccbcccbcedaddaaaaaaaaaa#aa#a######...###########aaaaaaaaaa####..cfhjjkmlmklkklmnjfeedeefebdeddegheeedddccbbbaaabbccbcbbaabbbgjkjjhifda.#######aaaaa###abaaaa####aaa###########aa##########..adccaddcecbabbaa##dedddcbabcbca#aaaabbaaaaaaaaaaaaaaaaaa###############aabaa##a####aacbcddebaaa########cffecdcbceeefdddddcbbbaabbbaaaabaaaaaaaaaa###aaa#a#aaaaaaaaaaaaaaaabbbaaaacbbaaabbbbcdcdccb", "cdcccccbbcdbaacbbbbbbaaa#aa#aaaa#####..#..##.#####a#aaa####aa######eigfcfgijjjlmmmmnlhfhiggdddeefgegfgffdeddcdcbaaccccbcbaaabbcfjkkkijgfb#######a#aa######a#############a###aaaaaba############abcc#ddcccbdecdcaddddddecbbbccaa###aabaaabaaaaaa#aaa#########.####a##a##a#aa#a######abccdgbb#ba#a######cffgfdefffehgdddeccccbaabbbaaabbabaaaaaaaaa###aa##aaaaaaaaaaaaaaaaaaaaaaaabbba#aabbacddccc", "cddcccbbcccaabbabaacbaaaaa#aa#aa#.#...#...#..###a###a#########aa##adeaaa#abedefijlkmnnlkkjdddfdcebb#degfaefgfeddcbdcddbacbbbbbbdjjklkkihgc#aa#####aa################aaa##a#aaabaaaaa###########aabdbedcabdddeeddddedcccddccbbbca###aaaaabba#a#####a#a###aaa###.###a#######aaaaa###aabbbbcdaaabaa##a####aeghhhggghhhfedddcccccbbbbbbbbbbbbbbaaaaaa####aaba#aca#aaaaaaaaaaaaaaaaaaaaabaaaaabbbcddd", "dddcccbbdedaabdaaaabbabbbbaaaaaa#.##.##.#.#####################aaaddbbaa#aa##a##aceejnllkkhfhfccfbbaaaabafabdeffgfcdddcabbbbabacgjkkllkhjhbaa#####aa############a##aaaa###aaa#aa#a#####.####a##aa#deedcabdeeeedeeddeedbccdcccdcb####aaabbbaaa#####a##a##a####################aa####aabbbcdea##a########aaabehiiiiiihfedfdccccccbacbbabbbcbbbbaaaaaaaa##ab##bbaaaaaaaaaabaaaaaaaabbbaaaaaabbbbbdd", "ddccdbcbedcaabbbbaaaaaabbababbaa#################a##########a###a#ecbaababaaaa#####abkllllljgbaaccbababbabaaaa#cedfheedcabbbbbbbchkkkklkhggeba###aba####.####a####a##aa##aaaaaaa##aa####.####a####dfdcba#bdeeeeeefedddcbbcdbbadcba###abaaacaaa###a##a###aa#####.####a######.##a####abbbbccbbc#ab##a#aa#ca###cfggihhihffffedcccccbbabccccdccbbbaaaaaaa#aa#aa#aaababaaabbaaaaaaaaaaaaaa#aa#abbcccc", "dedcccbcecaaacbababbbaabbbbbcbaaa#..###.#########a##############.cdabbbbbbbba###aabcddilmmljeaaabcbbbbbbbbbbbabaabcefgfecbbbbbbcdfjjkkkmkhfgecbaaabb########a######aaaaa####aaa###################befcbaabbadfeeeeffededcbbccabccccaa#aaa#abaa#######a########...###########.##..###abbbbcbbf#aa###abaa#a#####acfgffgfggefddcccccbbabcecbbbcbbaaaaaaaa##aa#aaaaababbbabbbbbcbbabaaaaa##aaaaabbcc", "cddecccccdcaaaaaabbbbaaaabbbbaaaa########.####################..aaababaaacbba#abddbcdfeejmllf#aabbbaabbbbbbaaaaaaa#afffdedcbbbddffjfijjkkkhgfed####aba#######a####aaaa#aa#####a######a############adffddcaa#befefedeeddccccbcbaacbaabbaa###aba####a###############.###########.######aabcddcefbb###bbaaaaaabba#cffffghhgfffedccccccbcbbebbbbbbbaaaaaaaa####aaba#aaaabbbbbbcbaaaaabbcbaaaaaaaabcc", "dddddfebdfeba##aaaaaaabbbbabaaaa####.#########################.abbaaaaaaaaabbaaabba##aceeilmme#aaaaaaaabbbbaaaaabbbbbefgeddcddddegiighiiggjggfdba##aaaa##############ba#b###aaaa#######a##a#aaa####dfgffgcaabefeeededccccdddcbbbbbaaacbab###aaaaaa########a#a########.#########..####aaabdcdecbdc#aa###aabbcccaacegggfgghggfeeeddddcccbccbbbbaaaaaaaaaaba#aaaabaaaaaaaaaaaaaaaaaaabbaaaaabbabbbc", "bcdeeeeedeeda##aaaaaaaccbbaaaaaaa####..##.#########a##########aaaaaaaaaaaaababba#aa####abbdhkmgbbbaaaaabbabaaaaababbbaehfcdeeeegghkkjjigdeehfeccaaaabcba########a####aaa#####aa####a####aa###baba##adfgfffdeeffdcddddddbcccdccbbbbbbb##bdb###aadb#a##############.##.######.##########abcdcedecegdb#a#aaabbcddaa#adfghfghgffefeefeeddcccccbbcbaaaaaaaaaaa#aa###aaaaaa#aaaab##aaaabbbabaaaabaaabb", "cbceeeefffffd#aaaaaaaaaddbaaaaaaaa#############.#############cbbaabaaaaaaabaaaaaaaaa###aaa#achlkigdaabbabbbbaabcaacaababccdbbdedcdfehkkjgeceheccda#aabbba###.######a#aaa#####aa######.#a#aa##aa#aa##adgggfeeggffdcccddcccbbcbccbbbaaa####ca##abcba#aa##########.#####a######.#.#######abbcbddbdfhgeaaa##abbcdcaaa##aaceghdfgffffffeeddddcccbbbaaaaaaaaaaaa##aa#aaaaaaaaaaab##a#baabbabbbaaaababb", "ccddefgfefffd#a##aaaaaabccbabaabaaa##########...############acbaabaabaaaaaaa#aaa#aabaaaa#aaaabgkjiifbabbabbaaaabaaabbabaaaaaaabcc#####cgkmjgfhfcbcaaaabcbaa########a#aa###a###########.####a######aa##bghfefgeddeccbbbccccccbcdcaaa#a##a#aa#a#aaaacbaa##.############aa########.#######bbbccddddggfbaa###abbcbaaaa#aaabeeeeggghgggffeedcccbbbbbcbaaaaaaaaaa###aaaba#aaaabbaa#a#abbbbbbabdbbaaaab", "bcceddefhgfcbaa#a#aaa###aaabbbaaaaa#######################aababaaaaa#aaaaaaaaaaa#aaaaaaaa#aa###cefllgabaaaaabbbaaaaabaaabbabaaa#ba######bfjljhghcac##aaacaa########a###############aa#.##a#############afgfgfedcccccbbccccccddcccaa##a####aa#aaaaaabaa#################a#a##.#########aaabccccddeegfbaa###abbaaa#aaaaaabdfceghhhhhhgfedddcbbbbbbbbaaaaaaaaaa###a##aaaaaaabbbaaacbbabbbbbcccdaaaa", "bbcccdefhiea###a##aaa######aaaa#aacb##############a####aaabcbbabbaaaaabaaaaaaaaa##a#aaabaaaaaaaaabekljbaaabbaabaabaaaaaaaabbaaaa#a#aa#####aekkhhiba###aabbbb#####a.#########a#a#####a#######aa####.#aba##gggfeedccbbbbbbcbaabccbcbaa##a###aa##abaaa#aa###..###########.###a##.#######aaaabbbcdddcefgaaaaa##abaabaaaabbaabdeffghighhgfffeeccbababbbbbaaaaa#aaaa#a####aaaaaabbaabbbbbbbcccbcccdbaa", "bcccccdefgeaaaaaaaaa#a#a#a##aaa#a#aba#######a#.###aa######bcaaaaaaaaaaabaaaaaaaa###aaaaaabbaa#aaabbchkkc#aaaaaaaaaaaaaaaaaaaaa#a#aaa#a#######dkklibca#aaabcdca#a#aa#################a######aaaa######aab#cghhgfddcbbbbaabaaaaabbca##a##abaaa##abaaba#a#aa############...##.###.#..####aaacbbcdccdcdedbaaa#a#acbaaa#aaaaaaabcffffghhhfggfeddbcbbbaaaabbaaaaaaaaaaa#aa#aa#aaabbbcccbbbbbbbbbbcdccb", "bbbccccdfcec##aaaaaa####a####aa#aa#aca##a####baa#######a##bbbaaaaaaaabbbbbaaaa#aaaa##aaaaabbba#aaaaaadijgaabaabbaaaaaa###aaaaaaaaaaaaaa#######behlidcdbaaabbcecaa######a###aaa###########a####a#######aaacghihgfedcbaaaaaaaaaababbbaa###aaa####a#aba##a#a#####..######......#...#.#.####aaccbcccdcdehhdaa####bcba###aaaaaaabaaadfeeegihgecdedcbcbaaaabbaaabaaaaaaa##aaaa#aaabcbbbccbbbbbbbbbcbbb", "babbcdddddde######aaa###########aaaabda##a####abaaa#####abbaaaaaaaaaaaaaaabbbaaa#aa##aaaaaaaaabaaaaaabcdkib#aaaabbaaaaaa####aaaaa#aaaaaa##a##a##acgjhfgefcbbacccbaa####a######aaaa########a#############bfffhjigedddbaaaaaabaabbbbccaa####aa###a##aa#################a##.....#..#########aabbbbcccddfheaaa####bba####abba#aaaa##bca.#bghfedecbccbbbaaaaaabaaaaaaaaa#a#aaaaabbbbbbbbbbbbbbbbbbaba", "bbabbdcdddcec#####aaaa#a####a###abaaaaaa##bda##aaa######aaaaa#######aabbbaaaaaa##a##aa#a#aaaaaaaabaabacbdjjbaaaaaabaaaaaa##########a#aa##aaa##a#a##cfhhededabbdcbcca##########aaaaa############a######a##dffgjiiheedcbaa###bbaabbbddba#########aaa####################a###..###..##..###aaaabbbbcbcfffebaaaa#aabaa##a#aaaaaaa#####aa#.bdegfeccbbaabbaaaaaaaaaaaaaa#aaaaaaaababccbcbaabbbbbbcbbab", "dbbbbcdcdcdcea###a####a#aab#aaaa##aaaaaaa##a####aaa###.##aa###########aaaabaa#aaaaaaaaaaaaa#aaaaaaabbaabbbhkfcaaaaabbaaaaa##########aaa###aaba######.ekjgddbabbaabccbba########aaa####.#######aa##aaa#####dgfgghgggedcbbaaa#aabbbcbedba#######aaa#a####################aa#.......##..####aabbbbcbcdefeebb#aaa#aaa##ab###aaa#######a###.##cgefdccbbabbbaaaaaaa#aaaa#a#aaaabbccbbcbbbaabbbbcbccbbb", "bcabbcceffabbc########aaa#aaaaaaba#aaaaaaaa########.#####aa######aa####aabbbaaaaaaa##aaaaaa###aa#aa#aaaaabbfkjhdaaaabaaa#aa##aa#####aa#a#a#aaaa######aikjjhbaaabbaacbaaa###############.###################bfhggggggfedcabaaaaabbcdeccaa########aa##########aa######a#a##a##..#.#...#####aabbbbbcccecdgccb##a####a##a############aaa######agfedccccbbaaaababaaaaaaa####aabbaaaaabbababbbccccbbcb", "ababbccdffdbbbba###aa#aaaaaaa#baaaaaaaaaaaa#########.####ab###########aaaaaaabcbbbaa###aaaa#ba###aaa###abbbbflljeaaaaaaaaa###########aa##aaaaa#######.afikkiba#abbaaba##########a############################ehffgggfeedcccbaabababcccbaa######aa##aa###.###aa####...#########...########abbbbcbbbcdecfgdaa#######################aa##a####bfeeddccbbbbbaaaaaabaaa#abaaaaaaaaabaaaabbbbbbccccccc", "adbbbbcdddecbaba#a#######a#a##aaaaaaaaa#aa##########.###aac##########a##aa#aaaabcbbaaaa##aaa####aa#aaba#abbbbdillhcaaaaa####aa####aa#aaaa##aa#########.#chkli#aaaaabbaaa########a#aa###a###############.###aa#fggffgffedeecbbbaaabbbbcbaaa#####aa###a############################.######aababbcbbbccedcfccaaaaaaaa###############.####a#####bffeddccbbaaaaaaaabaaa###aabaaaaaaaaaaababbbbbbbcccc", "ccbbccddeeeccaaca##a####aaaaaa##aaaaa#a#aaaa#########.###ab####.#a###aaa##aaa#aaaabbaaaaaaaaaaba#abaaaaaaaaaaachkklfbaaaa##########a##abaaa############..#bimiaaaaaabaaba##########aa#babaa##############.##a##aegfcbdeedfedbbbabbabbcbbbaa#####a#####aa######################.#########aabbbbbcbbacddddccaaa#aaaaaa###a#####################afgeecdccbaaaaaaa#abccbaaaaaaa#aaaaaaaaaaaabbbccbcc", "ccedcdddeeeccbbbcba#a###aaa#a#a#aaa#####aa#a#############ab#####.#####aa#a#aabaaaabbbbabbba##aa###acb#aaaaaaaaacfihkida##a#a###.####aaaaaaaa##a###aa######.ahljc#abaaaaaaa###.####a######abaaa############.#####.bababeedegdcbccbcbabaaabba#a##aa####aba#aba#a###################.####a##ababbbcbbbcdddedea#aaa#a####aa#######.###.######a##a##fgfedddbbaaaa#bcdccbbba####aaaaaaaabbabbbbbbbcbbc", "cddeddddeefddcbbcc#a#aa#aaaaaaa#aaaa####aaa######aa######ab#a########aa#a#aaaaaaaaaaabbaabba#aab###abb######aaabbcfheihc######a#####aa#aaaaaaa####aaaaaa###.aikjcaaaaaaaa#################aaccbaa#a################aaaaaaabdddcbccbaaaaaaaaaaa##b####abbcccb##.###a#############..###aaaaaabbbbbccbbccccddecaaa#aaaa###a########################effedccaabbaccbbaaaacc####a#aaaa#aabbbbbbbbbbbcc", "dcdcdcdeddfecdcbcdaa#aaa##a###a###aa##############aaaa###aba#############aaaabaaabaaaabbabbaaa#aba####a##a###aaabccefadhhb##aaa#####aaaaa#aa#a##aaa#aaa#####.aflkcaaaabaa####################ddcbaaa#################a#aaa#bdddbbcbaaaabaaaaaaa#a####a#baa####a###a###aa#############aaaabccccbcccbbcdcdedefb##a###aa##aa###############a##aa####efddcbcecbccabbaa#aacc###a##aa#aaaabbababbbbccc", "ccdddcbcfhfddcdcbbc#####a#aaa##a########a#a#aaa#####aaa##abaaa##.#######aabbaabbaaaaaaaababbaaa#aaaaa###a#a#a#aaabccdha#diga##aba#####ca##aa####aaaaa#a#######acildaababbaa###########a#######abccbaa#########.#########a###cdedbbdcbbabba#aaa###a####aaaa#aab###a##a#aa######aaa######aabbccccccccccddddeddfca#aa##aaa#aaa#####a####.###aa#a##a#cfeddedacaaabcaa###aacc###########aaaaaabbbbbcc", "ccccddccdeffdcccdccb########aa##########a#aaabaa#####aa##ab#aa###########aaaaaaababaaaaaaaabaabcabba############aaabcffb.afjfa#aba####a#a########a#a########aa#abhjb#aaaba#a##########a#######aabcccbb####.#..###aba#########abddbcecbbcbba#aaa########aaaa#a#a###aaa########aaaaa#####aabccdcddccccccccddedcec###ba#a####a#a##########.######aa#adedcbbaabaaabbaa###aabca##aaa#a##aaaaaaabbbbbc", "cccccdcedcddfebbdcbdb#######################abcbba#######bbaa######.######aaaaaabbabaaaa##aaabababaaaaa########aaaabbcfiea#bgjeaaa######aa#a#############a####a#acgigaaabb##########.##a#######aaa#adcba##########ba#a#a#####a#adfcddbcccbaa#aaa######aaaaaa##aa#aabbab#aa####aaaa#####aaabbccdddcdcbbbbcccddegd##baaaaa#########a################abbcccbbbbabbbba#####abca##aaa####aa#aaabbbbbb", "bbbccddcdcddefdbcdadcaaa#####################aabbbba#a#aabba#aa##########aaaaaabbaaaaaaaaa#a#aaabbbbbaaaa###a#aaaaaaaabfifa##ejgbaaa########a##################acbcfigba#aa###########a#########a#aaabbbba#######.#a#a#######aaaaffddccbccba##aaa##########a######aabaaa#.####aa######aaabbbccdeeefggecdedcdfedcbaacbaaaa##a#a####a############a##aa#accdcbcbbbbbba#####aaca#aaaaaaa###a#aaabaab", "bbbbcccccddddfecbccbdc#a############a###aaaa#aaa#aa##aabcccc###########aa#aaaaaabaaaaaaaaaa#aaa#aaabbbbbbaa###a#aabaaabbbhie#.bfhfbaaaa###aaaaaaaaa#######a####aaabdhifbaa########aabaa###a######aa#####bccaa#####.#####a########afgeddccdcba###aa########a#a#######aa######.##########aabcbcccdffghihgdcddcbacbbeabaaaaaa#a###################a##aaaa#bcddcdcbbbab##a##aaaba#aabcaa####a#aaaaba", "bbbbbbcccccdefedbbcacdc####aa##a#.##a#.##abb######a##aabbccc###########aa#aaaabbbbaaabaaaaaaaaaaaaaaabbbccbaa##aaabaabba##diic##adhebaaaa#aaa#aa##aa##########aabaaagjjf#a######a#aaaaaaa#a#######aa#a###bdddaa#a###.#a###########adcdddddcba#aaaaa#a###a##a##ba#b###aa####.###aa#####a#abcdcbbcdghihhgdcaaaaaabcfdccaaaaa#aa###################a##a#a##acbcdcbbcba#a#####aaba##abaaaa###aaaaaaa", "aaaaabbbbbcddeedccebaccb###a####a####a#..aba##########aaaaccb.############aaaabbaabbaabbaaaaaaaaaa#baaaccbbaaaa#aaaaaaaa####fjfb###egebaabcb##aaa##############aaa#achkjbaa######aaaaaba#a#aa###a###########abba###################abaceddcbaaaaaaaa#####a#####a####a##a######.###a##abaaccddedeeffdghfaaaaaaaabbdfcabbaaaaa###############.#########a###bccbedcbdaa######a#abaaaba########a#aaa", "#a#aaaabbbbbbcdedcccbabbb##aa######.######ba#############abcc##############aaaaababaaaaabbaaaaaaaaaaaaabbcbbccba#aaaaaaaaaaa#beihb##afgdbbcba#aaaaa######a######aa#abcilheba#####aaaaabaaaaaa#########a####a##a#aaa###############a#aaadedbbaaaaaaaaa##aa##a#######a##aab######.##aaaababceefcddcb#.#gfaaa#aaaaabcfgcaaaaaba########.#####################aabddcbcabaa##a##aaabaaaa######a######", "##a#aaaabbaabbccdcbcbbbacb###a###########.aba#######aa###aacf#######.#######aaaaaabcaaa#acaabbaaaaaaaaabababbbcdcbaabba#abaaaaabfje#a#aehdaaaaaaaaba#####ab#a####aabaabijiebaa##aaaaaabaaaba##aa#####a#a###########a###a###########aaaaaabbbaaaaaabaaa#aaaaa#####a##abaaaaaa########abbabcdgeba##.##.bdaaa#a#aaaacfgcaaaaaa########.a########.#######a#aa###abccbbbaaaa#aa#abbab#abaa####aa#####", "#####aaabbaaaabcbccccbbbcca###a############a#########aa##aaacb###.#.########aaaaaaaaabcbaaabaaaaaaaabaaaaaaaaaabcaaaaabaaaaabaabaejhbaa#aggcaaaaaaaaa####abb#a###aa##aabhigddbababba#acbabaaa###aa####a#c#a#############a#a########aaaaaaaabbaaaaaaaaaa#aa##a#####aaaaaa###aaa######aabbabege##b#######aa#a##aaaaaceecbaaa############################aaaa##aaacbbbaaa##aaa#aaaaa##aa#####a#####", "####aaaaaaaabbabbdcbcdccbbba#aa####a##a####a######..##aaaaabab###.###########aaaaaaabbbbbbaaaaa#aaaabcbaabaaabbaaaaaaabbaaabbabab#bghcaba#dhfaabaaaaaa#aa###aa##aaaaaaaabeegbccbaaabcbbbaababa######aa#aaaaa##aa#.######aaa#########b#aaaaaabaaaaaaaaaaa#a##aa#aaa#aaabbab##a####ab#aabbbbcfhaaca##############abbabddbbaa####################.###a##a#aaaaa#aabbbbbaaaaaa###aaaaaaaa#######a###", "#####aaaaaabbbbbccdbccdcbcca##########a#####aa##a######a#aaaabc###############aaacaabbabbbbbaaaaaaabccbbaaaaaaababcaa#bbaaaaaaaa#ba#eiebabaafhb#aaa###a#a####aaabbaa#baabbbigcebaaabcbbcdbbbcca#a##a###acbbaa#ab##########aaaa########aababbbaaaaabaaaaa##a###a#aa###aaaca##a#aa.bc#abbdccbdga#####.###########abbbbcdebaa##a##a##########a####.###a#aa###aaa##aabbabbba#a#####aaaaaa########aa#", "#####bbbabbbabbcddddcccbbbcca#a##aa###a#################aaaaabb#a####.########aaaacaaaaaacaaaaabcaaabbcdcbbbcbabbbabbaaaaaaaaa####aa#cijdbababhfa#aa###aa##a##a#aaaaa#aabbbflggfaabacbaabbbaacbba##aa#abccbbaa###aaa#####a#aaaba###a#aaaaabbacbaaaaaaaaaaaa###aaaaaaaaaacaaaa#bbab#abbcccccbdc#################aabdceedebaa#########################b#####aa#####bbbabbaa#a####a#aa##ba########a", "aa##aaabbbbccbbcccddcdccabbdfa####a###########aa######a#a#aacc#######.#########aaabababbaaaabbaaaaaaaabbbbaaaaaaabaabbbaaabaaaaacba#a#beijbaaaaehfa###########aa#abaaaabbbbdhjghffedccaaabaabaabbaaaacbcbcccbaa#aaaaaaaa#aaaaaaaa####aaaabbaadebbaaaaaaaaaaa###aaabaa#a#aaaaabbbbbbbabcdcccefe####.##.#######.##a#aacccccaa#aa#####.###############aaa###.#a###a##bbbbbaa#a########aaaaa##a#####", "###ab#ababbccbcbccdddccccbbbeda##aaa######aa###abaa####a###abdb#a###.######aaa#aaabbbaaaaaa#abbbaa#aaaaabdaabbcbabb#aaaaaaaabaaacbcba####ejdbbbacgjd##aa#aa#####aaabbaabaabbejiiiihhggfbaabbbaabcba#bcdcdddddcaabbbbcbaaaaabaaaaaaa##aaabbbbcdedbcbaaaaabbaa#aa#aabbaaaaaaabccbbbbbcdccddffebb####################aabccccca###########.#########a####aaa####a##aa#abbaaaaaa########aaa####a#####", "#aaaaabbbabbcccccdedccccedccdebabaa#aa###########baa##.##aaa#aca#######.#####aaa#aaabaaaaaabaaaacbaaaaaaabaaaabcbaabaa##aaabaaaaabaaaa###.cjgcbbbadiib##aaaaa####aaabbaaaaabdhlijjiiihfefcbaabbbbbbababdedfddedccbccdccbccdccccbaa#aaaaababcccdddcccbaaabbaaba#aaaabbaabbaccdddcdefffedeeed..################.######abcbdfbab#a###########################a#a#####aaaaaaaa##aaaa######a##.#a####", "###aaaaabcbabccccdcddcccccbbccebaaaa##############a#a####aaa##abb##############aabaaababaaabaaaabbaaaaaaaaaaaaaabbcbabbaabaaaaaaaaaaaa####.afhdbbaabfihb.#aa###aa###aaba#aaacclljjiijigddecbaabccbabbbdbadcbeffffeffgghhhighgfhgffcaaababdbbbbcfddddcbbbbbccabaaaaaaababddehggfegjiedaaaa#a####a##############.######bcdcddbaaa##a###################a#a#####aa####aaaa#aaa#a########a#######aaa", "aa##aaaabaaabbbdddccdbcddcccccdd##a#aa##aa########a######aaba###ab##############abaaaaacbaaaabaaaaaaaaaaaaaabbaabbaccbaaaaaaaaaaaaaa#########bfgbaabbdije.######aa#abbaaaaaaabellkkkkllkiiigfdcdcbabbcbcdcbcgijkjhhhhijjic#dcbcbddghffeeeihiggfgddedcccbcdcdcbcbcbabadeeffghhhebegdddb#########a#a####################babbbcbbb##a##################aa##a####aa#a###aa#a#aaa##a#######aaaaa##aa#", "a#aaaaabaaaaaabcdcceccefcadgeceebba###a#aaa########a#####aabaa#aabda########a####aaaaaaabbaaaabaaaaaabbaaaabbbbaaaaaabbcbaaaabaaaaaaa#aa######.eiebbbbcfihc#.###abaaa#aa##aaaabellkjlkjklmnnmlkgfccbbdddeefghjijkkllkhd#cfeabcbbcbbdgjjhgecccehieeededccceeedddddefcdffcedbacdec#bbaba#########aaaba#########.#######aaaacccdbbaa####################aa##a####aaaaa#aaaaa#a####aa######aa#aa##aa", "a#aaaabaaaaaaaabcccdddggedbdfccecaaa###aaba#a#######aa#.##aabba#aabc###########aaaaabcbaaaabaabaabbbabaaaaaabbcccaaaabbbbbbaaabaaaaaa#aa#aba###.bigbbbccdilid.##aaaaaa####aabbbcekmljgdfiijikmlmnkgdeefeeegieeddgdcghgdbabcfdebcccceffggfcbbbbbcefgedddcceeefdedcbccefgb####babedcaa##aa#######aabcda##.#############aaaaabcdcdbaa#########a########a###a###aabbbbaa#aa#aaaaa##aa######aaa##aaa#", "##aaaaabbaaaaaaabcdceeffedccfgedcaaa##aaaa###a#a#####aa..##abaaaabbd#########aaaaa#a#bbbbbbaaaaaaabbbbbaaaaaabccbbaaabaabbbbab#aaaaaaaaa#aaaaa###ahibbcdccgjkg####a#aa####aabbcddegkhddgihhghiibdilmljjjjiiihfaaa##aeeedcbbdghfdbbdfedfedccbbbbdbffhfededeefhhfc#####cea#####aaabdfda.a######.##abdfb##########.###a##aaaabadefecb#a##########aaa####a##aa####acbbbaa##aaaaaaaaaaa#####a######a#", "a##aaaaaabaaaaaabacddeddfdccefffd#aaaaabbaa#a#####a#.aaa###aaaa#abbdb########aaaaba#aaaaababbaabbbbbbbbbaaaaaaa#abcbaaababbbbcb#aa#abaaa###########fhdcccdcehihb###aa######a#bccdefggiglkjjhiihba#cglkjhiihgebcaaaaaa#aacdbbdefhfdbbeedbccbbbabdcbgjifefedeggfgfa#aa#a.aa######aaaacffba####.###abdeca######a###########aabbegffgedaaa##########aa####a##aaa#####aaaab#aaa##aaa#aa######a#######", "##aaaaa#aaaaaaaaabbcdddceddeeecdfbaaaaabbbaa#####ab#########aaaaaabbc########aababbaaaaaaaabbbaaaabcbbabbaaabaaaaaaabbbbaaabaabbbcaaaaaaa##########.bhfcccdddefigc#abaa#aaaaaacccdegeiihkihhjhbbaa#.#a##a#..##aaaaaaaaaaaacaabaacefedefbbedcbaccdbcfgiihhfdec.addb#ba###aa######aaaaadgeca#######aceaaa#################aaabdgeeghffb########a######aa####abaa#####a#aaaaaaa#aa###a#.######aaaa#", "a##a####aa#aaaaaaabccbccdedefebbef#baaaaaabaa#####a#aaa####aaa##aaaada########aaabbbaaaaabbaaaaccbbcabbbbaaaabaaaaaaaabbbbabbbbaabcb#a##a#########a##bifdccdddefgjeaaabaaaa##accbbcddfhehijhdb#aaaaa#a####a#abaa#aa##aa#aaaaaabbbaabefigffefdbcccdcbaacbbdhhfeaacbabb##a##########aaaaadhgb#####aabecaa########a###########baegfefgfeca##a#######a##aaaaa#aaaaa####aa#aabbaa#aaa###a#.#####a#aaa", "#aa#####a#a#aaaaaaacccbbccdcdedbcfcaaabbbaaaaa####a###a###abdb####aaeda######a#aa#aabbbabbaaaaacddbaaaaabaaaaaaabcbaabbbaabbbbbbababa####aa###aaa#####dihecccdedeejgaabcbaaaaabcbbbcdeheggeabaaa####aa########aa###aaaaaaaaaaaaaaccbaabdegedddddddccbbbba#abaabcbbaaaa##a##.#.#####a#a#abefb#####abdfaaa#####aaaa#a########aaadfeeffffc#######a######aa#aaaaaaa#aa##aa#aaabaaaaaa#######.###a#aa", "aaaaaa#aaaaaabaaaaabbcbbabbbcceedffdbaabcaaaa##abaa##aa###acefa####abdaa###.####a##aabbbcbcbaaaaabba##aaabaaaabaabbbaabbbaabbbbabbcbba#a##aa###aaa#####bhjgccdddefdhheabbaaababcbbabcdehfcaaaaaaaaa#aaaa#######aa###a##aaaaaabcdaabbbbabbbefedeccddcbbbaababbbcccca#a####aa#############aaceda###aabfebaa####aaaaa##########aaadefedegca########aaa##aaa#aaaaaaa##aaa##aaaaaaa#bcba#########aa##", "#aaa#aaa#aaaababcbbbbccbaaabbbbdgffgbaabbbaaaa#aaa####a##abbgea##aa##bca#########a#a#bcbabbbbaaaaaaaa##aabaababbbaabaabbbbbbbbbaaaabbaa##a#####aaa######adhidddddfhdfigbcba#aaaaaaaacbcfdabaaaaaa#aaaaaaa#######bb#####aaa##aabccaaabdcaaaeeefeddefcbbbbaaaabcbbbcdba#####a####..#######a##abdb#aabcefdaa####a#aaaaa#######aaaaaabacefc#########a###aaaaaa##aaaaaaaaaaaaabaaaa##aaaa###.#####aa#", "#############aabaaaabcbbaaaabbcceeeeeaaabbaa##a###ab#####abddb#####a##cb#######aa#a##aabbbbbbbaaaaabaaa##bbabbbaaabaabbbacbcbbbcbbbbaaa###a######aa##a#baaagkecdeegfeehfcbba##aaaaaaaaccdcbaccbaaaa#aaa##aaa#########a##a###aaabcaaaadeddbbdcdeigfdbcccbaa##cbabcbcdaaa####aaa######.######aa#debaacfdcaa#####aaaabaa########a##aabccdd#############aaaaaaa###aaaaaaaaaaaaaa###aaaaaa#########aa", "#############aabbbcbbccbaaaabbccddeedca#abaaa#aa###a##.##aaaa#######aaaca############aaaaaabaabaaaaaa##a#aaaaabbaaaaabbbabbbcbbccbccbaba##########a##aaabaabejfddddehddhgdbbba##aaaaabbbcccaabaaaaa#a#a##a#aaa###############aabcaaaaaegeddcecacdghfdccbaaa#cbabcbac#######bba#################bcdcbeebaaa###aaaa#aa#a###a####abaabdcdcba#a##a####aa###aaaaa##aaaa#aaaaaaaaaaa#aaa##aa#########a", "aca##########a#aaabdbcccbaaaabbccddeedbaaaaaa#aa#########abca#######a#aca############aaaaaaaaaaaaaaaaaaaaaaaaabbabaabbbbbabbbcbbbbcabbbba##########aa###aabbbeidbbccehefhhcbbaaa#aaabbaaabbcaaa#abcaaaaaaaaaaaaa#####.########aaabaacbedfdbbbdccccfhebaabaaa##a#acaba######daa###.######a####aa##acfdfdaa####aaaaaaaa###aca#aaaabaabccdeaaa###aa#aaaa##a#aaaaaa#abaaaaaaaabaaa##############.aab", "aa#bb#####.######aaabcccbbaaaabbbcddeebaaaa########.#####abca##########abaa####a#####aaaaaaaaaaaaaa#aaaaaaaaabcbbaaaaaaaabbbbbbbbbccabbaa#a#########a#####aaaachdbccdefehgiebbbaaaaabaaabccacbaaaacbaaaaaaa#aaaaaa#############a#baaaaceddbaabcbebbefdcaaaaa###ba#baa#####.aba##############a#a##aacfghdcaaaa#abaaaaaa######acbababbbdbaa###aaa#aaaa#a#aa#aa#aa##abaaaaaaabaaaaa##############ba", "a#aa#a#####.###a#aaabbcccbbbaabbbccccge#aa#######.#######abbba#######aaabbaa####bba###aaaaaaaaaaaaa#######aaaaabbbbabaabbaabbbbcbbbcbabbbaaa#a##a##########aaaabeccccddfgefhgaccaa#abbabbbbabbbba#aa#aaaaaaaaaaaaa#######a#####aaaaaabacdccabbbcecaacdfecbbaaaa#aaabaaa#####aa########aaab####a###aabeggbaaaaaaaaaaaaa#a##a###aaaabcccccaa###aaaaaaa#aa#aaaaaaaa#abaaaabaaaaaaa#a###########a#aa", "###aaaa###a######aaaacccbbbbbbbabccccehb#a########..#####abbca#######aaaacaa####cca###aaaaaaaaaaaaa#######aaaabaaaacdbaaabbbbbbbaabbbbcbccaa############a#aaaaabaccbdccegeccffbbaa######.#abaabbbaaaaaaaa#aaa#aaaaaaa#a##########aaaabbcc#abbabaabaddcbceebbba#aaaaaba######a############aba###a##aaaccggbaaaaaaabaaaaabaaaaa#a#bbabbccdb#aa###aa#aa#aaa#a#aaabaaaaab###abbabaaa###a#a########aa", "###aa#a######.######aacccbbbbbabbbccccfheaaaa#############bbcaa#######aaabcaa#####aa####aaaaaabaaaaa#aaa##aaabaaaaaacdcbaabcbbcbbbabbaabbbbca#a######aaa##a##a#aaacabccdeggacge.#aa####a#baaaabbabaaaaababbaaaaaaaaaaaa#########aaaaaaabda#aaabbbacbcdbbcdeca#a#aaaaa#a#aa#aa#############aa#####a#aaabcfgcabaaaaabaaaa#aaa#####babbbcccc##aa#a#aa#aaaa###aa#aaaaaaaaaaa#aabbaaaa###a#a#####abba", "###aa##aa##########a#acbcccbbbbbbbbbcceffebaa#############accbaaa######a#bdcaaa####aa##aaaaaaaaabaaaaaaaa#abbbaaaababcddccbcccccbaabaaabbbbbca####a######aaaaa##a##bbabcbdgefeed########a#a###ab#aabbbaaaaaaaaaaabaaabba#####a#.#a##aaaabca##abbbaccbbdcbcdedb#aaaaabaaa###aaa#########aa#aaaaaaaaaaaaabceecc##aaaaaa#a#aa########abbacccc##aaa#aa##aaaa###aabaaaaabaaaaaaabaaaa####aa#####a#a#a", "b###aaaaa#######.##a##abbdcbaabbbbaabccdegea########a#####abcbba###aa####acccaa######a#####aaaacbbbabbccbbaaccaaaaabbbcccbcbccbbaaaababaaaaabc###a#aa#####a#aa#a#aabdaaacbbafhgbfa.#####aaaaaaaaa#aabaaaaaaaaaaaabbbaaba###a###########baba##aaaabacaabccbccdeeaaaa#aaab####.########.##aabbbaaaaaaaaaaabccaccba##abbaa###a##a###a#aabbccca#aaa#a#abaaaaaaaaacaaaa#aaaabbaaaaa#aaaa#a#######a##a", "baabaa#######aaa#####aabbccbbaaabbaaabccdfeba#######aaa###abcabbaa##aaa####ddbaa######a###aaaaaaaaaabbcbbbbbccaaaaaabbbbbcccccbbbaaaaaaaaaa#abca##a#aaaaaa##aaaaaaabcaaaabaabgicce##.#a##aa#a#aaaaabaccbaabaaaaaaaaabbbaaa#aabb##########aa#aaaaaaaaaaabccccddfebaaaaabbaa################bbbbbbaaaaaaaabbbc##acbbaaaaaa####a#####aabbbcccb###aaaaaabbaaaa#a##aa####aba#bbaaaaaaabaaa#######a##a", "baaaaa#######aa#######aabccbabaabbbaabbbcdgdb#a########a##abdbbaaaa##aaa##abdcbaa#############aaaabbbbbbbbbabccaaaaaaaacbbbcccbccccbbaaaaaaaabbca#aaa#a#aaaaaacbabaa#aaaaaccbbjgabc###bb######abaaabbcccbabbbaaaaaaaaaaaaa##aaaaaa#######aa###aabcbaaaabbbccdeeefebaccbbbbb#.####a####.###abaabbbbbcbaa#aaabca.##acccbaaaa########aaababbcba##abaaaaaaaaaaaaaaaa#aaa#baaababa#bbaaaaaaa#######aa", "aa##aaa###############a#abcbabbaaaabaabbbcffcaa##aa##aaaa#abbbbaaaaaaa##a##abdbaa##############aaaaabbaacbabbbcaaaaaaaabbbaaabacbccbbbaaa#aaa#aabb#aaaaaaaaaaabbbbaaaa##aabbbadiabbc.##c#######aaaaaabbccbbabbaaababaaaaaaaaaa##aa#######a#####aabbaaaabcbbbcddcefhgceeaabba##############abbbbbbcbaa###.###aca####aacdba#a#a######aaaabbcbbaa##aaaaaaaaaaaa#aaaaaaaaaaaaaa#bababaaaabaaaaaaa#ab", "cb####aa################abcbbbaaaaabbaabbbdgdb##a#aa#aaaaa#abaabaaa#bba####aaddba#######a#########a#abbaaccccccbaaaaabaabccbbabaabcbbbbaaa#aa###acda####aaaabaaabbcbbaaaaa#bcbcebbccd#.aba######aaa#a#acbaaabbbbbaaabbdbbca##ba###abc.#.####.##a#bbaaaaaaccccdecdefghgfccccb#.####.#...###aaaabbabddba###...##bb#####a#bcba##########aaabbccaa###aaaaaaaaaaaaa##a#aa#aaaaaaaa##ababbaabaaaaaaaab", "ec##########a##aa#.#####abbcbbaaa#aa#ababccfffcaaa#aabaaaaaabbaaaaa#aba###aabbfdaa###.#############a#aaabbccbbccaabbaabbbbbbbbabaaabbbbbaaa#a###aacdba##aa#abbacbbcbbbaabaaabbceabccde.#c#aa######aaa#aaa#aaababbabaabbdefecd#aaaaaaec#.#########aaaaaa#aacdcbdbabdfegddffdba##.#.###.###aabbbbabbccbba###.#.##bc#######abbba########aaabbbddcaa##aaa##aaaaaaaaaa#aaa#aaaa#aaaaaababaabbaaaa##ab", "bca######.#####aa#######abbbbac#a##aa##abcdcehfaaaabbbaa#abcbbbaaa#aaba#####acegdaa####.############aaaaabbbbccccbabababcbbbbbaabbcbbabaa##aaa###aacebba###bffcdbcbbcbbcaaaabbbhbabbcee.##aa##aaa#acaabbaaaaaaabccaaaaaabdefge##aaaacea###########a######abdfdabaaaaababaceeb###.#...#.##aaabbbabbbaabaaa###..##bea###a##a#aca#a#a#####aaababb####aaaa##aaaaaaaaaaaabaaaaa#aaaaaababaaaaaaa###ab", ".#a###########.b########aacaaaacaaaaaaa##acdffgbaaabaaa##aaehdbaaaa#aaaa#####acfgbaa#########.########aaaabbabcdecbaabbabbbbbbbaaababaaaa######a##aaddbaaaaab##a##abccccccbbaabfhaababgd.######aa#aaaaaaaaaaaaabacdddbaaaaaaddeda#aa#ba######..##a########abdcaaaaababcabbbcddb#a###..#.##aaabccbbaaaaa#########abed#########cb#a#a####a#aaaaacb###a#aaa##aaaaaaaaaaaabaa#aaaaabaaaababaaa######", "#########aaa###a########abbaaaaaaa#a#aaaaaacdegeaabaaccbaa#acefcaa###aabba###aadfdbbaa####.#############ababaaabcccaaaaabbbbbbbabaaabbbbaaa#####aaaabdeaabbba########aabdedcbabbffaababhd########a#aaaaaaaaaaaaaaacedbabaaba#bfggcaaa#########..#.########aabcb#aaaaaabaababccddba#..##.####aaabbaaaaaa##...#####acecb########abba#aa#a#aaaaabbca##aa#aa#aabbaaaaaaaaaaaaaaaaaaabaaaaaabaaa#aa##", "##########aa###a#####aaaaaaa##aaaacc#a###aabbcefbabbcfcddddbabgfa#a#aaaadbaa##abdedcaaaaaa#############a#aaaabbbbaacbbabbaabbaaababbaabababa##a##aaaaaccbbbb########.###abbacdcccgbabbbcida####aa#a#baaaaaaaa##aaabccaaaaaacbbabggb#a#####aa##..##aa######aabbcbaaaaaaaba#aabbcccca#.########aaaaaaaaa###...#######abdec########abb#aaaaaaaaaaabcbaaa#####aabbbb#aaaaaa#abba#aaaaaabaaaaaaaaabb#", "###########aaaaba###aaaaaa####aaabdebca###aabbcfgfbacdccdeheaadgea###a##dcabaaaabdedcbaa##################aaaaabbbccbaabcbaabbbbabbabbbaaabaa#####aa#abddbcb##a########a##.##accdeedbcccejcbaa####aaaaaa#a#aaaa###aabbbbaa#bdbb#chfa####a########.###########babbaaaaaabaa#aaaaabbcdc#..######aa#aaaaaa###.#..#####a#abdeba#######bbbbaaa#aaaaaabcca#aaaa#aaaabbbaabaaaaaaaba#aa#bbaabbaaaa#####", "######a##a###a#aaaaa#aabaaa##aaacddbbcaa##aaaabdifdadeeddfffaabdddbaaaaabd#aaaaaacfedcaa#################aa###aaaacccbbabbbbaaabbbbbbbbbaaaaa######a#aaacdddaaa#########a######aabbicceedghcbb##aa#aaaaaa#aaa#a####aaabbaa#adffbafgd####aa###################aaaaaaaaaaaaa#ababaaabbbcb#.####aaaa#a#a#a##..########a#aabbcdd#.###a##bbaaaaaaaaabbbbba######aaaacbb#abaaabaa#a#aaaabaabbbabaa####", "######aaaaa####aaaaba#abaaa###a#bddccaaa######abcfgghhhfdfffcacbabdecca#bca#aba##aeffeba##############.########aaaaccbbbabcbbbaaaababbbbbbbaaaa######aaaabeeaa#aaa######a###a#aaaabfgdbbddhhccb###aaaaaabaaa###aa##aaaaaaaa#bffgd#cda##a#a######a#a###########aaaa#aaaaabb#abaaaa#aaaabbca####aa#aaaa####.#############aaabcdc#####a#abba###aaabababc#aaa##aaabcaaaaabaaaaaaacaaaabaabbbbbaaa###", "a######aaaa##a#aabbaaaaacba##a##acccddbaa#a##aaaaacccdefefefdacaaaacgebcdb#a##aacbbegfdba#aba##############aa###aaabcdbccbbabcbbbbbbbaabbabaaa###a###aaaabcdb#baa#a###########aaabddgcdcbbcfidbcb#aaaaabaaa#a#a#abaa###a#aa##dfffeaa#####a#####aa##b.######.###aaaaaaaaaacbacaabaaaa#aaaacccaa####################a########abceca###aa#abaa#aaabaaaacda#aa###aacaaaaaabaaa#aaabaaaacbbbbacaaaaaa", "aa##a###aaaa#a##aaaaabbbbbbba####bbbacbaaaa##aaaaaabccbdedcefaccaaa#accccaa##aaabcddfgefeeffea################aaaaaabbcbcbbcbabbbaabbaacaaaa#a#######a#aaaacfcaaa##a############aacdee#a####eifccc#aaa#ccaa###aaa#ba###a###a#befffd######aaab###aa############aaaaaaaaaabbcbcdbbaa###abbaaabccdca...#######aa#a####a######aaaabcdc######aaaaaaaaaaabbcdbaaa##aababaa##aabaaaaaabaa#abbbbaaba#aaa", "#aaaaa##a#.###a#aaaaaceccbbbab##aaaaaaaaaba#aaaa#aaabccbcdddgfdaaaa######aa##a#aaaeggihgeefeddeca###############aaaaababcbbbbaabaaaaabacbaaa##a#####ba#aaabadgeaa#a##a####a##a##aabbeeaa#####bhibaca##aadbaaaaaca###########aadfddfda###abaabb#aaba#####a######baa#aaaa#abdc#bccbaaaa###ba#aaabdfeec#########aa#aaaa####aa#aaaaabde###a###aaaaba#aaaabbccbaaaaaaaaaa#a#aaabaaabbaaaababbbbaabaaa", "##aa####a#####aaaaabcccbbbcbbaa##aaaaaaaaabb#baa##aaabbcccdefgiecbaaa##aabba###a#affghihfccdddddeca################aaabaaaabaaaaaaaaa#aaaabaa########aaaabaabcgcaaaadda#aa#######aacdde#######aegbbdbaa#adbbaabcaa#aa#########acfeeecaaaaaaaabbaaaba###########aaaaaaaaabddfbaaababaaaaaaa##aba#acefgca###aa#####abb######aaaaaaabcfa##a###aaaabdaaaabbbbdb###aa#aaaaaaaaaabcbbbbbbabaabbbbbbaa#", "####aaaa#a#####aaabccccbaabcbcca##aaababbabbabaaaaaabcccbacddefffdccabccdedaaaabdeeffgggeccddccdcdca#a##############aaacaaaabaabaaaaaaaaaaaaaaaa###aa###aaaaacdgcaaabaaa#######a##abdchaa######.cfcbcb#a.bffcbbbab###aaaa###a###ceedddabcbaaaabbabbaaaa##..#####aa##aaaa#acecbbcbaaaaabaaaa##aba#aecbccdcabaaa##abbaa#a##aaaa##aaaabdd##aa##aaa#aaababbbbbdb#a##aabaaaaaaaaaaaaabbbbbbcbbbbcbbaa", "aaabaaaa####aaaacccbbcbbbaaaabdaaaaabcaabcbbbbbaa##abcddcbcdefedffedbdccdeec#aafffdddeffcccbcdcccccccaa#############aaaab##aacaaaaaaaaaaaaaaaaaaa###aba#aaababdefaaaaaaa##a###aaaaabccgcaa#######bgcdeca##bhgbabaac##a#aaa##a###befddfdddbddbaacabbbbaa####.#######a#aaaaaacbaabbbaa##ababa##aa##acaaaabbcb#aa#a#aaa##aa#####a#a#aaaabeca#aaaaaaaaabaabbbbbdb#aaa#abaaaaaaaaaaaaaaaaaabcbaababaa", "aaaaaa#aa#####abbbcbbabcccbbaaabbccccdbabccbbbbbaaabbcddcbceeeddeggddfbcdeec###dffedddeddcccedccccbbcdb#################aa#aaabaaaa#baabaaa#aaa######aaaaaaaabbcdfaaaaaaa#a####a#aaaabge##########bhcbccaabdeeaaaa###a###aaaaaabceedefeeedeeccabbabcbbaaaaa##.#.#######aaaabbb#aaaaaaaaaabaa##a##aaa#acbcabca###aa####aa#########a##aaaedb#abaaaaaaabbabababccb#aaaaba#aaaaaaaaaaaaaaaaabbbbbaaa", "aaabaaaaaa###aaabbbbbaaaacbbbbbcccddefdaabbbbccbbbbabbccbcdddddeeeffefcedffedbabeeecddcbcccbdbbbabbbabba#aaaaa##a######aa#a##aaaaa#a##aaaaaaaaa###aa##aa###aaabbdedaaaaab#a####aaaaabbgha#a########becaccdfgddda#aa#aaaabaaa#a#addeecdcdfeeeddcacbbbcbbaaaaaa###########aabacbaaaaabaaba#baba#aa##bbbdbacaabcb##aaaaaaaaaa#########a#aaabddbaaaaababbbbbaaabcccbabaaaabaaaaaaaaaabaaabaaaabbbbaa", "abbabbaaaaaaaaaaaabbabaaaaabbcbbcdedfggccbaaabbbbccccbccddeddccdddcddecddeffddecddccacbaacbbbbaabaabaaaaaaaaaaaaaba####a###ba#ba#aa#####aa#aaaaa############aabbcdebbbaaaa########ababdhf#a#########afecfffebceaa###aaa#aaaaa##abeeddddeegffdcfdbbabcccbaaaaba###########aaaabaaaabbaaabbbaabbaaaaacdcaacaaaabca##aaa#aa#aa#aa#######aaaaacee#bbaababbbbbbbbbccdcaaaabbaaaabbbaaaaaaaaaabaaaaaab", "babbaaabaaa#aaa#aaaaaaaaaaaabbbbcdbadccdbbbaabbbbbcbbccdeeedeabcccccccccdeedfddcccdbcbaaaaaaabbbaaaaaaaaaccaaa#aa##aaaabbaab#a####aa####aa##aaa###############abcdedbcba#####aaaa#aabbdhie.#####a#####fgffececeda###aaa#aaaaaa#cddecddcddefeegefeccbccccbaa##aaa#.#####.##aaaabaa#aaaaa#aab#bcccbbccbbaab#aaaabcbbaa#aaaa#a#a######aaa##aaabdfdbbbbabbbbbbbbbbccccaaaaaaaaaaabbbbbaaaaaaaaaaba#b", "bbaaabbaaaaaaaaaaabaabbbaaaabbabcedcbbabccaaaaabbbaabbceffcccbbcbbbbbbbbddcdddbbbabbbbaa####aaabaaaaa##aacfeaa######a##aaabbbaaa##aa#a#####bcca#a##aab##aaa#aaaacccgdbbb#######aaaaabbbdhhb###########aeifddbbceda#aaa##aaabaabefffcdddccdeeeedeffefeddccbaa##aaa###.###..aa##aba##aaa#aaabaaabccddcccaabaababaabcca###aa#aaaaa####aa#####aaacffbbbbbbbbbbbbbbbbcdcaaaabbaaaaaabbaacbaaaaaabbbab", "babbbabbaaaaaaaaaaaaabbbaaaaabbbceddcbaaabbbbbaaaaaaabcdffdcabbccbbaaaabbbbbbbbaaaaaabaaa#a##aaaaaaa####aadd######a########abbaaaa##a#####a#aa########aaaaaa#aabbbbdgcaaa###aa##aaaaabadfgb######aa###aadidcdbaceca#aaaaaa#abcdeeeccdeddccddeadeefffffffecbaba#######.###.##aa#abaaaaaaaaabcaaabaabcbd#abaabbbbaaabdba#a#a##a###aaaa#########aacefdbbbbbbbbbbbbcbcccaaaabaaabbaabaaccaaabbaabbaa", "baababbbbabaaaa#a##aaabbbaaaaabccehdbaaaaaaabbaaaa##aabdgieccccbcbaaaaabaaaaaaaaaabaaaaaaaaabaaaaa###a###aaa################aaaaaacba######a#a##########aaaa#abbbbbcdhb##a####aaaaaaaacbfe.##aaaaa#####aadhcbbaaefbdb##aaccddfgedbddccccbbcdedceceggfeefefdcbaaaa#####.###.###aaaaaaaaa##aba#aaaaababdb#aa#aaabaa###bcbaa#######aa#############abdffcabbbabbcbbcbcbcdcbbaaabbbbbbbaacabaaaaaaaaa", "bbbbabbbbbbbaaaaabdcabdcaaaaaabbcdffcbaabaaabbbaaaaa##bcgjfbbbcdddcbbbbbbbbbaaabaabbbaaaaaaaaaaaba#########a#a###############aaaaaabaa#######a######aa#a##aaaabcbabbcceda#aaaaaaaaaaabbbec.a#aaaaaaa####aadhcabbbeecbaaadefggfeddcddcccccbccdccdddeghggeeeddcbaaaaa############abbaabaa#aaaaaaaaba#ba#aaaa#abaaaaa##aabbb###aa#a#a##a##########abbcffdcabbcbbbcccbbccccbaaaaaabbbbaabbabaaaaabba", "bbbbbbbbbbbbbbaaabfdcccbcbaaaaacdceebaa####aaabbbbaa##bdghfcbaaacdddccccccccccbbababbbaaaaaaabbbaa#a##aa#a#b##a#aa###a#######abaa###aaaa##a################aaaaabbbcbbcffaaa#cbaaaaaaaacec.#####aadea##a#aabgdababdfda#adfggeddccccbbbaccbbcbcddddgghigffffbabbaaaa##########ab#aaaaaaaaaaaaa####aaaabaaaaaaaaaa####a##aaca##a######a#########acbbbbcdefdabbaabccbbbbccccbcbaaabbbaaaababaaaabcc", "bcbbbbbbbbbcbbbbbcecccbaccedaaabddcaaa#######aabcbbbaabdfhfdcaa###acdcabdfeeedcccccbbcbbaaaaaaacbaa###aaaa#aaa#####a#aa##aa###ba###aaaaaaaba############aa#aaaaaaaaaabbbfgaa#adbaaa#aaaaehaa###aa#adea#a#aaabgbabacefdb#dfffedccbbaaaaaaccbbcdecdggihihhfdffcbbaaaa###aa###..#aa####baaabaaaaaa#####aaaaaaaa#aba#a###abaa#cbaa##.##aa####aa##aa#baaaacccefdbbabbcccbbbdccdbaabbbbbbbaaabbaaaaabc", "cabaabbbbbbcbcccccddb##abaccbabbdbcaa#a##a####aabdcdbbcdddghcbaaa####bcacigggecbbbcbcbbabcaaaaaabaaa#a##abb#########a##aaaaaaaaaa###aaaaaaa########aa##aaaa#####aaaaa#acegfaaa#aac##aaaachfc###aa###aabb###a#bbabccddefdceffedbcaaaaa#aaabbbbcdegihhhhgggdcffecabaaaa##a##.###abca#aaa##aaaaaaaa######a###b###baa####aaaaaaaaabca###############aaaabbbbbbdfebbabcccbcdcbbdcbbaababbabaabaaaabbb", "febaaaabbbbcdcccccb#####abbabbcccbbaaa####aa#a#abdeccbddeeehgcaa#a#aa#addhifdddbbccbcccbbbbaaaaaababaaa#aaba####a##a#a##aaaa#aaaaa#a##baaaaaaa#####b###aaaaaa##a##aaaabcefihefc##aaaaaabbdha####aaaa#ab######aaaabbccdefegffdcccaa#a##aaaaaabbehhhhffffcddbdcdbbba#ac######..###bb###a#abaaaaaabba#####aaa######a#aa#####a#####bbca###########a##aaabbbaaaabdfdbaccbccbcbbccdcbbbbaaaabaaaaaaabb", "dedbbbbbbccbcdccddb#####bbbaacccacbaaaa###aaaaaaacfdcbcdegghigbaa#aaaaaadfhgedcccccbbbbbbbbbbbbbbbbaaaaaabbba########aa#aaaa#abaaa####aaaaaa############aaaaaaa###aaaabcfghgihfbcb#abaaabbge####aaaaab######a#aaaaaaccdeeddfdbcbaaa##a##aabaafhgggfedccccdccbaaabaaaaaa#########a#####a##aabaabcaa#aaa#a#####.####a###########a#aaaba##a####a#aba#aaaabbaaaaabdeecccbbcbbccccdcbabaaabbbaaaabbba", "bccdcbbbcccccbcdfda#####acbabcbaabaaa#a###aa#aabbbefedcdffiihhcaaaaaaaabacfffefedcbbbbbaaaabbbbbbbbcaaaaaabaaa####a###a##aaaaaaaaba#####aabaa###########a#a####a###baabccghfhiieaa##aaaaabdga##a#a#aaaa######aabbaaabbbcddegdcbbaa##aaaaaaabbfedfddecbbbbbbaabbabbaaaaaaaaaa####aa####a#a#aaaabcbaaaaaaaa##############.######a#a#aabbba#a####a#aaaabaaabaaabbabcfedcbbbcbccccccbabbabaaaaabbccb", "bbccccbbcccccdddeca####aabbccca##aaaa##a#####abbbbeeffeeccfjjifbaabaaabbbcdecdeffdbcbbbaabbbccccbbdcbaaaaa###########a#a#aaaaaba#a######aaabcaaabaa###aa#aaa######acedbcdfihfhifba####aaaadhc###aaa###########a#bbaaabbccccfecaaacca##aaaaaccffdfccedbbab#a#aaaabbaaabababaa###########aaa###bbaa#aaa#abaa##########.########aa####a#aabba#a###a###aaaaabaabaaabbbcdfedbcccbcccccabbbbbbabbbbbbc", "bcdcbbcccccddddddba####abbbbdca#a###a###aa####aaabcededcbbgiijjhcabbaaaaaccddddcceedddddddeeefedbbcbcccbbbbaaa#a###aaaaa###aaaacaaa##a###a##acca############acaaaaa#abbccdghccggfcaba#aaaacggdaaa###############abbbaabbdeefedbaaaadda##aabbchedeefedbaaab#####aabbaabacbabaaaa########aa#a###aa####aaabba##a##.#############a#a####aaa##abdba#########aabbaabbabbaabdeddcbbbcccccbbbbaabbbccbba", "bbddccbccdccdcebcbb#####abccbcd######aa##a######abcddcdddeggiihhhdaaaabcccceedccbbcbbccbccdeeeggfeddccdeccbbaaaaaaa#a##aaa###aaaba#a##aa######a#####a######aaaaaaabaaababcehb#adcbdbba#aaabdceaa#################abbbbbacgeeecca###bedcaa#adfhccdffbbbba###a####aaaaabbbbaaaba###aaaa##########aa#.##aaaaa#aa#b######a#######aaaa##aaaa###abcdb######a#aabcbaabaabbaaabcdedbbbcddcbbbbcabbbccbbb", "bcdfdddcccdddcecbb####a#aabccabaa#####aaaaa#####abbccdedeedcijfggfabaabbbbccddccbbbabaaaaaaaaabbbgihihffedccbbbbbbbba#a#aa####aaaaaaa##aa#######a###aaaa########abaabbbbaccega#cdaaabaaaaabbfea#a#################abbbbbaeedddcbaaabacceccefihdccedcbaa##########aaaaaaabbbaaaa#####aaa##a############aa####aaaa######a#####aa##a##aaa###aaa#a#abc#aa###aabcaaaabbbbbbbbbbcddcbccddcbbbbabcccdcc", "ccbcffhfdddddccadbaa#####aabbaaba##########a##aaabbaacdddfeehjifgha#aabcbacddccbbbbbabbaaa#aabcccefgdddeffeecdedbbbbcba###aa####a##aaaaa##a###aa###aba#aa######a#aaabbba#abbfcbcccccbaaa#abbfjg#aa###########aaabbaaabbcbdedcdbbaaabbbcceghhiiedcedbbaa######a###aaaa#abaaaaaaaa##aaa##a##############aa####aaaaa#####ab#####aa##a###aa#aa#a#####aaaa##aaaaabbbbabbbbbbbbbbbbdddccddccbcbbbcccdd", "eecbdggfdddedcacda####a###abbaaca######aa##aaa#aabcababcdeeedgigdfgbbcbbbbbcccbbbbbaaaaaaaaaccddddefdecccbbcbbddcbccddedcaaa#a#aa##########a########adbaa#########aabbbcbcabbdcdcbbbcbaa##abbfiaaa##############baaabbbbccedcccbaa#abbbbbefgihfdcccbaaaa###a######aaba#abaaaaaabaa#aaaaaa######...#a#.#####aa#aaaa########a##aaa###a###aa#aa#aaaa#aabbabaaaaabcbbbbbbbbbbbbbbbccdeddcccbdccccdde", "eedfhhfcba#abb##a#####a#aabcaaccbc#####a#aa#aa###ccbbbabcdfffhgifehfebbbabbcccbbbbbbbbaaaa#ccdcddfghfeccccbbbbabcddegcbccdcaaaaaa###a###a######a#a##accba#########aaaabbccbbcbcehb###cbba##bdehe###############aa##aabbbccdcbccba##aacccbcceffedcbbaaa#####a######aaba##aaaa#ababcbbbbcbaa########.#.##a####a####aa######aaa###aa####a###a##a#aaa####aaadbbaaacccbbbbbbccbcbcccbcceeeeededcdbccd", "dgghigdb##a#a########baaa#abbcbdbbb#####aa#aaaaaaabaababcdegiihdggffdcbaabbbbabbbbbabaaaaa#ccdccdegedccbbbbbbcbbbbaadbabaacdb###aa###############aaaab#aa##a#######aaaaababbbabbfieaaaa#aaa#chke.#########..#aaaaaaaaababbccbbcbaa#aabbcbabcdeedcba###a#####a#a##.###baabbaaaaaaaabbaaba#########....#.#######ab#a#######a######a#########a##aabba###aaabbbbbbacdcbbbbcbcccccbdddeededegeddddcdc", "dhghhfa##a######a######aabaacccedaaa#######aaaaaaaababbbccdghgfedgfgcabaaaaaaabababaabaaaaabdcceeeecdbbbababbbbccbbbbbabdbabcba#a############aa##aaaaab#aa###########aababcbbaabeggh######aaagj##############aa#####abbaabbbbbabbbabcabbaaaabcddccba#######.###########ccaaa###aa##aaaa###a###..##....#.aa##a############aaa#####a#####a###aaa#aaaa#aaacaabbbbbbeccccbbccddccdegghhgfeegd#bddccc", "ffhhhe###########a#####b#bcadddcbaaaa#####abcca#aaaaaaaaabdhihgddfgfgcaaaaaaabbbabbbaabaaaabedcefecbbbbbbabbbaaabbacdca#aaa#bbdb#aaa#########aa####aa#a###a#####.###aaaaadbbaabaddcggbaaaa#bbdia#a##########aaa###aaabaaaabbbbbbaacefebaa#aaaabcccbaaaa###########.#.##ad#####.##aaa#aa#aa#####...#...###ab#ba######a###a##ab#####a###aaa##aa#aaaaaaaabbbbbbbbbbceddeeccbccccddfhijjhggghb#bba##", "#afhgcaa###########a#a##aabcddca###aa######abbbabaaaaabaaaeiiihgbbgeddaaaaaaaaabbaabbbaaaaabdcccddddccabbbbacaaaaabbbaaabaa##acdd###a######..a#a#####a#aa##a########a##aaecb#abbbcccfgaaaaaaaeia#a#a##############aabbaaaababbababdgeca####aaaaabcbbba#####a####.#######da##############aaaa#######.##.#.#ba########.#a#aa##abba##aa#aa#aa###aaaaaaaaaabbbbbcbccccefgeeccbccbbbbdfiihgggeb#aaaa#", "##bhgd###############ab#ababcdd###aaaa####aaaaaaaaababaaaadhhigebabfddcaaaaaaaaaaaabaaaaaaabcbbbcbbcecbbbabbbaaaabbaaaaaba###abadea#########.#a##########aa#a###a###a####aabbabbaadccghbbbaaabfi#a##a###aa####a##a#aaabaaaaaaaabbacfdba##a#aaa#aaaabbb######a######.##a#######aa#a##a#a####aa#####a#.#a####aa#########aaaaa##aaa###aa#aaaaa#aaaaabaaaabcbbbbccccceeceeeefedddcbbceeffhgfebaa####", "##.dhdb#########ab###bdababaddc######a###.#a######aabacaaaadghfdbbabecdba###aaa#aaaaccabaaacababbbbbbbcbcbbcbaaaaababaaaba####abbcfbaa#aaa###.###ab#####aaaa##a######aa#ba#aabbbabdcabefbcaababhe#a##aa##aa###a#####aabba#aaaaabbbefcba###aaaa#aaaaaaaa#########a#.##############aa#bb#aaa##a####.###########aaaaa#######aaaa###a####a##aabaabaaaaaaaaaabbbcccddebbbbdedefdcccccbceeghgfdaaba#aa", "aa#aeea##########c####ba###aca#####aba#############abcabaa#acdefccbacdbdc##aaaaa###aabdbaaabbcccbbbbbbbccbabcabaabbabbaaaaa###addbcdba#a################a####aaaa#aaaaaaaa#aaacbabdcbbbehca#abbeh#aa######aa######aa#aacfbaaaaaabbdgdbaa###aaaa#aaaa########.###aa#a.###########aaa#bbaaaaaa####a#.##.#######aba#####a#############a#aaaaabbba#bbbbaaaaabbcddddddbaabcedccbaadfdcceeggdbaaaaaaa#", "aa##ada#a########aaaa###a###a######abaa#########aa#abbbaaaabbcddeeebcdbabb#aaaaaa####aaaabcccbccbaabbbabccbaaaaaaaabbaaaaaaa##aabcccfeb##############a####ab#aaa##aaabbaacababaaaabcdbccffc##abeh.##aa###a#########aaaaacbabaaaccddfgdbaaa##aaaaaaa#######.##.#######.#########aaabaab########a#a##.#########aaa#####aa##a#aa###bdaaba#aa#aabaaaabbbabbbbcddefecbcbaabbdcbaabcecccefgcaaaaaaaaa#", "aaa#aaaa#aaaaa#####aaaaaa###########a#####a##ab#a##aacabaaabcccbdhedfdbbabc#aaaaaaaba##aaaeheaaaaaaabbbacddbbaaabbbaaaaaaabc#aa#a###cfgb#a#########aa###aaaccaaaaaaaacbabcdaacbaaabcddcccgfcaabeg.#a#aa#a###aaaa####aaaaabaaaaaaceefhfdbaa###aaaaaa########.####.###.####.####aa#abcbaaa####aaa#############aaaaaaaa#aaaa#ba#babffb#acb#aaaabaaabbccabbcccfgdaa##bcbbaaacbcbacebbbcddbbaaa#a####", "accccedaa#aa#aaa##a#aabda#################a#a#a##aaaabbbabbcccdcccfcfecbaaceca#aacdbcccba#ahgabaaaaababbbccccbaabbbbbbbaaabcb###aca#aabcc##a##########a###a#abaaa#aaabbddddbbbcbaaaaabcdddhecccg######ba#a##.#a###aaceca#cbaaaaacdefhgfcaaa#aaaabba#########..#####...#.#######aaabccbaaa####aa########.####abb##aa#aaa#a#ba#abbefba##bbbaaaaaabbccc#ccddeffcaaaa#baaaaabebbbbcbbbbcbbbbbaa##a##", "#abeeebaaa###aa###aa###aaa###################aa###a#aabbbbcddddccefegfcca#adhbaacccaaabcbcdecaaa##aaacabdabdcbaabbabbaaababbcb#aabb#aa##dea##aa#######aaa##a##aabaaaacacdfebbbbbbabccccfeddfgfed...#a##aa###########acdbabbb#aa#acddegfecbaaaaaaabaa#########...#####.#########a#abbbabba##aa#####.##....#####a##aaaaaaaa#baaaceeebaaaaeedbbbabbbccb#cedddcccbaaaaaaabaa#bebbbbbbbbbbbbbaaaa####", "##aadba#aa##a#######abbda################a#######aaaa#ababccdeeddffhhgccbaabefdbbaaa#aabcbbabca#aaaababbbbcccbaaacaabaaabaaaabbaaaab#aaaaefaaaaaaa#.###a#a#a######bbbaabccabbdcbabbcbcdbbaaaefeiiffa####a#######a##aaaaabbcba#baabdddefffdcaaaaaaaaaa##########...##############aabbbbbdabaaa###.....########aaaaaaaaaaaaabcccbdfebaaaaaacfdccbcddc##baabcbabaaaaaaaaabaaaedbcbcccccbbccbaaaaaaa", "a##aba#a####.######a##bgb#######a########aa#######aaa##aabbcceedddeghiebaaabccebaaaaaaaabaabaaabbaaabbaaabbbbbaaabbaaaaaaaaabbccbbcba#####cfebbabbbacaaaaaa#aaaa###acbbbbbbbbcbaabbbccbaaab#.aceffdfghfa#a####aa#aa##acbacbbbaaaaabcedcddedbaaabaaaaaa#######..#.################aabccccdbbb####.#..#..#.#..########aa#aaa#aaabdddbcababbbdeddedeeb####aaaaaa#ba#aababcbbbaeccbcbcbcbbbbaaaa###a", "ba#a#####a#############cb#########aa##a###a####ab#aabaaaabbbbedcdccehihcbbbbbbccaaa#a#aaaaabbaaaabbbcbbaaabbbccaaabbaaaaaaaaaabbbbacda####aaedbaaabddba#aaab###aa####aaddcceebabbbcbcdca#aaba#aaabaabfmka##aabaaaaaa#abbabbbbaaa#acccdddccedbbbbaaaaaaaa##a####.#.###############aabddcbbcaaa####.#......aa###aa####aaaa#aa##aacccccbbbabbcdedddea####a##aa#a#bccbccbcbbaaaadddccbbbbbbaa#aa####", "ab##aaaa######a##########aa###b##aaaaa##a#a#####ababbbaababbbccccdcdgjifbbabbcccca#aaaaaaaaacaaaaabcccbaaa#bbbcaaaaaaaaaaaaaaaaccbaabbaa#a#a#bcbbaa##a###aaba######aaaaaaddfhgccddddacacaaaaa#aaaaaaabhnk.aabbb##aa####aa#acaabb#aabccddeecccbbbabaa##aa###aa#######.######a###aaaabdddcdedda#########...#####aaaaaaaaa##a###aabcbbccbbbbcddeeefc##a####aaaaaacdccbbaababaaabccdccccbbbbaa#a####", "#####a#aaaaa###aaa######ba###aa#bba#aa#abca##bb#abaabbbbbbaabbbbdccceihgecbcdccbcd#ababa##aaabaaaaaabccbaabbddbbaa#aaaaaaaaaaaaaccbaaa#a######aabdcb##aaa##a#a#####aaaa##aabffebccddcb#aa#######aaaaaadlnd#aabbabaaaaa##aaaa####aaaabccdeedbb#aa##a###############.##..#.#####aaaaabccdeecdaa#####.########.###aaa#aa###aaaa#aaabcbccccbbccddeef##aaaaa####aaaccbaabaaaaaaaaba#bcddcbbbbbb#aaa#a", "abaa###aaaaa##a#a##a#############a#a#ababda#aaaaaaaabbaabbbbcbbbddbddgifhedbcccbbcc##aabbaa#aaaaaaabaabbbccccdebaa##aa#aaaaaaaaaabedaaaa##########becaaaaa#a#########aaa##abceffdccb##aa########a#abbabilk#a#a######ab#aa#aa#####aaabbcddedbaa#a######a#####################a#aaaaaabdddfgfc##########...a#a###aaa#a#aa##a###aaaabbbbbcbbbcceghfaaaaaaaabbabccbbbaaaaaaaa#abba#aacedcccbaaaaa#aa", "bbaa##aa#aaaa#aaaaaaaaa#aaa##########abaaaa#baaaaabbbbbabbbbccccddbddggghhfdbbcaabbbbbaabbaaaa#aaabbaaabbb#bbbaaa#####a#aaaaaaaaaabb##aa##########aabdcbabaaaa####aa###aa#abbcdhhcaba#baaa#######aaaaabhlmc#a#####aaaaa#a##abba#aabaaabcdgfbb################################aabbaabbccdhigca#########.########aaa########aa#a##aaabbbbccbccdgfha#caaa.##fedbbcbaaaaaaaaa#aaa###aaadecccbbaaaaaa", "#aa###aaa#a#aaabbbbbcbaa##a#######aaabaababaa#aaaaabbbbbaaababccdecdfhhiihgfdbccbbcbabaaaaaadca##abbaaaaaaa#bb##aaa####aa#aaa#aaaabbda.##########aaaabddcbbaa#a##aa#aaa##aaabbdecca#a#aa#a########aaaaaeili##a######abaa###aaaaaacfeaabddcdbaa##############################aaabbbbbbcdfgjieba####.#####aa#aa############aaaaa###aaabcbbcbbcefggcbbfeedbedbcbabbaaaaaaaaaaaaaaa#aaa#cdcddcbbaaaa", "aa#a###aa#a##a#aaaabbccaa#aaa########bacbaaaaaaaaaaaabcbbbbbbcedcdccfhfhkhggfdbbccbbabaabaabdda###aaa#aaaaaaacb#########aaaaaa#aaaabec##########aaaaaaabddcbaaaaaaaaaaaa##aabacbaaaba#####a##a######aaabgklbaaa#####aaaaaaaaaaabbbfdaacddeddcbaaa#########aaab##########a##aaaabbcbbbbeffhjifdcb#####.##acbb#aaaa###########aaaa#aaacbcbbcbcegfaccgghgffdcbbaabbbaaa#aaaaaaaaaba#aaaabeecccbaaaa", "aaaa########aaaabbabbbbcbbbaaaa#####.##aaaaaaaaaaaaabbbbaaaaadedcdccegijkifddebccbbccaabaaa##aa######aaaaaaba#aa#########aaaaaaaaa#bccda#######aaaaabbaaabddcba#aaaaaaaaaaaaabcdaaaaa##abaaa#a#a#a##aaaafhlg.aa#a#a###ba##b#acaabcdfaaaccdccedba##########adcbca#########a#aaabbcddccbdefggiigecb########aaaa#abba###########aaaaaa#bdbccbccef#abdeddeeddccba#bbbbbaaaaaaaaaaabcaaaaaa#eedccbbba", "aa#aaaaa###aaaaaaaaabbbbbbbbaaaa#######aabaaaaaaaaaabbaaaaabbbfeccccdfiljigcdeccccbccbccbbaaaa#######a#aa##aaa#####..#..#aaabaaaaaaabacb######aaaaaaabbaaaacddcbaaa##cbabaaaaabcbaaaaa###a##a####a##aababchl#.###a#####aaaaaa#aabbdeaaacbbbbdfdccbabb####a#ddbbbba##########abbbccdcccddefghhfcaaa######aab#abaaddaa########ab###aaaacccccdefd#dbgebcccdcaabbbaaaaaaababbbaaabacaaaaaba#eeddcbba", "aa#aaaaba#a#a##aaababbccbabbbbba########aa#a#aaaaaaaababbaaaaadcccaddfhkjigdcdecccbbcdcecbaaaa######aca####aa#####a#####.#aaaaa#aabababb######aaaaaabbabaaaaabcdcbaaaaaaaaaabbbcaaaa#a####aa####a#aaaaaababjh.####a#####aaa##aaaabdabaaaabbabdeeeddddcb#.##debaaabaaaba####aaabbccdcccddeffgfgcaa##aa###aaaaaccaddca########a#a###aaaccbbceffbaacgeaabbbbabaaaaaaaaaaabaaaabbcaaabaaaabbbccdedcb", "ba#a#aaaaa####aaaaaaaaaaccbcbbaa#######aaaa###aa##aaaaaaaabbbabbcbbefffhjihfcbfcbcbbbcfhgcaaa#####a#deaa##aaaa###############a##a###aaaaa###aaaabbaaaababbbbbbbbedcbaa#abbbbbcccaa##a######aa##aaa##abaa#aabja##.#######a#a###aaabecaaaaaaacccbcaaaabbdddefedcbaa###aaaa#aaaabbbcccccccddfggghdba####aababababcbbddba###a###a#aaa##aabbcccegfbaabcaaaaaaabbaaaaabbaabaacaabbbabbadbaaaaabba#aefc", "ba#a#aa#######aaaaaaabaabbebdbbb######aa####a###a####aaaabbaabcabcccddffjhfdbaefcdbbbbdjkjebaa#####bccb##baba#####aa######a###a#a####aaaaa##a##aabaaaaaaabbbbbbabefdbbcbbbcbbbcbaa####aa#######aaaaadaaaaabbdg###a#a####a#aa#aabccccaaaaaabcdbccaaaaabbdeeedcdcba###aa#aabaaabbbcbcccddddeffffdbaa####abccbb#bbccdbccaa###a#aaaa#a#aabbdcdfgdaaaccaaaaaa#aaaaababbaaabbbbbabbbbbcbcbaaaabaa###be", "fcb#############aa#aaaaaaadegdacbaa###aa####aaa#a####aaaabbaaabaabddccehieabaabecccbbbbbikkgca####acbb###baba#####aa####aaaaaaaa######aa###aaaaaaabaaaaaaaacbbbbbbeffedccbcddddbaaa##aaaa###a##aaa#adba#aaabbie.#.#aa##aaaaaaacecaaaba###a##aabdb#a#aaccccccccbbba###aaa###aaabbbbcccdddedegcddcbbaaaabbabbabbaabbaaddbaa#####aa##aaabbddefgcabagbaaaaaaaaaaaabbaaacabaaaaabbbbabbaaaaaaaaaaaa#a", "bdeba#########aaaaa###aaaaacfebbbbaa###aa#####aa########aaababaacbdeccehhbaaaaaddcbbbbbcgijhea####acb########a##aa#a##a#aaaaabaaaa####aaab###aaaaaaaaaababbccbbbbacbedffedcdeeaaaab#aaa#aa##a##aa#a###aa#aabackc.#.##aaaaaabdefb#a#aaaaa#a####abc####abcbbeecbbaaabb#aaaaaaaabbbbcbcdededdefdcaccbca##aaaa###aaaaabaaeccaaa###aaa#aaabcccdffbbacfc#a#a#aaaaaaabbaaaaeabcbbabbbbcbbabb#aaaaaaa#aa", "##aba######aaaaaaaa##a#aaa#fdaabbccb###################a#aaaabbabccccdehibabbbbcfdcbbbabgihc#a####abbaa##a###aa##a#aaaa##aaa##aaaaba###daaa###abcaaabaaabbbbbccbcbcdcdddggfedbcbaaaaa##a#####aaaa#aa#####abbbbdjb.a##aaaaabeecabba##aabda######aa####aaabbdcdcbaa#bcbbaaaaaaaabbbcccddedefffdcbccbab####a#####a#aaabaabeeba######aaacbcddegebbacccba##a#aaaaaaaaaaaaccbbbbbabaaa#aaabbaaaaaaaaaa", "aa##baa####aaabaaaaa#####aacaababbccbaa##################aaaaaaaabbccbegifaaaabbcecbbbbaadgb#####aeeabc#.######aa##aaaaa#aaaaa###abaa##edaaaa##aabbaaaabbbbbbbccbbdccccdddehhdabbaaaaaa##a###aaaabb######cebcbcgj#aa##abdfggcbbbaaaabdfea####aaaaa##aa###aaa#aaaa#aaabbaaaaaaaabbccddeeddeffeeeefcabaa#aa#####aa#aabbbacccbaaaaaaaabcccdegfbbbceaacb#####aaaaaaaaaaaacccabaaaaa#a#abbccaabbaaaa#", "#aaa#daaaaaaaabbbaaaa####abbaabaabcbbbbb##aa################aaaaabbbddehecacbaaaabecbbbbabaa#####adcca#########a#a##daaaaacaaaaaa###aa#aca#aa##aaaabbbaabccbbbbcddaccdeddecfhgcabaaa#ab#a####a####aaa#aaaabbbcbcijdchihgighedbcbbcdfdabbbbccaaaaaa###caa#aaaa#a#a##aaaaaaaaaaaaabcccdddddeeedeeeffbaaaaaa##aa###aaabbbabcdeabaaaabbbbcdegibabbfaabca####a#acca#aaaaaaababbbaaaa##aaababbaaabaaaa", "#####adcbbbaabbbaaaa#a#a#####aaaabbaaabcbaa#################aa#aaaaabddgeadbcaaaaabccbbbbba#####a#a##aaaaa###aa#aa#bccaabaac#aaa#####a#..#####aaaaaabcbaaabbbbcdccdcddedceefgfccbaaaaaa#aa###aa##accaaaaaaaabbbbdjkfdfgjjhgfeeeeeedcaabaabaaaaa#####ab#a#aaaa###a####aaaaaaaaaaabbccddccccdccdeeegfbcbcaaa#aaba#aaabdcbbbababbbaabbcccdghg#aadbaabbaa###a##acdaaa#a#aa#baaaaaaaaa#a#aaaccbaabaaa", "a##a#aaedbbcbabaaaa##a##aa####aaaababbaabacaaa###a#######a####aaaaaaaccehbbbbcbaaaaacdbbbcb#a#a#a#.####aaa##a#aaaaaaabaaaaab##aaaaaaaa#####aaa##aa##abbaaabbbccbccbcdcdcddeffcaabaaaabba#aa####a##bcbaaaabababbbbejib#abccdcbbccba##a##aaaa##a######a##aaaaa#a###a#####aaaaaaaaabbccccccccccccdeegfcdabbaaaaaaa#aaaabccbbbaccbabbbcddefedea#cd##a#aaab#aaa##bcb###aaa##abaaaa#####aaaaabbcbaabbb", "aa##aa#bhgccbbccbbaaaaa########aaaaabcbaaaabbaaaa###aa#####a#a#aaaabbbbcega##acbabababecccdabaa##########aaaaaaaaaaaaaabaaa####aaaaaaaa##.##abaaa#aaaaabbbbbbbbcdbbccddcdcegeaaaab#aaaaaaaaa####aabbabbcbbbcaaabbcegiaaaaaa##abbcbca##.###aaaaa####aaa##abbaa#aaaaa####aaaabbaaabbbbccccbcccdddedfddcaaaaaaaaaaaaabbccdbbbcecbbccdefged#a###fa######aaaaaaaabaa#######aab#aaaa#aa#aaaaaabcccabaa", "aa##aadafhhfeccbbbaa#aaa##a####a#aaaaaaaaaaaaaaaaabaaaabaa#aa###aaaaaabbcfd#a#acbaaaaabeecdcc#############abbaaaaaaaababbba###aaaaaaa#a#####aa#aaaaaa#aaaabbbabcccehgeecdegebaaaaaaaaa#aaa#aa###aaaaababccbbaa#aabceggaaaaaa#aaaabcb####a###aaba######a#a#####aaaaba#####aabbaaaabcbbbbcbbacceeddeebabdbabbaaaaaababcdccdccdcbbccefecb#####cc#########aaaaaaaaaa##ba#aaaaabbbbaaa#aaaaaabcccdgdb", "##aaacdggggghgdbbbbbaaaaa#aa###a###aa##aaaaaaaaaaaaabcbbaaaaaa#aaaaaaabbbdfd#aaacdaaaaaadgefc#######a#a###abb##a#aaabaaaaaa#######aaa#a########aaaaa##aabbbbbbbbccefhfeeegfbbba#aaaaaaaaaaaa####aa##abbcdacbaa##aabcehfaaaa###aaababa##.##a#aaaca#a#aaaaaa#aaaa#aabcc#####aaaabbbbbadcabbbbbbceedefcaabcecaaabaaababccdcdddccbbcceda#####baeaa#aaa#####ab##aaaaa##aaa##abbbbbbbbaaaaaaaaabbbagig", "f#aaaehhfffeffhfbccbbaaaaaaa####a#aaaaa###aaa#a#abaabccabcbabbbbabbaabbbbcehdaaaaaaaaaab#dgeaa##a###########aa####aaaaaaa######a####aaaa###a###aaaaa###aabbbbbacccdedddfgebcbaaaaabbbaabaaba#########abcbdabaaa#aabcdeibaaa######aaaca######aabbb####aaaaaaaaaaa##bbdb####aabbbbaaaacdcaabbbbcceddeccccaba#aaabaaaabccddddddceddeec#aca#aabebaaa#######aaaba#######aaaaabbbabbbbbaaaaaaaaaba#dii", "hd#aaejiedefeeddedccbaaaaaa########aaa#######a#a#aaaabbaacbbababccbbabbbbbceidbaaaaaaaacbcgeca#############aaaaaaaaaaaba######.a############a##aaaaaaaaaaaacbbbccccedbcfcbbbbaaabbbbaaaaaaababaaa#baaaabababbabaaaaabdfhaaaaa#aa##b#bbaa#####abb##a##aaaabbba#aaaaaacda#####abbbbaa####a#abaabccbdecdbbaaaaaaaaaaaabccceeedcdfgffeba#aa#aa#bcaaa##########aa##a####aaaaa#aaabbbbaaaaabbbcbbbeefh", "ggecdhjkiefeeddcdefdababaaa########aa##a########abaabaabcdabbcdccbcbabbbbccchiecaa#abbbaaaadeca#####a#######aabaaaaaabba###a##.#############a##aaaaaaaaaaabbbccdddbbeccdbbcbbbabbbbbbcbbaaaabccaaaabaabcabbabaaaabaabcefeabaaaaa####aaccb####aaa###a###aabbab#a#aaa##aaa#####acbba#a######aaaabbbbfefdaaaacaaaaaaaabbbcefffeefbed########a##dbaaa#######a#############a########aaaaaaaaaccfgfhdf", "efddegijmkfeeeddccdgdbcccbaaa####a#aaa#####a####a###aabbcbabacccdccbbbbbcbbdfijhbaaaaabb###cedbaa###aaa#####aabbccbaaaaa###accb###a##########aaaaaaaaaaaabcbbccddddcddaaaabbbabbbbbbcbaabbbbbaaaabbaaaaabbbbaaa#ccaabbddheabaaaaa####abca#####ba##a####abcaaaaaaaaaa#aaaa#####bbaaa##aaaa##aaabbaaadfdbaabcbaaaaaaabbacehhhhcaaaa#####a#ab##ccaa########aa#############ba#a#aaaa#aaabdaaeffghgff", "eddcbcdefijgeedcccbbdeccccbaaaaaaaaaa#a#########aaa##a#abcaacccccccbcbbccccdefikibaaaaaaaabbdddca#a#a#aa####aaabbbaaaa##a##aaaba##aa##a######aaaaaaaaaaabbbbbccccddddaabbaabcdbbbccbacbabcbbccbaa#aaaa###baaaaa#a#aaabcdfjb#aaaaaa####abaa.####a##aa####bcbbaaaaaaaa#####aa##abaaa#a##aaaaaaaaaaaaabecbaababaaaaabbbcbcehhcaaa##aaa#######b#.cbabaa#####aa##a#####a#########aa#a#aaabdefffggfefe", "ddcaaabdefhihecdbbbbacdecccbbaaaaaaaa############aa##aa#ababbcbcbbbababccdceeegijgaaaaaba###bfcdc##aaaaa######aaaaaaaaa#aaaaaacba#aaa#a#ba#aa#aaaaaaaababcbbbbbcedabbaabbaaabbbabbdccbbbaabbbbbaaa#aaaaa##aaaaaa#####abcehka##aaa#####aaaa###..a#aba#####abcaaaaaaa#a##a##a###ba########aaaa####aa#deaaa#aaaaaaabbbbbccefcbaba##abaaaa.#a#ba##dc#a#a####abaabb#a##aa##a###a###aaaaabaceecddhhedd", "cccbabbcdfffhheccbbbbbcdfccbbbbaaaaaa###############a##aaaabacbbbbaaaacccddcdefhjjhbaaaabaa##dfbbc###aa#aa######aabaabaabbbbbabdb#aa#a###bba#a##aaaabbabbbbbcbbcedbaaaaaaaaabbbbbcbccbcebbbbaaaaaaaaaa#####aaa####aa#aabdegj.############a##a##a#aba####a##baaaaaa#a###aa#aa########a##a#aaaa####a#eeaa###aaaaaaaaabbcdgfdbaa####aabbcb#aabc###cda#aa##aababcbb#a#aa###a##aab#aaaaababdecbcdheed", "cbbaccbcddeffeedcbbbbbbccffdbbcbabbaaa#aa########a###ca#abaabbbabaaaaabcccddcdgiikjgbaaaaba##afcacba###aa########abbbbaabbbbbbbcbbbb#aa#a###aa##aaaaababbbbcbccdca#a##aaaaabaaabcccbbcbcbaabba##aaaaaba#####aa####aabbbddcdjd.#########.#..#######aba######aaaaaba########aa#######aaa#aba#aaa###aacaaaa##aabaaaaaaabbcefcbbaaaaa##aaacabaaaa###bca#####aaaaacaa#a###a##a#aaa#a#aabbbbcddcccegdd", "cbbabbbbccddeedddcbbbbbbbbdfheccccbaaaa###########aa#bd##baaaabaaaaaababcddcccggijjjbaaabbaa##bcbabba##aa#######aaaaaaabbbbbbbbbcccaaaa##a##aaa##aaaabbbdbcbbcdfbaaa#aaabbbbbbbbbcccbccdedaaa#aaaabbaaaa#a#aa####a#abcccdccfi###########....#######aa##aaaaaaaaaaa##########a###a##aa#aa#aaa#####aaa#aaaa##abbbaaaaabcdefbbaaaaabaa####aa####a#a#dba#####bb##b###########aaaaa#aaabbaabbbccddede", "baabbbbbccccdeedcccbbccbcbbcdiheccbbbaaaaa#aab##aa###aa###aaaacbaaaaaababccccdfhjjjl#abbbaaba#abeaabb######a#####bbaa#aaaabbbcbbabbaa###aa####a###aaaabacdcccdceaaaaaaaaaababbbbbbbcbbbcbdba###aabbbaaa#aa##########aabbabccgb.###.#########.########a#aaaa#abaa#########a##aa#####bcaabaaba###aaaaaaaa#####aaaaaabbbdhidabaaaaaaaa###########a###ebbb###aaa####a###aa#aabcaabbaaababaaabbbbbdcb", "abcbbbbbbbccbbcddbcbbbbbbbbbcfeghfccbbabaaaaabaaaa####a#b##aaaabbaa#aaaaabccbceefhegdedaaaaaaa#abdaaba#aa##a#####aaaabaaaaaaabbbaacc###aa#aa####a#aaaaaaabcccddfbba#aaaaaabbbbabbccccccbcbdaa#####ac#####a##########aa#aabcbdh..#########.#####.####aaa#aaa###abb###########accaa###a##aaabbbba#a##a#abba####aaaaaccegcbbaaaaaaa#aa###.##a########aeaaaa###a#a######aaa##aaaaaaaabbaabbaacaacced", "cadbbbbbbcbccbbacbbbbbbbbabccdeehgffccbcbaaabaaaaaa###a####aaa#aaaaaaaaaaabccbdeeffeehgcaabaaa##adb#aca##aaa#####aaabaaaaaaaaaabaacdb##aaaaaaa#abbaaabbbabbdecffbaaaaaaaaaaaaaabbaccbcbcccdcaa#############aabb######aaaaabbbehd..###d#.#.######.####adbaaaa##abba########aaaaaaaaaaaaa#aaaaaaa#a#aa#abaaa####aaacdeheaaaaaaaaa##aa#aa#####a####a#.cdaa######a##a###########aa##aabb#aabaaabbadf", "cabdabbbabcccdccbccbbbbbbaabdcdefdcfgccbbbbaabcbaaa###aa##aca####aaa##aabbbccccddffhihhfbaba#c###bdaaagaaa#a######aabaabaaaaaaaa#a#aa####aaaa#aabbaaaabbbbbcddfeca###aaaaabbaabbabbcbccbbbccdada###aa######aaba####a###abaabcafjlf..defe##...#########bbaaa###aab#a#######aaabcb#aaaaaca##aaaa####a##aab###a##aabdfiida###aaaaa##ca#aa#####a####a###ecaaa########a##a#####a####a###aaaaaaaaaabab", "ccbbbbabbaaabccdcbbbbbbaaaabcdbbbeeadgeccbbbbabbbaaa##aa#abedbaa####a####bbbcbccddehhhfdaa###da#a#ddaabhaa###########a#abaabbaa######a####aaaaaaaaaabbbbbbcbdeefcb###aaaaaaaaaabbbbccccbbaabbcaaa############aacbaabaaaaaaabccbdejkbd..bgccdcba########aa######aaa#a#######aaaccaba#bcaaba#a##aaa#####abba#aa#aabdgkjkihgdb#.cedcbb#.###dc########b##ebaaaa#########################aaa#aaaaaaba", "abeecbbaababbbabbdbabbbbbaaabcccbdcb#ehedccbbaabbbaaa#abaaaedba###########acbbbcceeeggdaaa#bacaa#aadabbdf#######.#######aaaaaa######bca###aaaaaaaaaabbbbbbbccfffbaaaa#aaaaa#aaaabbccabbcccbbbbaaaaa#######a#aa#acaaaaaaaaaaaabccceglh.#....#baacca..####ab########aaa####a##ababbbba#ceaaaaaa###a######aa##acbbbbchgcddfgjihddigefegfffba#affeecbbaaabda#aa######a#a################aaaa#aaaaaab", "babfdcbcbabaabababbbaaaaaaaabcccdbaaaacifddcbbbbbbbabaabaacecabaaaaa######aaabbcdeeedifba#adcbaaba#bcabbfe#aa####aaa###a#abaaaa######aaaac#aaaaaaaabbbdbbbbcceebbba##aaaaaaa#aaabbbbbbcccdcabaaaaab##a#aaaaaaa######abaaaaa#abbbbddei#####a####.#ee######aa######aaaba######abaaaa#a##bc##aa#a####a###a#aaaabcbbbceecbbcbdeffgfdccccdefeefgffedcefeb##cdbcba########a###########a###aaaabaaaaaaa" }; SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 384 NAXIS2 = 384 HISTORY Written by XV 3.10a END 3"3wUD3D3"3""3"3"333""""""""3DDDU3""""DwUUD3333333"3""3""DfD"3""""""""33DUfffUw3""UD3""3"3D"33wf"""""""3""""""""D""""""""333U3333DDff333"""""""""""333333DDDUD"3"""""3"""""""""3""""""3333UUf"�ff"""""3""3"""""3D"""""""""3D333DffD33D3UfwwwUDDDDUfwffwwwfUDfwf3DU3D3"""""""3""""""""3ffD33""3"333"33U3"33333"""3DDD3UD3ffUDD33""333""""3"""fU3""D333DDfffU"""3"D""""U"33Uw�""""""3D"""""""""""3333333DDwww3"""""""""""""33DD"33DDD3333"""""""""D""""""""""""3DDDfݙ�����3""DD"��"3"""""3"3333"Df""""""""""D3333DDUUwUUfwfwww3""wwffD33"""3U"""""""""""""""3DD3333"33"""3DDUD333333""""3DU333ff"UfDD3333"333""""""3fU3"""333D3DDUUfwU""U""UU""3""""3""33"""""""""""""333333D3UffwD3""""""""""3333DDDD33""33D"""""D3""3"""""""3DD3Uf3U��3DDUD3""""""""""DD"3"3D""3""""""33"""""3U̻̪U3�DfUD33�UD3f3"""""""""""""3"D"3U"333"3DDDUDD3DD333333""3UDUfwUDwDD3333""3D3""""""D""""""333DDDDUUwww3"3"D3U"""""""""3""3"""""""""""""""""33""""33333DUUwfD""""""33""33"33D3DD333DDU"U"""""3"""3""3D"ww��Ufwf���33"""""3""""3D3"""""D""""""""3"""3UwU""""""D"""""fD"""""""""""""""""3"3D"U333333D3DD33"D33333333"3DDUffwwDD3D3"""3"""""""""""""""""""""3DD3UffwwffD""3""""U3"D"""""""3""""""""""3""DU3""""""""33"""333"33UfDww3""""""""""""""33"DD3D3DDDUD""""33"""""333fU��U���"U3"""""33"""""""""""""""""""""""""3""""""DUff"""""""""""""""�DU""""""""33""3"""33"Uw"3D3333333DD33DUU3D333333333DwfwDD33"3"""""3"""""3""""33"""""""3DD3DffwfUfU""""""""3U""3""""""""3"""""""333""DD""""""""""""3DDDUUw33"""""""3333"33DDDDDD3D3U"""D"""""3D3U����"""""""33"DD""""""3333""""33""""""DDfD33"""""""""�""f"""""""""""""""""33""33""D""DDfU3""33333DDDDUffUDDD33DD3D33DUfDD333"""""""3""""""""D3""""""3"3DDDDUw"333""3""3f""33"33""""""333D33"33"""""""""3"DUDDDUDf""""""""""3"3333333D333D3U3"""333"""""""33"3DD3���""""""3"""""3D""3""3"""""""""""""""333UU"3"""""""""f333""""""""3D""33"""3"3"""33333UD3D33"3333DDUUffUUUD33333333UwfDDDD3""""""3U3""""3""""""3"3DUUDDD3"""33""3D3"33""""""""""333333333DDD""""""""""""333U3D33DUw3""""""333333333DDD3DDUfU"""""""33"""""""""3DDDUDDw����""""""""""""""""""""""""""""""333"""""3DUfw33"""""3""""""U3"333""""""""33""333DDUUfUfD33"DD3DUUfwwffUD333333DDwwU33D3"33""""""D""3""333"3"""""3DDDUUDU̻3""""3""wD"D3""""3333""3333333D3333""""""""""3"3333D3DDUD"""""""3"""3DDD33D3D3""33""""""3"""""333UUDUU����"3""""""3"""""""3""""""D""""""3"""""""33DfwD33""""""""D"3""""3D""""""D"""""""""""3333DUUDDDfUUDDD3"33DUwwwfDD33333DUwDD3333"""""""""""3"D3333""""DDDUUDUfw3""""3""Uw33D""""""3""3""33333"3U3"""33""""""33"33333D33DfU3"""""""""33333D3DD3Df3333"""""""""""""""""3Uf�""""3""3""""""""""""""""""ff"""""""""""33DUwU3""""33D3""3DDU"""""3"3D33""""""3"""""3"3UfD3DUffUUUD"""3UfwfDU3333"DUfDDD33"""""""""""""3"33D3D333"3"3DDUDfff"""""3"3wDUD""""""""""""""""""""D3"""""3"""""""""""3"3D33333DfU"33""33"""333"33UDD333""33333"""""""""""""""3Df""""""""��""3""3D""""""""""3"""""""Uf""""""""""33333DDfwD3"3""3""""�"3"UD"""3""33""""""""""3"DffDUUfUUfUUD3DUfwffUDDD33UfDDDD3""""""""""""""""3D""DDDDDDD3D33DDDDUfw̪3""""""""33UUUD""""""""333""""""""3"""""""""""""""33333DDDDUUUU""33""3DU333DD3"D3"3D33DD3""""""3"""""""""3DUw3"""""""3""�"""3D33"""""""""""3"""""""""""""""""3fD3""3"3"""""333D3DfD""""""3�D3"3""""""""""""3UfwwwwfwffwUUfwfffUUDDUU3DDD3"""""""""""33D3"3"DDDUDD33333D33Uw3"""""33DfU3"""""""33DD3""""""DD3"""""""""""""3D33DDUUUUDUU""""333"333333D3""33333""""33"""""3333"""DD""33UUf"3""""""3D"3"""3D""""""""""""""33""""""""""33"""UwU3""3D3"""""""33"DfD""""""3DD""""3"""""""""3U""fwwwwfDU̪fwffUUDUfwU"3"3"""""""3""3""3DU"33DUDD3D3"3333DDDfD"""333""""UfD""""3""""""33""�""""""""""""333DDUUU33fDDU33D333"333333D33""""3DD""""3""3D"33"3""""3""3Dfwf"3"""""""DD3""""""33"3""""""""D33""""""3333wfwU""""D""""""""333Dfwwwffw3fU"U3""""""""""""""DDwwUwU""ffUfwffUUfUDD3"""""""""""""""33""D33"3"3DD33"33333DfU3""""""""D3DfD""""""""""""3"�""""""""""""""D333DDDDfU3DwD3333"""3333"""""""3"3"""3""""3"3"33"3"""""3Uw"""""""333"""33"""""333"""""""DU""3333""""3""3DD3UfDU33""""""""""""3DDDfffUDUwwwf3"""""3D""""""""""""""3333"""""333D333ffww"""fwwwfwww3DD33""""""""""""""""""3""3DD"3D3"3333"33""3333DfU""""""""""3Uf"""""""""""""""""""""""""33333"DDDUfUUUwf3D3"""""333""3""3""3D3U"3"""""3DUf3""""""D"""333"""""""""""33U3""3333""""DUD""3333DDfUUfDDDD"3""""3""""3DDUUUUUUDfUUffD"D"""3f3""""""3""""""333"33333"""""""""3"U"""DUU33333"""""""""""""""""""""""3D33"""""""""""""333UwU"""DU""""""UfwD"""33""""3"""""""""""""""""33333333DDfwwfffw333""""""""""""""""33DU"D3""""3Dfw"""""""3"3"�""""D""""""""""""""3DD""""33333"UD"333333DffUfwD""3DfD"""3"""3"3DDUDUUUDD33DDfU"3"f""""""3"""""""""33333333"""""""""333"""""U"wwfDD333""""""""""""""""""""""""3""""3""""""""""33DwU""D3"""""3ffDUDD"33""""""""3"333"""""""""""""""""""""333"3DDDfffDUff3"""""""""""""""""""3"3DD33""""3Df""""""""""3D3"""3"""""""3"""33""""3D3333D33"DDffUUff3"3U3"33""""""3"3DUDDUDDUD33DDfwfD3DD""""""""""3""""""3333"""""""""3DDDUU3""""3DD33DD33""""""""""3D3""""33""""""""""""3333Df""D3"3"3"3fDDDU"3""""""""""""""""3"""""""""""�"3""""""""33333333DU33DDUUDUDff""""3"""""""""""33"33D333D"""33Df"""""""33D3D"�"""""""""33"""""""""""33"""3333DDDD3DDDUUUfUwUUD"""""""""""""33DDU333DfD33DDUfwfU"w"""""""""3""""3""""""""""""3DDD"3""""""fU33D3"3"""""""""""3"33""3"D""""""""""""DDf3333D3"""""DU333D3"""�"""""""""""3"""""3""""""""""""""33"""333DD3DD3DUDUDUUfwwD""3""""33""""3D3""""3"3"3333f3"3DDUD33DD3""""""""""""""""""""""""33DDDDDDDDDDDDUffwDU"33"""""""""""3DD333"DD3"333DUUfwfUf"DU""""3"""3D3""""3"""""""""33D3""333"UD333""333""""""""""33"""3D3"""""""""3UUf"U3D"""""3DD33333""""""""""""3DD""3""D""""��""""""3D3"""3333DUDDUDUUfUDffwwDD3"""""""""""DD""""""""3333UwUwwffffffUD""3""3""""""3"""""""""""""""""33DDUUDDDDUDDUfffw3D3D"""""3""""3UD333"3"333""33DDDU""U3""33""""DU""""""3"""""""""""""DD3""3""""""U""""""""333"""""33""3""3D33333"""""""333UUffD"D3""""3fD3333"3"""UDD"""U"""""D"""""""""D"""""""333""3DD3333DUU"DDUfUUfDwD"3""""3"""""""""333D3DUDfU3D33DUwU"3333DD""""""D"""""""""""""""""""""3DDDUUUUUfffUfffww3"""""""""""333"3DUf"3""""3333DUf3"33w""3D"""DD""""""""3"333"""""""3"33"""3""""""3"""""3"""""""D""3"33DD3""""""""""33DD3fw""""33DfD3333""U3"ff"3D�"""""""""""""3""fU""""""33""""3333333DD33UDDDDUUUfU"33"""""""""""33Df3D3D"""3UwD333""""3Uwf""""""""""""""""""33""""""""33DDUUffUUfwwffffwD"3""""""""333"DDD3""""""""3DDDUfw333Df""D3""""""""""""DDD"3"""""""33DD""33"""""3"""""""""""""wU""33DD3"""""33"3DDDDUf3"3333DwUD333"3D""33"""""""""""""""""3"U""""3D"""3"""33333DD3D3DUDUUUwfU3D3"""""""""""""3333U3�""""""3ffD"33"""3U""""""33UDUD3""3D33""""""""333DDDUUfUfwwwUD3DD3"3"""""3""3ff3""""D3DUUff33"DDD3""""""""""""""DD33333"3""""""33""""""""""3Uf3"""""""""""Dwf3333"""""""""3"3""D3UfDDf3"""""UUD33333Df""D3""""""""""3"""""""3""""""""""3"33DD3333"D3fUwwfUDUff""""3"""""""""""""3"DD��""""""3Ufw3""""""""3D"3D33ffD33"""33""""""""3333D3DUfUfUUfwUD"DD3D""""""""""3""fDD"""""""""3DDDUww33"DwD"""""""""33""""f"3D33"3333D33"33"""""""""wD3"""""""""UfU"D3""""""""""""33"""3""3UUDDff"3""3fDDD33333̈D""D333"3""""""""""""""""""""3""""""""D333333fwwfUDD3DUUUU3""""""""""""U3""""33f��"""""""""DfD"""3""""3U3"""DDDDDDDD333"""""""3333DDDUUUfUfDUUD33""""33"33"33""33""UU3"""""""33UUfwD"3"3""""""""""""33"""D"3"""""3333"33"""""""""""""3"""""""""""3""33f3U333""""""""33""3D"3DDDUUwwwU3"fwDU3333U̻f3""3DD33"3""""""""""""""3"""""""333333"3fwU33D333D333D3"""""""""U"""""33U"""""""3DDDD""""""3DU3DD"""""33UfffUDUD3"""""3"""333D3DDDUUUUfwwwwU3"""3DD3333DDU3DD""""""""""33UDUwU"""DD"""""""""""3"33"""33333"33333D3D3""""3""3f3"""""""""""""""""DD3D33""""""""""""""""333"33D33fwwwwD3wD3D333DwD""""Uf"""""""""""""""""33""""3"33333333fUD3"""33333DDD"""""""""3""""3"�"""""3fD"""""""DDD3D""""33UUUfwfUD3""""""""""333DDDDDDDUUwU3"""3"3"3"3D33UU3""""""""33DDDfw3""3D"""""""33"""""33""3""D""333"33"U3"""""33""fwD""""""3""""""3"33DD3"33333""""""""""""3"33"""""UDDD"UUw̻UDUfDDD33DUDfD3"""""D""""�"""""""3"3"33""""""33"3"""""3DUD3""""""""""333D""""""""""""""3"3�""""""""3U"3""""33"3UfffUUUUD3�Uf3"""3"""3""""33DDUDDDUUfwwwD"""""""""DD"UUD""""""DD33Dfww3""Df""3333"3"""""""""""3""""33D"""3""""333DDUfUD3""""""""""""""""33333333""""""3""""""""""33"""""333wfDDDDUwݻDUfDDDD3DD3DD33""""""""""����"""3"""""""3"D3"""""""33""""DUUD3"""D3"3"""""3D3""""""""""3"3D�"""""""""33Uf"""D3333UwUDD3"33"UU3333""333DDUDDDUUfwwD"""""3"3""UU"""3""""DDDDDUfwUU3f3DDDUD""333"""""""3"333"""3"D"""""3"ffUUD33"""""""""33"3333D333""""�"""""""""""""3333"""""UfUDUDDf̪wUUf3DD33DD""3"""""""""""3""""""""""""3DDU""""""33"""3UUD3""""""""""""""3DU""""""3""""""""""w݈�""""3"3"D""3DUw"""DDUDDfU3""UD3D"""""33DUUDD3UfwfD3"""""33"""""""3U3DD3DDfw"3UfUUffUUDD3"33333"""""""""""3D""""""ffUDD333""""""""""""33DD"""""3"D3""""""""""""3D333333DfUDUDDww̙wU33DD33"3""3""3UU"""""""""""D3""""""""""3fD"""""""3UUD3""""""""""""""3"D3"""3""""""33""""""""""""""333wU""DUUfUUD3""""""3"""""33D3333fwwwUD3�"D33"""""""""""D3D33D3Dfw"DDwwUD33""333""""""""""""3"""""3ffDDD3"""""""""""""33333D3""""""3""3"3"""""""33333"""3"3DDUfDUwwU3DD33D3"3""""""UD""33"""""""33""""""""""""33U"�""""3UUD33"""""""""""33UfDD""""""""""fݪ""3""""""""Dwf""3UUDU3"""""333333DUwf3"�""""""""""""3D33D33DfwD33wffU3fU3D3"33""""""""""""""""""DUDUUD33""""33"""""""""""""""""""""3""""3"""""33333"3333DDDDUU3UUwU33D""33333""33"""""""33"""333333""""""""""""""33""""3UD3"3"""""""""33DUD"3"3""""""""3D""""""""33"""3"""3DUw33""33""33DDUD"�"""""""""3333DD3DDUw"D"""�wfU33D3"""""""""""""""UfDDD33"""""""3"""""""""""""3"3U"""""""""33""3333D333UU3UUwfU3DDD33DD""33"""""""""3""333DDDDUf3""""""""""""""3fU""""3fD""""""""""3DfwwUDD3""""33"3"""3"""""""33DUUfU3"""""""""""3UUUwwD���"""""""""""""33333D333DDfw""""""""33"3DD333"""""""""33"""DfUDDD3""""""""""""""""3"""33""""3D"33"3""333333""3333UDDDffD3DUDD3DU"3"3""""3""""""3DD3""33UU33"""""""""""""""DD3""""""3UD3"""""""""""3wwf3DDUUD3""""""""UU""33"3"""""""""""""3DDUffU33"""����"""""3DDUffDU""��""""""""""""3D3DDDD33DDUUffw""""""""DD3""3""""""""3"3DUUD333333"""""3"""""""3""""""""3"333""3"333DDDDUDUw33"33DDDD""""""""""D"""""3DDD3"""333D""""""""""""""""DD3""33""""3D33"""""3"""""""UUwDDUUUU"D"D""""""""""""3�""333"""""D""33""3DDUUffDDD333"3""""""�"""""3UUUDUfUU"���""""""""""""3D33DD3333DUUfffwD"""""""DUDD33""3"3"""3DDUDDDD3333"""3"""D3"""""3""3""""3333fUDUDDfD333333DD"""""""""33""""333D33"""333DD"""33""""""""""3333"DU"""fU3"""3UU3""""3""""UUDDff3"333D3DUD"""3""""3""3w"""3"""""""33"3333""""DDDUUUDDfU3333"""""""""��""3UUD33D"""�������""""""""""""DDDDD333"33DUfUUUf"""""3DD3DD3D33""""UUUDD333333""""""3""�"33""""""""33DDffUUUff3"""3DDf3""""""""3""3"""33"""33"""33333"""33"""""""""33DD33D3"Dwf33"333"D"""""""""""D33333333D3""333DD3"""3�"DfwwUww"""""""D3"D333"""""3DfUDUUfU3"""3""""""���""3DDDDU333��������""""""""3UUU3D"3"333UfUUfUff3""""""3"""3"3D333"fDD3D3D3D3333"""""""U3"""""33U"""""""3"3DDUffUUwwDD3""3fwU33"""""3D33"3D"""""3"3333DDD3"""D""3"""3""""33""""3""""fw"""""""�"""333""3DD"33UD3"33D3DU33"""fwfww""""""""33D3"3""3UUUfwwwUD""""""""""���""33333U"3"""�����"""""""""""""3DDD3Uwf3""""""DwUDD3DUUD3""3D3"3"""""""""3"""fU3D3DDDDD33DD3""""""""3fff3"""""""""""""""3333DUUUUDDfwfwDD""U3""DDD"""3D3DUfD""""""D"3U"3UD3""33"33"""3"33D3""33""Uf"""""""""3""""D"DUwf333333"3DDDDwfUUwwfU���""""DU3"333"""DUUfwfD3"""""""3""����""333"33"""�����"""""""""3"""Dfff3""""ffU333"333DD3DfUUUDDD3"""""""3""3f3333333333333"""""DDDDfU""""""""""3U""""""""333"33DDDUDDDwDwfD3""DfD"""DU3DDD3"""3"""""3"333DDDD3""3333333"""3D3"D"""3DD""""3""""""33UUUU333D3"""""3DUUUfDDD3""�"""DfD"D3"""""DUfwwD"""""""33"������"""3DD3"""""�"33""""""3""33fw3"333""""""33DDDDDUUfwwD""""3"""""3f3333D3333D33333""""""""""""""""""""""""3"""D"3"""3DDD3UfUwU33"3D"""""""3""""ff"""""""333"DUU33"""333"""""""3D"""Dw3""""""DD""""""""D3"3DU""D3"""3DUUDDDwD""3f�"""""""""""""3""""""DffwwU3""""""""����"""3D3""""""""""""""""""3"3"3ww3"D3""""3"""33DD"33DDDwU""3D33"""D3D3"Df333DUU33"""""""U"""""""""3"""""333""""33DUUfff3DU3"33""""""""""3DDD3DD3""333"3DD3""""""""33"""""""""3DDDwf3""3""""""33""D"3"3""""3DU3DDwwD"3f�""""""""D3"3"""DDUUwU3""""""""""���"""3""3""�""""""""3U""3"""""3""""333"3333DUUfwfD3D3""33UD3""3DfDDDfwD""""""""""""ff"D3""D""3""3D"3"""DUfwDD3"DU3UD"""""""3U3"""33DDD3333333DD3"3D"3""33"33""""""UU3DU3""""""""""""""""""D3"3UD333fD""33f""""""""Dw3""""""33UU3""""""""""�"""�"""33"""""""��"3""""""""333"3333"""""33DUUUUUU3""3DfUDD3""UwUDDffU3"""""""�UU3"33U"3"3"UUD"�"""3"D""""UwU33"3fDU3""""""""DD"3"""D"3"3333333D3D33D3"""""3"3"""3""33Dw3"""""�"3"""""""3"""333"3UD"3fw3D""3"3f""""""""33""""""333fwD3""""""""""""""�""33""""�"""""""""""""3""3""""""""""333DDDUUf3333UfUfwUDDDDD3DffwU""3"""3U"3"3"3DUU"""""""""""""3"3""""Uf3"3wUUD""""""""""""3"""""""3D333D33DfD333"333""""33"""""3""3"Uf"�""""""""33"33""UDD333"""3w"""""""""3""""""""33"DwU3"""""""""333"�"""""""""�"""""""""""""""""""""""3""""3D3333DDDDDffDffffwfUUUD33Dffwwwf3"""wD""""""3DUUD""""333"3"""""3"""f33fUU"""""""""33""333"""""3UDDDUUUUDD"3333"D"""""333"""3"""DUU"��"""""""""fD3"333DDDw"""""""f"""""33""""3"33"3"3UfD""""""3D333""�U"""""���3"�""""33"""""""""""""""""33333D3DDDDfwffDD3DD3333Uwf3""""wwf"33D"UUUD3"""""3DD""""""""""3UUUwwD"""""""333"333""3""""3fUDfwfD333333"333"""33"DUD""""33U3"""""""""�"""""U33""3"UUD3""""33U""""""""3""""333333""Dfwf3""""""3DDD3""""��"U�"""""""������"33""""3""""""""""""""3333333333DfUUffDD3DDDDUUw333"Uw"""""3""DDDfU"""""""""""3"333DDUwfUwD"3"""""""3"3"3""3"""""3UDDffffDU333"3"3333DD33333"3U3"3D3"""""""""3""""3"3D33""3f""""""33""33333"333"3D"33""""3DUUDD3"�DD""""""""""�������""""""""""""""""""D""333333fDDDD33DDUUDDUfwffU3UUDDDUU3""3""""33D3U333"""""""""3""3"3DUfUwwUD3""3333"33333"3"""""DDUDDUffUDD333333D3333""U3"3""DU3""""""3""""""""3"333"33wf"""""""Df���"""""""""3"33DD33D3""""33D3"3DUffUD3""""�3""33""""""""33""3"�����"3""""""33""""333333"DUD3333D3DDDDD3UUUffUfUffUUUUDUDffUwwD3""33""""3D""DD3D"""""DD333"3DUwwwwfwf333"33DDD33333333""""DDUDUUwwfDDDD3333"3DUUfD3DDUD"""""""""""DD3"""""33DD33D3Df3D33"3Uff""""333DDUD3DD3"""DDD3DDfwwfUD33""""""3""""""3"3D3333D3""��""""""""""""""""""U33"""DDD333333DD3D3DDD3DDfffffUfUDU3DDUffD3UwUUUfUD"DU"""33""D""""""""3D"3"3DUfffUUw33D33333DDD33333"""""""""DDUUUUfwUfDDD33D33UUD3DDUUfUD""""""""U3""""333D3D"33UDUD333D3"""33w"""3"""3333DDfUDDD3"""33333fwwUDDD3"""""""3""3""""""3""""""""���"�"""""""""""""""""""""33"3"""""3D333333333333333DDUfUUDDD3UDDDDUUfDD3DwwwUUUUUDD"U3""""33""3"""""33""DUUUwffw"""3D3"DUUDD33333"33"""""3DDDfwUUUfwwffDUfU3333D3"""""""""""""3"""""""333""33wD3DDDDD3""""33w"""""33"""33D3UfUDU33"""333DDffUDfU33""""""""3""""""""""""""""""""3"""""""""""""""""3333"333333333333UUUDDUUDD3D333DDDUU3DUwUUUDDDUUUDfD33"""3DD"3""""""""33DDUfUffUDww"3""3333DDUUDD333"3"""""""""333wwfUDD33333333"""""""""""""""""""3""3333"DDf"DU"""3"""""33wf"""33333"ffUUUD3"""3"DDfDDfwUDDfUD3"""""""""333""""""""""""""""""""""""""3D""""3D""""3333333333DUUD3DDUUD3333"3DDDUDD33UUDD3DDUDDUDf3D33"3DD3DU""""3DUUDUUUfU""""3DDDDffUDD33D33DD3DDUfffwfUUDDUfDD33""""""""""""""3"""""""""""""3"""3"3Df3"UD3U33""""3UDf"""33333"DfffDD"3fUD"""UwDDUww3333"""""""3333"""3"""""""�"""""""3""""""""""3DU3"""3D3""3""33"""3DUfU333DUUD3333D"333DD3333DUD33DDDDDUUUUUU3""3333UD""""""""3DfUfUD33D"33"""""DDUUUUDDffUUUUUUUfffwfU33D3DDD3333"""""""""""""D""""""DD""D""""""33DDUDDwD"3"""""DU""""333""33UffwfU3""""UU"""33DfUffwfU3"""3""33""3"D3"3""""""""""""33""�""""""3U3"""33""33"33""3UfUUD333DDDDD3333""333DD33"33DDDD33DDDDDUUUfD"""33DDD"""""""3333ffwwffDDww3""3"""333DUfDUfwwU3D333""333DDDD33UD3""""""""""""3"""""3D"""3""""""""DfU3DUwww3"""""UD""""33"""33DDDDwfD"""DD""""""DDwwUwDDfU33"3"""""33"""3"3"3"""""33""""""3""�"""""33""""""""3""3"""333DUwfU3DDD3DDDDD"333333"333333D3DDUD333DDDDD3DUwU""D3"3D3""3""""""""333fwfUDUwwD""""""""3"DwwwfwfUD33333""""33333333D""""""3"""""""""""""3"""3"""""3""3DDwf"""""""3U"""""""""33"""333DUUfUD33"""""""""33wfUwUUfD333333""33"33""""""""""""""""""3D3""""""""�""""333"""""""3"""3"""33"3DwfUD333D3DDDDDD3"33"3"""""33DD3UfU333333DD3DUDDUU3333""DDD"D3"""""""""""DwUD3DUf3""""""""UwfUDDDDD3333333333333333""""""333""""""""3""""""""""""""""""""3Dww3D3"3"""33f"""""3"""""""DDUffUUwU3D3""""""3""wwfUDDDDUDD3"""3""""""""""3""3D""""""�"""""3""""3"""""33"""""3UffDDD33D33DDDDUD3"3"""333""""333"wf3""""3333DUDDDDD3"33"33DDD33"""""""3UfDD3UUfffD""""""UUwUUU33DD3DDD3333""""""3"3"""""3""""""""""""""3"""""""3"""""""""""3DfwfwD""""""33U""""""3""""33DDUfwfwwUDDD"""""""""33fwwwwDUU3UDU333""D��33""3""""""33""""""""33D"""""333""""3UwU3"DD3DD3D33DDUD3333""""3"""""""33D"3""333333D3DDDDDUU3"3"DD3"33U3D""""""3UDU33DUUUD3"""3D"DfD333D3D33"3D""""""3"""""33""""""""""""""""""""""""""""""Dfw"""""D""""DwD""""33"33"3DDUUfwUDfwwfU3D""""""""3333DUfUDwwfD"3"""""�"3D"""""""""""""33"""""""""""3D"""""333333Uwf33"3DDD3DUD33UD33""3"33"3""3""""3333D333333333D33333DfDDD3"DDfU"""3UUD"""""3D333""3UwwUD"""DUD"3UwfffUDDDDD33D33"""""""D3""""""""""""""3""""""""3"""""""""""""333w"""U3"""""""f"""""Uf"""""33"3"DfwU3UwwwfUDD33""""""DD33DUfDUwUwwD33""""""��""3"""3"""""""""""""""3"""3""D3""�""""""3""""DDDfwU33"33DDD333UDDU3""3333333"""33"""""3D33333333333333"""3wUDDD3D3"""""DUDff3"""""3333""3UwD3"""DUUUDDDDDDDDDD33"3"333"""""""333""""""3"""""3""""""""""""333D33Dww"""D3""""""""DfD�""Uf""""3U"3"3UwU""UwfUUDDDD333"DD33D3DUUUUwwww3"33"""""3"""""""""""""""""3"""""""""""""D""""D3333DUfwU"33""3DD3333DDDD3D3"""333""""3"3""""3DD3333"3333333"""""3UD"3UD""""""33DUwwD3""3"""333"""""3Dw333DUUUD333333333"""3""333"""""""""""3"""""""""3""""""""""3D3"33DDfU""""""""""""333fD�""""""""""UD"333ffD3"""UfwwfUUDUUDDDDD3DDUDDUUUffffUUD3""""""33""3""""""""""3"3""""""3"""""""333""""""33DwwUD"33D333DDD33DDDD3""""""3333""33"3"""""33"3""3"3333"3""""""""333"""""3DDfU3"""""""33""""""3UfDDDD3D3"""""3""""""""""3"""""""""3"""""""""""""""D3""""""""33333DU3"""""""""D3wf�"""""""UD33""fw3U3""DDUUwfU3UUDDDD33DUfUDfDfwffwfwUD3""""��""""""""""3""""""3"3U3"""""3""3D3"""""3UwwD"333"33D33D3D3DUD33"""3333333""D"3"""""""""3"333"33"""""""""""""333"""""333DfUUD3"""33333"""""""3DUwwUD"33DD33""""33333333""""""3"""""""""""""UU""33""""""""""""""""3333UD""""""""""3"Uw3""""UUDU3"DfD""""""""3DUfffDDUfUUDDUUf"UffwwwwwwwfD3"3"��"""3"""""""""3D"""3""3D3U"3""3333"""3U3""""""""""DfwU333333333333D3DDD""""3"""33""3""DD"""33""33""33"""33"""""""""""3""333""""33"3DfUD33"3DD"""""333""33DfwwDDD33D33333333UUDUUU333"3333"""""3"""""""Dwf""""""333""""""3DD""""3"""""""DDDU333"""""333U3"fwUU33DfU"""""""3""3fwwwDUUUDDUffffUfwwfwfUUDD3"""""���"""3"""""""3"""3DDUUDDD""3""3"3""3DD"""""""""""""Dww3333333333333333DUD""""33""""""33""D3""""""333"33"33"""3""""""""""""""""""3333DU3"UDDU333""33333D33DDUfffUf"3DDDDDDDDDUffUwUUDDDU3D3"""""""333"""""""""DD"""""""""33""3"""""""""3DUfU3D3"""""""33Uf�"wwwfDfDfU""""""""""DUUfDUUDUUfwfffwfDD3DDDD3"""""��""""3"""""""""33DDD33DD33""3""""3D33""""""""""""""3UwU3333"3333333333DDDD"""""""""""33333""""""""""3"3"33"33""""""""""""33"3"""""33D33DUfUwDD3"""3333DDDD3DDUUfUUDDUUUDUUfDUUfwwUUfDUUDD"D3""D3333""3""3"""""""""""""3""3"3""""""""""""33DUf333"""""3"3Uw""wfDwwwf3Df"""""""""""3ffUUUUffwwUDwU33"3DDD3""""3"""""3""""33"""333""33"""""DUD""D""""3D"""""""""""""""Dff33""3"333333333DDUD""""33""""333""""""""""3""""""3"""3"""""""""33333""""D33333DDDUUfwU""3333DD3333"33DD3DUUUUUfffwwfwDfUwwfU3"3fffDUUD3DDD3U333"333"33""""""""""""""""""""""""""""""""33UfU"""""3""""""33""3fD"DDUwUUU"""""""3"""""UUffDUDUwfffUUD"D333D33""""""""3"D3"""""3""3"3"3"""333U3"D""3D3""""""""""""""3UU3"""""3"33333"""3DDD3"3""""3""""""""""3"""3""""3333"""""""""""333D33"3DDD33"""33DDDDU3"3DD33333"""33DUUD3DfffUUfUUw3DUffDUwwfUUUfUUDDDfUDDDD33DU3"""""3""""3""3""""""""""""""33DUw"""""""""""""3f3D3DD""3Uff"""""""""""3DffUfwfffUffDD"33"3D33"""""��""""333""""""""""3"""""""D3D"3D"""""""""fU3"3"""""""33"3"3"3DD3""""3""""""""""""""""""33333""""""3""""""""DDD33D333""""3U"""""3D""3D33333"""3DUUD3DUfwfUwwfU3UDDUffD""wwwUUUfwwDDD3DUDDDDDDD""""""3""D""""""""""""""""""""3""""3"3Ufw"""""""""""""3DDD""3DUfD"33"3""D"""""3fwUUwUUU3UU3""D"3333""�"""""""D3""333"""3"3""""D""""33D3""""""""""""""3fD""""""""""3""33333U3""""3""""""""""""""""""3D3""3"3""""""""""3DDDD3""3D3DD""""3"33"33"3""""""3DDD3"DUUfwwwUDD"3DDUfU""""3UffwwfDDUUDDUDUD"""""D""""3""3"""""""""""""""""""""""DUD"""3"""""3UD""�DwD3D3"�3wwD333"3"""""DffUUU"3D3""""33"33""""��"""""""DfD33D3"""""3"""""3""fD3DDUD"3""""33"""""""""""3UU""""""""3"33333U3"""3"""""""""""""333333D3333D33""""""""""3DDD333D33"""""""""""333"""""33DDDUfwfD3"""""33"""wwwDDUUUUUfD""""3""""3"""""""""""""3""""""3""3DD""""UU"""""DUUf"f33U3"""U33""3D"""""DwfffD""""""""33"""3""""""""""3UUw3"""3"3""""""""3""DfwD""""33"""""""3Dw""""""3U""""3333U3""""""""""""3D333333"3""333333""""""""�""""""DfDD333"3"""""""""3""""""""3DD3DUUUwU""""""""""fffwfUUfD""""""3"3D3333""3"""""3"D3""""3""""3"Uf""""""""33ff""33"D"""U3"""""D"""UwUUwU""3""33""3""3"""""""3UD3DD3""""3""""3UwffD"""""""""""""3Uf"""""3"""""33DD3""""""""""""""3"""33""""3"3333""3""""""""""""""""3333333"333"D3""""""""""3DD3UfUDfw"DD""""DDDD"""""3DUUwfwffwwf"""""""33D3D33D3"333""33""D""""""""""DwD""""""DUff"fwDDD"""DD"""""3"""3fwwwU"""3""""""""""""33D3DU33"""33"""3DDUD"���""""""""3DUD"""""""""""33DU3"""""3"3""""3""""""3"""3333""3""""""""""""33"""""D3"""DDDUU3""""""""DDDUfwfwfwU"D""""Df3DU3"""D33fwU3""3""""""3DU3DD33"3D3333333""33"3""""""""3DU33""""""3UUDUD33DwU3D3"""""3""""""3"""""Uwwwf"""""3��""""""""""D3"D""3""""""""DDD""""3DfD""""3"""""3""""DU"""""D""""""3""""""3""""D3333"D"""""""""""""""3""3""""3UUDD""""3DwwUwwwD"D3"3UfDD"3D""3""fwwf3"�""""DD333"3D333""""3"3333333""""""""3ff"""""""""""3wU33UUDD3""""""3"""""""""""""3wwUDU""""""""""""""33"3""""""""33D"""""""�"""3DUD""33""""3"3"3D""""""3D"""""3"""""""D""""3""33333"""""""""""""3""""""DUU33D""""""3UwU"UffUUwww""3UUU3"""""3U""""""DwfUD""""""""DDD33"3333"""333333333"""""""""DUUU""""""33DDffUD33"""""""""""""""33"""Uww3"wU""""""""""""""""3"3"""333D3�"""""""��"""33DUU�"33"""""""""33333"""""D33"3"""3"""""""3""333"3""""""3""""""""""3Uf3D"""33Dww3"DUDDUff""Uf""UD"3""""3UfUD3"""""""333DD3""3D3""3333"33"333"""3"""""3UU3D3""�"DDUffU3DDDfD3"""""""""""""""3333""3U33Dw""�3"33""""""3"""""""33DUD��""""""""���""3Uf3"3333"""""""""3DD"""""""""333""3"""""""3"""33""33""""""""""""""""""DD"""33Dfw3"33DwDUUUU3"3w""""""U3"""3UfUD"""""""""""3333""D33"33""33"""3"33""3"3"3"""""""DD3333�"33"DUDDD3"333DU""""3"""""""""""3DD""""""D33"33"""��""""33D3"""""""3"""33DDDD"�"""""""""���"3UfD"33"""""""""""3D3"""""3333"""""""33"""""""3"""""""""33"""""33""""""""""""""DUff""3""DD3"""DfwD""""33"""UwU33""�"3"3"""3DDD"""""3333333"3"""3333"""""""3Uf""333"""3UfUD3"33ww""3"3U""""""""""""""""DfU3"3""3"3wD"""���""3D3""""""3""3"3DDUU3"���"""33""""""���"DfD3"33"""""""""33D"""""""33"""""""""""""""""""3""""""3"""""�"�3""D""""D""""""""DUww3"""3"""""fU3"""""""""Dw3""�""""33"3DUfD3""33"3333333"""3"3"""""""UU3"""""3""3DDDDDD33""3w""3"3U�"""""""""""""""3"DUUU3""""""UUfU"""3"��""3UD"""""3"3D"333DUU3"���"""3DD33""""""3fUD3""""""""D3""""""""""""""""3"""""""3""""3"3"""3D"�"""3333"D""""3DUDfw""""333"""3D333"""""3""DfU""�"""""3333DDDD3"3"3"3D33333""33D33"3"""""""Df33"3wwDU3D33D33D""""3333"33Dff�""""""D""33"""""""3DD""""""3Ufwf""""Df"""3UwU"3"""""3"3"Dff3�����"""333"333""3"""��3f""""D""""""3"33""""""""""""""""3"""""""""""3"3""""""""3fD"""�"33D33""""""3"3DDwwwD"""""3""""""33""""""3"""33wU""�""""33DD33DD""33""33333333"3"""33333""""""DU3""""33"D33D333""3"""33Df"3DDUf�D"""""""""""3"33"3""33UfwfDU""""""fD�""""""""DUD3U3"3UwfUUwwU3"���""3333"33DD33"��3D"333""""333UUD""""""""""""""""""""""""""""3"3""33"""""3D3"""3D333"""""33""333UU3"""""""""3""3"""33"""UU3""""33""DDDDDD3"""""3""3DD33"3""3D3333""""""DU"""""3"""33D33"""""3D3Df33DDU�"3""""""D3"""33333"""33U33D"3""3D���"33""""""DDDDUfDUfwwDDDD3�����""""33"3UU3"���33"3D3""""33DD"""""""""""""""""""""""""""3"33""3""""""""3"""""""3D3"33""""3""333DwwD"""""""""3333"""""""""3U3"""""""33""D3"333D""""""""333"""3"D3DD333""""""""33"""""""""""3333""""""333"U"33D�D""""""33DD33"33"""3"3"""""""""""""""33""""3D333DUUDfwDff""33""333333D3""�"D"""DU3"""""""33D33""""""""""""""""""""""""""""3"3"3""""3""""""""33"""""""""3DD3"3""333""333DUU3"""3U33""""""""3UD3""""""333333333"3DD""""""""D333DDD3DDDD33""""""""33D"""""""""""D3"3"""""""DD33"3D33"3"""33DDD3"333"""""""""""""""""""""""3D3""""333DDUfffwf3"DD33333�"�"3""33333D3"""""3D"�"DDD3"""""""3"33D3""3"""""""""""""""""""3"""3"3"33"""""""""3""3"""""""33DD33"""33"""3DDUwf3"""""3D"33"""""UU3"""""""""""""33D33333DD""""""33333DDDDD333"""""""""""3D"""""""""""""""3D""""3""3DDf�"""""""""3"DD3""3"""""""""333"""""33"""""""""""""3DDDDUUwf3"""""33""333333""""""""333D"D33"""""""""333DDD3""""""33""""""""3"33"""""""3"""""3"""""�""33UD3""3333""3DDUff"""3D33""""DDD"""""""D333"33DD33""DD"""""333DDD3D3DD33""""3"3"""""3D"""""""""3U"""D33"w3w"�"""""""""""3""""""""""""333""3""3"3"""""3"D""3DD3DDUff"""""""3��""333"""""""""""3DD"DD3""33"""""""33DDD""""""3"""""""""D""""""""33""""""""""""""""""D3DDD333333333DDfwwf3"""DD3""""3UD""""""""""""""3"""""""""333""""3"3DUUDD3DDDDD3""3"""33333D""""""""33"3D3UfwffU"""3""333"""""""""""3"""33""�"""""3D""333"DD33UD3DUfU3"""""3"""""""""""""""""""""3DffDD""""""""""33"DDDD"""""""""""3"""""3"""""""3""""""""""""�""DDD33333"333DDDDwf""""33D"""""3D""""""""""3"""""""""""3""""""DUD3""3D33D333"33""3333D""""""""""D"3DDUf"Df�"""3""""33"3"""""3"33"""""""""""""""""""3U""""333"D3DU33DUfD""""""""""""""""""3DwD"3"""""3"""""""3"333DDDD""""""""""""""""""""""""33"""""""33""""""""""DDD3333333"3DDDDf3"��"33D"""""D""DD""""""""""""""""""3""""DU3"""3333333""3333D3DD""""""""3"DD3UDDffDDww33""�"3""333"""""""""""""""""""""""33DD"33"3""3"UUD3Dff333""""""3"""3"""""DD3"""""""3"""""3""""""33"33DDU3"""""""""""""3"""""3"33"3"""""""""""�""""33DDD333""333DDDDf""�"333""""33""33"""""""""""""""""""3333"3""33""3333D333D3"333"""""""""3fDDDDUUwfw"DD"""33"3333"3333"""""""""""""""""""""""3"DUDD"333DfD""DUwfD33"""""""3""""""""3"""3f3"""""""""""""""""""3DDDDD""""""""""""""""""""3""""3"""""""""""""33�"""3DDD33""""333DUUff3""""�"3D""3""""""""""""""""""""""""""3D33""""""""333333333DD"33""""""""DU3DDUfwff333"""""3"""3DD"D3""""D3""""""""""""""3""""DfUU3""3D3f33fwUD"""""3"3""�"3"""""DwUD"""""3"""""""D3"3"333U3"""""""""""""""""3"""""""3"""""3""D"""""3U3DDD3""""33DDUUffU3"""""""""3D"""D""""""""""""""""""""""""""33"3""33333"333D3333D"3333"""""333fU33DDffwD33""""""33"""33D""""3D"""""""""""""�"""3""D3fUwU333UDDDDwf3""3"""""D"3"U""�""""DwUwU"""""""""""D"""""3""3DDUf"""""""""""""""""3""""""""3"""�""3""333D33DD3""""33DDUUffUD""3""""""�"""""""D"""""""3""3""""""""""""33"""""333"333D33DD3DD3"3"""""3""3fwUUUUfUUU333""""""333DDD""3"""""""""""""3D"""""ffUUDfD"DUwUDD3"""D3"3D3"D33"3DUD3ff3""""""""""""3""3UDUD3"""""""""""""""""""""""""""""""""3""""3D33""""33DDfffff"""33""""3"3UU3"D3"""""3333333"""""3"""33"333"""3""333"D3D333D3333"""""""3"""fDUffwffwD33"""""""""DDUD3"DD3"""""""""""""""3D""""UfUU33UDUfwU3DDD3""D3"3D3DU""""""�""Uf3""DwUD""""""3"""""3DDUU"""""""""""""""""""""""""""""""""""""""3"3D3333DD3"""3333Uww3""333"""""""""33f"""3D"""3D3"3333""""""""""3""3"333""3""333333333""""33"""""""UUUUUUwUw3D3"""""""""D3DwU"3"""""""""""""33"""""3DD"""3UD"""fffwfUUfwD3333""""3D333DU3""��""3U3""3DfwU""""""""""""""3"DfwD""""""""""""""""""""3""""""""�""""""""""""""3"""""33D33"333DDffUwwU3""3D"""""3"""""Dfw""3U""�"""333D3D3"""""33""""3""""3""333""333""3333"33D33"""""""3DDUUUfwUf"33"""3"3D33"3DUfwD""""""""""""""""""""""3DU""3333"333fwfUfDDUUD333""3"333DDDD""""""DfU"""3wf3""""""""""UfwfUfD""""""""""""""""""""""""3D3""""""""""""""DDD33DDUDUfU3DwD"""333""""""""3U3""fU""""""333"33"""""DUU3"""""3"""""""3D3""333""333333"3"3""""""UfDDDUfUff""3D3"""""3D333DUfff"3"""""""""""""""""""""DD3""3UffUUUUUUUDD3333""3""3D33"""""��"""3fw3"3Uw"""""""""""UwffwwwwD"""""""""""""""""3""""""�""""""""""""""3DD3DDUfUfwf33fw3""""""3"""""""""""""U""""333"""""33""""DD33D"3333""""3""""""""3333"3333""3D3"""3wUDDUUUfwf"""3"""""DD33DUUwfU3""""""""3""""""""""""333""3fwwwfwU3DDDUD3""D33Uwf""D3"33""""""U3""3fD"""3"fwfwwfD"""""""""""""""""33""""""�""""""""""""""""""33DUUUDfUUfffDUw3"""""333"""3""""""33D""3"33""""""""333""""3D33"33"""3"""""""3333"""3""333D"""""""�3wDDDUUUfwD"3""""""""DDDUff̪33""�""��""""""""""""D""3""DfwfUfw33fUD3"DDU3DwwUfD�"UU33""""""""UfD""Df""""""3Uffww3""""3"""""""""""""�"""""""""""3""""""3"DUUfUUwUDDfwwwU"""""33""""�""""""""33U3""""3""""""3"33""333333333""""""""3D3"""3"3333D3"""3"""wUDDDUDf3"""3DDUfw̻3"D̻f3D""""""""DU33UfwwU33ffU3DD333"3UD3wfwfUfww""""�""""""Dww3"�"3UfD""""33fwwfU"""""""""""""3""""""""""""""33"""""""3DUDffwwfUDDwfUD"""""""""""��"3""""33U""""""333333"""""""33333""""""3DD33"""3""3333"3"""""""""""""""33DUDD̈"""""33DUUf̙UU3Uݻw""""fffUD33UwU33UwfUwfUDD3333U3wwwfUfUffwwDDf""""3UwU"�"�"3Uw3�"""""3"UfwfD3""""""""D333""""""""""""""""""""3""""""""3DDDUUUfU3UwDDfD"""""3""""�""33"""3D"""""3D3""""3""3""333"3""""""33DDD""""333333"""3"""""""""3"�3333DDUݪU�""""""""333DfݻUẅUffwfffffUUUDU3"3DwUf3DDDDfwwwD33333DfwfUUUDDfffwUfUD3DDfw33"3fUD""""""3DU"�"""""3DUDU3"""""""3333"""""""""""""""""""""""3""""""3DUDDfDDfwD"UfDff33""""""""3""""3U"""""""""33""""3""""""33""""3333""""""33D3""""3"""""""""�ff3333DwD�"3"""""""""3f̻̻̈wDD33UUUffw̙UDwf"3D33D33UfDDDffffUfUDDDfffUUUUUfwDUwwDfU3"DUfD33"3""""3"�""""DDDU33""""""""""""""""""""""""""""""3"""333UUUDDU3DUUDDDDDUU""""""""3""3"3"""""D3""""3""""""""""""""33""33"DD3""""""""""""""3w3""33Uf�"""33"""""""3f̪wUDUD3"33D3DUD3D̻DUD3D3UUwwfffwUUfUDDD3DUDUD3D3D3"3"Uffwwf3fUUU3""3"333D333""""""""""""""""""""""""""3D3"3DDDDUDUUDDDDD33DDf3""""""""""33""3"""3"3"""3""""33""""""""""""""33D3"33""3""""""""""""�"wU33""3w3�""""""3""""DDݻUUfD3""3DD3"333U3"UD3fwwwwfwwwwwD"""3"3U3333DwUUUUD33333DD"3"""""""3"3UUfwffU""""""�3DUDUU3"""""""""""""""""""""""""333"33DDDDDUfUDDDDfUDDUf3"3""""3""�""""D"�""""""3""""""3""""D3"""""""3""""3D3""3"""""3"""""3""""�DD333"U3""""""""33"""""3UݪwfwD3""333333"3"3UfUwUUfUDD3DDUDD3DDUDDDD3"""""""3"3DDDUUUDDD3"""33""3"""""33""33"DDUUUDUfwwwfUfffU���"3D3Uw3"3""""""""""""""""�""3"3"33DD3D3DDUUUDDDD333fU"""""""3""""3U3"�""""""333"""""""333"""""""3U""33D3"33""""""""3"""D3D3"fU333"DU"""""""33""3""33fw3""333""3D3"3DUDUUUUUD""3333D3"""""3""""""""""3333DUfU3D3"""""33""""""33"""""""3DD33333DUDDUUwwf33""3DDDDD"�""""""""33"""""""""""""""3333DD33DDDUUDUDD"33Uw""""""""DD�"""3"3"33""""33""""""""3333"""""""3""333"""3"""""D3""3f3""""fw""""3""""3333UwwfUDD"""3""3""33""""D3D3DDD3""""""""""""""""""""""33""Uf33""""""""""""""3""""""""3333333"3DUDDDfwf���"""DDDDD""""�"""�""33333"""""""""333"333"33DUUUUDDD333DD""""""""""33"�""""D""""""D"""""3D"""33DUD333D3"333"33"""""""""""DU3"3"3w""""""""""""""333w݈w""3"D3""333""D33""""3DD33"""""""""3"""""""33"D3""""""""""""""""""""""D""""33"3"33DDDDD3UD""3UDffUf3""3""333"33""""""3""""""""33333DDU3DDUD3DD""""""""""3D"""D""33"33333"""""""3DD33"""""""3"3D""33""""""""3"ff3"3""w3""""""""33""3""333Df3"""3D33DU333DD""""D33"""3""""""3"333"""""3""""""""""""D""""�3D"33UDD3U"�"3333DUf3"""""�""""""""33"333""""""""""""""""""33"33UD3DUDD333""""""��"""""3"3�"""""""333333"""""""""3D3""3"""33"""""""33"""33"3"33D"3"Uw""3""""""""""""""""""3ff3DD3"""3D333""3"3""""""""""�"""3""""""3""""""""""""""""""""33"3""3""3333Dw""D""33"3UU33""�"""""""""33333""""""""""""""""""33""""3D3DDDD333DD""""""""D3��"""""""""3D3"""3""""""""3""""""""""3D"""""3"""""3""3"f3"""D""""""""""33"""""3UU3"3"33""D3"3""""""D"""""""""""33""""""""""""""""""""""""33"3ff3""""""""DffD3""""""""""D333"""""""""""""""""""33""33DDUD3D333"D3"�"3"""""Dw�""""""3D""""D""33"""""""""3"3"333DUD3""33""3"""""3wf""fU""""""""3""3"""3""3f3""""""""3"""3"""""""""""""333""""""3""""""""""3"""""""33"3DUf3"��3U""""""""DwD""""""�"�""""3DD333"""""""33"3"3"""""""""333333DUfUDDD3"333""�3""3DD"""""3"3"""""33"""""""""""""33D33DD3""""""""""""3f3"wU33D3""""""""""3Dݙf3""""""3""""""""""""""""UfU33"""""""""""""""3�""""3"3DffwDUUD3�w""""""""3DwD"""""3"�""3UUD3D"3""""""3""""""""""33333DUUffUDDf3"DD3"""��"3"""""DD3�""""33""33""33""""""""""3"""DD33""""""""""""ww3ff3""3D3"""""""D̻3"""""""3""""""33""3"DfUUD3""""""""""""�""3""DDUUfUffwwUw""""""""33UwD"33"""""�"3DD3fUD3U""""3"""3"""""333333DDDDDUfwfU33D"DUD"""�"�"33"""33DDD""""""3333"""3"""""""""""""""333DD3"""""3""33"UD"Uf3"""""""""""""3"""w"""""""""""""3UUU"""�""UDUUUUUD3"""""""""3"3""�""""3DUD33DUUD""""""3DwUDD"""""""""""D3DUD33D3""""3""3"""""""""""3333DDDDDUUUUwfD3DD3UD"""""""""""""3DDDD""""""""3""""""""""""""""333333"""""3"""333f�3ww3"""""""""""""""""3Uw3""""3"""""3DD""�""wfUUDDUD3"""""""�""3D3DDDUwwUDUUD3"D33f"3""""""""""""3DUUDUD333"3""""3"""3D"""""""3"333DDUUDUDUUfwU3DU"UD"""""3333""""33"""""""""33"""""""""""""33333"""""""""""""3ww"f3"""""D3Dw3""""""""3333"�""""""wwUUDD3DD3"""""""3"""�"""""333DDUfffwfDUfUDUwfUD3""D3"""""""""""DDUD3D333333"""D""""""""""""3""3DDDDDUDfUDUUwf33UD3U3"3D33"33""�""""""33"3"""""""3"3"3"""""""""33Dwf"3f"""""""""D"""33�"""""UD3"3"""""UwDUU3DDD3"""""""""""""""33"3"""""""""33DDUUUDUD3333DDDUUfU3"""""""33DDD3333"3333""3D"""""""""333333DDDDUUDDUfwwUDDDUDD3""""""3"""""3"""""""""3"3""""""""3""3D"33""""3Dww3�"ww""3""""""""33"""3"""""3DDD33���"3""3UU3DfD33D33""""""""""""""""""""3DDUDUUDDDDDDDDUUfUDfD3""""�"""UfUD33""3"""33""""3D""""""""""""33333DDDUUUD3DwwUUDUD33D""""""""""""""3"""�""33""33""""""""3"33""""""""""""""3DDU"U""3"D""""""""""DU""3"33""""3DD3""�"DUfU33UD33"33"""""""""""3"""""""""33DDDDDDDDDDUUUUfUUwD""""""""""�""""DwfUUfU"D"""3D""""DD""""""33333DDUDUDUDUfUUwfDUD3DU""""""""""""""3"""""3"""3""""33"33""""3""""""3DDfw"U3"""""""""""""""""�"wD""""3""UUD3"""""""3UUU33D3""""3"""""""""3""""""""""3DDDD3DDD33DUDUfUfw3""""""""fwUUD3DfD3DD"33""""DD"""""""33"3"3333DDDDUUfUUUUffwUUD33DD""""""""""""""""""""3"""""""""""""""33""33"""3"33"""33DwfD""""""""""""""""�"̻D""""""""""DD3""""""""""3UUUD3DD3"""""""""""3"33DDD3�"��""""""33333DD33DDDDUUfD""""""""fwwfUDD""33"DD33""""DD"""""""33333333333DDDDfUDUUUfffDD333D3""""""""""""""3�"""""3""""3333"333""""D3"""""""""Dw̪U"""�"""""""""""�"ݻD"3"""""""�""3"""��3"3"3ffUfUD3DD3D3"3"""33"""""3""3""�""3"333D333DUUUfUf"""""""��""wwfUUU33""""3DUDD333"""""""""33"3333333D33DDD33DDUUfffDD""D""""""""""""""""""�"3�"""""""""""33""""""""""3""3"""""""""""Dw3""""""3"""��3""""""3""3"""3"3""�""fwD3UffUwfU333"33"33D333"""""�""33333D33"DUUUUDD"""""""""""wffDUDD3""""""""3DD3"""""""""""""""""""333DD3DD"U3333DUUUfD3"3"""""""""""""""�""D"""""""3D33"""""""""""3""3333UݙD"""""""""""""""�Dݪ"""""33"""""""�""wwwwwfUffD333"""3333D3""""""�""3"33D333DDfUDwDD""""""""�"3wwfUUDD33""""""""3"""""3"""""""""""3"3333333DDDD"3"33DDUwwU3333""""""""""3""""""""""""�"3"""""""3D333""""""3"""""3333wݻf""""""""""""""""�"w̪3""33""3""fwwwffUDDD3""3"3"3DDD3""""""�""������"3333D333DUfDwU"""""3wffUUDD33333""""""3""""3"""""""""3""""333333DDDDDDD3D"33DDfww"33D"""""""""3"""""""""�""""""333""""""""""""""""""""""33w̻U""""3""""""""""""""""̻3"""33""D3"""�3wwfUD"3"""""33DUfDD"""""""""������""33333DDDfDUDD3"""""""wfUDDDD33""""3"3"""""""""33"""""33"3"333DDDD33D3U3333DUDUDUDf"""""3"""""""""""""""�""""""3""""""""""""""""""""""33""333wD"""""33""""""""""3"�f̻UU3"33""3DD33""""�"""""UwfUD33"""""333D3fU3"""""""���������""3333D3DUfwff33"""""""3""""�DfwUDD33"333""""""""""""""""33DD33D333""3333D3DD33333"33UDUUUDfD"""""""3""""""3U"""""""""""333""""""""""""""""""3""3"D3U3""""""3""""""""""""""DwfUfU"33UD3DD""""""""UwwffUD3""33""333UU3"""""������""""3333D3Dwwwf3""""""3""""""""""""�3UfwfDD33""33""""""""""""""""""""""3"3DD3D3""333333D33"33"33DUUUUUUf"""""""3U"""3""""33"""""""""""""""333""""""""""""""3""""""3DU̪3""""33""""""""""""""""""""DwfwD33"DDD3""""""""3wwwfUUU3""""""3""3333DD""""""""�������""3333DDDUUwf"""33""33"""""3D"�3wfUfD3DD333""""""3"""""""""""""""333333333333333333"3"333DDDDUwDfD""""""""""""D""3"""333""""""""33333"""""""""""""333"""""""U""3""33""""""""""""""""""""3fݪUDU3"""33DfD"""""""""""DwfUD3""""""""""3"333"""""""3"""�������������""DD3DDDUDUfU""3D3""""""""3"""UwffffDUfUD3D3""""33"""3""""""""""""""3D333DD333333333D3333DDDDDUfwf"""""""""""""""""3""�""3D"""""""""""3""""""""""""""33"""""33DD""""""""""""""""""""""""""Uݪ3D""""3DUD"""""""""""3DwUUD3333""3"""""33D"""3""""3""3""""�������"""D33DUDDUDUfU3"""""D3""""""""""3DwwwwwwfUU3D333""""33""""""""""""""""""333DDD3333333333DUDD333DDDUfwf"""""""""""D3""""3D33"33"""""3"""""""""""""3"""""""""3fݻ3"""33""3""3""""""""33""""""""f̙3"""3333"�"""""�"3"wffUDD333333D3""3DD3D3""""""3"""""���"�""""333DUUUDfw""""""3""3""""33""3UfwwwwwffDD3"3"33333""""""""""""""""33""3333333DDD3DDDU3""3DDfUUfwwD3"""""""""333"""""""3"3""""""""""""""""""""""""""Dfw݈"3"""""333"""""3"""33"3"""3"3wݻD"D"""D"""""�""wwwfUDDDDD33DDDDDDUUDDD"""""""""""3""""�"""3DDDDUUffw3"""33"""""""""3UwDfwfUUUD33333333""""""""""""""""""333"""D33"33333DDDU""""DDUUfwwfwwwU"""""""3DD3"3""3"""���"D3""3""3""""""""""""3""""""""3̻w3"33"33""""3"""33"3"""""""3DDDwwD3D""""3D3""""""�"""3wfwfUUfDD333DDDDDD3DUD""""""""""""D3""�""�333DDUUUUw3"""33D3"""""""3ffffwwffUDDD33333D3"""""""""""""3"""""33""""333333"3U33""""3D3DffffwwwwwU"""""""""UU3""""""""�D33""3"""""""3"""""""""""""D̪U""33"3333""3D""D""3"3DDU33UfUDUwf̻fDffDDU"""333"�""""""�""""""""UwffwwUDDDUUDDD33D3DD333"""D""3D3"""�"��"33D3UU3Uwf""""33DUD"""""DfUwwwwwwwffUUUUDDD333"""""""""""""""""""""""""3"3""33"333""""3"333DUfffffUffU""""""""DD33"""""""���""""""""""""""3"33""""33U333"""""33"3"""""3"333"fwDUffff̻UffwfDD""""3D3""""""""""3"3""UwwwwUffwwUDUUUUUU3DDDUDD33333333U3""U3"���"3DUDfUfDfU3""""33DUU"""UwwwwfwffwffUUDDDDD33D3"""""""""""""""""""""""3""""333"3""""3"""33UUUUUwf3Uwf3""""""""3333"3""""��"33"""""""""33"""33""Dfff""""""""3333"""""33333fwfUUDUUUUfwU3"""""3"3"""""""""UwwwD""3fwfffUfUDDDDUUUD33333"""D3"3""""""""���"""3UDUfD3UD""""33DDD""DfwwfffUUUUDDD3DD3333""""""""""3"""""3"""""""""""""""""""33"""""33"333DDUUfDDDDDUD""""""3333""""3333""""���"""3"3"""D33""3UU3DUwffw""333""333333""""""""wwwUfUD333UUwww̙wfU"3"""""""""""UwwUUD""3fwfwfUffUUDDDD3D3""D3""33"""3""��""3DUUDfw3333""""""33"DwwwwwwwfUDDDDDD3D33f3333333""""""""""3"""""333333D3"""""33D3""""""""3DDUfUDDD3DfD"""D3"3"333""33333D3"""���"�DU"33333333"""3DUUݻf"""3D33333333333"3""3DfwwfD333333DUw̙wfD3"""33"""""""""3fwD3""33"UwffffwwfUfUD33DD"3DDDD""""""3"""������"3333D33w"""3""""DwwwwfwUUDDDDD33"3DfD333D33"""""""""""""""3"333"33333D33"3""""""""""33DDUUDDU3D3fUD""3333""""""33"3"33"""""fD3""3"3"""""3ݻ3""DD3"3"33"3""""DfUwffUD"3333333D̙f3""3"�"""""""""""""�"UwUD3"3UffffffwfUUUD33DU33"UD3""3"""D"""""""�"�""3333DD33D"3"""D"DwwwwwfUDDDDD33"3DDDDUDD333""""""""""""""3"3"""33"""""""""""""""""33DDDDUUUDDD33UfU""3U""""33"3333""""""����"""UU33""""""Dff̙wwDDw33""""3"w"3UfwwwDUUUD"3333"3"D̙3"""""""""""""""�"""UffUD"3UffffUffUUffU3DDUDDDUD3"""333""""""""""333DUf"""""3fwfUwUDDDDDD3"D33"333D3333"""""""""333""""""""""3""""""""333""""""33333UUDUUDDD33DDD""33"3""D3"""""""""���������"""""Uf""""3fUfw̻UUUwUDf33Ufw"fwwfUUD3UDUU3"D333333U̪D"""""""""""3"""""""3U3fUD"3UUUffUUUUfUDDDUUDD333D""""""33"""""""�""""""""3333DU"""3""""fwfUUUDDDDD33333333333333""""""""3""D""""""""""""""""""""""3"""""333DUUUDUDDDDD33DU3""D333333"""""""""�����""""""fwDwݙwUUUffwfwwwUfUUDUD3""DDDD3D3"""33Dw̪w3""""""""""3""3DDUUDDD3UfDUD"UUUUUUfD333DD""""3"""3"""""""""�"""""""3DDU333""DwwwUfwwwfUUUfDDDD3""333"""33"3"""""""""""""""""""""""""""""""""""333"""33"DUUDDDUUDD3DDD3DfU"UU"""""""""""""���""""""""""��DwwffUffwf3UfUUffffUUUDD333"""33DD3D33""333̻wU"�""""""3"""""""""��"UDD"UUDfD3"33""UfUUUD3"3D3D"""""33""""""""""""""""""""3"""""D3DUUf3"""DwwfDUD3DfffwUUUUUD333""333""""3""""""""""""""""""""""""""""""333""""D33"""3333DUDUDD3UUUDDDU333D3"33"""""""�""""""""3"�www̻ݙݻݪffUUDDfw"fffDDUfU3DUDD3D3""""""3"DD3DD""""3ff3"�""D3"""DD""""""""""UfD"3Ufff"3"��"UfUUD""3D33"""333"""""""""""""""""""""3""""""33DUf3"3""DfwfUD33UffUDDDUUUD333""33"""""""""""3""""""""""""""""""""""333""33D3""""""3DDDDDDDUUUfUUUUD"D"3""""""""""""""""""""""""3"�Dwf̻ݪwfUDDD33UfwUDDDfD333DD3"""""""""3U333D3""""3f"�"""DD""DU"""""�""�"�DfUDDDDfw33""Ufwwf""DU""""""33333""""""33"""33"3""�""""""""""""""DUfD""""3""""3UwfffwwUDDDDUUD33"""3"3""""""""""""""""""""""""""""33"""3"3333"333""""""3333DUDUDDUUUUUUfD3UD"""3"""""3""3""��""3"""""""""DU̙fffD3333DD3DfwfUDUD3333""""""3""DU"3D3""""Dw""3U33D""""""���3fUUfD3DUwwD�"DUwwwU"3DD"""3"D33333"""333333333""""""3"""""3""""UwU3"3"D"3"333DfwwUUUDDD333""33""""""""""3"""""""""""""""""33"33""3"""3D333"""""""3"33DDUUUUUDUUffwwUwU"""""D""3UD""D""""DfUUwݪUD33D3"""""3DUUDfUUU3DD"""""""""DDw333""3UwfUU�33DDDU3""""""�"��"3fUf3UD33Dwf"UD3DUU33U3"""D3D3DD333"""33D333333"3""""""""""""3"""""""3UwDDD333""DfwwfUDD33333"33"""""""""""""""""""3"""333""""""33""33333D"3"""""""""3333DDDUUUUUUffwD""""""333DD��"""""""""DD3"w̻fD3""""""""""3DDDfwffDDD33"""""�"DwwwwwwD"DUDD333wwwfwU"�""3DfU3"""""��""�3DffDDD3""3Uw"""333""3333UD33DDUDDff3"333"""3DUD33333""""""""""""D"""""33"3""DUffD333"fwwẅD33333333"33""""""""""3""""""DU3"33DD3"""3333""3""3DD3""""33"""""333DDUffUUUUfUf"""""""33""�"""33D""D̙3"""33"fwUUUUD333""""3"3fwffUUUDDwwUDDUwffffwfD���"3�"3DD333"""""""��"3wUwUDD"""Dw3�""3"3"""DDDD3Uwwf3333D33""DDD3"33"3"""""""""""""3"""3""""3""""33fwwD"""""ffffwwD"333333"3""""""""""""""33"33"3D3""""DD33333333D3D""""""""""""D33DUUUUUfUfwfU"""""""""�������""33""UݻU"�"""DD3DDUUDDDDDDDDDDDDDUD33DD3D3""33DwUD3w���"""3D3"""""3"""""�"""UwwfUD3""DD"3333DUwwffU"""33333D3"33""""""""3""""""""""""33"33"""3UD333"""""DwffffD"333333"""""""""""""""""33D333"3333"""""33333"3""""""""33333DDDUUUUfffwfUwf"""""""�������"""""f̙f""""D3"33UwU33"""""33D33""3"""""""3DUw33fD"��"""3"""""3""""""""""�"""UwwU3"""D"�"33DUffffwDUD3"33333""D33""""""""3""""""""33"33""3""Uw333333""wfDD3ffD33"3""3"""""""""""""""""333333D3"33""""""333"""""""333"3DDDDDDUUUUffffDwU"D"""""""""������3UU̪UD"������"D""D333""3"""""""""""""""3Dwfw"�""""""""""""""33D3"""""ffU3"""""���""""3D"DD3""""3DUDD"3D333""D"""""""""""""3"""""3333333"""33fD33D"""""""UfDDDfUD"""""""""""3"""""""3U3333333""33333"33""""""""33""3DD3DD3DDUDDUfwf33""""""""""""����"Uw̙wD""3"""����������33DD"""""""""""""33Dww3���"""""""""""3333""3"""DfD"""""�"""""""""3D3D33D33"""33""""""3""""""33""""33333"33"3Uwf"""""D"ffDDDwD""""""""""""""""3D""""""3"3"333333333333333"""""""3"3"3DDDD3DDDUDD3UwwUD"""""""""�������"""f33""""������""DDD""""""""""DUUUw�����""""""""""""""""""""33DfD""""""33""3"DUU3D33"333"""""""""3""""""33""""333"3D333DUU""UDwfDUf3"""""3""3"�"""""333333D3DD333333333"""""333333DD3D3333DDDDDUffUw""""""""33"��"w̻wwfff3"""""���"333"""""""""33DUf����"""""""""""""""3U33""""""�"""3""3UfDUD3""333"3"""""3""""333"""""333DU3"DD3Df3"""UwfUff3""""""33D3�"""""""""3DUDD33"333"D3""333333UDDD33333DDDDDUUf"""33"""3"����""D̪wffwUD"""""""3"���""""""�""""""3""""33f"�����""""""""""""""""""DUD"""""33""""""Uff333DDU33""""""""3"""""333"""""3D3D33DD3DfU33"DUwwwwffw3"""""""3D"3"��""""""""""""""DUDD"33"3"33"33""3DDD3333333DDUfffUfw""3"3""""����DwwwUfDDU3"""""""�""�"""""""""""D"DDD�������"""""3""""3"""""""3UD3"""""""3U""""""""UUD33DUU33"""""""""""33""3333D333DDDUUfDDD"3wfU"fD"""""3"3""""""���""""""""""""""""3UD333"3"33"333"3UUD333333DD33UwUfwf"""33"""3"���"UwfwUUwUD"3DD3""""""""""""""""3""""""""3"""""3Uw3����""""3""""""""3UUD3"""""""""U"""""""3"UUUDDDDUD3"""3"3""""""""""3"""33333D33D33DDUDD3"3""wfUUUDD3w""""""""33"3"""""3�����""""""""33""""""3DDD333"33333333UUDD33D333D33DwUffww"""""3D""""""""��"DfDDD3Dff3""33"333""""""""""""""""3D33"33""""""DwD�����"""""""3D"""""""""3UD""""3"3""""""""33"3"3UD3""D333""""33""""""""""""333"""333333DUDDDUUDUfD"UwfUUUDDD3f""""""""""333"""3U3��"""""""""""""3DD333""3"33333DUDDDD3D333D333UDfwD33""3""""3ww33D3DwU3"3""""""3""""""""""""""""""""3"D33"""3""""UD����""""""UUf3"""""3f3"33""""3""�"""""""3"""3�"U3""3ffD3""""""3"3"""""3D"3""""33333DUDwfUU33ffUUUDDDDDD""3"""""33""3""""DU""""""""""3""""""""""3D3"333"3D3333DUUDD3D333"3333DDUww"""33"""""""3Dw"""3DUfD""3""""""""""""3"""""3""3""3""33DD3"DD""D""3D3��""Df3""""""""D""""3""""""""3"""3"DwwD33""""3"""3""""DD""""""""D3D33DwwwDffUUfUUDUDD3DU"""3"333"""3"3D""3""DD3"""3""""""""""""""""3"3D333"DD33D3DDUUUD333D33D33"UDUffU3""""3"""""""D3""DUUU3"33""333""""""""""""3""""3""""3"3"3333DD333D3""""����"""""""""""""3"33""""D3"""""""""3"""3ww3""3""""""3""""33""""3"""DD3DDUDDU3DUUDUUDD33ff""""333""""3"3""333fff""��"""""""""""""""""""33"UDD3333DDDD3DUUUUD3DDD3""""UUUUf3D"""""""""U"""3fUDDD333""3U3"""3"""""""""""""D33"""""33"33333D33"3""""33���"""""""""""""�""3""""3"U3""""""""""""""""""3DDf3"3""33UwwU3"""33D"""33"""3"""""""3DDDDDDfUDUDUUUDfUDD"3U3"""3D"""3"""""3333D33""""�""""""""""""""""D""D33333DDDUfwfUUffDUD3""3"3DwUwf""""""""""""""3DU3"""DfDUUD3"""""""""""""""""""""""""""""3DDD33"""""""""3""33"""""""D"��""""""""""���"""""""3U""""""""""""""3333fwffUffDDUUfffwD33""""3333""""333""3"3333DDD3Dfff3fUUUfwwfU3UffD3D3U3""3"""3"3D33"""3""""�""""3""""""""3333DDUDffUUfwfUD""""DDUfUw""""""3""""""33"D3"DUfUDDD3"3""""""""""""""""""""""3""""33DDUDDUUD333"3""""""33""""33�"""""""3"""""33""""3"""��"""""""""""3DUUf3""3UD33DUD"3333""33"3"""3333"""33333D"DUUffUwfffwwfDDUwwwf3DDDD"""""3"3333"""33""�""""""""""""""3"33UUDfwfUDUwwfUD3""3DUffww""""""""DU3fD33wfUD""""""D3"3""""""""""""""""""333333"""33DUUUU3DDUDDD3"3"3""""""3"3"��""""""""""3333""DD""3"3U"""""""""""33DDUwUD""""""D3""33"3"33""333"3""3333333333333DDDUUf3"UwwwffwwwwfffwwUDDUU""""3"""33"3333""""��""""""""""""""DDDDffUUUDwwwwfUD3"3DDUwf3""�"""""3"D3""DUDDUwU33"3""""3"3"""""""""""""""3"""""3DDDD3DDDDD"33""3""333D3""3"""""3�""""3""""33""DUUUD333DD""""3U33"""""3DDDDDDUUDwwD3""""""D""3""3333"""33333""""3333""""""3DDDUU""fUUfwfUffDUwwwwff"""3333"""3D3""3"""""""""""""3UD3"UwUfUUfwwffUDDDDDf"""�""3""3""""3ff3DfUUD3"""""""3"""""""""""""""""""3""3333""""""""333"""33""""""33""""""3"""3""3DfUD3"""3DDD3"""UUDD"""33DfwwwfUfUUfUD3""""""3D"3"""333DD333333""""33D3333"""""33DU""fwfffffDUU3DUUwD333333""""3D333"""""�"""""""""""333fU3"DwfwfffwfUUDDUUU"""��""""UU"DUfDUfD3D""""3"""""""""""""""""3"3""""""""333""""""""""3""""3""""3""""""""""""3D3"3""333D3""3D""""3DU3UfwfUfUD3D3""""""3D3"3"33DD33333D"""""3DDD3""3""""3DU33"3wfUUDD3DDUUww33""""""333DD""""3"""""3"""""3""""3fwU""33wwffffffUffUUfw3"""""""D̻fUDfDDD3"33""""""33"""""3""""""""""""""""3"""""""""333"""""""3""""""""3""""3"3�""""""3""""""""3"""D33"3D3""""""""�""33DD33UDD3"""33""""""D333"DDDD33DDD""""33DDDD33""""DDUD33"DfffUDDDD3DDUfffwf3U"""""333333"""3""""""""""D""3ffD"3"3"UfwwwfUffUwUDwwfww""�""�3fwfffUUfwfU3333"""3"""""3""""""""3""""""""""33"""33D33"""""""""""3""""""3"""""""""""33DD�"3""3D"""""""3""""""""""33�3DD3""""""""""""33"33"33"""3DDDDDUDUDDUUD33"3DUDUUDD3"3UUU33UDfDUfUD33333DDfffffDU""""3"3D3D"""""3""""3""3333"3D""""Uwf3"""3""fwfwwwfUUUffUfwfw3"""�D"""�"wwfwwwfD333"3"""""""""""""""""3"3"""""""""3""""DDD""""""""""3"""""3"3"""""""""""""3DD3""""3""""�""3""""""3""D33""""""""""333"""""""""DD3"UD33UUUDD3DUf3UfUDD3""""3UD3"ffUUfUD333DDUffwwwwwD3""""333D""3"""3""Uf3Dff""""3"""""3""""DwD""""3D3D3UwwfUwffffwfwffUD"""""3"UwU3DfwfUDDDD3""3"""""""""""""""""""""3""""33""33D33""""""""3""""""""3DD""""""""33DDD""""""""""""""""""3""""33"3D"""3"33D"""""�"""D3"�UUffDDD3"DwfffUD"""""3DD3"wfffUUUUD3DUDUUwfwwffU""3""""3"""33"3"""""DwwfUf"""""""""""""3wf3"3""""""D"UD""wwfDwwwwwwwff"""3"""ffD333DDUDD3333""33""""""""3"""""""""""""3"""3D333""333""3""""""33"D3"""""""""3DDDUwD""3333Df"3""""""""""""""""3""""""""333"3"""""""""�"""UDUUDU3"UfUffUD""3""DfwfUUUUUUUDUUUfwfwwwffU33"""""33""3"""""3Dff33U""""""""""3UUU3""""""3"D333""3UwwwwwffffUUD3"""""3wD3"""333D3333""333"3"""""""""""""""""""3"""""""""3"""3"""3""""""""""33"33"3""""3DDfwwffD3DUUffDU3""""""""""""3fU"""""""3"""""""""""3"""���"�""3DDD3DU""wwwU333"3UfwfUUUffD3DDUDUfwwwffwwUwwU3"""""""3"33"DUUU333"""""3"33Uf333""""3"33"""DUUwwwffwffUUD3"33"""""""DD3"""""33333333""D3"""""""""""""""""""""""""""""""""""""""""33""D""D3""""DDDwUfwfwDUfDwUU3D""""""""""""""""33ff3"""""""�"""DUD3"""""""33"��������""DUUfffUfUDfffUDDfwwwfUwUwfDUUUDDDDUUfffffwUUwwwUUUU3"333"""""3fwDU3"""""3D"""""3U3"3""3"33""3""ffwwffffDwD"""""""""UD3""""""333"""3"""3333"""33D3""""""""""""""""""""""""""""""""33"""D"""3""""3DDUwUUUUUUDDUwwwUUw3"""""""""""""""""33U3""""3""""DfU3"""""3""333���������3"3fUfUfUD3"""""""""3DDUUffUfwfDwwwffwwUUUUUUfUUfffUUfwUUffww3""""""""3U33"""D3Uwf"""33DUw3"""""""3333""3333UDwfffUffw"33"""""""3DU"""""""3"333""33""""33"3D"""""""�"D"""""""""""""3"""""""""3"33""3""""""""3DDDU333DDDDUUfwwfwwfww3""""""""""""""""333DD"""3"""""""""3wU""""33"3"""���3"DfUD3333"3"""""""""3DDDDDUUfUUU33UffDUfwffUfUUffwwUfwwfUUfwwD3"33D"33fwffwfUUDUD3ff"""""3"3"33333"3"3D3DDwwfffwfD3"""33D""w̙U""""""333"3"""""""3""3""""""""DU3""""""""""""""""""33333""3""""""3D3DDU"""""3DDUUffwfwfw3"""""""3""33"""3"33"""3DD"""""""""""3""""""D3"3D3""��������"""U3""""3"""""""""333DUfUUUUD3"3f33D33wwffwUfD"UfffwfwwfwwfUwf"3wwUDffD3333DD""""3D""""""3"""3""3333"33DUwwwwwww"33333D"3̻fD"""""3"333"""""""D�"D"""3""3""D"3""""""""""""""""""""""33333""33"""333DDDDf3""""33DDUUUUfUfw3""""""3DDD""""""3333D3"""""""""""""""""""""33U"""�������"""3"""DD3""""""""""""3DDUffDD33""3""3333fwfD""UfwwwfwwwffDDffU3DDwfDfUUwf"""3D"D33"""33"""3""""33333D3DwU"33""3̻DUU""""""33"33"""""""33D"""""""""""3"""""""""3"""""""""""""""""""""D3""3""""33DDDDDU3""""3333DDUUfffwfff3"""3"DDUD"""""""33"3"""""""""""""""""""""33""3""�������""3"3D3"""33"""""""3Uwf3"3""""""33333Dw""""33wffwwwffDfwwffDUUUfffwUDfwD"3""3DD3""3D3D3"""""""33"333333wU3D3D33̻w33fD3""""""33""""""""3D"""3""""""""""""3"3""""""33"""""""""3D""33"""""3D3DDDD3D3"""""3"33DDDUfwẅ3""33D3DD3""""""3"""""""""""""""""""""""""33""""""�����""3"""""UU"""33""""""""""3w3""""""333"33Dwf"""""wwDDUUwwwwwDDD3DDUwfffDffD""3DUUDUUUDDf3"""3"""3"""D3333f33DfDf̪33Df3"333""""""3"""333f"""""3333"3""""""""3"3""""""3"""33333""""""""D3"""""""33DDDDDUUD3D3D"""""""3DUfww"33333""3D""""""""""""""""""""""""""3"3""""������"""""UwD""33""""""""3U3"DwU""""""33""DfUw""""3fwfUUDDDUf3DDwwfU""DD3"DUUfDUDDUfUUDDfwUUDDDDDDD"3""33"3""33""3"D33U3"Dw̻ffUD3""U33UDD33D3""3333"""""3333"DD""""3D"�3"3""""""""3""DD3333""""""""D3"""""""""DDDUDDD"3""33"""3U3"33DDDUwwww3"""""3U3""""3"33"""""""""""3"""""3"""""������""""3fUDDD"""""33""""""""""UU""3Uf3"33333"3333D""""""""""3U"UU"3""UDwUwU"D3""3D333DDD3UDUwwU"DUDfUDD333"D3333DDDDD3333"3"D"33U33fUD333DD"""""""""DDUD""""""3""""""""3""3"""3"""3"""""""""3DD33"333"3D""""""3UDUUDU""3"""3""""DD"""333DDfwwww""""33"""3fw3D3""""""""""""3"""""""""""���""3Uf3"3DUD33D3""33""DUf""3fD3""333""33UwD"""""""""333D"3""Uf3"fD"33"DDUD33"33D3UUU3"333"3DDDD33"D33333"3DD33333""""3D3Dw̻wUUD3"3Uf3"""""""""""""3"""""33"""""""""33"""""""""""""3DDD"""33"""D""""""33DUDUD3""3""""""3""""""33DDUwwwwwU""33""3DDUU3"3""""""""""""""""""""""�"3"""3wfU3""33333"""""3""""3333"UD3"333"""3DUD""3"""3333333333"""33D33"333""""333Uf3""333""3D3333"D3"33"3333"333""3"33333݈D33333""33""""""""D"""""U3""""""""""""""""""""""""3333"33"""3""""""3"DUfDfD"""3"""""3""""""""DDUfffwfffw3D333D333D3"""""""3"""""""33"""""""""�3"�""��UfUD3""33"""""""3""""""""""""""U3333333""D3"""""3"""33D"""3"DUD""""3"""""33DD""""""""3333D3"3D"DDDDD3"33""333"3D33""fݙwD3D33"""""""""""""""""""""""3""""""""""""""333DDD333"""33"�""3333UUfUU""D3"""""""""""""333DDUUUwwfD33""333UU"3""""""3"""333"""""""3""""3333"""""""�""ffD3""33"""""""""""""""""""""""3f"3""""""3DD""""""""3D""3UfD3DU3""3""""33UD""""""""33""""DD333DDU3"3"""333"333"3"D̻wUDD3""""33""""""""33"""""""""3""""""""""""3"""""��""333D"D3"D"""D"""33DDUffU3""33""""33"3"3"3""""33DDUUUwwfUww333DDfwf3DD3UfU""""33""""""""""3DD""U""""3"""""""�DfUD3333""""""""""""""33""""""UD""""""33ff"3""""""3"""33"3UDDDUD33"DD3D3"""""33DU3"""""3"3""""D3DD33DD3"""3333""3"3"3"UfUDDDD333"""""""""""""""""""""""""""""""""""""""""���"""333D333""""""3"""33DDDfD3""""""""D3""33"""3""""3DDDUffwwUU"""""3D333DwwwfDUD3""33""""D33D3"33""""33"""""""ffUDD3"""""""""""3D""""""w"""""""""Dw"""""3""3""DD3D33DD3"""""""333333""""""3DDD"""""3""""""UD333D3D"3333"""""3""DDw3DD3DDDDD""""3"""""""""""""""""""""""""""""""""""""""�""3"3"33"""""3""""33DUUD"""33"""3"3""3"""33"3333DUUUwwff3"""3D"""""""""""""�"3"""D3"3"3""""""""""ffD333""""33""33""""DU""""""""Df�"""3UDDUD"""3D"D3"3"""""""""3""3DD"""""33U"""""""""""3DDD333D33"""""""33""33U33DDD3UfUU""""""""""3"""""""""""""""""""""""""""""�"""3"""""""3""""""3DDUwD"""""""333"""33D33""D"3333DUUfDUDD"""""""""""""""""""���"""""""""""""""""UfU333""""""3"3DD3"""""D""""3Uf33333D"3UUD3""3DD""""""""""""33"D""3U3"""""""""""DD3333333"""33""33""UD3"DDDDDDUDD3""""3""""""""""""""3"""""3"""""""3"""""3DD""""�"3DUw3"""""""""3""333D33333"3"33DUUUwfUD3""""""""""""""""���"""""33"""""""""""3wfUD33"""""""""3D333"""U"""3DUUDfDDDD""UUfwwUUD"""""""""""3""D333UD""""""""DD333DD3"""""""""3""Uf"3""33DDUD3"33"""""3"""""""""""3"""""""D""3D3""""""�"""""""3"3UfwD"3""""3Uw3""""""DUD"""3"""""3333"33D333DDDUU"""""""""""������""3"""""""3""""""""""""""""""fUD333""�""""""""3"3""""""�wf3"""3DDD3D33D33"""U3DfD3""""""""""""""""3""""3DD"""""""""U333D33""""3""""33Dw3"3DDD"33DD""D3""""""3""""""""333""""""3"3""""3"""�""""3D""3""""3333"DUfU"""""3DDUDD""""""DUD"""3"333""3"333DD3D33DUDDffUD""""""����"""33""""3""""""""""""""""""""DwffU33""�"""""33""""DD3"3"""UDD333"""""""3D3"3D3D3""""""""""""D3"3UD""""""DUUD3""3"""""""""UwfU"""33"33DDD33""""""""""""""""""""333"""""3D3""""""""""""""33"""3""3""""""3DDDD""""DwD"""3DD3"""""""33""""33"3"33DDD3ffD3"""""�3""""""3"3"""33"""""3""""""3UwD"3"33""""�3UUD3UfwwD333"UUD3"""""D""333UD"""3"""3""""""""""3DUDDU3"""""DDUD3"""""""33"""3ff3"""""""3"DD3D333"""""""""""D3""""""""""3""""333""""""""""""�""333""3333""""""""""""""3"3Df""333"""""""""""""""""""""""3DDDD3DD3"""�""""""""""3DDDU3333""""33""""33Dff33""33"""""""""""DUwUfwf3DUUD33UwwUD3""33""33333DU33""""3D"""""""""""""33UfU""""""""DD3fU"""33""""DfwwU3"""""""""3DDD3DD"3"""33""""DD""""""""""""""""3"3""""""""""""""3333"""""333""""""""33DDfD"3D""333"""""""""""""""""""""3D3DD"D3"�"""""""""""D3UUD3"""33333""""33fwD333"3""""""""""""""3DUfUD33333DDDUD33""""""""333333"3""�"DD""""""""""""""33DUD""""""33"DDUU"""""D""UwU3"""""""""""3DD33""D3""3"3""""33"""""""33"""""3""""""""""""""3"""""33""""3"3Dwf""D33"33"""""""""""3"""""""""3"DD3D3"""""""""3""""""333"3""""3333""""333Dww33333333"""""""""""""3DDfwD"UU"""""33""""""""""33333333""33""""333"""""33DDD3"33""3UDDDD""3"DwDD3"""""""""3DD33D""3U3"D3"33""""""""""""""""""""""""3"""""""�"""""""""33DffwD33"3"3"""""""""""""""33"UDDD3"�"""""""33"333""Df"""""""333"""""33Uw33333"33"""""""""""""""333DDUDDD""""""""""3"33"""3D"33"3""""""""""""""""""""""333DDD""33UUD""33"3UwwU333"""""""33DD33D33UU3""""D3""""""""""""33""""""""""""33"�""""""""�"Uwfw""""""""33"""""""""3333DD"�""""""""33333""Df3"""333DD3"""333UUD33"3333""""""""""""3""""""3333DUD""""""333"""3333333""""""33""""""""""""33333DD""DD333DDUwfU"""""""""""""""DD3DDD33DD3""""3"""""""""""""""""""""""""3"""3""""""���"f3"3"D3"""""""""""""3UDD"3""""""""""3"3"""""""""""""""""D""3DDD3D3"33DU33"333DD3"""""""""""""3"""""""3D3DUDD""�"""""""""3"3"33"3"""""333"""""""""""33""33DU3333"33"Uww33""""""""""3D333DD"33"3"""3"3"""""""""""""""""""""""""""""�"""""""3"DU""33""""""""""""33D"3D"33""""""""""""""D"""3"""""""""3333D3333UUDff33D33333"33""""""""""""""3"""""33DDDw3�"""3"""""""33""""33D3D"3"""""""""33""""""333UDDD33"3Uf3D3"""""""DD3333D3""D3"""""""""""""""""""""""""3"""UD333""""""3DUwD""""""""""""""UDDDD"3""""3""""333D""3""3""""""""""�"D33D3""3DfwUDDDD3333333"""""""3""""""3"""""""""33DUUD"�"""""D3"3333""3D3"3D""""""""""3""""""""""""""3DDUf3"Dw3"""3D"""""3D333333""333"3"""""3""""""""""""""""3""3"""D3UDDD"""""""""33w̻D"DD""""""""""3DDD"""""""33"""""3333""""3D33""""""3""3Uw3UDDD33333333""""""""33"""""""""""""""33DwU33""""D""3"3""""33DU""""""""""""""""""""""""""""""33DDUD""fD3"""""D"""3333333""""33"""""""""""""""""""""D"3UUDD33"""""""""""�"3fD"3D"""""""3DD3""3""""""333""""""3"""333U3"""""""""3fwDD""333D3"33"""""""""""""""3""""""33DwU"3"�"3"DD""""3""3"3""3D3D"�""""""""""3""""""""""3DDf33ww3""""""3D"""3333333"""""3"""""""""""""�""""3��"33333333"""""""""""""3UUf"�"3U"""""""""33DUD3U33"""""""""333"""""DUUD3"""""3""��"3fU""3"333DD3""""""""3""""3""""""""DfD"3�3"33""""33"3"3"3"33DU"""""""3D33""""""""""3"33DUDUfD""3"""3"33""""""3333""""""3"""""""""""""""3U"�3D"""3""3"""""""""3DU3�333Uf"�"""""""""""""3333D3DD33""""""""333""""DUD333""""""""3""""""3fD""""UD"3D"""""""33""3""3"""""3"""Uf��D"�""3D333"33DD"""333"3333"""""""""""""D""""""""""""D"3DDwf3333"""""3333""3""3"3"D3"""3"""""""""""""""""3����""D"""""33""""""""333D3�"33DDfD"""""""""""""""""3""33333"D"""33"3""wUUD3D3"""""3""""""Dwf""""3D3333""""""33"33""""""""""3""ff�UU""""""""D"""3UD3333""3""3"""�"""""""3"""""""""""""""""""33Df333""""""3""33"3""""""33""""""""""""""3"""�""""��"""""""""""""3333"��""3333DfwD���""""""""""""D3"D33UUU33DDUwfD3DD""""""""""""""""""""DwU"""""""33"3333"""33"33"""""""""""3Df��"3"3D"""""3U""333333"""333""""�"3"""""3""""""""""""""3"3fD""""""""""""UD"3"""""3"""""""""""""""""""3""""33""""""""""""""D"D"�""3333DDUUwU""UfD"3""""""""""3""""""3DDUDDfUf3""DDD3""""""3"""3"""""""""""3"3UU33D"33U333"""""DD"""""""""""DUD�""""""""3""DD"""3""33"""D33"3""��"3D""""""""""""""3""3UD""""""""""""""D3"33""""33"""""""""""3"""""""""33"""""""""""3"""""3D�""""333DUUUDUwwwfwwwfUUwUDUD3""""33"""3"DUDUU3UDD"DUfwfDD"""""""""""""""""333"3wUD3"""""D3333"3333DU"3""""3DDU""""""""""3"""DD333""""3"33"""""333""3""""""""""""UfwUD"333""""""""333""DD"""""3""3""""""3"3"""""""""""""33"���""""""�"3D"��"3"""""333DDD33DDUU33"33333DUfwf3UwU"�3fU""""333D3DUUUUD333DUfwwU""""""""""3"""3D3"DffU33"""3DU3""33DDD333""""""33DD"�""""""33DDDU3"""""""3""""""""�"33""""""""""""Dwf3UD"3D3"""""33"3"D3"""""3""""""""""""""""""""""""33"""""""��""""""D3""3D3�""""""""""33"3""333""""""""DDfDUw""""33DDDD"DUD"33333"DDDUwf3""""""""""3"33DD"UDfUDD3"""DD3"3DD3D"D"3"""3"DU�""""""""""33DD""""""33"33""""���333""""""""""""""3DDDffD33U3333""""""""33""UDD3""3""33"""""3""3"""""3"""""""""3"""""""""��""3"""""33�"""3�"""""""""""""""""DUDfUUwwDwwwUDDUfffwU3""3333UD"""""33DUUf3""Uwf"""""""""33""DD3ffUfD3"33"""�"UDD3DU3U33D33""DU""33"""3""33"D33""3"""""3"""""""3""""""""""3D"""""3D""""3UfwfD3""U333""""""""""3UD3"""""3D3""""""333"""""""""""""""""""""""3"33""""""�"3""33333"��"""3"""""""""""33Dff3333"DffUDDfUDfUD3DUUfU3D3fU""3DDU3UU""Uff3"33"""""D3"UfUUwUUD333""""333DU33UD33D"""3U��"""""""3""3333333""""""""33""""""""""""""3D""33"3D33""3DfUDDUD3""DDDD3"""""3"3D3""""33DD33"""3"3DD3"""""""3"""""""3""""DU3""�""""""3"�"3D"""333D"��"""""3""""""""""""DDUw3"33"""ffUU33D333U3"""3DUwD""3DD3"U3Dw3D33fD"333"3fwUUDU33""""""�DUUDD3"""""3"""""3""DD3333"""3""333"33"3"""""""""3D"""""3DD3"33DDDUfUD3U33"DUDUDD""""""""3D33333"DDD3""""3"DDDD3""""""""3333"""""3"33"3U3""""33""""""""3""3D""3"3"3D3""""""""""3U3"""""""3""DDUf""3D33""fUU3"333"333UwU"""33DDDfD333UDDDfwU33D3D3ffwwffU""""""""3fUD"33"""D3""""""D3DDDD"""3""3333""U33""""""""""3U"3"33DD3"3""33DUUD3"D33DDU"DU33"""""3D3333333DD33"3"33DUUD3"333"3"""3D"""3"""D"3""""""""""""""""""""�""""DD"""3""3DD"""""""""""""UD"3"""""""D3""""DUUU333UU"3fD333333"D"3DfwwwwwwU"3"3DDDUffUU3UUffDUDUf3UffDDUUUfUUDDDUf3"3""""3fU3333""""D"�"""""33DUUU3""""""""""U33"3""""""""""D3"33DD3""3""33DDDD"""33D3UD3DfDDD"""""UD"33333D33D3DD""3DDUD3333D"D3""33""3D3""""3""3"""""""""�"""""3D"3"""33D33"""""""333""3DUDUfDDUfDDDDD3""""33""""""3f"""3"DwUf""3UfD33UD333333"D""3DUfffffwwwU"33DDUUffwU333UUffDDUDDDUDD333333DDD3DD"""""�"DfDD33"""""D3�"""3""3DUD3D3""""""""3D"3""""""""3"3333DD3"""""33DDD3D3""""""3DDU"DDD3""3UU333333"33Df3D33UDDD33""33"3D"3"""""3D3""""""""""""""""""3D"3""""33D33"""""3"""33333"33Dwwwf3UD33"D"D3333333D3DDUDDwU"""3UfUD"""3"""""DDD333333D3"3DwfUfwwffffwD33D3"UUUU""3333333333DDDDD33""3"3"333""D3"""3DDD3"3DD333""""3D3""""""3333"3"""""�33""""""""""""333DD3"""""3333333"""""""""333DDDD"""3DU3"3D333"3DUUUD3UUDD33""""3DDD"3""""""3""""""3""""�""""""3"DD"3"""33"DD3""""""""""""""33DD"3""3fwwff33D3��"""33""33DDDDDDDDUUUDfD�"""""""UDD33DDDD"�""3UfDUUUfffUUffwfD33ffUD"""""333333"3333D33"""""""""3""3""""DUDD""DD33""""3DU"""""""""""""""""""""""3"""333""""""""""""3"""DD3"""""3DD"3"33333D3D33fD"33DDUDUUDUDDD"""3"3333"""""""""""""""""""""�3""""""""3U"""""33""DD3"""""""""33D33"""3Uwf"""""""33"333""""3UDfffUD"3D"fUUDwfDU3""DUD3DD33333333UffU3"""""33333""""""33"""""""D3"""33U"""3D3""""3Df""""""""""""""""""""�""3"""""""""333""3"""""""333333U33"3""""D"UU"D3333UUDDDD33U"D33DUDUUfDDDD3""3333D"""3""""""""""""""""""""3"""3U""3""""3"33""""3""""33Uf""""""Uw""""33333"""""""3"3"�"DD3wwwwUUD33"""""Dwf"3"""""""3DUD33"""""""""""""""""""U3""33UD""3"3""""3Df""""""""""""�"""3""33"""3D3"""""""""33333""""""""""DDDD3DD"3"D""""3DffffUDUwwwDDDDD"33D3UUfDDDDD""3333333"""3"""""""""3"""""""""3"""""3"""""""""3"""""3"""3UD""""Uf333"""""""""""""3""��"DwwUUDD3"""""""""3Dw"""""""33"""""""""""""""""""""""""""""""DDD"3""3"""DU3""""""""""""�"""""""""""""""""""33""""3333333"3""""""""""D333DD3333""3"""DDDDDUwU3UwffwDUU"3DD3DfUUUDD33""""""333"3"33""""""""3""""""""""""""33""""3"""""""""""""3Ufw3"""3D"3D3""""��""3DUwwwwUD33333""""""3Uf"""""""""33333"""""""""�"""""""3""3D333"""3""3333DUfw""""3""""""""""""""""""""""""""""""333"33""33""""""""33333"DDD3""""""33DDUDDUfwfwwUDDfD3DDDDUffUUD3"""""""333D3"""3"""""""""""""""""""""""""""""33D""""""""""3fff""""""33"�""�""""3fUDD3333333""3333DDUf"""""""""3333"""""""D"3""3"333""33"3DUDUUD3"3fD"""""""""""3""""""""""""""3"""""33"""""33333"""""333""3333DDD3"333""""33DDDD3wwwDDD3DDDD3DDDDUUffU""3""""3"""3"""3""""""33"""""""""33DD"""""""33"33"""""""3DDfUw""""3"""�3�3"����"D3DDDDwf3"""""""3"3"""""""""D""""""""33"""""3DDUf3"333Uf"""333"""""""""3"""""""3"""""""3""""""""33"""""33"""""D333D333D33"""3333D3DwfD3D333DDUUDDDfUUDD""""""33"""""""""""""""""""""""""""""""33D3""""""""D""33"""D33DD3Uf"""3""""""�3"����33"3""f3""""""3""3""""""��"3"""3"3"333D3DUD""DfDDDUfwUD"3"""""""""3"""""""""3"""""�"3"""""""""33"33""""""""""DD333DU3333"""333"33UwU333"3D3DDDUUUfffUD""""""""3"""""""33""""""""""""""""""""3"""""""""DD33"3"""""�"�"3D3DD"3Uf"""3��"""""""""""�""""3UD3""""""""""""""""U3""""""""D3DfwwUUDDDUUfUD3U3""3"""""""""""""""""""""""""""""""""""D"""""""""3333UfDDUDD3333""3"""""3fwfD333"3333D3DffUfUD""3""""3""""""""333"""""""""33""""""""""""""""""""""""""""""3���""UDD33"DUD""�""3"""33"""""""�""333fwD""""�""""""""�D""""DU33333DfUfwUD33""""""3"33U3""""""""""3""""""""""""""""UU33""""""""""3""""""DDDDUD33"333D3""3"""""DwU3"3333"33333DwfUU"""""""""""3"""333"""3"""""""""""""3""3""""""""""33""�3��""D33""3DUfDDD�""333"""""33""""""�""""33wU"3""""�"3w3""""""D3"DDDUwffD""""""""3DU3"3"3"3"""""""""""""""""""3"""3wU"""""""333"3"""3"3U3333333333333"""""""UwwD3""333333333DfwU3""3""""""""""""333"""D3"""""""""""""""""""""""""""""""""""�""����""3U33"33DwfDfU�"""3"""""""D"""""��""""3Uwf""""�""3""UUwf3""""�3U3DUDUD33D""""""33U3""""""""""�"""""""""""""""D3""33"333""""""""33333""333""""3""""""3wf3"""3"3333333Dwf""""""""""""""""""3"""3"""""3"""""""""""""""""""�"""3"""������"3D3333DDUwwf3���"""3""""""""""""""��""33DwU""""�"DwwD""""��"DDDUUDDfDDD3"""3D3"""3DU3""""""""""�"""""""""""""""3"""33"""3"3""D33"333""""""3"""""DfwU"333"33D333DDUwf3""""""""""""33""""""""""""""""""""""""""3""""3""33""��"""3D""33UfUfw3""""""""""""3""""����""333"UD"""�3wwwwwwwwwffffwD"""DwwwffUUU3""3""""3""""3f3""""""""���""""3"""""3"""""""""""""""""DDUDUD3333"333"""""""""""""Dwf""3333DDU"3DD3UwwwfU"""""3"""""""""""""3"""""""""""""""""""""""3""""33"""3"""�""3D"3D33Ufwf3D�"333""""""""""��������""��"""33333D"��fwffffUUUDfUfwwfffffw"3DfDDD3"33333""3"""""""""""DU3"""""3"""""�������""""""""""3"""""""""""""""""3ffDD3"3"33333""""""""""""3Dww3333DUDDUD333DUwwfUD"3""""33"3"3""33""""""""""""""""""""""""""""33""""DU3�"""""3D33333DUffffwD�""""3""D3"""""��������""3333"3U"""33DwfUDDUUUDDDDUUUfffffwfUff3""""""3"""""""""""""""3DD"""3"""33"����������"""""3""33""""""""""""""""""UU333"3""333UU"""""""""UwfD3333"DUUfU33DDUwwUDDUU""""""33""3D"""""33""""""""""""33"""""""""DUUf33""""""""3DDDD3"3DUfwf"�"""""33""""""�������"�""3D3""3wD�"wD333D3DDD333DDDffffwwDD3""""""33"""""""�""DU3""3""33�����""""""""""33""""""""""""""""""DD3"333333"3fwU"""""""""3fww"3"""3"3UfU"33DwwwfDDDUU"""""""""3"3""""""""333""""""""33"""""3"3"""""""""DD3"""3""""""DDDD"3"DDDwf�"""""""""��""3D"3wDw"333D""wwwwwU333333333"33DDDUfffUfwD"""""""""""""""�"33D"""""""""����""""33"3333"""""""""""""""""""3D"333333"3ffU"""""""""DwfD""33"33"DU3"3DwwwwDDDDUU""""""""""3"3"""""""3""""""""""3""3"""33""""""""�"""""""�"""3DDUD""3DDww""""""3"""3""""""��""""""3UUUffUUwwfffUUD"3"""3333333333DUUUUUffffD"""33""""""�"""U""""""����""""333"33D""""""""""""""33""""333""3UUD"""""""""3wU"""333"3U"DU3D3UwwwU33UDD3DD3"""""""""""""""3"3"""""33""""""""""""""""""3""""�"33"""DUfDD33DDU""�""3""""""""""�"""""""�DU33UfwwUDDDD333"""3""""33333DDDDUUUDUDDU333D3DUU3"""""�"fU"""""""��""33333"""3333"3""""""""""""""33"""3"33"3DD3""""3""333U"3333D333UUD3D3UwwUD"DDDD"DDDU"""""""""""333""""""""33"33"3""""""3"""""""�""33""""3UfUDDDDDDD3"""""""3"""""��""""UU"3fUDfUfU333""33"3"""""""""""33DDDDDD3DDUUU3""3"D33DDD3"""""""""�"DwD"""""""""""f""""""33DU"""""""""""""3"""""""3"3D3""""""""333w3"333"3""3DUD3UfwwwU33DDDDDDDUU"""""""""3""33""""""""333"""""""""3"""""""""""33"33""""��"3UDDDDD3DUD"""""""""33"3""������3wU""DDfwUUUU3"""""""""""""""""3"3DDD33333DD33DUUD"3D""""DUD"3fwUU"��DD"fwU3""""""��"""""""3U""3"33UD""""""""""3"""""""""""33D33"""""""3333w3"""3333""333DfwwwUU3"33DUDDDDfUD"3""""""""""""""""""""""""""""""""""""""""""3""""33DD3"�"3D3D33D3f""""""""�3""""""""���3"""ffU3"UwDUUUD33"""""""""""""""DD333""33333"3D33DUDD3"3DU3UUfffwUUUU3"wUDwf3UD""""�""D""3"""""3D3"DD""""""""33""""""""""""333"""""""33333U3"""3333"""DDwwwUD""33DDDDDDUUUUwD3""""""""""""33"""""""""3"""""3DD3""""""D3""""""3"3"3""""3333333f""""33""""UD""""""3"""����"D"�DwwUDUfD""""""3""""""""""""333""""""3"""3"3"33""DD33333wDDUffUwf3UD"""���""""""""""3"""33""""""""""""""""""""3""33333"""""3"33fU33"""3"33""3wwwwfD3""3333D33DUUUfD3""3D3""3"""""""""""""""""33""3D"""""""""""""""""""""33"3""��"""""""3Uf3""3"3""""""33"""""""3U3""����"DU3"33""""DUU"fwwfUD3"""""""""3""""3"3"""""""""""3""""�33"""""3UDUUffwwUU"33""""��"3""""""""3""3"""""""""""""""""""3"3333"""""""3Dww333"3""333""DfwU3"""3333D3"DUUDDfD333DDD33"""""""""""""""""""3"""3"""33"""3"3""33""""""""""""33""""UU"33""""�""""""3D3"""""""�����DUD333"""3UDUfUwwwUUD33""""""""""""""""""""""""""""""""""""""33DDUUwDD"""���""""""""""""33""""3""""""""""33D33"""3"""33fwU"3""33333333wwUD"""""3333333DDU3U3D3DDD3D33"""""""""""""33"3333"""33""D3"3""3""""33"""33""33��"33D3"""3fDU3"DD"""�""""D"DfD3""""""����"3"""""DffUUDffUUDD3"""""""""""""""""""""""""""""""""""33Uwwwwf3D""3���""""""""""3""33UDD3"""""""""3""""""3333""""""""3DfD"3""3"3333"3wwU""""""33"333"333DUUU3D3DDDDU3"""""""""""""3333DD3""33333""""""3"""""""""3""�"333D""DUfUD""3D""�"3UUDwD""3"""""���"""""33DDUUD33UUfUDDDD3"""""""D3"""""""""""""""""�""""""DUfDffffUD""��""""""""""""3DUfUD3"""""""""""D3"""""3333"""""""""UwU""3""""3333DUwf3"""""""DDD333333DDUDDD333UDfD3"""33"""""""33""3""33333"""""333"""3""""""�""33"""DwfD""33"""3""""3UUDU"""3"""""""�3"�"3wUUDDD33"DUDDDDDD""""""U3"""""""3"""""""""""3"""��"""""33DUffUwU""�""""""""""3ffUfDD""3"""""""""33"""""3333"""""""""DD3""3"""3"33"UwU3""""""3D333333DDDDUD""33DUDDD3""""""""""""""""""""""""3"33"""""""""""""""""""""33D3"""""3ffD33"""33"3"""""DfU3"""3""""""��"3wfUfwwUDDDD3"""DUDDDD33"""""""3"""3""333""""""""33""��""""D3UUUUwf""��"""""""""""""3DDUUf3"3"3D3""""""""""3"""""333D""3""""DD""""""""3""33fwf3"""""""DUDDD""33D33D33333DUD33D"""""""33"""""""33""""""""""33"""33""""""""""""""""DDD3""""3D3D"3333333""""3""D3D"""""""3""��UffwDD3333""3DD333333""""""""""""""3""3D33""""""""""""33ff333UU"���"""""3D33333333333"3DDD3"""""""""""""""3"""""""3D3""""""""""""3fwfU"""3"""33DDDD3"3333DD33"3DD333UD33""""""3"""""""3"""""""""""33"3"""""""""""""""33DD33""3Df""D333333""""""""Uf3"D3""D"3""""�"wffD3DD333"3""D3DDD333333"""""""""""""""3333333"""""333"""""�3""""U3""3f""""���"3"""3U3"""3"3"3"33""3UU3"""""""""""""""""""""""""fD""""""""""3UwfDDD3D33"33"DDDDD33333D33333D3"33UD3D3""""3"""""""""""""""333"""3""""""""""�3DUD3D3"3UU3""D33"3"3"""""""""""DUDD3UUUUUU33333"""""3wwUDDD3"3333"3"""3D3DD"33""""""""""""3"""33"33""""""3""""""""3�"33""ff"�����"3DDDD3"""""""""3DU""33DD3""""""""""""""""""""3f3""""""""33wfU"""333DD"3"3DDD333""3DD3DDD33D33DUDUD"""""""""""""""""""""3"33DD3"""""""""""""��""3UUU33DDDDD""""""""""""""""fUUfUUUDUUDD3DD3DDDD33D33DfU33DDDDD33333333"3"333D33D3""""""""""""""33""3""3"""""""3""""""""�""3""DD"""��"""""33""""""""""33""3"DD3""""""""""""""""""DD3""""""""""Uwf"3"33D3D3D33""3333"""333DDUU3D33333DUDDDDD""""""""""""""""""""""3"3DD3"""""""""�"33DwwD"33DfDD""""""""""""""ff3DDDDDD3333D33DD3UUUDDDDDD333DD3333333D33"33333DD3333"""�"""""3""""""333"333""""3""""""""""3DD"""""�""3""""""""""""3"""""""""""""""""""""""f3"""""""""""""33wfU33333D333333"3333333"3333UUfD3D333333D333Df""""3D"""""""""""33333""""""""""""33"3f3""3"DD"3""""3"""3UfUUffUUUD3333333D3"3"DUUUDDDDD333DUDUDUD"333333"3"333DD3"3"""""33"""""""333"""""333""""""""����""""""333D"""�"""""""""3""3""""""D3""""""""""w3"""333""""ffDf3D333"333D33"3""333333"33UUUDDDDDD"3""""""DDD"""""""""""""333"""3"""""""""""33333fU3""3UUD3""""""""DDD""DUfffDDDDDDD33"33333333DDUUDDD3333D3DUUffUD3"""33"3333D333"3""""�"3"""""""333"""3333"""""�"��"""""""3DD3D"""��""""""""""""""""3D""""""""3U3"""""""""""3DwwDDDD"33D3333D3D333""3""33"3DUUDUDDD33""""3UU3""""""""""""""""33"""""""""""33333f"3"3Df"""""3DDUUDUUfUDDDDDDDDD3D3DD333D3DUUUUDDD333DDDUfwfUD3""D33D33333333"3"3""""�""""""""""""D33""33D3""""""""""""""33D3DD"""""""""""""""""3""33"""""""Uf"""""""3fUDD3DD"D3333333D333""33"333DUDDDUUU3333""""""33UU33D""""""""""333"""""""""""""""""3333f3"33Dff3"""""3"DU333DDDUDD333333DD33"3D333D3DUUDDDDDDUUUUUUDDUD"333D3DD333UUD3333333""""�"""""""""""""""""""3333"""3""""""3""�""3�""""""33UU3""""�"""""""""""""333"D""D"""""3ww""""""DwDD3D3D33D3333333D""""3"3"33UDDDDUU33DDDD""""""33DDff""""33"D""""""""""""""""""""""""""""3DDUw"33DUU3DDDUDU""DDUfD3333333""3DD3"""33DDD333DD3DDDDUUDDDDDDUUDD333333DDD33333DDDUUU3"333"3""""�33"""D"""""""""""""""333""3""3"""33""3"33"�"""""""""3DUD3""""""""""""""""�"333"""3"3""""Df""""""3wUDDDD3DDDD3333""3333""""""3DD33DDDDU"3D3DD"""""333DDUf3U3"""""""""""""""""""""""""3DUDwf"""D3UDDwD333UUU33333"""""""""3D3""333DDD333D33DDDDDDDDD33D3DDD33333DDD33"33"DUUfUD""33"3"""""""D3""DwU"""""3"3333""""3333""3""""3""""33"""""""""""33DDU"""""33""""""""""""3333""""""Uf""""""""3DUUDDDDDDDD"33333"33"3"""3D""DDDDD33DU3""D33"3333"3D3DUUUU"3"""""""""""""""""""�""3DDw3""33DwfU""""3"""""""""""""DD3DD3"""3DDD33DD333333D3333333D33333D"3DDD3"3"3DDUfDD3"3333"""""""""""""""3fU""""""3"""""3"DD3"""D"""""""""""""""""DD33"3"""""""""""""""""DU""3"""""DfD"""""""""""""wwwfUUD33"33D33"33333333""33UfUUwfUU3"333UD"33"33"3"333D3D3DDUUwwDU""""""""""""""""3DUwU""""3DUw""""""""""33DD"33""""333DDDDD3D3"33DD33333333333DD33DDD333DUDUfUfD"3333""""""""33"""""3"""3""""""3DDD3"33""""""""""""""""DDDDU"3""""""3"""""""""D"""""Dww"""""""""""""fwfffUD333333D3""3333333""UfffwfUD3""33"33DD3"33UD3D""3UDDDDDDffUww3""""""""""""""""""DDff3"333DU"""""""333"33"33333DDDDDDDDD3D33DUD3""33D3DDDDD33333D"3333UUff3333333D"""""""3""""3""""3D33"""3""3""""""""""""""DDDDD3DD"""""""3"""""""""""""""UUD333""""""""""wfffUUDDD33333"""3""33"""3UfUDDD3""""3"""""33""333DUf3""DD33UUUD33DUD""""�3""""""""""3"33""3DDD3""""DUU3""""""""""3333333D3333DUD3D3DD3DDDDUU3"3"3DDDDDDDDD3333"""3333DD3UD3333"3D33"""""""""""""""D3"3""3""33D3"�3"""""""3DUDDDDD3"""""3"""""""""�UD3333333""""""""3wwfUDDDDDD33D"33"""33D3UfU333333""""""""""3"""3DDUfD3D"333D33333D3ff""""""D3""33D333"""3DD""""33D3""33"""3""3DDUD3"333DD3DfUDDDDDDDDDDDDfU33DU333DD3D33D3D3333333333"3333DDD33""""""""""�"""""""""33D""""333"3D"""��"""""""3DD"33UU3""3""��""""""33""""""�3UU333333333"""""3wwffUUUDD3DD3U"3"""333DDUUD333333"""""""""""3"D33DDf3"3"3D333333D3Df�"""""fU3333"""""3UUD"""""UD""""""3"3"333DDDDwD3DDDDDwfDDDDUUUwwfUwfDUUD3333DD33DDUDUU333333D333""33DD"3""D3"""��"""""""33""""""""DD"�""""""""3333"UDU"""33""""33""""""""""""�"fDD33333333333D3fwwffUUUUUDD3DDD33""""DDUD333333""""""""""""""33D3DDU3""UwUD3333333D3DfwDD3""""""3D33""""""""33DU3"""""ww"""""""""33""""3DUfUU"3"fwDUUUfwDwUUUUfDDDwwUU3"""33333DD3DDU3D3"333333D33333UD"333UU33D"""""""""""3U3""""""D"���"""""""333UfDD""""""33"""""""""�3fUDDDUDDDDDDDDUUfffffUDUUUDD3Df3""""""Dff3333333"3"3""""""""""""3DDDDDwfUD333333333333"3Dwwwf"""""""""""""""�"33DD""""3w3"3"3"""""D3"""""333"3fUffwfDDfUDUUfw"Df3"UfD""""3DDD3333D3"33333D33D3DDDDDD"3DDU3"33"""""D3DD3""�""""3DDfDD3""""""""""D33"D""""""""��UwwwwwwUfUUUUfw""fUUUU33DUUUDDUDD3"""3DfU333""3"3""""""""""""""""3UD3""33"3"333333333333DDfffD�"""""""""�3DD3333f""333"""33"33D3"3""""3fDUU"wfDUUfffU"3UfD""3fU3D""D33UU333333D333333U3""DDDD3"""""""3D"3""�""""3DD3D3"""3""DD3D"3"""""""""����UwfwwfwwUUUDUDDDDDDUUUUDD33""3UUD"""""""3"""""""""""""""33D33"33"3"3333333"33D3DDUUUfUfwD�"""""""""""""""�"DU"DfwU33333"3D3""33D33"""""""3"fD3UwfUUUfwfwf"DfU3"wfD33D3fD33DD3333"3333333DD"33DUD""�""""D"�"""""DDDD33D""""""3fUD""3""""""3"""3D��wfw̻U33DU3DDD3DDDUUf3D3333DU3""""""""""""""""""""""33D3333333"3333333"33333DDUUfUffUww"""""""""""""""""""�"3DU""̻33DDD33333D33D3333""""""3UUfUDDDD33"DwwD33"DDD"DUD"33UDDU3"3"""""33333""3333D3""��"3"3""""�"""3D3DU333""���""3"""3DUD""3""""""333"�3"DffUwf"D333DD333DDDDDUDDD333DD""3""""""""""""""""""""""3D3"3"""3"""33333""3"333333DDUUUUfUwwDffU3"""""""3"""33"3�""ffDUwwDDDUUDDD3333DD333DD"""�""3DDDD3D3D33333ww""3Df3"3333DD3D""33"""""3DD33333333333""""""""""""3"3"""""""33D"D"""3��"33"""""3D"D3D"""""""""�3wDUU"""3f"3UD3DDDDUUUUUUfDUfD333DD33"""""""33"""""""""""33333"333""""33333"""3333333DDUUUfUUUfwfww""""""""""""""3"��"̈wfDẅUUDDDUDDD3DDD3D3D33U3"3DD"""33DDDD3""33fwwwD""""3Uw33333333DD"""3"""""""3D333"3333""""""""""33""""""�""""""""Dw"��"""""DUD333"3D3""""3�DwDUUfUDDU"3U"""UUDUUDffwffwwffffU33DDD33""""""""""""""""""""""3333"""""""3""33""""3"3333333DDDUDDUD33Dff"""""""""""3U̻DDwwUwUffDDUUUUDUDDDDD3D""""""""""333""3"3fU3"""""UwD333333DDD3"3D3"""""3D"333D3""""""""""""DD33""""""""""""�3""3D33DUUw3"""""33""3""""""Uw3Df3DDUD3"33"D3D3"UUDDUDUfffwwwwffD3DD333""""""""""""""""""""""33"""""""3""33333""3"3"333333333DDDD3333DDfU"""""""3""""""3"f̙DD3UUfwffwwfDDDUDDUfwwfwUUD"""3""""3""33""""3DUw3333"""DUfD33""333D3333""""333333""""""""""""""""""""DD3D3"""""""""""""""""""3DDDDDUw3�""""""""""""""""""�"fw3Dww"D333""""D33DDUUU"DUUffwwwwffUUUD"33"""""""""""""""""""""D33"""""""33"333D""3""""33"3333"33333333333UwD"""""""""""DD"Df3D3""""Dff3UD3U3�D3D""""""""""""""""""33DUfD33"""333D3DUD33333""""""3""3D3"""""""""""""""""""""""3DUU3D333"""""""""""""""""3""�"""33DUUUww"�""�""""""""""3""""DD��Dfww3"3"""3"""""3DD""DD""DD33fwwwfUfUUDD3"""""""""""""""""""3D33"""""""""""""3"""""""""""""""""""""""3DDDfwf""""""""""""""DD3"fwD3"333"""""D33DfDffD"""""""3""""""""333UDDDUf33D33"3"DfUfD333"3""""""""3333""""""""""""""""3333"D333333"""""""DDUU3333333"""""""""""""""""""33Dfff""""""""""33"""""""̙w3�""3UU"""""""""3U33"""""DwwwwfffffDD3"""""""""""""""""""3D3"""""""""""""""3"""""""""""""""""""""""33333Uwf3""""""""""3DD3UwffwfDD"3"333""3""333"""�"""""""33""""333D3D33DD"D33UfUfDD33"33"""""""""33""""""""""""""""""D333""3"3333"""""""3UffD"""3D3"""""""""""3"""""�3""""33Dff3""D333"333""""""""""""""U̻33��"33D"""3D3""""33D""""""""3""DwwwwwfUwwDD3""""""""""""""""""""3D33"""""""""""3"""3""""""""""""""""3333DDD""""""3DDUUUfwUfffD333333""333333333""3"""""""""""""""DD3"""33"33D33DDw3D""""3"33333""""""""""""333"33"3""3"""""""""33"3""""3DUwf"""""3333""""""""""""""""33"""""3DfU33""""3UD33DD3"""""""""""""3""3"""U3"""333DD3"""""33"""3fUwwfwwwwUD33"""""""""""""""""""DD333""""""""""""3"333""""""""""""""""""333D"""""""""3DUUUwwUUUfffU33333D3333D333""3"""""""D""""""""""""""""DU""""3"""""DDUf"""""3333DD3333"""""333"3"3DUUUDDD33""""""""333""""""3Ufff""""""3"333333"""""""""""""3""""""""3fD"""""""3"3DDDD3D3"3""""""""UU3""""""3333UU3"""""33"3UUUDwfwwwwfDD33""""""""""""""""3DD3D"3""""""""33"""3"3"""""""""""""""""""""3D""""""3333DUwwfUUff3UD33333D33D3D3""""""�""""3333""""""""""""""33"""""DUUw3D3"33DD3DD333""33""3""3"UwU33""""3D"""""""""333"3"33DffU""""33"3333333333"""""""""�"""""""DU"333""""""""3333DDUDUU3""33"""""3f"�"""""""3"333Df3"3"33"3UfDD333DfwwffD3"""""""""3"""""""3DDD3333"""""""3"33333""""3""""""""""""3UU"""3""3DDDffUUffUD"333D33D333333"""""""""""33D3""""""""""""""""""""33DUUD3333333333333"333333""33Uw3""""""33"""""""""333DDffU"""""33"333"333333""""""33""3"""33D""3D3""333"""33""3UUD"""""""U""""""""���"""33DDDwU"33333UUDDD33DD"DwwDD3"""""""""3"3"""3DDDD3"3"""""""""""3UD""33""""""""""3DUU"""3"""33DUfUUUUUUUU33DDD3D3333"""""""3"33""""""""""""""33""33UfD3DDDDDD333DDDD3D333D33UUffD"""""3DD"""""""3333DUfU33"33"""""33333333"""""""33"""""""333"""33""3"""""""""3Uw3""DDf3""""3""�����"""3DUDff33333UUD3DD3DUD"3DfU33""""""""3""""""DUU333""""""""""""""""DD3"""""3"""""""""""DDUffU"""3333DUfUUUUDDDDD3DD3DD333"""�""""""""""""""""""""3333333DDUUDUD33333DU333"UfDDDDD3D3"""""3"""""DD33DDwD"D333"33"33333333"""333""333""""�""3D3""""33"""""""3"Dw3UD�UU3"33D"�����"""3DUDDfD33DDfU33DDDfU3"33UD3""""""""3"""3""""DDD""3""""""""""""3"""33D"""""""""""""3"333DffU"�"""""333DUfUUDDD3DDDDDUD33"3"""""""""""""""""""""""33""33333wwUDD333"33""""33333"3D333""""""""""""""3D33DUwU""Df33333"""333333333"""""33"3"""""""3DUD""""33""""""333UD"UwDU""""""33""��"""3DUfDfU33DUfD333DDf3""3"DU"""""3333333"""""3UD3"""3""""""""""3"""3D"""""""""""""""""""3"3DDUDffD3""3DDDUUfUUU3"DDD3DDUD3333""""""""""""""""""""""""""33333"3DwUDD333""""""""""""33"DDD3""""""""3""""333UwU3""3UfD333"3""333333333333"3"33""""""�""DU3""""""""""33DD3"""ww"3D"""""3D33"""""3DUffwD3DfUDDDDDfww"""""DU3"""333""33"3"""3D33""""""""""""33""""3"""""""""""""""DD333DDDUfww�"""""33UffUffUUU"DD333D3DDD3""""""33"DD""""""""""""""""3"33333D33DwUDDDD33""3"""""3""333DD33""""""""""3"""""""""DwD"""3D33"""3"33D""333"33333"""D3"3""""�""3U3""""""�"""33"U3"""f33D"""3"UD3"""3DDUwfUUUUffUfU"""3UfU33"""33"33"""""D3""""""""""""""3333"""""""""""""""3""3333DD333DUfDfw"D""""3DUUUUUUU333DD"3DUDD3""""""33"""""""""""""""""D333"""""DDUUU3"""""""""""333D3"""""""""3"""""33"3U"""""3ffD33D3D3DD3333"3333333"3333""""""""""D""3""3"""""3333""""""""fw3""UD""""3UU3"""""""3DUwwwwwwfUfwf"""3wwDD3"""33"""3"""""D3""""""""""""""33"3""""""""""""3D3""33DDDD33UUfUff"""""3""""3D33DDUfUD333"3UUUD3"33333"""""""3"""""""""""""""""""""""3D33"""""""""3D""""3""""""3D3D3"""""33""""""""33D""""""33fD3333DD33333"3D"33D3333""""""""3""""""3""3"""""""""3wwD""""""3f3DUD3"""""""33DDUfwwfffwUUUUwwD""""3fwfDD""3333333""""3U3""""""""""""DDD333""""""""""3333333DDDDDDDDUUw""""""""DD3DUUD33"3D3DUUD333D3""""""""""""3""""""""""""""""""""""""""""""33DD""""""""""33""""""""""""3DDDD3"""""""3""""""""""""""3333""33"DD3UUfUD33333"333D3D33D"""""""D3D3""""""""""""""""""UU"""""fD""UUD33""""33DUUfwUUfwUUfUDDDDww3"""""fwfDD333333333""3"DU333"""""""""""DD33"�""""3"""""""""33"3D3DD3D3DDDfD3""3"D33DUUD3333"DUUDD3"33"""""""""""""""33"""""""3"""""3"""""""""33DDD33"3""""""""""""""""""""""33DD333""""""""""333""""""""33""33D3""33DDDDD33333"333"3333"""""33DfU3"""""""""""""""""UD"""""""DU33UUD3333""33DDfwfDDfwwwD3DfDDfU"33"""DwwUDD333333333""3DD33""""""""""""33""3""""""""""""3"""333D3D333Dfwf3"""3"333DDD333""DU3DD333""""""""""""""3333"3"""33"""""""""""""333UDDD3"""""""""""""""""3D3"33"3""""""""3"DD3""""""""""""3DUU3"""""333DDDD3""3333""3333"""""""""3Dfff"""""""3"""""""""�D3""""""""wD""DUDUD3D33D33DDUffwffwfDDDD3DUUD""3"""fwwfDDDD33333"""DUD""3""""""""""""""3""""""""""""""3333D"3"3333DUUUf3""""33D3333""""33DD3333"""""""""3D""""""""3333""3""DD33"3""""""""""""33"3UD3"""""""""""""""""""333""333"3"""""""""""D33""""""""""3D3"""""3"D3DDDD"3""3""D3D3""""""""""""3UDDU3""33"""""""""3"Uݻw""""""""UU""UD3DD3333DDDDUDDfwUUDDDDDD33Uw""""333DffwfUUUD3333"""fD""""""""""""""""3""""""""""""3333"D33333"""DDDUU""""3fD"33"""""3"3DUDDD333DU3""""33""""""""3D333""3"""33""3"""""""""""3fD3""""""""""""""""""""""""""33D3"""""""3"""""""""""""3""""""333333UD33"333D33"""""""""""""3DDDDD3""333""""""""3""""""w""""""""w33fD""""3DD3DUUUDffD33DDDD333DDUU33"3""DDfUUUUUDD33"""Dw3"""""""""""""""D""""""""""""3""""D"33"""3333UUf"""""3D33"33""""""33D3DD3"33"""""""""""""33"333""""""33"3"""""""""""UD3""""""""""""""""33"""3""""333D3""""""""""""""""""""""""""""""""3333333D3"3"333D3333""""""""""""DDUUDUU3""3""""""��"""""33"""UݻD"""""""""wUwf3""""3DDDDUUfwU3""333333"3UU333333333"UDffUDUDDD33"3Uf3""""""""""""""3"3"""""""""""""""""""""""""""3DUwf333"333DD333"""3"3""33DDD3"""""""""""""3""""3D33DD3"""""""""""""""""""""3DD3"""""""3""3"""""3UD""D"""""3""33"3""""""""33""""""""""""""""3333333DD333"D3D3"33333""""""""""""D3DDDDU333"""�"""""3"""""wݻwD""""""""UDwD33"""3DDDDUD3"""""""""DU""33333333D3UUffUUDDDD33DfD3"""""""""""""""3""""""""""""""""""3""""""3""33Uw3Uf333""""""33DDDDD33"""""""3""""3DDD"""3DDff3""""""""""""""""""UU33"""3"""""""""""""33"33"""""""3D33""""""""""""""""""""""333DD3""3DD3D33333""""""""""""3""""DD3fU�""""""""DfݻU3"""""""3UffU3""""""3DfwwU""""""3UU"3333DDDD3DfUwfUU3333UUU33"""3"3"""""""�""3""""""""""3"""""3"""""3"33"333UwwffD3"3"""""3"3DDDD33""""""""""DUU3""3333""""""""""""""""""3"UfUD""33""""""""""""""""""3"3D3D"""""""""""""""""""D3""333D3"3DDD3333D3"33"""""""""33"""""33"U3""""""3"D3̪wfU"""""""DffD3"""""3wwfD""""""""DUD""""D33DD3D3fffwwwU"3UwfD"3"""3"33""""""""""3""""""""""""""""""""3"""3""33333DUfwwU"33"""""33"D333"3"""""""""""D3""""3""""""3"3"""""""""""""""""""3"33DDD""3"""""""""""""""3""""DDD3""""""""""""""""3"3U333"3D3"333333333D33""""""""""3"""""D3DU""""�""""""33DDw̻wwUwU"""3"33wwD33333"DU""""""""""""""UUD3"""3DDDDU33UffwfUUwUwfD33"D""""33"""""""""""""""""""3"""""""3""""3"333DDDUUUUD"33""""3"333DD33D3"""""""""33""""""3"""""3"33333""""""""33D"""333333333D3""""""3"""""""""""""""33333"""""""""""""D33D3"33"3D"333DUU3"""33""""""""33""""""""33DU3"""""""""333DwU"333333ffDDDD3Ufw""""""""""""3fUDD3""""3DUDUUD3wfwwUUffUDD333333"33""""""""3"3"""""""""""""""""3"""""333333333333DUww"3"""""""3DDD333""3"""""""""""""""""""""""3"""3"""333DUwwfwwwUDDDUUUDDDDD3""3"""D3"3"""""33"""""""""333D"""""""""""""""3""""""DDD3""""3D3""DD33UDD333"3"33""3DD3""""""""""3Uf"3""""""""33DfD333333fUDUfUUU"""""""""""""3UDDDDDD"""3333DUUUUwfwwU33"3D333333333""""""""""D3"""""""""""""""""""""""""""3333""33DDUU3333"""""33"3"""""3""""""""""3"""""3"""""""""3"3333DDUUUfffwUwwwfUDD3333DDDDD"""""D3"3""3""3"""""""""3DD3""""""""3"""""""""""DD""3"""U3"3UUUUwfUfUD33D"""3DUUD""""""""333DUD"""""""""33DÜfD"333DDwwfUU""""""""""""""3wfD3DDDD333"333UUUUUUDD3"""DUD33D3333333"""""""""3"""""""""""""""""3333"""""33""""3"33UUD3333"""""""""""""""""""""""""3"""""""""""3D33""333"3333DDUUUUUUfwU3DUDDUfDUUD""""33"""""3""""333DDD33""""""""""""""""""""DU3""3""UD"3DDUUUDDDDDUffUUUUUU3"""""""""""333D"""""""3DffwwUU33DD33wfw3""""""""""UwfwfD3UUDDDDUUDfUDDfwUD3"3DUD""3333333""""""""""""""""""""3"""""""""""""""""3"""3D3""""""""""3333UUU333"""""""""""""""""""333"33D33"3DUffUD333"""""""333DDUUUDDDD33DD3UD3DD"""""""""""33DDUDD333""""""3""""""""""3D"""3""UwDDD3DDD3DDDDDUDDDDU33"""""""""""""333D3"""""""33DwffwwwD33333fD333"""""""""wU33DfwfDUDUDDUUUUUUffUD3"33D33"33D333""""""""3""""""""""""3""""""""""""""""""""""3D"""""3"""""33DDD3D"333"""""3"""""""""""33UDDDD333Dffwf3D""""""""""""333DDD""3""""""""""3""""""""""""3DDDDDD333"""""""""3"""""""""D3"3"3"fffU3333DUU3D3DD3DDDD"""""""""""""""""3333D3"""""333UfffwfU333DÜ33333""""""""""""3f""3DDUUfUDDDDUUUDDwwwUU33"333D33333333333"""""""""""""""3"""""""""""33"3""""""""DD""""""""""3DDD3"D"""3""""""""""""""""""33"""3DD333DUU33UD3""""""3""""""3333"""""3""""""""""""""""""""33DDDDUD333""""""""3""""""""333"3""Dwwww333333333333DDDD3"""""""""""""""""""33DDD"""""""3DwDUfffwfwwD33f̻f33D33""""""""""Uf"333DUUUDfw3DDUwwwfUDDDD33333"333"""""""""3"""""""""""""""""3""""""""""""""""""""D3"""3"3"33DDDUfD3"""""""""""""3""""""3U333DfDUD3"""""""""""""""""""""3DD33""""""""""""3D""""33DDDDDDUDDD3333D3D"3333"""""""3""""33fwwUUf"3D3333DDDDDUDD333""""""3""""""""""3"33333D33"""""""3fwD3UffUUfwwwwwwfUUw3DfDDDD333""""""""""""DwD"3333DUUUDUfwwffUUwfD33DD333DD3D33"""""""""3""""""""""""""33"""""""""""""""33""""333333DDDDUU3""""�""3""""""3UUDD3DUUU3""""""""3"""333""""33"33"3"""""D3D33""3"33DDDDUUUUUfffwwffUDDU3""""""""""""UfwfUfD3"33333DUUUU3DUUD""3""""""33333""33DDUDDD333D3""""""333wU33DDUUUUfwwwwfwffUfUDUDDD33"""""""""""33D"""""33DUDDDUffwUDDDUfwfDD3333333DD3333"""""""333""""""""""333D"3""""""""""""3""""3""333333UDDD""�""3U3""""DDUU33UD3"33""""""""333333"""3""""3"""�""""""""""333"""3""33333DDUUUffwfwwUUfwUDD""""""""""""3"ffwUfUfDD3"333UUU33DDDD"33333333DUDDD3DDDDDDDDD3"""""""""3"DD"33DDDUUUfwwwfUwfUDDDDDDD333"""""""""3D3""""""33DDUDUUUfwfDUUffwfUDD333"3DD3333""""""3333"""""""""3D3"33"""""""""""""""3""3D333D33""""33D3""DDDDD3DD""D3D"""""""""""""""3DD"3333"""333""3"""""""""""D"333"DUD3DUUwwwwUffwfwfUUD3""""""3""""""UUwUDwUDDDDDDUD3D3DDDfD33"3DDUUUUUD3333DDDDDD333Df3""""""33w3"DDD3DDDUDUUUffU̪DDUUDDDDD33""""3""3""UD"""33DDD3DUUDDfwUDUffffUUUD"D3DDDDDD3"3"""3333333""""�""""3"D33"""""""""""33"33D3D3DU3"��""""DUU3"3D33DDD"3DUUD""33"""""""""333D""""33"""""3""""""""""""3""""""D333DUwwfUUfDDUwwwwfUU3"""""33""""3""3ff3UwfUUfwwfUUUUDUUUD"33"D3D3DD3""33"DDD3DU333DU3""""33333ww33DDDD3DDDDDDUUUfUw̪UUUUUUUDDD33"""""33"3U3""3DDDU3DDDDUUwDDDUwffUDD333D3DDDD33"33DDD333333"""""""""D"D3"""""""""""""3""333333Uw"""""""DwwU"3D3DUD33"Uw3D33"""""""""""""3""""3"3""""""""""""""""""""3UfUUDDUUUUUUwwffffD""""333"""333DUDwfffffwUDD3"3DD33"""333D"""""333DU3333DD333U3""""33DDf3"33DDDD3DDDDDUUDUwfUUUUUUUUUDD33""""""3UU""""33UUDD33UUUfUDDUfffUDD33DDUDD3DD3D3DDDD333"""""�"""33""333D3""""""""""""""""""33"DDUUf3""""""""3UUfwDDD3"3UDDDD3""""""""""""3""333""""""""""""""""""""""""3DUUUUDUfffUfwwfwfDU""33"""""33333"Uwf3DwUwwwfffD"""""""3"""D"3U3"""333DUD33333333DD3""33"fD"3DDDDUDDDDDUUUDwwUDDUUUUUUUUUDDD3"""""UU3"""""3DDDD3D3DDUUUwDwfDDD3333D3DD3DD3DD3DDD3333"""""""""""3DD3D3"""""""""""""""""""33"UUfU"""�"""3""""DDDfwDDD3DUDD3D33""""""3D3""""""""""""""""""""""""""""""""DDUUDDDUUUUUDDffwwUDDUDD3"""""3333DwUUUwwwwf3""""""""""3"""3DD3333333"3DD33333D3U3""33333"DDDDDDDDDDDUUUwU3DUUUUUUfUUUUDDD333"33wf"3""""""3DDDDD3D3UUUfDfwwwDDD"33DDDD33DDUDDDDD3333"""""""""3"3"""""""""""""""""""""""33DDD33U3"�"""3""""""3UwU33DDD33Uf33""""3""""""""""3"""""3""""3""""""""""3DDD""33333D333UwwwfDDf3"""3333D33fwwfUDDwf3""""""33""""""""3""33"33333"D3333D3UU""33"3"333DDDD33DDUUUUU""3DUUUUffUUUUUDDD33"3UwU"""""""""""3DDDDDD33DDUUD3fwUwwUD333DUDD33DDUUDDDDD333""""33DD3""3""""""""""33""""""""33DD3D"3"""""D3""3""33UD33DUD33fwD3"3D33""""""""""""""3""""33"""D3""""""""""""3UD3"""""""""3"Dffwffwwww3"""33"3DDfwffUUfwU3"3"""""333"3""3"""""333333"3DD3"3UfUU""""33"D33D3DDDD33DDDUff333"DDUUUUUUUUUUDDDD3"DfD3"3"""""""""""333DD3333DDDUDUwUwf33333DDD3D3DUUDDDDDD33"""""""33""""""""3""""""333UU33"3"�""""D3"""""3333DDD3UDUU33D3D"""D"""3""3D"""""""""""""""33"""""""""""3D33""""""33DffUUUfwU"""3"DD3wwwD""""DD3"""""""D"3"""33""3D3333333D3UfwwfUwU3"D""3"w33D3DDD3DDDDUfwD3333"DDDUUUUUUUUDDDD33Dw33333"3""""""""""333D3333DDDDUfwfDwU3""3U"3333DDDUDDD3333""""""""""""""""""""""33333""3""""""""3""""""""""33DDDD3DDD""333""""""333""""3""""""3"33""""""""3"""""""""3""""""D3"""""""""3DUfUUfwfwf"33333UwwfUDw"""333333""""""D"3""3"""33"3""33UfffDD"3UDD333D""Dw333DDDDD3DDDUUff"3333DDDDUUUUUUUUUUDDDff3"33""3"""""""""""333D33DDDUUfwfUwfUUUDDD3""3DUDDD3D3D""3""""��"""""""""""""""""""3"3DD""3""""""""""""""""""3DDD33DUf33""3""33"""33""""""""""3""""""""3""""""333""""""""""""3"3"""""""""""3DUUUUfwfU3333Dfw3DUfUDfU"333"3"333D333333"""33""33333D3DUU333DUDf3333UD"3ff3333DDDDDDDDfUUwUU33333DDDDUUUUUUUUUUDUwU""""""3"33"""""""""""3333DDUUDUwfUfUwwUUUUD3D"3DUUDD33D33"""""""""""""""""""""""""""33DD""3"""""""""""""""33333DUfDD33"""""33"""33""3"""""""""3"""""""""33"""""""""""3"""""33"""""3DUffUUfwf333wf33UUUDD33333"""3UD3D3D3"D3"""33"3D33DDDUU33DfwfDUD333DUUfD33D3DDDDDDDUUUww33U33333DDDDUUUUUUUUUUfD33""3"""333""""""333DUfwUfD"UUfUDUUU3"D"UfUDD33333"3""""�""""""""""""3""3"""""""""""""3DU3"""""""""""""""""3DUD33DDUDUDD3D"3"""""333""""""""3"""3""""""""333""""""333"""""""""33DfUfUUUUUfDUwfUwwUUD333"""33333DD"33333D"""""3DD333333fDDfwU3DU3D3DfwfwU33D3DDDDDDDUDfwfU3"UDD33DDDDDUUUUUUUUfD333""D""333"""""""3UDUffUfw3""UfUUDUD33DUfUDD333D3""""""""""""""3"""""""""""""""""""3""33"DU3"D3""3"""""""""""3UDD3DDUffwf33"DD3"""3D3""""""3"3U333D"333333""3""3""3"3"""""""""33DUUfUUUfffwwUUDDUfD333""""3"333"33"3D3""""""33DD333333ffwU333UU3UUwwUf333D33DDDDDfUfD3D33DUDDDDDDDDUUUUUUDwwDD3333"33"333"""""""3DfUUUfwf3�3UDUfDD3DDDUUUD3"3333"""""""""3"""""""""""""""""""3""""""""33"33DfwfD3DD"""""""3DUD3DUDwfUffD33"3""""""3""3""""""3"""DUD""DU""D3D""""""""3D""""3"""""""""""333UUUfUUwwDDDwwwwU3""3D3U3"3333333333"""""33DDD3333DwUfU33"UfUUffwUfwwwfD33D3DDDDDDfUU333333UfDDD33DDDDUUUUUDDDD33""D"""33"""3DDfUUUfU"DUDfD3DDDDUUUUD33333"33""""""3"""""""""""""""""""3"""""""""3DDUUwwUUfwf""""33DD33DDUDDD33333"""""""3""""""3"�3""""3DDU"3U3"33333DDD3"""""""""""""""""33"3DDUwffwwU3DffUUUfUUwUDD33D3333333333"""3"DDDD33DDUUUfD"3"3fUfwwwwwU"""3DD3DDDDDUUU3ww333D33"DUffDDUUUDDw3DDDD333""3"""33""""333UfUUfU"�"fUUD3""DDDDDDDD33333"3"""""""""""3""33""""""""""3"""""""333"""""333fwwwwUDUDUfwwU"�"""""3"3DD333UDDDDD"333"""""""""""""""""��""""""DD33UD33DDU3DDU""""""""""3""""""""""333DUffwfDDfU33DUfUffUf33333333DUD333""3"""3"DDDUUDDDD3UD""33"UUUffwwww3"3333DDDDDDDDUUU33""3333"3fwDDDUUUUUDDDDDDDD333"3"3"""""""333DUffww"�"3DwfU"3DD3DDD"3D333333"3"""""""""""""3""""""""""""3""""3"""3""""333"DfwwfD3DDUUDDUfD�""""""""""DDDDUUDUDDD33""""""""""""""3"""33DD"DU""UDDUUUDD3"""33"""3"""3""""""""""""3"333Ufwwf3DDDUUUffUDDDUDw3D3333""3D333333""""3DUffwffUUfU3"""3D3UDDfwwwww"333333333DUDUUUUUfw3""3333"3"fUDDUUDf33DDDDDDDD3333"""3"""""3"""3DDDDUwwf3""33""UUDDDUDD"3DDDDD33333""""""""""""""""""""3"""3"3"""""""33"33""3333UUfD33UDDDUUff"��"""3"""3D333DUUDD333D"""""""""3"""""3"33333DD""3DDDUUff3""""""""3"""3"""""""""3D3UfwDDDDUUUwwUD3DDDUwD3D333333DD3333"3""3DUwf3D33D"""3333DUDUwwwff""333DD33DDDUffUUffU"""3"""""DDDDwf33DDDDDDDDD33"""""333""33""33D33DwfD""""""UDUU33UDDD"33DDD333"33""""""""""""""""""""""""3""""333333"33D333UUD"3DUUUUfww"""DfUDD"""""""DD33DUDDD3333""""""""""""3""""�""""3"3"3D3"3"DD3DDUfU"""""""""3DD"D3"""""D3DDDUwwfDDDDUffUUUDD3DUUwwUfwD3"333DUfD3"3333DUUfDUU33"""33"333DDDUUffww"33"3333DDDDDUfDUfU3""""33"""""wwD3DDDDDDDDDDD33"""33D333DD3333DDDUf"""fUwf3DDDD33D3DDDDDDD3""""""3"""""""""""3"3"""3""""333"3"""33333DUfD33DUfUfwD"3DfUD3"""""""3"33DDDD3333D3"""3"3""""3"""""""""33""""33""33UD33DU3333""""""3DUU3D33"""""3DUDDDffw33UDDffffDDDDDDUUffwfffDDD"DDD3D3"33DDUfwU3Df3""""3""3"333DUDUwwwU"33333DDDDDDDfD"Uf""""3""""3""D̪̪U333D3DDDDDDDD3D3333""33DDDDDDDDUUfwU""DffUD33D""DDDDD3DDDDD3""""""""""3""""""""""""�3""""""3"""""""33333DDUD33DUUfUww3"33""""3"""""""""33"33"33"DD"""3"""""""""""""33""""3"""D3UUD3DD"""""""""""DUf"3D33""""""3DDDDUffwD3DUUUffUDUDDUUDDDDwfUUUD33DD333333DDUUfUfDDDUD""""""""3"DfUDUUD3"3""3DDDDDDDDDfDDU""""""3""DUwfDDDDD33DDDDDDDD3D333""333DDDDDUUDUUDf"D"DUDDUDD333333333DD3DUD""""""""""""""3""""""""""""""""""""333333DD3U333DUfwww"""""3""""""""""""3""33""DDUD""D33""3""""""""""""3"""""""3D"""3UUD"DU""""3"D3333UUUUD3"""""""""33UDDDUfw33DUDUfwDDUUDDDD3D33wUDDfD"3DD3D333DUUUD3wwUDDD3""D3""3D33ffD""""""3DfUUUDDDDUUwf3""""""33fwDDD3DDDDD33DDDDDD3D3D33"""333DUDDfUUD33"33"3D33DUD33333333""DDDDD""""""""""""3D3""3""""""""""""""""""""""""3""33D3333333Uwwwwfff""""3D""""33"""333"""3"3DDDU""DU33"3"""""""""""D"""""""""""""""3DUDDD"""""""""U3D3333"DD""""""""D33DDUDUw333DDDUfDDDUUD333"DUwU3DUf333DDDUDDDDDUD3fwDD3"""""3D33DD"3UwD"""""""33UUUDDDDDDfwf"""""""""UwU33DDDDD3D33DDUDD333D""""3333UDDUUff3"33U"�"D"33UUDD"3D3333333UUDD"""""""""""3UD""""""""""""""""""""""""3333DD33U33DDfwwwfDDU""3""""""3"""""""3""3U33D3"33"DDDDfU"""""""""""""""U3"""""""""""""""333D3DDDU3"""""3UD3"D3DUD""""""""3""DD33DDUUUD"3DDDUfD3D33D33"3"UfU33DUfUDUUffDDUUUfffUD33D3""333"33DUUUUfD""""""33DDDDD3DDUwwD""""""""wfwwfDDfwD33D3DDDDDDD3333"""3333DD33UUfU3"33DD�""3DDUDDD3D333"333"UUDD"3"333"""3"UU3"""""""""""""""""""""""3333DD3D3333UfwffDDfD"""""""3"""""""""""3333333""33"DD3Dfff33""33""3"""3333""""""3"""3"""""3"33DDD3""3DD333DD3D"""""3U33"33"33DUUU3"33DDUUD333D33333DDwD3DDDfUUUUfUUfUUUD3"3"3"""""""DDUfwwfU3""""""""DDDDD333DDww3""""""3wfD3DD3DDDDDDDD3333"""3333D333DUD33"33D3"3D""3DDDDDD"333333333UUU3"""""3"3DU3"""3""""""""""""""""""""3333DD333"33UfUUD33f""33D3"""""""""33"""""3"3333"3333Uf3DDDDD333"3"""""""""""""""33"""33"33U3D333"""UD3D3U3"33""""3D3"""3DUDwU"333DDUD3D333333"3DUD3U33UfUfffwU33333""""""""3UUUUffUD""""""333UDDDDDD3Dff"""""""DwfUDDfw3DDDDDDDDDD333333""33DDDDDDDU""3""DD3"""""UfUDD3D3"""3333D33DUU3"""3333""U33""33""""3""""""""""""""3"""33"UDD"""333DDDDD33UD3D333"""""""""33""""33D333DDD3UU3DUDD3333D"33""""""""""""""""3"""3"33DD33U3"3DD"3UU3333"""""3U33""3333DUf3""3333DUD3333""3"33fUD33"DDUUUfffwfU"33"3""""""""3ffffwwD""""333D333333DDfU""""""3wwwfUDDDwD3Uf3D3DDUDDDD33""""""33DDDDDUU3""3UD3�""""""3UUUD333"""3"33333D3U3"333333"3"333"""""""""""""3"3""""""3D333"333333DDD333f"3D33"""""""""""3"3"""33333D3DUDDDUD333D333333""""""""""""""""3"33Uf""""D33333UUD3""""3""""3333DDDfUfD"3"3D3""""""3"3D33333DD3UUDfwwfDDD333"""3D"""""UUUfUD3"""""333"3333DDDUU""""""3DfwfUUDUUDDfwUUUwUDDDDDDDDD33""""""3DDDDUUU""33U""3333UUD33""""""3D333DUUUDD""""""3""""""""""""""""3""""""""""""3""D3"333333D3333Uw33""""3""3""3""3""""""""3333333DUUD3"3DD"""33""""""""""""""3"""""D333wwf""""3"33"33333""33""""3333DDDfww3"""33""""""33"3DD333333DUUUfwfDDD3"3"""333"D3"33UUUfD3""""3""3"33DDDUD"3""""""3DffUD"""""3333DDUUfwUDDUDD3D33"""""33DDUDDU3"33U"""DUUDDD"""""""""3DD3333Uffw33"""3"""""""""""""""""""""""""""""""3"D3"33333D3333Dw3""""""33"3""""33"""""""""3D3"D33UUD"""3333333""""""""""""""""3U3D33fUfwD"""3"""""3"""""3"""""3"333Dwwffwf""""""""""""3D33333333DUDUUUfwf"3333""3DD""3""DfUUff"""""""""333"33DUfU3"333""""""""DwfD"""""3""333333DUwU3DD33333""""""333DU3""""3U3""DUDDD3"""3""3DD333333"333DffUDD3D33""""3"""""""""""3""""""""""""33"""3D33333"33Uwf"""""3"33D33""3""""""""""""3""33DDD3"3333333D3""""""""""""""D333"3fff3"3UU3"""3"""""""3"33333DfffwwUD"""""""""""3333"333333DUDUUUwwD33D333D3"""""3DDDU33"3""""3D33""3DUffD"""333333""3UUfD""""""""3333333DDwD3D3333333"""""333DD"""3"DD""DUD333333""""33DD""3333333"33DffD"33""""""""""""""""33""""""""""""333""3DD33D3"""DU""""""3"333"3333""""""""33"3DUUDDU3DUD3D333"""""""""""3"""3"""""""33""D""3UU"3DfwD""3"""""""333333UUwwwf"""""""""""""333D333333333DUUfffUDfDDUDDDDD"""""3D3UU3""""3"""D333333UUf3333DD333"333fU3""""""""""""33"33DDfD3333DD3333""3333DD"""33DD"�3DD"33"D3"3"3""3UD"333"33"333D3UfD"3""""""""""3""""""3"""3"3""""""33333333D3333"D3fU3"""33""""3D3333""""""""""3333DDDD3DUUUU3"""""""""""3""33""""""""333"3D3""3DD3UUwf3""3"3"""""33333DUUwfU3""""""""""3D3"3DD3333333DDDUUUUDDDffDDDDD33""""3DDUU333""""""""""3D333DDDUDD3D3"3D3"3DffD3"333333""""3""333DUU33333333""333D3333"""3D3UD��DDDD3""33""""3UU3"333D"3333DDDDffD"""""""""""""""""""""""""""""""3D3333333DD3333DUU"""""D3""""3UU33"""""""""""""33DD33DUDDUUD"3""""""""""""""3D"""33"""3""333333"3DDDUwfUD"""""""""3333DUUUwfUD3"""""""""3D333DD3333333D3DDUDDDDD3ff3DD333"""""DDDDDD3""""""""3"""333UU3333DDD3DDD3"Dff"D333D3DD3"""33"3333DfDD33333"3333333"3""3333DD�"�3D3D3"""""3fUDD3333333""3DDUUfU"""""3ffU""""""""""""""""""""""33"3"33"3333D333DDDD33"""""33"3""3UUD333"""""""33D3D33DfDDD333"3"""""""""""33""3""D"""3"3333333DUDwU333"""3"""""333DDUwfwwfUfD""""3"""""D3"3f33333333DDD3D3333UU3fU3UUD""""""3UDD""3"""""""33333"UUDD"""3D33UD33D3UU"3333333DD"""""""""3DUUD33333333333333""""33""3f"33""""""""3DDU3333"33D333DDDDUDD3""fwwU3D"""""""""""""""""3""""""""3""33DD33DDf33D""""""""3333DUD333""""""""33333333UUUDD333"""""""""33"""""""3""333"33ffUfffwU""""33"""33"3DUUfwwwUD3"""""""""""DDUfUUD"333D333DD3"33DDUDfffDUD""""33DDD""""""""""""""3"DUUU3""3""3333DDDDDwU3""33""33D"""""""3"33DDDDD3333333DD3DD""D33333U""""""3""""""""3"DD3"""""333333DDDfwwDUffUD3333""""""""""""""""3""""""""""333D33D3""""""""333DDDUUD33""""""""""""333333DUfU3333"3""""333""""""""33""333UwffU3"""""""3333DDUfw3wfD333"""""U3"DUfDUwD3""3D3333D333333DUfww3DDD"33DU333"""""3"""""DDDD3"""""3333""3UwfU""""3"33333"""""""3"33DfUDDD3333"DDDD3"""DD33"3f3""""""""""""""""3"D3D"""""""3333DDUfwfDDDDDD3D3"""""""""""""""""333DDD3""""""""""""33UfUUD3"3""""""""33"3D33333UUUD3"""""""3"""""""""""""""33"33UfwwwDD33"""""""""3DUDffDUD33""""""D333DUUUUU"33333"333"3333333DDwffU333333D33""""D"3"333UD3D3"33"3""3""3ffUD""""""""3D33"""""""33DUwUUUDD3333D3DD3"333"""3DU""""""""""""""3"""""""D3""""""3"33DUfwUU33D3DD3""""""""""3""""33DDD3"""""""""""3""3DD333""""""""""3"""33"33333UUfDDD""""""33""""""""""""""""""3DD3DDDf3"DwU3"""""""3DUUUDwwDD3""""3D33D33UDDDDD"33"3""3"3333333333DUDDUU3"333333""""3"333"DUDDDD""3D33D"3UUUU33"""33"333"""""""""333UUDUUfD3DD333UD3"333""33DU""3"""""33""""""3DwwUDDD33333333"""""""""3""""33D3""""""""""""""33DD33""""""333""""""""""3333"3"DUUUDD""""""""""""""""""""""3D"33D3333"3"3"3"""""""3DDUfffw3"3""""33D33D"DD3D333""3333"3"""33333333DDDDDUU3DD33333""""333""33DDD3UD33U33UUDUDDD3"3""3""""""""""""""""33DDDUUfDDD33"DDD333""333DfD""""""""""""3DDUUD333"3333333"""""""""3"3""33D3""""333""33D3333""""""""33"""""""DD"33"3""3UfD33"""""""""3"""""""""33UD""3UD3D""D3"33"3""3DDUfwwwU"3"""""D3333D3"3D"3D3""""333"3""""33333DDD333DDUwfUDD333""""3"33"DDD3D333UU3UDDDDD3333""""33""33"""""3""3333DDUDDffUDDDD"D3""""3333UU3""""33""""""""""""33UUfDDUUDD333"3333Df3"""""""""""""""33333DD"DDD3"""DD33333"""3"33"3"""""""""""""33D3"""""3UDD33"""""""""""""""3"3D33"""""3Uf333"""""""""""3DDUUffwf""""""""D"3""333"3333""""33"""""""333"33DD3""333Uwf333"""33"""333D3DDUD333DUUDDD333"33"333"33"3"""""""D33"3D33DDDDUUUUDD3DDD""""""33UD3D"""D33""""""""""""33DfUUfUDDD3""""DDDUD"""333"3""""3"""333"""333333DD3333"""DDD33D33"""333333"3"""3""""""3D3"""""33DD3D3"""""""""""""""3Uf3"""333DD"D3"""""333"""3DDUUDUffww3""""""3""3D"""3"3333""33"D3"""33""""3"3DD3"33"33UwwfwUD""""""33"""3"3D3UffDDDfDDDD3"3"3333"33"33""""""33""33D3DDDDDUDUUUUDDDDUD""""3"3DUf"3"�"""3""33""""3"""""3fUUUDDDDD""""33D"3f""""33DD3""""33"""333""""333"""D3D3D33UDD3""33"D33333"""""""""33""""3"""""333D333D"""""""""3"""""""33UDD3""3DDUUUfD""""3DDU33"DDDUUDUfwUwwD3"33"""33""""3"3333333"33""3""""D333D33"""""""Dffffwww3"""""""""33D333UUDUUUUD3D33"""3333"3"33"3"""3"3"3333DDDUDDUUDUUDDDDUfD"""""3DDw33"""""33""D"3f"""""�"""""DwffDUDDDDD"333"3"DD"33"""33""""""33""""33"3"333333DDD33333DDD333""""""""""3"33"""""""3""""3DU3"3""""""""""3""3"""3"33333"3333D3DUUU33"""3DffD"3DDDDDDUUUwfUU3"""3"""333""3"""3""3"DD""""""""33DD333"""3"""3DUUfwwf3333""""""33DDDDD33wfDD333"""3"3333333DD3""333"33DUDDUD3UUDUUDDDUDUUD3""""""3Dw3"U""""33"D33DD""""""3UD"3DD33"3"3""""DUwfUfU33""""""3""""""33"3""3"3D33D3D333"33"""""""""""3"""D3""""""""""""DU""""""""""""""""""""3333""""DD333D3333"""""""ffD"3DDD3DDUfUDUwf""""D3"""3""D3"""""""3D333"""""""""3DD""""""""""DDDDfwwww3"33"""""3DDDDDUUDUfU3333""3D"333DD3DD3D3D333333333DfD3DDDDDfDDDDUDD33"""""""3Df33"""""""3"3D"DU""33""3wUD""3D3""3""3DwwUU3"3UD""""""""""""""33"3333333D333D3""""""""""""""""3""3"""""""""33""3""""3"""""""""""3"D"""3DD333D333D33"3Uw33DDDDDDUfwfDUUU""33""""3"Dwf""""""3DDD3"""""""3"""D"""""""""3DDUUDww3"3""""""33DDD3DD3DUU33"D"33333333"""D3""""3D3"33333D33D3DD3DDUDDUDDUD3""333""3"""Uf""3"""3"""33D3"DU3�"33DDD�""""""ff"""""""33"3UUww3"""3DU"""""""""""""3"33""33333"3DD3"3"3""""""""""""33"""""""""""""""3D3""""""""3"""""""33"3"""""DD"""3U3DD3DD3""D""DDUUDDDDDDDUUfffw̻f"3DD"""3ww3"""33333"""""""""333"3D"""""""DD3DDDDfwwfDD"""""333D"33"D3UU33""3U3"""""""""""""""333""333333333D33DDDDUDUDDD"33333""3"UD""""33"""3""3D3DD""U3""""""""""""DU3""""DwwwU""""""33U3""""""""""""""33"333"""333""""""3"""""""""""""3""""""""""""""3""""DD"""""""3""""""3"""3"""33"3"3"DD3D33DDD""3"""""33DDUDDDDDDUffw""33"""wwwD3""33""""""""""""33""""""333D3333DUffwf3""3""3"D333D3DD""33"3""""""""""""""3"33"33D3DU33DDD3UUDUDDD"3D33"3"33""w3"""33""D"""3333"UU3""�""33""""3wwD"""""""3D"33"""""""333D"""""""""3"33333""""33D3"""""""""""""""""3"""3"3""""""""""""DD"33"""""""33""""3D333"33"ff33DD3D3"DU""""""3333DD33D3DUfwUww3"""""""""""33"""""""""3""""D"""""333333"3DUUUfwf3""33""3DDDD333D3"UD3D3""33"""""""""""3"3"DDD3""U3"33DDfUDDD33DD33"3""""""Uf"33""""333"Df33�"�""""""""""DwD"""""""3""3""""""""33""""""""""""""""""""3"3U"""33333"3"3""""""""""""33"""3""""""""""""D3333333""""""""""""""D333333"3UD"333DU3"DDU3"""""""3"33D33UUUfUDDUUfw"""""wwU"""""3"""""""D"""3D""""333D""""3DDUUUfD"3"""""D333"33DDDDDD33U3UwU""33""""""""""""3333333"""3UDUUDD3333"333DD""333""3wU"""3""""""33333UU3""""""""""""3DU33"""""""""33""""""33"""""""""""""""""""3""""""""3333"""3""""""""""333""""""""""""""""33D3333"3D3""D3"""""3"""3DDDDDD3""3fD"333DUU3"DUf3""""""3"""33UwfUD3"DDUDD"""UU3UUU""""""""""3"""""""333333""""3DDDffD3UU3""33DD"3D33333"DDDU33U"33"""""""""""""3333DDDUD3D33DDDDDD3D""3"33U3"333"33""3""""""DDDUDUU3ffU3""""3"""""UfD3""3"""""""33"33"""3"""""""""""""""""333"""33""33""33"""""""33""333"""""""""3"""DD33"333333"""""33D33333333D3"""3U333333UUDD3333""""33"3333DfwfwUD3""U3DUUfUf3w3"3fDUD""""""""""""33D"33""""33DDffU3D3""""3UDDD3"3"""3333"33DD33""""""""""""""33333D3DD"3DDDDDUDDD3333"33"3"333""3wf""""""""3DD33"""fUUUD"UD""""UwD"""""""""""""""""3D"""33"""""3""""""""""""""""""""""""3"""3"""3D"3"""""""3D3""3""""""""""""""DD3"""333""""""3"3UD"""3333DDD333U3"333"DUDDfD"U333DUDDUUfUUDDDDD3""3D33Df3""DUDDD"""""""""""""""""""33""33""""3DDUUfDD333""3D333D333""D33"U3"3DDDUU3""""""""3333"3333DU333"33DUUD333DD""333DD33""""U"3333333""333"DUffU3U""3DfU"""33"3""""""""3""""""""3""""D"""""""""""""""""""""""""3"3"""""3D"""""""33D3"""""""""""""�""""3""3DD3""3333""""""33"fwU""3333DD333"UU"""3"UffwwwwUfUUUffD3333DDD33"3D3"33Dwf"""""DU"UD""""""""""33""""33"3D""""3"3DUUDfU3""D3"""""""3"333"D333DDDUwww3""""""D3""3D3"3DD33D333333D33DDfU333DDUDD3""3D33DD333"3"333DDDUfUfUD3"���"UUD3"""33333333"""""33"""""33""33""""""""""""3"""""""""3"3"33DU3D33""""""""""""""""""""""""""""""""3DD3"33"""""""""""""3w"""33D33333"3Uf3""3UwwUUfUfwfUDDfDDDUD33333DD3DD333333DDfU""3"""3DD3w"""""""""""3"""""""""3""""""33DDww""3"333"""""""33""3""DD""3DDD3D3""""""""3""333DD333""333333UUUU333DDD3"3DUf3DDD3""333"33D3"fDUUUU3""�"DUfD"""""""""""""""""33""33"""D3"""""""""""""""3""3"""""""3""""333333D3"33""33"""""3""""""""DD3"""3""""""DD3333"""3"""""""""""UD3""33"333"33UD""DwUUUUDUUUD"UwD""""3D33"3""""""3D"333Uݪ"D3"3"3D3UwDUff""""""33""""""3""""3UUfD"3D3""""""""""""33333D33333""""""""""""3D3DD33""""3""3wwfDDDDD33"""DDD333D3"""3"""33DfDDDDUD"""DU3""""""3""""""""3D""33""3D""""""""""""""""""3"""""""3""""D3D3"DU3"""3""""""3"""""33DUUDD3""3D""""""3D3"""""""3DDD"""""""3"""3333333""D3"3ffUUUUDD3D33DDD3"3""""3""3"""""""""3333U3D3""3f3UU3DfD33""3U3""""33""""""""""33UDfffUDDUD33""""""""33D333"3"""33"3"33""""""""""""3DUDD333"3D333Dww3DUD"33"3D3w"33"""3""""wDDD33D""U3����""""3""""""""3""""""3U33""""33""""3"""""3""""""""""""""33"3333""333""""3333333DfwwfDDD3""33"""""3""""""""UDD""3"""3333"33"333"3DD3DDwU3DD33333D""3D""3"""33""""""""""""333Dݪ"DD333UU"3DUU33""Df""""""""""""""3DUUfffwwwU33""""3""333333DU"3UD3D"""3"""""""""""""3D3333"Uw333"ff33DD"""""DDw�"3""3"""3"fD33DD3"wD���33""""""""""""""""""3DU""""""3""""""""3"""333""3""""3"3D33D33333D3"""33DDDDUUf3""UD"""""3DDDD""""""""""""""33""333"""""333D33DwwDDD3333DD3""33"""""""3""""""3""""33DfݻU"3"DDD33""DDU3"Uf""""3""""""D3""DDUfUUUfwwwf"3"""""""DDDDDDD333DDD""3""""""""""""""3D33"""3333""fwDDU3""""""DUf""""333""""DUDDDDD3Df"�33"""""""""�""3"�"3D3"""3""333""""""""""""""33"""""""""""3"3D33D33""333UUUff3""3"3"""""3""3DfD3""3D""""""""3"33"3"""33"33""33DwUDDDD3D3fD"""3"""""""""""""""""3U̪U"33UD"3w""3DfD33fD"""""3"""33""""UUUfUUUfffwfDD"""""3DDDUD3D3333DD3333"""""""33""""333333"""""""33333""""Df""""333""UDDUfU3DD�""""""""��"""3U3""33"333"""""""""""""""D3"""3"33U3"33"3D33D3D3DD33Uf̈3"""""""""""""""""D3DD3D"333""""""3D"""""333333"333D3""3wwDD3DD3DD33D3""""3""""""""""""""33̻D"333DDw"""DUf3D3U""""""""""""D"DDD"3DDDUDDDDUUUwUD3""""333"3DD33D333DDDD""""33""3"""33333""""""""""DD""D"""3DwD�"""3UUffUU3��"""""""""""""""3U3333D"333"""""""""""""3"""333""3333U33"""3DDDDDDUDfw̙U""""""""""""""3DDDDDDU3"3D3""""""""""""""33"33333DD"3fwUDD"3D33"3"DDD3"""3""""""3Dff33"33""f""3DfUD""3""""""3""""3""3D"3"33DDDDDDUffffDD""""""""""""3333333DDD333UD33DU"""""33""""""D3""3DD"""3Dw��"DUUfwUU"""""""""""""""""DUD3"33"""333D"""""""""333"""33""333D3D3"33"3DUffw̻D��"""""""""""""""DfUDD33D3""""""33""333""""3D""333333"wwDD333333"3"D3"D3"""""""33DUfD"3"3"3""DD3"DUwD"""""""""3""""D"""3""3"33DDDDDDD3DUwU"""""""""""""""333333DDDDDD33D3D""""""""3"""""3U"DDDff3""""3f""��"ffD33"""33"""D"""""""""3UU3333333333DD33"3333"33"33"3D3D3DfwwfUUDDfwffD3���"""""""""3"""""""DwfU33D33"""""""""3""3"""""3D3D333"33DwUDDD33"333"""3""3D3"""""""""3DUUffwfDU3"33"""U"33Dw3"""""33"""""""""""3333D333DDUfU""""""""""""3"""33"333fUU33"""""D"""""3"""""UD"3"33"3UfU��"�DUD33��""""""3D3""""D""""""3"333DwDD333DUDDDDfD333D333DUDDUUD3DUwffD3wwD�"""�""""""""33"""""���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/radiobutton.rb��������������������������������������������0000644�0001750�0001750�00000003356�11701304107�021307� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header radiobutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/18 17:13:32 $ $Id: radiobutton.rb,v 1.7 2005/07/18 17:13:32 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class RadioButtonSample < SampleWindow def initialize super("radio buttons") set_border_width(10) vbox = Gtk::VBox.new(false, 10) add(vbox) button1 = Gtk::RadioButton.new("button1") vbox.add(button1) button2 = Gtk::RadioButton.new(button1, "button2") vbox.add(button2) button3 = Gtk::RadioButton.new(button1, "button3") vbox.add(button3) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, true) button.can_default = true button.grab_default end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/test.xpm��������������������������������������������������0000644�0001750�0001750�00000003767�11701304107�020143� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 20 19 66 2", /* colors */ ".. c None", ".# c #000000", ".a c #dfdfdf", ".b c #7f7f7f", ".c c #006f6f", ".d c #00efef", ".e c #009f9f", ".f c #004040", ".g c #00bfbf", ".h c #ff0000", ".i c #ffffff", ".j c #7f0000", ".k c #007070", ".l c #00ffff", ".m c #00a0a0", ".n c #004f4f", ".o c #00cfcf", ".p c #8f8f8f", ".q c #6f6f6f", ".r c #a0a0a0", ".s c #7f7f00", ".t c #007f7f", ".u c #5f5f5f", ".v c #707070", ".w c #00f0f0", ".x c #009090", ".y c #ffff00", ".z c #0000ff", ".A c #00afaf", ".B c #00d0d0", ".C c #00dfdf", ".D c #005f5f", ".E c #00b0b0", ".F c #001010", ".G c #00c0c0", ".H c #000f0f", ".I c #00007f", ".J c #005050", ".K c #002f2f", ".L c #dfcfcf", ".M c #dfd0d0", ".N c #006060", ".O c #00e0e0", ".P c #00ff00", ".Q c #002020", ".R c #dfc0c0", ".S c #008080", ".T c #001f1f", ".U c #003f3f", ".V c #007f00", ".W c #00000f", ".X c #000010", ".Y c #00001f", ".Z c #000020", ".0 c #00002f", ".1 c #000030", ".2 c #00003f", ".3 c #000040", ".4 c #00004f", ".5 c #000050", ".6 c #00005f", ".7 c #000060", ".8 c #00006f", ".9 c #000070", "#. c #7f7f80", "## c #9f9f9f", /* pixels */ "........................................", "........................................", "........................................", ".......................#.#.#............", ".....................#.......#...#......", "...............................#.#......", ".......#.#.#.................#.#.#......", ".....#.y.i.y.#.#.#.#.#.#.#..............", ".....#.i.y.i.y.i.y.i.y.i.#..............", ".....#.y.i.y.i.y.i.y.i.y.#..............", ".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....", ".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......", ".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........", ".....#.y.#.s.s.s.s.s.s.s.s.s.#..........", ".....#.#.s.s.s.s.s.s.s.s.s.#............", ".....#.#.#.#.#.#.#.#.#.#.#..............", "........................................", "........................................", "........................................" }; ���������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/layout.rb�������������������������������������������������0000644�0001750�0001750�00000005202�11701304107�020262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header layout.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: layout.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by Minoru Inachi <inachi@earth.interq.or.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class LayoutSample < SampleWindow def initialize super("Gtk::Layout") set_default_size(200, 200) scrolledwindow = Gtk::ScrolledWindow.new add(scrolledwindow) @layout = Gtk::Layout.new(nil, nil) scrolledwindow.add(@layout) # We set step sizes here since GtkLayout does not set # them itself. @layout.hadjustment.step_increment = 10.0 @layout.vadjustment.step_increment = 10.0 @layout.set_events(Gdk::Event::EXPOSURE_MASK) @layout.signal_connect("expose_event") do | w, event | layout_expose_handler(event) end @layout.set_size(1600, 128000) for i in 0..15 do for j in 0..15 do buf = "Button #{i}, #{j}" if ((i + j) % 2) != 0 then button = Gtk::Button.new(buf) else button = Gtk::Label.new(buf) end @layout.put(button, j*100, i*100) button.show end end for i in 16..1279 do buf = "Button #{i}, 0" if (i % 2) != 0 then button = Gtk::Button.new(buf) else button = Gtk::Label.new(buf) end @layout.put(button, 0, i * 100) end end private def layout_expose_handler(event) imin = (event.area.x) / 10 imax = (event.area.x + event.area.width + 9) / 10 jmin = (event.area.y) / 10 jmax = (event.area.y + event.area.height + 9) / 10 for i in imin..imax-1 do for j in jmin..jmax-1 do if ((i+j) % 2) != 0 then @layout.bin_window.draw_rectangle( @layout.style.black_gc, true, 10 * i, 10 * j, 1 + i % 10, 1 + j % 10) end end end false end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/sample.rb�������������������������������������������������0000644�0001750�0001750�00000002717�11701304107�020236� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header sample.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: sample.rb,v 1.9 2005/07/21 17:47:19 mutoh Exp $ =end require 'gtk2' module Sample def destroy super @destroyed = true end def destroyed? @destroyed end end module SampleClass def invoke @singleton = nil unless defined? @singleton @singleton = new if @singleton.nil? or @singleton.destroyed? unless @singleton.visible? @singleton.show_all else @singleton.destroy end end end class SampleWindow < Gtk::Window include Sample extend SampleClass def initialize(title) super(title) @destroyed = false signal_connect("destroy") do destroy end end end class SampleDialog < Gtk::Dialog include Sample extend SampleClass def initialize(title) super(title) @destroyed = false signal_connect("destroy") do destroy end end end OptionMenuItem = Struct.new("OptionMenuItem", :name, :block) def build_option_menu(items, history) omenu = Gtk::OptionMenu.new menu = Gtk::Menu.new group = nil items.size.times do |i| menu_item = Gtk::RadioMenuItem.new(group, items[i].name) menu_item.signal_connect("activate") do |widget| items[i].block.call(widget) end group = menu_item.group menu.append(menu_item) menu_item.active = true if i == history menu_item.show end omenu.menu = menu omenu.history = history omenu end �������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/buttonbox.rb����������������������������������������������0000644�0001750�0001750�00000005576�11701304107�021007� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header buttonbox.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: buttonbox.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Rewritten by Minoru Inachi <inachi@earth.interq.or.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ButtonBoxSample < SampleWindow def initialize super("Button Boxes") signal_connect("destroy"){destroy} set_border_width(10) main_vbox = Gtk::VBox.new add(main_vbox) frame_horz = Gtk::Frame.new("Horizontal Button Boxes") main_vbox.pack_start(frame_horz, true, true, 10) vbox = Gtk::VBox.new vbox.border_width = 10 frame_horz.add(vbox) vbox.pack_start(create_bbox(true, "Spread", 40, Gtk::ButtonBox::SPREAD)) vbox.pack_start(create_bbox(true, "Edge", 40, Gtk::ButtonBox::EDGE), true, true, 5) vbox.pack_start(create_bbox(true, "Start", 40, Gtk::ButtonBox::START), true, true, 5) vbox.pack_start(create_bbox(true, "End", 40, Gtk::ButtonBox::END), true, true, 5) frame_vert = Gtk::Frame.new("Vertical Button Boxes") main_vbox.pack_start(frame_vert, true, true, 10) hbox = Gtk::HBox.new hbox.border_width = 10 frame_vert.add(hbox) hbox.pack_start(create_bbox(false, "Spread", 30, Gtk::ButtonBox::SPREAD)) hbox.pack_start(create_bbox(false, "Edge", 30, Gtk::ButtonBox::EDGE), true, true, 5) hbox.pack_start(create_bbox(false, "Start", 30, Gtk::ButtonBox::START), true, true, 5) hbox.pack_start(create_bbox(false, "End", 30, Gtk::ButtonBox::END), true, true, 5) end def create_bbox(horizontal, title, spacing, layout) frame = Gtk::Frame.new(title) if horizontal then bbox = Gtk::HButtonBox.new else bbox = Gtk::VButtonBox.new end bbox.border_width = 5 frame.add(bbox) bbox.set_layout_style(layout) bbox.set_spacing(spacing) button = Gtk::Button.new("OK") bbox.add(button) button = Gtk::Button.new("Cancel") bbox.add(button) button = Gtk::Button.new("Help") bbox.add(button) frame end end ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/filesel.rb������������������������������������������������0000644�0001750�0001750�00000003574�11701304107�020402� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header filesel.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: filesel.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class FileSelectionSample < Gtk::FileSelection include Sample extend SampleClass def initialize super("file selection dialog") @destroyed = false signal_connect("destroy") do destroy end set_window_position(Gtk::Window::POS_MOUSE) hide_fileop_buttons ok_button.signal_connect("clicked") do puts filename destroy end cancel_button.signal_connect("clicked") do destroy end button = Gtk::Button.new("Hide Fileops") button.signal_connect("clicked") do hide_fileop_buttons end action_area.pack_start(button, false, false, 0) button = Gtk::Button.new("Show Fileops") button.signal_connect("clicked") do show_fileop_buttons end action_area.pack_start(button, false, false, 0) end end ������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/gammacurve.rb���������������������������������������������0000644�0001750�0001750�00000003463�11701304107�021103� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header gammacurve.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: gammacurve.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class GammaCurveSample < SampleWindow include Math def initialize super("Gtk::GammaCurve") set_border_width(10) @curve = Gtk::GammaCurve.new add(@curve) @count = 0 end def update max = 127 + (@count % 2) * 128 @curve.curve.set_range(0, max, 0, max) vec = [] max.times do |i| vec[i] = (127 / sqrt(max)) * sqrt(i) end @curve.curve.set_vector(max, vec) @count += 1 end attr_reader :count def GammaCurveSample.invoke @singleton = new if @singleton.nil? or @singleton.destroyed? @singleton.update unless @singleton.visible? @singleton.show_all end if @singleton.count == 4 @singleton.destroy end end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/Modeller.xpm����������������������������������������������0000644�0001750�0001750�00000007557�11701304107�020730� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * InterfaceModeller_app_2_Tile_xpm[] = { "48 48 66 1", " c None", ". c #86174D344103", "X c #69A651445144", "o c #8617410330C2", "O c #69A6410338E3", "+ c #30C218611861", "@ c #AEBA6DB66185", "# c #71C638E328A2", "$ c #69A634D328A2", "% c #30C228A228A2", "& c #79E73CF330C2", "* c #BEFB9E799E79", "= c #8E3869A66185", "- c #514424921861", "; c #A699A289B6DA", ": c #A6999E79A699", "> c #71C65D756185", ", c #9E799A69A699", "< c #8E3882078E38", "1 c #861779E78617", "2 c #A6999A69AEBA", "3 c #8E388A289658", "4 c #71C675D679E7", "5 c #96588A289E79", "6 c #30C230C238E3", "7 c #C71BC71BC71B", "8 c #9E79A289AEBA", "9 c #AEBAAAAABEFB", "0 c #96589248A699", "q c #A699AAAAB6DA", "w c #AEBAAAAAB6DA", "e c #D75CD34CD75C", "r c #EFBEE79DEFBE", "t c #BEFBB6DABEFB", "y c #B6DABAEAC71B", "u c #AEBAAEBAB6DA", "i c #E79DDB6CDF7D", "p c #96588E389658", "a c #596559656185", "s c #AEBA8E388E38", "d c #CF3CCB2BCF3C", "f c #9E799A699E79", "g c #86177DF78E38", "h c #69A6659571C6", "j c #AEBAAEBABEFB", "k c #96589E799E79", "l c #B6DAA699A699", "z c #E79DC71BC71B", "x c #B6DAB6DAB6DA", "c c #861786179658", "v c #B6DAB2CABEFB", "b c #BEFBAAAAAEBA", "n c #C71BBEFBC71B", "m c #514441034103", "M c #41033CF34103", "N c #492428A228A2", "B c #AEBAA289B6DA", "V c #618530C22081", "C c #69A630C228A2", "Z c #69A630C22081", "A c #596528A22081", "S c #492428A22081", "D c #618528A22081", "F c #596520811861", "G c #69A628A22081", "H c #FFFF14514103", " .X ", " .oO+ ", " @.o#++ ", " @.o$%+ ", " @.&#++ ", " @.o#++ ", " @.o$++ ", " @.&#++ ", " .O#++ ", " *=-$++ ", " ;:>+++ ", " ;,<1% ", " 2,34 ", " 2;,51 ", " 2,,,,6 ", " 7777 28888,6 ", " 77777777 2829,,,06 ", " 9qwwe7rrrrr77rr 828,9tyt,6 ", " uuwriirrieiiieii77pa< 82,8,,,8,06 ", " s=1ttiieeeeded77eufgh>j,8,8,k,0,6 ", " =@lzieeeeee77eeex:fpcg4>9,,,,qjv6 ", " =O=blt7eeee7deenw:ffp<gha:t979;06 ", " =OO@=@zieeee7ex:::fffff0,v72444h6 ", " =OOo&Osst7iee7wkf:f:ff;t721444ham ", " =#&&&&OO@di7eu:ff:fferiv114444hmMX ", " =O&&&..o.sdp33fff:errrii7cc1hhh6mmNX= ", " =O&&&@.o.@sberrrrrriiuxuxnB;44aMmVCO#OX ", " =O&&o@..o.zrrrie777nnxtuxx:x;n:>mV##&&O$mX ", " =O&&o....zrrieieuxunx7txx:nnfwpMmVZ#$ZZZVVN ", " =O&oooo.*rrde77ewxnxxtnw:f4M%M%+NA#$Z$ZZVmN> ", " =Oo&ooo@iree7inxn7nnuuff4h%M>m%S-AZ$CCZDZmSX ", " =O&o.o.@rrn7eulun7xxuwp4mm6ahM%--AZCCZDDDANX ", " =Ooooo.*rixenuwwn7nxupph%M>>h6mAADVVZVVDDANX ", " =O&o.o.zrexwwnwuxxnughX%mahhmMN-AZCCVVDDAAN> ", " *XOoo.*iin7n777xxxtphaM+ama>MSNFVCZZVVDAAAS> ", " 1O..izewxux7nuuux4%++%hha>%N-DDCZZVDAAAASX ", " 1.=ituu:uButnxxuX%>hh>M%++NADZZZVDADAA--X ", " :e7f::lnn7*ppnx6ahm6++mNN-ADCZVDDAAAA-SX ", " 7nupp:wxxg%MMau6%++NmmmADADVVVVVDAA---NX ", " 7uBgh1wwxg6h>m%:MmmVNAVDZVZCVZZDAAAAF-S+X ", " nfgaM%pnwhX6%mXb6$DVVZC$C#C$ZZDVAAA---+NX ", " 27a%MaM47:mN.OoolmODGZ####$$ZZVDDA-----SSX ", " 2gmg<m6p7wmmOo...O$GZ####$$CZVVDAAA----++X ", " qBcaM <gxgmXmo.@.o&$$##$$$CZZZDADA-A-++-NX ", " M6> paMa HX.@@@oZ$###$$CZVDDAAAA---SS+X ", " 43 p=&@@&&$##$CCCVVVAAA--+S+S+%X ", " k =o@.##$VVmmmNNNSSSSSS%XXXX ", " s>OSSNmN>>aaa177777 "}; �������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/wmhints.rb������������������������������������������������0000644�0001750�0001750�00000001774�11701304107�020450� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header wmhints.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: wmhints.rb,v 1.8 2005/07/21 17:47:19 mutoh Exp $ =end require 'sample' class WMHintsSample < SampleWindow def initialize super("WM Hints") realize circles = Gdk::Pixmap.create_from_xbm(window, "circles.xbm") window.set_icon(nil, circles, circles) window.icon_name = "WMHints Test Icon" window.decorations = Gdk::Window::DECOR_ALL | Gdk::Window::DECOR_MENU window.functions = Gdk::Window::FUNC_ALL | Gdk::Window::FUNC_RESIZE vbox = Gtk::VBox.new(false, 10) add(vbox) label = Gtk::Label.new("Try iconizing me!") label.set_size_request(150, 50) vbox.pack_start(label, true, true, 0) vbox.pack_start(Gtk::HSeparator.new, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, true, true, 0) button.can_default = true button.grab_default end end ����ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/button.rb�������������������������������������������������0000644�0001750�0001750�00000007410�11701304107�020263� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header button.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/17 16:55:26 $ $Id: button.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ButtonSample < SampleWindow def initialize super("buttons") box1 = Gtk::VBox.new(false, 0) add(box1) table = Gtk::Table.new(3, 3, false) table.row_spacings = 5 table.column_spacings = 5 table.border_width = 10 box1.pack_start(table, true, true, 0) button = [ Gtk::Button.new("button1"), Gtk::Button.new("button2"), Gtk::Button.new("button3"), Gtk::Button.new("button4"), Gtk::Button.new("button5"), Gtk::Button.new("button6"), Gtk::Button.new("button7"), Gtk::Button.new("button8"), Gtk::Button.new("button9"), ] button[0].signal_connect("clicked") do button_window(button[1]) end table.attach(button[0], 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[1].signal_connect("clicked") do button_window(button[2]) end table.attach(button[1], 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[2].signal_connect("clicked") do button_window(button[3]) end table.attach(button[2], 2, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[3].signal_connect("clicked") do button_window(button[4]) end table.attach(button[3], 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[4].signal_connect("clicked") do button_window(button[5]) end table.attach(button[4], 2, 3, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[5].signal_connect("clicked") do button_window(button[6]) end table.attach(button[5], 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[6].signal_connect("clicked") do button_window(button[7]) end table.attach(button[6], 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[7].signal_connect("clicked") do button_window(button[8]) end table.attach(button[7], 2, 3, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) button[8].signal_connect("clicked") do button_window(button[0]) end table.attach(button[8], 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0) box1.pack_start(Gtk::HSeparator.new, false, true, 0) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.pack_start(box2, false, true, 0) button[9] = Gtk::Button.new("close") button[9].signal_connect("clicked") do destroy end box2.add(button[9]) end private def button_window(button) unless button.visible? button.show else button.hide end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/reparent.rb�����������������������������������������������0000644�0001750�0001750�00000005171�11701304107�020572� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header reparent.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: reparent.rb,v 1.6 2005/07/18 17:13:33 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ReparentSample < SampleWindow def initialize super("reparent") vbox = Gtk::VBox.new(false, 0) add(vbox) box2 = Gtk::HBox.new(false, 5) box2.set_border_width(10) vbox.pack_start(box2, true, true, 0) label = Gtk::Label.new("Hello World") frame = Gtk::Frame.new("Frame 1") box2.pack_start(frame, true, true, 0) framebox1 = Gtk::VBox.new(false, 5) framebox1.border_width = 5 frame.add(framebox1) button = Gtk::Button.new("switch") button.signal_connect("clicked"){ label.reparent(framebox1) } framebox1.pack_start(button, false, true, 0) framebox1.add(label) label.signal_connect("parent_set"){ |child, old_parent| puts "set_parent for \"#{child.class}\":" puts " new parent: \"#{if child.parent then child.parent.class else 'NULL' end}\"," puts " old parent: \"#{if old_parent then old_parent.class else 'NULL' end}\"," puts " data: 42\n" } frame = Gtk::Frame.new("Frame 2") box2.pack_start(frame, true, true, 0) framebox2 = Gtk::VBox.new(false, 5) framebox2.border_width = 5 frame.add(framebox2) button = Gtk::Button.new("switch") button.signal_connect("clicked"){ label.reparent(framebox2) } framebox2.pack_start(button, false, true, 0) vbox.pack_start(Gtk::HSeparator.new, false, true) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, true, 10) button.can_default = true button.grab_default end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/check-n.xpm�����������������������������������������������0000644�0001750�0001750�00000000533�11701304107�020460� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char *openfile[] = { /* width height num_colors chars_per_pixel */ " 10 9 5 1", /* colors */ ". c None", "# c #000000", "y c #666666", "i c #ff1f00", "# c #9f9f9f", /* pixels */ "..........", "........yy", ".......yy.", "......yy..", ".yyy.yy...", "..yyyy....", "...yy.....", "..........", "..........", }; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/colorselect.rb��������������������������������������������0000644�0001750�0001750�00000001404�11701304107�021263� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin colorselect.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project $Id: colorselect.rb,v 1.5 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class ColorSelectionSample < Gtk::ColorSelectionDialog include Sample extend SampleClass def initialize super("color selection dialog") @destroyed = false signal_connect("destroy"){destroy} colorsel.set_has_opacity_control(true) set_window_position(Gtk::Window::POS_MOUSE) colorsel.signal_connect("color_changed"){ colorsel.current_color } ok_button.signal_connect("clicked"){ color = colorsel.current_color colorsel.set_current_color(color) } cancel_button.signal_connect("clicked"){destroy} end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/checkbutton.rb��������������������������������������������0000644�0001750�0001750�00000003521�11701304107�021260� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header checkbutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: checkbutton.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/17 16:55:26 $ $Id: checkbutton.rb,v 1.6 2005/07/17 16:55:26 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class CheckButtonSample < SampleWindow def initialize super("check buttons") box1 = Gtk::VBox.new add(box1) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.add(box2) button = Gtk::CheckButton.new("button1") box2.add(button) button = Gtk::CheckButton.new("button2") box2.add(button) button = Gtk::CheckButton.new("button3") box2.add(button) box1.pack_start(Gtk::HSeparator.new) box2 = Gtk::VBox.new(false, 10) box2.border_width = 10 box1.add(box2) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} box2.add(button) end end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/spinbutton.rb���������������������������������������������0000644�0001750�0001750�00000012576�11701304107�021166� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header spinbutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: spinbutton.rb,v 1.7 2005/07/30 10:24:57 mutoh Exp $ Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class SpinButtonSample < SampleWindow def get_value(spin, label, data) if (data == 1) buf = sprintf("%d", spin.value_as_int) else buf = sprintf("%0.*f", spin.digits, spin.value) end label.text = buf end def initialize super("Gtk::SpinButton") main_vbox = Gtk::VBox.new(false, 5) main_vbox.set_border_width(10) add(main_vbox) frame = Gtk::Frame.new("Not accelerated") main_vbox.pack_start(frame, true, true, 0) vbox = Gtk::VBox.new(false, 0) vbox.set_border_width(5) frame.add(vbox) # Day, month, year spinners hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, true, true, 5) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Day :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(1.0, 1.0, 31.0, 1.0, 5.0, 0.0) spinner = Gtk::SpinButton.new(adj, 0, 0) spinner.wrap = true vbox2.pack_start(spinner, false, true, 0) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Month :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(1.0, 1.0, 12.0, 1.0, 5.0, 0.0) spinner = Gtk::SpinButton.new(adj, 0, 0) spinner.wrap = true vbox2.pack_start(spinner, false, true, 0) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Year :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(1998.0, 0.0, 2100.0, 1.0, 100.0, 0.0) spinner = Gtk::SpinButton.new(adj, 0, 0) spinner.wrap = true spinner.set_size_request(55, -1) vbox2.pack_start(spinner, false, true, 0) frame = Gtk::Frame.new("Accelerated") main_vbox.pack_start(frame, true, true, 0) vbox = Gtk::VBox.new(false, 0) vbox.set_border_width(5) frame.add(vbox) hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, true, 5) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Value :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(0.0, -10000.0, 10000.0, 0.5, 100.0, 0.0) spinner1 = Gtk::SpinButton.new(adj, 1.0, 2) spinner1.set_wrap(true) spinner1.set_size_request(100, -1) spinner1.set_update_policy(Gtk::SpinButton::UPDATE_ALWAYS) vbox2.pack_start(spinner1, false, true, 0) vbox2 = Gtk::VBox.new(false, 0) hbox.pack_start(vbox2, true, true, 5) label = Gtk::Label.new("Digits :") label.set_alignment(0, 0.5) vbox2.pack_start(label, false, true, 0) adj = Gtk::Adjustment.new(2, 1, 5, 1, 1, 0) spinner2 = Gtk::SpinButton.new(adj, 0.0, 0) spinner2.wrap = true adj.signal_connect("value_changed"){ spinner1.digits = spinner2.value_as_int } vbox2.pack_start(spinner2, false, true, 0) hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, true, 5) button = Gtk::CheckButton.new("Snap to 0.5-ticks") button.signal_connect("clicked"){ spinner1.snap_to_ticks = button.active? } vbox.pack_start(button, true, true, 0) button.set_active(true) button2 = Gtk::CheckButton.new("Numeric only input mode") button2.signal_connect("clicked"){ spinner1.numeric = button2.active? } vbox.pack_start(button2, true, true, 0) button2.active = true val_label = Gtk::Label.new("") hbox = Gtk::HBox.new(false, 0) vbox.pack_start(hbox, false, true, 5) button3 = Gtk::Button.new("Value as Int") button3.signal_connect("clicked"){get_value(spinner1, val_label, 1)} hbox.pack_start(button3, true, true, 5) button4 = Gtk::Button.new("Value as Float") button4.signal_connect("clicked"){get_value(spinner1, val_label, 2)} hbox.pack_start(button4, true, true, 5) vbox.pack_start(val_label, true, true, 0) val_label.text = "0" hbox = Gtk::HBox.new(false, 0) main_vbox.pack_start(hbox, false, true, 0) button5 = Gtk::Button.new("Close") button5.signal_connect("clicked"){destroy} hbox.pack_start(button5, true, true, 5) end end ����������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/shapedwindow.rb�������������������������������������������0000644�0001750�0001750�00000004306�11701304107�021445� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header shapedwindow.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: shapedwindow.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ =end require 'sample' class ShapeSampleBasic < Gtk::Window include Sample extend SampleClass @@root_win = nil def initialize(xpm_file, x, y, px, py, type) super(type) @destroyed = false signal_connect("destroy"){destroy} realize @@root_win = Gdk::Window.default_root_window unless @@root_win window.set_events(window.events | Gdk::Event::BUTTON_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK | Gdk::Event::BUTTON_PRESS_MASK) signal_connect("button_press_event") do |w, event| if (event.event_type == Gdk::Event::BUTTON_PRESS) @x = event.x @y = event.y Gtk.grab_add(self) Gdk.pointer_grab(window, true, Gdk::Event::BUTTON_RELEASE_MASK | Gdk::Event::BUTTON_MOTION_MASK | Gdk::Event::POINTER_MOTION_HINT_MASK, nil, nil, 0) end end signal_connect("button_release_event") do Gtk.grab_remove(self) Gdk.pointer_ungrab(0) end signal_connect("motion_notify_event") do xp, yp, mask = @@root_win.pointer move(xp - @x, yp - @y) end move(x, y) style = Gtk::Widget.default_style fixed = Gtk::Fixed.new fixed.set_size_request(100, 100) add(fixed) gdk_pixmap, gdk_pixmap_mask = Gdk::Pixmap::create_from_xpm(window, style.bg(Gtk::STATE_NORMAL), xpm_file) pixmap = Gtk::Image.new(gdk_pixmap, gdk_pixmap_mask) fixed.put(pixmap, px, py) shape_combine_mask(gdk_pixmap_mask, px, py) end end class ShapeSampleModeller < ShapeSampleBasic def initialize super("Modeller.xpm", 440, 140, 0, 0, Gtk::Window::POPUP) end end class ShapeSampleSheets < ShapeSampleBasic def initialize super("FilesQueue.xpm", 580, 170, 0, 0, Gtk::Window::POPUP) end end class ShapeSampleRings < ShapeSampleBasic def initialize super("3DRings.xpm", 460, 270, 25, 25, Gtk::Window::TOPLEVEL) end end ShapesSample = Class.new class << ShapesSample def invoke ShapeSampleModeller.invoke ShapeSampleSheets.invoke ShapeSampleRings.invoke end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/labels.rb�������������������������������������������������0000644�0001750�0001750�00000005046�11701304107�020215� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- =begin header labels.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002,2003 Ruby-GNOME2 Project Team $Id: labels.rb,v 1.7 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class LabelSample < SampleWindow def initialize super("Gtk::Label") set_border_width(5) vbox = Gtk::VBox::new(false, 5) hbox = Gtk::HBox::new(false, 5) hbox.pack_start(vbox, false, false, 0) create_frame("Normal Label", "This is a Normal label", vbox) create_frame("Multi-line Label", "This is a Multi-line label.\nSecond line\nThird line", vbox) create_frame("Left Justified Label", "This is a Left-Justified\nMulti-line label.\nThird line", vbox) do |label| label.justify = Gtk::JUSTIFY_LEFT end create_frame("Right Justified Label", "This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)", vbox) do |label| label.justify = Gtk::JUSTIFY_RIGHT end vbox = Gtk::VBox::new(false, 5) hbox.pack_start(vbox, false, false, 0) create_frame("Line wrapped label", "This is an example of a line-wrapped label. It should not be taking up the entire width allocated to it, but automatically wraps the words to fit. The time has come, for all good men, to come to the aid of their party. The sixth sheik's six sheep's sick.\n It supports multiple paragraphs correctly, and correctly adds many extra spaces. ", vbox) do |label| label.wrap = true end create_frame("Filled, wrapped label", "This is an example of a line-wrapped, filled label. It should be taking up the entire width allocated to it. Here is a seneance to prove my point. Here is another sentence. Here comes the sun, do de do de do.\n This is a new paragraph.\n This is another newer, longer, better paragraph. It is coming to an end, unfortunately.", vbox) do |label| label.justify = Gtk::JUSTIFY_FILL label.wrap = true end create_frame("Underlined label", "This label is underlined!\nThis one is underlined in 日本語の入用quite a funky fashion", vbox) do |label| label.justify = Gtk::JUSTIFY_LEFT label.pattern = "_________________________ _ _________ _ _____ _ __ __ ___ ____ _____" end add(hbox) end def create_frame(title, label_str, vbox) frame = Gtk::Frame::new(title) frame.show label = Gtk::Label::new(label_str) yield(label) if iterator? frame.add(label) vbox.pack_start(frame, false, false, 0) end private :create_frame end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/testgtkrc2������������������������������������������������0000644�0001750�0001750�00000000670�11701304107�020443� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..." # # include "rc-file" # # style <name> [= <name>] # { # <option> # } # # widget <widget_set> style <style_name> # widget_class <widget_class_set> style <style_name> # this file gets included from testgtkrc style 'main_buttons' = 'button' { font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" bg[PRELIGHT] = { 0, 0, 0.75 } } widget "main window.*GtkButton*" style "main_buttons" ������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/togglebutton.rb�������������������������������������������0000644�0001750�0001750�00000003057�11701304107�021470� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header togglebutton.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/21 17:47:19 $ $Id: togglebutton.rb,v 1.6 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ToggleButtonSample < SampleWindow def initialize super("toggle buttons") set_border_width(5) vbox = Gtk::VBox.new(false, 5) add(vbox) (1..3).each do |i| vbox.add(Gtk::ToggleButton.new("button#{i}")) end vbox.pack_start(Gtk::HSeparator.new, false, true, 0) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.add(button) end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/dialog.rb�������������������������������������������������0000644�0001750�0001750�00000001601�11701304107�020203� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin dialog.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: dialog.rb,v 1.6 2005/07/17 16:55:27 mutoh Exp $ =end require 'sample' class DialogSample < SampleDialog def initialize super("Gtk::Dialog") set_default_size(200, 100) button = Gtk::Button.new("OK") button.can_default = true action_area.pack_start(button) button.grab_default button = Gtk::Button.new("Toggle") button.signal_connect("clicked"){label_toggle} button.can_default = true action_area.pack_start(button) @label = nil end private def label_toggle if @label == nil then @label = Gtk::Label.new("Dialog Test") @label.signal_connect("destroy"){@label = nil} @label.set_padding(10, 10) vbox.pack_start(@label) @label.show else @label.destroy end end end �������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/README����������������������������������������������������0000644�0001750�0001750�00000000402�11701304107�017275� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-testgtk - testgtk.c rewritten in Ruby/GTK To run, do ruby testgtk.rb in this directory. ---- (Maintainer from Ruby/GTK2) Masao Mutoh <mutoh@highway.ne.jp> (Original Author of Ruby/GTK version) Hiroshi Igarashi <igarashi@ueda.info.waseda.ac.jp> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/notebook.rb�����������������������������������������������0000644�0001750�0001750�00000016462�11701304107�020577� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header notebook.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: notebook.rb,v 1.11 2005/07/18 17:13:32 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' $book_open_xpm = [ "16 16 4 1", " c None s None", ". c black", "X c #808080", "o c white", " ", " .. ", " .Xo. ... ", " .Xoo. ..oo. ", " .Xooo.Xooo... ", " .Xooo.oooo.X. ", " .Xooo.Xooo.X. ", " .Xooo.oooo.X. ", " .Xooo.Xooo.X. ", " .Xooo.oooo.X. ", " .Xoo.Xoo..X. ", " .Xo.o..ooX. ", " .X..XXXXX. ", " ..X....... ", " .. ", " " ] $book_closed_xpm = [ "16 16 6 1", " c None s None", ". c black", "X c red", "o c yellow", "O c #808080", "# c white", " ", " .. ", " ..XX. ", " ..XXXXX. ", " ..XXXXXXXX. ", ".ooXXXXXXXXX. ", "..ooXXXXXXXXX. ", ".X.ooXXXXXXXXX. ", ".XX.ooXXXXXX.. ", " .XX.ooXXX..#O ", " .XX.oo..##OO. ", " .XX..##OO.. ", " .X.#OO.. ", " ..O.. ", " .. ", " " ] class NotebookSample < SampleWindow def initialize super("notebook") vbox = Gtk::VBox.new(false, 0) add(vbox) @notebook = Gtk::Notebook.new @notebook.signal_connect("switch_page") do |widget, page, num_page| unless destroyed? page_switch(widget, page, num_page) end end @notebook.tab_pos = Gtk::POS_TOP vbox.add(@notebook) @notebook.border_width = 10 @notebook.realize @book_open, @book_open_mask = Gdk::Pixmap::create_from_xpm_d(@notebook.window, nil, $book_open_xpm) @book_closed, @book_closed_mask = Gdk::Pixmap::create_from_xpm_d(@notebook.window, nil, $book_closed_xpm) create_pages(1, 5) vbox.add(Gtk::HSeparator.new) cbutton1 = Gtk::CheckButton.new("popup menu") vbox.add(cbutton1) cbutton1.signal_connect("clicked"){ @notebook.enable_popup = cbutton1.active? } hbox = Gtk::HBox.new(false, 5) hbox.border_width = 10 vbox.pack_start(hbox, false, false, 0) label = Gtk::Label.new("Notebook Style :") hbox.add(label) omenu = build_option_menu([ OptionMenuItem.new("Standard", proc { standard_notebook }), OptionMenuItem.new("No tabs", proc { notabs_notebook }), OptionMenuItem.new("Scrollable", proc { scrollable_notebook }) ], 0) hbox.add(omenu) button = Gtk::Button.new("Show all Pages") hbox.add(button) button.signal_connect('clicked'){ @notebook.each do |w| w.show end } hbox = Gtk::HBox.new(true, 10) hbox.set_border_width(10) vbox.pack_start(hbox, false, true, 0) button = Gtk::Button.new("prev") button.signal_connect("clicked"){ @notebook.prev_page } hbox.pack_start(button, true, true, 0) button = Gtk::Button.new("next") button.signal_connect("clicked"){ @notebook.next_page } hbox.pack_start(button, true, true, 0) button = Gtk::Button.new("rotate") button.signal_connect("clicked"){ @notebook.tab_pos = (@notebook.tab_pos.to_i + 1) % 4 } hbox.pack_start(button, true, true, 0) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, false, false, 5) button.can_default = true button.grab_default end def standard_notebook @notebook.set_show_tabs(true) @notebook.set_scrollable(false) if @notebook.children.size == 15 10.times do @notebook.remove_page(5) end end end def notabs_notebook @notebook.set_show_tabs(false) if @notebook.children.size == 15 10.times do @notebook.remove_page(5) end end end def scrollable_notebook @notebook.set_show_tabs(true) @notebook.set_scrollable(true) if @notebook.children.size == 5 create_pages(6, 15) end end def create_pages(start_page, end_page) start_page.upto(end_page) do |i| buffer = "Page #{i}" child = Gtk::Frame.new(buffer) child.border_width = 10 vbox = Gtk::VBox.new(true, 0) vbox.border_width = 10 child.add(vbox) hbox = Gtk::HBox.new(true, 0) vbox.pack_start(hbox, false, true, 5) button1 = Gtk::CheckButton.new("Fill Tab") hbox.pack_start(button1, true, true, 5) button1.active = true button1.signal_connect('toggled'){ expand, fill, pack = @notebook.query_tab_label_packing(child) @notebook.set_tab_label_packing(child, expand, button1.active?, pack) } button2 = Gtk::CheckButton.new("Expand Tab") hbox.pack_start(button2, true, true, 5) button2.signal_connect('toggled'){ expand, fill, pack = @notebook.query_tab_label_packing(child) @notebook.set_tab_label_packing(child, button2.active?, fill, pack) } button3 = Gtk::CheckButton.new("Pack end") hbox.pack_start(button3, true, true, 5) button3.signal_connect('toggled'){ expand, fill, pack = @notebook.query_tab_label_packing(child) @notebook.set_tab_label_packing(child, expand, fill, if button3.active? then Gtk::PACK_END else Gtk::PACK_START end) } button = Gtk::Button.new("Hide Page") vbox.pack_end(button, false, false, 5) button.signal_connect('clicked'){ child.hide } child.show_all label_box = Gtk::HBox.new(false, 0) pixwid = Gtk::Image.new(@book_closed, @book_closed_mask) label_box.pack_start(pixwid, false, true, 0) pixwid.set_padding(3, 1) label = Gtk::Label.new(buffer) label_box.pack_start(label, false, true, 0) label_box.show_all menu_box = Gtk::HBox.new(false, 0) pixwid = Gtk::Image.new(@book_closed, @book_closed_mask) menu_box.pack_start(pixwid, false, true, 0) pixwid.set_padding(3, 1) label = Gtk::Label.new(buffer) menu_box.pack_start(label, false, true, 0) menu_box.show_all @notebook.append_page_menu(child, label_box, menu_box) end end def set_page_pixmaps(notebook, page_num, pix, mask) child = notebook.get_nth_page(page_num) label = notebook.get_tab_label(child).children[0].set(pix, mask) end def page_switch(notebook, page, page_num) old_page_num = notebook.page return if (page_num == old_page_num) set_page_pixmaps(notebook, page_num, @book_open, @book_open_mask) if (old_page_num != -1) set_page_pixmaps(notebook, old_page_num, @book_closed, @book_closed_mask) end end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/statusbar.rb����������������������������������������������0000644�0001750�0001750�00000005126�11701304107�020762� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header statusbar.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/21 17:47:19 $ $Id: statusbar.rb,v 1.6 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class StatusbarSample < SampleWindow def initialize super("statusbar") set_border_width(5) @counter = 1 vbox = Gtk::VBox.new(false, 5) add(vbox) statusbar = Gtk::Statusbar.new vbox.pack_end(statusbar, true, true, 0) statusbar.signal_connect("text_popped"){|o, mid, text| @counter = 1 if text puts "poped" } statusbar.signal_connect("text_pushed"){|o, mid, text| # do nothing... as of gtk 1.2.6 puts "pushed" } button_push = Gtk::Button.new("push something") vbox.add(button_push) button_push.signal_connect("clicked"){ @counter += 1 statusbar.push(1, "something #{@counter}") } button_pop = Gtk::Button.new("pop") vbox.add(button_pop) button_pop.signal_connect("clicked"){ statusbar.pop(1) } button_steal = Gtk::Button.new("steal #4") vbox.add(button_steal) button_steal.signal_connect("clicked"){ statusbar.remove(1, 4) } button_context = Gtk::Button.new("test contexts") vbox.add(button_context) button_context.signal_connect("clicked"){ ["any context", "idle messages", "some text", "hit the mouse", "hit the mouse2"].each do |str| puts "Gtk::StatusBar: context=\"#{str}\", context_id=#{statusbar.get_context_id(str)}" end } vbox.add(Gtk::HSeparator.new) button_close = Gtk::Button.new("close") button_close.signal_connect("clicked"){destroy} vbox.add(button_close) end end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/progressbar.rb��������������������������������������������0000644�0001750�0001750�00000011624�11701304107�021303� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header progressbar.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: progressbar.rb,v 1.9 2005/07/18 17:13:32 mutoh Exp $ Rewritten by Minoru Inachi <inachi@earth.interq.or.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ProgressBarSample < SampleDialog def initialize super("Gtk::ProgressBar") set_border_width(10) vbox1 = Gtk::VBox.new(false, 5) vbox1.border_width = 10 vbox.add(vbox1) frame = Gtk::Frame.new("Progress") vbox1.add(frame) vbox2 = Gtk::VBox.new(false, 5) frame.add(vbox2) align = Gtk::Alignment.new(0.5, 0.5, 0, 0) vbox2.pack_start(align, FALSE, FALSE, 5) @pbar = Gtk::ProgressBar.new align.add(@pbar) @timer = Gtk.timeout_add(100){progress_timeout} align = Gtk::Alignment.new(0.5, 0.5, 0, 0) vbox2.pack_start(align, false, false, 5); hbox = Gtk::HBox.new(false, 5) align.add(hbox) label = Gtk::Label.new("Label updated by user :") hbox.add(label) @label = Gtk::Label.new("") hbox.add(@label) frame = Gtk::Frame.new("Options") vbox1.add(frame) vbox2 = Gtk::VBox.new(false, 5) frame.add(vbox2) tab = Gtk::Table.new(3, 2, false) vbox2.add(tab) label = Gtk::Label.new("Orientation :"); tab.attach(label, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5) label.set_alignment(0, 0.5) @omenu1 = build_option_menu( [ OptionMenuItem.new("Left-Right", proc { |w| toggle_orientation(w) }), OptionMenuItem.new("Right-Left", proc { |w| toggle_orientation(w) }), OptionMenuItem.new("Bottom-Top", proc { |w| toggle_orientation(w) }), OptionMenuItem.new("Top-Bottom", proc { |w| toggle_orientation(w) }) ], 0) hbox = Gtk::HBox.new(false, 0) tab.attach(hbox, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5); hbox.add(@omenu1) check = Gtk::CheckButton.new("Show text") check.signal_connect("clicked") do |w| toggle_show_text(w) end tab.attach(check, 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5) hbox = Gtk::HBox.new(false, 0) tab.attach(hbox, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5) label = Gtk::Label.new("Text align :") tab.attach(label, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5) label.set_alignment(0, 0.5) hbox = Gtk::HBox.new(false, 0) tab.attach(hbox, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 5, 5) label = Gtk::Label.new("x :") hbox.pack_start(label, false, true, 5) adj = Gtk::Adjustment.new(0.5, 0, 1, 0.1, 0.1, 0) @x_align_spin = Gtk::SpinButton.new(adj, 0, 1) adj.signal_connect("value_changed"){adjust_align} hbox.pack_start(@x_align_spin, false, true, 0) @x_align_spin.sensitive = false label = Gtk::Label.new("y :") hbox.pack_start(label, false, true, 5) adj = Gtk::Adjustment.new(0.5, 0, 1, 0.1, 0.1, 0) @y_align_spin = Gtk::SpinButton.new(adj, 0, 1) adj.signal_connect("value_changed"){adjust_align} hbox.pack_start(@y_align_spin, false, true, 0) @y_align_spin.sensitive = false button = Gtk::Button.new("close") button.signal_connect("clicked"){ Gtk::timeout_remove(@timer) destroy } button.can_default = true self.action_area.add(button) button.grab_default end private def toggle_orientation(rmitem) return unless rmitem.mapped? i = 3 group = rmitem.group group.each do |g| break if g.active? i -= 1 end @pbar.orientation = i end private def progress_timeout new_val = @pbar.fraction + 0.05 new_val = 0.0 if new_val > 1.0 @pbar.fraction = new_val @label.text = "#{(new_val * 100).to_i}" true end private def toggle_show_text(cbutton) @pbar.show_text = cbutton.active? @x_align_spin.sensitive = cbutton.active? @y_align_spin.sensitive = cbutton.active? end private def adjust_align @pbar.text_xalign = @x_align_spin.value @pbar.text_yalign = @y_align_spin.value end end ������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/range.rb��������������������������������������������������0000644�0001750�0001750�00000003515�11701304107�020046� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header range.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team $Id: range.rb,v 1.6 2005/07/18 17:13:32 mutoh Exp $ Rewritten by TAKAHASHI Hitoshi <thitoshi@ne.scphys.kyoto-u.ac.jp> Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class RangeSample < SampleWindow def initialize super("range controls") vbox = Gtk::VBox.new(false, 10) add(vbox) adjustment = Gtk::Adjustment.new(0.0, 0.0, 101.0, 0.1, 1.0, 1.0) scale = Gtk::HScale.new(adjustment) scale.set_size_request(150, 50) scale.update_policy = Gtk::UPDATE_DELAYED scale.digits = 1 scale.draw_value = true vbox.add(scale) scrollbar = Gtk::HScrollbar.new(adjustment) scrollbar.update_policy = Gtk::UPDATE_CONTINUOUS vbox.add(scrollbar) vbox.add(Gtk::HSeparator.new) button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} vbox.pack_start(button, true, true, 0) button.can_default = true button.grab_default end end �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/FilesQueue.xpm��������������������������������������������0000644�0001750�0001750�00000005503�11701304107�021221� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static char * FilesQueue_xpm[] = { "44 31 64 1", " c None", ". c #E79DE38DDF7D", "X c #CF3CC71BCF3C", "o c #71C675D671C6", "O c #B6DAB2CAB6DA", "+ c #CF3CD34CCF3C", "@ c #DF7DE38DE79D", "# c #FFFFFBEEFFFF", "$ c #EFBEEFBEEFBE", "% c #DF7DDB6CDF7D", "& c #BEFBBAEAC71B", "* c #BEFBBAEABEFB", "= c #BEFBC30BC71B", "- c #71C66DB671C6", "; c #D75CD34CD75C", ": c #9E799A699E79", "> c #E79DE38DE79D", ", c #CF3CCB2BC71B", "< c #B6DAB2CABEFB", "1 c #BEFBBAEAB6DA", "2 c #B6DAB6DAB6DA", "3 c #618561856185", "4 c #C71BBAEABEFB", "5 c #AEBAAAAAAEBA", "6 c #965892488E38", "7 c #A699A699A699", "8 c #38E338E338E3", "9 c #F7DEF7DEF7DE", "0 c #E79DEFBEEFBE", "q c #DF7DE38DDF7D", "w c #C71BC71BC71B", "e c #C71BC30BBEFB", "r c #BEFBC30BBEFB", "t c #B6DAAAAAAEBA", "y c #410345144103", "u c #D75CDB6CD75C", "i c #C71BCB2BC71B", "p c #BEFBCB2BBEFB", "a c #9E79A289A699", "s c #86178E388E38", "d c #CF3CCF3CD75C", "f c #CF3CD75CCF3C", "g c #C71BC30BCF3C", "h c #28A22CB228A2", "j c #000000000000", "k c #D75CD34CDF7D", "l c #10400C300820", "z c #E79DEBADEFBE", "x c #DF7DDB6CD75C", "c c #514459655965", "v c #8617861779E7", "b c #DF7DD34CD75C", "n c #CF3CCB2BCF3C", "m c #618555555965", "M c #861786178617", "N c #30C234D330C2", "B c #EFBEEBADE79D", "V c #DF7DDB6CE79D", "C c #D75CE38DD75C", "Z c #514449245144", "A c #186120812081", "S c #79E77DF779E7", "D c #6185659569A6", "F c #9E7992489E79", " .XoOX+ ", " @#$%&*=-o;: ", " @>,=O<12*&:-<3X ", " >%&1*4*2*OO**56758790 ", " 9qX+we=r*&e<<<251t5555yu9 ", " $qu++;ipi=p*=p**2tOOO27a5s<- ", " #9udfXi;,gi&**4**4r*Ot5t55tehj ", " 0qku+u;+d,gg=*=r*&**&<255t<*yl1 ", " $$zq@%xk%uf;,w,i=i=e**r=12tO1=8cvj ", " $@%>.%.%%%xbkx,w+ni,wwrwe*4*1=;8mMNj ", " zz@Bz>>>V%%%C+u;;dfnnfwggi&=&X+yZsNll ", " af#9@B0>q>qqq>xk.;;;kfX+XnXw=g,fycMhhN5 ", " al5#9$$>qzBV.%x%%b;x+fnf+,X,iiqym6NAo-j ", " #roS%#$zz>>V%%xkk%f;;+df,XnwnVZD:8AS-j* ", " D-9Oy*9$Bz>q%qx%%u;x;;dknX+d>Zm:hhSDjr ", " a3o+>S3z#90@@z.%>qCC%uu;ff%@Zm:NhMoj= ", " wlvvo#:3599$>B>q>%%%%+f;fk$ymaalMvjr ", " 0.a--S49mct9$z@.qkkqC;xu%@Zm5AlvSj* ", " ohu%3:Z:9@y609q@@>..>Cx>$Zm5NhMvjr ", " -j797Zv5705y=#$0>>V.%>#Z378AMMj* ", " Zj9Xo-McBXDv%90.%%#9cc78AsMj* ", " 8hM#M-DSF96cvz0>z#c35Nhs6j1 ", " jl9#o63vx#-D###mmt8N66j* ", " 5jc@fZF3o%+ZFDm<8A6FjO ", " :j50sSay<$ss2Nh:FjO ", " 6880&SDMF.rNNFFj1 ", " 8jr#:SFScA6ajO ", " Alr$DSysajO ", " >jy#51:jO ", " %Dy*gjO ", " alla "}; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/scrolledwindow.rb�����������������������������������������0000644�0001750�0001750�00000004072�11701304107�022010� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header scrolledwindow.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Date: 2005/07/21 17:47:19 $ $Id: scrolledwindow.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ScrolledWindowSample < SampleDialog def initialize super("dialog") scrolled_window = Gtk::ScrolledWindow.new scrolled_window.border_width = 10 scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) vbox.add(scrolled_window) table = Gtk::Table.new(20, 20, false) table.row_spacings = 10 table.column_spacings = 10 scrolled_window.add_with_viewport(table) table.focus_hadjustment = scrolled_window.hadjustment table.focus_vadjustment = scrolled_window.vadjustment for i in 0..19 for j in 0..19 buffer = "button (#{i},#{j})" button = Gtk::ToggleButton.new(buffer) table.attach(button, i, i + 1, j, j + 1) end end button = Gtk::Button.new("close") button.signal_connect("clicked"){destroy} action_area.pack_start(button, true, true, 0) set_default_size(300, 300) end end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/circles.xbm�����������������������������������������������0000644�0001750�0001750�00000006335�11701304107�020564� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define circles_width 64 #define circles_height 64 static unsigned char circles_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0xf8, 0x1f, 0x00, 0x20, 0x00, 0x00, 0xff, 0x03, 0xf8, 0x0f, 0x00, 0xff, 0x07, 0x00, 0xfe, 0x03, 0xfc, 0x07, 0xc0, 0xff, 0x1f, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xf0, 0xff, 0x7f, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0x07, 0xfe, 0x03, 0xfc, 0xff, 0xff, 0x01, 0xf8, 0x0f, 0xfe, 0x01, 0xfe, 0x8f, 0xff, 0x03, 0xf0, 0x0f, 0xfe, 0x01, 0xfe, 0x01, 0xfc, 0x03, 0xf0, 0x0f, 0xff, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x1f, 0xff, 0x00, 0x7f, 0x00, 0xf0, 0x07, 0xe0, 0x1f, 0xff, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0xc0, 0x0f, 0x00, 0x80, 0x1f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x81, 0x3f, 0x00, 0xe0, 0x0f, 0xf0, 0x1f, 0xfe, 0x01, 0x7f, 0x00, 0xf0, 0x07, 0xf0, 0x0f, 0xfe, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x0f, 0xfe, 0x03, 0xfe, 0x01, 0xfc, 0x03, 0xf8, 0x0f, 0xfc, 0x03, 0xfe, 0x8f, 0xff, 0x03, 0xf8, 0x07, 0xfc, 0x07, 0xfc, 0xff, 0xff, 0x01, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0xff, 0xff, 0x00, 0xfc, 0x07, 0xf8, 0x0f, 0xf0, 0xff, 0x7f, 0x00, 0xfe, 0x03, 0xf8, 0x1f, 0xc0, 0xff, 0x1f, 0x00, 0xff, 0x03, 0xf0, 0x1f, 0x00, 0xff, 0x07, 0x00, 0xff, 0x01, 0xf0, 0x3f, 0x00, 0x20, 0x00, 0x80, 0xff, 0x01, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/sample/testgtk/toolbar.rb������������������������������������������������0000644�0001750�0001750�00000004771�11701304107�020421� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin header toolbar.rb - a part of testgtk.c rewritten in Ruby/GTK2 Copyright (C) 2002-2005 Ruby-GNOME2 Project Team Rewritten by Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp> $Id: toolbar.rb,v 1.7 2005/07/21 17:47:19 mutoh Exp $ Original Copyright: GTK - The GIMP Toolkit Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =end require 'sample' class ToolbarSample < SampleWindow def initialize super("Toolbar test") toolbar = Gtk::Toolbar.new toolbar.append("Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal", Gtk::Image.new("test.xpm")){ toolbar.orientation = Gtk::ORIENTATION_HORIZONTAL } toolbar.append("Vertical", "Vertical toolbar layout", "Toolbar/Vertical", Gtk::Image.new("test.xpm")){ toolbar.orientation = Gtk::ORIENTATION_VERTICAL } toolbar.append_space toolbar.append("Icons", "Only show toolbar icons", "Toolbar/IconsOnly", Gtk::Image.new("test.xpm")){ toolbar.toolbar_style = Gtk::Toolbar::ICONS } toolbar.append("Text", "Only show toolbar text", "Toolbar/TextOnly", Gtk::Image.new("test.xpm")){ toolbar.toolbar_style = Gtk::Toolbar::TEXT } toolbar.append("Both", "Show toolbar icons and text", "Toolbar/Both", Gtk::Image.new("test.xpm")){ toolbar.toolbar_style = Gtk::Toolbar::BOTH } toolbar.append_space toolbar.append(Gtk::Entry.new, "This is an unusable Gtk::Entry ;)", "Hey don't click me!!!") toolbar.append_space toolbar.append("Enable", "Enable tooltips", nil, Gtk::Image.new("test.xpm")){ toolbar.tooltips = true } toolbar.append("Disable", "Disable tooltips", nil, Gtk::Image.new("test.xpm")){ toolbar.tooltips = false } add(toolbar) end end �������ruby-gnome2-all-2.2.5/gtk2/patches/�����������������������������������������������������������������0000755�0001750�0001750�00000000000�12446223375�015120� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/patches/gtk+-2.24.25-add-missing-exeext-and-fix-directory.diff�����������0000644�0001750�0001750�00000004015�12446223375�026445� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru gtk+-2.24.25.orig/gtk/Makefile.am gtk+-2.24.25/gtk/Makefile.am --- gtk+-2.24.25.orig/gtk/Makefile.am 2014-09-30 05:02:16.000000000 +0900 +++ gtk+-2.24.25/gtk/Makefile.am 2014-12-23 17:04:30.451910604 +0900 @@ -1394,7 +1394,7 @@ gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE) else gtk_update_icon_cache_program = \ - ./gtk-update-icon-cache + ./gtk-update-icon-cache$(EXEEXT) endif gtkbuiltincache.h: @REBUILD@ stamp-icons diff -ru gtk+-2.24.25.orig/modules/input/Makefile.am gtk+-2.24.25/modules/input/Makefile.am --- gtk+-2.24.25.orig/modules/input/Makefile.am 2014-09-30 05:02:17.000000000 +0900 +++ gtk+-2.24.25/modules/input/Makefile.am 2014-12-23 17:05:40.646189376 +0900 @@ -200,10 +200,10 @@ # after the libraries are installed in their final locations. install-data-hook: @if $(RUN_QUERY_IMMODULES_TEST) ; then \ - echo $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \ - $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \ - echo "$(DESTDOR)$(bindir)/gtk-query-immodules-2.0 > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache" ; \ - $(DESTDIR)$(bindir)/gtk-query-immodules-2.0 > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache ; \ + echo $(mkinstalldirs) $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION) ; \ + $(mkinstalldirs) $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION) ; \ + echo "$(DESTDOR)$(bindir)/gtk-query-immodules-2.0$(EXEEXT) > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache" ; \ + $(DESTDIR)$(bindir)/gtk-query-immodules-2.0$(EXEEXT) > $(DESTDIR)$(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/immodules.cache ; \ else \ echo "***" ; \ echo "*** Warning: immodules.cache not built" ; \ @@ -253,7 +253,7 @@ included-modules: $(noinst_LTLIBRARIES) immodules.cache: Makefile.am $(module_LTLIBRARIES) - $(top_builddir)/gtk/gtk-query-immodules-2.0 $(module_LTLIBRARIES) > immodules.cache + $(top_builddir)/gtk/gtk-query-immodules-2.0$(EXEEXT) $(module_LTLIBRARIES) > immodules.cache CLEANFILES = immodules.cache �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/gtk2/patches/gtk+-2.24.22-remove-PRIVATE-from-def.diff������������������������0000644�0001750�0001750�00000015415�12446160551�023521� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru gtk+-2.24.22.orig/gtk/gtk.def gtk+-2.24.22/gtk/gtk.def --- gtk+-2.24.22.orig/gtk/gtk.def 2013-10-11 19:17:52.000000000 +0900 +++ gtk+-2.24.22/gtk/gtk.def 2014-11-22 23:22:14.712803615 +0900 @@ -70,13 +70,11 @@ gtk_accel_map_foreach_unfiltered gtk_accel_map_get gtk_accel_map_get_type - gtk_accel_map_load PRIVATE gtk_accel_map_load_utf8 gtk_accel_map_load_fd gtk_accel_map_load_scanner gtk_accel_map_lock_path gtk_accel_map_lookup_entry - gtk_accel_map_save PRIVATE gtk_accel_map_save_utf8 gtk_accel_map_save_fd gtk_accel_map_unlock_path @@ -1143,26 +1141,21 @@ gtk_expander_set_use_markup gtk_expander_set_use_underline gtk_file_chooser_add_filter - gtk_file_chooser_add_shortcut_folder PRIVATE gtk_file_chooser_add_shortcut_folder_utf8 gtk_file_chooser_add_shortcut_folder_uri gtk_file_chooser_error_quark gtk_file_chooser_get_action - gtk_file_chooser_get_current_folder PRIVATE gtk_file_chooser_get_current_folder_file gtk_file_chooser_get_current_folder_utf8 gtk_file_chooser_get_current_folder_uri gtk_file_chooser_get_extra_widget gtk_file_chooser_get_file - gtk_file_chooser_get_filename PRIVATE gtk_file_chooser_get_filename_utf8 - gtk_file_chooser_get_filenames PRIVATE gtk_file_chooser_get_filenames_utf8 gtk_file_chooser_get_files gtk_file_chooser_get_filter gtk_file_chooser_get_local_only gtk_file_chooser_get_preview_file - gtk_file_chooser_get_preview_filename PRIVATE gtk_file_chooser_get_preview_filename_utf8 gtk_file_chooser_get_preview_uri gtk_file_chooser_get_preview_widget @@ -1178,27 +1171,22 @@ gtk_file_chooser_get_uris gtk_file_chooser_get_use_preview_label gtk_file_chooser_list_filters - gtk_file_chooser_list_shortcut_folders PRIVATE gtk_file_chooser_list_shortcut_folders_utf8 gtk_file_chooser_list_shortcut_folder_uris gtk_file_chooser_remove_filter - gtk_file_chooser_remove_shortcut_folder PRIVATE gtk_file_chooser_remove_shortcut_folder_utf8 gtk_file_chooser_remove_shortcut_folder_uri gtk_file_chooser_select_all gtk_file_chooser_select_file - gtk_file_chooser_select_filename PRIVATE gtk_file_chooser_select_filename_utf8 gtk_file_chooser_select_uri gtk_file_chooser_set_action - gtk_file_chooser_set_current_folder PRIVATE gtk_file_chooser_set_current_folder_file gtk_file_chooser_set_current_folder_utf8 gtk_file_chooser_set_current_folder_uri gtk_file_chooser_set_current_name gtk_file_chooser_set_extra_widget gtk_file_chooser_set_file - gtk_file_chooser_set_filename PRIVATE gtk_file_chooser_set_filename_utf8 gtk_file_chooser_set_filter gtk_file_chooser_set_local_only @@ -1210,7 +1198,6 @@ gtk_file_chooser_set_use_preview_label gtk_file_chooser_unselect_all gtk_file_chooser_unselect_file - gtk_file_chooser_unselect_filename PRIVATE gtk_file_chooser_unselect_filename_utf8 gtk_file_chooser_unselect_uri gtk_file_chooser_dialog_get_type @@ -1240,15 +1227,12 @@ gtk_file_filter_new gtk_file_filter_set_name gtk_file_selection_complete - gtk_file_selection_get_filename PRIVATE gtk_file_selection_get_filename_utf8 - gtk_file_selection_get_selections PRIVATE gtk_file_selection_get_selections_utf8 gtk_file_selection_get_select_multiple gtk_file_selection_get_type gtk_file_selection_hide_fileop_buttons gtk_file_selection_new - gtk_file_selection_set_filename PRIVATE gtk_file_selection_set_filename_utf8 gtk_file_selection_set_select_multiple gtk_file_selection_show_fileop_buttons @@ -1376,7 +1360,6 @@ gtk_icon_source_free gtk_icon_source_get_direction gtk_icon_source_get_direction_wildcarded - gtk_icon_source_get_filename PRIVATE gtk_icon_source_get_filename_utf8 gtk_icon_source_get_icon_name gtk_icon_source_get_pixbuf @@ -1388,7 +1371,6 @@ gtk_icon_source_new gtk_icon_source_set_direction gtk_icon_source_set_direction_wildcarded - gtk_icon_source_set_filename PRIVATE gtk_icon_source_set_filename_utf8 gtk_icon_source_set_icon_name gtk_icon_source_set_pixbuf @@ -1404,20 +1386,17 @@ gtk_icon_info_get_builtin_pixbuf gtk_icon_info_get_display_name gtk_icon_info_get_embedded_rect - gtk_icon_info_get_filename PRIVATE gtk_icon_info_get_filename_utf8 gtk_icon_info_get_type gtk_icon_info_load_icon gtk_icon_info_set_raw_coordinates gtk_icon_theme_add_builtin_icon - gtk_icon_theme_append_search_path PRIVATE gtk_icon_theme_append_search_path_utf8 gtk_icon_theme_error_quark gtk_icon_theme_get_default gtk_icon_theme_get_example_icon_name gtk_icon_theme_get_for_screen gtk_icon_theme_get_icon_sizes - gtk_icon_theme_get_search_path PRIVATE gtk_icon_theme_get_search_path_utf8 gtk_icon_theme_get_type gtk_icon_theme_has_icon @@ -1428,12 +1407,10 @@ gtk_icon_theme_lookup_by_gicon gtk_icon_theme_choose_icon gtk_icon_theme_new - gtk_icon_theme_prepend_search_path PRIVATE gtk_icon_theme_prepend_search_path_utf8 gtk_icon_theme_rescan_if_needed gtk_icon_theme_set_custom_theme gtk_icon_theme_set_screen - gtk_icon_theme_set_search_path PRIVATE gtk_icon_theme_set_search_path_utf8 gtk_icon_view_get_column_spacing gtk_icon_view_get_columns @@ -1514,7 +1491,6 @@ gtk_image_get_type gtk_image_new gtk_image_new_from_animation - gtk_image_new_from_file PRIVATE gtk_image_new_from_file_utf8 gtk_image_new_from_icon_name gtk_image_new_from_icon_set @@ -1524,7 +1500,6 @@ gtk_image_new_from_stock gtk_image_new_from_gicon gtk_image_set_from_animation - gtk_image_set_from_file PRIVATE gtk_image_set_from_file_utf8 gtk_image_set_from_icon_name gtk_image_set_from_icon_set @@ -2300,7 +2275,6 @@ gtk_rc_add_class_style gtk_rc_add_widget_class_style gtk_rc_add_widget_name_style - gtk_rc_add_default_file PRIVATE gtk_rc_add_default_file_utf8 gtk_rc_find_module_in_path gtk_rc_find_pixmap_in_path @@ -2311,7 +2285,6 @@ gtk_rc_get_style gtk_rc_get_style_by_paths gtk_rc_get_theme_dir - gtk_rc_parse PRIVATE gtk_rc_parse_utf8 gtk_rc_parse_color gtk_rc_parse_color_full @@ -2322,7 +2295,6 @@ gtk_rc_reparse_all_for_settings gtk_rc_reset_styles gtk_rc_scanner_new - gtk_rc_set_default_files PRIVATE gtk_rc_set_default_files_utf8 gtk_rc_style_copy gtk_rc_style_get_type @@ -3490,7 +3462,6 @@ gtk_type_unique gtk_type_class gtk_ui_manager_add_ui - gtk_ui_manager_add_ui_from_file PRIVATE gtk_ui_manager_add_ui_from_file_utf8 gtk_ui_manager_add_ui_from_string gtk_ui_manager_ensure_update @@ -3790,7 +3761,6 @@ gtk_window_set_deletable gtk_window_set_default gtk_window_set_default_icon - gtk_window_set_default_icon_from_file PRIVATE gtk_window_set_default_icon_from_file_utf8 gtk_window_set_default_icon_list gtk_window_set_default_icon_name @@ -3806,7 +3776,6 @@ gtk_window_get_has_frame gtk_window_set_has_frame gtk_window_set_icon - gtk_window_set_icon_from_file PRIVATE gtk_window_set_icon_from_file_utf8 gtk_window_set_icon_list gtk_window_set_icon_name ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/�������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�014662� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/test/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12423063747�015651� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/test/test_webkit_gtk_webview.rb������������������������������������0000644�0001750�0001750�00000001740�12423063747�023121� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 class TestWebKitGtkWebView < Test::Unit::TestCase include WebKitGtkTestUtils::Omissions def test_webkit_gtk_webview omit_on_os_x assert_nothing_raised do WebKitGtk::WebView.new end end end ��������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/test/run-test.rb���������������������������������������������������0000755�0001750�0001750�00000004552�12423063747�017770� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2013 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") gio_base = File.join(ruby_gnome2_base, "gio2") atk_base = File.join(ruby_gnome2_base, "atk") pango_base = File.join(ruby_gnome2_base, "pango") gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2") gdk3_base = File.join(ruby_gnome2_base, "gdk3") gtk3_base = File.join(ruby_gnome2_base, "gtk3") gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection") cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject") webkit_gtk_base = File.join(ruby_gnome2_base, "webkit-gtk") modules = [ [glib_base, "glib2"], [gio_base, "gio2"], [atk_base, "atk"], [pango_base, "pango"], [gdk_pixbuf_base, "gdk_pixbuf2"], [gdk3_base, "gdk3"], [gtk3_base, "gtk3"], [gobject_introspection_base, "gobject-introspection"], [cairo_gobject_base, "cairo-gobject"], [webkit_gtk_base, "webkit-gtk"], ] modules.each do |target, module_name| if File.exist?("Makefile") and system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test")) require "gobject-introspection-test-utils" $LOAD_PATH.unshift(File.join(webkit_gtk_base, "test")) require "webkit-gtk-test-utils" require "webkit-gtk" exit Test::Unit::AutoRunner.run(true) ������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/test/webkit-gtk-test-utils/����������������������������������������0000755�0001750�0001750�00000000000�12423063747�022034� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/test/webkit-gtk-test-utils/omissions.rb����������������������������0000644�0001750�0001750�00000001640�12423063747�024405� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2014 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 module WebKitGtkTestUtils module Omissions def omit_on_os_x omit("Skip this test on OS X") if RUBY_PLATFORM =~ /darwin/ end end end ������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/test/webkit-gtk-test-utils.rb��������������������������������������0000644�0001750�0001750�00000002503�12423063747�022361� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "test-unit" require "test/unit/notify" require "webkit-gtk-test-utils/omissions" module WebKitGtkTestUtils def later_version?(major, minor, micro=nil) micro ||= 0 webkit_gtk_version = [ WebKitGtk::MAJOR_VERSION, WebKitGtk::MINOR_VERSION, WebKitGtk::MICRO_VERSION, ] (webkit_gtk_version <=> [major, minor, micro]) >= 0 end def only_webkit_gtk_version(major, minor, micro=nil) micro ||= 0 unless later_version?(major, minor, micro) omit("Require WebKitGtk >= #{major}.#{minor}.#{micro}") end end end ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/Rakefile�����������������������������������������������������������0000644�0001750�0001750�00000010700�12416346617�016337� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- # # Copyright (C) 2013-2014 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 $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/WebKitGTK is a Ruby binding of WebKitGTK+." package.description = "Ruby/WebKitGTK is a Ruby binding of WebKitGTK+." package.dependency.gem.runtime = ["gobject-introspection", "gtk3"] package.dependency.gem.development = ["test-unit-notify"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = [ "glib2", "gobject-introspection", "atk", "pango", "gdk_pixbuf2", "gdk3", "gstreamer", ] package.windows.gobject_introspection_dependencies = [ "atk", "gdk_pixbuf2", "pango", "gdk3", "gstreamer", ] package.external_packages = [ # { # :name => "libjpeg", # :base_name => "jpeg-9a", # :archive_base_name => "jpegsrc.v9a.tar.gz", # :download_base_url => "http://www.ijg.org/files", # :label => "libjpeg", # :windows => { # :configure_args => [], # :built_file => "bin/libjpeg-9.dll", # }, # }, # { # :name => "libwebp", # :download_base_url => "https://webp.googlecode.com/files", # :label => "WebP", # :version => "0.4.0", # :windows => { # :built_file => "bin/libwebp-5.dll", # }, # }, # { # :name => "sqlite-autoconf", # :download_base_url => "http://www.sqlite.org/2014", # :label => "SQLite", # :version => "3080600", # :compression_method => "gz", # :windows => { # :configure_args => [], # :built_file => "bin/libsqlite3-0.dll", # }, # }, # { # :name => "libsoup", # :download_site => :gnome, # :label => "libsoup", # :version => "2.48.0", # :compression_method => "xz", # :windows => { # :configure_args => [ # "--enable-introspection", # "--without-apache-httpd", # ], # :build_concurrently => false, # :patches => [ # "libsoup-2.48.0-remove-nonexistent-symbol.diff", # ], # :built_file => "bin/libsoup-2.4-1.dll", # }, # }, # { # :name => "libiconv", # :label => "iconv", # :version => "1.14", # :download_base_url => "http://ftp.gnu.org/pub/gnu/libiconv", # :compression_method => "gz", # :windows => { # :built_file => "bin/libiconv-2.dll", # }, # }, # { # :name => "libxslt", # :version => "1.1.28", # :download_base_url => "ftp://xmlsoft.org/libxslt", # :compression_method => "gz", # :windows => { # :built_file => "bin/libxslt-1.dll", # :configure_args => [ # "--without-python", # ], # :patches => [ # "libxslt-1.1.28-add-mkdir-fallback.diff", # ], # }, # }, # { # :name => "webkitgtk", # :download_base_url => "http://webkitgtk.org/releases", # :label => "WebKitGTK+", # :version => "2.6.0", # :compression_method => "xz", # :windows => { # :cmake_args => [ # "-DPORT=GTK", # "-DJPEG_INCLUDE_DIR=#{package.windows.absolute_binary_dir}/include", # "-DJPEG_LIBRARY=#{package.windows.absolute_binary_dir}/lib", # "-DENABLE_PLUGIN_PROCESS_GTK2=OFF", # "-DENABLE_X11_TARGET=OFF", # ], # :patches => [ # "webkitgtk-2.6.0-buildable.diff", # ], # }, # }, ] end package_task.define namespace :dependency do desc "Install depenencies" task :install do # TODO: Install gir1.2-webkit-3.0 on Debian. end end task :build => "dependency:install" ����������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/README.md����������������������������������������������������������0000644�0001750�0001750�00000001001�12102213527�016124� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ruby/WebKitGTK Ruby/WebKitGTK is a Ruby binding of WebKitGTK+. ## Requirements * Ruby/GObjectIntrospection and Ruby/GTK3 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/) * [WebKitGTK+](http://webkitgtk.org/) ## Install gem install webkit-gtk ## License Copyright (c) 2013 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. ## Project Website http://ruby-gnome2.sourceforge.jp/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/COPYING.LIB��������������������������������������������������������0000644�0001750�0001750�00000063642�12102213527�016330� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/lib/���������������������������������������������������������������0000755�0001750�0001750�00000000000�12516434313�015432� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/lib/webkit-gtk.rb��������������������������������������������������0000644�0001750�0001750�00000002611�12516434313�020027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "gobject-introspection" require "gtk3" base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) module WebKitGtk class << self def const_missing(name) init if const_defined?(name) const_get(name) else super end end def init class << self remove_method(:init) remove_method(:const_missing) end loader = Loader.new(self) loader.load("WebKit") end end class Loader < GObjectIntrospection::Loader end end �����������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/sample/������������������������������������������������������������0000755�0001750�0001750�00000000000�12147676243�016157� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/sample/brower.rb���������������������������������������������������0000644�0001750�0001750�00000001743�12147676243�020011� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "webkit-gtk" window = Gtk::Window.new window.signal_connect("destroy") do Gtk.main_quit end view = WebKitGtk::WebView.new view.load_uri("http://webkitgtk.org/") window.add(view) window.show_all Gtk.main �����������������������������ruby-gnome2-all-2.2.5/webkit-gtk/patches/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12416346617�016323� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/patches/libsoup-2.48.0-remove-nonexistent-symbol.diff��������������0000644�0001750�0001750�00000000702�12416346617�026532� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru libsoup-2.48.0.orig/libsoup/libsoup-2.4.sym libsoup-2.48.0/libsoup/libsoup-2.4.sym --- libsoup-2.48.0.orig/libsoup/libsoup-2.4.sym 2014-06-18 23:42:51.000000000 +0900 +++ libsoup-2.48.0/libsoup/libsoup-2.4.sym 2014-10-06 21:29:02.421366897 +0900 @@ -348,7 +348,6 @@ soup_server_get_async_context soup_server_get_listener soup_server_get_listeners -soup_server_get_gsocket soup_server_get_port soup_server_get_type soup_server_get_uris ��������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/patches/libxslt-1.1.28-add-mkdir-fallback.diff���������������������0000644�0001750�0001750�00000000627�12257552170�024753� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru libxslt-1.1.28.orig/libxslt/security.c libxslt-1.1.28/libxslt/security.c --- libxslt-1.1.28.orig/libxslt/security.c 2012-09-12 14:58:14.000000000 +0900 +++ libxslt-1.1.28/libxslt/security.c 2013-12-28 19:25:13.615751850 +0900 @@ -39,6 +39,7 @@ #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif +#define mkdir(path, mode) mkdir(path) #endif #ifndef HAVE_STAT ���������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/webkit-gtk/patches/webkitgtk-2.6.0-buildable.diff�����������������������������0000644�0001750�0001750�00000001477�12416346617�023543� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������diff -ru webkitgtk-2.6.0.orig/Source/cmake/FindFontconfig.cmake webkitgtk-2.6.0/Source/cmake/FindFontconfig.cmake --- webkitgtk-2.6.0.orig/Source/cmake/FindFontconfig.cmake 2013-08-04 01:10:40.000000000 +0900 +++ webkitgtk-2.6.0/Source/cmake/FindFontconfig.cmake 2014-10-07 23:40:10.515822164 +0900 @@ -39,14 +39,14 @@ else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) - if (NOT WIN32) + # if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the find_path() and find_library() calls find_package(PkgConfig) pkg_check_modules(PC_FONTCONFIG fontconfig) set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) - endif (NOT WIN32) + # endif (NOT WIN32) find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h PATHS �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/��������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�013410� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/extconf.rb����������������������������������������������������������������0000644�0001750�0001750�00000002222�11701304107�015373� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "vte" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/Rakefile������������������������������������������������������������������0000644�0001750�0001750�00000000622�12446160551�015061� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require 'gnome2/rake/package-task' package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/VTE is a Ruby binding of VTE." package.description = "Ruby/VTE is a Ruby binding of VTE." package.dependency.gem.runtime = ["gtk2"] package.windows.packages = [] package.windows.dependencies = [] end package_task.define ��������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/����������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014202� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/������������������������������������������������������������������0000755�0001750�0001750�00000000000�12446160551�015012� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/extconf.rb��������������������������������������������������������0000644�0001750�0001750�00000003537�12446160551�017015� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin extconf.rb for Ruby/VTE extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "vte" package_id = "vte" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end setup_windows(module_name, base_dir) unless required_pkg_config_package(package_id, :debian => "libvte-dev", :redhat => "vte-devel", :homebrew => "vte", :macports => "vte") exit(false) end ["glib2", "atk", "gtk2"].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 vte_headers = ["vte/vte.h"] have_type("VteTerminalCursorBlinkMode", vte_headers) unless have_macro("VTE_CHECK_VERSION", vte_headers) make_version_header("VTE", package_id, ".") end create_pkg_config_file("Ruby/VTE", package_id) $defs << "-DRUBY_VTE_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 �����������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte.c�����������������������������������������������������������0000644�0001750�0001750�00000003130�11701304107�016263� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte.h" #define RG_TARGET_NAMESPACE mVte void Init_vte(void) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = rb_define_module("Vte"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(VTE_MAJOR_VERSION), INT2FIX(VTE_MINOR_VERSION), INT2FIX(VTE_MICRO_VERSION))); G_DEF_CLASS(VTE_TYPE_TERMINAL_ANTI_ALIAS, "TerminalAntiAlias", RG_TARGET_NAMESPACE); Init_vte_access(RG_TARGET_NAMESPACE); Init_vte_reaper(RG_TARGET_NAMESPACE); Init_vte_terminal(RG_TARGET_NAMESPACE); Init_vte_charattributes(RG_TARGET_NAMESPACE); Init_vte_pty(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte-reaper.c����������������������������������������������������0000644�0001750�0001750�00000002312�11701304107�017540� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte.h" #define RG_TARGET_NAMESPACE cReaper static VALUE rg_m_get(VALUE self) { return GOBJ2RVAL(vte_reaper_get()); } void Init_vte_reaper(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_REAPER, "Reaper", mVte); RG_DEF_MODFUNC(get, 0); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/depend������������������������������������������������������������0000644�0001750�0001750�00000000244�12064346475�016203� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-vte.pc $(pkgconfigdir); \ fi ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte.h�����������������������������������������������������������0000664�0001750�0001750�00000002421�11740310343�016276� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __RBVTE_H__ #define __RBVTE_H__ #include <ruby.h> #include <rbgtk.h> #include <vte/vte.h> #include <vte/vteaccess.h> #include <vte/reaper.h> #ifndef VTE_CHECK_VERSION # include "rbvteversion.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) #define RVAL2TERM(obj) (RVAL2GOBJ(obj)) #define RVAL2COLOR(obj) ((GdkColor *)RVAL2BOXED(obj, GDK_TYPE_COLOR)) #define COLOR2RVAL(obj) (BOXED2RVAL(obj, GDK_TYPE_COLOR)) #define RVAL2AA(obj) (RVAL2GENUM(obj, VTE_TYPE_TERMINAL_ANTI_ALIAS)) #define RVAL2EB(obj) (RVAL2GENUM(obj, VTE_TYPE_TERMINAL_ERASE_BINDING)) #define RVAL2CT(obj) (RVAL2GENUM(obj, GDK_TYPE_CURSOR_TYPE)) #define RVAL2PFD(obj) ((PangoFontDescription*)RVAL2BOXED(self, PANGO_TYPE_FONT_DESCRIPTION)) #define PFD2RVAL(obj) (BOXED2RVAL(obj, PANGO_TYPE_FONT_DESCRIPTION)) G_GNUC_INTERNAL void Init_vte_access(VALUE mVte); G_GNUC_INTERNAL void Init_vte_reaper(VALUE mVte); G_GNUC_INTERNAL void Init_vte_terminal(VALUE mVte); G_GNUC_INTERNAL void Init_vte_charattributes(VALUE mVte); G_GNUC_INTERNAL void Init_vte_pty(VALUE mVte); #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte-pty.c�������������������������������������������������������0000644�0001750�0001750�00000005526�11701304107�017110� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbvte.h" #define RG_TARGET_NAMESPACE cPty #define _SELF(s) (VTE_PTY(RVAL2GOBJ(s))) #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_initialize(VALUE self, VALUE flags_or_fd) { VtePty *pty = NULL; GError *error = NULL; if (TYPE(flags_or_fd) == T_FIXNUM) { pty = vte_pty_new_foreign(NUM2INT(flags_or_fd), &error); } else { pty = vte_pty_new(RVAL2GFLAGS(flags_or_fd, VTE_TYPE_PTY_FLAGS), &error); } if (error) RAISE_GERROR(error); G_INITIALIZE(self, pty); return Qnil; } static VALUE rg_child_setup(VALUE self) { vte_pty_child_setup(_SELF(self)); return self; } static VALUE rg_close(VALUE self) { vte_pty_close(_SELF(self)); return self; } static VALUE rg_size(VALUE self) { int rows, columns; gboolean result; GError *error = NULL; result = vte_pty_get_size(_SELF(self), &rows, &columns, &error); if (error) RAISE_GERROR(error); return rb_ary_new3(2, INT2NUM(rows), INT2NUM(columns)); } static VALUE rg_set_size(VALUE self, VALUE rows, VALUE columns) { gboolean result; GError *error = NULL; result = vte_pty_set_size(_SELF(self), NUM2INT(rows), NUM2INT(columns), &error); if (error) RAISE_GERROR(error); return self; } static VALUE rg_set_utf8(VALUE self, VALUE utf8) { gboolean result; GError *error = NULL; result = vte_pty_set_utf8(_SELF(self), RVAL2CBOOL(utf8), &error); if (error) RAISE_GERROR(error); return self; } #endif void Init_vte_pty(VALUE mVte) { #if VTE_CHECK_VERSION(0, 26, 0) VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_PTY, "Pty", mVte); G_DEF_CLASS(VTE_TYPE_PTY_ERROR, "Error", RG_TARGET_NAMESPACE); G_DEF_CLASS(VTE_TYPE_PTY_FLAGS, "Flags", RG_TARGET_NAMESPACE); RG_DEF_METHOD(initialize, 1); RG_DEF_METHOD(child_setup, 0); RG_DEF_METHOD(close, 0); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(set_utf8, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte-terminalaccessible.c����������������������������������������0000644�0001750�0001750�00000002543�11701304107�022121� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte.h" #define RG_TARGET_NAMESPACE cTerminalAccessible static VALUE rg_initialize(VALUE self, VALUE terminal) { G_INITIALIZE(self, vte_terminal_accessible_new(RVAL2TERM(terminal))); return Qnil; } void Init_vte_access(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_TERMINAL_ACCESSIBLE, "TerminalAccessible", mVte); RG_DEF_METHOD(initialize, 1); G_DEF_SETTERS(RG_TARGET_NAMESPACE); } �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte-terminal.c��������������������������������������������������0000664�0001750�0001750�00000073511�11740310343�020112� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte.h" #include <stdarg.h> #include <pwd.h> #define RG_TARGET_NAMESPACE cTerminal #define _SELF(s) (VTE_TERMINAL(RVAL2GOBJ(s))) static ID id_new, id_call; static char ** rval2cstrary(VALUE ary) { long i, len; char **result; if (NIL_P(ary)) return NULL; len = RARRAY_LEN(ary); result = ALLOC_N(char *, len + 1); for (i = 0; i < len; i++) { result[i] = g_strdup(RVAL2CSTR(RARRAY_PTR(ary)[i])); } result[i] = NULL; return result; } static void free_cstrary(char **ary) { long i; if (!ary) return; for (i = 0; ary[i] != NULL; i++) { g_free(ary[i]); } g_free(ary); } static VALUE attrary2rval(GArray *attrs) { long i, len; VALUE rb_attrs, rb_class; len = attrs->len; rb_attrs = rb_ary_new2(len); rb_class = rb_const_get(rb_const_get(rb_cObject, rb_intern("Vte")), rb_intern("CharAttributes")); for (i = 0; i < len; i++) { VteCharAttributes *attr; attr = &g_array_index(attrs, VteCharAttributes, i); rb_ary_push(rb_attrs, rb_funcall(rb_class, id_new, 6, LONG2NUM(attr->row), LONG2NUM(attr->column), COLOR2RVAL(&(attr->fore)), COLOR2RVAL(&(attr->back)), CBOOL2RVAL(attr->underline), CBOOL2RVAL(attr->strikethrough))); } return rb_attrs; } static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, vte_terminal_new()); return Qnil; } #if VTE_CHECK_VERSION(0, 26, 0) static VALUE fork_command_default_argv(void) { struct passwd *pwd; const char *shell = NULL; pwd = getpwuid(getuid()); if (pwd != NULL) shell = pwd->pw_shell; if (shell == NULL) shell = g_getenv("SHELL") ? g_getenv("SHELL") : "/bin/sh"; return rb_ary_new3(1, CSTR2RVAL(shell)); } static VALUE fork_command_full(int argc, VALUE *argv, VALUE self) { VALUE options, rb_pty_flags, rb_working_directory, rb_command_argv, rb_envv, rb_spawn_flags; int pty_flags, spawn_flags; char *working_directory; char **command_argv; char **envv; GPid child_pid; gboolean result; GError *error = NULL; rb_scan_args(argc, argv, "01", &options); rbg_scan_options(options, "pty_flags", &rb_pty_flags, "working_directory", &rb_working_directory, "argv", &rb_command_argv, "envv", &rb_envv, "spawn_flags", &rb_spawn_flags, NULL); pty_flags = NIL_P(rb_pty_flags) ? VTE_PTY_DEFAULT : RVAL2GFLAGS(rb_pty_flags, VTE_TYPE_PTY_FLAGS); working_directory = NIL_P(rb_working_directory) ? NULL : RVAL2CSTR(rb_working_directory); command_argv = rval2cstrary(NIL_P(rb_command_argv) ? fork_command_default_argv() : rb_command_argv); envv = rval2cstrary(rb_envv); spawn_flags = NIL_P(rb_spawn_flags) ? G_SPAWN_CHILD_INHERITS_STDIN | G_SPAWN_SEARCH_PATH : NUM2INT(rb_spawn_flags); result = vte_terminal_fork_command_full(_SELF(self), pty_flags, working_directory, command_argv, envv, spawn_flags, NULL, NULL, &child_pid, &error); free_cstrary(command_argv); free_cstrary(envv); if (error) RAISE_GERROR(error); return INT2NUM(child_pid); } #endif static VALUE rg_fork_command(int argc, VALUE *argv, VALUE self) { VALUE rb_command, rb_command_argv, rb_envv, rb_directory; VALUE lastlog, utmp, wtmp; char *command; char **command_argv; char **envv; char *directory; pid_t pid; rb_scan_args(argc, argv, "07", &rb_command, &rb_command_argv, &rb_envv, &rb_directory, &lastlog, &utmp, &wtmp); #if VTE_CHECK_VERSION(0, 26, 0) if (argc == 0 || TYPE(rb_command) == T_HASH) return fork_command_full(1, &rb_command, self); rb_warn("'fork_commad(command, argv, envv, directory, lastlog, utmp, wtmp)' style" " has been deprecated since version 0.26." " Use 'fork_commad(options = {})' style."); #endif command = NIL_P(rb_command) ? NULL : RVAL2CSTR(rb_command); command_argv = rval2cstrary(rb_command_argv); envv = rval2cstrary(rb_envv); directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory); pid = vte_terminal_fork_command(RVAL2TERM(self), command, command_argv, envv, directory, NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog), NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp), NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp)); free_cstrary(command_argv); free_cstrary(envv); return INT2NUM(pid); } static VALUE rg_fork_pty(int argc, VALUE *argv, VALUE self) { VALUE rb_envv, rb_directory, lastlog, utmp, wtmp; char **envv; char *directory; pid_t pid; rb_scan_args(argc, argv, "05", &rb_envv, &rb_directory, &lastlog, &utmp, &wtmp); envv = rval2cstrary(rb_envv); directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory); pid = vte_terminal_forkpty(RVAL2TERM(self), envv, directory, NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog), NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp), NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp)); free_cstrary(envv); return INT2NUM(pid); } static VALUE rg_feed(VALUE self, VALUE data) { glong length; length = RSTRING_LEN(data); if (length > 0) { vte_terminal_feed(RVAL2TERM(self), RSTRING_PTR(data), length); } return self; } static VALUE rg_feed_child(VALUE self, VALUE data) { glong length; length = RSTRING_LEN(data); if (length > 0) { vte_terminal_feed_child(RVAL2TERM(self), RSTRING_PTR(data), length); } return self; } static VALUE rg_feed_child_binary(VALUE self, VALUE data) { glong length; length = RSTRING_LEN(data); if (length > 0) { vte_terminal_feed_child_binary(RVAL2TERM(self), RSTRING_PTR(data), length); } return self; } static VALUE rg_copy_clipboard(VALUE self) { vte_terminal_copy_clipboard(RVAL2TERM(self)); return self; } static VALUE rg_paste_clipboard(VALUE self) { vte_terminal_paste_clipboard(RVAL2TERM(self)); return self; } static VALUE rg_copy_primary(VALUE self) { vte_terminal_copy_primary(RVAL2TERM(self)); return self; } static VALUE rg_paste_primary(VALUE self) { vte_terminal_paste_primary(RVAL2TERM(self)); return self; } static VALUE rg_set_size(VALUE self, VALUE columns, VALUE rows) { vte_terminal_set_size(RVAL2TERM(self), NUM2LONG(columns), NUM2LONG(rows)); return self; } static VALUE rg_set_audible_bell(VALUE self, VALUE is_audible) { vte_terminal_set_audible_bell(RVAL2TERM(self), RVAL2CBOOL(is_audible)); return self; } static VALUE rg_audible_bell_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_audible_bell(RVAL2TERM(self))); } static VALUE rg_set_visible_bell(VALUE self, VALUE is_visible) { vte_terminal_set_visible_bell(RVAL2TERM(self), RVAL2CBOOL(is_visible)); return self; } static VALUE rg_visible_bell_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_visible_bell(RVAL2TERM(self))); } static VALUE rg_set_scroll_background(VALUE self, VALUE scroll) { vte_terminal_set_scroll_background(RVAL2TERM(self), RVAL2CBOOL(scroll)); return self; } static VALUE rg_set_scroll_on_output(VALUE self, VALUE scroll) { vte_terminal_set_scroll_on_output(RVAL2TERM(self), RVAL2CBOOL(scroll)); return self; } static VALUE rg_set_scroll_on_keystroke(VALUE self, VALUE scroll) { vte_terminal_set_scroll_on_keystroke(RVAL2TERM(self), RVAL2CBOOL(scroll)); return self; } static VALUE rg_set_color_dim(VALUE self, VALUE dim) { vte_terminal_set_color_dim(RVAL2TERM(self), RVAL2COLOR(dim)); return self; } static VALUE rg_set_color_bold(VALUE self, VALUE bold) { vte_terminal_set_color_bold(RVAL2TERM(self), RVAL2COLOR(bold)); return self; } static VALUE rg_set_color_foreground(VALUE self, VALUE foreground) { vte_terminal_set_color_foreground(RVAL2TERM(self), RVAL2COLOR(foreground)); return self; } static VALUE rg_set_color_background(VALUE self, VALUE background) { vte_terminal_set_color_background(RVAL2TERM(self), RVAL2COLOR(background)); return self; } static VALUE rg_set_color_cursor(VALUE self, VALUE cursor) { vte_terminal_set_color_cursor(RVAL2TERM(self), NIL_P(cursor) ? NULL : RVAL2COLOR(cursor)); return self; } static VALUE rg_set_color_highlight(VALUE self, VALUE highlight) { vte_terminal_set_color_highlight(RVAL2TERM(self), NIL_P(highlight) ? NULL : RVAL2COLOR(highlight)); return self; } static VALUE rg_set_colors(VALUE self, VALUE foreground, VALUE background, VALUE rb_palette) { glong i, len; GdkColor *palette; len = RARRAY_LEN(rb_palette); if (!(len == 0 || len == 8 || len == 16 || len == 24)) { char *inspect; inspect = RVAL2CSTR(rb_palette); rb_raise(rb_eArgError, "palette size must be 0, 8, 16 or 24: %s", inspect); } palette = ALLOCA_N(GdkColor, len); for (i = 0; i < len; i++) { GdkColor *color; color = RVAL2COLOR(RARRAY_PTR(rb_palette)[i]); palette[i] = *color; } vte_terminal_set_colors(RVAL2TERM(self), RVAL2COLOR(foreground), RVAL2COLOR(background), palette, len); return self; } static VALUE rg_set_default_colors(VALUE self) { vte_terminal_set_default_colors(RVAL2TERM(self)); return self; } static VALUE rg_set_background_image(VALUE self, VALUE image_or_path) { if (RVAL2CBOOL(rb_obj_is_kind_of(image_or_path, rb_cString))) { vte_terminal_set_background_image_file(RVAL2TERM(self), RVAL2CSTR(image_or_path)); } else { vte_terminal_set_background_image(RVAL2TERM(self), RVAL2GOBJ(image_or_path)); } return self; } static VALUE rg_set_background_tint_color(VALUE self, VALUE color) { vte_terminal_set_background_tint_color(RVAL2TERM(self), RVAL2COLOR(color)); return self; } static VALUE rg_set_background_saturation(VALUE self, VALUE saturation) { vte_terminal_set_background_saturation(RVAL2TERM(self), NUM2DBL(saturation)); return self; } static VALUE rg_set_background_transparent(VALUE self, VALUE transparent) { vte_terminal_set_background_transparent(RVAL2TERM(self), RVAL2CBOOL(transparent)); return self; } static VALUE rg_set_cursor_blinks(VALUE self, VALUE blink) { #if VTE_CHECK_VERSION(0, 18, 0) VteTerminalCursorBlinkMode mode; mode = RVAL2CBOOL(blink) ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF; vte_terminal_set_cursor_blink_mode(RVAL2TERM(self), mode); #else vte_terminal_set_cursor_blinks(RVAL2TERM(self), RVAL2CBOOL(blink)); #endif return self; } #if VTE_CHECK_VERSION(0, 18, 0) static VALUE rg_set_cursor_blink_mode(VALUE self, VALUE rb_mode) { VteTerminalCursorBlinkMode mode; mode = RVAL2GENUM(rb_mode, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE); vte_terminal_set_cursor_blink_mode(RVAL2TERM(self), mode); return self; } static VALUE rg_cursor_blink_mode(VALUE self) { VteTerminalCursorBlinkMode mode; mode = vte_terminal_get_cursor_blink_mode(RVAL2TERM(self)); return GENUM2RVAL(mode, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE); } #endif #if VTE_CHECK_VERSION(0, 19, 1) static VALUE rg_set_cursor_shape(VALUE self, VALUE rb_shape) { VteTerminalCursorShape shape; shape = RVAL2GENUM(rb_shape, VTE_TYPE_TERMINAL_CURSOR_SHAPE); vte_terminal_set_cursor_shape(RVAL2TERM(self), shape); return self; } static VALUE rg_cursor_shape(VALUE self) { VteTerminalCursorShape shape; shape = vte_terminal_get_cursor_shape(RVAL2TERM(self)); return GENUM2RVAL(shape, VTE_TYPE_TERMINAL_CURSOR_SHAPE); } #if !VTE_CHECK_VERSION(0, 20, 0) static VALUE rg_pty(VALUE self) { return INT2NUM(vte_terminal_get_pty(RVAL2TERM(self))); } #endif static VALUE rg_child_exit_status(VALUE self) { return INT2NUM(vte_terminal_get_child_exit_status(RVAL2TERM(self))); } #endif static VALUE rg_set_scrollback_lines(VALUE self, VALUE lines) { vte_terminal_set_scrollback_lines(RVAL2TERM(self), NUM2LONG(lines)); return self; } static VALUE rg_im_append_menuitems(VALUE self, VALUE menushell) { vte_terminal_im_append_menuitems(RVAL2TERM(self), RVAL2GOBJ(menushell)); return self; } static VALUE rg_set_font(int argc, VALUE *argv, VALUE self) { VALUE font_desc_or_name, rb_antialias; VteTerminalAntiAlias antialias = VTE_ANTI_ALIAS_USE_DEFAULT; VteTerminal *term; rb_scan_args(argc, argv, "11", &font_desc_or_name, &rb_antialias); term = RVAL2TERM(self); if (!NIL_P(rb_antialias)) antialias = RVAL2AA(rb_antialias); if (rb_obj_is_kind_of(font_desc_or_name, rb_cString)) { char *name; name = RVAL2CSTR(font_desc_or_name); if (NIL_P(rb_antialias)) vte_terminal_set_font_from_string(term, name); else vte_terminal_set_font_from_string_full(term, name, antialias); } else { PangoFontDescription *font_desc; font_desc = RVAL2PFD(font_desc_or_name); if (NIL_P(rb_antialias)) vte_terminal_set_font(term, font_desc); else vte_terminal_set_font_full(term, font_desc, antialias); } return self; } static VALUE rg_font(VALUE self) { PangoFontDescription *font_desc; font_desc = (PangoFontDescription *)vte_terminal_get_font(RVAL2TERM(self)); return PFD2RVAL(font_desc); } static VALUE rg_using_xft_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_using_xft(RVAL2TERM(self))); } static VALUE rg_set_allow_bold(VALUE self, VALUE allow_bold) { vte_terminal_set_allow_bold(RVAL2TERM(self), RVAL2CBOOL(allow_bold)); return self; } static VALUE rg_allow_bold_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_allow_bold(RVAL2TERM(self))); } static VALUE rg_has_selection_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_has_selection(RVAL2TERM(self))); } static VALUE rg_set_word_chars(VALUE self, VALUE word_chars) { vte_terminal_set_word_chars(RVAL2TERM(self), NIL_P(word_chars) ? NULL : RVAL2CSTR(word_chars)); return self; } static VALUE rg_word_char_p(VALUE self, VALUE c) { return CBOOL2RVAL(vte_terminal_is_word_char(RVAL2TERM(self), NUM2UINT(c))); } static VALUE rg_set_backspace_binding(VALUE self, VALUE binding) { vte_terminal_set_backspace_binding(RVAL2TERM(self), RVAL2EB(binding)); return self; } static VALUE rg_set_delete_binding(VALUE self, VALUE binding) { vte_terminal_set_delete_binding(RVAL2TERM(self), RVAL2EB(binding)); return self; } static VALUE rg_mouse_autohide_p(VALUE self) { return CBOOL2RVAL(vte_terminal_get_mouse_autohide(RVAL2TERM(self))); } static VALUE rg_set_mouse_autohide(VALUE self, VALUE setting) { vte_terminal_set_mouse_autohide(RVAL2TERM(self), RVAL2CBOOL(setting)); return self; } static VALUE rg_reset(VALUE self, VALUE full, VALUE clear_history) { vte_terminal_reset(RVAL2TERM(self), RVAL2CBOOL(full), RVAL2CBOOL(clear_history)); return self; } static gboolean term_is_selected_cb(VteTerminal *terminal, glong column, glong row, gpointer data) { gboolean result = TRUE; VALUE callback = (VALUE)data; if (!NIL_P(callback)) { VALUE rb_result; rb_result = rb_funcall(callback, id_call, 3, GOBJ2RVAL(terminal), LONG2NUM(column), LONG2NUM(row)); result = RVAL2CBOOL(rb_result); } return result; } static VALUE rg_get_text(int argc, VALUE *argv, VALUE self) { VALUE get_attrs, include_trailing_spaces, proc, rb_text; GArray *attrs = NULL; char *text; rb_scan_args(argc, argv, "02&", &get_attrs, &include_trailing_spaces, &proc); if (get_attrs != Qfalse) attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes)); if (RVAL2CBOOL(include_trailing_spaces)) { text = vte_terminal_get_text_include_trailing_spaces( RVAL2TERM(self), term_is_selected_cb, (gpointer)proc, attrs); } else { text = vte_terminal_get_text(RVAL2TERM(self), term_is_selected_cb, (gpointer)proc, attrs); } rb_text = CSTR2RVAL(text); free(text); if (attrs) { VALUE rb_attrs; rb_attrs = attrary2rval(attrs); g_array_free(attrs, TRUE); return rb_ary_new3(2, rb_text, rb_attrs); } else { return rb_text; } } static VALUE rg_get_text_range(int argc, VALUE *argv, VALUE self) { VALUE start_row, start_col, end_row, end_col, get_attrs, proc, rb_text; GArray *attrs = NULL; char *text; rb_scan_args(argc, argv, "41&", &start_row, &start_col, &end_row, &end_col, &get_attrs, &proc); if (get_attrs != Qfalse) attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes)); text = vte_terminal_get_text_range(RVAL2TERM(self), NUM2LONG(start_row), NUM2LONG(start_col), NUM2LONG(end_row), NUM2LONG(end_col), term_is_selected_cb, (gpointer)proc, attrs); rb_text = CSTR2RVAL(text); free(text); if (attrs) { VALUE rb_attrs; rb_attrs = attrary2rval(attrs); g_array_free(attrs, TRUE); return rb_ary_new3(2, rb_text, rb_attrs); } else { return rb_text; } } static VALUE rg_cursor_position(VALUE self) { glong column, row; vte_terminal_get_cursor_position(RVAL2TERM(self), &column, &row); return rb_ary_new3(2, LONG2NUM(column), LONG2NUM(row)); } static VALUE rg_match_clear_all(VALUE self) { vte_terminal_match_clear_all(RVAL2TERM(self)); return self; } static VALUE rg_match_add(VALUE self, VALUE match) { return INT2NUM(vte_terminal_match_add(RVAL2TERM(self), RVAL2CSTR(match))); } static VALUE rg_match_set_cursor(VALUE self, VALUE tag, VALUE cursor) { if (NIL_P(cursor) || RVAL2GTYPE(cursor) == GDK_TYPE_CURSOR) { vte_terminal_match_set_cursor(RVAL2TERM(self), NUM2INT(tag), RVAL2GOBJ(cursor)); } else if (RVAL2GTYPE(cursor) == GDK_TYPE_CURSOR_TYPE) { vte_terminal_match_set_cursor_type(RVAL2TERM(self), NUM2INT(tag), RVAL2CT(cursor)); #if VTE_CHECK_VERSION(0, 17, 1) } else { vte_terminal_match_set_cursor_name(_SELF(self), NUM2INT(tag), RVAL2CSTR(cursor)); #endif } return self; } static VALUE rg_match_remove(VALUE self, VALUE tag) { vte_terminal_match_remove(RVAL2TERM(self), NUM2INT(tag)); return self; } static VALUE rg_match_check(VALUE self, VALUE column, VALUE row) { char *string; int tag; string = vte_terminal_match_check(RVAL2TERM(self), NUM2LONG(column), NUM2LONG(row), &tag); if (string) { VALUE rb_string; rb_string = CSTR2RVAL(string); free(string); return rb_ary_new3(2, rb_string, INT2NUM(tag)); } else { return Qnil; } } #if !VTE_CHECK_VERSION(0, 20, 0) static VALUE rg_set_emulation(VALUE self, VALUE emulation) { vte_terminal_set_emulation(RVAL2TERM(self), RVAL2CSTR(emulation)); return self; } static VALUE rg_emulation(VALUE self) { return CSTR2RVAL(vte_terminal_get_emulation(RVAL2TERM(self))); } #endif static VALUE rg_default_emulation(VALUE self) { return CSTR2RVAL(vte_terminal_get_default_emulation(RVAL2TERM(self))); } #if !VTE_CHECK_VERSION(0, 20, 0) static VALUE rg_set_encoding(VALUE self, VALUE encoding) { vte_terminal_set_encoding(RVAL2TERM(self), RVAL2CSTR(encoding)); return self; } static VALUE rg_encoding(VALUE self) { return CSTR2RVAL(vte_terminal_get_encoding(RVAL2TERM(self))); } #endif static VALUE rg_status_line(VALUE self) { return CSTR2RVAL(vte_terminal_get_status_line(RVAL2TERM(self))); } static VALUE rg_padding(VALUE self) { int xpad, ypad; vte_terminal_get_padding(RVAL2TERM(self), &xpad, &ypad); return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad)); } #if !VTE_CHECK_VERSION(0, 20, 0) static VALUE rg_set_pty(VALUE self, VALUE pty_master) { vte_terminal_set_pty(RVAL2TERM(self), NUM2INT(pty_master)); return self; } #endif static VALUE rg_adjustment(VALUE self) { return GOBJ2RVAL(vte_terminal_get_adjustment(RVAL2TERM(self))); } static VALUE rg_char_width(VALUE self) { return LONG2NUM(vte_terminal_get_char_width(RVAL2TERM(self))); } static VALUE rg_char_height(VALUE self) { return LONG2NUM(vte_terminal_get_char_height(RVAL2TERM(self))); } static VALUE rg_char_descent(VALUE self) { return LONG2NUM(vte_terminal_get_char_descent(RVAL2TERM(self))); } static VALUE rg_char_ascent(VALUE self) { return LONG2NUM(vte_terminal_get_char_ascent(RVAL2TERM(self))); } static VALUE rg_row_count(VALUE self) { return LONG2NUM(vte_terminal_get_row_count(RVAL2TERM(self))); } static VALUE rg_column_count(VALUE self) { return LONG2NUM(vte_terminal_get_column_count(RVAL2TERM(self))); } static VALUE rg_window_title(VALUE self) { return CSTR2RVAL(vte_terminal_get_window_title(RVAL2TERM(self))); } static VALUE rg_icon_title(VALUE self) { return CSTR2RVAL(vte_terminal_get_icon_title(RVAL2TERM(self))); } #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_pty_new(VALUE self, VALUE flags) { VtePty *result; GError *error = NULL; result = vte_terminal_pty_new(_SELF(self), RVAL2GFLAGS(flags, VTE_TYPE_PTY_FLAGS), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(result); } #endif #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_search_find_next(VALUE self) { gboolean result; result = vte_terminal_search_find_next(_SELF(self)); return CBOOL2RVAL(result); } #endif #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_search_find_previous(VALUE self) { gboolean result; result = vte_terminal_search_find_previous(_SELF(self)); return CBOOL2RVAL(result); } #endif #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_search_get_wrap_around_p(VALUE self) { gboolean result; result = vte_terminal_search_get_wrap_around(_SELF(self)); return CBOOL2RVAL(result); } #endif #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_search_set_wrap_around(VALUE self, VALUE wrap_around) { vte_terminal_search_set_wrap_around(_SELF(self), RVAL2CBOOL(wrap_around)); return self; } #endif #if VTE_CHECK_VERSION(0, 16, 0) static VALUE rg_select_all(VALUE self) { vte_terminal_select_all(_SELF(self)); return self; } #endif #if VTE_CHECK_VERSION(0, 16, 0) static VALUE rg_select_none(VALUE self) { vte_terminal_select_none(_SELF(self)); return self; } #endif static VALUE rg_set_opacity(VALUE self, VALUE opacity) { vte_terminal_set_opacity(_SELF(self), NUM2UINT(opacity)); return self; } #if VTE_CHECK_VERSION(0, 26, 0) static VALUE rg_watch_child(VALUE self, VALUE child_pid) { vte_terminal_watch_child(_SELF(self), NUM2INT(child_pid)); return self; } #endif #if VTE_CHECK_VERSION(0, 24, 0) static VALUE rg_write_contents(int argc, VALUE *argv, VALUE self) { VALUE stream, flags, rb_cancellable; GCancellable *cancellable; gboolean result; GError *error = NULL; rb_scan_args(argc, argv, "21", &stream, &flags, &rb_cancellable); cancellable = NIL_P(rb_cancellable) ? NULL : RVAL2GOBJ(rb_cancellable); result = vte_terminal_write_contents(_SELF(self), RVAL2GOBJ(stream), RVAL2GENUM(flags, VTE_TYPE_TERMINAL_WRITE_FLAGS), cancellable, &error); if (error) RAISE_GERROR(error); return CBOOL2RVAL(result); } #endif void Init_vte_terminal(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; id_new = rb_intern("new"); id_call = rb_intern("call"); RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_TERMINAL, "Terminal", mVte); G_DEF_CLASS(VTE_TYPE_TERMINAL_ERASE_BINDING, "EraseBinding", RG_TARGET_NAMESPACE); #if VTE_CHECK_VERSION(0, 18, 0) G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, "CursorBlinkMode", RG_TARGET_NAMESPACE); #endif #if VTE_CHECK_VERSION(0, 19, 1) G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_SHAPE, "CursorShape", RG_TARGET_NAMESPACE); #endif #if VTE_CHECK_VERSION(0, 24, 0) G_DEF_CLASS(VTE_TYPE_TERMINAL_WRITE_FLAGS, "WriteFlags", RG_TARGET_NAMESPACE); #endif RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD(fork_command, -1); RG_DEF_METHOD(fork_pty, -1); RG_DEF_METHOD(feed, 1); RG_DEF_METHOD(feed_child, 1); RG_DEF_METHOD(feed_child_binary, 1); RG_DEF_METHOD(copy_clipboard, 0); RG_DEF_METHOD(paste_clipboard, 0); RG_DEF_METHOD(copy_primary, 0); RG_DEF_METHOD(paste_primary, 0); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(set_audible_bell, 1); RG_DEF_METHOD_P(audible_bell, 0); RG_DEF_METHOD(set_visible_bell, 1); RG_DEF_METHOD_P(visible_bell, 0); RG_DEF_METHOD(set_scroll_background, 1); RG_DEF_METHOD(set_scroll_on_output, 1); RG_DEF_METHOD(set_scroll_on_keystroke, 1); RG_DEF_METHOD(set_color_dim, 1); RG_DEF_METHOD(set_color_bold, 1); RG_DEF_METHOD(set_color_foreground, 1); RG_DEF_METHOD(set_color_background, 1); RG_DEF_METHOD(set_color_cursor, 1); RG_DEF_METHOD(set_color_highlight, 1); RG_DEF_METHOD(set_colors, 3); RG_DEF_METHOD(set_default_colors, 0); RG_DEF_METHOD(set_background_image, 1); RG_DEF_METHOD(set_background_tint_color, 1); RG_DEF_METHOD(set_background_saturation, 1); RG_DEF_METHOD(set_background_transparent, 1); RG_DEF_METHOD(set_cursor_blinks, 1); #if VTE_CHECK_VERSION(0, 18, 0) RG_DEF_METHOD(set_cursor_blink_mode, 1); RG_DEF_METHOD(cursor_blink_mode, 0); #endif #if VTE_CHECK_VERSION(0, 19, 1) RG_DEF_METHOD(set_cursor_shape, 1); RG_DEF_METHOD(cursor_shape, 0); #if !VTE_CHECK_VERSION(0, 20, 0) RG_DEF_METHOD(pty, 0); #endif RG_DEF_METHOD(child_exit_status, 0); #endif RG_DEF_METHOD(set_scrollback_lines, 1); RG_DEF_METHOD(im_append_menuitems, 1); RG_DEF_METHOD(set_font, -1); RG_DEF_METHOD(font, 0); RG_DEF_METHOD_P(using_xft, 0); RG_DEF_METHOD(set_allow_bold, 1); RG_DEF_METHOD_P(allow_bold, 0); RG_DEF_METHOD_P(has_selection, 0); RG_DEF_ALIAS("have_selection?", "has_selection?"); RG_DEF_METHOD(set_word_chars, 1); RG_DEF_METHOD_P(word_char, 1); RG_DEF_METHOD(set_backspace_binding, 1); RG_DEF_METHOD(set_delete_binding, 1); RG_DEF_METHOD_P(mouse_autohide, 0); RG_DEF_METHOD(set_mouse_autohide, 1); RG_DEF_METHOD(reset, 2); RG_DEF_METHOD(get_text, -1); RG_DEF_METHOD(get_text_range, -1); RG_DEF_METHOD(cursor_position, 0); RG_DEF_METHOD(match_clear_all, 0); RG_DEF_METHOD(match_add, 1); RG_DEF_METHOD(match_set_cursor, 2); RG_DEF_METHOD(match_remove, 1); RG_DEF_METHOD(match_check, 2); #if !VTE_CHECK_VERSION(0, 20, 0) RG_DEF_METHOD(set_emulation, 1); RG_DEF_METHOD(emulation, 0); #endif RG_DEF_METHOD(default_emulation, 0); #if !VTE_CHECK_VERSION(0, 20, 0) RG_DEF_METHOD(set_encoding, 1); RG_DEF_METHOD(encoding, 0); #endif RG_DEF_METHOD(status_line, 0); RG_DEF_METHOD(padding, 0); #if !VTE_CHECK_VERSION(0, 20, 0) RG_DEF_METHOD(set_pty, 1); #endif RG_DEF_METHOD(adjustment, 0); RG_DEF_METHOD(char_width, 0); RG_DEF_METHOD(char_height, 0); RG_DEF_METHOD(char_descent, 0); RG_DEF_METHOD(char_ascent, 0); RG_DEF_METHOD(row_count, 0); RG_DEF_METHOD(column_count, 0); RG_DEF_METHOD(window_title, 0); RG_DEF_METHOD(icon_title, 0); #if VTE_CHECK_VERSION(0, 26, 0) RG_DEF_METHOD(pty_new, 1); RG_DEF_METHOD(search_find_next, 0); RG_DEF_METHOD(search_find_previous, 0); RG_DEF_METHOD_P(search_get_wrap_around, 0); RG_DEF_METHOD(search_set_wrap_around, 1); RG_DEF_ALIAS("search_wrap_around=", "search_set_wrap_around"); #endif #if VTE_CHECK_VERSION(0, 16, 0) RG_DEF_METHOD(select_all, 0); RG_DEF_METHOD(select_none, 0); #endif RG_DEF_METHOD(set_opacity, 1); #if VTE_CHECK_VERSION(0, 26, 0) RG_DEF_METHOD(watch_child, 1); #endif #if VTE_CHECK_VERSION(0, 24, 0) RG_DEF_METHOD(write_contents, -1); #endif G_DEF_SETTERS(RG_TARGET_NAMESPACE); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/ext/vte/rbvte-charattributes.c��������������������������������������������0000644�0001750�0001750�00000004532�11701304107�021314� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2006-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 "rbvte.h" #define RG_TARGET_NAMESPACE cCharAttributes static ID id_row, id_column, id_fore, id_back, id_underline, id_strikethrough; static VALUE rg_initialize(VALUE self, VALUE row, VALUE column, VALUE fore, VALUE back, VALUE underline, VALUE strikethrough) { rb_ivar_set(self, id_row, row); rb_ivar_set(self, id_column, column); rb_ivar_set(self, id_fore, fore); rb_ivar_set(self, id_back, back); rb_ivar_set(self, id_underline, underline); rb_ivar_set(self, id_strikethrough, strikethrough); return Qnil; } static VALUE rg_underline_p(VALUE self) { return rb_ivar_get(self, id_underline); } static VALUE rg_strikethrough_p(VALUE self) { return rb_ivar_get(self, id_strikethrough); } void Init_vte_charattributes(VALUE mVte) { VALUE RG_TARGET_NAMESPACE; id_row = rb_intern("@row"); id_column = rb_intern("@column"); id_fore = rb_intern("@fore"); id_back = rb_intern("@back"); id_underline = rb_intern("@underline"); id_strikethrough = rb_intern("@strikethrough"); RG_TARGET_NAMESPACE = rb_define_class_under(mVte, "CharAttributes", rb_cObject); RG_DEF_METHOD(initialize, 6); RG_DEF_ATTR("row", TRUE, FALSE, TRUE); RG_DEF_ATTR("column", TRUE, FALSE, TRUE); RG_DEF_ATTR("fore", TRUE, FALSE, TRUE); RG_DEF_ATTR("back", TRUE, FALSE, TRUE); RG_DEF_ALIAS("foreground", "fore"); RG_DEF_ALIAS("background", "back"); RG_DEF_METHOD_P(underline, 0); RG_DEF_METHOD_P(strikethrough, 0); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/COPYING.LIB���������������������������������������������������������������0000644�0001750�0001750�00000063642�12257552170�015071� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/lib/����������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014150� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/lib/vte.rb����������������������������������������������������������������0000644�0001750�0001750�00000000072�11701304107�015272� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������require "gtk2" require "vte.so" require "vte/deprecated" ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/lib/vte/������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014746� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/lib/vte/deprecated.rb�����������������������������������������������������0000644�0001750�0001750�00000000637�11701304107�017401� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������module Vte extend GLib::Deprecatable define_deprecated_const 'TerminalEraseBinding', 'Vte::Terminal::EraseBinding' define_deprecated_const 'TerminalCursorBlinkMode', 'Vte::Terminal::CursorBlinkMode' define_deprecated_const 'TerminalCursorShape', 'Vte::Terminal::CursorShape' class Terminal extend GLib::Deprecatable define_deprecated_method 'match_set_cursor_type', 'match_set_cursor' end end �������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/README��������������������������������������������������������������������0000644�0001750�0001750�00000001247�11701304107�014266� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Ruby/VTE ======== Ruby/VTE is a Ruby binding of VTE. Requirements ------------ Ruby: http://www.ruby-lang.org/ VTE [*]: http://www.gnome.org/ Ruby/GTK2: http://ruby-gnome2.sourceforge.net/ [*]: 0.12.1 or later is required. Install ------- 0. install ruby and VTE. 1. ruby extconf.rb 2. make 3. su 4. make install Copying ------- Copyright (c) 2002-2006 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/sample/�������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014663� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/sample/terminal.rb��������������������������������������������������������0000755�0001750�0001750�00000001271�11701304107�017027� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin terminal.rb - Ruby/VTE sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: terminal.rb,v 1.2 2006/06/17 13:27:51 mutoh Exp $ =end require "vte" window = Gtk::Window.new("Terminal sample") window.signal_connect("destroy"){Gtk.main_quit} terminal = Vte::Terminal.new terminal.set_font("Monospace 16", Vte::TerminalAntiAlias::FORCE_ENABLE) terminal.signal_connect("child-exited") do |widget| Gtk.main_quit end terminal.signal_connect("window-title-changed") do |widget| window.title = terminal.window_title end terminal.fork_command window.add(terminal) window.show_all Gtk.main ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/vte/sample/multiterm.rb�������������������������������������������������������0000755�0001750�0001750�00000005117�11701304107�017241� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby =begin multiterm.rb - Ruby/VTE sample script. Copyright (c) 2006 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: multiterm.rb,v 1.2 2006/06/17 13:27:51 mutoh Exp $ =end require "vte" class MultiTerm def initialize @terminals = [] init_window add_terminal end def run @window.show_all @notebook.get_nth_page(@notebook.page).grab_focus end private def init_window @window = Gtk::Window.new("MultiTerm sample") @window.signal_connect("destroy") do |widget| Gtk.main_quit end init_notebook @window.add(@notebook) end def init_notebook @notebook = Gtk::Notebook.new @last_page_index = nil @notebook.signal_connect_after("switch-page") do |widget, page, i| max_page_index = widget.n_pages - 1 if max_page_index > 0 and i == max_page_index widget.page = @last_page_index end end @notebook.signal_connect("switch-page") do |widget, page, i| @last_page_index ||= i terminal = widget.get_nth_page(i) if terminal.respond_to?(:window_title) @last_page_index = i update_window_title(terminal.window_title) end end @notebook.tab_reorderable = true if @notebook.respond_to?(:tab_reorderable=) @notebook.scrollable = true init_new_tab_label dummy = Gtk::EventBox.new @notebook.append_page(dummy, @new_tab_label) end def init_new_tab_label @new_tab_label = Gtk::EventBox.new @new_tab_label.signal_connect("button-press-event") do |widget, event| add_terminal @notebook.page = @last_page_index true end # @new_tab_label.set_size_request(30, -1) image = Gtk::Image.new(Gtk::Stock::NEW, Gtk::IconSize::MENU) image.show @new_tab_label.add(image) @new_tab_label end def destroy @window.destroy end def add_terminal terminal = Vte::Terminal.new terminal.signal_connect("child-exited") do |widget| @notebook.remove_page(@notebook.page_num(widget)) @terminals.delete(widget) destroy if @terminals.empty? end terminal.signal_connect("window-title-changed") do |widget| @notebook.set_tab_label_text(widget, widget.window_title) update_window_title(widget.window_title) end terminal.set_font("Monospace 14") terminal.fork_command terminal.show last = @notebook.n_pages @notebook.insert_page(last - 1, terminal) @terminals << terminal end def update_window_title(title) @window.title = title if title end end multi_term = MultiTerm.new multi_term.run Gtk.main �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/��������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�013371� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/test/���������������������������������������������������������������������0000755�0001750�0001750�00000000000�12124610262�014344� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/test/atk-test-utils.rb����������������������������������������������������0000644�0001750�0001750�00000001522�12124610262�017563� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2013 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 require "test-unit" require "test/unit/notify" module AtkTestUtils end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/test/run-test.rb����������������������������������������������������������0000755�0001750�0001750�00000002766�12124610262�016470� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby # # Copyright (C) 2013 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 ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..") ruby_gnome2_base = File.expand_path(ruby_gnome2_base) glib_base = File.join(ruby_gnome2_base, "glib2") atk_base = File.join(ruby_gnome2_base, "atk") modules = [ [glib_base, "glib2"], [atk_base, "atk"] ] modules.each do |target, module_name| if system("which make > /dev/null") `make -C #{target.dump} > /dev/null` or exit(false) end $LOAD_PATH.unshift(File.join(target, "ext", module_name)) $LOAD_PATH.unshift(File.join(target, "lib")) end $LOAD_PATH.unshift(File.join(glib_base, "test")) require "glib-test-init" $LOAD_PATH.unshift(File.join(atk_base, "test")) require "atk-test-utils" require "atk" exit Test::Unit::AutoRunner.run(true) ����������ruby-gnome2-all-2.2.5/atk/test/test-text-rectangle.rb�����������������������������������������������0000644�0001750�0001750�00000001741�12124610262�020577� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- # # Copyright (C) 2013 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 class TestAtkRectangle < Test::Unit::TestCase include AtkTestUtils def test_width rectangle = Atk::TextRectangle.new(0, 10, 20, 30) assert_equal(20, rectangle.width) end end �������������������������������ruby-gnome2-all-2.2.5/atk/extconf.rb����������������������������������������������������������������0000644�0001750�0001750�00000002222�11701304107�015354� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' package = "atk" base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + package mkmf_gnome2_dir = base_dir + 'lib' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_dir = Pathname("ext") + package FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist? extconf_rb_path = ext_dir + "extconf.rb" system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false) create_makefile(package) FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/#{package} && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/#{package} && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/#{package} && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/#{package} && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/#{package} && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/Rakefile������������������������������������������������������������������0000644�0001750�0001750�00000001543�12416346617�015053� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- ruby -*- $LOAD_PATH.unshift("./../glib2/lib") require "gnome2/rake/package-task" package_task = GNOME2::Rake::PackageTask.new do |package| package.summary = "Ruby/ATK is a Ruby binding of ATK-1.0.x." package.description = "Ruby/ATK is a Ruby binding of ATK-1.0.x." package.dependency.gem.runtime = ["glib2"] package.windows.packages = [] package.windows.dependencies = [] package.windows.build_dependencies = ["glib2", "gobject-introspection"] package.external_packages = [ { :name => "atk", :download_site => :gnome, :label => "atk", :version => "2.14.0", :compression_method => "xz", :windows => { :configure_args => [ "--enable-introspection", ], :build_concurrently => false, :built_file => "bin/libatk-1.0-0.dll", }, } ] end package_task.define �������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/����������������������������������������������������������������������0000755�0001750�0001750�00000000000�11701304107�014163� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/������������������������������������������������������������������0000755�0001750�0001750�00000000000�12446160551�014754� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatknoopobject.c�������������������������������������������������0000644�0001750�0001750�00000002447�11701304107�020303� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cNoOpObject #define _SELF(s) (RVAL2ATKNOOPOBJECT(s)) static VALUE rg_initialize(VALUE self, VALUE gobj) { G_INITIALIZE(self, atk_no_op_object_new(RVAL2GOBJ(gobj))); return Qnil; } void Init_atk_noopobject(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_NO_OP_OBJECT, "NoOpObject", mAtk); RG_DEF_METHOD(initialize, 1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkutil.c�������������������������������������������������������0000644�0001750�0001750�00000007270�12257552167�017137� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cUtil static ID id_call; /* How can I implement them? guint atk_add_focus_tracker (AtkEventListener focus_tracker); void atk_remove_focus_tracker (guint tracker_id); void atk_focus_tracker_init (AtkEventListenerInit add_function); void (*AtkEventListener) (AtkObject*); void (*AtkEventListenerInit) (void); guint atk_add_global_event_listener (GSignalEmissionHook listener, const gchar *event_type); void atk_remove_global_event_listener (guint listener_id); */ static VALUE rg_s_focus_tracker_notify(VALUE self, VALUE obj) { atk_focus_tracker_notify(RVAL2ATKOBJECT(obj)); return self; } static gint key_snoop_func(AtkKeyEventStruct* event, gpointer func) { VALUE ret = rb_funcall((VALUE)func, id_call, 7, INT2NUM(event->type), UINT2NUM(event->state), UINT2NUM(event->keyval), INT2NUM(event->length), CSTR2RVAL(event->string), UINT2NUM(event->keycode), UINT2NUM(event->timestamp)); return NUM2INT(ret); } static VALUE rg_s_add_key_event_listener(VALUE self) { guint ret; VALUE func = rb_block_proc(); G_RELATIVE(self, func); ret = atk_add_key_event_listener((AtkKeySnoopFunc)key_snoop_func, (gpointer)func); return UINT2NUM(ret); } static VALUE rg_s_remove_key_event_listener(VALUE self, VALUE id) { atk_remove_key_event_listener(NUM2UINT(id)); return self; } static VALUE rg_s_root(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(atk_get_root()); } static VALUE rg_s_focus_object(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(atk_get_focus_object()); } static VALUE rg_s_toolkit_name(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(atk_get_toolkit_name()); } static VALUE rg_s_toolkit_version(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL(atk_get_toolkit_version()); } void Init_atk_util(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_UTIL, "Util", mAtk); id_call = rb_intern("call"); RG_DEF_SMETHOD(focus_tracker_notify, 1); RG_DEF_SMETHOD(add_key_event_listener, 0); RG_DEF_SMETHOD(remove_key_event_listener, 1); RG_DEF_SMETHOD(root, 0); RG_DEF_SMETHOD(focus_object, 0); RG_DEF_SMETHOD(toolkit_name, 0); RG_DEF_SMETHOD(toolkit_version, 0); /* AtkCoordType */ G_DEF_CLASS(ATK_TYPE_COORD_TYPE, "CoordType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_COORD_TYPE, "ATK_"); /* AtkKeyEventType */ G_DEF_CLASS(ATK_TYPE_KEY_EVENT_TYPE, "KeyEventType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_KEY_EVENT_TYPE, "ATK_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatk.h�����������������������������������������������������������0000644�0001750�0001750�00000003145�11701304107�016221� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "ruby.h" #include <atk/atk.h> #include <atk/atk-enum-types.h> #include <atk/atknoopobject.h> #include <atk/atknoopobjectfactory.h> #include "rbgobject.h" #include "rbatkversion.h" #include "rbatkconversions.h" #if defined(G_PLATFORM_WIN32) && !defined(RUBY_ATK_STATIC_COMPILATION) # ifdef RUBY_ATK_COMPILATION # define RUBY_ATK_VAR __declspec(dllexport) # else # define RUBY_ATK_VAR extern __declspec(dllimport) # endif #else # define RUBY_ATK_VAR extern #endif extern GType atk_text_rectangle_get_type(void); extern GType atk_text_range_get_type(void); RUBY_ATK_VAR VALUE mAtk; #define ATK_TYPE_TEXT_RECTANGLE (atk_text_rectangle_get_type()) #define ATK_TYPE_TEXT_RANGE (atk_text_range_get_type()) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/extconf.rb��������������������������������������������������������0000644�0001750�0001750�00000004554�12446160551�016757� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������=begin extconf.rb for Ruby/Atk extention library =end require 'pathname' base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path top_dir = base_dir.parent 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 = "atk" package_id = "atk" begin require 'mkmf-gnome2' rescue LoadError require 'rubygems' gem 'glib2' require 'mkmf-gnome2' end ruby_header = 'ruby.h' have_func 'rb_errinfo', ruby_header ["glib2"].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 setup_windows(module_name, base_dir) unless required_pkg_config_package([package_id, 1, 12, 0], :debian => "libatk1.0-dev", :redhat => "atk-devel", :homebrew => "atk", :macports => "atk") exit(false) end atk_header = "atk/atk.h" have_func('atk_action_get_localized_name', atk_header) have_func('atk_hyperlink_is_inline', atk_header) have_func('atk_object_add_relationship', atk_header) have_func('atk_object_remove_relationship', atk_header) have_func('atk_component_get_layer', atk_header) have_func('atk_component_get_mdi_zorder', atk_header) have_func('atk_hyperlink_is_selected_link', atk_header) have_func('atk_text_get_bounded_ranges', atk_header) have_func('atk_role_get_localized_name', atk_header) have_func('atk_text_clip_type_get_type', atk_header) have_func('atk_text_free_ranges', atk_header) make_version_header("ATK", package_id, ".") create_pkg_config_file("Ruby/ATK", package_id) $defs << " -DRUBY_ATK_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 ����������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkvalue.c������������������������������������������������������0000664�0001750�0001750�00000003765�11740310343�017265� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mValue #define _SELF(s) (RVAL2ATKVALUE(s)) static VALUE rg_current(VALUE self) { GValue gval = G_VALUE_INIT; atk_value_get_current_value(_SELF(self), &gval); return GVAL2RVAL(&gval); } static VALUE rg_max(VALUE self) { GValue gval = G_VALUE_INIT; atk_value_get_maximum_value(_SELF(self), &gval); return GVAL2RVAL(&gval); } static VALUE rg_min(VALUE self) { GValue gval = G_VALUE_INIT; atk_value_get_minimum_value(_SELF(self), &gval); return GVAL2RVAL(&gval); } static VALUE rg_set_current(VALUE self, VALUE value) { GValue gval = G_VALUE_INIT; g_value_init(&gval, RVAL2GTYPE(value)); rbgobj_rvalue_to_gvalue(value, &gval); if (! atk_value_set_current_value(_SELF(self), &gval)){ rb_raise(rb_eRuntimeError, "Can't set the current value."); } return self; } void Init_atk_value(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_VALUE, "Value", mAtk); RG_DEF_METHOD(current, 0); RG_DEF_METHOD(max, 0); RG_DEF_METHOD(min, 0); RG_DEF_METHOD(set_current, 1); } �����������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkselection.c��������������������������������������������������0000644�0001750�0001750�00000005007�11701304107�020121� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mSelection #define _SELF(s) (RVAL2ATKSELECTION(s)) static VALUE rg_add_selection(VALUE self, VALUE i) { gboolean ret = atk_selection_add_selection(_SELF(self), NUM2INT(i)); if (! ret) rb_raise(rb_eRuntimeError, "Can't add selection"); return self; } static VALUE rg_clear_selection(VALUE self) { gboolean ret = atk_selection_clear_selection(_SELF(self)); if (! ret) rb_raise(rb_eRuntimeError, "Can't clear selection"); return self; } static VALUE rg_ref_selection(VALUE self, VALUE i) { return GOBJ2RVAL(atk_selection_ref_selection(_SELF(self), NUM2INT(i))); } static VALUE rg_selection_count(VALUE self) { return INT2NUM(atk_selection_get_selection_count(_SELF(self))); } static VALUE rg_child_selected_p(VALUE self, VALUE i) { return CBOOL2RVAL(atk_selection_is_child_selected(_SELF(self), NUM2INT(i))); } static VALUE rg_remove_selection(VALUE self, VALUE i) { gboolean ret = atk_selection_remove_selection(_SELF(self), NUM2INT(i)); if (! ret) rb_raise(rb_eRuntimeError, "Can't remove selection"); return self; } static VALUE rg_select_all_selection(VALUE self) { return CBOOL2RVAL(atk_selection_select_all_selection(_SELF(self))); } void Init_atk_selection(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_SELECTION, "Selection", mAtk); RG_DEF_METHOD(add_selection, 1); RG_DEF_METHOD(clear_selection, 0); RG_DEF_METHOD(ref_selection, 1); RG_DEF_METHOD(selection_count, 0); RG_DEF_METHOD_P(child_selected, 1); RG_DEF_METHOD(remove_selection, 1); RG_DEF_METHOD(select_all_selection, 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkrelationtype.c�����������������������������������������������0000644�0001750�0001750�00000002512�11701304107�020651� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cType static VALUE rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKRELATIONTYPE2RVAL(atk_relation_type_for_name(RVAL2CSTR(name))); } void Init_atk_relation_type(VALUE cRelation) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_RELATION_TYPE, "Type", cRelation); RG_DEF_SMETHOD(for_name, 1); G_DEF_CONSTANTS(cRelation, ATK_TYPE_RELATION_TYPE, "ATK_"); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/depend������������������������������������������������������������0000644�0001750�0001750�00000000463�12064346475�016150� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������install-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rbatk.h $(RUBYARCHDIR) $(INSTALL_DATA) rbatkversion.h $(RUBYARCHDIR) install: install-pc install-pc: if test -n "$(pkgconfigdir)"; then \ $(MAKEDIRS) $(pkgconfigdir); \ $(INSTALL_DATA) ruby-atk.pc $(pkgconfigdir); \ fi �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkcomponent.c��������������������������������������������������0000644�0001750�0001750�00000012143�12257552167�020157� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mComponent #define _SELF(s) (RVAL2ATKCOMPONENT(s)) /* static void focus_handler(AtkObject *aobj, gboolean bool) { VALUE ret = rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(aobj), CBOOL2RVAL(bool)); } static VALUE rg_add_focus_handler(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); return UINT2NUM(atk_component_add_focus_handler(_SELF(self), focus_handler)); } */ static VALUE rg_contains_p(VALUE self, VALUE x, VALUE y, VALUE coord_type) { return CBOOL2RVAL(atk_component_contains(_SELF(self), NUM2INT(x), NUM2INT(y), RVAL2ATKCOORDTYPE(coord_type))); } static VALUE rg_get_extents(VALUE self, VALUE coord_type) { gint x, y, width, height; atk_component_get_extents(_SELF(self), &x, &y, &width, &height, RVAL2ATKCOORDTYPE(coord_type)); return rb_ary_new3(4, INT2NUM(x), INT2NUM(y), INT2NUM(width), INT2NUM(height)); } #ifdef HAVE_ATK_COMPONENT_GET_LAYER static VALUE rg_layer(VALUE self) { return ATKLAYER2RVAL(atk_component_get_layer(_SELF(self))); } #endif #ifdef HAVE_ATK_COMPONENT_GET_MDI_ZORDER static VALUE rg_mdi_zorder(VALUE self) { return INT2NUM(atk_component_get_mdi_zorder(_SELF(self))); } #endif static VALUE rg_position(VALUE self, VALUE coord_type) { gint x, y; atk_component_get_position(_SELF(self), &x, &y, RVAL2ATKCOORDTYPE(coord_type)); return rb_assoc_new(INT2NUM(x), INT2NUM(y)); } static VALUE rg_size(VALUE self) { gint width, height; atk_component_get_size(_SELF(self), &width, &height); return rb_assoc_new(INT2NUM(width), INT2NUM(height)); } static VALUE rg_grab_focus(VALUE self) { return CBOOL2RVAL(atk_component_grab_focus(_SELF(self))); } static VALUE rg_ref_accessible_at_point(VALUE self, VALUE x, VALUE y, VALUE coord_type) { return GOBJ2RVAL(atk_component_ref_accessible_at_point( _SELF(self), NUM2INT(x), NUM2INT(y), RVAL2ATKCOORDTYPE(coord_type))); } static VALUE rg_remove_focus_handler(VALUE self, VALUE handler_id) { atk_component_remove_focus_handler(_SELF(self), NUM2UINT(handler_id)); return self; } static VALUE rg_set_extents(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, VALUE coord_type) { gboolean ret = atk_component_set_extents(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height), RVAL2ATKCOORDTYPE(coord_type)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set extents"); return self; } static VALUE rg_set_position(VALUE self, VALUE x, VALUE y, VALUE coord_type) { gboolean ret = atk_component_set_position(_SELF(self), NUM2INT(x), NUM2INT(y), RVAL2ATKCOORDTYPE(coord_type)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set the position"); return self; } static VALUE rg_set_size(VALUE self, VALUE width, VALUE height) { gboolean ret = atk_component_set_size(_SELF(self), NUM2INT(width), NUM2INT(height)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set the size"); return self; } static VALUE rg_alpha(VALUE self) { return rb_float_new(atk_component_get_alpha(_SELF(self))); } void Init_atk_component(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_COMPONENT, "Component", mAtk); /* RG_DEF_METHOD(add_focus_handler, 0); */ RG_DEF_METHOD_P(contains, 3); RG_DEF_METHOD(get_extents, 1); #ifdef HAVE_ATK_COMPONENT_GET_LAYER RG_DEF_METHOD(layer, 0); #endif #ifdef HAVE_ATK_COMPONENT_GET_MDI_ZORDER RG_DEF_METHOD(mdi_zorder, 0); #endif RG_DEF_METHOD(position, 1); RG_DEF_METHOD(size, 0); RG_DEF_METHOD(grab_focus, 0); RG_DEF_METHOD(ref_accessible_at_point, 3); RG_DEF_METHOD(remove_focus_handler, 1); RG_DEF_METHOD(set_extents, 5); RG_DEF_METHOD(set_position, 2); RG_DEF_METHOD(set_size, 2); RG_DEF_METHOD(alpha, 0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatktextrectangle.c����������������������������������������������0000644�0001750�0001750�00000007067�12124610262�021017� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Masao Mutoh * 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 "rbatkprivate.h" #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES #define RG_TARGET_NAMESPACE cTextRectangle #define _SELF(r) (RVAL2ATKTEXTRECTANGLE(r)) /**********************************/ static AtkTextRectangle* atk_text_rectangle_copy(const AtkTextRectangle* val) { AtkTextRectangle* new_val; g_return_val_if_fail (val != NULL, NULL); new_val = g_new(AtkTextRectangle, 1); *new_val = *val; return new_val; } GType atk_text_rectangle_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("AtkTextRectangle", (GBoxedCopyFunc)atk_text_rectangle_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ static VALUE rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { AtkTextRectangle rectangle; rectangle.x = NUM2INT(x); rectangle.y = NUM2INT(y); rectangle.width = NUM2INT(width); rectangle.height = NUM2INT(height); G_INITIALIZE(self, g_boxed_copy(ATK_TYPE_TEXT_RECTANGLE, &rectangle)); return Qnil; } /* 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) { AtkTextRectangle* a = _SELF(self); return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y), INT2FIX(a->width), INT2FIX(a->height)); } #endif void Init_atk_text_rectangle(VALUE mAtk) { #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_TEXT_RECTANGLE, "TextRectangle", mAtk); RG_DEF_METHOD(initialize, 4); 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); #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkimplementor.c������������������������������������������������0000644�0001750�0001750�00000002434�11701304107�020470� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mImplementor #define _SELF(s) (RVAL2ATKIMPLEMENTOR(s)) static VALUE rg_ref_accessible(VALUE self) { return GOBJ2RVAL(atk_implementor_ref_accessible(_SELF(self))); } void Init_atk_implementor(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_IMPLEMENTOR, "Implementor", mAtk); RG_DEF_METHOD(ref_accessible, 0); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkrelationset.c������������������������������������������������0000644�0001750�0001750�00000005336�12257552167�020514� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cRelationSet #define _SELF(s) (RVAL2ATKRELATIONSET(s)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, atk_relation_set_new()); return Qnil; } static VALUE rg_contains_p(VALUE self, VALUE relationship) { return CBOOL2RVAL(atk_relation_set_contains( _SELF(self), RVAL2ATKRELATIONTYPE(relationship))); } static VALUE rg_remove(VALUE self, VALUE relation) { atk_relation_set_remove(_SELF(self), RVAL2ATKRELATION(relation)); return self; } static VALUE rg_add(VALUE self, VALUE relation) { atk_relation_set_add(_SELF(self), RVAL2ATKRELATION(relation)); return self; } static VALUE rg_n_relations(VALUE self) { return INT2NUM(atk_relation_set_get_n_relations(_SELF(self))); } static VALUE rg_get_relation(VALUE self, VALUE i) { if (rb_obj_is_kind_of(i, GTYPE2CLASS(ATK_TYPE_RELATION_TYPE))){ return GOBJ2RVAL(atk_relation_set_get_relation_by_type( _SELF(self), RVAL2ATKRELATIONTYPE(i))); } else { return GOBJ2RVAL(atk_relation_set_get_relation(_SELF(self), NUM2INT(i))); } } static VALUE rg_add_relation(VALUE self, VALUE relationship, VALUE obj) { atk_relation_set_add_relation_by_type(_SELF(self), RVAL2ATKRELATIONTYPE(relationship), RVAL2ATKOBJECT(obj)); return self; } void Init_atk_relation_set(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_RELATION_SET, "RelationSet", mAtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD_P(contains, 1); RG_DEF_METHOD(remove, 1); RG_DEF_METHOD(add, 1); RG_DEF_METHOD(n_relations, 0); RG_DEF_METHOD(get_relation, 1); RG_DEF_METHOD(add_relation, 2); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkregistry.c���������������������������������������������������0000644�0001750�0001750�00000003721�11701304107�020005� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cRegistry #define _SELF(s) (RVAL2ATKREGISTRY(s)) static VALUE rg_set_factory_type(VALUE self, VALUE type, VALUE factory_type) { atk_registry_set_factory_type(_SELF(self), CLASS2GTYPE(type), CLASS2GTYPE(factory_type)); return self; } static VALUE rg_get_factory_type(VALUE self, VALUE type) { return GTYPE2CLASS(atk_registry_get_factory_type(_SELF(self), CLASS2GTYPE(type))); } static VALUE rg_get_factory(VALUE self, VALUE type) { return GOBJ2RVAL(atk_registry_get_factory(_SELF(self), CLASS2GTYPE(type))); } static VALUE rg_s_default_registry(G_GNUC_UNUSED VALUE self) { return GOBJ2RVAL(atk_get_default_registry()); } void Init_atk_registry(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_REGISTRY, "Registry", mAtk); RG_DEF_METHOD(set_factory_type, 2); RG_DEF_METHOD(get_factory_type, 1); RG_DEF_METHOD(get_factory, 1); RG_DEF_SMETHOD(default_registry, 0); } �����������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkstate.c������������������������������������������������������0000644�0001750�0001750�00000003224�11701304107�017253� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cState #define _SELF(s) (RVAL2ATKSTATE(s)) static VALUE rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKSTATETYPE2RVAL(atk_state_type_register(RVAL2CSTR(name))); } /* We don't need this. G_CONST_RETURN gchar* atk_state_type_get_name (AtkStateType type); */ static VALUE rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKSTATETYPE2RVAL(atk_state_type_for_name(RVAL2CSTR(name))); } void Init_atk_state(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_STATE_TYPE, "State", mAtk); RG_DEF_SMETHOD(type_register, 1); RG_DEF_SMETHOD(for_name, 1); G_DEF_CONSTANTS(mAtk, ATK_TYPE_STATE_TYPE, "ATK_"); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatktext.c�������������������������������������������������������0000664�0001750�0001750�00000023044�11740310343�017125� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mText #define _SELF(s) (RVAL2ATKTEXT(s)) static VALUE rg_get_text(VALUE self, VALUE start_offset, VALUE end_offset) { VALUE ret; gchar* text = atk_text_get_text(_SELF(self), NUM2INT(start_offset), NUM2INT(end_offset)); ret = CSTR2RVAL(text); g_free(text); return ret; } static VALUE rg_get_character_at_offset(VALUE self, VALUE offset) { gchar buf[10]; gint len = g_unichar_to_utf8(atk_text_get_character_at_offset (_SELF(self), NUM2INT(offset)), buf); buf[len] = '\0'; return rb_str_new2(buf); } static VALUE rg_get_text_after_offset(VALUE self, VALUE offset, VALUE boundary_type) { gchar* ret; VALUE result; gint start_offset, end_offset; ret = atk_text_get_text_after_offset(_SELF(self), NUM2INT(offset), RVAL2ATKTEXTBOUNDARY(boundary_type), &start_offset, &end_offset); result = rb_ary_new3(3, CSTR2RVAL(ret), INT2NUM(start_offset), INT2NUM(end_offset)); g_free(ret); return result; } static VALUE rg_get_text_at_offset(VALUE self, VALUE offset, VALUE boundary_type) { gchar* ret; VALUE result; gint start_offset, end_offset; ret = atk_text_get_text_at_offset(_SELF(self), NUM2INT(offset), RVAL2ATKTEXTBOUNDARY(boundary_type), &start_offset, &end_offset); result = rb_ary_new3(3, CSTR2RVAL(ret), INT2NUM(start_offset), INT2NUM(end_offset)); g_free(ret); return result; } static VALUE rg_get_text_before_offset(VALUE self, VALUE offset, VALUE boundary_type) { gchar* ret; VALUE result; gint start_offset, end_offset; ret = atk_text_get_text_before_offset(_SELF(self), NUM2INT(offset), RVAL2ATKTEXTBOUNDARY(boundary_type), &start_offset, &end_offset); result = rb_ary_new3(3, CSTR2RVAL(ret), INT2NUM(start_offset), INT2NUM(end_offset)); g_free(ret); return result; } static VALUE rg_caret_offset(VALUE self) { return INT2NUM(atk_text_get_caret_offset(_SELF(self))); } static VALUE rg_get_character_extents(VALUE self, VALUE offset, VALUE coords) { gint x, y, width, height; atk_text_get_character_extents(_SELF(self), NUM2INT(offset), &x, &y, &width, &height, RVAL2ATKCOORDTYPE(coords)); return rb_ary_new3(4, INT2NUM(x), INT2NUM(y), INT2NUM(width), INT2NUM(height)); } static VALUE rg_get_run_attributes(VALUE self, VALUE offset) { gint start_offset, end_offset; AtkAttributeSet* list; VALUE ary; list = atk_text_get_run_attributes(_SELF(self), NUM2INT(offset), &start_offset, &end_offset); ary = rb_ary_new(); while (list) { AtkAttribute* data = (AtkAttribute*)list->data; rb_ary_push(ary, rb_assoc_new(CSTR2RVAL(data->name), CSTR2RVAL(data->value))); list = list->next; } atk_attribute_set_free(list); return ary; } static VALUE rg_default_attributes(VALUE self) { AtkAttributeSet* list; VALUE ary; list = atk_text_get_default_attributes(_SELF(self)); ary = rb_ary_new(); while (list) { AtkAttribute* data = (AtkAttribute*)list->data; rb_ary_push(ary, rb_assoc_new(CSTR2RVAL(data->name), CSTR2RVAL(data->value))); list = list->next; } atk_attribute_set_free(list); return ary; } static VALUE rg_character_count(VALUE self) { return INT2NUM(atk_text_get_character_count(_SELF(self))); } static VALUE rg_get_offset_at_point(VALUE self, VALUE x, VALUE y, VALUE coords) { return INT2NUM(atk_text_get_offset_at_point(_SELF(self), NUM2INT(x), NUM2INT(y), RVAL2ATKCOORDTYPE(coords))); } #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES #ifdef HAVE_ATK_TEXT_CLIP_TYPE_GET_TYPE static VALUE rg_get_bounded_ranges(VALUE self, VALUE rect, VALUE coord_type, VALUE x_clip_type, VALUE y_clip_type) { AtkTextRange** ranges; int i = 0; VALUE ary; ranges = atk_text_get_bounded_ranges(_SELF(self), RVAL2ATKTEXTRECTANGLE(rect), RVAL2ATKCOORDTYPE(coord_type), RVAL2ATKTEXTCLIPTYPE(x_clip_type), RVAL2ATKTEXTCLIPTYPE(y_clip_type)); ary = rb_ary_new(); while(ranges[i]){ rb_ary_push(ary, ATKTEXTRANGE2RVAL(ranges[i])); i++; } #ifdef HAVE_ATK_TEXT_FREE_RANGES atk_text_free_ranges(ranges); #endif return ary; } #endif static VALUE rg_get_range_extents(VALUE self, VALUE start_offset, VALUE end_offset, VALUE coord_type) { AtkTextRectangle rect; atk_text_get_range_extents(_SELF(self), NUM2INT(start_offset), NUM2INT(end_offset), RVAL2ATKCOORDTYPE(coord_type), &rect); return ATKTEXTRECTANGLE2RVAL(&rect); } /* Don't need this void atk_text_free_ranges (AtkTextRange **ranges); */ #endif static VALUE rg_n_selections(VALUE self) { return INT2NUM(atk_text_get_n_selections(_SELF(self))); } static VALUE rg_get_selection(VALUE self, VALUE selection_num) { gint start_offset, end_offset; VALUE ret; gchar* text = atk_text_get_selection(_SELF(self), NUM2INT(selection_num), &start_offset, &end_offset); ret = CSTR2RVAL(text); g_free(text); return ret; } static VALUE rg_add_selection(VALUE self, VALUE start_offset, VALUE end_offset) { gboolean ret = atk_text_add_selection(_SELF(self), NUM2INT(start_offset), NUM2INT(end_offset)); if (! ret) rb_raise(rb_eRuntimeError, "Can't add selection"); return self; } static VALUE rg_remove_selection(VALUE self, VALUE selection_num) { gint num; gboolean ret; num = NUM2INT(selection_num); ret = atk_text_remove_selection(_SELF(self), num); if (! ret) rb_raise(rb_eRuntimeError, "Can't remove selection. num = %d", num); return self; } static VALUE rg_set_selection(VALUE self, VALUE selection_num, VALUE start_offset, VALUE end_offset) { gboolean ret = atk_text_set_selection(_SELF(self), NUM2INT(selection_num), NUM2INT(start_offset), NUM2INT(end_offset)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set selection"); return self; } static VALUE rg_set_caret_offset(VALUE self, VALUE offset) { gboolean ret = atk_text_set_caret_offset(_SELF(self), NUM2INT(offset)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set caret offset"); return self; } /* We don't need them. void atk_attribute_set_free (AtkAttributeSet *attrib_set); */ void Init_atk_text(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_TEXT, "Text", mAtk); RG_DEF_METHOD(get_text, 2); RG_DEF_METHOD(get_character_at_offset, 1); RG_DEF_METHOD(get_text_after_offset, 2); RG_DEF_METHOD(get_text_at_offset, 2); RG_DEF_METHOD(get_text_before_offset, 2); RG_DEF_METHOD(caret_offset, 0); RG_DEF_METHOD(get_character_extents, 2); RG_DEF_METHOD(get_run_attributes, 1); RG_DEF_METHOD(default_attributes, 0); RG_DEF_METHOD(character_count, 0); RG_DEF_METHOD(get_offset_at_point, 3); #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES #ifdef HAVE_ATK_TEXT_CLIP_TYPE_GET_TYPE RG_DEF_METHOD(get_bounded_ranges, 4); RG_DEF_METHOD(get_range_extents, 3); #endif #endif RG_DEF_METHOD(n_selections, 0); RG_DEF_METHOD(get_selection, 1); RG_DEF_METHOD(add_selection, 2); RG_DEF_METHOD(remove_selection, 1); RG_DEF_METHOD(set_selection, 3); RG_DEF_METHOD(set_caret_offset, 1); /* AtkTextBoundary */ #ifdef ATK_TYPE_TEXT_BOUNDARY G_DEF_CLASS(ATK_TYPE_TEXT_BOUNDARY, "Boundary", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_TEXT_BOUNDARY, "ATK_TEXT_"); #endif /* AtkTextClipType */ #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES #ifdef HAVE_ATK_TEXT_CLIP_TYPE_GET_TYPE G_DEF_CLASS(ATK_TYPE_TEXT_CLIP_TYPE, "ClipType", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_TEXT_CLIP_TYPE, "ATK_TEXT_"); #endif #endif Init_atk_text_attribute(RG_TARGET_NAMESPACE); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkstreamablecontent.c������������������������������������������0000644�0001750�0001750�00000003422�11701304107�021645� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mStreamableContent #define _SELF(s) (RVAL2ATKSTREAMABLECONTENT(s)) static VALUE rg_n_mime_types(VALUE self) { return INT2NUM(atk_streamable_content_get_n_mime_types(_SELF(self))); } static VALUE rg_mime_type(VALUE self, VALUE i) { return CSTR2RVAL(atk_streamable_content_get_mime_type(_SELF(self), NUM2INT(i))); } static VALUE rg_get_stream(VALUE self, VALUE mime_type) { GIOChannel* io = atk_streamable_content_get_stream(_SELF(self), RVAL2CSTR(mime_type)); if (!io) rb_raise(rb_eRuntimeError, "Couldn't get the stream."); return GIOCHANNEL2RVAL(io); } void Init_atk_streamable_content(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_STREAMABLE_CONTENT, "StreamableContent", mAtk); RG_DEF_METHOD(n_mime_types, 0); RG_DEF_METHOD(mime_type, 1); RG_DEF_METHOD(get_stream, 1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatktextrange.c��������������������������������������������������0000644�0001750�0001750�00000004720�11701304107�020136� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Masao Mutoh * 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 "rbatkprivate.h" #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES #define RG_TARGET_NAMESPACE cTextRange #define _SELF(r) (RVAL2ATKTEXTRANGE(r)) /**********************************/ static AtkTextRange* atk_text_range_copy(const AtkTextRange* val) { AtkTextRange* new_val; g_return_val_if_fail (val != NULL, NULL); new_val = g_new(AtkTextRange, 1); *new_val = *val; return new_val; } GType atk_text_range_get_type(void) { static GType our_type = 0; if (our_type == 0) our_type = g_boxed_type_register_static ("AtkTextRange", (GBoxedCopyFunc)atk_text_range_copy, (GBoxedFreeFunc)g_free); return our_type; } /**********************************/ /* Struct accessors */ static VALUE rg_bounds(VALUE self) { return ATKTEXTRECTANGLE2RVAL(&_SELF(self)->bounds); } static VALUE rg_start_offset(VALUE self) { return INT2NUM(_SELF(self)->start_offset); } static VALUE rg_end_offset(VALUE self) { return INT2NUM(_SELF(self)->end_offset); } static VALUE rg_content(VALUE self) { return CSTR2RVAL(_SELF(self)->content); } #endif void Init_atk_text_range(VALUE mAtk) { #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_TEXT_RANGE, "TextRange", mAtk); RG_DEF_METHOD(bounds, 0); RG_DEF_METHOD(start_offset, 0); RG_DEF_METHOD(end_offset, 0); RG_DEF_METHOD(content, 0); #endif } ������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkeditabletext.c�����������������������������������������������0000664�0001750�0001750�00000011457�11740310343�020624� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mEditableText #define _SELF(s) (RVAL2ATKEDITABLETEXT(s)) struct rval2atkattributegslist_args { VALUE ary; long n; GSList *result; }; static VALUE rbatk_rval2atkattributegslist_body(VALUE value) { long i; struct rval2atkattributegslist_args *args = (struct rval2atkattributegslist_args *)value; for (i = 0; i < args->n; i++) { VALUE ary = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]); AtkAttribute *attribute; if (RARRAY_LEN(ary) != 2) rb_raise(rb_eArgError, "attribute %ld should be an array of length 2", i); attribute = g_new(AtkAttribute, 1); args->result = g_slist_append(args->result, attribute); attribute->name = g_strdup(RVAL2CSTR(RARRAY_PTR(ary)[0])); attribute->value = g_strdup(RVAL2CSTR(RARRAY_PTR(ary)[1])); } return Qnil; } static void rbatk_atkattributegslist_free(GSList *list) { GSList *p; for (p = list; p != NULL; p = g_slist_next(p)) { AtkAttribute *attribute = (AtkAttribute *)p->data; g_free(attribute->value); g_free(attribute->name); g_free(attribute); } g_slist_free(list); } static G_GNUC_NORETURN VALUE rbatk_rval2atkattributegslist_rescue(VALUE value) { rbatk_atkattributegslist_free(((struct rval2atkattributegslist_args *)value)->result); rb_exc_raise(rb_errinfo()); } static GSList * rbatk_rval2atkattributegslist(VALUE value) { struct rval2atkattributegslist_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = NULL; rb_rescue(rbatk_rval2atkattributegslist_body, (VALUE)&args, rbatk_rval2atkattributegslist_rescue, (VALUE)&args); return args.result; } #define RVAL2ATKATTRIBUTEGSLIST(value) rbatk_rval2atkattributegslist(value) static VALUE rg_set_run_attributes(VALUE self, VALUE attributes, VALUE rbstart_offset, VALUE rbend_offset) { AtkEditableText *editable; gint start_offset, end_offset; AtkAttributeSet *list; gboolean result; if (NIL_P(attributes)) return Qfalse; editable = _SELF(self); start_offset = NUM2INT(rbstart_offset); end_offset = NUM2INT(rbend_offset); list = RVAL2ATKATTRIBUTEGSLIST(attributes); result = atk_editable_text_set_run_attributes(editable, list, start_offset, end_offset); rbatk_atkattributegslist_free(list); return CBOOL2RVAL(result); } static VALUE rg_set_text_contents(VALUE self, VALUE str) { atk_editable_text_set_text_contents(_SELF(self), RVAL2CSTR(str)); return self; } static VALUE rg_insert_text(VALUE self, VALUE str, VALUE position) { gint pos = NUM2INT(position); StringValue(str); atk_editable_text_insert_text(_SELF(self), RVAL2CSTR(str), RSTRING_LEN(str), &pos); return INT2NUM(pos); } static VALUE rg_copy_text(VALUE self, VALUE start_pos, VALUE end_pos) { atk_editable_text_copy_text(_SELF(self), NUM2INT(start_pos), NUM2INT(end_pos)); return self; } static VALUE rg_cut_text(VALUE self, VALUE start_pos, VALUE end_pos) { atk_editable_text_cut_text(_SELF(self), NUM2INT(start_pos), NUM2INT(end_pos)); return self; } static VALUE rg_delete_text(VALUE self, VALUE start_pos, VALUE end_pos) { atk_editable_text_delete_text(_SELF(self), NUM2INT(start_pos), NUM2INT(end_pos)); return self; } static VALUE rg_paste_text(VALUE self, VALUE position) { atk_editable_text_paste_text(_SELF(self), NUM2INT(position)); return self; } void Init_atk_editabletext(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_EDITABLE_TEXT, "EditableText", mAtk); RG_DEF_METHOD(set_run_attributes, 3); RG_DEF_METHOD(set_text_contents, 1); RG_DEF_METHOD(insert_text, 2); RG_DEF_METHOD(copy_text, 2); RG_DEF_METHOD(cut_text, 2); RG_DEF_METHOD(delete_text, 2); RG_DEF_METHOD(paste_text, 1); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkrelation.c���������������������������������������������������0000644�0001750�0001750�00000005203�12257552167�017771� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cRelation #define _SELF(s) (RVAL2ATKRELATION(s)) static VALUE rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKRELATIONTYPE2RVAL(atk_relation_type_register(RVAL2CSTR(name))); } struct rval2atkobjects_args { VALUE ary; long n; AtkObject **result; }; static VALUE rval2atkobjects_body(VALUE value) { long i; struct rval2atkobjects_args *args = (struct rval2atkobjects_args *)value; for (i = 0; i < args->n; i++) args->result[i] = RVAL2ATKOBJECT(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rval2atkobjects_rescue(VALUE value) { g_free(((struct rval2atkobjects_args *)value)->result); rb_exc_raise(rb_errinfo()); } static VALUE rg_initialize(VALUE self, VALUE targets, VALUE rbrelationship) { AtkRelationType relationship = RVAL2ATKRELATIONTYPE(rbrelationship); struct rval2atkobjects_args args; AtkRelation *relation; args.ary = rb_ary_to_ary(targets); args.n = RARRAY_LEN(args.ary); args.result = g_new(AtkObject *, args.n + 1); rb_rescue(rval2atkobjects_body, (VALUE)&args, rval2atkobjects_rescue, (VALUE)&args); relation = atk_relation_new(args.result, args.n, relationship); g_free(args.result); G_INITIALIZE(self, relation); return Qnil; } static VALUE rg_add_target(VALUE self, VALUE obj) { atk_relation_add_target(_SELF(self), RVAL2ATKOBJECT(obj)); return self; } void Init_atk_relation(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_RELATION, "Relation", mAtk); RG_DEF_SMETHOD(type_register, 1); RG_DEF_METHOD(initialize, 2); RG_DEF_METHOD(add_target, 1); Init_atk_relation_type(RG_TARGET_NAMESPACE); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatk.c�����������������������������������������������������������0000644�0001750�0001750�00000004763�11701304107�016223� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mAtk VALUE mAtk; extern void Init_atk(void); void Init_atk(void) { RG_TARGET_NAMESPACE = rb_define_module("Atk"); rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION", rb_ary_new3(3, INT2FIX(ATK_MAJOR_VERSION), INT2FIX(ATK_MINOR_VERSION), INT2FIX(ATK_MICRO_VERSION))); Init_atk_action(RG_TARGET_NAMESPACE); Init_atk_component(RG_TARGET_NAMESPACE); Init_atk_document(RG_TARGET_NAMESPACE); Init_atk_editabletext(RG_TARGET_NAMESPACE); Init_atk_gobjectaccessible(RG_TARGET_NAMESPACE); Init_atk_hyperlink(RG_TARGET_NAMESPACE); Init_atk_hypertext(RG_TARGET_NAMESPACE); Init_atk_image(RG_TARGET_NAMESPACE); Init_atk_implementor(RG_TARGET_NAMESPACE); Init_atk_noopobject(RG_TARGET_NAMESPACE); Init_atk_noopobjectfactory(RG_TARGET_NAMESPACE); Init_atk_object(RG_TARGET_NAMESPACE); Init_atk_objectfactory(RG_TARGET_NAMESPACE); Init_atk_registry(RG_TARGET_NAMESPACE); Init_atk_relation(RG_TARGET_NAMESPACE); Init_atk_relation_set(RG_TARGET_NAMESPACE); Init_atk_selection(RG_TARGET_NAMESPACE); Init_atk_state(RG_TARGET_NAMESPACE); Init_atk_state_set(RG_TARGET_NAMESPACE); Init_atk_streamable_content(RG_TARGET_NAMESPACE); Init_atk_table(RG_TARGET_NAMESPACE); Init_atk_text(RG_TARGET_NAMESPACE); Init_atk_text_range(RG_TARGET_NAMESPACE); Init_atk_text_rectangle(RG_TARGET_NAMESPACE); Init_atk_util(RG_TARGET_NAMESPACE); Init_atk_value(RG_TARGET_NAMESPACE); } �������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkaction.c�����������������������������������������������������0000644�0001750�0001750�00000004533�11701304107�017414� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mAction #define _SELF(s) (RVAL2ATKACTION(s)) static VALUE rg_do_action(VALUE self, VALUE i) { return CBOOL2RVAL(atk_action_do_action(_SELF(self), NUM2INT(i))); } static VALUE rg_n_actions(VALUE self) { return INT2NUM(atk_action_get_n_actions(_SELF(self))); } static VALUE rg_get_description(VALUE self, VALUE i) { return CSTR2RVAL(atk_action_get_description(_SELF(self), NUM2INT(i))); } static VALUE rg_get_name(VALUE self, VALUE i) { return CSTR2RVAL(atk_action_get_name(_SELF(self), NUM2INT(i))); } #ifdef HAVE_ATK_ACTION_GET_LOCALIZED_NAME static VALUE rg_get_localized_name(VALUE self, VALUE i) { return CSTR2RVAL(atk_action_get_localized_name(_SELF(self), NUM2INT(i))); } #endif static VALUE rg_get_keybinding(VALUE self, VALUE i) { return CSTR2RVAL(atk_action_get_keybinding(_SELF(self), NUM2INT(i))); } static VALUE rg_set_description(VALUE self, VALUE i, VALUE desc) { return CBOOL2RVAL(atk_action_set_description(_SELF(self), NUM2INT(i), RVAL2CSTR(desc))); } void Init_atk_action(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_ACTION, "Action", mAtk); RG_DEF_METHOD(do_action, 1); RG_DEF_METHOD(n_actions, 0); RG_DEF_METHOD(get_description, 1); RG_DEF_METHOD(get_name, 1); #ifdef HAVE_ATK_ACTION_GET_LOCALIZED_NAME RG_DEF_METHOD(get_localized_name, 1); #endif RG_DEF_METHOD(get_keybinding, 1); RG_DEF_METHOD(set_description, 2); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkgobjectaccessible.c������������������������������������������0000644�0001750�0001750�00000002736�11701304107�021575� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cGObjectAccessible #define _SELF(s) (RVAL2ATKGOBJECTACCESSIBLE(s)) static VALUE rg_s_for_object(G_GNUC_UNUSED VALUE self, VALUE obj) { return GOBJ2RVAL(atk_gobject_accessible_for_object(RVAL2GOBJ(obj))); } static VALUE rg_object(VALUE self) { return GOBJ2RVAL(atk_gobject_accessible_get_object(_SELF(self))); } void Init_atk_gobjectaccessible(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_GOBJECT_ACCESSIBLE, "GObjectAccessible", mAtk); RG_DEF_SMETHOD(for_object, 1); RG_DEF_METHOD(object, 0); } ����������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkimage.c������������������������������������������������������0000664�0001750�0001750�00000004140�11740310343�017217� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mImage #define _SELF(s) (RVAL2ATKIMAGE(s)) static VALUE rg_image_position(VALUE self, VALUE coord_type) { gint x, y; atk_image_get_image_position(_SELF(self), &x, &y, RVAL2ATKCOORDTYPE(coord_type)); return rb_assoc_new(INT2NUM(x), INT2NUM(y)); } static VALUE rg_image_description(VALUE self) { return CSTR2RVAL(atk_image_get_image_description(_SELF(self))); } static VALUE rg_set_image_description(VALUE self, VALUE description) { gboolean ret = atk_image_set_image_description(_SELF(self), RVAL2CSTR(description)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set image description"); return self; } static VALUE rg_image_size(VALUE self) { gint width, height; atk_image_get_image_size(_SELF(self), &width, &height); return rb_assoc_new(INT2NUM(width), INT2NUM(height)); } void Init_atk_image(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_IMAGE, "Image", mAtk); RG_DEF_METHOD(image_position, 1); RG_DEF_METHOD(image_description, 0); RG_DEF_METHOD(set_image_description, 1); RG_DEF_METHOD(image_size, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkhyperlink.c��������������������������������������������������0000644�0001750�0001750�00000003634�11701304107�020145� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cHyperlink #define _SELF(s) (RVAL2ATKHYPERLINK(s)) static VALUE rg_get_uri(VALUE self, VALUE i) { return CSTR2RVAL(atk_hyperlink_get_uri(_SELF(self), NUM2INT(i))); } static VALUE rg_get_object(VALUE self, VALUE i) { return GOBJ2RVAL(atk_hyperlink_get_object(_SELF(self), NUM2INT(i))); } static VALUE rg_valid_p(VALUE self) { return CBOOL2RVAL(atk_hyperlink_is_valid(_SELF(self))); } #ifdef HAVE_ATK_HYPERLINK_IS_INLINE static VALUE rg_inline_p(VALUE self) { return CBOOL2RVAL(atk_hyperlink_is_inline(_SELF(self))); } #endif static VALUE rg_n_anchors(VALUE self) { return INT2NUM(atk_hyperlink_get_n_anchors(_SELF(self))); } void Init_atk_hyperlink(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_HYPERLINK, "Hyperlink", mAtk); RG_DEF_METHOD(get_uri, 1); RG_DEF_METHOD(get_object, 1); RG_DEF_METHOD_P(valid, 0); #ifdef HAVE_ATK_HYPERLINK_IS_INLINE RG_DEF_METHOD_P(inline, 0); #endif RG_DEF_METHOD(n_anchors, 0); } ����������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkconversions.h������������������������������������������������0000644�0001750�0001750�00000010335�11701304107�020511� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 */ #ifndef __RBATKCONVERSIONS_H__ #define __RBATKCONVERSIONS_H__ #define RVAL2ATKACTION(o) (ATK_ACTION(RVAL2GOBJ(o))) #define RVAL2ATKCOMPONENT(o) (ATK_COMPONENT(RVAL2GOBJ(o))) #define RVAL2ATKDOCUMENT(o) (ATK_DOCUMENT(RVAL2GOBJ(o))) #define RVAL2ATKEDITABLETEXT(o) (ATK_EDITABLE_TEXT(RVAL2GOBJ(o))) #define RVAL2ATKGOBJECTACCESSIBLE(o) (ATK_GOBJECT_ACCESSIBLE(RVAL2GOBJ(o))) #define RVAL2ATKHYPERLINK(o) (ATK_HYPERLINK(RVAL2GOBJ(o))) #define RVAL2ATKHYPERTEXT(o) (ATK_HYPERTEXT(RVAL2GOBJ(o))) #define RVAL2ATKIMAGE(o) (ATK_IMAGE(RVAL2GOBJ(o))) #define RVAL2ATKIMPLEMENTOR(o) (ATK_IMPLEMENTOR(RVAL2GOBJ(o))) #define RVAL2ATKNOOPOBJECT(o) (ATK_NOOPOBJECT(RVAL2GOBJ(o))) #define RVAL2ATKNOOPOBJECTFACTORY(o) (ATK_NO_OP_OBJECT_FACTORY(RVAL2GOBJ(o))) #define RVAL2ATKOBJECT(o) (ATK_OBJECT(RVAL2GOBJ(o))) #define RVAL2ATKOBJECTFACTORY(o) (ATK_OBJECT_FACTORY(RVAL2GOBJ(o))) #define RVAL2ATKREGISTRY(o) (ATK_REGISTRY(RVAL2GOBJ(o))) #define RVAL2ATKRELATION(o) (ATK_RELATION(RVAL2GOBJ(o))) #define RVAL2ATKRELATIONSET(o) (ATK_RELATION_SET(RVAL2GOBJ(o))) #define RVAL2ATKSELECTION(o) (ATK_SELECTION(RVAL2GOBJ(o))) #define RVAL2ATKSTATE(o) (ATK_STATE(RVAL2GOBJ(o))) #define RVAL2ATKSTATESET(o) (ATK_STATE_SET(RVAL2GOBJ(o))) #define RVAL2ATKSTREAMABLECONTENT(o) (ATK_STREAMABLE_CONTENT(RVAL2GOBJ(o))) #define RVAL2ATKTABLE(o) (ATK_TABLE(RVAL2GOBJ(o))) #define RVAL2ATKTEXT(o) (ATK_TEXT(RVAL2GOBJ(o))) #define RVAL2ATKVALUE(o) (ATK_VALUE(RVAL2GOBJ(o))) #define RVAL2ATKTEXTRANGE(o) ((AtkTextRange*)RVAL2BOXED(o, ATK_TYPE_TEXT_RANGE)) #define ATKTEXTRANGE2RVAL(o) (BOXED2RVAL(o, ATK_TYPE_TEXT_RANGE)) #define RVAL2ATKTEXTRECTANGLE(o) ((AtkTextRectangle*)RVAL2BOXED(o, ATK_TYPE_TEXT_RECTANGLE)) #define ATKTEXTRECTANGLE2RVAL(o) (BOXED2RVAL(o, ATK_TYPE_TEXT_RECTANGLE)) #define RVAL2ATKCOORDTYPE(o) (RVAL2GENUM(o, ATK_TYPE_COORD_TYPE)) #define ATKCOORDTYPE2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_COORD_TYPE)) #define RVAL2ATKLAYER(o) (RVAL2GENUM(o, ATK_TYPE_LAYER)) #define ATKLAYER2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_LAYER)) #define RVAL2ATKRELATIONTYPE(o) (RVAL2GENUM(o, ATK_TYPE_RELATION_TYPE)) #define ATKRELATIONTYPE2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_RELATION_TYPE)) #define RVAL2ATKROLE(o) (RVAL2GENUM(o, ATK_TYPE_ROLE)) #define ATKROLE2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_ROLE)) #define RVAL2ATKSTATETYPE(o) (RVAL2GENUM(o, ATK_TYPE_STATE_TYPE)) #define ATKSTATETYPE2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_STATE_TYPE)) #define RVAL2ATKTEXTATTRIBUTE(o) (RVAL2GENUM(o, ATK_TYPE_TEXT_ATTRIBUTE)) #define ATKTEXTATTRIBUTE2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_TEXT_ATTRIBUTE)) #define RVAL2ATKTEXTBOUNDARY(o) (RVAL2GENUM(o, ATK_TYPE_TEXT_BOUNDARY)) #define ATKTEXTBOUNDARY2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_TEXT_BOUNDARY)) #define RVAL2ATKTEXTCLIPTYPE(o) (RVAL2GENUM(o, ATK_TYPE_TEXT_CLIP_TYPE)) #define ATKTEXTCLIPTYPE2RVAL(o) (GENUM2RVAL(o, ATK_TYPE_TEXT_CLIP_TYPE)) #endif /* __RBATKCONVERSIONS_H__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkobjectfactory.c����������������������������������������������0000644�0001750�0001750�00000003176�11701304107�020777� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cObjectFactory #define _SELF(s) (RVAL2ATKOBJECTFACTORY(s)) static VALUE rg_create_accessible(VALUE self, VALUE obj) { return GOBJ2RVAL(atk_object_factory_create_accessible(_SELF(self), RVAL2GOBJ(obj))); } static VALUE rg_accessible_type(VALUE self) { return GTYPE2CLASS(atk_object_factory_get_accessible_type(_SELF(self))); } static VALUE rg_invalidate(VALUE self) { atk_object_factory_invalidate(_SELF(self)); return self; } void Init_atk_objectfactory(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_OBJECT_FACTORY, "ObjectFactory", mAtk); RG_DEF_METHOD(create_accessible, 0); RG_DEF_METHOD(accessible_type, 0); RG_DEF_METHOD(invalidate, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/atk.def�����������������������������������������������������������0000644�0001750�0001750�00000000022�11701304107�016173� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������EXPORTS Init_atk ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkobjectrole.c�������������������������������������������������0000644�0001750�0001750�00000003115�11701304107�020262� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cRole static VALUE rg_localized_name(G_GNUC_UNUSED VALUE self) { #ifdef HAVE_ATK_ROLE_GET_LOCALIZED_NAME return CSTR2RVAL(atk_role_get_localized_name(RVAL2ATKROLE(self))); #else rb_warning("not supported in this version of ATK."); return Qnil; #endif } static VALUE rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKROLE2RVAL(atk_role_for_name(RVAL2CSTR(name))); } void Init_atk_object_role(VALUE cObject) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_ROLE, "Role", cObject); RG_DEF_METHOD(localized_name, 0); RG_DEF_SMETHOD(for_name, 1); G_DEF_CONSTANTS(cObject, ATK_TYPE_ROLE, "ATK_"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatktable.c������������������������������������������������������0000664�0001750�0001750�00000016244�11740310343�017234� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mTable #define _SELF(s) (RVAL2ATKTABLE(s)) static VALUE rg_ref_at(VALUE self, VALUE row, VALUE column) { return GOBJ2RVAL(atk_table_ref_at(_SELF(self), NUM2INT(row), NUM2INT(column))); } static VALUE rg_get_index_at(VALUE self, VALUE row, VALUE column) { return INT2NUM(atk_table_get_index_at(_SELF(self), NUM2INT(row), NUM2INT(column))); } static VALUE rg_get_column_at_index(VALUE self, VALUE index_) { return INT2NUM(atk_table_get_column_at_index(_SELF(self), NUM2INT(index_))); } static VALUE rg_get_row_at_index(VALUE self, VALUE index_) { return INT2NUM(atk_table_get_row_at_index(_SELF(self), NUM2INT(index_))); } static VALUE rg_n_columns(VALUE self) { return INT2NUM(atk_table_get_n_columns(_SELF(self))); } static VALUE rg_n_rows(VALUE self) { return INT2NUM(atk_table_get_n_rows(_SELF(self))); } static VALUE rg_get_column_extent_at(VALUE self, VALUE row, VALUE column) { return INT2NUM(atk_table_get_column_extent_at(_SELF(self), NUM2INT(row), NUM2INT(column))); } static VALUE rg_get_row_extent_at(VALUE self, VALUE row, VALUE column) { return INT2NUM(atk_table_get_row_extent_at(_SELF(self), NUM2INT(row), NUM2INT(column))); } static VALUE rg_caption(VALUE self) { return GOBJ2RVAL(atk_table_get_caption(_SELF(self))); } static VALUE rg_get_column_description(VALUE self, VALUE column) { return CSTR2RVAL(atk_table_get_column_description(_SELF(self), NUM2INT(column))); } static VALUE rg_get_row_description(VALUE self, VALUE row) { return CSTR2RVAL(atk_table_get_row_description(_SELF(self), NUM2INT(row))); } static VALUE rg_get_column_header(VALUE self, VALUE column) { return GOBJ2RVAL(atk_table_get_column_header(_SELF(self), NUM2INT(column))); } static VALUE rg_get_row_header(VALUE self, VALUE row) { return GOBJ2RVAL(atk_table_get_row_header(_SELF(self), NUM2INT(row))); } static VALUE rg_summary(VALUE self) { return GOBJ2RVAL(atk_table_get_summary(_SELF(self))); } static VALUE rg_set_caption(VALUE self, VALUE caption) { atk_table_set_caption(_SELF(self), RVAL2ATKOBJECT(caption)); return self; } static VALUE rg_set_row_description(VALUE self, VALUE row, VALUE description) { atk_table_set_row_description(_SELF(self), NUM2INT(row), RVAL2CSTR(description)); return self; } static VALUE rg_set_column_description(VALUE self, VALUE column, VALUE description) { atk_table_set_column_description(_SELF(self), NUM2INT(column), RVAL2CSTR(description)); return self; } static VALUE rg_set_row_header(VALUE self, VALUE row, VALUE header) { atk_table_set_row_header(_SELF(self), NUM2INT(row), RVAL2ATKOBJECT(header)); return self; } static VALUE rg_set_column_header(VALUE self, VALUE column, VALUE header) { atk_table_set_column_header(_SELF(self), NUM2INT(column), RVAL2ATKOBJECT(header)); return self; } static VALUE rg_set_summary(VALUE self, VALUE accessible) { atk_table_set_summary(_SELF(self), RVAL2ATKOBJECT(accessible)); return self; } static VALUE rg_selected_columns(VALUE self) { gint ret; gint* selected; VALUE result = Qnil; ret = atk_table_get_selected_columns(_SELF(self), &selected); if (ret > 0){ gint i; result = rb_ary_new2(ret); for (i = 0; i < ret; i++){ rb_ary_push(result, INT2NUM(selected[i])); } } return result; } static VALUE rg_selected_rows(VALUE self) { gint ret; gint* selected; VALUE result = Qnil; ret = atk_table_get_selected_rows(_SELF(self), &selected); if (ret > 0){ gint i; result = rb_ary_new2(ret); for (i = 0; i < ret; i++){ rb_ary_push(result, INT2NUM(selected[i])); } } return result; } static VALUE rg_column_selected_p(VALUE self, VALUE column) { return CBOOL2RVAL(atk_table_is_column_selected(_SELF(self), NUM2INT(column))); } static VALUE rg_row_selected_p(VALUE self, VALUE row) { return CBOOL2RVAL(atk_table_is_row_selected(_SELF(self), NUM2INT(row))); } static VALUE rg_selected_p(VALUE self, VALUE row, VALUE column) { return CBOOL2RVAL(atk_table_is_selected(_SELF(self), NUM2INT(row), NUM2INT(column))); } static VALUE rg_add_column_selection(VALUE self, VALUE column) { gboolean ret = atk_table_add_column_selection(_SELF(self), NUM2INT(column)); if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface"); return self; } static VALUE rg_add_row_selection(VALUE self, VALUE row) { gboolean ret = atk_table_add_row_selection(_SELF(self), NUM2INT(row)); if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface"); return self; } static VALUE rg_remove_column_selection(VALUE self, VALUE column) { gboolean ret = atk_table_remove_column_selection(_SELF(self), NUM2INT(column)); if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface"); return self; } static VALUE rg_remove_row_selection(VALUE self, VALUE row) { gboolean ret = atk_table_remove_row_selection(_SELF(self), NUM2INT(row)); if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface"); return self; } void Init_atk_table(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_TABLE, "Table", mAtk); RG_DEF_METHOD(ref_at, 2); RG_DEF_METHOD(get_index_at, 2); RG_DEF_METHOD(get_column_at_index, 1); RG_DEF_METHOD(get_row_at_index, 1); RG_DEF_METHOD(n_columns, 0); RG_DEF_METHOD(n_rows, 0); RG_DEF_METHOD(get_column_extent_at, 2); RG_DEF_METHOD(get_row_extent_at, 2); RG_DEF_METHOD(caption, 0); RG_DEF_METHOD(get_column_description, 1); RG_DEF_METHOD(get_row_description, 1); RG_DEF_METHOD(get_column_header, 1); RG_DEF_METHOD(get_row_header, 1); RG_DEF_METHOD(summary, 0); RG_DEF_METHOD(set_caption, 1); RG_DEF_METHOD(set_row_description, 2); RG_DEF_METHOD(set_column_description, 2); RG_DEF_METHOD(set_row_header, 2); RG_DEF_METHOD(set_column_header, 2); RG_DEF_METHOD(set_summary, 1); RG_DEF_METHOD(selected_columns, 0); RG_DEF_METHOD(selected_rows, 0); RG_DEF_METHOD_P(column_selected, 1); RG_DEF_METHOD_P(row_selected, 1); RG_DEF_METHOD_P(selected, 2); RG_DEF_METHOD(add_column_selection, 1); RG_DEF_METHOD(add_row_selection, 1); RG_DEF_METHOD(remove_column_selection, 1); RG_DEF_METHOD(remove_row_selection, 1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkobject.c�����������������������������������������������������0000644�0001750�0001750�00000012065�11701304107�017404� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cObject #define _SELF(s) RVAL2ATKOBJECT(s) /* How can I implement this? Since 1.10 AtkObject* atk_implementor_ref_accessible (AtkImplementor *implementor); */ /* Use properties accessible_* G_CONST_RETURN gchar* atk_object_get_name (AtkObject *accessible); G_CONST_RETURN gchar* atk_object_get_description (AtkObject *accessible); AtkObject* atk_object_get_parent (AtkObject *accessible); (AtkObject *accessible); */ static VALUE rg_n_accessible_children(VALUE self) { return INT2NUM(atk_object_get_n_accessible_children(_SELF(self))); } static VALUE rg_ref_accessible_child(VALUE self, VALUE i) { return GOBJ2RVAL(atk_object_ref_accessible_child(_SELF(self), NUM2INT(i))); } static VALUE rg_ref_relation_set(VALUE self) { return GOBJ2RVAL(atk_object_ref_relation_set(_SELF(self))); } /* Use properties accessible_* AtkLayer atk_object_get_layer (AtkObject *accessible); gint atk_object_get_mdi_zorder (AtkObject *accessible); AtkRole atk_object_get_role (AtkObject *accessible); */ static VALUE rg_ref_state_set(VALUE self) { return GOBJ2RVAL(atk_object_ref_state_set(_SELF(self))); } static VALUE rg_index_in_parent(VALUE self) { return INT2NUM(atk_object_get_index_in_parent(_SELF(self))); } /* Use properties accessible_* void atk_object_set_name (AtkObject *accessible, const gchar *name); void atk_object_set_description (AtkObject *accessible, const gchar *description); void atk_object_set_parent (AtkObject *accessible, AtkObject *parent); void atk_object_set_role (AtkObject *accessible, AtkRole role); */ /* guint atk_object_connect_property_change_handler (AtkObject *accessible, AtkPropertyChangeHandler *handler); void atk_object_remove_property_change_handler (AtkObject *accessible, guint handler_id); */ static VALUE rg_notify_state_change(VALUE self, VALUE state, VALUE value) { atk_object_notify_state_change(_SELF(self), RVAL2ATKSTATETYPE(state), RVAL2CBOOL(value)); return self; } /* I don't have a good idea to implement this method. Any idea? void atk_object_initialize (AtkObject *accessible, gpointer data); */ #ifdef HAVE_ATK_OBJECT_ADD_RELATIONSHIP static VALUE rg_add_relationship(VALUE self, VALUE relationship, VALUE target) { return CBOOL2RVAL(atk_object_add_relationship( _SELF(self), RVAL2ATKRELATIONTYPE(relationship), _SELF(target))); } #endif #ifdef HAVE_ATK_OBJECT_REMOVE_RELATIONSHIP static VALUE rg_remove_relationship(VALUE self, VALUE relationship, VALUE target) { return CBOOL2RVAL(atk_object_remove_relationship( _SELF(self), RVAL2ATKRELATIONTYPE(relationship), _SELF(target))); } #endif void Init_atk_object(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_OBJECT, "Object", mAtk); RG_DEF_METHOD(n_accessible_children, 0); RG_DEF_METHOD(ref_accessible_child, 1); RG_DEF_METHOD(ref_relation_set, 0); RG_DEF_METHOD(ref_state_set, 0); RG_DEF_METHOD(index_in_parent, 0); RG_DEF_METHOD(notify_state_change, 2); #ifdef HAVE_ATK_OBJECT_ADD_RELATIONSHIP RG_DEF_METHOD(add_relationship, 2); #endif #ifdef HAVE_ATK_OBJECT_REMOVE_RELATIONSHIP RG_DEF_METHOD(remove_relationship, 2); #endif Init_atk_object_role(RG_TARGET_NAMESPACE); /* AtkLayer */ G_DEF_CLASS(ATK_TYPE_LAYER, "Layer", RG_TARGET_NAMESPACE); G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_LAYER, "ATK_"); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkprivate.h����������������������������������������������������0000644�0001750�0001750�00000003453�11701304107�017616� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef RB_ATK_PRIVATE_H #define RB_ATK_PRIVATE_H #include "rbatk.h" #ifndef HAVE_RB_ERRINFO # define rb_errinfo() (ruby_errinfo) #endif #ifndef G_VALUE_INIT # define G_VALUE_INIT { 0, { { 0 } } } #endif G_BEGIN_DECLS G_GNUC_INTERNAL void Init_atk_action(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_component(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_document(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_editabletext(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_gobjectaccessible(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_hyperlink(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_hypertext(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_image(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_implementor(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_noopobject(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_noopobjectfactory(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_object(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_object_role(VALUE cObject); G_GNUC_INTERNAL void Init_atk_objectfactory(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_registry(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_relation(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_relation_type(VALUE cRelation); G_GNUC_INTERNAL void Init_atk_relation_set(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_selection(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_state(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_state_set(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_streamable_content(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_table(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_text(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_text_attribute(VALUE mText); G_GNUC_INTERNAL void Init_atk_text_range(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_text_rectangle(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_util(VALUE mAtk); G_GNUC_INTERNAL void Init_atk_value(VALUE mAtk); G_END_DECLS #endif /* RB_ATK_PRIVATE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatktextattribute.c����������������������������������������������0000644�0001750�0001750�00000003404�11701304107�021043� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cAttribute static VALUE rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKTEXTATTRIBUTE2RVAL(atk_text_attribute_register(RVAL2CSTR(name))); } static VALUE rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name) { return ATKTEXTATTRIBUTE2RVAL(atk_text_attribute_for_name(RVAL2CSTR(name))); } static VALUE rg_get_value(VALUE self, VALUE index) { return CSTR2RVAL(atk_text_attribute_get_value(RVAL2ATKTEXTATTRIBUTE(self), NUM2INT(index))); } void Init_atk_text_attribute(VALUE mText) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_TEXT_ATTRIBUTE, "Attribute", mText); G_DEF_CONSTANTS(mText, ATK_TYPE_TEXT_ATTRIBUTE, "ATK_TEXT_"); RG_DEF_SMETHOD(type_register, 1); RG_DEF_SMETHOD(for_name, 1); RG_DEF_METHOD(get_value, 1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkstateset.c���������������������������������������������������0000644�0001750�0001750�00000010544�11701304107�017772� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cStateSet #define _SELF(s) (RVAL2ATKSTATESET(s)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, atk_state_set_new()); return Qnil; } static VALUE rg_empty_p(VALUE self) { return CBOOL2RVAL(atk_state_set_is_empty(_SELF(self))); } static VALUE rg_add_state(VALUE self, VALUE type) { return CBOOL2RVAL(atk_state_set_add_state(_SELF(self), RVAL2ATKSTATETYPE(type))); } struct rval2atkstatetype_args { VALUE ary; long n; AtkStateType *result; }; static VALUE rval2atkstatetype_body(VALUE value) { long i; struct rval2atkstatetype_args *args = (struct rval2atkstatetype_args *)value; for (i = 0; i < args->n; i++) args->result[i] = RVAL2ATKSTATETYPE(RARRAY_PTR(args->ary)[i]); return Qnil; } static G_GNUC_NORETURN VALUE rval2atkstatetype_rescue(VALUE value) { g_free(((struct rval2atkstatetype_args *)value)->result); rb_exc_raise(rb_errinfo()); } static AtkStateType * rval2atkstatetype(VALUE value, long *n) { struct rval2atkstatetype_args args; args.ary = rb_ary_to_ary(value); args.n = RARRAY_LEN(args.ary); args.result = g_new(AtkStateType, args.n + 1); rb_rescue(rval2atkstatetype_body, (VALUE)&args, rval2atkstatetype_rescue, (VALUE)&args); if (n != NULL) *n = args.n; return args.result; } #define RVAL2ATKSTATETYPES(value, n) rval2atkstatetype(value, n) static VALUE rg_add_states(VALUE self, VALUE rbtypes) { AtkStateSet *set = _SELF(self); long n; AtkStateType *types = RVAL2ATKSTATETYPES(rbtypes, &n); atk_state_set_add_states(set, types, n); g_free(types); return self; } static VALUE rg_clear_states(VALUE self) { atk_state_set_clear_states(_SELF(self)); return self; } static VALUE rg_contains_state(VALUE self, VALUE type) { return CBOOL2RVAL(atk_state_set_contains_state(_SELF(self), RVAL2ATKSTATETYPE(type))); } static VALUE rg_contains_states(VALUE self, VALUE rbtypes) { AtkStateSet *set = _SELF(self); long n; AtkStateType *types = RVAL2ATKSTATETYPES(rbtypes, &n); gboolean result; result = atk_state_set_contains_states(set, types, n); g_free(types); return CBOOL2RVAL(result); } static VALUE rg_remove_state(VALUE self, VALUE type) { return CBOOL2RVAL(atk_state_set_remove_state(_SELF(self), RVAL2ATKSTATETYPE(type))); } static VALUE rg_and(VALUE self, VALUE compare_set) { return GOBJ2RVAL(atk_state_set_and_sets(_SELF(self), _SELF(compare_set))); } static VALUE rg_or(VALUE self, VALUE compare_set) { return GOBJ2RVAL(atk_state_set_or_sets(_SELF(self), _SELF(compare_set))); } static VALUE rg_xor(VALUE self, VALUE compare_set) { return GOBJ2RVAL(atk_state_set_xor_sets(_SELF(self), _SELF(compare_set))); } void Init_atk_state_set(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_STATE_SET, "StateSet", mAtk); RG_DEF_METHOD(initialize, 0); RG_DEF_METHOD_P(empty, 0); RG_DEF_METHOD(add_state, 1); RG_DEF_METHOD(add_states, 1); RG_DEF_METHOD(clear_states, 0); RG_DEF_METHOD(contains_state, 1); RG_DEF_METHOD(contains_states, 1); RG_DEF_METHOD(remove_state, 1); RG_DEF_METHOD(and, 1); RG_DEF_ALIAS("&", "and"); RG_DEF_METHOD(or, 1); RG_DEF_ALIAS("|", "or"); RG_DEF_METHOD(xor, 1); RG_DEF_ALIAS("^", "xor"); } ������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatknoopobjectfactory.c������������������������������������������0000644�0001750�0001750�00000002470�11701304107�021667� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE cNoOpObjectFactory #define _SELF(s) (RVAL2ATKNOOPOBJECTFACTORY(s)) static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, atk_no_op_object_factory_new()); return Qnil; } void Init_atk_noopobjectfactory(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_NO_OP_OBJECT_FACTORY, "NoOpObjectFactory", mAtk); RG_DEF_METHOD(initialize, 0); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkhypertext.c��������������������������������������������������0000644�0001750�0001750�00000003136�11701304107�020171� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mHypertext #define _SELF(s) (RVAL2ATKHYPERTEXT(s)) static VALUE rg_get_link(VALUE self, VALUE link_index) { return GOBJ2RVAL(atk_hypertext_get_link(_SELF(self), NUM2INT(link_index))); } static VALUE rg_n_links(VALUE self) { return INT2NUM(atk_hypertext_get_n_links(_SELF(self))); } static VALUE rg_link_index(VALUE self, VALUE char_index) { return INT2NUM(atk_hypertext_get_link_index(_SELF(self), NUM2INT(char_index))); } void Init_atk_hypertext(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_HYPERTEXT, "Hypertext", mAtk); RG_DEF_METHOD(get_link, 1); RG_DEF_METHOD(n_links, 0); RG_DEF_METHOD(link_index, 1); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/ext/atk/rbatkdocument.c���������������������������������������������������0000644�0001750�0001750�00000005357�12257552167�020004� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -*- 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 "rbatkprivate.h" #define RG_TARGET_NAMESPACE mDocument #define _SELF(s) (RVAL2ATKDOCUMENT(s)) static VALUE rg_document_type(VALUE self) { return CSTR2RVAL(atk_document_get_document_type(_SELF(self))); } /* How can I implement this? static VALUE rg_document(VALUE self) { return GOBJ2RVAL(atk_document_get_document(_SELF(self))); } */ static VALUE rg_get_attribute_value(VALUE self, VALUE name) { return CSTR2RVAL(atk_document_get_attribute_value(_SELF(self), RVAL2CSTR(name))); } static VALUE rg_set_attribute_value(VALUE self, VALUE name, VALUE value) { gboolean ret = atk_document_set_attribute_value(_SELF(self), RVAL2CSTR(name), RVAL2CSTR(value)); if (! ret) rb_raise(rb_eRuntimeError, "Can't set attribute value: %s, %s", RVAL2CSTR(name), RVAL2CSTR(value)); return self; } static VALUE rg_attributes(VALUE self) { AtkAttributeSet* list = atk_document_get_attributes(_SELF(self)); VALUE ary = rb_ary_new(); while (list) { AtkAttribute* attr = list->data; rb_ary_push(ary, rb_assoc_new(CSTR2RVAL(attr->name), CSTR2RVAL(attr->value))); list = list->next; } return ary; } static VALUE rg_locale(VALUE self) { return CSTR2RVAL(atk_document_get_locale(_SELF(self))); } void Init_atk_document(VALUE mAtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_DOCUMENT, "Document", mAtk); RG_DEF_METHOD(document_type, 0); /* RG_DEF_METHOD(document, 0); */ RG_DEF_METHOD(get_attribute_value, 1); RG_DEF_ALIAS("[]", "get_attribute_value"); RG_DEF_METHOD(set_attribute_value, 2); RG_DEF_ALIAS("[]=", "set_attribute_value"); RG_DEF_METHOD(attributes, 0); RG_DEF_METHOD(locale, 0); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/COPYING.LIB���������������������������������������������������������������0000644�0001750�0001750�00000063642�12257552167�015060� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! ����������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/lib/����������������������������������������������������������������������0000755�0001750�0001750�00000000000�12516441043�014137� 5����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/lib/atk.rb����������������������������������������������������������������0000644�0001750�0001750�00000001060�12137115064�015240� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������require 'glib2' base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path vendor_dir = base_dir + "vendor" + "local" vendor_bin_dir = vendor_dir + "bin" GLib.prepend_dll_path(vendor_bin_dir) begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/atk.so" rescue LoadError require 'atk.so' end if vendor_dir.exist? begin require "gobject-introspection" vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0" GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir) rescue LoadError end end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ruby-gnome2-all-2.2.5/atk/README��������������������������������������������������������������������0000644�0001750�0001750�00000001264�12257552167�014270� 0����������������������������������������������������������������������������������������������������ustar �kou�����������������������������kou��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Ruby/ATK =============== Ruby/ATK is a Ruby binding of ATK-1.12.x or later. Requirements ------------ Ruby: http://www.ruby-lang.org/ GLib: http://www.gtk.org/ ATK: http://developer.gnome.org/projects/gap Ruby/GLib2: http://ruby-gnome2.sourceforge.net/ Install ------- 0. install ruby-1.9.x or later, GLib, ATK, Ruby/GLib2. 1. ruby extconf.rb 2. make 3. su 4. make install Copying ------- Copyright (c) 2003-2005 Ruby-GNOME2 Project Team This program is free software. You can distribute/modify this program under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. Project Website --------------- http://ruby-gnome2.sourceforge.jp/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������