<commit_before><?php

/*
 * This file is part of the 'org.octris.ncurses' package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace org\octris\ncurses\component {
    /**
     * Windows component.
     *
     * @octdoc      c:component/window
     * @copyright   copyright (c) 2013 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class window extends \org\octris\ncurses\container
    /**/
    {
        /**
         * Whether window has a border.
         *
         * @octdoc  p:window/$has_border
         * @var     bool
         */
        protected $has_border = true;
        /**/

        /**
         * Width of window.
         * 
         * @octdoc  p:window/$width
         * @var     int
         */
        protected $width;
        /**/

        /**
         * Height of window.
         * 
         * @octdoc  p:window/$height
         * @var     int
         */
        protected $height;
        /**/

        /**
         * X position of window.
         * 
         * @octdoc  p:window/$x
         * @var     int
         */
        protected $x;
        /**/

        /**
         * Y position of window.
         * 
         * @octdoc  p:window/$y
         * @var     int
         */
        protected $y;
        /**/

        /**
         * Constructor.
         *
         * @octdoc  m:window/__construct
         * @param   int             $width          Optional width of window (default: 0).
         * @param   int             $height         Optional height of window (default: 0).
         * @param   int             $x              Optional x position of window (default: 0).
         * @param   int             $y              Optional y position of window (default: 0).
         */
        public function __construct($width = 0, $height = 0, $x = 0, $y = 0)
        /**/
        {
            $this->width  = $width;
            $this->height = $height;
            $this->x      = $x;
            $this->y      = $y;
        }
        
        /**
         * Build window.
         *
         * @octdoc  m:window/build
         */
        public function build()
        /**/
        {
            $this->resource = ncurses_newwin($this->height, $this->width, $this->y, $this->x);

            if ($this->has_border) {
                ncurses_wborder($this->resource, 0, 0, 0, 0, 0, 0, 0, 0);
            }
            
            parent::build();
        }
    }
}<commit_msg>added functionality for showing/hiding window<commit_after><?php

/*
 * This file is part of the 'org.octris.ncurses' package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace org\octris\ncurses\component {
    /**
     * Windows component.
     *
     * @octdoc      c:component/window
     * @copyright   copyright (c) 2013 by <NAME>
     * @author      <NAME> <<EMAIL>>
     */
    class window extends \org\octris\ncurses\container
    /**/
    {
        /**
         * Panel instance the window is assigned to.
         *
         * @octdoc  p:window/$panel
         * @var     \org\octris\ncurses\panel
         */
        private $panel;
        /**/

        /**
         * Whether window has a border.
         *
         * @octdoc  p:window/$has_border
         * @var     bool
         */
        protected $has_border = true;
        /**/

        /**
         * Whether window has been build.
         *
         * @octdoc  p:window/$is_build
         * @var     bool
         */
        protected $is_build = false;
        /**/

        /**
         * Width of window.
         * 
         * @octdoc  p:window/$width
         * @var     int
         */
        protected $width;
        /**/

        /**
         * Height of window.
         * 
         * @octdoc  p:window/$height
         * @var     int
         */
        protected $height;
        /**/

        /**
         * X position of window.
         * 
         * @octdoc  p:window/$x
         * @var     int
         */
        protected $x;
        /**/

        /**
         * Y position of window.
         * 
         * @octdoc  p:window/$y
         * @var     int
         */
        protected $y;
        /**/

        /**
         * Constructor.
         *
         * @octdoc  m:window/__construct
         * @param   int             $width          Optional width of window (default: 0).
         * @param   int             $height         Optional height of window (default: 0).
         * @param   int             $x              Optional x position of window (default: 0).
         * @param   int             $y              Optional y position of window (default: 0).
         */
        public function __construct($width = 0, $height = 0, $x = 0, $y = 0)
        /**/
        {
            $this->width  = $width;
            $this->height = $height;
            $this->x      = $x;
            $this->y      = $y;
        }
        
        /**
         * Destructor.
         *
         * @octdoc  m:window/__destruct
         */
        public function __destruct()
        /**/
        {
            unset($this->panel);

            ncurses_delwin($this->resource);
        }

        /**
         * Return whether window is visible.
         *
         * @octdoc  m:window/isVisible
         * @return  bool                                Returns whether window is visible.
         */
        public function isVisible()
        /**/
        {
            return $this->panel->isVisible();
        }

        /**
         * Build window.
         *
         * @octdoc  m:window/build
         */
        public function build()
        /**/
        {
            $this->resource = ncurses_newwin($this->height, $this->width, $this->y, $this->x);

            if ($this->has_border) {
                ncurses_wborder($this->resource, 0, 0, 0, 0, 0, 0, 0, 0);
            }
            
            parent::build();

            $this->panel = new \org\octris\ncurses\panel($this);

            $this->is_build = true;
        }

        /**
         * Show window.
         *
         * @octdoc  m:window/show
         */
        public function show()
        /**/
        {
            if (!$this->is_build) $this->build();

            $this->panel->show();
        }

        /**
         * Hide window.
         *
         * @octdoc  m:window/hide
         */
        public function hide()
        /**/
        {
            $this->panel->hide();
        }
    }
}
{'fraction_non_alphanumeric': 0.12827461607949414, 'fraction_numerical': 0.006022282445046673, 'mean_word_length': 1.0427429274292743, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '904124', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1867, 'n_words': 446}