Module: WidgetWrapper::Initializer

Defined in:
lib/wx_wrapper/initializer.rb

Instance Method Summary collapse

Instance Method Details

#anvil(name) ⇒ Object

Initializes the application widgets.

anvil "FirstApp" do
  frame "Hello World!"
end


10
11
12
13
14
# File 'lib/wx_wrapper/initializer.rb', line 10

def anvil(name)
  Wx::App.run do
    yield if block_given?
  end
end

#extract_options_from_args!(args) ⇒ Object

nodoc



16
17
18
# File 'lib/wx_wrapper/initializer.rb', line 16

def extract_options_from_args!(args) #nodoc
  args.last.is_a?(Hash) ? args.pop : {}
end

#position_array_to_instance(options) ⇒ Object

nodoc



20
21
22
# File 'lib/wx_wrapper/initializer.rb', line 20

def position_array_to_instance(options) #nodoc
  options[:position] = Wx::Point.new(options[:position][0], options[:position][1]) unless options[:position].nil?
end

#size_array_to_instance(options) ⇒ Object

nodoc



24
25
26
# File 'lib/wx_wrapper/initializer.rb', line 24

def size_array_to_instance(options) #nodoc
  options[:size] = Wx::Size.new(options[:size][0], options[:size][1]) unless options[:size].nil?
end

#style_array_to_constants(options) ⇒ Object

nodoc



28
29
30
# File 'lib/wx_wrapper/initializer.rb', line 28

def style_array_to_constants(options) #nodoc
  options[:style] = eval(options[:style].collect { |key| "Wx::TE_#{key.to_s.upcase}" }.join('|')) unless options[:style].nil?
end