Class: Java::OrgEclipseSwtWidgets::Composite

Inherits:
Object
  • Object
show all
Defined in:
lib/sweet/swt/composite.rb

Instance Method Summary collapse

Instance Method Details

#layout=(name, opts = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/sweet/swt/composite.rb', line 3

def layout=(name, opts = {})
  Sweet.debug "layout = #{name}(#{opts.inspect})"
  # TODO allow instantiated layouts and layout classes
  class_name = "#{name.to_s.capitalize}Layout"
  l = instance_eval "org.eclipse.swt.layout.#{class_name}.new"

  opts.each_pair do |k,v|
    l.send("#{k}=", v)
  end

  setLayout l
  Sweet.debug getLayout
end