|
|
@ -4,9 +4,12 @@ declare(strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
namespace Yggverse\Yoda\Abstract\Entity; |
|
|
|
namespace Yggverse\Yoda\Abstract\Entity; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use \GdkEvent; |
|
|
|
|
|
|
|
use \GtkEntry; |
|
|
|
|
|
|
|
|
|
|
|
abstract class Entry |
|
|
|
abstract class Entry |
|
|
|
{ |
|
|
|
{ |
|
|
|
public \GtkEntry $gtk; |
|
|
|
public GtkEntry $gtk; |
|
|
|
|
|
|
|
|
|
|
|
public const LENGTH = 1024; |
|
|
|
public const LENGTH = 1024; |
|
|
|
public const PLACEHOLDER = ''; |
|
|
|
public const PLACEHOLDER = ''; |
|
|
@ -15,7 +18,7 @@ abstract class Entry |
|
|
|
|
|
|
|
|
|
|
|
public function __construct() |
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->gtk = new \GtkEntry; |
|
|
|
$this->gtk = new GtkEntry; |
|
|
|
|
|
|
|
|
|
|
|
$this->gtk->set_placeholder_text( |
|
|
|
$this->gtk->set_placeholder_text( |
|
|
|
_($this::PLACEHOLDER) |
|
|
|
_($this::PLACEHOLDER) |
|
|
@ -40,7 +43,7 @@ abstract class Entry |
|
|
|
$this->gtk->connect( |
|
|
|
$this->gtk->connect( |
|
|
|
'activate', |
|
|
|
'activate', |
|
|
|
function( |
|
|
|
function( |
|
|
|
\GtkEntry $entry |
|
|
|
GtkEntry $entry |
|
|
|
) { |
|
|
|
) { |
|
|
|
$this->_onActivate( |
|
|
|
$this->_onActivate( |
|
|
|
$entry |
|
|
|
$entry |
|
|
@ -51,8 +54,8 @@ abstract class Entry |
|
|
|
$this->gtk->connect( |
|
|
|
$this->gtk->connect( |
|
|
|
'key-release-event', |
|
|
|
'key-release-event', |
|
|
|
function ( |
|
|
|
function ( |
|
|
|
\GtkEntry $entry, |
|
|
|
GtkEntry $entry, |
|
|
|
\GdkEvent $event |
|
|
|
GdkEvent $event |
|
|
|
) { |
|
|
|
) { |
|
|
|
$this->_onKeyRelease( |
|
|
|
$this->_onKeyRelease( |
|
|
|
$entry, |
|
|
|
$entry, |
|
|
@ -64,7 +67,7 @@ abstract class Entry |
|
|
|
$this->gtk->connect( |
|
|
|
$this->gtk->connect( |
|
|
|
'changed', |
|
|
|
'changed', |
|
|
|
function ( |
|
|
|
function ( |
|
|
|
\GtkEntry $entry |
|
|
|
GtkEntry $entry |
|
|
|
) { |
|
|
|
) { |
|
|
|
$this->_onChanged( |
|
|
|
$this->_onChanged( |
|
|
|
$entry |
|
|
|
$entry |
|
|
@ -75,8 +78,8 @@ abstract class Entry |
|
|
|
$this->gtk->connect( |
|
|
|
$this->gtk->connect( |
|
|
|
'focus-out-event', |
|
|
|
'focus-out-event', |
|
|
|
function ( |
|
|
|
function ( |
|
|
|
\GtkEntry $entry, |
|
|
|
GtkEntry $entry, |
|
|
|
\GdkEvent $event |
|
|
|
GdkEvent $event |
|
|
|
) { |
|
|
|
) { |
|
|
|
$this->_onFocusOut( |
|
|
|
$this->_onFocusOut( |
|
|
|
$entry, |
|
|
|
$entry, |
|
|
@ -87,21 +90,21 @@ abstract class Entry |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
abstract protected function _onActivate( |
|
|
|
abstract protected function _onActivate( |
|
|
|
\GtkEntry $entry |
|
|
|
GtkEntry $entry |
|
|
|
): void; |
|
|
|
): void; |
|
|
|
|
|
|
|
|
|
|
|
abstract protected function _onKeyRelease( |
|
|
|
abstract protected function _onKeyRelease( |
|
|
|
\GtkEntry $entry, |
|
|
|
GtkEntry $entry, |
|
|
|
\GdkEvent $event |
|
|
|
GdkEvent $event |
|
|
|
): void; |
|
|
|
): void; |
|
|
|
|
|
|
|
|
|
|
|
abstract protected function _onChanged( |
|
|
|
abstract protected function _onChanged( |
|
|
|
\GtkEntry $entry |
|
|
|
GtkEntry $entry |
|
|
|
): void; |
|
|
|
): void; |
|
|
|
|
|
|
|
|
|
|
|
abstract protected function _onFocusOut( |
|
|
|
abstract protected function _onFocusOut( |
|
|
|
\GtkEntry $entry, |
|
|
|
GtkEntry $entry, |
|
|
|
\GdkEvent $event |
|
|
|
GdkEvent $event |
|
|
|
): void; |
|
|
|
): void; |
|
|
|
|
|
|
|
|
|
|
|
public function setLength( |
|
|
|
public function setLength( |
|
|
|