当前位置: 首页>>代码示例>>PHP>>正文


PHP ncurses_wrefresh函数代码示例

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


在下文中一共展示了ncurses_wrefresh函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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