本文整理汇总了PHP中ncurses_wrefresh函数的典型用法代码示例。如果您正苦于以下问题:PHP ncurses_wrefresh函数的具体用法?PHP ncurses_wrefresh怎么用?PHP ncurses_wrefresh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ncurses_wrefresh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
ncurses_init();
$this->initScreen();
if ((int) $this->width === 0 || (int) $this->height === 0) {
// auto-detect required height & width based on text
$this->width = $this->height = 0;
$text = str_replace("\n", "|", $this->text);
// decode any linebreaks
$lines = explode("|", $text);
foreach ($lines as $line) {
$len = strlen($line);
if ($len > $this->width) {
$this->width = $len;
}
$this->height++;
}
}
// open a dialog box window
$width = max([$this->width, $this->minWidth]);
$cord = $this->getCoordinates($this->height, $width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
$this->nwin = $this->createDialogWindow($cord['y'], $cord['x'], $this->height + 2, $width, true, 2);
$this->strokePara($this->nwin, $this->text, $this->height, $width, 'center', false);
ncurses_wrefresh($this->nwin);
}
开发者ID:vsychov,项目名称:php_ncurses,代码行数:25,代码来源:NcursesNotice.php
示例2: onDraw
public function onDraw()
{
if ($this->window) {
ncurses_wborder($this->window, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_mvwaddstr($this->window, 0, 3, "[ x ]");
ncurses_wrefresh($this->window);
}
parent::onDraw();
}
开发者ID:noccy80,项目名称:cherryphp,代码行数:9,代码来源:dialog.php
示例3: ncurses_show_screen
function ncurses_show_screen($showHelp)
{
// basic settings
ncurses_noecho();
ncurses_curs_set(0);
// set app title
$title = "Red Ventures Selenium Runner";
// commands to be listed in help
$commands = array('q' => 'quit', 'r' => 'run selected tests', 'space' => 'toggle test selection', 'enter' => 'run highlighted tests', 'up' => 'move up', 'down' => 'move down', 'pgUp' => 'scroll description up', 'pgDown' => 'scroll description down', '?/h' => 'show this help panel');
// create a fullscreen window
$fullscreen = ncurses_newwin(0, 0, 0, 0);
ncurses_getmaxyx($fullscreen, $max_y, $max_x);
// enter the main event loop
$do_loop = 1;
while ($do_loop) {
// calculate width of help window columns
$c = $t = 0;
foreach ($commands as $cmd => $txt) {
$c = strlen($cmd) > $c ? strlen($cmd) : $c;
$t = strlen($txt) > $t ? strlen($txt) : $t;
}
$h = count($commands);
// calculate the help windows height
if ($showHelp) {
if (!empty($helpWin)) {
ncurses_delwin($helpWin);
}
$helpWin = ncurses_newwin($h + 4, $c + $t + 5, ($max_y - $h - 4) / 2, ($max_x - $c - $t - 5) / 2);
ncurses_wborder($helpWin, 0, 0, 0, 0, 0, 0, 0, 0);
$i = 0;
foreach ($commands as $cmd => $txt) {
ncurses_mvwaddstr($helpWin, 2 + $i, 2, $cmd);
ncurses_mvwaddstr($helpWin, 2 + $i, 2 + $c + 1, $txt);
}
if (!empty($helpWin)) {
ncurses_wrefresh($helpWin);
} else {
ncurses_refresh();
}
}
if (empty($helpWin)) {
$key = ncurses_getch();
} else {
$key = ncurses_wgetch($helpWin);
}
switch ($key) {
case 27:
ncurses_flushinp();
$do_loop = 0;
break;
default:
$showHelp = $showHelp === true ? false : true;
ncurses_show_screen($showHelp);
}
}
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:56,代码来源:test.php
示例4: getWindowSize
public function getWindowSize()
{
static $stored = null;
// Get the window size only once
// We're avoiding problems with resizing windows
if ($stored == null) {
ncurses_wrefresh($this->window);
ncurses_getmaxyx($this->window, $y, $x);
$stored = array($x, $y);
}
return $stored;
}
开发者ID:swos-,项目名称:ncurses,代码行数:12,代码来源:example2.php
示例5: draw
/**
*
*/
function draw($workspace)
{
$wh = $this->_wh;
ncurses_wcolor_set($wh, NCC_FRAME);
ncurses_wborder($wh, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_wcolor_set($wh, NCC_TITLE);
ncurses_wattron($wh, NCURSES_A_BOLD);
$left = floor(($this->_w - 2) / 2 - (strlen($this->_title) + 2) / 2);
ncurses_mvwaddstr($wh, 0, $left, ' ' . $this->_title . ' ');
ncurses_wattroff($wh, NCURSES_A_BOLD);
ncurses_wcolor_set($wh, NCC_TEXT);
for ($n = 0; $n < $this->_h - 2; $n++) {
ncurses_mvwaddstr($wh, $n + 1, 1, str_repeat(" ", $this->_w - 2));
}
ncurses_wrefresh($wh);
ncurses_wcolor_set($wh, 0);
ncurses_move(-1, 1);
ncurses_refresh();
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:22,代码来源:dialog.php
示例6: display
/**
* @return bool
*/
public function display()
{
ncurses_init();
$this->initScreen();
//open a dialog box window
$cord = $this->getCoordinates($this->height, $this->width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
$win = $this->createDialogWindow($cord['y'], $cord['x'], $this->height, $this->width, true);
//output dialog text
$this->strokePara($win, $this->text, $this->height, $this->width, 'center', true);
//ok button
$this->configureButtons();
//wait for input
do {
$this->strokeAllButtons($win);
ncurses_wrefresh($win);
//get keyboard input
$status = $this->getButtonInput($win);
} while ($status === null);
return true;
}
开发者ID:vsychov,项目名称:php_ncurses,代码行数:23,代码来源:NcursesMsgbox.php
示例7: display
/**
* @return mixed
*/
public function display()
{
ncurses_init();
$this->initScreen();
// open a dialog box window
$cord = $this->getCoordinates($this->getHeight(), $this->getWidth(), self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
$mainWindow = $this->createDialogWindow($cord['y'], $cord['x'], $this->getHeight(), $this->getWidth(), true);
// output dialog text
$paraOffsetY = $this->strokePara($mainWindow, $this->getText(), $this->getHeight(), $this->getWidth(), 'center', true);
// Create menu sub-window
$menuSubWindow = $this->createMenuSubWindow($mainWindow, $this->getHeight(), $this->getWidth(), $paraOffsetY);
$this->configureButtons();
// wait for input
do {
$this->strokeAllButtons($mainWindow);
$this->strokeAllMenuItems($menuSubWindow);
ncurses_wrefresh($mainWindow);
ncurses_wrefresh($menuSubWindow);
//get keyboard input
$status = $this->getMenuInput($mainWindow);
} while ($status === null);
return $status;
}
开发者ID:vsychov,项目名称:php_ncurses,代码行数:26,代码来源:NcursesChecklist.php
示例8: parse
private function parse($char = '')
{
switch ($char) {
case ESCAPE_KEY:
ncurses_end();
exit;
break;
case ENTER:
$buffer = $this->getBuffer();
ncurses_mvaddstr(0, 1, $buffer);
ncurses_wclear($this->small);
ncurses_wborder($this->small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_mvwaddstr($this->small, 5, 5, $buffer);
ncurses_wrefresh($this->small);
break;
default:
$this->pushBuffer(chr($char));
ncurses_wclear($this->small);
ncurses_wborder($this->small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_mvwaddstr($this->small, 5, 5, chr($char));
ncurses_wrefresh($this->small);
break;
}
}
开发者ID:swos-,项目名称:ncurses,代码行数:24,代码来源:Ncurses.php
示例9: display
/**
* @return mixed
*/
public function display()
{
ncurses_init();
$this->initScreen();
// open a dialog box window
$cord = $this->getCoordinates($this->height, $this->width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
$win = $this->createDialogWindow($cord['y'], $cord['x'], $this->height, $this->width, true);
// output dialog text
$para_offset_y = $this->strokePara($win, $this->text, $this->height, $this->width, 'center', true);
// Create menu sub-window
$mwin = $this->createMenuSubWindow($win, $this->height, $this->width, $para_offset_y, $this->border);
// configure buttons
$this->configureButtons();
// wait for input
do {
$this->strokeAllButtons($win);
$this->strokeAllMenuItems($mwin);
ncurses_wrefresh($win);
ncurses_wrefresh($mwin);
//get keyboard input
$status = $this->getMenuInput($win);
} while ($status === null);
return $status;
}
开发者ID:vsychov,项目名称:php_ncurses,代码行数:27,代码来源:NcursesMenu.php
示例10: refresh
/**
* Refresh (redraw) window
*/
public function refresh()
{
if (!$this->getChanged()) {
return false;
} else {
$this->setChanged(false);
}
ncurses_wrefresh($this->getWindow());
foreach ($this->childs as $child) {
$child->refresh();
}
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:15,代码来源:Window.php
示例11: display
/**
* @return mixed
*/
public function display()
{
ncurses_init();
$this->initScreen();
// open a dialog box window
$cord = $this->getCoordinates($this->height, $this->width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
$win = $this->createDialogWindow($cord['y'], $cord['x'], $this->height, $this->width, true);
// Create menu sub-window
// Controls alignment of menu title
$para_offset_y = $this->strokePara($win, $this->text, $this->height, $this->width, 'center', true);
$cord_x = $this->inputIndentation;
//ORIGINAL CODE CENTERED INPUT FIELDS.
//$para_offset_y = $this->_stroke_para($win,$this->text,$this->height,$this->width,"center",true);
//$cord_x = round(($this->width/2) - ($this->length/2) );
foreach ($this->fields as $key => $val) {
$cord_y = $para_offset_y + $key * 2;
// output dialog text
$this->addInputBox($win, $this->fields[$key]['name'], $this->fields[$key]['label'], $cord_y, $cord_x, $this->fields[$key]['length'], $this->fields[$key]['value']);
}
// configure buttons
$this->configureButtons();
// wait for input
do {
$this->strokeAllButtons($win);
//THIS IS WHERE THE INPUT BOXES ARE POSITIONED
$this->strokeInputBoxes($win);
ncurses_wrefresh($win);
// get keyboard input
if ($this->focusCat() === 'B') {
$status = $this->getButtonInput($win);
} else {
$status = $this->getTextboxInput($win);
}
} while ($status === null);
if (isset($status['val'])) {
$status = $status['val'];
}
return $status;
}
开发者ID:vsychov,项目名称:php_ncurses,代码行数:42,代码来源:NcursesInputBox.php
示例12: gui
function gui()
{
// we begin by initializing ncurses
$ncurse = ncurses_init();
// let ncurses know we wish to use the whole screen
$fullscreen = ncurses_newwin(0, 0, 0, 0);
// draw a border around the whole thing.
ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
ncurses_attron(NCURSES_A_REVERSE);
ncurses_mvaddstr(0, 1, "AEMB2 SIMULATOR OUTPUT TRANSLATOR");
ncurses_attroff(NCURSES_A_REVERSE);
// now lets create a small window
$small = ncurses_newwin(10, 30, 2, 2);
// border our small window.
ncurses_wborder($small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_refresh();
// paint both windows
// move into the small window and write a string
ncurses_mvwaddstr($small, 5, 5, " Test String ");
// show our handiwork and refresh our small window
ncurses_wrefresh($small);
$pressed = ncurses_getch();
// wait for a user keypress
ncurses_end();
// clean up our screen
}
开发者ID:jiangxilong,项目名称:aemb,代码行数:26,代码来源:simulator.php
示例13: draw
/**
* Commit the buffer to the screen
*
* Also manages the border and refreshing the window
*/
public function draw($force = false)
{
if ($this->isDirty || $force) {
if ($this->isBordered) {
ncurses_wborder($this->window, 0, 0, 0, 0, 0, 0, 0, 0);
}
$this->bufferHeight();
$this->playBuffer();
ncurses_wrefresh($this->window);
}
}
开发者ID:zenexius,项目名称:Slacker,代码行数:16,代码来源:slacker.php
示例14: log
public function log($msg, $color = self::CLR_DEFAULT)
{
ncurses_getmaxyx($this->windows['log'], $y, $x);
ncurses_getyx($this->windows['log'], $cy, $cx);
// cursor xy
if ($cy > $y - 3) {
ncurses_werase($this->windows['log']);
ncurses_wborder($this->windows['log'], 0, 0, 0, 0, 0, 0, 0, 0);
$cy = 0;
}
$msg = mb_substr($msg, 0, $x - 2);
$color and ncurses_wcolor_set($this->windows['log'], $color);
ncurses_mvwaddstr($this->windows['log'], $cy + 1, 1, $msg);
ncurses_clrtoeol();
$color and ncurses_wcolor_set($this->windows['log'], self::CLR_DEFAULT);
// никак скроллить не выходит
#ncurses_insdelln (1);
#ncurses_scrl (-2); // вообще 0 реакции
#ncurses_insertln ();
ncurses_wrefresh($this->windows['log']);
}
开发者ID:svgorbunov,项目名称:AcePHProxy,代码行数:21,代码来源:class.ncurses_ui.php
示例15: _window_with_lines
public function _window_with_lines($name, $lines, $x = 5, $y = 5, $set_width = false)
{
// Need an array of lines.
$lines = (array) $lines;
// Ignore disabled liens
$lines = array_filter($lines);
// Do we not have a specific set width? Calculate the longest line
if (!is_numeric($set_width)) {
$longest_line = strlen($name) + 10;
foreach ($lines as $line) {
$length = strlen(implode('', $line));
$longest_line = $length > $longest_line ? $length : $longest_line;
}
$width = $longest_line + 4;
} else {
$width = $set_width;
}
// Calculate window hight
$height = 3 + count($lines);
// Create window
$win = ncurses_newwin($height, $width, $x, $y);
// This character will be the side borders
$side = ord('|');
// Do the borders of the window
ncurses_wborder($win, $side, $side, ord('-'), ord('-'), ord('/'), ord('\\'), ord('\\'), ord('/'));
// Add window title string
ncurses_mvwaddstr($win, 1, 1, $this->_charpad($name, $width, 'c', '='));
// Keep track of vertical position for each line
$v = 1;
// Go through and output each line, while incrementing line position counter
foreach ($lines as $line) {
ncurses_mvwaddstr($win, $v + 1, 1, $this->_charpad($line[0] . $this->_charpad($line[1], $width - strlen($line[0]), 'r', '.'), $width, 'n'));
$v++;
}
// Show it
ncurses_wrefresh($win);
// Store it so we can kill it later
$this->_windows[] =& $win;
// Return window dimensions
return array($width, $height);
}
开发者ID:impelling,项目名称:VegaDNS,代码行数:41,代码来源:class.out_ncurses.php
示例16: ncurses_show_text
function ncurses_show_text($title, $text, $question, $keys = TRUE)
{
// prepare text
$textH = count($text);
$textW = 1;
$textLEN = array();
for ($i = 0; $i < $textH; $i++) {
$textLEN[$i] = strlen($text[$i]);
if ($textLEN[$i] > $textW) {
$textW = $textLEN[$i];
}
}
// create text pad (invisible window)
$textWIN = ncurses_newpad($textH, $textW);
// fill it with text
for ($i = 0; $i < $textH; $i++) {
ncurses_mvwaddstr($textWIN, $i, 0, $text[$i]);
}
// prepare question
$questionH = count($question);
$questionLastW = strlen($question[$questionH - 1]);
// initialize...
$posX = $posY = 0;
$screenH = $screenW = 0;
// loop around...
while (1) {
// get actual screen size
$oldH = $screenH;
$oldW = $screenW;
ncurses_getmaxyx(STDSCR, $screenH, $screenW);
// something changed?
if ($screenH != $oldH || $screenW != $oldW) {
if ($oldH > 0) {
ncurses_delwin($upperWIN);
ncurses_delwin($lowerWIN);
}
ncurses_erase();
ncurses_refresh(STDSCR);
$upperWIN = ncurses_newwin($screenH - (2 + $questionH), $screenW, 0, 0);
$lowerWIN = ncurses_newwin(2 + $questionH, $screenW, $screenH - (2 + $questionH), 0);
$upperH = $screenH - (4 + $questionH);
$upperW = $screenW - 2;
$copyH = $upperH > $textH ? $textH : $upperH;
$copyW = $upperW > $textW ? $textW : $upperW;
// border lower window
ncurses_wborder($lowerWIN, 0, 0, 0, 0, 0, 0, 0, 0);
// print text in lower window
for ($i = 0; $i < $questionH; $i++) {
ncurses_mvwaddstr($lowerWIN, $i + 1, 1, $question[$i]);
}
}
// check and fix positions
if ($posY < 0 || $upperH >= $textH) {
$posY = 0;
} else {
if ($upperH + $posY > $textH) {
$posY = $textH - $upperH;
}
}
if ($posX < 0 || $upperW >= $textW) {
$posX = 0;
} else {
if ($upperW + $posX > $textW) {
$posX = $textW - $upperW;
}
}
// border upper window
ncurses_wborder($upperWIN, 0, 0, 0, 0, 0, 0, 0, 0);
// draw title and info line
ncurses_wattron($upperWIN, NCURSES_A_REVERSE);
ncurses_mvwaddstr($upperWIN, 0, 2, ' ' . $title . ' ');
if ($upperH < $textH) {
ncurses_mvwaddstr($upperWIN, $upperH + 1, 2, ' line ' . ($posY + 1) . '-' . ($posY + $copyH) . '/' . $textH . ' ');
}
ncurses_wattroff($upperWIN, NCURSES_A_REVERSE);
// draw < and > at left/right side when horizontal scrolling is nesseccary
if ($upperW < $textW) {
for ($i = 0; $i < $copyH; $i++) {
if ($textLEN[$i + $posY] > $copyW + $posX) {
ncurses_mvwaddstr($upperWIN, $i + 1, $screenW - 1, '>');
}
if ($posX > 0 && $textLEN[$i + $posY] > 0) {
ncurses_mvwaddstr($upperWIN, $i + 1, 0, '<');
}
}
}
// draw upper window
ncurses_wrefresh($upperWIN);
// copy a part of the text (pad) to the screen
ncurses_prefresh($textWIN, $posY, $posX, 1, 1, $upperH, $upperW);
// move cursor to end of last line of question
ncurses_wmove($lowerWIN, $questionH, $questionLastW + 1);
// draw lower window
ncurses_wrefresh($lowerWIN);
// get a character and do...
$char = ncurses_getch();
if (is_array($keys) && array_search($char, $keys) !== FALSE) {
break;
} else {
if ($char == NCURSES_KEY_UP) {
//.........这里部分代码省略.........
开发者ID:jean-pasqualini,项目名称:ia,代码行数:101,代码来源:example.php
示例17: define
<?php
/**
* nCurses Keys
*
* Show nCurses key code.
*
* @author Kenny Parnell <[email protected]>
* @date Tue 05 Aug 2008 09:08:07 PM EDT
*/
define('ESCAPE_KEY', 27);
ncurses_init();
$fullscreen = ncurses_newwin(0, 0, 0, 0);
ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
ncurses_getmaxyx($fullscreen, $y, $x);
$small = ncurses_newwin(5, 7, ($y - 5) / 2, ($x - 7) / 2);
ncurses_wborder($small, 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_refresh();
ncurses_mvwaddstr($small, 5, 2, "12");
ncurses_wrefresh($small);
do {
$k = ncurses_wgetch($small);
if ($k == ESCAPE_KEY) {
ncurses_end();
exit;
} else {
echo $k;
}
} while (1);
/* vim:set ft=php ts=4 sw=4 et */
开发者ID:jean-pasqualini,项目名称:ia,代码行数:30,代码来源:keys.php
示例18: refreshAll
/**
* Refresh All Panels.
*/
public function refreshAll()
{
foreach ($this->panels as $p) {
ncurses_wrefresh($p);
}
ncurses_refresh();
}
开发者ID:ShaneMcC,项目名称:synacor-challenge,代码行数:10,代码来源:VMOutput_ncurses.php
示例19: finish
/**
* reset internal state, and send a new line so that the progress bar text is "finished"
*
* @static
* @return string, a new line
*/
public static function finish()
{
self::reset();
if (self::$window) {
ncurses_mvwaddstr(self::$window, 1, 2, "\n");
ncurses_refresh();
ncurses_wrefresh(self::$window);
}
return "\n";
}
开发者ID:guaykuru,项目名称:pawtucket,代码行数:16,代码来源:CLIProgressBar.php
示例20: switch
$buffer .= $buf;
}
if ($buffer != "") {
switch ($buffer) {
case ' ':
case '[[21~':
ncurses_end();
exit;
default:
ncurses_mvwaddstr($full, 2, 2, str_repeat(' ', 20));
ncurses_mvwaddstr($full, 2, 2, "{$buffer}: " . strlen($buffer));
}
$buffer = '';
}
ncurses_mvwaddstr($full, 4, 4, microtime(true));
ncurses_wrefresh($full);
usleep(1);
}
exit;
declare (ticks=1);
pcntl_signal(SIGINT, function () {
echo "Caught SIGINT\n";
exit;
});
register_shutdown_function(function () {
echo 'I\'m a shutdown function :-)' . PHP_EOL;
});
class A
{
public function __destruct()
{
开发者ID:EsterniTY,项目名称:dfl860e-logger,代码行数:31,代码来源:tests.php
注:本文中的ncurses_wrefresh函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论