From 85ec80314c5f0cdeb1708306e3b83158084608d0 Mon Sep 17 00:00:00 2001 From: ryoii Date: Mon, 30 Mar 2020 21:32:40 +0800 Subject: [PATCH] Graphical add contextMenu for log list items --- .../mirai/console/graphical/view/PrimaryView.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt index a871a17b3..a50453e12 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt @@ -10,6 +10,7 @@ import javafx.scene.control.ButtonType import javafx.scene.control.Tab import javafx.scene.control.TabPane import javafx.scene.image.Image +import javafx.scene.input.Clipboard import javafx.scene.input.KeyCode import javafx.scene.layout.Priority import javafx.stage.FileChooser @@ -21,6 +22,7 @@ import net.mamoe.mirai.console.graphical.util.jfxButton import net.mamoe.mirai.console.graphical.util.jfxListView import net.mamoe.mirai.console.graphical.util.jfxTabPane import tornadofx.* +import tornadofx.Stylesheet.Companion.contextMenu class PrimaryView : View() { @@ -194,6 +196,16 @@ private fun TabPane.logTab( graphic = label(it.first) { maxWidthProperty().bind(this@listview.widthProperty()) isWrapText = true + + + contextmenu { + item("复制").action { + Clipboard.getSystemClipboard().putString(it.first) + } + item("删除").action { + logs.remove(it) + } + } } } }