Class: RubyMVC::Toolkit::WxRuby::Dialog
- Inherits:
-
Wx::Dialog
- Object
- Wx::Dialog
- RubyMVC::Toolkit::WxRuby::Dialog
- Includes:
- SignalHandler, 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.
- #add_view(view) ⇒ Object
-
#initialize(options) ⇒ Dialog
constructor
A new instance of Dialog.
- #show ⇒ Object
Methods included from Common
Methods included from SignalHandler
#signal_connect, #signal_disconnect, #signal_emit
Constructor Details
#initialize(options) ⇒ Dialog
Returns a new instance of Dialog.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 34 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.
54 55 56 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 54 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
61 62 63 64 65 66 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 61 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 |
#add_view(view) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 68 def add_view(view) sizer = Wx::BoxSizer.new(Wx::VERTICAL) view.peer.reparent(self) sizer.add(view.peer, 1, Wx::EXPAND|Wx::ALL, 5) sizer.add(@buttons, 0, Wx::ALIGN_RIGHT|Wx::ALL, 5) self.sizer = sizer layout end |
#show ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/ruby_mvc/toolkit/peers/wxruby/dialog.rb', line 77 def show self.centre if @modal case self.show_modal() when Wx::ID_OK, Wx::ID_YES @wxform.submit if @wxform resp = :accept else resp = :cancel end signal_emit("response", self, resp) else sel.show() end end |