diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModController.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModController.kt
index 10429187d..962177515 100644
--- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModController.kt
+++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModController.kt
@@ -17,6 +17,7 @@
*/
package org.jackhuang.hmcl.ui
+import com.jfoenix.effects.JFXDepthManager
import javafx.fxml.FXML
import javafx.scene.Node
import javafx.scene.control.ScrollPane
@@ -46,6 +47,19 @@ class ModController {
for (modInfo in modManager.getMods(versionId)) {
rootPane.children += ModItem(modInfo) {
modManager.removeMods(versionId, modInfo)
+ }.apply {
+ JFXDepthManager.setDepth(this, 1)
+ style += "-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;"
+
+ modInfo.activeProperty.addListener { _, _, newValue ->
+ if (newValue)
+ styleClass -= "disabled"
+ else
+ styleClass += "disabled"
+ }
+
+ if (!modInfo.isActive)
+ styleClass += "disabled"
}
}
}
diff --git a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModItem.kt b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModItem.kt
index 073b61012..02b993c97 100644
--- a/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModItem.kt
+++ b/HMCL/src/main/kotlin/org/jackhuang/hmcl/ui/ModItem.kt
@@ -23,7 +23,7 @@ import javafx.scene.control.Label
import javafx.scene.layout.BorderPane
import org.jackhuang.hmcl.mod.ModInfo
-class ModItem(info: ModInfo, private val deleteCallback: () -> Unit) : BorderPane() {
+class ModItem(info: ModInfo, private val deleteCallback: (ModItem) -> Unit) : BorderPane() {
@FXML lateinit var lblModFileName: Label
@FXML lateinit var lblModAuthor: Label
@FXML lateinit var chkEnabled: JFXCheckBox
@@ -40,6 +40,6 @@ class ModItem(info: ModInfo, private val deleteCallback: () -> Unit) : BorderPan
}
fun onDelete() {
- deleteCallback()
+ deleteCallback(this)
}
}
\ No newline at end of file
diff --git a/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css b/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css
index 427f4f213..46d1fa043 100644
--- a/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css
+++ b/HMCL/src/main/resources/assets/css/jfoenix-main-demo.css
@@ -6,6 +6,10 @@
-fx-font-family: "Roboto";
}
+.disabled Label {
+ -fx-text-fill: gray;
+}
+
.side-menu {
-fx-padding: 20.0, 10.0;
-fx-font-size: 15.0;
diff --git a/HMCL/src/main/resources/assets/fxml/mod-item.fxml b/HMCL/src/main/resources/assets/fxml/mod-item.fxml
index 1d3c275c8..08fd28b54 100644
--- a/HMCL/src/main/resources/assets/fxml/mod-item.fxml
+++ b/HMCL/src/main/resources/assets/fxml/mod-item.fxml
@@ -23,7 +23,7 @@
-
+
diff --git a/HMCL/src/main/resources/assets/fxml/mod.fxml b/HMCL/src/main/resources/assets/fxml/mod.fxml
index 12ed94c8e..68a651082 100644
--- a/HMCL/src/main/resources/assets/fxml/mod.fxml
+++ b/HMCL/src/main/resources/assets/fxml/mod.fxml
@@ -1,8 +1,5 @@
-
-
-
@@ -10,7 +7,7 @@
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jackhuang.hmcl.ui.ModController">
-
+
diff --git a/HMCL/src/main/resources/assets/svg/close-black.fxml b/HMCL/src/main/resources/assets/svg/close-black.fxml
new file mode 100644
index 000000000..1b1aeb9b4
--- /dev/null
+++ b/HMCL/src/main/resources/assets/svg/close-black.fxml
@@ -0,0 +1,2 @@
+
+
diff --git a/HMCL/src/main/resources/assets/svg/pencil.fxml b/HMCL/src/main/resources/assets/svg/pencil.fxml
new file mode 100644
index 000000000..fa69a57ae
--- /dev/null
+++ b/HMCL/src/main/resources/assets/svg/pencil.fxml
@@ -0,0 +1,2 @@
+
+