From 548b5143db2c3d701520671ef1413cf3c39fcedf Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 12 Jun 2000 07:48:31 +0000 Subject: 2000-06-12 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/tk.rb | 205 +++++++++++++++++++++++++++++++++++++++++++++++-- ext/tk/lib/tkcanvas.rb | 107 ++++++++++++++++++++++---- ext/tk/lib/tkentry.rb | 8 ++ ext/tk/lib/tkfont.rb | 14 ++-- 4 files changed, 301 insertions(+), 33 deletions(-) (limited to 'ext/tk') diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index bb3f7f6ab8..a18a0e4587 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -457,6 +457,21 @@ module TkCore _get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg)) end + def scaling(scale=nil) + if scale + tk_call('tk', 'scaling', scale) + else + Float(number(tk_call('tk', 'scaling'))) + end + end + def scaling_displayof(win, scale=nil) + if scale + tk_call('tk', 'scaling', '-displayof', win, scale) + else + Float(number(tk_call('tk', '-displayof', win, 'scaling'))) + end + end + def appname(name=None) tk_call('tk', 'appname', name) end @@ -772,6 +787,24 @@ class TkBindTag end end +class TkBindTagAllval}) + else + tk_call 'itemconfigure', index, "-#{key}", val + end + end + end + + def itemconfiginfo(index, key=nil) + if key + conf = tk_split_list(tk_send('itemconfigure',index,"-#{key}")) + conf[0] = conf[0][1..-1] + conf + else + tk_split_list(tk_send('itemconfigure', index)).collect{|conf| + conf[0] = conf[0][1..-1] + conf + } + end + end end module TkTreatMenuEntryFont @@ -2397,6 +2490,9 @@ class TkMenu@variable, + 'label'=>value, 'value'=>value) + end + def index(index) + @menu.index(index) + end + def invoke(index) + @menu.invoke(index) + end + def insert(index, value) + @menu.add(index, 'radiobutton', 'variable'=>@variable, + 'label'=>value, 'value'=>value) + end + def delete(index, last=None) + @menu.delete(index, last) + end + def yposition(index) + @menu.yposition(index) + end + def menucget(index, key) + @menu.cget(index, key) + end + def menuconfigure(index, key, val=None) + @menu.configure(index, key, val) + end + def menuconfiginfo(index, key=nil) + @menu.configinfo(index, key) + end + def entrycget(index, key) + @menu.entrycget(index, key) + end + def entryconfigure(index, key, val=None) + @menu.entryconfigure(index, key, val) + end + def entryconfiginfo(index, key=nil) + @menu.entryconfiginfo(index, key) + end +end + module TkComposite include Tk extend Tk diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb index 914bfe01e3..5f4bdadaee 100644 --- a/ext/tk/lib/tkcanvas.rb +++ b/ext/tk/lib/tkcanvas.rb @@ -217,7 +217,7 @@ class TkCanvas "(t1)&&(t2)" + # ltag = tag1 | tag2; ltag.path => "(t1)||(t2)" + # ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)" + # ltag = - tag1; ltag.path => "!(t1)" + def & (tag) + if tag.kind_of? TkObject + TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')') + else + TkcTagString.new(@c, '(' + @id + ')&&(' + tag.to_s + ')') + end + end + + def | (tag) + if tag.kind_of? TkObject + TkcTagString.new(@c, '(' + @id + ')||(' + tag.path + ')') + else + TkcTagString.new(@c, '(' + @id + ')||(' + tag.to_s + ')') + end + end + + def ^ (tag) + if tag.kind_of? TkObject + TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')') + else + TkcTagString.new(@c, '(' + @id + ')^(' + tag.to_s + ')') + end + end + + def -@ + TkcTagString.new(@c, '!(' + @id + ')') + end end class TkcTag