aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.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/components/TextBlock.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/components/TextBlock.kt')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt
new file mode 100644
index 0000000..8a4f32a
--- /dev/null
+++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/TextBlock.kt
@@ -0,0 +1,41 @@
+package cc.woverflow.chatting.gui.components
+
+import gg.essential.elementa.components.UIBlock
+import gg.essential.elementa.components.UIText
+import gg.essential.elementa.constraints.ChildBasedSizeConstraint
+import gg.essential.elementa.dsl.*
+import gg.essential.elementa.effects.OutlineEffect
+import gg.essential.elementa.state.BasicState
+import gg.essential.vigilance.gui.VigilancePalette
+import gg.essential.vigilance.gui.settings.SettingComponent
+
+/**
+ * Heavily modified from Vigilance under LGPLv3 (modified to be just a text block)
+ * https://github.com/Sk1erLLC/Vigilance/blob/master/LICENSE
+ */
+class TextBlock(
+ text: String
+) : SettingComponent() {
+ private val textHolder = UIBlock() constrain {
+ width = ChildBasedSizeConstraint() + 6.pixels()
+ height = ChildBasedSizeConstraint() + 6.pixels()
+ color = VigilancePalette.getDarkHighlight().toConstraint()
+ } childOf this effect OutlineEffect(
+ VigilancePalette.getDivider(),
+ 1f
+ ).bindColor(BasicState(VigilancePalette.getDivider()))
+
+ private val text: UIText = UIText(text) constrain {
+ x = 3.pixels()
+ y = 3.pixels()
+ }
+
+ init {
+ this.text childOf textHolder
+
+ constrain {
+ width = ChildBasedSizeConstraint()
+ height = ChildBasedSizeConstraint()
+ }
+ }
+} \ No newline at end of file