mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
fix double click target
This commit is contained in:
parent
ec57e7830c
commit
69e4a57146
1 changed files with 25 additions and 14 deletions
|
|
@ -103,19 +103,7 @@ class Tab
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->gtk->connect(
|
|
||||||
'button-press-event',
|
|
||||||
function (
|
|
||||||
?\GtkNotebook $self,
|
|
||||||
?\GdkEvent $event
|
|
||||||
) {
|
|
||||||
// Close tab on double click
|
|
||||||
if ($event->type == 5) // @TODO PHP-GTK3 Gdk.EventType.DOUBLE_BUTTON_PRESS
|
|
||||||
{
|
|
||||||
$this->close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function append(
|
public function append(
|
||||||
|
|
@ -130,9 +118,32 @@ class Tab
|
||||||
$this->container
|
$this->container
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Create event box to listen for double click on title label
|
||||||
|
$label = new \GtkEventBox;
|
||||||
|
|
||||||
|
$label->add(
|
||||||
|
$page->title->gtk
|
||||||
|
);
|
||||||
|
|
||||||
|
$label->show_all();
|
||||||
|
|
||||||
|
$label->connect(
|
||||||
|
'button-press-event',
|
||||||
|
function (
|
||||||
|
?\GtkEventBox $self,
|
||||||
|
?\GdkEvent $event
|
||||||
|
) {
|
||||||
|
// Close tab on double click
|
||||||
|
if ($event->type == 5) // @TODO PHP-GTK3 Gdk.EventType.DOUBLE_BUTTON_PRESS
|
||||||
|
{
|
||||||
|
$this->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$this->gtk->append_page(
|
$this->gtk->append_page(
|
||||||
$page->gtk,
|
$page->gtk,
|
||||||
$page->title->gtk
|
$label
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->gtk->set_tab_reorderable(
|
$this->gtk->set_tab_reorderable(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue