aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 13:45:51 -0500
committerWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 13:45:51 -0500
commite574e54a53b87ef4bbb33404b6fdb6b97c72dd81 (patch)
tree62bc726b1f0eb4727b6ddf10696f1fa69c519806 /src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt
parent27aa4095270f943ddab2a4e4d370e225766c7ff7 (diff)
downloadChatting-e574e54a53b87ef4bbb33404b6fdb6b97c72dd81.tar.gz
Chatting-e574e54a53b87ef4bbb33404b6fdb6b97c72dd81.tar.bz2
Chatting-e574e54a53b87ef4bbb33404b6fdb6b97c72dd81.zip
allow selecting multiple chat tabs at the same time
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt
index f320925..e3b96f1 100644
--- a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt
+++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt
@@ -1,5 +1,6 @@
package cc.woverflow.chatting.gui.components
+import cc.polyfrost.oneconfig.libs.universal.UKeyboard
import cc.polyfrost.oneconfig.libs.universal.UResolution
import cc.woverflow.chatting.chat.ChatTab
import cc.woverflow.chatting.chat.ChatTabs
@@ -21,11 +22,20 @@ class TabButton(buttonId: Int, x: Int, widthIn: Int, heightIn: Int, private val
}) {
override fun onMousePress() {
- ChatTabs.currentTab = chatTab
+ if (UKeyboard.isShiftKeyDown()) {
+ if (ChatTabs.currentTabs.contains(chatTab)) {
+ ChatTabs.currentTabs.remove(chatTab)
+ } else {
+ ChatTabs.currentTabs.add(chatTab)
+ }
+ } else {
+ ChatTabs.currentTabs.clear()
+ ChatTabs.currentTabs.add(chatTab)
+ }
}
override fun isEnabled(): Boolean {
- return chatTab != ChatTabs.currentTab
+ return ChatTabs.currentTabs.contains(chatTab)
}
companion object {