class RETerm::Panel

Panels provide quick ways to switch between menus, pushing and poping them on/off an internal stack

Public Class Methods

new(window) click to toggle source

Initialize panel from the given window.

This maintains an internal registry of panels created for event dispatching purposes

# 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

Public Instance Methods

show() click to toggle source

Render this panel by surfacing it ot hte top of the stack

# 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