Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > cursesライブラリ > Curses::Windowクラス

class Curses::Window

クラスの継承リスト: Curses::Window < Object < Kernel < BasicObject

要約

特異メソッド

new(height, width, y, x) -> Curses::Window

画面の座標 (x,y) を左上端とし、幅 width 高さ height とする curses のトップレベルウィンドウを 作成し、それを表現する Curses::Window オブジェクトを 返します。

[PARAM] height:
ウィンドウの高さを指定します。
[PARAM] width:
ウィンドウの幅を指定します。
[PARAM] y:
ウィンドウの左上端の y 座標を指定します。
[PARAM] x:
ウィンドウの左上端の x 座標を指定します。

インスタンスメソッド

addstr(str) -> nil
self << str -> nil

ウィンドウのカーソル位置に文字列 str を上書きします。

[PARAM] str:
文字列を指定します。
addch(ch) -> nil

ウィンドウのカーソル位置に ch (1 バイト) を上書きします。

[PARAM] ch:
文字を 1 バイト指定します。
attroff(attrs) -> Integer | true

[TODO]

Turns off the named attributes +attrs+ without affecting any others.

[PARAM] attrs:

[SEE_ALSO] Curses::Window#attrset

attron(attrs) -> Integer | true

[TODO]

Turns off the named attributes +attrs+ without turning any other attributes on or off.

[PARAM] attrs:

[SEE_ALSO] Curses::Window#attrset

attrset(attrs)

[TODO]

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

[PARAM] attrs:
...
begx -> Integer

親ウィンドウの中でウィンドウの左上がある x 座標を返します。 始点は 0 です。

begy -> Integer

親ウィンドウの中でウィンドウの左上がある y 座標を返します。 始点は 0 です。

bkgd(ch) -> bool

[TODO]

Set the background of the current window and apply character Integer +ch+ to every character.

[PARAM] ch:
...

[SEE_ALSO] Curses.bkgd

bkgdset(ch) -> nil

[TODO]

Manipulate the background of the current window with character Integer +ch+

[PARAM] ch:
...

[SEE_ALSO] Curses.bkgdset

box(vertical_char, horizontal_char) -> nil

縦の線に vertical_char、横の線に horizontal_char を使いウィンドウに沿っ て箱を書きます。

線は普通にウィンドウ内に書かれるだけなので上書きしないよう注意してくだ さい。

[PARAM] vertical_char:
縦の線に使用する文字を指定します。
[PARAM] horizontal_char:
横の線に使用する文字を指定します。

例:

win = Curses::Window.new(5,5,5,5)
win.box(?|, ?-)
clear -> nil

ウィンドウの表示を消去します。 この操作は即座に実行されます。

close -> nil

ウィンドウを閉じ、メモリを開放します。 以降のこのウィンドウオブジェクトに対する操作は例外を発生します。

clrtoeol -> nil

カーソルの位置はそのままで、ウィンドウの内容をクリアします。

color_set(color) -> bool

[TODO]

Sets the current color of the given window to the foreground/background combination described by the Fixnum +color+.

[PARAM] color:
...
curx -> Integer

ウィンドウ内におけるカーソルの桁番号を返します。 一桁目が 0 です。

cury -> Integer

ウィンドウ内におけるカーソルの行番号を返します。 一行目が 0 です。

delch -> nil

ウィンドウのカーソル位置から 1 バイト消去します。

deleteln -> nil

ウィンドウの、カーソルがある行を消去します。

getbkgd -> Integer | nil

[TODO]

Returns an Integer (+ch+) for the character property in the current window.

getch -> Integer

ウィンドウへの入力から 1 バイト読みこみます。

getstr -> String

ウィンドウへの入力から一行読みこみます。

idlok(bf)

[TODO]

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.

[PARAM] bf:
...
inch -> Integer

ウィンドウのカーソル位置から 1 バイト読みとって返します。

insch(ch) -> nil

ウィンドウのカーソル位置に ch (1 バイト) を挿入します。

[PARAM] ch:
文字を 1 バイト指定します。
insertln -> nil

[TODO]

Inserts a line above the cursor, and the bottom line is lost

keypad(val) -> bool | nil
keypad=(val) -> bool | nil

[TODO]

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.

[PARAM] val:
...
maxx -> Integer

移動可能な最大の x 座標を返します。 表示可能なバイト数 + 1 です。

maxy -> Integer

移動可能な最大の y 座標を返します。 表示可能な行 + 1 です。

move(y, x) -> nil

ウィンドウを座標 (x, y) に移動します。

親ウィンドウからはみだす位置を指定すると無視されます。

nodelay(val)

[TODO]

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.

noutrefresh -> nil

[TODO]

Refreshes the windows and lines.

Curses::Window.noutrefresh allows multiple updates with more efficiency than Curses::Window.refresh alone.

refresh -> nil

ウィンドウの表示を更新します。

resize(lines, cols) -> bool | nil

[TODO]

Resize the current window to Fixnum +lines+ and Fixnum +cols+

[PARAM] lines:
[PARAM] cols:
scrl(num)

[TODO]

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.

[PARAM] num:
scroll -> bool

現在のウィンドウを一行スクロールします。

scrollok(bf) -> nil

[TODO]

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)

setpos(y, x) -> nil

ウィンドウ内の (x, y) にカーソルを移動します。

setscrreg(top, bottom) -> bool

[TODO]

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.

[PARAM] top:
...
[PARAM] bottom:
...
standend -> nil

強調書き込みを終了します。

standout -> nil

以後書き込む文字を強調表示します。

subwin(height, width, y, x) -> Curses::Window

画面の座標 (x,y) を左上端とし、幅 width 高さ height とするサブウィンドウを作成し、 それを表現する Curses::Window オブジェクトを返します。

[PARAM] height:
ウィンドウの高さを指定します。
[PARAM] width:
ウィンドウの幅を指定します。
[PARAM] y:
ウィンドウの左上端の y 座標を指定します。
[PARAM] x:
ウィンドウの左上端の x 座標を指定します。
timeout=(delay)

[TODO]

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.
[PARAM] delay:
...
class Curses::Window