mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
tk.rb :
* TkWindow include TkWinfo * treat unknown widget classes as subclasses of TkWindow git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2e4fc59d1c
commit
28f8fc7f88
2 changed files with 25 additions and 11 deletions
|
@ -607,7 +607,7 @@ ip_init(self)
|
||||||
}
|
}
|
||||||
DUMP1("Tk_Init");
|
DUMP1("Tk_Init");
|
||||||
if (Tk_Init(ptr->ip) == TCL_ERROR) {
|
if (Tk_Init(ptr->ip) == TCL_ERROR) {
|
||||||
rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
|
rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
|
||||||
}
|
}
|
||||||
DUMP1("Tcl_StaticPackage(\"Tk\")");
|
DUMP1("Tcl_StaticPackage(\"Tk\")");
|
||||||
#if TCL_MAJOR_VERSION >= 8
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
|
|
|
@ -62,19 +62,32 @@ module TkComm
|
||||||
return path
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
ruby_class = WidgetClassNames[tk_class]
|
if ruby_class = WidgetClassNames[tk_class]
|
||||||
gen_class_name = ruby_class.name + 'GeneratedOnTk'
|
ruby_class_name = ruby_class.name
|
||||||
unless Object.const_defined? gen_class_name
|
gen_class_name = ruby_class_name + 'GeneratedOnTk'
|
||||||
eval "class #{gen_class_name}<#{ruby_class.name}
|
classname_def = ''
|
||||||
def initialize(path)
|
elsif Object.const_defined?('Tk' + tk_class)
|
||||||
@path=path
|
ruby_class_name = 'Tk' + tk_class
|
||||||
Tk_WINDOWS[@path] = self
|
gen_class_name = ruby_class_name + 'GeneratedOnTk'
|
||||||
end
|
classname_def = ''
|
||||||
end"
|
else
|
||||||
|
ruby_class_name = 'TkWindow'
|
||||||
|
gen_class_name = ruby_class_name + tk_class + 'GeneratedOnTk'
|
||||||
|
classname_def = "WidgetClassName = '#{tk_class}'.freeze"
|
||||||
end
|
end
|
||||||
eval "#{gen_class_name}.new('#{path}')"
|
unless Object.const_defined? gen_class_name
|
||||||
|
Object.class_eval "class #{gen_class_name}<#{ruby_class_name}
|
||||||
|
#{classname_def}
|
||||||
|
def initialize(path)
|
||||||
|
@path=path
|
||||||
|
Tk_WINDOWS[@path] = self
|
||||||
|
end
|
||||||
|
end"
|
||||||
|
end
|
||||||
|
Object.class_eval "#{gen_class_name}.new('#{path}')"
|
||||||
end
|
end
|
||||||
private :_genobj_for_tkwidget
|
private :_genobj_for_tkwidget
|
||||||
|
module_function :_genobj_for_tkwidget
|
||||||
|
|
||||||
def tk_tcl2ruby(val)
|
def tk_tcl2ruby(val)
|
||||||
if val =~ /^rb_out (c\d+)/
|
if val =~ /^rb_out (c\d+)/
|
||||||
|
@ -3224,6 +3237,7 @@ class TkObject<TkKernel
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkWindow<TkObject
|
class TkWindow<TkObject
|
||||||
|
include TkWinfo
|
||||||
extend TkBindCore
|
extend TkBindCore
|
||||||
|
|
||||||
WidgetClassName = ''.freeze
|
WidgetClassName = ''.freeze
|
||||||
|
|
Loading…
Reference in a new issue