|
|
@ -4,21 +4,48 @@ declare(strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; |
|
|
|
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content\Gemtext; |
|
|
|
|
|
|
|
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content\Image; |
|
|
|
|
|
|
|
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content\Plain; |
|
|
|
|
|
|
|
|
|
|
|
class Viewport |
|
|
|
class Viewport |
|
|
|
{ |
|
|
|
{ |
|
|
|
public \GtkViewport $gtk; |
|
|
|
public \GtkViewport $gtk; |
|
|
|
|
|
|
|
|
|
|
|
// Dependencies |
|
|
|
// Dependencies |
|
|
|
public \Yggverse\Yoda\Entity\Browser\Container\Page\Content $content; |
|
|
|
public Content $content; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Requirements |
|
|
|
|
|
|
|
private Gemtext | Plain | Image | null $_data = null; |
|
|
|
|
|
|
|
|
|
|
|
public function __construct( |
|
|
|
public function __construct( |
|
|
|
\Yggverse\Yoda\Entity\Browser\Container\Page\Content $content |
|
|
|
Content $content |
|
|
|
) { |
|
|
|
) { |
|
|
|
// Init dependencies |
|
|
|
// Init dependencies |
|
|
|
$this->content = $content; |
|
|
|
$this->content = $content; |
|
|
|
|
|
|
|
|
|
|
|
// Init viewport |
|
|
|
// Init viewport |
|
|
|
$this->gtk = new \GtkViewport; |
|
|
|
$this->gtk = new \GtkViewport; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function set( |
|
|
|
|
|
|
|
Gemtext | Plain | Image $data |
|
|
|
|
|
|
|
): void |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Remove previous |
|
|
|
|
|
|
|
if ($this->_data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$this->_data->gtk->destroy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init current |
|
|
|
|
|
|
|
$this->_data = $data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->gtk->add( |
|
|
|
|
|
|
|
$data->gtk |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Render |
|
|
|
// Render |
|
|
|
$this->gtk->show(); |
|
|
|
$this->gtk->show(); |
|
|
|