assume the string is a Tcl/Tk's create command of the widget class.
# File tk/lib/tk.rb, line 5061 def TkWindow._widget_inspect_full_=(mode) @@WIDGET_INSPECT_FULL = (mode && true) || false end
# File tk/lib/tk.rb, line 5058 def TkWindow._widget_inspect_full_? @@WIDGET_INSPECT_FULL end
# File tk/lib/tk.rb, line 5232 def self.database_class WidgetClassNames[self::WidgetClassName] end
# File tk/lib/tk.rb, line 5229 def self.database_classname self::WidgetClassName end
# File tk/lib/tk.rb, line 5075 def initialize(parent=nil, keys=nil) if parent.kind_of? Hash keys = _symbolkey2str(parent) parent = keys.delete('parent') widgetname = keys.delete('widgetname') install_win(if parent then parent.path end, widgetname) without_creating = keys.delete('without_creating') # if without_creating && !widgetname # fail ArgumentError, # "if set 'without_creating' to true, need to define 'widgetname'" # end elsif keys keys = _symbolkey2str(keys) widgetname = keys.delete('widgetname') install_win(if parent then parent.path end, widgetname) without_creating = keys.delete('without_creating') # if without_creating && !widgetname # fail ArgumentError, # "if set 'without_creating' to true, need to define 'widgetname'" # end else install_win(if parent then parent.path end) end if self.method(:create_self).arity == 0 p 'create_self has no arg' if $DEBUG create_self unless without_creating if keys # tk_call @path, 'configure', *hash_kv(keys) configure(keys) end else p 'create_self has args' if $DEBUG fontkeys = {} methodkeys = {} if keys #['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key| # fontkeys[key] = keys.delete(key) if keys.key?(key) #} __font_optkeys.each{|key| fkey = key.to_s fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey) fkey = "kanji#{key}" fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey) fkey = "latin#{key}" fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey) fkey = "ascii#{key}" fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey) } __optkey_aliases.each{|alias_name, real_name| alias_name = alias_name.to_s if keys.has_key?(alias_name) keys[real_name.to_s] = keys.delete(alias_name) end } __methodcall_optkeys.each{|key| key = key.to_s methodkeys[key] = keys.delete(key) if keys.key?(key) } __ruby2val_optkeys.each{|key, method| key = key.to_s keys[key] = method.call(keys[key]) if keys.has_key?(key) } end if without_creating && keys #configure(keys) configure(__conv_keyonly_opts(keys)) else #create_self(keys) create_self(__conv_keyonly_opts(keys)) end font_configure(fontkeys) unless fontkeys.empty? configure(methodkeys) unless methodkeys.empty? end end
WidgetClassNames = self
==> If self is a widget class, entry to the WidgetClassNames table.
# File tk/lib/tk.rb, line 5071 def self.to_eval self::WidgetClassName end
# File tk/lib/tk.rb, line 5214 def bind_class @db_class || self.class() end
# File tk/lib/tk.rb, line 5617 def caret(keys=nil) TkXIM.caret(path, keys) end
# File tk/lib/tk.rb, line 5612 def colormodel(model=None) tk_call('tk', 'colormodel', path, model) self end
# File tk/lib/tk.rb, line 5602 def command(cmd=nil, &b) if cmd configure_cmd('command', cmd) elsif b configure_cmd('command', Proc.new(&b)) else cget('command') end end
# File tk/lib/tkextlib/tcllib/cursor.rb, line 56 def cursor_propagate(cursor) # Sets the cursor for self and all its descendants to cursor. #tk_call_without_enc('::cursor::propagate', @path, cursor) Tk::Tcllib::Cursor.cursor_propagate(self, cursor) end
# File tk/lib/tkextlib/tcllib/cursor.rb, line 61 def cursor_restore(cursor = None) # Restore the original or previously set cursor for self and all its # descendants. If cursor is specified, that will be used if on any # widget that did not have a preset cursor (set by a previous call # to TkWindow#cursor_propagate). #tk_call_without_enc('::cursor::restore', @path, cursor) Tk::Tcllib::Cursor.cursor_restore(self, cursor) end
# File tk/lib/tk.rb, line 5221 def database_class name = database_classname() if WidgetClassNames[name] WidgetClassNames[name] else TkDatabaseClass.new(name) end end
# File tk/lib/tk.rb, line 5218 def database_classname TkWinfo.classname(self) end
# File tk/lib/tk.rb, line 5621 def destroy super children = [] rexp = /^#{self.path}\.[^.]+$/ TkCore::INTERP.tk_windows.each{|path, obj| children << [path, obj] if path =~ rexp } if defined?(@cmdtbl) for id in @cmdtbl uninstall_cmd id end end children.each{|path, obj| obj.instance_eval{ if defined?(@cmdtbl) for id in @cmdtbl uninstall_cmd id end end } TkCore::INTERP.tk_windows.delete(path) } begin tk_call_without_enc('destroy', epath) rescue end uninstall_win end
# File tk/lib/tk.rb, line 5690 def eventloop_wait_destroy wait_destroy(false) end
# File tk/lib/tk.rb, line 5663 def eventloop_wait_visibility wait_visibility(false) end
# File tk/lib/tk.rb, line 5540 def grab(opt = nil) unless opt tk_call_without_enc('grab', 'set', path) return self end case opt when 'set', :set tk_call_without_enc('grab', 'set', path) return self when 'global', :global #return(tk_call('grab', 'set', '-global', path)) tk_call_without_enc('grab', 'set', '-global', path) return self when 'release', :release #return tk_call('grab', 'release', path) tk_call_without_enc('grab', 'release', path) return self when 'current', :current return window(tk_call_without_enc('grab', 'current', path)) when 'status', :status return tk_call_without_enc('grab', 'status', path) else return tk_call_without_enc('grab', opt, path) end end
# File tk/lib/tk.rb, line 5567 def grab_current grab('current') end
# File tk/lib/tk.rb, line 5571 def grab_release grab('release') end
# File tk/lib/tk.rb, line 5575 def grab_set grab('set') end
# File tk/lib/tk.rb, line 5579 def grab_set_global grab('global') end
# File tk/lib/tk.rb, line 5583 def grab_status grab('status') end
# File tk/lib/tk.rb, line 5309 def grid(keys = nil) #tk_call 'grid', epath, *hash_kv(keys) if keys TkGrid.configure(self, keys) else TkGrid.configure(self) end self end
# File tk/lib/tk.rb, line 5331 def grid_anchor(anchor=None) if anchor == None TkGrid.anchor(self) else TkGrid.anchor(self, anchor) self end end
# File tk/lib/tk.rb, line 5347 def grid_bbox(*args) #list(tk_call('grid', 'bbox', epath, *args)) TkGrid.bbox(self, *args) end
# File tk/lib/tk.rb, line 5406 def grid_column(index, keys=nil) if keys.kind_of?(Hash) grid_columnconfigure(index, keys) else grid_columnconfiginfo(index, keys) end end
# File tk/lib/tk.rb, line 5366 def grid_columnconfig(index, keys) #tk_call('grid', 'columnconfigure', epath, index, *hash_kv(keys)) TkGrid.columnconfigure(self, index, keys) end
# File tk/lib/tk.rb, line 5378 def grid_columnconfiginfo(index, slot=nil) #if slot # tk_call('grid', 'columnconfigure', epath, index, "-#{slot}").to_i #else # ilist = list(tk_call('grid', 'columnconfigure', epath, index)) # info = {} # while key = ilist.shift # info[key[1..-1]] = ilist.shift # end # info #end TkGrid.columnconfiginfo(self, index, slot) end
# File tk/lib/tk.rb, line 5352 def grid_config(slot, value=None) #if slot.kind_of? Hash # tk_call 'grid', 'configure', epath, *hash_kv(slot) #else # tk_call 'grid', 'configure', epath, "-#{slot}", value #end if slot.kind_of? Hash TkGrid.configure(self, slot) else TkGrid.configure(self, slot=>value) end end
# File tk/lib/tk.rb, line 5340 def grid_forget #tk_call('grid', 'forget', epath) TkGrid.forget(self) self end
# File tk/lib/tk.rb, line 5319 def grid_in(target, keys = nil) if keys keys = keys.dup keys['in'] = target else keys = {'in'=>target} end #tk_call 'grid', epath, *hash_kv(keys) TkGrid.configure(self, keys) self end
# File tk/lib/tk.rb, line 5422 def grid_info() #list(tk_call('grid', 'info', epath)) TkGrid.info(self) end
# File tk/lib/tk.rb, line 5427 def grid_location(x, y) #list(tk_call('grid', 'location', epath, x, y)) TkGrid.location(self, x, y) end
# File tk/lib/tk.rb, line 5432 def grid_propagate(mode=None) #if mode == None # bool(tk_call('grid', 'propagate', epath)) #else # tk_call('grid', 'propagate', epath, mode) # self #end if mode == None TkGrid.propagate(self) else TkGrid.propagate(self, mode) self end end
# File tk/lib/tk.rb, line 5447 def grid_remove() #tk_call 'grid', 'remove', epath TkGrid.remove(self) self end
# File tk/lib/tk.rb, line 5414 def grid_row(index, keys=nil) if keys.kind_of?(Hash) grid_rowconfigure(index, keys) else grid_rowconfiginfo(index, keys) end end
# File tk/lib/tk.rb, line 5372 def grid_rowconfig(index, keys) #tk_call('grid', 'rowconfigure', epath, index, *hash_kv(keys)) TkGrid.rowconfigure(self, index, keys) end
# File tk/lib/tk.rb, line 5392 def grid_rowconfiginfo(index, slot=nil) #if slot # tk_call('grid', 'rowconfigure', epath, index, "-#{slot}").to_i #else # ilist = list(tk_call('grid', 'rowconfigure', epath, index)) # info = {} # while key = ilist.shift # info[key[1..-1]] = ilist.shift # end # info #end TkGrid.rowconfiginfo(self, index, slot) end
# File tk/lib/tk.rb, line 5453 def grid_size() #list(tk_call('grid', 'size', epath)) TkGrid.size(self) end
# File tk/lib/tk.rb, line 5458 def grid_slaves(keys = nil) #list(tk_call('grid', 'slaves', epath, *hash_kv(args))) TkGrid.slaves(self, keys) end
# File tk/lib/tk.rb, line 5199 def inspect if @@WIDGET_INSPECT_FULL super else str = super str[0..(str.index(' '))] << '@path=' << @path.inspect << '>' end end
# File tk/lib/tk.rb, line 5587 def lower(below=None) # below = below.epath if below.kind_of?(TkObject) below = _epath(below) tk_call 'lower', epath, below self end
# File tk/lib/tk.rb, line 5236 def pack(keys = nil) #tk_call_without_enc('pack', epath, *hash_kv(keys, true)) if keys TkPack.configure(self, keys) else TkPack.configure(self) end self end
# File tk/lib/tk.rb, line 5265 def pack_config(slot, value=None) #if slot.kind_of? Hash # tk_call 'pack', 'configure', epath, *hash_kv(slot) #else # tk_call 'pack', 'configure', epath, "-#{slot}", value #end if slot.kind_of? Hash TkPack.configure(self, slot) else TkPack.configure(self, slot=>value) end end
# File tk/lib/tk.rb, line 5258 def pack_forget #tk_call_without_enc('pack', 'forget', epath) TkPack.forget(self) self end
# File tk/lib/tk.rb, line 5246 def pack_in(target, keys = nil) if keys keys = keys.dup keys['in'] = target else keys = {'in'=>target} end #tk_call 'pack', epath, *hash_kv(keys) TkPack.configure(self, keys) self end
# File tk/lib/tk.rb, line 5279 def pack_info() #ilist = list(tk_call('pack', 'info', epath)) #info = {} #while key = ilist.shift # info[key[1..-1]] = ilist.shift #end #return info TkPack.info(self) end
# File tk/lib/tk.rb, line 5289 def pack_propagate(mode=None) #if mode == None # bool(tk_call('pack', 'propagate', epath)) #else # tk_call('pack', 'propagate', epath, mode) # self #end if mode == None TkPack.propagate(self) else TkPack.propagate(self, mode) self end end
# File tk/lib/tk.rb, line 5304 def pack_slaves() #list(tk_call('pack', 'slaves', epath)) TkPack.slaves(self) end
# File tk/lib/tk.rb, line 5463 def place(keys) #tk_call 'place', epath, *hash_kv(keys) TkPlace.configure(self, keys) self end
# File tk/lib/tk.rb, line 5488 def place_config(slot, value=None) #if slot.kind_of? Hash # tk_call 'place', 'configure', epath, *hash_kv(slot) #else # tk_call 'place', 'configure', epath, "-#{slot}", value #end TkPlace.configure(self, slot, value) end
# File tk/lib/tk.rb, line 5498 def place_configinfo(slot = nil) # for >= Tk8.4a2 ? #if slot # conf = tk_split_list(tk_call('place', 'configure', epath, "-#{slot}") ) # conf[0] = conf[0][1..-1] # conf #else # tk_split_simplelist(tk_call('place', # 'configure', epath)).collect{|conflist| # conf = tk_split_simplelist(conflist) # conf[0] = conf[0][1..-1] # conf # } #end TkPlace.configinfo(self, slot) end
# File tk/lib/tk.rb, line 5481 def place_forget #tk_call 'place', 'forget', epath TkPlace.forget(self) self end
# File tk/lib/tk.rb, line 5469 def place_in(target, keys = nil) if keys keys = keys.dup keys['in'] = target else keys = {'in'=>target} end #tk_call 'place', epath, *hash_kv(keys) TkPlace.configure(self, keys) self end
# File tk/lib/tk.rb, line 5515 def place_info() #ilist = list(tk_call('place', 'info', epath)) #info = {} #while key = ilist.shift # info[key[1..-1]] = ilist.shift #end #return info TkPlace.info(self) end
# File tk/lib/tk.rb, line 5525 def place_slaves() #list(tk_call('place', 'slaves', epath)) TkPlace.slaves(self) end
# File tk/lib/tk.rb, line 5594 def raise(above=None) #above = above.epath if above.kind_of?(TkObject) above = _epath(above) tk_call 'raise', epath, above self end
# File tk/lib/tk.rb, line 5530 def set_focus(force=false) if force tk_call_without_enc('focus', '-force', path) else tk_call_without_enc('focus', path) end self end
# File tk/lib/tk.rb, line 5694 def thread_wait_destroy wait_destroy(true) end
# File tk/lib/tk.rb, line 5666 def thread_wait_visibility wait_visibility(true) end
# File tk/lib/tkextlib/tktrans/tktrans.rb, line 37 def tktrans_get_image() tk_send('tktrans::setwidget', @path) end
# File tk/lib/tkextlib/tktrans/tktrans.rb, line 33 def tktrans_set_image(img) tk_send('tktrans::setwidget', @path, img) self end
# File tk/lib/tk.rb, line 5678 def wait_destroy(on_thread = true) if $SAFE >= 4 fail SecurityError, "can't wait destroy at $SAFE >= 4" end on_thread &= (Thread.list.size != 1) if on_thread INTERP._thread_tkwait('window', epath) else INTERP._invoke('tkwait', 'window', epath) end end
# File tk/lib/tk.rb, line 5652 def wait_visibility(on_thread = true) if $SAFE >= 4 fail SecurityError, "can't wait visibility at $SAFE >= 4" end on_thread &= (Thread.list.size != 1) if on_thread INTERP._thread_tkwait('visibility', path) else INTERP._invoke('tkwait', 'visibility', path) end end