From 94d960beb57ead291992a6ceb34871b377ade1d1 Mon Sep 17 00:00:00 2001 From: nagai Date: Mon, 11 Oct 2004 04:51:21 +0000 Subject: * ext/tk/lib/tk/*: untabify git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/tk/wm.rb | 206 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 118 insertions(+), 88 deletions(-) (limited to 'ext/tk/lib/tk/wm.rb') diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb index b5106adade..a1002f7b96 100644 --- a/ext/tk/lib/tk/wm.rb +++ b/ext/tk/lib/tk/wm.rb @@ -11,237 +11,267 @@ module Tk def aspect(*args) if args.length == 0 - list(tk_call_without_enc('wm', 'aspect', path)) + list(tk_call_without_enc('wm', 'aspect', path)) else - tk_call('wm', 'aspect', path, *args) - self + tk_call('wm', 'aspect', path, *args) + self end end + def attributes(slot=nil,value=None) if slot == nil - lst = tk_split_list(tk_call('wm', 'attributes', path)) - info = {} - while key = lst.shift - info[key[1..-1]] = lst.shift - end - info + lst = tk_split_list(tk_call('wm', 'attributes', path)) + info = {} + while key = lst.shift + info[key[1..-1]] = lst.shift + end + info elsif slot.kind_of? Hash - tk_call('wm', 'attributes', path, *hash_kv(slot)) - self + tk_call('wm', 'attributes', path, *hash_kv(slot)) + self elsif value == None - tk_call('wm', 'attributes', path, "-#{slot}") + tk_call('wm', 'attributes', path, "-#{slot}") else - tk_call('wm', 'attributes', path, "-#{slot}", value) - self + tk_call('wm', 'attributes', path, "-#{slot}", value) + self end end + def client(name=None) if name == None - tk_call('wm', 'client', path) + tk_call('wm', 'client', path) else name = '' if name == nil - tk_call('wm', 'client', path, name) - self + tk_call('wm', 'client', path, name) + self end end + def colormapwindows(*args) if args.size == 0 - list(tk_call_without_enc('wm', 'colormapwindows', path)) + list(tk_call_without_enc('wm', 'colormapwindows', path)) else - tk_call_without_enc('wm', 'colormapwindows', path, *args) - self + tk_call_without_enc('wm', 'colormapwindows', path, *args) + self end end + def wm_command(value=nil) if value - tk_call('wm', 'command', path, value) - self + tk_call('wm', 'command', path, value) + self else - #procedure(tk_call('wm', 'command', path)) - tk_call('wm', 'command', path) + #procedure(tk_call('wm', 'command', path)) + tk_call('wm', 'command', path) end end + def deiconify(ex = true) tk_call_without_enc('wm', 'deiconify', path) if ex self end + def focusmodel(mode = nil) if mode - tk_call_without_enc('wm', 'focusmodel', path, mode) - self + tk_call_without_enc('wm', 'focusmodel', path, mode) + self else - tk_call_without_enc('wm', 'focusmodel', path) + tk_call_without_enc('wm', 'focusmodel', path) end end + def frame tk_call_without_enc('wm', 'frame', path) end + def geometry(geom=nil) if geom - tk_call_without_enc('wm', 'geometry', path, geom) - self + tk_call_without_enc('wm', 'geometry', path, geom) + self else - tk_call_without_enc('wm', 'geometry', path) + tk_call_without_enc('wm', 'geometry', path) end end + def wm_grid(*args) if args.size == 0 - list(tk_call_without_enc('wm', 'grid', path)) + list(tk_call_without_enc('wm', 'grid', path)) else - tk_call_without_enc('wm', 'grid', path, *args) - self + tk_call_without_enc('wm', 'grid', path, *args) + self end end + def group(leader = nil) if leader - tk_call('wm', 'group', path, leader) - self + tk_call('wm', 'group', path, leader) + self else - window(tk_call('wm', 'group', path)) + window(tk_call('wm', 'group', path)) end end + def iconbitmap(bmp=nil) if bmp - tk_call_without_enc('wm', 'iconbitmap', path, bmp) - self + tk_call_without_enc('wm', 'iconbitmap', path, bmp) + self else - image_obj(tk_call_without_enc('wm', 'iconbitmap', path)) + image_obj(tk_call_without_enc('wm', 'iconbitmap', path)) end end + def iconify(ex = true) tk_call_without_enc('wm', 'iconify', path) if ex self end + def iconmask(bmp=nil) if bmp - tk_call_without_enc('wm', 'iconmask', path, bmp) - self + tk_call_without_enc('wm', 'iconmask', path, bmp) + self else - image_obj(tk_call_without_enc('wm', 'iconmask', path)) + image_obj(tk_call_without_enc('wm', 'iconmask', path)) end end + def iconname(name=nil) if name - tk_call('wm', 'iconname', path, name) - self + tk_call('wm', 'iconname', path, name) + self else - tk_call('wm', 'iconname', path) + tk_call('wm', 'iconname', path) end end + def iconposition(*args) if args.size == 0 - list(tk_call_without_enc('wm', 'iconposition', path)) + list(tk_call_without_enc('wm', 'iconposition', path)) else - tk_call_without_enc('wm', 'iconposition', path, *args) - self + tk_call_without_enc('wm', 'iconposition', path, *args) + self end end + def iconwindow(win = nil) if win - tk_call_without_enc('wm', 'iconwindow', path, win) - self + tk_call_without_enc('wm', 'iconwindow', path, win) + self else - w = tk_call_without_enc('wm', 'iconwindow', path) - (w == '')? nil: window(w) + w = tk_call_without_enc('wm', 'iconwindow', path) + (w == '')? nil: window(w) end end + def maxsize(*args) if args.size == 0 - list(tk_call_without_enc('wm', 'maxsize', path)) + list(tk_call_without_enc('wm', 'maxsize', path)) else - tk_call_without_enc('wm', 'maxsize', path, *args) - self + tk_call_without_enc('wm', 'maxsize', path, *args) + self end end + def minsize(*args) if args.size == 0 - list(tk_call_without_enc('wm', 'minsize', path)) + list(tk_call_without_enc('wm', 'minsize', path)) else - tk_call_without_enc('wm', 'minsize', path, *args) - self + tk_call_without_enc('wm', 'minsize', path, *args) + self end end + def overrideredirect(bool=None) if bool == None - bool(tk_call_without_enc('wm', 'overrideredirect', path)) + bool(tk_call_without_enc('wm', 'overrideredirect', path)) else - tk_call_without_enc('wm', 'overrideredirect', path, bool) - self + tk_call_without_enc('wm', 'overrideredirect', path, bool) + self end end + def positionfrom(who=None) if who == None - r = tk_call_without_enc('wm', 'positionfrom', path) - (r == "")? nil: r + r = tk_call_without_enc('wm', 'positionfrom', path) + (r == "")? nil: r else - tk_call_without_enc('wm', 'positionfrom', path, who) - self + tk_call_without_enc('wm', 'positionfrom', path, who) + self end end + def protocol(name=nil, cmd=nil, &b) if cmd - tk_call_without_enc('wm', 'protocol', path, name, cmd) - self + tk_call_without_enc('wm', 'protocol', path, name, cmd) + self elsif b - tk_call_without_enc('wm', 'protocol', path, name, proc(&b)) - self + tk_call_without_enc('wm', 'protocol', path, name, proc(&b)) + self elsif name - result = tk_call_without_enc('wm', 'protocol', path, name) - (result == "")? nil : tk_tcl2ruby(result) + result = tk_call_without_enc('wm', 'protocol', path, name) + (result == "")? nil : tk_tcl2ruby(result) else - tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path)) + tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path)) end end + def resizable(*args) if args.length == 0 - list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)} + list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)} else - tk_call_without_enc('wm', 'resizable', path, *args) - self + tk_call_without_enc('wm', 'resizable', path, *args) + self end end + def sizefrom(who=None) if who == None - r = tk_call_without_enc('wm', 'sizefrom', path) - (r == "")? nil: r + r = tk_call_without_enc('wm', 'sizefrom', path) + (r == "")? nil: r else - tk_call_without_enc('wm', 'sizefrom', path, who) - self + tk_call_without_enc('wm', 'sizefrom', path, who) + self end end + def stackorder list(tk_call('wm', 'stackorder', path)) end + def stackorder_isabove(win) bool(tk_call('wm', 'stackorder', path, 'isabove', win)) end + def stackorder_isbelow(win) bool(tk_call('wm', 'stackorder', path, 'isbelow', win)) end + def state(state=nil) if state - tk_call_without_enc('wm', 'state', path, state) - self + tk_call_without_enc('wm', 'state', path, state) + self else - tk_call_without_enc('wm', 'state', path) + tk_call_without_enc('wm', 'state', path) end end + def title(str=nil) if str - tk_call('wm', 'title', path, str) - self + tk_call('wm', 'title', path, str) + self else - tk_call('wm', 'title', path) + tk_call('wm', 'title', path) end end + def transient(master=nil) if master - tk_call_without_enc('wm', 'transient', path, master) - self + tk_call_without_enc('wm', 'transient', path, master) + self else - window(tk_call_without_enc('wm', 'transient', path)) + window(tk_call_without_enc('wm', 'transient', path)) end end + def withdraw(ex = true) tk_call_without_enc('wm', 'withdraw', path) if ex self -- cgit v1.2.3