Module: Place (Ruby 2.3.4)

In Files

  • tk/lib/tk/place.rb

Class/Module Index [+]

Quicksearch

Place

Constants

TkCommandNames

Public Class Methods

configinfo(win, slot = nil)
 
               # File tk/lib/tk/place.rb, line 33
def configinfo(win, slot = nil)
  # for >= Tk8.4a2 ?
  if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
    # win = win.epath if win.kind_of?(TkObject)
    win = _epath(win)
    if slot
      #conf = tk_split_list(tk_call_without_enc('place', 'configure',
      #                                        win, "-#{slot}") )
      conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
                                                     win, "-#{slot}") )
      conf[0] = conf[0][1..-1]
      conf[1] = tk_tcl2ruby(conf[1])
      conf[2] = tk_tcl2ruby(conf[1])
      conf[3] = tk_tcl2ruby(conf[1])
      conf[4] = tk_tcl2ruby(conf[1])
      conf
    else
      tk_split_simplelist(tk_call_without_enc('place', 'configure',
                                              win)).collect{|conflist|
        #conf = list(conflist)
        conf = simplelist(conflist).collect!{|inf| tk_tcl2ruby(inf)}
        conf[0] = conf[0][1..-1]
        conf
      }
    end
  else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
    current_configinfo(win, slot)
  end
end
            
configure(win, slot, value=None)
 
               # File tk/lib/tk/place.rb, line 13
def configure(win, slot, value=None)
  # for >= Tk8.4a2 ?
  # win = win.epath if win.kind_of?(TkObject)
  win = _epath(win)
  if slot.kind_of? Hash
    params = []
    slot.each{|k, v|
      params.push("-#{k}")
      # params.push((v.kind_of?(TkObject))? v.epath: v)
      params.push(_epath(v))
    }
    tk_call_without_enc('place', 'configure', win, *params)
  else
    # value = value.epath if value.kind_of?(TkObject)
    value = _epath(value)
    tk_call_without_enc('place', 'configure', win, "-#{slot}", value)
  end
end
            
Also aliased as: place
current_configinfo(win, slot = nil)
 
               # File tk/lib/tk/place.rb, line 63
def current_configinfo(win, slot = nil)
  # win = win.epath if win.kind_of?(TkObject)
  win = _epath(win)
  if slot
    #conf = tk_split_list(tk_call_without_enc('place', 'configure',
    #                                         win, "-#{slot}") )
    conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
                                                   win, "-#{slot}") )
    # { conf[0][1..-1] => conf[1] }
    { conf[0][1..-1] => tk_tcl2ruby(conf[4]) }
  else
    ret = {}
    #tk_split_list(tk_call_without_enc('place','configure',win)).each{|conf|
    tk_split_simplelist(tk_call_without_enc('place', 'configure',
                                            win)).each{|conf_list|
      #ret[conf[0][1..-1]] = conf[1]
      conf = simplelist(conf_list)
      ret[conf[0][1..-1]] = tk_tcl2ruby(conf[4])
    }
    ret
  end
end
            
forget(win)
 
               # File tk/lib/tk/place.rb, line 86
def forget(win)
  # win = win.epath if win.kind_of?(TkObject)
  win = _epath(win)
  tk_call_without_enc('place', 'forget', win)
end
            
info(win)
 
               # File tk/lib/tk/place.rb, line 92
def info(win)
  # win = win.epath if win.kind_of?(TkObject)
  win = _epath(win)
  #ilist = list(tk_call_without_enc('place', 'info', win))
  ilist = simplelist(tk_call_without_enc('place', 'info', win))
  info = {}
  while key = ilist.shift
    #info[key[1..-1]] = ilist.shift
    info[key[1..-1]] = tk_tcl2ruby(ilist.shift)
  end
  return info
end
            
place(win, slot, value=None)
Alias for: configure
slaves(master)
 
               # File tk/lib/tk/place.rb, line 105
def slaves(master)
  # master = master.epath if master.kind_of?(TkObject)
  master = _epath(master)
  list(tk_call('place', 'slaves', master))
end