• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ncurses_newwin函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ncurses_newwin函数的典型用法代码示例。如果您正苦于以下问题:PHP ncurses_newwin函数的具体用法?PHP ncurses_newwin怎么用?PHP ncurses_newwin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ncurses_newwin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Initiate our NCurses panels.
  */
 private function init()
 {
     // Get Sizes
     $top = $right = $bottom = $left = 0;
     ncurses_getmaxyx(STDSCR, $bottom, $right);
     $this->lastBottom = $bottom;
     $this->lastRight = $right;
     // Panel Layouts
     $traceWidth = min($right / 2, 55);
     $traceHeight = $bottom;
     $debugWidth = $right - $traceWidth;
     $debugHeight = 8;
     $inputWidth = $debugWidth;
     $inputHeight = 3;
     $outputWidth = $debugWidth;
     $outputHeight = $bottom - $debugHeight - $inputHeight;
     $this->panels['trace'] = ncurses_newwin($traceHeight, $traceWidth, $top, $right - $traceWidth);
     ncurses_wborder($this->panels['trace'], 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_mvwaddstr($this->panels['trace'], 0, 2, "[ Logging ]");
     ncurses_wmove($this->panels['trace'], 2, 2);
     $this->panels['debug'] = ncurses_newwin($debugHeight, $debugWidth, $bottom - $debugHeight, $left);
     $this->panels['input'] = ncurses_newwin($inputHeight, $inputWidth, $bottom - $debugHeight - $inputHeight, $left);
     $this->panels['output'] = ncurses_newwin($outputHeight, $outputWidth, $top, $left);
     ncurses_wborder($this->panels['output'], 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_mvwaddstr($this->panels['output'], 0, 2, "[ Output ]");
     ncurses_wmove($this->panels['output'], 2, 2);
     ncurses_curs_set(0);
     ncurses_cbreak();
     ncurses_noecho();
     $this->redrawAll();
 }
开发者ID:ShaneMcC,项目名称:synacor-challenge,代码行数:34,代码来源:VMOutput_ncurses.php


示例2: __construct

 /**
  * Create window
  *
  * @param int $rows
  * @param int $cols
  * @param int $y
  * @param int $x
  * @return void
  */
 public function __construct($rows = 0, $cols = 0, $y = 0, $x = 0)
 {
     $this->window = ncurses_newwin($rows, $cols, $y, $x);
     $this->cols = $this->getMaxX();
     $this->rows = $this->getMaxY();
     $this->x = $x;
     $this->y = $y;
     $this->maxLines = $this->getMaxY() - $y - 2;
 }
开发者ID:ck99,项目名称:kurses,代码行数:18,代码来源:Window.php


示例3: __construct

 public function __construct()
 {
     parent::__construct();
     $this->setFormatter(new OutputFormatter());
     ncurses_init();
     //ncurses_mvaddstr(55,1,"My first ncurses application");
     $this->window = ncurses_newwin(40, 30, 0, 0);
     ncurses_wborder($this->window, 0, 0, 0, 0, 0, 0, 0, 0);
 }
开发者ID:jean-pasqualini,项目名称:ia,代码行数:9,代码来源:NCursesOutput.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: getWindow

 public function getWindow()
 {
     if (!$this->window) {
         $this->window = ncurses_newwin(0, 0, 0, 0);
         ncurses_getmaxyx($this->window, $y, $x);
         $this->rows = $y;
         $this->cols = $x;
     }
     return $this->window;
 }
开发者ID:ck99,项目名称:kurses,代码行数:10,代码来源:Screen.php


示例6: __construct

 public function __construct($prompt)
 {
     ncurses_init();
     // Create a full-screen window
     $this->window = ncurses_newwin(0, 0, 0, 0);
     $this->prompt = $prompt;
     // Disable echoing the characters without our control
     ncurses_noecho();
     $this->drawPrompt();
 }
开发者ID:swos-,项目名称:ncurses,代码行数:10,代码来源:example2.php


示例7: __construct

 /**
  * Create a window
  *
  * @param int $columns
  * @param int $rows
  * @param int $x
  * @param int $y
  */
 public function __construct($columns = 0, $rows = 0, $x = 0, $y = 0)
 {
     $this->x = $x;
     $this->y = $y;
     $this->windowResource = ncurses_newwin($rows, $columns, $y, $x);
     if ($rows == 0 || $columns == 0) {
         $this->getSize($columns, $rows);
     }
     $this->columns = $columns;
     $this->rows = $rows;
 }
开发者ID:wapmorgan,项目名称:ncursesobjects,代码行数:19,代码来源:Window.php


示例8: __construct

 /**
  *
  */
 function __construct($x, $y, $w, $h, $title, $text)
 {
     $this->_x = $x;
     $this->_y = $y;
     $this->_w = $w;
     $this->_h = $h;
     $this->_title = $title;
     $this->_text = $text;
     $this->_wh = ncurses_newwin($this->_h, $this->_w, $this->_y, $this->_x);
     Console::debug("Created window with handle %xd", $this->_wh);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:14,代码来源:dialog.php


示例9: __construct

 public function __construct($rows, $cols, $x, $y)
 {
     if (!static::$init) {
         static::$nCurse = ncurses_init();
         ncurses_refresh();
     }
     static::$nCount++;
     $this->resource = ncurses_newwin($rows, $cols, $x, $y);
     $this->reset();
     ncurses_wborder($this->resource, 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_wrefresh($this->resource);
 }
开发者ID:EsterniTY,项目名称:dfl860e-logger,代码行数:12,代码来源:ncurse.php


示例10: __construct

 /**
  *
  */
 function __construct()
 {
     ncurses_init();
     if (ncurses_has_colors()) {
         ncurses_start_color();
         ncurses_init_pair(NCC_FRAME, NCURSES_COLOR_BLACK, NCURSES_COLOR_BLUE);
         ncurses_init_pair(NCC_TEXT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
         ncurses_init_pair(NCC_TITLE, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
         ncurses_init_pair(NCC_MORE, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
         ncurses_curs_set(0);
     }
     $this->workspace = ncurses_newwin(0, 0, 0, 0);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:16,代码来源:application.php


示例11: onCreate

 public function onCreate()
 {
     list($w, $h) = $this->onMeasure();
     $ctx = Context::getInstance();
     list($dw, $dh) = $ctx->getDimensions();
     \debug("Dialog::onCreate() measured to %dx%d", $w, $h);
     \debug("Dialog::onCreate() display size is %dx%d", $dw, $h);
     $this->setPosition(($dw - $w) / 2, ($dh - $h) / 2);
     $this->setSize($w, $h);
     list($x, $y) = $this->getPosition();
     list($w, $h) = $this->getSize();
     $this->window = \ncurses_newwin($h, $w, $y, $x);
     parent::onCreate();
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:14,代码来源:dialog.php


示例12: wnd

 protected function wnd($renew = false)
 {
     if ($renew) {
         if ($this->window) {
             ncurses_delwin($this->window);
         }
         $this->window = null;
     }
     if (!$this->window) {
         $this->window = ncurses_newwin($this->height, $this->width, $this->top, $this->left);
         \Cherry\debug('New window: %dx%d+%d+%d', $this->left, $this->top, $this->width, $this->height);
     }
     return $this->window;
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:14,代码来源:widget.php


示例13: init

 public function init($title = 'AcePHProxy')
 {
     // начинаем с инициализации библиотеки
     $ncurse = ncurses_init();
     // используем весь экран
     $this->windows['main'] = ncurses_newwin(0, 0, 0, 0);
     // рисуем рамку вокруг окна
     ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_getmaxyx($this->windows['main'], $y, $x);
     // save current main window size
     $this->cur_x = $x;
     $this->cur_y = $y;
     // создаём второе окно для лога
     $rows = floor($y / 2);
     $cols = $x;
     $sy = $y - $rows;
     $sx = 0;
     $this->windows['log'] = ncurses_newwin($rows, $cols, $sy, $sx);
     // и окно для статистики (остальное пространство)
     $rows = $y - $rows - 1;
     $cols = $x;
     $sy = 1;
     $sx = 0;
     // еще -1 чтобы границы не перекрывались
     $this->windows['stat'] = ncurses_newwin($rows, $cols, $sy, $sx);
     if (ncurses_has_colors()) {
         ncurses_start_color();
         // colors http://php.net/manual/en/ncurses.colorconsts.php
         ncurses_init_pair(self::CLR_ERROR, NCURSES_COLOR_RED, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_GREEN, NCURSES_COLOR_GREEN, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_YELLOW, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_SPEC1, NCURSES_COLOR_RED, NCURSES_COLOR_WHITE);
         ncurses_init_pair(5, NCURSES_COLOR_MAGENTA, NCURSES_COLOR_BLACK);
         ncurses_init_pair(6, NCURSES_COLOR_CYAN, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_DEFAULT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLACK);
         $this->log('Init colors', self::CLR_GREEN);
     }
     // рамка для него
     ncurses_wborder($this->windows['log'], 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_wborder($this->windows['stat'], 0, 0, 0, 0, 0, 0, 0, 0);
     $this->outputTitle($title);
     ncurses_nl();
     ncurses_curs_set(0);
     // visibility
     ncurses_refresh();
     // рисуем окна
     // обновляем маленькое окно для вывода строки
     ncurses_wrefresh($this->windows['log']);
 }
开发者ID:svgorbunov,项目名称:AcePHProxy,代码行数:49,代码来源:class.ncurses_ui.php


示例14: __construct

 public function __construct()
 {
     $this->nc = ncurses_init();
     if (!ncurses_has_colors()) {
         $this->onTerminate();
         echo "No color support.\n";
     }
     ncurses_start_color();
     $this->screen = ncurses_newwin(0, 0, 0, 0);
     $this->setCursorVisible(false);
     assert($this->screen);
     ncurses_init_pair(Widget\Widget::COLOR_DIALOGBG, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
     ncurses_init_pair(Widget\Widget::COLOR_DIALOGTEXT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
     ncurses_refresh();
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:15,代码来源:context.php


示例15: __construct

 public function __construct()
 {
     $ncurse = ncurses_init();
     $this->fullscreen = ncurses_newwin(0, 0, 0, 0);
     ncurses_noecho();
     ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
     $this->small = ncurses_newwin(10, 30, 7, 25);
     ncurses_wborder($this->small, 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_refresh();
     ncurses_attron(NCURSES_A_REVERSE);
     ncurses_mvaddstr(0, 10, "---Sample Title---");
     ncurses_attroff(NCURSES_A_REVERSE);
     ncurses_mvwaddstr($this->small, 5, 5, "Initial screen");
     ncurses_wrefresh($this->small);
 }
开发者ID:swos-,项目名称:ncurses,代码行数:15,代码来源:Ncurses.php


示例16: __construct

 /**
  * Constructor accepts the placement (x, y, width and height), the title,
  * the available options, and the currently selected index.
  *
  * @param int $x The topmost row
  * @param int $y The leftmost column
  * @param int $w The width
  * @param int $h The height
  * @param string $title The title
  * @param array $items The available options
  * @param int $selected The currently selected index
  */
 function __construct($x, $y, $w, $h, $title, array $items, $selected = 0)
 {
     $this->_x = $x;
     $this->_y = $y;
     $this->_w = $w;
     $this->_h = $h;
     $this->_title = $title;
     $this->_items = $items;
     $this->_itemsidx = array_values($items);
     $this->_selected = $selected;
     $this->_scroll = 0;
     // TODO: Calculate from height and selected
     $this->_wh = ncurses_newwin($this->_h, $this->_w, $this->_y, $this->_x);
     ncurses_werase($this->_wh);
     Console::debug("Created window with handle %xd", $this->_wh);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:28,代码来源:menu.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: 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


示例19: dialog

function dialog($params)
{
    ###############################################################################################
    if (empty($params) || !is_array($params)) {
        trigger_error('params must be non-empty array');
        return NULL;
    }
    $message = isset($params['message']) ? $params['message'] : '';
    $buttons = !empty($params['buttons']) && is_array($params['buttons']) ? $params['buttons'] : array('OK');
    $n_buttons = count($buttons);
    for ($i = 0; $i < $n_buttons; $i++) {
        $buttons[$i] = ' ' . $buttons[$i] . ' ';
    }
    $parent_rows = isset($params['rows']) && $params['rows'] > 0 ? (int) $params['rows'] : 25;
    $parent_cols = isset($params['cols']) && $params['cols'] > 0 ? (int) $params['cols'] : 80;
    if (empty($message) || empty($buttons) || $parent_rows <= 0 || $parent_cols <= 0) {
        trigger_error('wrong params');
        return NULL;
    }
    $message_lines = split("\n", $message);
    $message_width = 0;
    $n_message_lines = count($message_lines);
    for ($i = 0; $i < $n_message_lines; $i++) {
        $message_width = max(strlen($message_lines[$i]), $message_width);
    }
    $buttons_delim = '  ';
    $buttons_delim_len = strlen($buttons_delim);
    $buttons_len = strlen(implode($buttons_delim, $buttons));
    $width = 4 + max($buttons_len + 2 * $buttons_delim_len, $message_width);
    $height = 4 + $n_message_lines;
    $dlg_y = $parent_rows > $height ? $parent_rows - $height >> 1 : 1;
    $dlg_x = $parent_cols > $width ? $parent_cols - $width >> 1 : 1;
    $window = ncurses_newwin($height, $width, $dlg_y, $dlg_x);
    if (empty($window)) {
        trigger_error('unable to create window');
        return NULL;
    }
    ncurses_wborder($window, 0, 0, 0, 0, 0, 0, 0, 0);
    $i_x = 0;
    $i_y = 0;
    for ($i = 0; $i < $n_message_lines; $i++) {
        $i_y = 1 + $i;
        $i_x = 1 + ($width - 2 - strlen($message_lines[$i]) >> 1);
        ncurses_mvwaddstr($window, $i_y, $i_x, rtrim($message_lines[$i]));
    }
    $buttons_data = array();
    $buttons_shift_x = 1 + ($width - 1 - $buttons_len >> 1);
    $buttons_shift_y = 2 + $n_message_lines;
    $i_title = '';
    $i_x = $buttons_shift_x;
    for ($i = 0; $i < $n_buttons; $i++) {
        $i_title = $buttons[$i];
        $buttons_data[] = array('x' => $i_x, 's' => $i_title);
        if (0 == $i) {
            ncurses_wattron($window, NCURSES_A_REVERSE);
        }
        ncurses_mvwaddstr($window, $buttons_shift_y, $i_x, $i_title);
        if (0 == $i) {
            ncurses_wattroff($window, NCURSES_A_REVERSE);
        }
        $i_x += strlen($i_title) + $buttons_delim_len;
    }
    ncurses_wrefresh($window);
    ncurses_keypad($window, TRUE);
    ncurses_curs_set(0);
    ncurses_noecho();
    $result = -1;
    $do_loop = 1;
    $move = 0;
    $current = 0;
    while ($do_loop) {
        $key = ncurses_wgetch($window);
        $move = 0;
        switch ($key) {
            case NCURSES_KEY_LEFT:
                if ($current > 0) {
                    $move = -1;
                }
                break;
            case NCURSES_KEY_RIGHT:
                if ($current < $n_buttons - 1) {
                    $move = 1;
                }
                break;
            case XCURSES_KEY_LF:
            case XCURSES_KEY_CR:
                $result = $current;
                $do_loop = 0;
                break;
            case XCURSES_KEY_ESC:
                $do_loop = 0;
                break;
        }
        if (0 == $do_loop) {
            ncurses_flushinp();
        } elseif ($move) {
            ncurses_mvwaddstr($window, $buttons_shift_y, $buttons_data[$current]['x'], $buttons_data[$current]['s']);
            $current += $move;
            ncurses_wattron($window, NCURSES_A_REVERSE);
            ncurses_mvwaddstr($window, $buttons_shift_y, $buttons_data[$current]['x'], $buttons_data[$current]['s']);
//.........这里部分代码省略.........
开发者ID:jean-pasqualini,项目名称:ia,代码行数:101,代码来源:dialog.php


示例20: street

street (Doug Linder)

Managing senior programmers is like
herding cats (Dave Platt)
EOT;
$lines = explode("\n", $quotes);
$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;
开发者ID:jean-pasqualini,项目名称:ia,代码行数:31,代码来源:panel.php



注:本文中的ncurses_newwin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ncurses_wborder函数代码示例发布时间:2022-05-15
下一篇:
PHP ncurses_mvwaddstr函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap