Module: Ncurses

Extended by:
Ncurses, NCX
Includes:
NCX
Included in:
Ncurses
Defined in:
lib/rbcurse/core/system/panel.rb,
lib/rbcurse/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



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

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



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

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



226
227
228
# File 'lib/rbcurse/core/system/ncurses.rb', line 226

def self.stdscr
  @stdscr
end

Instance Method Details

#const_missing(name) ⇒ Object

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



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

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