Project

General

Profile

Bug #4747 ยป ruby_doc_updates-20110520_0227-curses_vbatts.patch

vbatts (Vincent Batts), 05/20/2011 03:34 PM

View differences:

ext/curses/curses.c
*
* maintainers:
* - Takaaki Tateishi (ttate@kt.jaist.ac.jp)
*
* doumentation:
* - Vincent Batts (vbatts@hashbangbash.com)
*/
#include "ruby.h"
......
/*-------------------------- module Curses --------------------------*/
/* def init_screen */
/*
* Document-method: Curses.init_screen
*
* Initialize a standard screen
*
* see also Curses.stdscr
*/
static VALUE
curses_init_screen(void)
{
......
return rb_stdscr;
}
/* def stdscr */
/*
* Document-method: Curses.stdscr
*
* The Standard Screen.
* Upon initializing curses, a default window called stdscr,
* which is the size of the terminal screen, is created.
*
* Many curses functions use this window.
*/
#define curses_stdscr curses_init_screen
/* def close_screen */
static VALUE
curses_close_screen(void)
{
......
}
#ifdef HAVE_ISENDWIN
/* def closed? */
static VALUE
curses_closed(void)
{
......
#define curses_closed rb_f_notimplement
#endif
/* def clear */
static VALUE
curses_clear(VALUE obj)
{
......
return Qnil;
}
/* def clrtoeol */
static VALUE
curses_clrtoeol(void)
{
......
return Qnil;
}
/* def refresh */
static VALUE
curses_refresh(VALUE obj)
{
......
return Qnil;
}
/* def doupdate */
static VALUE
curses_doupdate(VALUE obj)
{
......
return Qnil;
}
/* def echo */
static VALUE
curses_echo(VALUE obj)
{
......
return Qnil;
}
/* def noecho */
static VALUE
curses_noecho(VALUE obj)
{
......
return Qnil;
}
/* def raw */
static VALUE
curses_raw(VALUE obj)
{
......
return Qnil;
}
/* def noraw */
static VALUE
curses_noraw(VALUE obj)
{
......
return Qnil;
}
/* def cbreak */
static VALUE
curses_cbreak(VALUE obj)
{
......
return Qnil;
}
/* def nocbreak */
static VALUE
curses_nocbreak(VALUE obj)
{
......
return Qnil;
}
/* def nl */
static VALUE
curses_nl(VALUE obj)
{
......
return Qnil;
}
/* def nonl */
static VALUE
curses_nonl(VALUE obj)
{
......
return Qnil;
}
/* def beep */
static VALUE
curses_beep(VALUE obj)
{
......
return Qnil;
}
/* def flash */
static VALUE
curses_flash(VALUE obj)
{
......
}
#ifdef HAVE_UNGETCH
/* def ungetch */
/*
* Document-method: Curses.ungetch
* call-seq: ungetch(ch)
*
* Places +ch+ back onto the input queue to be returned by
* the next call to Curses.getch.
*
* There is just one input queue for all windows.
*/
static VALUE
curses_ungetch(VALUE obj, VALUE ch)
{
......
#define curses_ungetch rb_f_notimplement
#endif
/* def setpos(y, x) */
static VALUE
curses_setpos(VALUE obj, VALUE y, VALUE x)
{
......
return Qnil;
}
/* def standout */
static VALUE
curses_standout(VALUE obj)
{
......
return Qnil;
}
/* def standend */
static VALUE
curses_standend(VALUE obj)
{
......
return Qnil;
}
/* def inch */
static VALUE
curses_inch(VALUE obj)
{
......
return CH2FIX(inch());
}
/* def addch(ch) */
static VALUE
curses_addch(VALUE obj, VALUE ch)
{
......
return Qnil;
}
/* def insch(ch) */
static VALUE
curses_insch(VALUE obj, VALUE ch)
{
......
return Qnil;
}
/* def addstr(str) */
/*
* Document-method: Curses.addstr
* call-seq: addstr(str)
*
* add a string of characters +str+, to the window and advance cursor
*
*/
static VALUE
curses_addstr(VALUE obj, VALUE str)
{
......
return Qnil;
}
/* def getch */
/*
* Document-method: Curses.getch
*
* Read and returns a character from the window.
*
* See Curses::Key to all the function KEY_* available
*
*/
static VALUE
curses_getch(VALUE obj)
{
......
return Qnil;
}
/* def getstr */
static VALUE
curses_getstr(VALUE obj)
{
......
return rb_locale_str_new_cstr(rtn);
}
/* def delch */
static VALUE
curses_delch(VALUE obj)
{
......
return Qnil;
}
/* def delelteln */
static VALUE
curses_deleteln(VALUE obj)
{
......
return Qnil;
}
/* def insertln */
static VALUE
curses_insertln(VALUE obj)
{
......
return Qnil;
}
/* def keyname */
static VALUE
curses_keyname(VALUE obj, VALUE c)
{
......
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
/*
* call-seq: attrset(attrs)
*
* see also Curses::Window.attrset
*
*/
static VALUE
curses_attrset(VALUE obj, VALUE attrs)
{
......
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
/*
* Document-method: Curses.bkgdset
* call-seq: bkgdset(ch)
*
* Manipulate the background of the named window
* with character Integer +ch+
*
* The background becomes a property of the character
* and moves with the character through any scrolling
* and insert/delete line/character operations.
*
* see also the system manual for curs_bkgd(3)
*/
static VALUE
curses_bkgdset(VALUE obj, VALUE ch)
{
......
return Qnil;
}
/*
* call-seq: bkgd(ch)
*
* Window background manipulation routines.
*
* Set the background property of the current
* and then apply the character Integer +ch+ setting
* to every character position in that window.
*
* see also the system manual for curs_bkgd(3)
*/
static VALUE
curses_bkgd(VALUE obj, VALUE ch)
{
......
}
#if defined(HAVE_USE_DEFAULT_COLORS)
/*
* tells the curses library to use terminal's default colors.
*
* see also the system manual for default_colors(3)
*/
static VALUE
curses_use_default_colors(VALUE obj)
{
......
#endif
#if defined(HAVE_TABSIZE)
/*
* Document-method: TABSIZE=
* call-seq: TABSIZE=(value)
*
* Sets the TABSIZE to Integer +value+
*/
static VALUE
curses_tabsize_set(VALUE obj, VALUE val)
{
......
#endif
#if defined(HAVE_TABSIZE)
/*
* Returns the number of positions in a tab.
*/
static VALUE
curses_tabsize_get(VALUE ojb)
{
......
#endif
#if defined(HAVE_ESCDELAY)
/*
* call-seq: ESCDELAY=(value)
*
* Sets the ESCDELAY to Integer +value+
*/
static VALUE
curses_escdelay_set(VALUE obj, VALUE val)
{
......
#endif
#if defined(HAVE_ESCDELAY)
/*
* Returns the total time, in milliseconds, for which
* curses will await a character sequence, e.g., a function key
*/
static VALUE
curses_escdelay_get(VALUE obj)
{
......
#define curses_escdelay_get rb_f_notimplement
#endif
/*
* Document-method: Curses.resize
* call-seq: resize(lines, cols)
*
* alias for Curses.resizeterm
*
*/
/*
* Document-method: Curses.resizeterm
* call-seq: resizeterm(lines, cols)
*
* Resize the current term to Fixnum +lines+ and Fixnum +cols+
*
*/
static VALUE
curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
{
......
xfree(mdata->mevent);
}
/*
* Document-method: Curses.getmouse
*
* Returns the current mouse or nil
*/
static VALUE
curses_getmouse(VALUE obj)
{
......
return (UINT2NUM(mdata->mevent -> mem)); \
}
/*
* Document-method: Curses::MouseEvent.eid
*
* Returns the current mouse id
*/
DEFINE_MOUSE_GET_MEMBER(curs_mouse_id, id)
/*
* Document-method: Curses::MouseEvent.x
*
* Returns the current mouse's X coordinate
*/
DEFINE_MOUSE_GET_MEMBER(curs_mouse_x, x)
/*
* Document-method: Curses::MouseEvent.y
*
* Returns the current mouse's Y coordinate
*/
DEFINE_MOUSE_GET_MEMBER(curs_mouse_y, y)
/*
* Document-method: Curses::MouseEvent.z
*
* Returns the current mouse's Z coordinate
*/
DEFINE_MOUSE_GET_MEMBER(curs_mouse_z, z)
/*
* Document-method: Curses::MouseEvent.bstate
*
* Returns the current mouse's B state.
*
* ???
*/
DEFINE_MOUSE_GET_MEMBER(curs_mouse_bstate, bstate)
#undef define_curs_mouse_member
#endif /* USE_MOUSE */
#ifdef HAVE_TIMEOUT
/*
* Document-method: Curses.timeout=
* call-seq: timeout=(delay)
*
* Sets block and non-blocking reads for the window.
* - If delay is negative, blocking read is used (i.e., waits indefinitely for input).
* - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting).
* - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input.
*
*/
static VALUE
curses_timeout(VALUE obj, VALUE delay)
{
......
/*-------------------------- class Window --------------------------*/
/* def self.allocate */
/* returns a Curses::Window object */
static VALUE
window_s_allocate(VALUE class)
{
......
return Data_Make_Struct(class, struct windata, 0, free_window, winp);
}
/* def initialize(h, w, top, left) */
/*
* Document-method: Curses::Window.new
* call-seq: new(height, width, top, left)
*
* Contruct a new Curses::Window with constraints of
* +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column.
*
* A new window using full screen is called as
* Curses::Window.new(0,0,0,0)
*
*/
static VALUE
window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
{
......
return obj;
}
/* def subwin(height, width, top, left) */
/*
* Document-method: Curses::Window.subwin
* call-seq: subwin(height, width, top, left)
*
* Contruct a new subwindow with constraints of
* +height+ lines, +width+ columns, begin at +top+ line, and begin +left+ most column.
*
*/
static VALUE
window_subwin(VALUE obj, VALUE height, VALUE width, VALUE top, VALUE left)
{
......
return win;
}
/* def close */
/*
* Document-method: Curses::Window.close
*
* Deletes the window, and frees the memory
*/
static VALUE
window_close(VALUE obj)
{
......
return Qnil;
}
/* def clear */
/*
* Document-method: Curses::Window.clear
*
* Clear the window.
*/
static VALUE
window_clear(VALUE obj)
{
......
return Qnil;
}
/* def clrtoeol */
/*
* Document-method: Curses::Window.clrtoeol
*
* Clear the window to the end of line, that the cursor is currently on.
*/
static VALUE
window_clrtoeol(VALUE obj)
{
......
return Qnil;
}
/* def refresh */
/*
* Document-method: Curses::Window.refresh
*
* Refreshes the windows and lines.
*
*/
static VALUE
window_refresh(VALUE obj)
{
......
return Qnil;
}
/* def noutrefresh */
/*
* Document-method: Curses::Window.noutrefresh
*
* Refreshes the windows and lines.
*
* Curses::Window.noutrefresh allows multiple updates with
* more efficiency than Curses::Window.refresh alone.
*/
static VALUE
window_noutrefresh(VALUE obj)
{
......
return Qnil;
}
/* def move(y, x) */
/*
* Document-method: Curses::Window.move
* call-seq: move(y,x)
*
* Moves the window so that the upper left-hand corner is at position (+y+, +x+)
*/
static VALUE
window_move(VALUE obj, VALUE y, VALUE x)
{
......
return Qnil;
}
/* def setpos(y, x) */
/*
* Document-method: Curses::Window.setpos
* call-seq: setpos(y, x)
*
* A setter for the position of the window,
* using coordinates +x+ and +y+
*
*/
static VALUE
window_setpos(VALUE obj, VALUE y, VALUE x)
{
......
return Qnil;
}
/* def cury */
/*
* Document-method: Curses::Window.cury
*
* A getter for the current line (Y coord) of the window
*/
static VALUE
window_cury(VALUE obj)
{
......
return INT2FIX(y);
}
/* def curx */
/*
* Document-method: Curses::Window.curx
*
* A getter for the current column (X coord) of the window
*/
static VALUE
window_curx(VALUE obj)
{
......
return INT2FIX(x);
}
/* def maxy */
/*
* Document-method: Curses::Window.maxy
*
* A getter for the maximum lines for the window
*/
static VALUE
window_maxy(VALUE obj)
{
......
#endif
}
/* def maxx */
/*
* Document-method: Curses::Window.maxx
*
* A getter for the maximum columns for the window
*/
static VALUE
window_maxx(VALUE obj)
{
......
#endif
}
/* def begy */
/*
* Document-method: Curses::Window.begy
*
* A getter for the beginning line (Y coord) of the window
*/
static VALUE
window_begy(VALUE obj)
{
......
#endif
}
/* def begx */
/*
* Document-method: Curses::Window.begx
*
* A getter for the beginning column (X coord) of the window
*/
static VALUE
window_begx(VALUE obj)
{
......
#endif
}
/* def box(vert, hor) */
/*
* Document-method: Curses::Window.box
* call-seq: box(vert, hor)
*
* set the characters to frame the window in.
* The vertical +vert+ and horizontal +hor+ character.
*
* win = Curses::Window.new(5,5,5,5)
* win.box(?|, ?-)
*
*/
static VALUE
window_box(int argc, VALUE *argv, VALUE self)
{
......
return Qnil;
}
/* def standout */
/*
* Document-method: Curses::Window.standout
*
* Enables the best highlighting mode of the terminal.
*
* This is equivalent to Curses::Window.attron(A_STANDOUT)
*
* see also Curses::Window.attrset
*/
static VALUE
window_standout(VALUE obj)
{
......
return Qnil;
}
/* def standend */
/*
* Document-method: Curses::Window.standend
*
* Enables the Normal display (no highlight)
*
* This is equivalent to Curses::Window.attron(A_NORMAL)
*
* see also Curses::Window.attrset
*/
static VALUE
window_standend(VALUE obj)
{
......
return Qnil;
}
/* def inch */
/*
* Document-method: Curses::Window.inch
*
* Returns the character at the current position of the window.
*/
static VALUE
window_inch(VALUE obj)
{
......
return CH2FIX(winch(winp->window));
}
/* def addch(ch) */
/*
* Document-method: Curses::Window.addch
* call-seq: addch(ch)
*
* Add a character +ch+, with attributes, to the window, then advance the cursor.
*
* see also the system manual for curs_addch(3)
*/
static VALUE
window_addch(VALUE obj, VALUE ch)
{
......
return Qnil;
}
/* def insch(ch) */
/*
* Document-method: Curses::Window.insch
* call-seq: insch(ch)
*
* Insert a character +ch+, before the cursor, in the current window
*
*/
static VALUE
window_insch(VALUE obj, VALUE ch)
{
......
return Qnil;
}
/* def addstr(str) */
/*
* Document-method: Curses::Window.addstr
* call-seq: addstr(str)
*
* add a string of characters +str+, to the window and advance cursor
*
*/
static VALUE
window_addstr(VALUE obj, VALUE str)
{
......
return Qnil;
}
/* def <<(str) */
/*
* Document-method: Curses::Window.<<
* call-seq: <<(str)
*
* Add String +str+ to the current string.
*
* See also Curses::Window.addstr
*/
static VALUE
window_addstr2(VALUE obj, VALUE str)
{
......
return Qnil;
}
/* def getch */
/*
* Document-method: Curses::Window.getch
*
* Read and returns a character from the window.
*
* See Curses::Key to all the function KEY_* available
*
*/
static VALUE
window_getch(VALUE obj)
{
......
return Qnil;
}
/* def getstr */
/*
* Document-method: Curses::Window.getstr
*
* This is equivalent to a series f Curses::Window.getch calls
*
*/
static VALUE
window_getstr(VALUE obj)
{
......
return rb_locale_str_new_cstr(arg.rtn);
}
/* def delch */
/*
* Document-method: Curses::Window.delch
*
* Delete the character under the cursor
*
*/
static VALUE
window_delch(VALUE obj)
{
......
return Qnil;
}
/* def delelteln */
/*
* Document-method: Curses::Window.deleteln
*
* Delete the line under the cursor.
*
*/
static VALUE
window_deleteln(VALUE obj)
{
......
return Qnil;
}
/* def insertln */
/*
* Document-method: Curses::Window.insertln
*
* Inserts a line above the cursor, and the bottom line is lost
*
*/
static VALUE
window_insertln(VALUE obj)
{
......
return Qnil;
}
/*
* Document-method: Curses::Window.scrollok
* call-seq: scrollok(bool)
*
* Controls what happens when the cursor of a window
* is moved off the edge of the window or scrolling region,
* either as a result of a newline action on the bottom line,
* or typing the last character of the last line.
*
* If disabled, (+bool+ is false), the cursor is left on the bottom line.
*
* If enabled, (+bool+ is true), the window is scrolled up one line
* (Note that to get the physical scrolling effect on the terminal,
* it is also necessary to call Curses::Window.idlok)
*/
static VALUE
window_scrollok(VALUE obj, VALUE bf)
{
......
return Qnil;
}
/*
* Document-method: Curses::Window.idlok
* call-seq: idlok(bool)
*
* If +bool+ is +true+ curses considers using the hardware insert/delete
* line feature of terminals so equipped.
*
* If +bool+ is +false+, disables use of line insertion and deletion.
* This option should be enabled only if the application needs insert/delete
* line, for example, for a screen editor.
*
* It is disabled by default because insert/delete line tends to be visually
* annoying when used in applications where it is not really needed.
* If insert/delete line cannot be used, curses redraws the changed portions of all lines.
*
*/
static VALUE
window_idlok(VALUE obj, VALUE bf)
{
......
return Qnil;
}
/*
* Document-method: Curses::Window.setscrreg
* call-seq: setscrreg(top, bottom)
*
* Set a software scrolling region in a window.
* +top+ and +bottom+ are lines numbers of the margin.
*
* If this option and Curses::Window.scrollok are enabled, an attempt to move off
* the bottom margin line causes all lines in the scrolling region
* to scroll one line in the direction of the first line.
* Only the text of the window is scrolled.
*
*/
static VALUE
window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
{
......
}
#if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET)
/*
* Document-method: Curses::Window.color_set
* call-seq: color_set(col)
*
* Sets the current color of the given window to the
* foreground/background combination described by the Fixnum +col+.
*/
static VALUE
window_color_set(VALUE obj, VALUE col)
{
......
}
#endif /* defined(USE_COLOR) && defined(HAVE_WCOLOR_SET) */
/*
* Document-method: Curses::Window.scroll
*
* Scrolls the current window up one line.
*/
static VALUE
window_scroll(VALUE obj)
{
......
return (scroll(winp->window) == OK) ? Qtrue : Qfalse;
}
/*
* Document-method: Curses::Window.scrl
* call-seq: scrl(num)
*
* Scrolls the current window Fixnum +num+ lines.
* The current cursor position is not changed.
*
* For positive +num+, it scrolls up.
*
* For negative +num+, it scrolls down.
*
*/
static VALUE
window_scrl(VALUE obj, VALUE n)
{
......
#endif
}
/*
* Document-method: Curses::Window.attroff
* call-seq: attroff(attrs)
*
* Turns on the named attributes +attrs+ without affecting any others.
*
* See also Curses::Window.attrset
*/
static VALUE
window_attroff(VALUE obj, VALUE attrs)
{
......
#endif
}
/*
* Document-method: Curses::Window.attron
* call-seq: attron(attrs)
*
* Turns off the named attributes +attrs+
* without turning any other attributes on or off.
*
* See also Curses::Window.attrset
*/
static VALUE
window_attron(VALUE obj, VALUE attrs)
{
......
#endif
}
/*
* Document-method: Curses::Window.attrset
* call-seq: attrset(attrs)
*
* Sets the current attributes of the given window to +attrs+.
*
* The following video attributes, defined in <curses.h>, can
* be passed to the routines Curses::Window.attron, Curses::Window.attroff,
* and Curses::Window.attrset, or OR'd with the characters passed to addch.
* A_NORMAL Normal display (no highlight)
* A_STANDOUT Best highlighting mode of the terminal.
* A_UNDERLINE Underlining
* A_REVERSE Reverse video
* A_BLINK Blinking
* A_DIM Half bright
* A_BOLD Extra bright or bold
* A_PROTECT Protected mode
* A_INVIS Invisible or blank mode
* A_ALTCHARSET Alternate character set
* A_CHARTEXT Bit-mask to extract a character
* COLOR_PAIR(n) Color-pair number n
*
* TODO: provide some examples here.
*
* see also system manual curs_attr(3)
*/
static VALUE
window_attrset(VALUE obj, VALUE attrs)
{
......
#endif
}
/*
* Document-method: Curses::Window.bkgdset
* call-seq: bkgdset(ch)
*
* Manipulate the background of the current window
* with character Integer +ch+
*
* see also Curses.bkgdset
*/
static VALUE
window_bkgdset(VALUE obj, VALUE ch)
{
......
return Qnil;
}
/*
* Document-method: Curses::Window.bkgd
* call-seq: bkgd(ch)
*
* Set the background of the current window
* and apply character Integer +ch+ to every character.
*
* see also Curses.bkgd
*/
static VALUE
window_bkgd(VALUE obj, VALUE ch)
{
......
#endif
}
/*
* Document-method: Curses::Window.getbkgd
*
* Returns an Interer (+ch+) for the character property in the current window.
*/
static VALUE
window_getbkgd(VALUE obj)
{
......
#endif
}
/*
* Document-method: Curses::Window.resize
* call-seq: resize(lines, cols)
*
* Resize the current window to Fixnum +lines+ and Fixnum +cols+
*
*/
static VALUE
window_resize(VALUE obj, VALUE lin, VALUE col)
{
......
#ifdef HAVE_KEYPAD
/*
* Document-method: Curses::Window.keypad=
* call-seq: keypad=(bool)
*
* see Curses::Window.keypad
*/
/*
* Document-method: Curses::Window.keypad
* call-seq: keypad(bool)
*
* Enables the keypad of the user's terminal.
* If enabled (+bool+ is +true+), the user can press a function key
* (such as an arrow key) and wgetch returns a single value representing
* the function key, as in KEY_LEFT. If disabled (+bool+ is +false+),
* curses does not treat function keys specially and the program has to
* interpret the escape sequences itself. If the keypad in the terminal
* can be turned on (made to transmit) and off (made to work locally),
* turning on this option causes the terminal keypad to be turned on when
* Curses::Window.getch is called.
*
* The default value for keypad is false.
*
*/
static VALUE
window_keypad(VALUE obj, VALUE val)
{
......
#endif
#ifdef HAVE_NODELAY
/*
* Document-method: Curses::Window.nodelay
* call-seq: nodelay(bool)
*
* Causes Curses::Window.getch to be a non-blocking call. If no input is ready, getch returns ERR.
*
* If disabled (+bool+ is +false+), Curses::Window.getch waits until a key is pressed.
*
*/
static VALUE
window_nodelay(VALUE obj, VALUE val)
{
......
#endif
#ifdef HAVE_WTIMEOUT
/*
* Document-method: Curses::Window.timeout=
* call-seq: timeout=(delay)
*
* Sets block and non-blocking reads for the window.
* - If delay is negative, blocking read is used (i.e., waits indefinitely for input).
* - If delay is zero, then non-blocking read is used (i.e., read returns ERR if no input is waiting).
* - If delay is positive, then read blocks for delay milliseconds, and returns ERR if there is still no input.
*
*/
static VALUE
window_timeout(VALUE obj, VALUE delay)
{
......
#endif
/*------------------------- Initialization -------------------------*/
/*
* Document-module: Curses
*
* == Description
* An implementation of the CRT screen handling and optimization library.
*
* == Structures
*
* === Classes
*
* * Curses::Window - class with the means to draw a window or box
* * Curses::MouseEvent - class for collecting mouse events
*
* === Modules
*
* * Curses - basis for the curses implementation
* * Curses::Key - the collection of constants
*
* == Examples
*
* * hello.rb
* :include: hello.rb
*
*
* * rain.rb
* :include: rain.rb
*
*/
void
Init_curses(void)
{
mCurses = rb_define_module("Curses");
/*
* Document-module: Curses::Key
*
*
* a container for the KEY_* values.
*
* See also system manual for getch(3)
*
*/
mKey = rb_define_module_under(mCurses, "Key");
rb_gc_register_address(&rb_stdscr);
#ifdef USE_MOUSE
/*
* Document-class: Curses::MouseEvent
*
* == Description
*
* Curses::MouseEvent
*
* == Example
*
* * mouse.rb
* :include: mouse.rb
*
*/
cMouseEvent = rb_define_class_under(mCurses,"MouseEvent",rb_cObject);
rb_undef_method(CLASS_OF(cMouseEvent),"new");
rb_define_method(cMouseEvent, "eid", curs_mouse_id, 0);
......
rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
/*
* Document-class: Curses::Window
*
* == Description
*
* The means by which to create and manage frames or windows.
* While there may be more than one window at a time, only one window
* receive the input.
*
* == Usage
*
* require 'curses'
*
* Curses.init_screen()
*
* my_str = "LOOK! PONIES!"
* win = Curses::Window.new( 8, (my_str.length + 10),
* (Curses.lines - 8) / 2,
* (Curses.cols - (my_str.length + 10)) / 2 )
* win.box("|", "-")
* win.setpos(2,3)
* win.addstr(my_str)
* # or even
* win << "\nORLY"
* win << "\nYES!! " + my_str
* win.refresh
* win.getch
* win.close
*
*/
cWindow = rb_define_class_under(mCurses, "Window", rb_cData);
rb_define_alloc_func(cWindow, window_s_allocate);
rb_define_method(cWindow, "initialize", window_initialize, 4);
......
#endif /* USE_MOUSE */
#if defined(KEY_MOUSE) && defined(USE_MOUSE)
/* Document-const: MOUSE
*
* Mouse event read
*/
rb_curses_define_const(KEY_MOUSE);
rb_define_const(mKey, "MOUSE", INT2NUM(KEY_MOUSE));
#endif
#ifdef KEY_MIN
/* Document-const: MIN
*
* ???
*/
rb_curses_define_const(KEY_MIN);
rb_define_const(mKey, "MIN", INT2NUM(KEY_MIN));
#endif
#ifdef KEY_BREAK
/* Document-const: BREAK
*
* Break key
*/
rb_curses_define_const(KEY_BREAK);
rb_define_const(mKey, "BREAK", INT2NUM(KEY_BREAK));
#endif
#ifdef KEY_DOWN
/* Document-const: DOWN
*
* the down arrow key
*/
rb_curses_define_const(KEY_DOWN);
rb_define_const(mKey, "DOWN", INT2NUM(KEY_DOWN));
#endif
#ifdef KEY_UP
/* Document-const: UP
*
* the up arrow key
*/
rb_curses_define_const(KEY_UP);
rb_define_const(mKey, "UP", INT2NUM(KEY_UP));
#endif
#ifdef KEY_LEFT
/* Document-const: LEFT
*
* the left arrow key
*/
rb_curses_define_const(KEY_LEFT);
rb_define_const(mKey, "LEFT", INT2NUM(KEY_LEFT));
#endif
#ifdef KEY_RIGHT
/* Document-const: RIGHT
*
* the right arrow key
*/
rb_curses_define_const(KEY_RIGHT);
rb_define_const(mKey, "RIGHT", INT2NUM(KEY_RIGHT));
#endif
#ifdef KEY_HOME
/* Document-const: HOME
*
* Home key (upward+left arrow)
*/
rb_curses_define_const(KEY_HOME);
rb_define_const(mKey, "HOME", INT2NUM(KEY_HOME));
#endif
#ifdef KEY_BACKSPACE
/* Document-const: BACKSPACE
*
* Backspace
*/
rb_curses_define_const(KEY_BACKSPACE);
rb_define_const(mKey, "BACKSPACE", INT2NUM(KEY_BACKSPACE));
#endif
......
}
#endif
#ifdef KEY_DL
/* Document-const: DL
*
* Delete line
*/
rb_curses_define_const(KEY_DL);
rb_define_const(mKey, "DL", INT2NUM(KEY_DL));
#endif
#ifdef KEY_IL
/* Document-const: IL
*
* Insert line
*/
rb_curses_define_const(KEY_IL);
rb_define_const(mKey, "IL", INT2NUM(KEY_IL));
#endif
#ifdef KEY_DC
/* Document-const: DC
*
* Delete character
*/
rb_curses_define_const(KEY_DC);
rb_define_const(mKey, "DC", INT2NUM(KEY_DC));
#endif
#ifdef KEY_IC
/* Document-const: IC
*
* Insert char or enter insert mode
*/
rb_curses_define_const(KEY_IC);
rb_define_const(mKey, "IC", INT2NUM(KEY_IC));
#endif
#ifdef KEY_EIC
/* Document-const: EIC
*
* Enter insert char mode
*/
rb_curses_define_const(KEY_EIC);
rb_define_const(mKey, "EIC", INT2NUM(KEY_EIC));
#endif
#ifdef KEY_CLEAR
/* Document-const: CLEAR
*
* Clear Screen
*/
rb_curses_define_const(KEY_CLEAR);
rb_define_const(mKey, "CLEAR", INT2NUM(KEY_CLEAR));
#endif
#ifdef KEY_EOS
/* Document-const: EOS
*
* Clear to end of screen
*/
rb_curses_define_const(KEY_EOS);
rb_define_const(mKey, "EOS", INT2NUM(KEY_EOS));
#endif
#ifdef KEY_EOL
/* Document-const: EOL
*
* Clear to end of line
*/
rb_curses_define_const(KEY_EOL);
rb_define_const(mKey, "EOL", INT2NUM(KEY_EOL));
#endif
#ifdef KEY_SF
/* Document-const: SF
*
* Scroll 1 line forward
*/
rb_curses_define_const(KEY_SF);
rb_define_const(mKey, "SF", INT2NUM(KEY_SF));
#endif
#ifdef KEY_SR
/* Document-const: SR
*
* Scroll 1 line backware (reverse)
*/
rb_curses_define_const(KEY_SR);
rb_define_const(mKey, "SR", INT2NUM(KEY_SR));
#endif
#ifdef KEY_NPAGE
/* Document-const: NPAGE
*
* Next page
*/
rb_curses_define_const(KEY_NPAGE);
rb_define_const(mKey, "NPAGE", INT2NUM(KEY_NPAGE));
#endif
#ifdef KEY_PPAGE
/* Document-const: PPAGE
*
* Previous page
*/
rb_curses_define_const(KEY_PPAGE);
rb_define_const(mKey, "PPAGE", INT2NUM(KEY_PPAGE));
#endif
#ifdef KEY_STAB
/* Document-const: STAB
*
* Set tab
... This diff was truncated because it exceeds the maximum size that can be displayed.
    (1-1/1)