Module: FFI::NCurses::EmulatedFunctions

Included in:
FFI::NCurses
Defined in:
lib/ffi-ncurses.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fixup(function, &block) ⇒ Object



558
559
560
561
562
# File 'lib/ffi-ncurses.rb', line 558

def self.fixup(function, &block)
  if NCurses.unattached_functions.include?(function)
    block.call
  end
end

Instance Method Details

#getbegyx(win) ⇒ Object



530
531
532
# File 'lib/ffi-ncurses.rb', line 530

def getbegyx(win)
  [NCurses.getbegy(win), NCurses.getbegx(win)]
end

#getmaxyx(win) ⇒ Object



536
537
538
# File 'lib/ffi-ncurses.rb', line 536

def getmaxyx(win)
  [NCurses.getmaxy(win), NCurses.getmaxx(win)]
end

#getparyx(win) ⇒ Object



533
534
535
# File 'lib/ffi-ncurses.rb', line 533

def getparyx(win)
  [NCurses.getpary(win), NCurses.getparx(win)]
end

#getsyxObject

transliterated from ncurses.h note: had to spell out NCurses::TRUE - will look into this



542
543
544
545
546
547
548
# File 'lib/ffi-ncurses.rb', line 542

def getsyx
  if (is_leaveok(newscr) == NCurses::TRUE)
 [-1, -1]
  else
    getyx(newscr)
  end
end

#getyx(win) ⇒ Object

I’m departing from the NCurses API here - makes no sense to force people to use pointer return values when these are implemented as macros to make them easy to use in C when we have multiple return values in Ruby for that exact same purpose



527
528
529
# File 'lib/ffi-ncurses.rb', line 527

def getyx(win)
  [NCurses.getcury(win), NCurses.getcurx(win)]
end

#setsyx(y, x) ⇒ Object



549
550
551
552
553
554
555
556
# File 'lib/ffi-ncurses.rb', line 549

def setsyx(y, x)
  if y == -1 && x == -1
 leaveok(newscr, NCurses::TRUE)
  else
 leaveok(newscr, NCurses::FALSE)
 wmove(newscr, y, x)
  end
end