Module: Ncurses

Extended by:
Ncurses, NCX
Includes:
NCX
Included in:
Ncurses
Defined in:
lib/canis/core/system/panel.rb,
lib/canis/core/system/ncurses.rb

Overview

changed on 2011-09-8

Defined Under Namespace

Modules: NCX Classes: FFIWINDOW, Panel

Constant Summary collapse

FALSE =
0
TRUE =
1

Constants included from NCX

NCX::A_BLINK, NCX::A_BOLD, NCX::A_NORMAL, NCX::A_REVERSE, NCX::A_STANDOUT, NCX::A_UNDERLINE, NCX::KEY_F1

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NCX

COLORS, COLS, LINES, _stdscr

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object

i think we can knock this off



166
167
168
169
170
# File 'lib/canis/core/system/ncurses.rb', line 166

def method_missing meth, *args
  if (FFI::NCurses.respond_to?(meth))
    FFI::NCurses.send meth, *args
  end
end

Class Method Details

.initscrObject

if ffi-ncurses returns a pointer wrap it. or we can check for whether it responds_to? refresh and getch



218
219
220
221
222
223
224
225
226
# File 'lib/canis/core/system/ncurses.rb', line 218

def self.initscr
  #@stdscr = Ncurses::FFIWINDOW.new(FFI::NCurses.initscr) { }
  stdscr = FFI::NCurses.initscr
  if stdscr.is_a? FFI::Pointer
    @stdscr = Ncurses::FFIWINDOW.new(stdscr) { }
  else
    @stdscr = stdscr
  end
end

.stdscrObject



227
228
229
# File 'lib/canis/core/system/ncurses.rb', line 227

def self.stdscr
  @stdscr
end

Instance Method Details

#const_missing(name) ⇒ Object

FFINC.constants.each { |e| Ncurses.const_set(e, FFINC.const_get(e) ) }



172
173
174
175
176
# File 'lib/canis/core/system/ncurses.rb', line 172

def const_missing name
  val = FFI::NCurses.const_get(name)
  const_set(name, val)
  return val
end