From e293776ef7d13b880217b3ba07188f3ca01408ab Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 23 Feb 2020 00:50:13 +0100 Subject: Support for "cursor" CSS property (#135) --- src/main/kotlin/pl/treksoft/kvision/core/Css.kt | 41 ++++++++++++++++++++++ .../pl/treksoft/kvision/core/StyledComponent.kt | 7 ++++ 2 files changed, 48 insertions(+) (limited to 'src/main') diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt index 51ed1382..66a0db36 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt @@ -515,6 +515,47 @@ enum class LineBreak(internal val lineBreak: String) { ANYWHERE("anywhere") } +enum class Cursor(internal val cursor: String) { + DEFAULT("default"), + AUTO("auto"), + NONE("none"), + ALIAS("alias"), + ALLSCROLL("all-scroll"), + CELL("cell"), + CONTEXTMENU("context-menu"), + COLRESIZE("col-resize"), + COPY("copy"), + CROSSHAIR("crosshair"), + ERESIZE("e-resize"), + EWRESIZE("ew-resize"), + GRAB("grab"), + GRABBING("grabbing"), + HELP("help"), + MOVE("move"), + NRESIZE("n-resize"), + NERESIZE("ne-resize"), + NESWRESIZE("nesw-resize"), + NSRESIZE("ns-resize"), + NWRESIZE("nw-resize"), + NWSERESIZE("nwse-resize"), + NODROP("no-drop"), + NOTALLOWED("not-allowed"), + POINTER("pointer"), + PROGRESS("progress"), + ROWRESIZE("row-resize"), + SRESIZE("s-resize"), + SERESIZE("se-resize"), + SWRESIZE("sw-resize"), + TEXT("text"), + VERTICALTEXT("vertical-text"), + WRESIZE("w-resize"), + WAIT("wait"), + ZOOMIN("zoom-in"), + ZOOMOUT("zoom-out"), + INITIAL("initial"), + INHERIT("inherit") +} + /** * Type-safe definition of CSS border. * @param width width of the border diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt index bf25f1af..80a2b0c4 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt @@ -284,6 +284,10 @@ abstract class StyledComponent { * CSS line break of the current component. */ open var lineBreak: LineBreak? by refreshOnUpdate() + /** + * CSS cursor shape over the current component. + */ + open var cursor: Cursor? by refreshOnUpdate() private var snStyleCache: List? = null @@ -483,6 +487,9 @@ abstract class StyledComponent { lineBreak?.let { snstyle.add("line-break" to it.lineBreak) } + cursor?.let { + snstyle.add("cursor" to it.cursor) + } globalStyleCache[cacheKey] = snstyle return snstyle } -- cgit