2008-02-28 16:39:33 +00:00
|
|
|
<?php
|
2008-02-29 15:39:44 +00:00
|
|
|
/**
|
|
|
|
* Example ncurses application
|
|
|
|
*
|
|
|
|
* @package Nc
|
|
|
|
* @subpackage Example
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include ncurses library
|
|
|
|
*/
|
2008-02-28 16:39:33 +00:00
|
|
|
require_once( 'ncurses.php' );
|
|
|
|
|
2008-02-29 15:39:44 +00:00
|
|
|
/**
|
|
|
|
* Example Nc Application
|
|
|
|
*
|
|
|
|
* @package Nc
|
|
|
|
* @subpackage Example
|
|
|
|
*/
|
2008-02-28 16:39:33 +00:00
|
|
|
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();
|
|
|
|
?>
|