package com.marvinelsen.willow.ui.util

import com.marvinelsen.willow.ui.DictionaryEntryFx
import javafx.event.EventHandler
import javafx.scene.control.ContextMenu
import javafx.scene.control.MenuItem

fun createContextMenuForEntry(entry: DictionaryEntryFx) = ContextMenu().apply {
    val menuItemCopyHeadword = MenuItem("Copy Headword").apply {
        onAction = EventHandler { ClipboardHelper.copyHeadword(entry) }
    }

    val menuItemCopyPronunciation = MenuItem("Copy Pronunciation").apply {
        onAction = EventHandler { ClipboardHelper.copyPronunciation(entry) }
    }

    items.addAll(menuItemCopyHeadword, menuItemCopyPronunciation)
}
