aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-02-26 12:45:35 +0100
committerRobert Jaros <rjaros@finn.pl>2018-02-26 12:45:35 +0100
commit5c98e5bb469269d54fb508f2adf589da696cbcd6 (patch)
treef56e5d300789a5d31d2c96df4c81ac5f10d4373a /src/main/kotlin/pl/treksoft/kvision
parent73e672b25476b23c135fccfd0b7a67e1e8b915bd (diff)
downloadkvision-5c98e5bb469269d54fb508f2adf589da696cbcd6.tar.gz
kvision-5c98e5bb469269d54fb508f2adf589da696cbcd6.tar.bz2
kvision-5c98e5bb469269d54fb508f2adf589da696cbcd6.zip
Add support for overflow and resize CSS properties.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Css.kt26
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt14
2 files changed, 39 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
index 091c806a..ff01cc9f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
@@ -28,7 +28,7 @@ import pl.treksoft.kvision.utils.toHexString
* Definitions of CSS units.
*/
@Suppress("EnumNaming", "EnumEntryName")
-enum class Unit(internal val unit: String) {
+enum class UNIT(internal val unit: String) {
px("px"),
pt("pt"),
em("em"),
@@ -268,6 +268,30 @@ enum class Position(internal val position: String) {
}
/**
+ * Definitions of CSS overflow options.
+ */
+enum class Overflow(internal val overflow: String) {
+ VISIBLE("visible"),
+ HIDDEN("hidden"),
+ SCROLL("scroll"),
+ AUTO("auto"),
+ INITIAL("initial"),
+ INHERIT("inherit")
+}
+
+/**
+ * Definitions of CSS resize options.
+ */
+enum class Resize(internal val resize: String) {
+ NONE("none"),
+ BOTH("both"),
+ HORIZONTAL("horizontal"),
+ VERTICAL("vertical"),
+ INITIAL("initial"),
+ INHERIT("inherit")
+}
+
+/**
* Type-safe definition of CSS border.
*/
class Border private constructor(
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
index 37eb28c7..d871ff60 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
@@ -80,6 +80,14 @@ abstract class StyledComponent : Component {
*/
var zIndex: Int? by refreshOnUpdate()
/**
+ * CSS overflow of the current component.
+ */
+ var overflow: Overflow? by refreshOnUpdate()
+ /**
+ * CSS resize of the current component.
+ */
+ var resize: Resize? by refreshOnUpdate()
+ /**
* Border of the current component.
*/
var border: Border? by refreshOnUpdate()
@@ -244,6 +252,12 @@ abstract class StyledComponent : Component {
zIndex?.let {
snstyle.add("z-index" to it.toString())
}
+ overflow?.let {
+ snstyle.add("overflow" to it.toString())
+ }
+ resize?.let {
+ snstyle.add("resize" to it.toString())
+ }
border?.let {
snstyle.add("border" to it.asString())
}