From 7fc53294f27a325b15cf0dc81caa40bebb28b080 Mon Sep 17 00:00:00 2001 From: nagai Date: Tue, 3 Aug 2004 04:49:20 +0000 Subject: * ext/tk/lib/tk/namespace.rb: bug fix * ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: add Tk::TreeCtrl.loupe git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/tkextlib/treectrl/tktreectrl.rb | 32 ++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'ext/tk/lib/tkextlib/treectrl/tktreectrl.rb') diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb index 0e57b7c194..3ea1a324cb 100644 --- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb +++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb @@ -15,7 +15,7 @@ require 'tkextlib/treectrl/setup.rb' TkPackage.require('treectrl') module Tk - class TreeCtrl_Widget < TkWindow + class TreeCtrl < TkWindow def self.package_version begin TkPackage.require('treectrl') @@ -24,17 +24,37 @@ module Tk end end + # dummy :: + # pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for + # 'loupe' command (probably it is bug, I think). + # So, calling a 'treectrl' command for loading the dll with + # the auto_load facility. + begin + tk_call('treectrl') + rescue + end + def self.loupe(img, x, y, w, h, zoom) + # NOTE: platform == 'unix' only + + # img => TkPhotoImage + # x, y => screen coords + # w, h => magnifier width and height + # zoom => zooming rate + Tk.tk_call_without_enc('loupe', img, x, y, w, h, zoom) + end + class NotifyEvent < TkUtil::CallbackSubst end module ConfigMethod end end + TreeCtrl_Widget = TreeCtrl end ############################################## -class Tk::TreeCtrl_Widget::NotifyEvent +class Tk::TreeCtrl::NotifyEvent # [ <'%' subst-key char>, , ] KEY_TBL = [ [ ?c, ?n, :item_num ], @@ -94,7 +114,7 @@ end ############################################## -module Tk::TreeCtrl_Widget::ConfigMethod +module Tk::TreeCtrl::ConfigMethod include TkItemConfigMethod def treectrl_tagid(key, obj) @@ -312,8 +332,8 @@ end ############################################## -class Tk::TreeCtrl_Widget - include Tk::TreeCtrl_Widget::ConfigMethod +class Tk::TreeCtrl + include Tk::TreeCtrl::ConfigMethod include Scrollable TkCommandNames = ['treectrl'.freeze].freeze @@ -321,7 +341,7 @@ class Tk::TreeCtrl_Widget WidgetClassNames[WidgetClassName] = self def install_bind(cmd, *args) - install_bind_for_event_class(Tk::TreeCtrl_Widget::NotifyEvent, cmd, *args) + install_bind_for_event_class(Tk::TreeCtrl::NotifyEvent, cmd, *args) end ######################### -- cgit v1.2.3