diff options
Diffstat (limited to 'ext/tk/lib/tkextlib/tktrans')
| -rw-r--r-- | ext/tk/lib/tkextlib/tktrans/setup.rb | 8 | ||||
| -rw-r--r-- | ext/tk/lib/tkextlib/tktrans/tktrans.rb | 53 |
2 files changed, 61 insertions, 0 deletions
diff --git a/ext/tk/lib/tkextlib/tktrans/setup.rb b/ext/tk/lib/tkextlib/tktrans/setup.rb new file mode 100644 index 000000000..ce0f0bd4d --- /dev/null +++ b/ext/tk/lib/tkextlib/tktrans/setup.rb @@ -0,0 +1,8 @@ +# +# setup.rb -- setup script before calling TkPackage.require() +# +# If you need some setup operations (for example, add a library path +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup +# operations in this file. +# diff --git a/ext/tk/lib/tkextlib/tktrans/tktrans.rb b/ext/tk/lib/tkextlib/tktrans/tktrans.rb new file mode 100644 index 000000000..fa5d7a2ea --- /dev/null +++ b/ext/tk/lib/tkextlib/tktrans/tktrans.rb @@ -0,0 +1,53 @@ +# +# TkTrans support (win32 only) +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +require 'tk' + +# call setup script for general 'tkextlib' libraries +require 'tkextlib/setup.rb' + +# call setup script +require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb') + +TkPackage.require('tktrans') rescue Tk.load_tcllibrary('tktrans') + +class TkWindow + begin + TkTrans_VERSION = TkPackage.require('tktrans') + rescue + TkTrans_VERSION = nil + end + + def tktrans_set_image(img) + tk_send('tktrans::setwidget', @path, img) + self + end + def tktrans_get_image() + tk_send('tktrans::setwidget', @path) + end +end + +class TkRoot + undef tktrans_set_image, tktrans_get_image + + def tktrans_set_image(img) + tk_send('tktrans::settoplevel', @path, img) + self + end + def tktrans_get_image() + tk_send('tktrans::settoplevel', @path) + end +end + +class TkToplevel + undef tktrans_set_image, tktrans_get_image + + def tktrans_set_image(img) + tk_send('tktrans::settoplevel', @path, img) + self + end + def tktrans_get_image() + tk_send('tktrans::settoplevel', @path) + end +end |
