Module: Tk::Place
- Included in:
- Widget
- Defined in:
- lib/ffi-tk/command/place.rb
Overview
Geometry manager for fixed or rubber-sheet placement
The placer is a geometry manager for Tk. It provides simple fixed placement of windows, where you specify the exact size and location of one window, called the slave, within another window, called the master. The placer also provides rubber-sheet placement, where you specify the size and location of the slave in terms of the dimensions of the master, so that the slave changes size and location in response to changes in the size of the master. Lastly, the placer allows you to mix these styles of placement so that, for example, the slave has a fixed width and height but is centered inside the master.
Class Method Summary (collapse)
-
+ (Object) configure(window, options = None)
Query or modify the geometry options of the slave given by window.
- + (Object) forget(window)
- + (Object) info(window)
-
+ (Object) place(window, options = {})
Arrange for the placer to manage the geometry of a window.
- + (Object) slaves(window)
Instance Method Summary (collapse)
- - (Object) place(options = {})
- - (Object) place_configure(options = None)
- - (Object) place_forget
- - (Object) place_info
- - (Object) place_slaves
Class Method Details
+ (Object) configure(window, options = None)
Query or modify the geometry options of the slave given by window. If no option is specified, this command returns a list describing the available options (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more options are specified, then the command modifies the given option(s) to have the given value(s); in this case the command returns nil.
34 35 36 |
# File 'lib/ffi-tk/command/place.rb', line 34 def self.configure(window, = None) Configure.common(Tk, [:place, :configure, window], ) end |
+ (Object) forget(window)
38 39 40 |
# File 'lib/ffi-tk/command/place.rb', line 38 def self.forget(window) Tk.execute_only('place', 'forget', window) end |
+ (Object) info(window)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ffi-tk/command/place.rb', line 42 def self.info(window) info = Tk.execute('place', 'info', window).to_s array = info.split.each_slice(2).map{|key, value| case key = key[1..-1].to_sym when :anchor, :in [key, value] when :bordermode [key, value.to_sym] when :height, :width, :x, :y [key, value.to_i] when :relheight, :relwidth, :relx, :rely [key, value.to_f] else raise "Unknown info pair: %p => %p" % [key, value] end } Hash[array] end |
+ (Object) place(window, options = {})
Arrange for the placer to manage the geometry of a window. The remaining arguments consist of a hash that specifies the way in which window's geometry is managed. Option may have any of the values accepted by [Place.configure].
19 20 21 22 |
# File 'lib/ffi-tk/command/place.rb', line 19 def self.place(window, = {}) args = .map{|k,v| ["-#{k}", v] }.flatten Tk.execute_only('place', window, *args) end |
+ (Object) slaves(window)
63 64 65 |
# File 'lib/ffi-tk/command/place.rb', line 63 def self.slaves(window) Tk.execute('place', 'slaves', window) end |
Instance Method Details
- (Object) place(options = {})
67 68 69 |
# File 'lib/ffi-tk/command/place.rb', line 67 def place( = {}) Place.place(self, ) end |
- (Object) place_configure(options = None)
71 72 73 |
# File 'lib/ffi-tk/command/place.rb', line 71 def place_configure( = None) Place.configure(self, ) end |
- (Object) place_forget
75 76 77 |
# File 'lib/ffi-tk/command/place.rb', line 75 def place_forget Place.forget(self) end |
- (Object) place_info
79 80 81 |
# File 'lib/ffi-tk/command/place.rb', line 79 def place_info Place.info(self) end |
- (Object) place_slaves
83 84 85 |
# File 'lib/ffi-tk/command/place.rb', line 83 def place_slaves Place.slaves(self) end |