aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-01-03 11:12:54 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-01-03 11:12:54 +0700
commit487709996c22fb0dbcac792076be799a09865600 (patch)
tree5ab6f27a54d673fb057fd3eafd9a5e27816f898c /src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt
parentdf895d122a8a2ea249e686578e026c1d0a8b8c47 (diff)
downloadChatting-487709996c22fb0dbcac792076be799a09865600.tar.gz
Chatting-487709996c22fb0dbcac792076be799a09865600.tar.bz2
Chatting-487709996c22fb0dbcac792076be799a09865600.zip
Chattils -> Chatting (1.1.0)
Update images (ty Mo2men) update screenshot line tooltip (ty Mo2men)
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt
new file mode 100644
index 0000000..a4a9f70
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/gui/ChatShortcutViewGui.kt
@@ -0,0 +1,57 @@
+package cc.woverflow.chatting.gui
+
+import cc.woverflow.chatting.chat.ChatShortcuts
+import cc.woverflow.chatting.gui.components.TextBlock
+import gg.essential.api.EssentialAPI
+import gg.essential.elementa.ElementaVersion
+import gg.essential.elementa.WindowScreen
+import gg.essential.elementa.components.UIBlock
+import gg.essential.elementa.constraints.CenterConstraint
+import gg.essential.elementa.constraints.RelativeWindowConstraint
+import gg.essential.elementa.constraints.SiblingConstraint
+import gg.essential.elementa.dsl.*
+import gg.essential.vigilance.gui.VigilancePalette
+import gg.essential.vigilance.gui.settings.ButtonComponent
+
+class ChatShortcutViewGui : WindowScreen(version = ElementaVersion.V1) {
+ override fun initScreen(width: Int, height: Int) {
+ super.initScreen(width, height)
+ for ((index, shortcut) in ChatShortcuts.shortcuts.withIndex()) {
+ val block = UIBlock(VigilancePalette.getBackground()).constrain {
+ x = 3.percent()
+ y = (index * 12).percent()
+ this.width = 94.percent()
+ this.height = 25.pixels()
+ } childOf this.window
+ TextBlock(shortcut.first).constrain {
+ x = RelativeWindowConstraint(0.05F)
+ y = CenterConstraint()
+ } childOf block
+ TextBlock(shortcut.second).constrain {
+ x = SiblingConstraint(10F)
+ y = CenterConstraint()
+ } childOf block
+ ButtonComponent("Edit") {
+ println("${shortcut.first} ${shortcut.second}")
+ EssentialAPI.getGuiUtil().openScreen(ChatShortcutEditGui(shortcut.first, shortcut.second, true))
+ } constrain {
+ x = SiblingConstraint(20F)
+ y = CenterConstraint()
+ } childOf block
+ ButtonComponent("Delete") {
+ println("${shortcut.first} ${shortcut.second}")
+ ChatShortcuts.removeShortcut(shortcut.first)
+ EssentialAPI.getGuiUtil().openScreen(ChatShortcutViewGui())
+ } constrain {
+ x = SiblingConstraint(5F)
+ y = CenterConstraint()
+ } childOf block
+ }
+ ButtonComponent("New") {
+ EssentialAPI.getGuiUtil().openScreen(ChatShortcutEditGui("", "", false))
+ } constrain {
+ x = CenterConstraint()
+ y = 80.percent()
+ } childOf window
+ }
+} \ No newline at end of file