Class: RubyMVC::Application
- Inherits:
-
Object
- Object
- RubyMVC::Application
- Defined in:
- lib/ruby_mvc/application.rb
Overview
This provides the entry point for a basic application.
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#frame ⇒ Object
FIXME 2011-12-29 ast: The relationship between Toolkit::App and the AppController classes don’t really make sense.
-
#windows ⇒ Object
Returns the value of attribute windows.
Instance Method Summary collapse
- #dialog(options, &block) ⇒ Object
- #error(msg, options) ⇒ Object
-
#initialize(options, &block) ⇒ Application
constructor
A new instance of Application.
- #window(options, &block) ⇒ Object
Constructor Details
#initialize(options, &block) ⇒ Application
Returns a new instance of Application.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ruby_mvc/application.rb', line 39 def initialize(, &block) @windows = [] if ico = [:icon] ico = [:icon] = File.(ico) puts "icon requested: #{ico}" end @windows << (self.frame = Toolkit::Frame.new()) if cc = [:controller] self.controller = cc self.controller.app = self self.controller.init end @frame_width = [:width] @frame_height = [:height] self.instance_eval(&block) if block self.frame.show end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
36 37 38 |
# File 'lib/ruby_mvc/application.rb', line 36 def controller @controller end |
#frame ⇒ Object
FIXME 2011-12-29 ast: The relationship between Toolkit::App and the AppController classes don’t really make sense. This needs to be revisited in a future iteration.
35 36 37 |
# File 'lib/ruby_mvc/application.rb', line 35 def frame @frame end |
#windows ⇒ Object
Returns the value of attribute windows.
37 38 39 |
# File 'lib/ruby_mvc/application.rb', line 37 def windows @windows end |
Instance Method Details
#dialog(options, &block) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/ruby_mvc/application.rb', line 73 def dialog(, &block) set_parent() dlg = Toolkit::Dialog.new() block.call(dlg) if block dlg.show dlg end |
#error(msg, options) ⇒ Object
81 82 83 84 85 |
# File 'lib/ruby_mvc/application.rb', line 81 def error(msg, ) [:class] = :error dlg = Toolkit::MessageBox.new(msg, ) dlg.show end |
#window(options, &block) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ruby_mvc/application.rb', line 57 def window(, &block) set_parent() # FIXME: this is a bit of a hack for wxRuby peers [:height] = @frame_height if ![:height] [:width] = @frame_width if ![:width] win = Toolkit::Frame.new() block.call(win) if block win.show # FIXME: need to be able to intercept the close event so # we can remove the window from the list @windows << win win end |