Module: Tk::Pack
- Included in:
- Widget
- Defined in:
- lib/ffi-tk/command/pack.rb
Overview
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.
Class Method Summary (collapse)
-
+ (Object) configure(*arguments)
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.
-
+ (Object) forget(*slaves)
Removes each of the slaves from the packing order for its master and unmaps their windows.
-
+ (Object) info(slave)
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.
-
+ (Object) pack(*args)
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].
-
+ (Object) propagate(master, boolean = true)
If boolean is true then propagation is enabled for master, which must be a window (see GEOMETRY PROPAGATION below).
-
+ (Object) slaves(master)
Returns a list of all of the slaves in the packing order for master.
Instance Method Summary (collapse)
- - (Object) pack(options = {})
- - (Object) pack_configure(options = {})
- - (Object) pack_forget
- - (Object) pack_info
- - (Object) pack_propagate(boolean = true)
- - (Object) pack_slaves
Class Method Details
+ (Object) configure(*arguments)
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.
18 19 20 |
# File 'lib/ffi-tk/command/pack.rb', line 18 def self.configure(*arguments) Tk.execute('pack', 'configure', *arguments) end |
+ (Object) forget(*slaves)
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.
25 26 27 |
# File 'lib/ffi-tk/command/pack.rb', line 25 def self.forget(*slaves) Tk.execute_only('pack', 'forget', *slaves) end |
+ (Object) info(slave)
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.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ffi-tk/command/pack.rb', line 33 def self.info(slave) info = Tk.execute('pack', 'info', slave) array = info.split.each_slice(2).map{|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 } Hash[array] end |
+ (Object) pack(*args)
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].
10 11 12 |
# File 'lib/ffi-tk/command/pack.rb', line 10 def self.pack(*args) Tk.execute('pack', *args) end |
+ (Object) propagate(master, boolean = true)
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.
61 62 63 |
# File 'lib/ffi-tk/command/pack.rb', line 61 def self.propagate(master, boolean = true) Tk.execute_only('pack', 'propagate', master, boolean) end |
+ (Object) slaves(master)
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.
68 69 70 |
# File 'lib/ffi-tk/command/pack.rb', line 68 def self.slaves(master) Tk.execute('pack', 'slaves', master) end |
Instance Method Details
- (Object) pack(options = {})
72 73 74 75 |
# File 'lib/ffi-tk/command/pack.rb', line 72 def pack( = {}) Pack.pack(self, .) self end |
- (Object) pack_configure(options = {})
77 78 79 80 |
# File 'lib/ffi-tk/command/pack.rb', line 77 def pack_configure( = {}) Tk.execute_only('pack', 'configure', self, ) self end |
- (Object) pack_forget
82 83 84 85 |
# File 'lib/ffi-tk/command/pack.rb', line 82 def pack_forget Pack.forget(self) self end |
- (Object) pack_info
87 88 89 |
# File 'lib/ffi-tk/command/pack.rb', line 87 def pack_info Pack.info(self) end |
- (Object) pack_propagate(boolean = true)
91 92 93 |
# File 'lib/ffi-tk/command/pack.rb', line 91 def pack_propagate(boolean = true) Pack.propagate(self, boolean) end |
- (Object) pack_slaves
95 96 97 |
# File 'lib/ffi-tk/command/pack.rb', line 95 def pack_slaves Pack.slaves(self) end |