1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

SpaceAnalyzer: Added context menu for nodes

Currently supports 3 actions: Open, Copy Path, and Delete.
This commit is contained in:
Sviatoslav Peleshko 2021-02-20 17:02:28 +02:00 committed by Andreas Kling
parent 8d6525fc50
commit ff018607a1
4 changed files with 99 additions and 1 deletions

View file

@ -312,6 +312,8 @@ void TreeMapWidget::mousedown_event(GUI::MouseEvent& event)
void TreeMapWidget::doubleclick_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
return;
const TreeMapNode* node = path_node(m_viewpoint);
if (node && !node_is_leaf(*node)) {
Vector<int> path = path_to_position(event.position());
@ -341,6 +343,12 @@ void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event)
}
}
void TreeMapWidget::context_menu_event(GUI::ContextMenuEvent& context_menu_event)
{
if (on_context_menu_request)
on_context_menu_request(context_menu_event);
}
void TreeMapWidget::set_tree(RefPtr<TreeMap> tree)
{
m_tree = tree;