Class: Amun::Windows::Frame

Inherits:
Base show all
Defined in:
lib/amun/windows/frame.rb

Overview

a Frame fills all the space in terminal renders an echo area or mini buffer if it exists and an object that respond to #render and #trigger, like buffer, or another window or so

Instance Attribute Summary collapse

Attributes inherited from Base

#size

Attributes inherited from Object

#events

Instance Method Summary collapse

Constructor Details

#initialize(size = default_size) ⇒ Frame

Returns a new instance of Frame.



19
20
21
22
23
24
# File 'lib/amun/windows/frame.rb', line 19

def initialize(size = default_size)
  super(size)
  @window = BufferWindow.new(top_window_size)
  @echo_area = EchoArea.new(bottom_window_size)
  bind(Curses::KEY_RESIZE, self, :set_size_to_terminal)
end

Instance Attribute Details

#echo_areaObject

Returns the value of attribute echo_area.



16
17
18
# File 'lib/amun/windows/frame.rb', line 16

def echo_area
  @echo_area
end

#mini_bufferObject

Returns the value of attribute mini_buffer.



16
17
18
# File 'lib/amun/windows/frame.rb', line 16

def mini_buffer
  @mini_buffer
end

#screen=(value) ⇒ Object (writeonly)

Sets the attribute screen

Parameters:

  • value

    the value to set the attribute screen to.



17
18
19
# File 'lib/amun/windows/frame.rb', line 17

def screen=(value)
  @screen = value
end

#windowObject

Returns the value of attribute window.



16
17
18
# File 'lib/amun/windows/frame.rb', line 16

def window
  @window
end

Instance Method Details

#renderObject



32
33
34
35
# File 'lib/amun/windows/frame.rb', line 32

def render
  render_window(window)
  render_window(bottom_area)
end

#set_size_to_terminalObject



37
38
39
# File 'lib/amun/windows/frame.rb', line 37

def set_size_to_terminal(*)
  self.size = default_size
end

#trigger(event) ⇒ Object



26
27
28
29
30
# File 'lib/amun/windows/frame.rb', line 26

def trigger(event)
  EventManager.join(event, self.events, echo_area, mini_buffer || window, EventManager)
rescue StandardError => error
  handle_exception(error)
end