Class: Okayu::MainPanel
- Inherits:
-
Wx::Panel
- Object
- Wx::Panel
- Okayu::MainPanel
- Defined in:
- lib/views/main_panel.rb
Instance Attribute Summary collapse
-
#timer ⇒ Object
readonly
Returns the value of attribute timer.
Instance Method Summary collapse
- #close_tab ⇒ Object
- #create_tab ⇒ Object
- #get_current_page ⇒ Object
-
#initialize(frame, x, y, w, h) ⇒ MainPanel
constructor
A new instance of MainPanel.
- #on_size(event) ⇒ Object
- #on_update ⇒ Object
Constructor Details
#initialize(frame, x, y, w, h) ⇒ MainPanel
Returns a new instance of MainPanel.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/views/main_panel.rb', line 4 def initialize(frame, x, y, w, h) super(frame, -1, Wx::Point.new(x, y), Wx::Size.new(w, h)) @notebook = Wx::Notebook.new self, :id =>ID_NOTEBOOK, :pos => Wx::Point.new(x, y), :size => Wx::Size.new(w, h) # panel = LivePanel.new(@notebook) # @notebook.add_page(panel, panel.title, TRUE) create_tab @timer = Wx::Timer.new(self, Wx::ID_ANY) @timer.start 100 evt_timer(@timer.get_id) {|event| on_update} evt_size{|event| on_size(event)} end |
Instance Attribute Details
#timer ⇒ Object (readonly)
Returns the value of attribute timer.
3 4 5 |
# File 'lib/views/main_panel.rb', line 3 def timer @timer end |
Instance Method Details
#close_tab ⇒ Object
40 41 42 43 |
# File 'lib/views/main_panel.rb', line 40 def close_tab @notebook.get_current_page.close @notebook.delete_page(@notebook.get_selection) end |
#create_tab ⇒ Object
34 35 36 37 38 |
# File 'lib/views/main_panel.rb', line 34 def create_tab panel = LivePanel.new(@notebook) @notebook.add_page(panel, panel.title, TRUE) @notebook.get_current_page.set_index(@notebook.get_selection) end |
#get_current_page ⇒ Object
45 46 47 |
# File 'lib/views/main_panel.rb', line 45 def get_current_page @notebook.get_current_page end |
#on_size(event) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/views/main_panel.rb', line 27 def on_size event if @notebook size = get_client_size @notebook.set_dimensions(2, 2, (size.get_width - 4), (size.get_height - 4)) end end |
#on_update ⇒ Object
21 22 23 24 25 |
# File 'lib/views/main_panel.rb', line 21 def on_update @notebook.each_page do |page| page.on_update end end |