Example #1
0
 function _createMenuSubWindow(&$win, $parent_height, $parent_width, $para_offset_y)
 {
     // auto-detect window width based on menu contents
     if ($this->mode == "checklist") {
         $menu_width = 1 + 4 + $this->menu_label_width + 2 + $this->menu_desc_width + 1;
     } else {
         $menu_width = 1 + $this->menu_label_width + 2 + $this->menu_desc_width + 1;
     }
     // Draw borders
     $cord['y'] = 1 + $para_offset_y;
     $cord['x'] = round(($parent_width - $menu_width) / 2);
     //$cord = $this->_getCoordinates($parent_height,$menu_width,"center","middle");
     $y = $this->menu_total + 2;
     $x = $menu_width;
     $this->_drawThinBorders($win, $cord['y'], $cord['x'], $y, $x);
     // draw window inside borders
     $cord = $this->_getCoordinates($parent_height, $menu_width, "center", "middle");
     $swin = ncurses_newwin($y - 2, $x - 2, $cord['y'] + $para_offset_y + 2, $cord['x'] + 1);
     // fill window
     ncurses_wcolor_set($swin, 2);
     for ($row = 0; $row < $y - 2; $row++) {
         ncurses_wmove($swin, $row, 0);
         ncurses_whline($swin, 32, $x - 2);
     }
     return $swin;
 }
Example #2
0
 /**
  * Displays specified input text box
  * @param $index
  */
 protected function drawInputBox($index)
 {
     $label_offset = 0;
     $win =& $this->inputBoxList[$index]['win'];
     $label =& $this->inputBoxList[$index]['label'];
     $hotkey =& $this->inputBoxList[$index]['hot'];
     $cord_y =& $this->inputBoxList[$index]['y'];
     $cord_x =& $this->inputBoxList[$index]['x'];
     $max_length =& $this->inputBoxList[$index]['max_length'];
     ncurses_wcolor_set($win, 2);
     // draws the label
     if ($label != "") {
         ncurses_mvwaddstr($win, $cord_y, $cord_x, $label);
         $label_offset = strlen($label);
         // overide offset due to label length
     }
     // draws border for input field
     //$this->_drawThinBorders($win,$cord_y-1,($cord_x+$label_offset),3,$max_length+2,"out");
     //ncurses_wmove ( $win, $y+$height-1, $x+1 );
     // draws input box contents
     $this->drawInputBoxContents($index);
     // draws bottom border
     ncurses_wcolor_set($win, 2);
     ncurses_wmove($win, $cord_y + 1, $cord_x + $label_offset + 1);
     ncurses_whline($win, 175, 20);
     // bottom line
 }
Example #3
0
 /**
  * Displays and creates a sub-window to contain the Menu Items
  * @param $win
  * @param $parentHeight
  * @param $parentWidth
  * @param $paraOffsetY
  * @param int $border
  * @return resource - ID of the sub-window
  */
 protected function createMenuSubWindow(&$win, $parentHeight, $parentWidth, $paraOffsetY, $border = 0)
 {
     // auto-detect window width based on menu contents
     if ($this instanceof NcursesChecklist) {
         $menuWidth = 1 + 4 + $this->menuLabelWidth + 2 + $this->menuDescWidth + 1;
     } else {
         $menuWidth = 1 + $this->menuLabelWidth + 2 + $this->menuDescWidth + 1;
     }
     // Draw borders
     $cord['y'] = 1 + $paraOffsetY;
     $cord['x'] = round(($parentWidth - $menuWidth) / 2);
     //$cord = $this->getCoordinates($parent_height,$menu_width,"center","middle");
     $y = $this->menuTotal + 2;
     $x = $menuWidth;
     if ($border != 0) {
         $this->drawThinBorders($win, $cord['y'], $cord['x'], $y, $x);
     }
     // draw window inside borders
     $cord = $this->getCoordinates($parentHeight, $menuWidth, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
     $swin = ncurses_newwin($y - 2, $x - 2, $cord['y'] + $paraOffsetY + 2, $cord['x'] + 1);
     // fill window
     ncurses_wcolor_set($swin, 2);
     for ($row = 0; $row < $y - 2; $row++) {
         ncurses_wmove($swin, $row, 0);
         ncurses_whline($swin, 32, $x - 2);
     }
     return $swin;
 }