Class: RETerm::Panel
- Inherits:
-
Object
- Object
- RETerm::Panel
- Includes:
- EventDispatcher
- Defined in:
- lib/reterm/panel.rb
Overview
Panels provide quick ways to switch between menus, pushing and poping them on/off an internal stack
Instance Method Summary collapse
-
#initialize(window) ⇒ Panel
constructor
Initialize panel from the given window.
-
#show ⇒ Object
Render this panel by surfacing it ot hte top of the stack.
Methods included from EventDispatcher
Constructor Details
#initialize(window) ⇒ Panel
Initialize panel from the given window.
This maintains an internal registry of panels created for event dispatching purposes
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/reterm/panel.rb', line 11 def initialize(window) @@registry ||= {} # panel already associated with window raise ArgumentError, window if @@registry.key?(window) @@registry[window] = self @window = window @panel = Ncurses::Panel::PANEL.new(@window.win) end |
Instance Method Details
#show ⇒ Object
Render this panel by surfacing it ot hte top of the stack
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/reterm/panel.rb', line 24 def show Ncurses::Panel.top_panel(@panel) update_reterm @@registry.values.each { |panel| if panel == self dispatch :panel_show else panel.dispatch :panel_hide end } end |