| Module | WidgetWrapper::FrameMethods |
| In: |
widget_wrapper/lib/wx_wrapper/frame.rb
|
Creates a new frame for the application. Examples:
This will create a new frame with the title "test frame"
frame "test frame", :position => [ 100, 100 ], :size => [ 640, 480 ]
# File widget_wrapper/lib/wx_wrapper/frame.rb, line 10
10: def frame(title="", options={})
11: # Option Setup
12: options[:title] = title
13: position_array_to_instance(options)
14: size_array_to_instance(options)
15: full_screen = options[:full_screen]
16: maximize = options[:maximize]
17: center = case options[:center]
18: when :vertical : Wx::VERTICAL
19: when :horizontal : Wx::HORIZONTAL
20: when :both : Wx::BOTH
21: when true : Wx::BOTH
22: else nil
23: end
24:
25: # Remove options that aren't supposed to be sent to wx ruby
26: options.delete(:maximize)
27: options.delete(:full_screen)
28: options.delete(:center)
29:
30: # Create a new frame
31: frame = Wx::Frame.new(nil, options)
32:
33: # Handle method level calls
34: frame.show_full_screen(true) if full_screen
35: frame.maximize(true) if maximize
36: frame.centre(center) if center
37:
38: # Yield the frame instance into a block
39: if block_given?
40: yield(frame)
41: end
42:
43: # Display the frame
44: frame.show
45: end