mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
draft middle click event implementation
This commit is contained in:
parent
fb3ad27e18
commit
52d25c6ffa
1 changed files with 25 additions and 0 deletions
|
|
@ -5,8 +5,10 @@ declare(strict_types=1);
|
||||||
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
|
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
|
||||||
|
|
||||||
use \Exception;
|
use \Exception;
|
||||||
|
use \Gdk;
|
||||||
use \GdkEvent;
|
use \GdkEvent;
|
||||||
use \GtkLabel;
|
use \GtkLabel;
|
||||||
|
use \Pango;
|
||||||
|
|
||||||
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup;
|
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup;
|
||||||
|
|
||||||
|
|
@ -280,6 +282,29 @@ class Gemtext extends Markup
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function _onButtonPressEvent(
|
||||||
|
GtkLabel $label,
|
||||||
|
GdkEvent $event
|
||||||
|
): bool
|
||||||
|
{
|
||||||
|
// Open link in new tab on middle button click
|
||||||
|
if ($event->button->button == Gdk::BUTTON_MIDDLE)
|
||||||
|
{
|
||||||
|
$result = $label->get_layout()->xy_to_index(
|
||||||
|
$event->button->x * Pango::SCALE,
|
||||||
|
$event->button->y * Pango::SCALE
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
// @TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private function _wrap(
|
private function _wrap(
|
||||||
string $value
|
string $value
|
||||||
): string
|
): string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue