Class: RubyMVC::Toolkit::WxRuby::Dialog
- Inherits:
-
Wx::Dialog
- Object
- Wx::Dialog
- RubyMVC::Toolkit::WxRuby::Dialog
- Includes:
- Common
- Defined in:
- lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb
Instance Method Summary collapse
-
#add(child, options = {}) ⇒ Object
This method is used to add a child to the existing frame.
-
#add_form(form) ⇒ Object
This method is used to add a FormView to the main content part of the dialog.
-
#initialize(options) ⇒ Dialog
constructor
A new instance of Dialog.
- #show ⇒ Object
Methods included from Common
Constructor Details
#initialize(options) ⇒ Dialog
Returns a new instance of Dialog.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 33 def initialize() opts = {} title = [:title] || "Dialog" winid = [:id] || -1 opts[:size] = [ [:width], [:height] ] if parent = [:parent] parent = parent.peer end if [:modal].nil? || [:modal] @modal = true else @modal = false end super(parent, winid, title) @buttons = (Wx::OK|Wx::CANCEL) end |
Instance Method Details
#add(child, options = {}) ⇒ Object
This method is used to add a child to the existing frame.
53 54 55 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 53 def add(child, = {}) child.peer.reparent(self) end |
#add_form(form) ⇒ Object
This method is used to add a FormView to the main content part of the dialog
60 61 62 63 64 65 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 60 def add_form(form) @wxform = FormBuilder.build(self, form) @wxform..add(@buttons, 0, Wx::ALIGN_RIGHT|Wx::ALL, 5) self.sizer = @wxform. self.sizer.fit(self) end |
#show ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 67 def show self.centre if @modal if Wx::ID_OK == self.show_modal() @wxform.submit if @wxform end else sel.show() end end |