scanner/ncurses/example.php

28 lines
844 B
PHP
Raw Normal View History

<?php
require_once( 'ncurses.php' );
class MyApp extends NcApp {
function run() {
$nc_main = new NcWindow( $this, 0, 0, 0, 0 );
$nc_main->title( 'Hello There' );
$nc_main->write( 0, 0, file_get_contents( __FILE__ ) );
$nc_main->get_char();
$nc_small = new NcWindow( $nc_main, 10, 60, 5, 20 );
$nc_small->title( 'Progress Bars' );
ncurses_attron( NCURSES_A_REVERSE );
$bar_1 = new NcProgressBar( $nc_small, 0, 0, 0, 100, true );
$bar_1->pos( 57 );
$bar_2 = new NcProgressBar( $nc_small, 0, 1, 0, 100, false );
$bar_2->pos( 11 );
$nc_small->write( 3, 0, 'Text Input:' );
$input = new NcTextInput( $nc_small, -12, 3, 12 );
$foo = $input->get();
$nc_small->write_centered( 4, 'Press any key to destroy this window' );
$nc_small->get_char();
$nc_small->hide();
$nc_main->get_char();
}
}
$app = new MyApp();
?>