Class: Gemthief::Executive::WindowManagement::Panel
- Inherits:
-
Object
- Object
- Gemthief::Executive::WindowManagement::Panel
- Defined in:
- lib/gemthief/executive/window_management.rb
Instance Method Summary collapse
- #addstr(char) ⇒ Object
-
#clear ⇒ Object
TODO: Use Forwardable for these and other methods.
- #dimensions ⇒ Object
-
#initialize(screen_x, screen_y, screen_width, screen_height, content_width, content_height, content_x = 0, content_y = 0) ⇒ Panel
constructor
A new instance of Panel.
- #noutrefresh ⇒ Object
- #screen_maxcol ⇒ Object
- #screen_maxrow ⇒ Object
- #setpos(at_line, at_col) ⇒ Object
Constructor Details
#initialize(screen_x, screen_y, screen_width, screen_height, content_width, content_height, content_x = 0, content_y = 0) ⇒ Panel
Returns a new instance of Panel.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gemthief/executive/window_management.rb', line 32 def initialize(screen_x, screen_y, screen_width, screen_height, content_width, content_height, content_x=0, content_y=0) @screen_x = screen_x @screen_y = screen_y @screen_width = screen_width @screen_height = screen_height @content_width = content_width @content_height = content_height @content_x = content_x @content_y = content_y @outer = Curses::Pad.new(@content_height, @content_width) @inner = @outer.subpad(@content_height, @content_width,1,1) end |
Instance Method Details
#addstr(char) ⇒ Object
53 54 55 |
# File 'lib/gemthief/executive/window_management.rb', line 53 def addstr(char) @inner.addstr("@") end |
#clear ⇒ Object
TODO: Use Forwardable for these and other methods
47 48 49 |
# File 'lib/gemthief/executive/window_management.rb', line 47 def clear @inner.clear end |
#dimensions ⇒ Object
71 72 73 |
# File 'lib/gemthief/executive/window_management.rb', line 71 def dimensions { x: @width, y: @height } end |
#noutrefresh ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gemthief/executive/window_management.rb', line 57 def noutrefresh @outer.noutrefresh( @content_y, @content_x, @screen_y, @screen_x, screen_maxrow, screen_maxcol ) @outer.box(?|, ?-) @inner.noutrefresh( @content_y, @content_x, @screen_y+1, @screen_x+1, screen_maxrow-2, screen_maxcol-2 ) end |
#screen_maxcol ⇒ Object
79 80 81 |
# File 'lib/gemthief/executive/window_management.rb', line 79 def screen_maxcol @screen_x + @screen_width end |
#screen_maxrow ⇒ Object
75 76 77 |
# File 'lib/gemthief/executive/window_management.rb', line 75 def screen_maxrow @screen_y + @screen_height end |
#setpos(at_line, at_col) ⇒ Object
50 51 52 |
# File 'lib/gemthief/executive/window_management.rb', line 50 def setpos(at_line, at_col) @inner.setpos(at_line, at_col) end |