summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tkextlib/tktrans/tktrans.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tkextlib/tktrans/tktrans.rb')
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/ext/tk/lib/tkextlib/tktrans/tktrans.rb b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
new file mode 100644
index 0000000000..fa5d7a2eae
--- /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