More work on Edit Frame

This commit is contained in:
Deon George
2019-10-02 15:47:56 +10:00
parent bb031b1b82
commit d43d5b71fd
5 changed files with 110 additions and 14 deletions

View File

@@ -2,8 +2,11 @@
namespace App\Classes\Control;
use Illuminate\Support\Arr;
use App\Classes\Control;
use App\Classes\Parser\Ansi;
use App\Classes\Frame;
use App\Classes\Server;
/**
* Class Edit Frame handles frame editing
@@ -15,6 +18,19 @@ class EditFrame extends Control
private $x = 1;
private $y = 1;
// The frame applicable for this control (not the current rendered frame, thats in $so)
protected $fo = NULL;
public function __construct(Server $so,array $args=[])
{
if (! $args OR ! Arr::get($args,'fo') OR (! $args['fo'] instanceof Frame))
throw new \Exception('Missing frame to Edit');
$this->fo = $args['fo'];
parent::__construct($so);
}
protected function boot()
{
// Clear screen and setup edit.

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Classes\Control;
use App\Classes\Control;
/**
* Class Test
*
* This is a test class for Control Validation Processing
*
* @package App\Classes\Control
*/
class Test extends Control
{
public function boot()
{
$this->so->co->send(CLS.HOME.DOWN.CON);
$this->so->co->send('Press 1, or 2, or 4, 0 to end.');
}
public function handle(string $read)
{
switch ($read)
{
case 0:
$this->complete = TRUE;
$read = '';
break;
case 1:
$this->so->co->send('You pressed ONE.');
$read = '';
break;
case 2:
$this->so->co->send('You pressed TWO.');
$read = '';
break;
case 3:
$this->so->co->send('You pressed THREE.');
$read = '';
break;
case 4:
$this->so->co->send('You pressed FOUR.');
$read = '';
break;
}
return $read;
}
}