module Tk::Pack

Geometry manager that packs around edges of cavity

The pack command is used to communicate with the packer, a geometry manager that arranges the children of a parent by packing them in order around the edges of the parent.

Public Class Methods

configure(*arguments) click to toggle source

The arguments consist of the names of one or more slave windows followed by a hash of arguments that specify how to manage the slaves. See THE PACKER ALGORITHM for details on how the options are used by the packer.

# File lib/ffi-tk/command/pack.rb, line 19
def self.configure(*arguments)
  Tk.execute('pack', 'configure', *arguments)
end
forget(*slaves) click to toggle source

Removes each of the slaves from the packing order for its master and unmaps their windows. The slaves will no longer be managed by the packer.

# File lib/ffi-tk/command/pack.rb, line 26
def self.forget(*slaves)
  Tk.execute_only('pack', 'forget', *slaves)
end
info(slave) click to toggle source

Returns a hash whose elements are the current configuration state of the slave given by in the same option-value form that might be specified to pack configure. The hash contains`in: master` where master is the slave's master.

# File lib/ffi-tk/command/pack.rb, line 34
def self.info(slave)
  info = Tk.execute('pack', 'info', slave)

  array = info.map do |key, value|
    case key = key[1..-1].to_sym
    when :expand
      [key, Tk.boolean(value)]
    when :ipadx, :ipady, :padx, :pady
      [key, value.to_i]
    when :fill, :side
      [key, value.to_sym]
    when :after, :anchor, :before, :in
      [key, value]
    else
      raise 'Unknown info pair: %p => %p' % [key, value]
    end
  end

  Hash[array]
end
pack(*args) click to toggle source

If the first argument to pack is a window name (any value starting with “.”), then the command is processed in the same way as [configure].

# File lib/ffi-tk/command/pack.rb, line 11
def self.pack(*args)
  Tk.execute('pack', *args)
end
propagate(master, boolean = true) click to toggle source

If boolean is true then propagation is enabled for master, which must be a window (see GEOMETRY PROPAGATION below). If boolean is false, then propagation is disabled for master. In either of these cases nil is returned. If boolean is omitted then the command returns 0 or 1 to indicate whether propagation is currently enabled for master. Propagation is enabled by default.

# File lib/ffi-tk/command/pack.rb, line 62
def self.propagate(master, boolean = true)
  Tk.execute_only('pack', 'propagate', master, boolean)
end
slaves(master) click to toggle source

Returns a list of all of the slaves in the packing order for master. The order of the slaves in the list is the same as their order in the packing order.

# File lib/ffi-tk/command/pack.rb, line 69
def self.slaves(master)
  Tk.execute('pack', 'slaves', master)
end

Public Instance Methods

pack(options = {}) click to toggle source
# File lib/ffi-tk/command/pack.rb, line 73
def pack(options = {})
  Pack.pack(self, options.to_tcl_options)
  self
end
pack_configure(options = {}) click to toggle source
# File lib/ffi-tk/command/pack.rb, line 78
def pack_configure(options = {})
  Tk.execute_only('pack', 'configure', self, options)
  self
end
pack_forget() click to toggle source
# File lib/ffi-tk/command/pack.rb, line 83
def pack_forget
  Pack.forget(self)
  self
end
pack_info() click to toggle source
# File lib/ffi-tk/command/pack.rb, line 88
def pack_info
  Pack.info(self)
end
pack_propagate(boolean = true) click to toggle source
# File lib/ffi-tk/command/pack.rb, line 92
def pack_propagate(boolean = true)
  Pack.propagate(self, boolean)
end
pack_slaves() click to toggle source
# File lib/ffi-tk/command/pack.rb, line 96
def pack_slaves
  Pack.slaves(self)
end