Class: MittensUi::Grid
- Inherits:
-
Object
- Object
- MittensUi::Grid
- Defined in:
- lib/mittens_ui/grid.rb
Instance Method Summary collapse
- #attach(widget, options) ⇒ Object
-
#initialize(window) {|_self| ... } ⇒ Grid
constructor
A new instance of Grid.
Constructor Details
#initialize(window) {|_self| ... } ⇒ Grid
Returns a new instance of Grid.
3 4 5 6 7 |
# File 'lib/mittens_ui/grid.rb', line 3 def initialize(window, &block) @grid = Gtk::Grid.new yield(self) window.add_child(@grid) end |
Instance Method Details
#attach(widget, options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mittens_ui/grid.rb', line 9 def attach(, ) grid_height = [:height] grid_width = [:width] grid_top = [:top] grid_left = [:left] # Place widget next to each other in the direction determined by the “orientation” property # defaults to :horizontal. if .size >= 1 @grid.add() end unless [:attach_to].nil? return @grid.attach_next_to() else @grid.attach(, grid_left, grid_top, grid_width, grid_height) end end |