Class: Reactive::View::Wx::Helpers::ModelMainFrame
- Inherits:
-
Wx::Frame
- Object
- Wx::Frame
- Reactive::View::Wx::Helpers::ModelMainFrame
- Defined in:
- lib/helpers/model_main_frame_class.rb
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#notebook ⇒ Object
readonly
Returns the value of attribute notebook.
Instance Method Summary collapse
- #add_page(options = {}) ⇒ Object
- #add_pane(options = {}) ⇒ Object
- #art_provider ⇒ Object
- #close_page(window) ⇒ Object
- #current_page ⇒ Object
-
#initialize(*args) ⇒ ModelMainFrame
constructor
A new instance of ModelMainFrame.
-
#model ⇒ Object
get the model of the current page.
-
#selected_records ⇒ Object
get the selected records of the current page.
Constructor Details
#initialize(*args) ⇒ ModelMainFrame
Returns a new instance of ModelMainFrame.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/helpers/model_main_frame_class.rb', line 19 def initialize(*args) super @manager = Wx::AuiManager.new @manager.set_managed_window(self) .set_status_text("Ready") set_min_size( Wx::Size.new(400,300) ) pi = Wx::AuiPaneInfo.new pi.set_name('notebook').center_pane @manager.add_pane(create_notebook, pi) @manager.update evt_erase_background { | e | on_erase_background(e) } evt_size{ | e | on_size(e) } evt_auinotebook_page_changed(Wx::ID_ANY) { | e | on_page_changed(e) } end |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
17 18 19 |
# File 'lib/helpers/model_main_frame_class.rb', line 17 def manager @manager end |
#notebook ⇒ Object (readonly)
Returns the value of attribute notebook.
17 18 19 |
# File 'lib/helpers/model_main_frame_class.rb', line 17 def notebook @notebook end |
Instance Method Details
#add_page(options = {}) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/helpers/model_main_frame_class.rb', line 62 def add_page( = {}) # Handle default options [:select] = default_page_select if [:select].nil? [:bitmap] = default_page_bitmap if [:bitmap].nil? [:caption] = default_page_caption if [:caption].nil? if control = yield(@notebook) control.extend PageStatus @notebook.add_page(control, [:caption], [:select], [:bitmap]) end end |
#add_pane(options = {}) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/helpers/model_main_frame_class.rb', line 53 def add_pane( = {}) pi = Wx::AuiPaneInfo.new .each {|setter, value| pi.send("set_#{setter}", value)} if control = yield(pi) @manager.add_pane(control, pi) @manager.update end end |
#art_provider ⇒ Object
83 84 85 |
# File 'lib/helpers/model_main_frame_class.rb', line 83 def art_provider Wx::ArtProvider end |
#close_page(window) ⇒ Object
74 75 76 77 |
# File 'lib/helpers/model_main_frame_class.rb', line 74 def close_page(window) index = @notebook.get_page_index(window) @notebook.delete_page(index) if index end |
#current_page ⇒ Object
79 80 81 |
# File 'lib/helpers/model_main_frame_class.rb', line 79 def current_page @notebook.get_page(@notebook.get_selection) end |
#model ⇒ Object
get the model of the current page
48 49 50 51 |
# File 'lib/helpers/model_main_frame_class.rb', line 48 def model page = current_page page && page.model end |
#selected_records ⇒ Object
get the selected records of the current page
42 43 44 45 |
# File 'lib/helpers/model_main_frame_class.rb', line 42 def selected_records page = current_page page ? page.selected_records : [] end |