mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tcltklib/tcltklib.c (ip_init): set root-win title to "ruby" when
the running script is '-e one-liner' or '-' (stdin). * ext/tcltklib/extconf.rb: add find_library("#{lib}#{ver}",..) for stub libs * ext/tk/lib/tk/textmark.rb: TkTextMarkCurrent and TkTextMarkAnchor have a wrong parent class. * ext/tk/lib/tk/dialog.rb: rename TkDialog2 --> TkDialogObj and TkWarning2 --> TkWarningObj (old names are changed to alias names) * ext/tk/lib/tk/dialog.rb: bug fix of treatment of 'prev_command' option and hashes for configuration * ext/tk/lib/tk/dialog.rb: add TkDialogObj#name to return the button name * ext/tk/lib/tk/radiobutton.rb: rename enbugged method value() ==> get_value() and value=(val) ==> set_value(val). * ext/tk/lib/tk/menu.rb: add TkMenu.new_menuspec * ext/tk/lib/tk/menu.rb: add alias (TkMenuButton = TkMenubutton, TkOptionMenuButton = TkOptionMenubutton) * ext/tk/lib/tk/event.rb: new method aliases (same as option keys of event_generate) for Event object * ext/tk/lib/tk/font.rb: configinfo returns proper types of values * ext/tk/lib/tk.rb: bind methods accept subst_args + block * ext/tk/lib/tk/canvas.rb: ditto * ext/tk/lib/tk/canvastag.rb: ditto * ext/tk/lib/tk/frame.rb: ditto * ext/tk/lib/tk/text.rb: ditto * ext/tk/lib/tk/texttag.rb: ditto * ext/tk/lib/tk/toplevel.rb: ditto * ext/tk/lib/tkextlib/*: ditto and bug fix git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
642e10156c
commit
b9bdee95f1
25 changed files with 688 additions and 118 deletions
49
ChangeLog
49
ChangeLog
|
@ -1,3 +1,52 @@
|
|||
Thu Dec 9 03:08:36 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tcltklib/tcltklib.c (ip_init): set root-win title to "ruby" when
|
||||
the running script is '-e one-liner' or '-' (stdin).
|
||||
|
||||
* ext/tcltklib/extconf.rb: add find_library("#{lib}#{ver}",..) for
|
||||
stub libs
|
||||
|
||||
* ext/tk/lib/tk/textmark.rb: TkTextMarkCurrent and TkTextMarkAnchor
|
||||
have a wrong parent class.
|
||||
|
||||
* ext/tk/lib/tk/dialog.rb: rename TkDialog2 --> TkDialogObj and
|
||||
TkWarning2 --> TkWarningObj (old names are changed to alias names)
|
||||
|
||||
* ext/tk/lib/tk/dialog.rb: bug fix of treatment of 'prev_command'
|
||||
option and hashes for configuration
|
||||
|
||||
* ext/tk/lib/tk/dialog.rb: add TkDialogObj#name to return the
|
||||
button name
|
||||
|
||||
* ext/tk/lib/tk/radiobutton.rb: rename enbugged method value() ==>
|
||||
get_value() and value=(val) ==> set_value(val).
|
||||
|
||||
* ext/tk/lib/tk/menu.rb: add TkMenu.new_menuspec
|
||||
|
||||
* ext/tk/lib/tk/menu.rb: add alias (TkMenuButton = TkMenubutton,
|
||||
TkOptionMenuButton = TkOptionMenubutton)
|
||||
|
||||
* ext/tk/lib/tk/event.rb: new method aliases (same as option keys of
|
||||
event_generate) for Event object
|
||||
|
||||
* ext/tk/lib/tk/font.rb: configinfo returns proper types of values
|
||||
|
||||
* ext/tk/lib/tk.rb: bind methods accept subst_args + block
|
||||
|
||||
* ext/tk/lib/tk/canvas.rb: ditto
|
||||
|
||||
* ext/tk/lib/tk/canvastag.rb: ditto
|
||||
|
||||
* ext/tk/lib/tk/frame.rb: ditto
|
||||
|
||||
* ext/tk/lib/tk/text.rb: ditto
|
||||
|
||||
* ext/tk/lib/tk/texttag.rb: ditto
|
||||
|
||||
* ext/tk/lib/tk/toplevel.rb: ditto
|
||||
|
||||
* ext/tk/lib/tkextlib/*: ditto and bug fix
|
||||
|
||||
Wed Dec 8 23:54:29 2004 Dave Thomas <dave@pragprog.com>
|
||||
|
||||
* lib/rdoc/generators/template/html/html.rb (RDoc::Page): Typo
|
||||
|
|
|
@ -41,7 +41,9 @@ def find_tcl(tcllib, stubs)
|
|||
true
|
||||
else
|
||||
%w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
|
||||
find_library("tcl#{ver}", func, *paths) or
|
||||
find_library("#{lib}#{ver}", func, *paths) or
|
||||
find_library("#{lib}#{ver.delete('.')}", func, *paths) or
|
||||
find_library("tcl#{ver}", func, *paths) or
|
||||
find_library("tcl#{ver.delete('.')}", func, *paths)
|
||||
}
|
||||
end
|
||||
|
@ -62,7 +64,9 @@ def find_tk(tklib, stubs)
|
|||
true
|
||||
else
|
||||
%w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
|
||||
find_library("tk#{ver}", func, *paths) or
|
||||
find_library("#{lib}#{ver}", func, *paths) or
|
||||
find_library("#{lib}#{ver.delete('.')}", func, *paths) or
|
||||
find_library("tk#{ver}", func, *paths) or
|
||||
find_library("tk#{ver.delete('.')}", func, *paths)
|
||||
}
|
||||
end
|
||||
|
|
|
@ -3461,8 +3461,14 @@ ip_init(argc, argv, self)
|
|||
case 1:
|
||||
/* argv0 */
|
||||
if (!NIL_P(argv0)) {
|
||||
/* Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), 0); */
|
||||
Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), TCL_GLOBAL_ONLY);
|
||||
if (strncmp(StringValuePtr(argv0), "-e", 3) == 0
|
||||
|| strncmp(StringValuePtr(argv0), "-", 2) == 0) {
|
||||
Tcl_SetVar(ptr->ip, "argv0", "ruby", TCL_GLOBAL_ONLY);
|
||||
} else {
|
||||
/* Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), 0); */
|
||||
Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0),
|
||||
TCL_GLOBAL_ONLY);
|
||||
}
|
||||
}
|
||||
case 0:
|
||||
/* no args */
|
||||
|
|
|
@ -901,12 +901,30 @@ module TkComm
|
|||
:_bind_append_for_event_class, :_bind_remove_for_event_class,
|
||||
:_bindinfo_for_event_class
|
||||
|
||||
def bind(tagOrClass, context, cmd=Proc.new, *args)
|
||||
#def bind(tagOrClass, context, cmd=Proc.new, *args)
|
||||
# _bind(["bind", tagOrClass], context, cmd, *args)
|
||||
# tagOrClass
|
||||
#end
|
||||
def bind(tagOrClass, context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind(["bind", tagOrClass], context, cmd, *args)
|
||||
tagOrClass
|
||||
end
|
||||
|
||||
def bind_append(tagOrClass, context, cmd=Proc.new, *args)
|
||||
#def bind_append(tagOrClass, context, cmd=Proc.new, *args)
|
||||
# _bind_append(["bind", tagOrClass], context, cmd, *args)
|
||||
# tagOrClass
|
||||
#end
|
||||
def bind_append(tagOrClass, context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append(["bind", tagOrClass], context, cmd, *args)
|
||||
tagOrClass
|
||||
end
|
||||
|
@ -920,12 +938,30 @@ module TkComm
|
|||
_bindinfo(['bind', tagOrClass], context)
|
||||
end
|
||||
|
||||
def bind_all(context, cmd=Proc.new, *args)
|
||||
#def bind_all(context, cmd=Proc.new, *args)
|
||||
# _bind(['bind', 'all'], context, cmd, *args)
|
||||
# TkBindTag::ALL
|
||||
#end
|
||||
def bind_all(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind(['bind', 'all'], context, cmd, *args)
|
||||
TkBindTag::ALL
|
||||
end
|
||||
|
||||
def bind_append_all(context, cmd=Proc.new, *args)
|
||||
#def bind_append_all(context, cmd=Proc.new, *args)
|
||||
# _bind_append(['bind', 'all'], context, cmd, *args)
|
||||
# TkBindTag::ALL
|
||||
#end
|
||||
def bind_append_all(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append(['bind', 'all'], context, cmd, *args)
|
||||
TkBindTag::ALL
|
||||
end
|
||||
|
@ -2067,11 +2103,27 @@ end
|
|||
|
||||
|
||||
module TkBindCore
|
||||
def bind(context, cmd=Proc.new, *args)
|
||||
#def bind(context, cmd=Proc.new, *args)
|
||||
# Tk.bind(self, context, cmd, *args)
|
||||
#end
|
||||
def bind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
Tk.bind(self, context, cmd, *args)
|
||||
end
|
||||
|
||||
def bind_append(context, cmd=Proc.new, *args)
|
||||
#def bind_append(context, cmd=Proc.new, *args)
|
||||
# Tk.bind_append(self, context, cmd, *args)
|
||||
#end
|
||||
def bind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
Tk.bind_append(self, context, cmd, *args)
|
||||
end
|
||||
|
||||
|
|
|
@ -94,12 +94,30 @@ class TkCanvas<TkWindow
|
|||
*tags.collect{|t| tagid(t)}))
|
||||
end
|
||||
|
||||
def itembind(tag, context, cmd=Proc.new, *args)
|
||||
#def itembind(tag, context, cmd=Proc.new, *args)
|
||||
# _bind([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def itembind(tag, context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def itembind_append(tag, context, cmd=Proc.new, *args)
|
||||
#def itembind_append(tag, context, cmd=Proc.new, *args)
|
||||
# _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def itembind_append(tag, context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
|
|
@ -21,12 +21,30 @@ module TkcTagAccess
|
|||
@c.bbox(@id)
|
||||
end
|
||||
|
||||
def bind(seq, cmd=Proc.new, *args)
|
||||
#def bind(seq, cmd=Proc.new, *args)
|
||||
# @c.itembind(@id, seq, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def bind(seq, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
@c.itembind(@id, seq, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def bind_append(seq, cmd=Proc.new, *args)
|
||||
#def bind_append(seq, cmd=Proc.new, *args)
|
||||
# @c.itembind_append(@id, seq, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def bind_append(seq, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
@c.itembind_append(@id, seq, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
require 'tk'
|
||||
|
||||
class TkDialog2 < TkWindow
|
||||
class TkDialogObj < TkWindow
|
||||
extend Tk
|
||||
|
||||
TkCommandNames = ['tk_dialog'.freeze].freeze
|
||||
|
@ -23,7 +23,9 @@ class TkDialog2 < TkWindow
|
|||
c.delete('command'); c.delete(:command)
|
||||
# @config << Kernel.format("%s.button%s configure %s; ",
|
||||
# @path, i, hash_kv(c).join(' '))
|
||||
@config << @path+'.button'+i.to_s+'configure '+hash_kv(c).join(' ')+'; '
|
||||
# @config << @path+'.button'+i.to_s+' configure '+hash_kv(c).join(' ')+'; '
|
||||
@config << @path+'.button'+i.to_s+' configure '+
|
||||
array2tk_list(hash_kv(c))+'; '
|
||||
}
|
||||
case configs
|
||||
when Proc
|
||||
|
@ -74,7 +76,7 @@ class TkDialog2 < TkWindow
|
|||
#@config = "puts [winfo children .w0000];"
|
||||
@config = ""
|
||||
|
||||
@command = nil
|
||||
@command = prev_command
|
||||
|
||||
if keys.kind_of? Hash
|
||||
@title = keys['title'] if keys.key? 'title'
|
||||
|
@ -84,7 +86,7 @@ class TkDialog2 < TkWindow
|
|||
@default_button = keys['default'] if keys.key? 'default'
|
||||
@buttons = keys['buttons'] if keys.key? 'buttons'
|
||||
|
||||
@command = keys['prev_command']
|
||||
@command = keys['prev_command'] if keys.key? 'prev_command'
|
||||
|
||||
@message_config = keys['message_config'] if keys.key? 'message_config'
|
||||
@msgframe_config = keys['msgframe_config'] if keys.key? 'msgframe_config'
|
||||
|
@ -121,36 +123,44 @@ class TkDialog2 < TkWindow
|
|||
if @message_config.kind_of? Hash
|
||||
# @config << Kernel.format("%s.msg configure %s;",
|
||||
# @path, hash_kv(@message_config).join(' '))
|
||||
@config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';'
|
||||
# @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';'
|
||||
@config << @path+'.msg configure '+
|
||||
array2tk_list(hash_kv(@message_config))+';'
|
||||
end
|
||||
|
||||
if @msgframe_config.kind_of? Hash
|
||||
# @config << Kernel.format("%s.top configure %s;",
|
||||
# @path, hash_kv(@msgframe_config).join(' '))
|
||||
@config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';'
|
||||
# @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';'
|
||||
@config << @path+'.top configure '+
|
||||
array2tk_list(hash_kv(@msgframe_config))+';'
|
||||
end
|
||||
|
||||
if @btnframe_config.kind_of? Hash
|
||||
# @config << Kernel.format("%s.bot configure %s;",
|
||||
# @path, hash_kv(@btnframe_config).join(' '))
|
||||
@config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';'
|
||||
# @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';'
|
||||
@config << @path+'.bot configure '+
|
||||
array2tk_list(hash_kv(@btnframe_config))+';'
|
||||
end
|
||||
|
||||
if @bitmap_config.kind_of? Hash
|
||||
# @config << Kernel.format("%s.bitmap configure %s;",
|
||||
# @path, hash_kv(@bitmap_config).join(' '))
|
||||
@config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
|
||||
# @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
|
||||
@config << @path+'.bitmap configure '+
|
||||
array2tk_list(hash_kv(@bitmap_config))+';'
|
||||
end
|
||||
|
||||
_set_button_config(@button_configs) if @button_configs
|
||||
|
||||
if @command.kind_of? Proc
|
||||
@command.call(self)
|
||||
end
|
||||
end
|
||||
private :create_self
|
||||
|
||||
def show
|
||||
if @command.kind_of? Proc
|
||||
@command.call(self)
|
||||
end
|
||||
|
||||
if @default_button.kind_of? String
|
||||
default_button = @buttons.index(@default_button)
|
||||
else
|
||||
|
@ -174,6 +184,10 @@ class TkDialog2 < TkWindow
|
|||
# @var.value.to_i
|
||||
@val
|
||||
end
|
||||
|
||||
def name
|
||||
@buttons[@val]
|
||||
end
|
||||
######################################################
|
||||
# #
|
||||
# these methods must be overridden for each dialog #
|
||||
|
@ -223,13 +237,17 @@ class TkDialog2 < TkWindow
|
|||
# returns nil or a Hash {option=>value, ...} for the button frame
|
||||
return nil
|
||||
end
|
||||
def prev_command
|
||||
# returns nil or a Proc
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
TkDialog2 = TkDialogObj
|
||||
|
||||
#
|
||||
# TkDialog : with showing at initialize
|
||||
#
|
||||
class TkDialog < TkDialog2
|
||||
class TkDialog < TkDialogObj
|
||||
def self.show(*args)
|
||||
self.new(*args)
|
||||
end
|
||||
|
@ -244,7 +262,7 @@ end
|
|||
#
|
||||
# dialog for warning
|
||||
#
|
||||
class TkWarning2 < TkDialog2
|
||||
class TkWarningObj < TkDialogObj
|
||||
def initialize(parent = nil, mes = nil)
|
||||
if !mes
|
||||
if parent.kind_of? TkWindow
|
||||
|
@ -281,8 +299,9 @@ class TkWarning2 < TkDialog2
|
|||
return "OK";
|
||||
end
|
||||
end
|
||||
TkWarning2 = TkWarningObj
|
||||
|
||||
class TkWarning < TkWarning2
|
||||
class TkWarning < TkWarningObj
|
||||
def self.show(*args)
|
||||
self.new(*args)
|
||||
end
|
||||
|
|
|
@ -130,6 +130,15 @@ module TkEvent
|
|||
# []
|
||||
#end
|
||||
|
||||
alias button num
|
||||
alias delta wheel_delta
|
||||
alias root rootwin_id
|
||||
alias rootx x_root
|
||||
alias root_x x_root
|
||||
alias rooty y_root
|
||||
alias root_y y_root
|
||||
alias sendevent send_event
|
||||
|
||||
end
|
||||
|
||||
###############################################
|
||||
|
|
|
@ -20,6 +20,17 @@ class TkFont
|
|||
Tk_FontUseTBL.clear
|
||||
}
|
||||
|
||||
# option_type : default => string
|
||||
OptionType = Hash.new(?s)
|
||||
OptionType['size'] = ?n
|
||||
OptionType['pointadjust'] = ?n
|
||||
OptionType['underline'] = ?b
|
||||
OptionType['overstrike'] = ?b
|
||||
|
||||
# metric_type : default => num_or_str
|
||||
MetricType = Hash.new(?n)
|
||||
MetricType['fixed'] = ?b
|
||||
|
||||
# set default font
|
||||
case Tk::TK_VERSION
|
||||
when /^4\.*/
|
||||
|
@ -112,6 +123,8 @@ class TkFont
|
|||
case type
|
||||
when 'kanji', 'latin', 'ascii'
|
||||
@type = type
|
||||
when :kanji, :latin, :ascii
|
||||
@type = type.to_s
|
||||
else
|
||||
fail ArgumentError, "unknown type '#{type}'"
|
||||
end
|
||||
|
@ -637,7 +650,7 @@ class TkFont
|
|||
begin
|
||||
actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
|
||||
rescue
|
||||
latinkeys {}
|
||||
latinkeys = {}
|
||||
end
|
||||
if latinkeys != {}
|
||||
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
|
||||
|
@ -648,7 +661,7 @@ class TkFont
|
|||
begin
|
||||
actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
|
||||
rescue
|
||||
kanjikeys {}
|
||||
kanjikeys = {}
|
||||
end
|
||||
if kanjikeys != {}
|
||||
tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
|
||||
|
@ -662,23 +675,41 @@ class TkFont
|
|||
|
||||
def actual_core_tk4x(font, window=nil, option=nil)
|
||||
# dummy
|
||||
if option
|
||||
""
|
||||
if option == 'pointadjust' || option == :pointadjust
|
||||
1.0
|
||||
elsif option
|
||||
case OptionType[option.to_s]
|
||||
when ?n
|
||||
0
|
||||
when ?b
|
||||
false
|
||||
else
|
||||
''
|
||||
end
|
||||
else
|
||||
[['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
|
||||
['underline',[]], ['overstrike',[]], ['charset',[]],
|
||||
['pointadjust',[]]]
|
||||
[['family',''], ['size',0], ['weight',''], ['slant',''],
|
||||
['underline',false], ['overstrike',false], ['charset',''],
|
||||
['pointadjust',0]]
|
||||
end
|
||||
end
|
||||
|
||||
def actual_core_tk8x(font, window=nil, option=nil)
|
||||
if option == 'compound'
|
||||
if option == 'compound' || option == :compound
|
||||
""
|
||||
elsif option
|
||||
if window
|
||||
tk_call('font', 'actual', font, "-displayof", window, "-#{option}")
|
||||
val = tk_call('font', 'actual', font,
|
||||
"-displayof", window, "-#{option}")
|
||||
else
|
||||
tk_call('font', 'actual', font, "-#{option}")
|
||||
val = tk_call('font', 'actual', font, "-#{option}")
|
||||
end
|
||||
case OptionType[option.to_s]
|
||||
when ?n
|
||||
num_or_str(val)
|
||||
when ?b
|
||||
bool(val)
|
||||
else
|
||||
val
|
||||
end
|
||||
else
|
||||
l = tk_split_simplelist(if window
|
||||
|
@ -692,7 +723,16 @@ class TkFont
|
|||
if key == '-compound'
|
||||
l.shift
|
||||
else
|
||||
r.push [key[1..-1], l.shift]
|
||||
key = key[1..-1]
|
||||
val = l.shift
|
||||
case OptionType[key]
|
||||
when ?n
|
||||
r.push [key, num_or_str(val)]
|
||||
when ?b
|
||||
r.push [key, bool(val)]
|
||||
else
|
||||
r.push [key, val]
|
||||
end
|
||||
end
|
||||
end
|
||||
r
|
||||
|
@ -707,12 +747,21 @@ class TkFont
|
|||
def configinfo_core_tk4x(font, option=nil)
|
||||
# dummy
|
||||
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
|
||||
if option
|
||||
""
|
||||
if option == 'pointadjust' || option == :pointadjust
|
||||
1.0
|
||||
elsif option
|
||||
case OptionType[option.to_s]
|
||||
when ?n
|
||||
0
|
||||
when ?b
|
||||
false
|
||||
else
|
||||
''
|
||||
end
|
||||
else
|
||||
[['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
|
||||
['underline',[]], ['overstrike',[]], ['charset',[]],
|
||||
['pointadjust',[]]]
|
||||
[['family',''], ['size',0], ['weight',''], ['slant',''],
|
||||
['underline',false], ['overstrike',false], ['charset',''],
|
||||
['pointadjust',1.0]]
|
||||
end
|
||||
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
|
||||
current_configinfo_core_tk4x(font, option)
|
||||
|
@ -721,10 +770,18 @@ class TkFont
|
|||
|
||||
def current_configinfo_core_tk4x(font, option=nil)
|
||||
if option
|
||||
""
|
||||
case OptionType[option.to_s]
|
||||
when ?n
|
||||
0
|
||||
when ?b
|
||||
false
|
||||
else
|
||||
''
|
||||
end
|
||||
else
|
||||
{'family'=>'', 'size'=>'', 'weight'=>'', 'slant'=>'',
|
||||
'underline'=>'', 'overstrike'=>'', 'charset'=>'', 'pointadjust'=>''}
|
||||
{'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'',
|
||||
'underline'=>false, 'overstrike'=>false,
|
||||
'charset'=>false, 'pointadjust'=>1.0}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -797,10 +854,18 @@ class TkFont
|
|||
|
||||
def configinfo_core_tk8x(font, option=nil)
|
||||
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
|
||||
if option == 'compound'
|
||||
if option == 'compound' || option == :compound
|
||||
""
|
||||
elsif option
|
||||
tk_call('font', 'configure', font, "-#{option}")
|
||||
val = tk_call('font', 'configure', font, "-#{option}")
|
||||
case OptionType[option.to_s]
|
||||
when ?n
|
||||
num_or_str(val)
|
||||
when ?b
|
||||
bool(val)
|
||||
else
|
||||
val
|
||||
end
|
||||
else
|
||||
l = tk_split_simplelist(tk_call('font', 'configure', font))
|
||||
r = []
|
||||
|
@ -808,7 +873,16 @@ class TkFont
|
|||
if key == '-compound'
|
||||
l.shift
|
||||
else
|
||||
r.push [key[1..-1], l.shift]
|
||||
key = key[1..-1]
|
||||
val = l.shift
|
||||
case OptionType[key]
|
||||
when ?n
|
||||
r.push [key, num_or_str(val)]
|
||||
when ?b
|
||||
r.push [key, bool(val)]
|
||||
else
|
||||
r.push [key, val]
|
||||
end
|
||||
end
|
||||
end
|
||||
r
|
||||
|
@ -822,7 +896,15 @@ class TkFont
|
|||
if option == 'compound'
|
||||
""
|
||||
elsif option
|
||||
tk_call('font', 'configure', font, "-#{option}")
|
||||
val = tk_call('font', 'configure', font, "-#{option}")
|
||||
case OptionType[option.to_s]
|
||||
when ?n
|
||||
num_or_str(val)
|
||||
when ?b
|
||||
bool(val)
|
||||
else
|
||||
val
|
||||
end
|
||||
else
|
||||
l = tk_split_simplelist(tk_call('font', 'configure', font))
|
||||
r = {}
|
||||
|
@ -830,7 +912,16 @@ class TkFont
|
|||
if key == '-compound'
|
||||
l.shift
|
||||
else
|
||||
r[key[1..-1]] = l.shift
|
||||
key = key[1..-1]
|
||||
val = l.shift
|
||||
case OptionType[key]
|
||||
when ?n
|
||||
r.push [key, num_or_str(val)]
|
||||
when ?b
|
||||
r.push [key, bool(val)]
|
||||
else
|
||||
r.push [key, val]
|
||||
end
|
||||
end
|
||||
end
|
||||
r
|
||||
|
@ -958,7 +1049,7 @@ class TkFont
|
|||
begin
|
||||
actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
|
||||
rescue
|
||||
latinkeys {}
|
||||
latinkeys = {}
|
||||
end
|
||||
if latinkeys != {}
|
||||
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
|
||||
|
@ -981,7 +1072,7 @@ class TkFont
|
|||
begin
|
||||
actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
|
||||
rescue
|
||||
latinkeys {}
|
||||
latinkeys = {}
|
||||
end
|
||||
if latinkeys != {}
|
||||
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
|
||||
|
|
|
@ -92,18 +92,18 @@ class TkFrame<TkWindow
|
|||
self.database_class.name
|
||||
end
|
||||
|
||||
def self.bind(*args)
|
||||
def self.bind(*args, &b)
|
||||
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
||||
super(*args)
|
||||
super(*args, &b)
|
||||
else
|
||||
TkDatabaseClass.new(self.name).bind(*args)
|
||||
TkDatabaseClass.new(self.name).bind(*args, &b)
|
||||
end
|
||||
end
|
||||
def self.bind_append(*args)
|
||||
def self.bind_append(*args, &b)
|
||||
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
||||
super(*args)
|
||||
super(*args, &b)
|
||||
else
|
||||
TkDatabaseClass.new(self.name).bind_append(*args)
|
||||
TkDatabaseClass.new(self.name).bind_append(*args, &b)
|
||||
end
|
||||
end
|
||||
def self.bind_remove(*args)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
require 'tk'
|
||||
require 'tk/itemconfig'
|
||||
require 'tk/menuspec'
|
||||
|
||||
module TkMenuEntryConfig
|
||||
include TkItemConfigMethod
|
||||
|
@ -33,6 +34,7 @@ end
|
|||
|
||||
class TkMenu<TkWindow
|
||||
include TkMenuEntryConfig
|
||||
extend TkMenuSpec
|
||||
|
||||
TkCommandNames = ['menu'.freeze].freeze
|
||||
WidgetClassName = 'Menu'.freeze
|
||||
|
@ -47,6 +49,24 @@ class TkMenu<TkWindow
|
|||
#end
|
||||
#private :create_self
|
||||
|
||||
def self.new_menuspec(menu_spec, parent = nil, tearoff = false, keys = nil)
|
||||
if parent.kind_of?(Hash)
|
||||
keys = _symbolkey2str(parent)
|
||||
parent = keys.delete('parent')
|
||||
tearoff = keys.delete('tearoff')
|
||||
elsif tearoff.kind_of?(Hash)
|
||||
keys = _symbolkey2str(tearoff)
|
||||
tearoff = keys.delete('tearoff')
|
||||
elsif keys
|
||||
keys = _symbolkey2str(keys)
|
||||
else
|
||||
keys = {}
|
||||
end
|
||||
|
||||
widgetname = keys.delete('widgetname')
|
||||
_create_menu(parent, menu_spec, widgetname, tearoff, keys)
|
||||
end
|
||||
|
||||
def tagid(id)
|
||||
#id.to_s
|
||||
_get_eval_string(id)
|
||||
|
@ -389,6 +409,7 @@ class TkMenubutton<TkLabel
|
|||
end
|
||||
private :create_self
|
||||
end
|
||||
TkMenuButton = TkMenubutton
|
||||
|
||||
|
||||
class TkOptionMenubutton<TkMenubutton
|
||||
|
@ -509,3 +530,4 @@ class TkOptionMenubutton<TkMenubutton
|
|||
@menu.current_entryconfiginfo(index, key)
|
||||
end
|
||||
end
|
||||
TkOptionMenuButton = TkOptionMenubutton
|
||||
|
|
|
@ -29,7 +29,7 @@ class TkRadioButton<TkButton
|
|||
configure 'variable', tk_trace_variable(v)
|
||||
end
|
||||
|
||||
def value
|
||||
def get_value
|
||||
var = tk_send_without_enc('cget', '-variable')
|
||||
if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
|
||||
_fromUTF8(INTERP._get_global_var(var))
|
||||
|
@ -38,7 +38,7 @@ class TkRadioButton<TkButton
|
|||
end
|
||||
end
|
||||
|
||||
def value=(val)
|
||||
def set_value(val)
|
||||
var = tk_send_without_enc('cget', '-variable')
|
||||
if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
|
||||
_fromUTF8(INTERP._set_global_var(var, _get_eval_string(val, true)))
|
||||
|
|
|
@ -519,12 +519,30 @@ class TkText<TkTextWin
|
|||
alias deltag tag_delete
|
||||
alias delete_tag tag_delete
|
||||
|
||||
def tag_bind(tag, seq, cmd=Proc.new, *args)
|
||||
#def tag_bind(tag, seq, cmd=Proc.new, *args)
|
||||
# _bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def tag_bind(tag, seq, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def tag_bind_append(tag, seq, cmd=Proc.new, *args)
|
||||
#def tag_bind_append(tag, seq, cmd=Proc.new, *args)
|
||||
# _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def tag_bind_append(tag, seq, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
|
|
@ -122,13 +122,13 @@ class TkTextMarkInsert<TkTextNamedMark
|
|||
end
|
||||
end
|
||||
|
||||
class TkTextMarkCurrent<TkTextMark
|
||||
class TkTextMarkCurrent<TkTextNamedMark
|
||||
def self.new(parent,*args)
|
||||
super(parent, 'current', *args)
|
||||
end
|
||||
end
|
||||
|
||||
class TkTextMarkAnchor<TkTextMark
|
||||
class TkTextMarkAnchor<TkTextNamedMark
|
||||
def self.new(parent,*args)
|
||||
super(parent, 'anchor', *args)
|
||||
end
|
||||
|
|
|
@ -162,12 +162,30 @@ class TkTextTag<TkObject
|
|||
@t.current_tag_configinfo @id, key
|
||||
end
|
||||
|
||||
def bind(seq, cmd=Proc.new, *args)
|
||||
#def bind(seq, cmd=Proc.new, *args)
|
||||
# _bind([@t.path, 'tag', 'bind', @id], seq, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def bind(seq, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([@t.path, 'tag', 'bind', @id], seq, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def bind_append(seq, cmd=Proc.new, *args)
|
||||
#def bind_append(seq, cmd=Proc.new, *args)
|
||||
# _bind_append([@t.path, 'tag', 'bind', @id], seq, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def bind_append(seq, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append([@t.path, 'tag', 'bind', @id], seq, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
|
|
@ -201,18 +201,18 @@ class TkToplevel<TkWindow
|
|||
self.database_class.name
|
||||
end
|
||||
|
||||
def self.bind(*args)
|
||||
def self.bind(*args, &b)
|
||||
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
||||
super(*args)
|
||||
super(*args, &b)
|
||||
else
|
||||
TkDatabaseClass.new(self.name).bind(*args)
|
||||
TkDatabaseClass.new(self.name).bind(*args, &b)
|
||||
end
|
||||
end
|
||||
def self.bind_append(*args)
|
||||
def self.bind_append(*args, &b)
|
||||
if self == WidgetClassNames[WidgetClassName] || self.name == ''
|
||||
super(*args)
|
||||
super(*args, &b)
|
||||
else
|
||||
TkDatabaseClass.new(self.name).bind_append(*args)
|
||||
TkDatabaseClass.new(self.name).bind_append(*args, &b)
|
||||
end
|
||||
end
|
||||
def self.bind_remove(*args)
|
||||
|
|
|
@ -23,13 +23,31 @@ class Tk::BWidget::LabelEntry
|
|||
WidgetClassName = 'LabelEntry'.freeze
|
||||
WidgetClassNames[WidgetClassName] = self
|
||||
|
||||
def entrybind(*args)
|
||||
_bind([path, 'bind'], *args)
|
||||
#def entrybind(*args)
|
||||
# _bind([path, 'bind'], *args)
|
||||
# self
|
||||
#end
|
||||
def entrybind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([path, 'bind'], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def entrybind_append(*args)
|
||||
_bind_append([path, 'bind'], *args)
|
||||
#def entrybind_append(*args)
|
||||
# _bind_append([path, 'bind'], *args)
|
||||
# self
|
||||
#end
|
||||
def entrybind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append([path, 'bind'], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -44,13 +44,33 @@ class Tk::BWidget::ListBox
|
|||
end
|
||||
end
|
||||
|
||||
def imagebind(*args)
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
#def imagebind(*args)
|
||||
# _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
# self
|
||||
#end
|
||||
def imagebind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindImage'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def imagebind_append(*args)
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
#def imagebind_append(*args)
|
||||
# _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
# self
|
||||
#end
|
||||
def imagebind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindImage'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -63,13 +83,33 @@ class Tk::BWidget::ListBox
|
|||
_bindinfo_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
end
|
||||
|
||||
def textbind(*args)
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
#def textbind(*args)
|
||||
# _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
# self
|
||||
#end
|
||||
def textbind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindText'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def textbind_append(*args)
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
#def textbind_append(*args)
|
||||
# _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
# self
|
||||
#end
|
||||
def textbind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindText'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -41,13 +41,33 @@ class Tk::BWidget::NoteBook
|
|||
end
|
||||
end
|
||||
|
||||
def tabbind(*args)
|
||||
_bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
|
||||
#def tabbind(*args)
|
||||
# _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
|
||||
# self
|
||||
#end
|
||||
def tabbind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def tabbind_append(*args)
|
||||
_bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
|
||||
#def tabbind_append(*args)
|
||||
# _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
|
||||
# self
|
||||
#end
|
||||
def tabbind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -105,9 +125,13 @@ class Tk::BWidget::NoteBook
|
|||
list(tk_send('pages', first, last))
|
||||
end
|
||||
|
||||
def raise(page=None)
|
||||
tk_send('raise', page)
|
||||
self
|
||||
def raise(page=nil)
|
||||
if page
|
||||
tk_send('raise', page)
|
||||
self
|
||||
else
|
||||
tk_send('raise')
|
||||
end
|
||||
end
|
||||
|
||||
def see(page)
|
||||
|
|
|
@ -22,13 +22,31 @@ class Tk::BWidget::SpinBox
|
|||
WidgetClassName = 'SpinBox'.freeze
|
||||
WidgetClassNames[WidgetClassName] = self
|
||||
|
||||
def entrybind(*args)
|
||||
_bind([path, 'bind'], *args)
|
||||
#def entrybind(*args)
|
||||
# _bind([path, 'bind'], *args)
|
||||
# self
|
||||
#end
|
||||
def entrybind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([path, 'bind'], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def entrybind_append(*args)
|
||||
_bind_append([path, 'bind'], *args)
|
||||
#def entrybind_append(*args)
|
||||
# _bind_append([path, 'bind'], *args)
|
||||
# self
|
||||
#end
|
||||
def entrybind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append([path, 'bind'], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -41,13 +41,33 @@ class Tk::BWidget::Tree
|
|||
end
|
||||
end
|
||||
|
||||
def imagebind(*args)
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
#def imagebind(*args)
|
||||
# _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
# self
|
||||
#end
|
||||
def imagebind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindImage'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def imagebind_append(*args)
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
#def imagebind_append(*args)
|
||||
# _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
# self
|
||||
#end
|
||||
def imagebind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindImage'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -60,13 +80,33 @@ class Tk::BWidget::Tree
|
|||
_bindinfo_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
|
||||
end
|
||||
|
||||
def textbind(*args)
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
#def textbind(*args)
|
||||
# _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
# self
|
||||
#end
|
||||
def textbind(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_for_event_class(Event_for_Items, [path, 'bindText'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def textbind_append(*args)
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
#def textbind_append(*args)
|
||||
# _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
|
||||
# self
|
||||
#end
|
||||
def textbind_append(context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append_for_event_class(Event_for_Items, [path, 'bindText'],
|
||||
context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -330,7 +330,18 @@ module Tk
|
|||
end
|
||||
end
|
||||
|
||||
def bind(*args)
|
||||
#def bind(*args)
|
||||
# unless @widget
|
||||
# begin
|
||||
# @widget = window(tk_call(@master, 'component', @component))
|
||||
# @path = @widget.path
|
||||
# rescue
|
||||
# fail RuntimeError, 'component is not assigned to a widget'
|
||||
# end
|
||||
# end
|
||||
# @widget.bind(*args)
|
||||
#end
|
||||
def bind(context, *args)
|
||||
unless @widget
|
||||
begin
|
||||
@widget = window(tk_call(@master, 'component', @component))
|
||||
|
@ -339,10 +350,26 @@ module Tk
|
|||
fail RuntimeError, 'component is not assigned to a widget'
|
||||
end
|
||||
end
|
||||
@widget.bind(*args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
@widget.bind(context, cmd, *args)
|
||||
end
|
||||
|
||||
def bind_append(*args)
|
||||
#def bind_append(*args)
|
||||
# unless @widget
|
||||
# begin
|
||||
# @widget = window(tk_call(@master, 'component', @component))
|
||||
# @path = @widget.path
|
||||
# rescue
|
||||
# fail RuntimeError, 'component is not assigned to a widget'
|
||||
# end
|
||||
# end
|
||||
# @widget.bind_append(*args)
|
||||
#end
|
||||
def bind_append(context, *args)
|
||||
unless @widget
|
||||
begin
|
||||
@widget = window(tk_call(@master, 'component', @component))
|
||||
|
@ -351,7 +378,12 @@ module Tk
|
|||
fail RuntimeError, 'component is not assigned to a widget'
|
||||
end
|
||||
end
|
||||
@widget.bind_append(*args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
@widget.bind_append(context, cmd, *args)
|
||||
end
|
||||
|
||||
def bind_remove(*args)
|
||||
|
|
|
@ -97,12 +97,30 @@ class Tk::Iwidgets::Scrolledcanvas
|
|||
*tags.collect{|t| tagid(t)}))
|
||||
end
|
||||
|
||||
def itembind(tag, context, cmd=Proc.new, *args)
|
||||
#def itembind(tag, context, cmd=Proc.new, *args)
|
||||
# _bind([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def itembind(tag, context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def itembind_append(tag, context, cmd=Proc.new, *args)
|
||||
#def itembind_append(tag, context, cmd=Proc.new, *args)
|
||||
# _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def itembind_append(tag, context, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind_append([path, "bind", tagid(tag)], context, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
|
|
@ -75,7 +75,28 @@ module Tk
|
|||
end
|
||||
end
|
||||
|
||||
def dnd_bindtarget(type, event, cmd=Proc.new, prior=50, *args)
|
||||
#def dnd_bindtarget(type, event, cmd=Proc.new, prior=50, *args)
|
||||
# event = tk_event_sequence(event)
|
||||
# if prior.kind_of?(Numeric)
|
||||
# tk_call('dnd', 'bindtarget', @path, type, event,
|
||||
# install_bind_for_event_class(DND_Subst, cmd, *args),
|
||||
# prior)
|
||||
# else
|
||||
# tk_call('dnd', 'bindtarget', @path, type, event,
|
||||
# install_bind_for_event_class(DND_Subst, cmd, prior, *args))
|
||||
# end
|
||||
# self
|
||||
#end
|
||||
def dnd_bindtarget(type, event, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
|
||||
prior = 50
|
||||
prior = args.shift unless args.empty?
|
||||
|
||||
event = tk_event_sequence(event)
|
||||
if prior.kind_of?(Numeric)
|
||||
tk_call('dnd', 'bindtarget', @path, type, event,
|
||||
|
@ -101,8 +122,20 @@ module Tk
|
|||
end
|
||||
end
|
||||
|
||||
def dnd_bindsource(type, cmd=Proc.new, prior=None)
|
||||
tk_call('dnd', 'bindsource', @path, type, cmd, prior)
|
||||
#def dnd_bindsource(type, cmd=Proc.new, prior=None)
|
||||
# tk_call('dnd', 'bindsource', @path, type, cmd, prior)
|
||||
# self
|
||||
#end
|
||||
def dnd_bindsource(type, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
|
||||
args = [None] if args.empty
|
||||
|
||||
tk_call('dnd', 'bindsource', @path, type, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -743,16 +743,39 @@ class Tk::TreeCtrl
|
|||
marquee_visible()
|
||||
end
|
||||
|
||||
def notify_bind(obj, event, cmd=Proc.new, *args)
|
||||
#def notify_bind(obj, event, cmd=Proc.new, *args)
|
||||
# _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def notify_bind(obj, event, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def notify_bind_append(obj, event, cmd=Proc.new, *args)
|
||||
#def notify_bind_append(obj, event, cmd=Proc.new, *args)
|
||||
# _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||
# self
|
||||
#end
|
||||
def notify_bind_append(obj, event, *args)
|
||||
if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
||||
cmd = args.shift
|
||||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
def notify_bindremove(obj, event)
|
||||
_bind_remove([@path, 'notify', 'bind', obj], event)
|
||||
self
|
||||
end
|
||||
|
||||
def notify_bindinfo(obj, event=nil)
|
||||
_bindinfo([@path, 'notify', 'bind', obj], event)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue