class MittensUi::Grid

Public Class Methods

new(window) { |self| ... } click to toggle source
# File lib/mittens_ui/grid.rb, line 3
def initialize(window, &block)
  @grid = Gtk::Grid.new
  yield(self)
  window.add_child(@grid)
end

Public Instance Methods

attach(widget, options) click to toggle source
# File lib/mittens_ui/grid.rb, line 9
def attach(widget, options)
  grid_height   = options[:height]
  grid_width    = options[:width]
  grid_top      = options[:top]
  grid_left     = options[:left]

  # Place widget next to each other in the direction determined by the “orientation” property
  # defaults to :horizontal.
  if options.size >= 1
    @grid.add(widget)
  end

  unless options[:attach_to].nil?
    return
    @grid.attach_next_to()
  else
    @grid.attach(widget, grid_left, grid_top, grid_width, grid_height)
  end
end