mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
GTextEditor: Add add_custom_context_menu_action()
This allows embedders to add their own custom GAction set to a text editor's context menu.
This commit is contained in:
@@ -1204,6 +1204,12 @@ void GTextEditor::context_menu_event(GContextMenuEvent& event)
|
||||
m_context_menu->add_action(copy_action());
|
||||
m_context_menu->add_action(paste_action());
|
||||
m_context_menu->add_action(delete_action());
|
||||
if (!m_custom_context_menu_actions.is_empty()) {
|
||||
m_context_menu->add_separator();
|
||||
for (auto& action : m_custom_context_menu_actions) {
|
||||
m_context_menu->add_action(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_context_menu->popup(event.screen_position());
|
||||
}
|
||||
@@ -1413,3 +1419,8 @@ int GTextEditor::Line::visual_line_containing(int column) const
|
||||
});
|
||||
return visual_line_index;
|
||||
}
|
||||
|
||||
void GTextEditor::add_custom_context_menu_action(GAction& action)
|
||||
{
|
||||
m_custom_context_menu_actions.append(action);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user