本文整理汇总了PHP中ncurses_mvwaddstr函数的典型用法代码示例。如果您正苦于以下问题:PHP ncurses_mvwaddstr函数的具体用法?PHP ncurses_mvwaddstr怎么用?PHP ncurses_mvwaddstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ncurses_mvwaddstr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: draw
public function draw()
{
$start = 3;
foreach ($this->tabs as $i => $tab) {
$attrs = NCURSES_A_UNDERLINE;
ncurses_wmove($this->window, 0, $start);
// ncurses_wvline($this->window, NCURSES_A_NORMAL, 1);
if ($i === $this->active) {
$attrs += NCURSES_A_REVERSE;
}
if ($tab->hasAlert()) {
ncurses_wcolor_set($this->window, 0);
}
if ($attrs) {
ncurses_wattron($this->window, $attrs);
}
$tabName = sprintf("[F%d] %s", $i + 1, $tab->name);
ncurses_mvwaddstr($this->window, 0, $start + 1, $tabName);
if ($attrs) {
ncurses_wattroff($this->window, $attrs);
}
// ncurses_wvline($this->window, NCURSES_A_NORMAL, 1);
$start += strlen($tabName) + 3;
if ($i === $this->active) {
$tab->draw();
ncurses_top_panel($tab->panel->panel);
}
}
}
开发者ID:ck99,项目名称:kurses,代码行数:29,代码来源:TabsManager.php
示例2: drawList
/**
* Draw list items
*
* @param null $current
*
* @internal param int $select
* @return void
*/
public function drawList($current = null)
{
$current = $this->current;
// Current more than last visible item
if ($current > $this->firstPos + $this->getMaxY() && count($this->items) > $current) {
$this->firstPos = $current;
}
if ($this->getMaxY() > count($this->items)) {
$lastPos = count($this->items);
} else {
$lastPos = $this->firstPos + $this->getMaxY();
}
for ($i = $this->firstPos; $i < $lastPos; $i++) {
$attrs = 0;
$item = $this->items[$i];
if ($i === $current) {
$attrs += NCURSES_A_REVERSE;
}
if (isset($item['bold']) && $item['bold']) {
$attrs += NCURSES_A_BOLD;
}
if ($attrs) {
ncurses_wattron($this->getWindow(), $attrs);
}
$title = str_pad($item['title'], $this->getMaxX() - 2, ' ');
ncurses_mvwaddstr($this->getWindow(), $i + 1, 1, $title);
if ($attrs) {
ncurses_wattroff($this->getWindow(), $attrs);
}
}
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:39,代码来源:Listbox.php
示例3: 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
示例4: 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
示例5: start
/**
* Construct
*/
public function start()
{
ncurses_keypad($this->getWindow(), true);
ncurses_noecho();
$this->setBorder();
ncurses_wattron($this->getWindow(), NCURSES_A_BOLD);
ncurses_mvwaddstr($this->getWindow(), 0, 1, $this->title);
ncurses_wattroff($this->getWindow(), NCURSES_A_BOLD);
ncurses_mvwaddstr($this->getWindow(), 2, 2, $this->text);
$this->processing();
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:14,代码来源:Message.php
示例6: println
public function println($text)
{
if (is_array($text)) {
foreach ($text as $row) {
$this->println($row);
}
} elseif (is_string($text) || is_numeric($text)) {
ncurses_mvwaddstr($this->resource, $this->y, 1, $text);
$this->y++;
$this->maxX = max($this->maxX, strlen($text));
}
}
开发者ID:EsterniTY,项目名称:dfl860e-logger,代码行数:12,代码来源:ncurse.php
示例7: draw
public function draw()
{
ncurses_color_set(1);
ncurses_mvwaddstr($this->wnd(), 0, 0, str_repeat(" ", $this->width));
// Measure items
$fullwidth = $this->width;
$numauto = 0;
$alloc = 0;
foreach ($this->items as $key => $item) {
$item->item->update();
$itemwidth = $item->item->measure();
if ($item->width == self::SBR_WIDTH_AUTO) {
$numauto++;
} elseif ($item->width == self::SBR_WIDTH_EXPAND) {
$alloc += $itemwidth;
} else {
$alloc += $item->width;
}
}
// Count in the separator bars
$alloc += (count($this->items) - 1) * 3;
// With the items measured, hand out the auto space
if ($numauto > 0) {
$autowidth = floor(($fullwidth - $alloc) / $numauto);
}
// Now draw it all
$cptr = 1;
$idx = 0;
foreach ($this->items as $key => $item) {
if ($item->width == self::SBR_WIDTH_AUTO) {
$itemwidth = $autowidth;
} elseif ($item->width == self::SBR_WIDTH_EXPAND) {
$itemwidth = $item->measure();
} else {
$itemwidth = $item->width;
}
$cstr = substr($item->item->value, 0, $itemwidth);
ncurses_color_set(1);
ncurses_mvwaddstr($this->wnd(), 0, $cptr, $cstr);
$idx++;
$cptr += $itemwidth;
if ($idx != count($this->items)) {
ncurses_color_set(2);
ncurses_mvwaddstr($this->wnd(), 0, $cptr, ' | ');
}
$cptr += 3;
}
ncurses_color_set(0);
}
开发者ID:noccy80,项目名称:cherryphp,代码行数:49,代码来源:statusbar.php
示例8: beforeRefresh
public function beforeRefresh()
{
$notices = [];
foreach ($this->statusBarNotices as $notifier) {
if ($notifier instanceof StatusBarMessage) {
$notices[] = $notifier->getStatusMessage();
} elseif (is_callable($notifier)) {
$notices[] = call_user_func($notifier);
}
}
$noticeBar = implode(', ', $notices);
ncurses_mvwaddstr($this->window, $this->rows - 1, 2, str_repeat(' ', $this->cols));
ncurses_mvwaddstr($this->window, $this->rows - 1, 2, $noticeBar);
$this->manager->draw();
}
开发者ID:ck99,项目名称:kurses,代码行数:15,代码来源:Screen.php
示例9: 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
示例10: 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
示例11: count
$n_lines = count($lines);
$window_width = 0;
for ($i = 0; $i < $n_lines; $i++) {
$window_width = max($window_width, strlen($lines[$i]));
}
$window_width += 4;
$x_coords = array(10, 14, 18);
$y_coords = array(10, 12, 8);
for ($i = 0; $i < 3; $i++) {
$windows[$i] = ncurses_newwin(4 + $n_lines, $window_width, $y_coords[$i], $x_coords[$i]);
ncurses_wborder($windows[$i], 0, 0, 0, 0, 0, 0, 0, 0);
ncurses_wattron($windows[$i], NCURSES_A_REVERSE);
ncurses_mvwaddstr($windows[$i], 0, 2, ' window #' . $i . ' ');
ncurses_wattroff($windows[$i], NCURSES_A_REVERSE);
for ($j = 0; $j < $n_lines; $j++) {
ncurses_mvwaddstr($windows[$i], 2 + $j, 2, $lines[$j]);
}
ncurses_wrefresh($windows[$i]);
$panels[$i] = ncurses_new_panel($windows[$i]);
}
ncurses_update_panels();
ncurses_curs_set(0);
ncurses_noecho();
$i = 0;
$k = NULL;
while (XCURSES_KEY_ESC != $k) {
$k = ncurses_getch();
ncurses_top_panel($panels[$i % 3]);
ncurses_update_panels();
ncurses_doupdate();
$i++;
开发者ID:jean-pasqualini,项目名称:ia,代码行数:31,代码来源:panel.php
示例12: setuserinput
function setuserinput()
{
$sStatus = date("[H:i:s] ") . "[" . $this->aDisplayVars['nick'] . "] [Win: ";
ncurses_mvwaddstr($this->userinputw, 0, 0, $this->cl);
ncurses_mvwaddstr($this->userinputw, 0, 0, $sStatus);
/* Now we need to draw states for our various windows. */
$bShow = false;
$aInactive = array();
$aActive = array();
$iChans = 0;
// Draw a list of all windows. First, get two arrays of which are active and not.
foreach ($this->aBuffers as $iBuffer => $oBuffer) {
if ($oBuffer->active == true) {
$aActive[] = $iBuffer;
} else {
$aInactive[] = $iBuffer;
}
}
// Now generate out list. First of all, we want to draw only active windows. We also want them to stand out.
foreach ($aActive as $iActive) {
if ($bShow == false) {
ncurses_wcolor_set($this->userinputw, NC_PAIR_INPUT_ACTIVE);
ncurses_waddstr($this->userinputw, $iActive);
ncurses_wcolor_set($this->userinputw, NC_PAIR_INPUT);
$bShow = true;
} else {
ncurses_waddstr($this->userinputw, ",");
ncurses_wcolor_set($this->userinputw, NC_PAIR_INPUT_ACTIVE);
ncurses_waddstr($this->userinputw, $iActive);
ncurses_wcolor_set($this->userinputw, NC_PAIR_INPUT);
}
}
/*
* Now append inactive windows. We don't make these stand out of course.
*/
foreach ($aInactive as $iInactive) {
if ($bShow == false) {
ncurses_waddstr($this->userinputw, $iInactive);
$bShow = true;
} else {
ncurses_waddstr($this->userinputw, ",");
ncurses_waddstr($this->userinputw, $iInactive);
}
}
ncurses_waddstr($this->userinputw, "]");
ncurses_mvwaddstr($this->userinputw, 1, 0, $this->cl);
ncurses_mvwaddstr($this->userinputw, 1, 0, "[" . $this->aDisplayVars['window'] . "] " . $this->userinputt . '_');
ncurses_wrefresh($this->userinputw);
}
开发者ID:rburchell,项目名称:ircc,代码行数:49,代码来源:ncurse.class.php
示例13: drawInputBoxContents
/**
* Displays specified input text box value contents
* @param $index
*/
protected function drawInputBoxContents($index)
{
$win =& $this->inputBoxList[$index]['win'];
$val =& $this->inputBoxList[$index]['val'];
$cord_y =& $this->inputBoxList[$index]['y'];
$cord_x =& $this->inputBoxList[$index]['x'];
$label =& $this->inputBoxList[$index]['label'];
// label offset
$label_offset = 0;
if ($label !== '') {
$label_offset = strlen($label);
// overide offset due to label length
}
// output the value
for ($n = 0; $n < $this->inputBoxList[$index]['max_length']; $n++) {
// Set content color based on has focus or not.
if ($this->focusCat() === 'I' && $this->focusSubindex() == $index) {
if ($n == $this->inputBoxList[$index]['val_cursor']) {
//CURSOR COLOR - RED
ncurses_wcolor_set($win, 1);
} else {
ncurses_wcolor_set($win, 5);
}
} else {
ncurses_wcolor_set($win, 2);
}
// print chars that exist
if (isset($val[$n])) {
$char = $val[$n];
} else {
$char = ' ';
}
ncurses_mvwaddstr($win, $cord_y, $cord_x + $label_offset + 1 + $n, $char);
}
}
开发者ID:vsychov,项目名称:php_ncurses,代码行数:39,代码来源:NcursesInputBox.php
示例14: clear
public function clear()
{
for ($j = 0; $j < $this->rows; $j++) {
ncurses_mvwaddstr($this->window, $j, 0, str_repeat(' ', $this->cols));
}
}
开发者ID:ck99,项目名称:kurses,代码行数:6,代码来源:Window.php
示例15: setTitle
public function setTitle($title)
{
$this->title = $title;
ncurses_wattron($this->getWindow(), NCURSES_A_BOLD);
ncurses_mvwaddstr($this->getWindow(), 0, 2, ' ' . $title . ' ');
ncurses_wattroff($this->getWindow(), NCURSES_A_BOLD);
$this->setChanged(true);
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:8,代码来源:Window.php
示例16: 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
示例17: 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
示例18: _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
示例19: 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
示例20: 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
注:本文中的ncurses_mvwaddstr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论