Correl Roush
57215e1191
git-svn-id: file:///srv/svn/scanner/trunk@16 a0501263-5b7a-4423-a8ba-1edf086583e7
43 lines
1,023 B
PHP
43 lines
1,023 B
PHP
<?php
|
|
/**
|
|
* Example ncurses application
|
|
*
|
|
* @package Nc
|
|
* @subpackage Example
|
|
*/
|
|
|
|
/**
|
|
* Include ncurses library
|
|
*/
|
|
require_once( 'ncurses.php' );
|
|
|
|
/**
|
|
* Example Nc Application
|
|
*
|
|
* @package Nc
|
|
* @subpackage Example
|
|
*/
|
|
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();
|
|
?>
|