mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
84fddcff2f
commit
7fc53294f2
2 changed files with 30 additions and 10 deletions
|
|
@ -133,8 +133,8 @@ class TkNamespace < TkObject
|
||||||
# <pattern> must be glob-style pattern
|
# <pattern> must be glob-style pattern
|
||||||
tk_split_simplelist(tk_call('namespace', 'children', *args)).collect{|ns|
|
tk_split_simplelist(tk_call('namespace', 'children', *args)).collect{|ns|
|
||||||
# ns is fullname
|
# ns is fullname
|
||||||
if Tk_Namesapce_ID.key?(ns)
|
if Tk_Namespace_ID_TBL.key?(ns)
|
||||||
Tk_Namesapce_ID[ns]
|
Tk_Namespace_ID_TBL[ns]
|
||||||
else
|
else
|
||||||
ns
|
ns
|
||||||
end
|
end
|
||||||
|
|
@ -264,8 +264,8 @@ class TkNamespace < TkObject
|
||||||
|
|
||||||
def self.parent(namespace=None)
|
def self.parent(namespace=None)
|
||||||
ns = tk_call('namespace', 'parent', namespace)
|
ns = tk_call('namespace', 'parent', namespace)
|
||||||
if Tk_Namesapce_ID.key?(ns)
|
if Tk_Namespace_ID_TBL.key?(ns)
|
||||||
Tk_Namesapce_ID[ns]
|
Tk_Namespace_ID_TBL[ns]
|
||||||
else
|
else
|
||||||
ns
|
ns
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ require 'tkextlib/treectrl/setup.rb'
|
||||||
TkPackage.require('treectrl')
|
TkPackage.require('treectrl')
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
class TreeCtrl_Widget < TkWindow
|
class TreeCtrl < TkWindow
|
||||||
def self.package_version
|
def self.package_version
|
||||||
begin
|
begin
|
||||||
TkPackage.require('treectrl')
|
TkPackage.require('treectrl')
|
||||||
|
|
@ -24,17 +24,37 @@ module Tk
|
||||||
end
|
end
|
||||||
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
|
class NotifyEvent < TkUtil::CallbackSubst
|
||||||
end
|
end
|
||||||
|
|
||||||
module ConfigMethod
|
module ConfigMethod
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TreeCtrl_Widget = TreeCtrl
|
||||||
end
|
end
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
class Tk::TreeCtrl_Widget::NotifyEvent
|
class Tk::TreeCtrl::NotifyEvent
|
||||||
# [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
|
# [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
|
||||||
KEY_TBL = [
|
KEY_TBL = [
|
||||||
[ ?c, ?n, :item_num ],
|
[ ?c, ?n, :item_num ],
|
||||||
|
|
@ -94,7 +114,7 @@ end
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
module Tk::TreeCtrl_Widget::ConfigMethod
|
module Tk::TreeCtrl::ConfigMethod
|
||||||
include TkItemConfigMethod
|
include TkItemConfigMethod
|
||||||
|
|
||||||
def treectrl_tagid(key, obj)
|
def treectrl_tagid(key, obj)
|
||||||
|
|
@ -312,8 +332,8 @@ end
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
class Tk::TreeCtrl_Widget
|
class Tk::TreeCtrl
|
||||||
include Tk::TreeCtrl_Widget::ConfigMethod
|
include Tk::TreeCtrl::ConfigMethod
|
||||||
include Scrollable
|
include Scrollable
|
||||||
|
|
||||||
TkCommandNames = ['treectrl'.freeze].freeze
|
TkCommandNames = ['treectrl'.freeze].freeze
|
||||||
|
|
@ -321,7 +341,7 @@ class Tk::TreeCtrl_Widget
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def install_bind(cmd, *args)
|
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
|
end
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue