const class gfx::Border
sys::Obj gfx::Border
@Js
@Serializable { simple=true }
Modes width, style, color, and radius of a rectangular border.
- colorBottom
-
const Color colorBottom := black
Color of bottom side, default is black.
- colorLeft
-
const Color colorLeft := black
Color of left side, default is black.
- colorRight
-
const Color colorRight := black
Color of right side, default is black.
- colorTop
-
const Color colorTop := black
Color of top side, default is black.
- copy
-
new copy(Border orig, |This| f)
Copy border with some modifications
- defVal
-
const static Border defVal := Border.fromStr("0")
Default is zero pixel border.
- equals
-
virtual override Bool equals(Obj? obj)
Equality is based on string format.
- fromStr
-
static new fromStr(Str str, Bool checked := true)
Parse a border from string (see
toStr
). If invalid and checked is true then throw ParseErr otherwise return null. The string formatted as four optional parts, where each part may have 1 to 4 values:border := [width] [style] [color] [radius] width := top ["," right ["," bottom ["," left]]] style := top ["," right ["," bottom ["," left]]] color := top ["," right ["," bottom ["," left]]] radius := top-left ["," top-right ["," bottom-right ["," bottom-left]]]
Width and radius must be integers, color must match
Color
string format, and style must be "solid", "inset", or "outset". If one side is not specified, it is reflected from the opposite side:a => a,a,a,a a,b => a,b,a,b a,b,c => a,b,c,b
Examples:
Border("2") => 2 solid #000000 0 Border("#abc") => 1 solid #aabbcc 0 Border("2 inset 3") => 2 inset #000000 3 Border("0,1,2,3") => 0,1,2,3 solid #000000 0 Border("0,1,2 #00f") => 0,1,2 solid #0000ff 0
- hash
-
virtual override Int hash()
Hash is based on string format.
- make
-
new make(|This| f)
Construct with it-block
- radiusBottomLeft
-
const Int radiusBottomLeft := 0
Radius in pixels of bottom-left corner, default is 0.
- radiusBottomRight
-
const Int radiusBottomRight := 0
Radius in pixels of bottom-right corner, default is 0.
- radiusTopLeft
-
const Int radiusTopLeft := 0
Radius in pixels of top-left corner, default is 0.
- radiusTopRight
-
const Int radiusTopRight := 0
Radius in pixels of top-right corner, default is 0.
- styleBottom
-
const Int styleBottom := styleSolid
Style of bottom side as one of styleX constants, default is solid.
- styleFromStr
-
static Int? styleFromStr(Str s, Bool checked := true)
Parse style string into int constant - see
styleToStr
. - styleInset
-
const static Int styleInset := 1
Constant identifier for inset style.
- styleLeft
-
const Int styleLeft := styleSolid
Style of left side as one of styleX constants, default is solid.
- styleOutset
-
const static Int styleOutset := 2
Constant identifier for outside style.
- styleRight
-
const Int styleRight := styleSolid
Style of right side as one of styleX constants, default is solid.
- styleSolid
-
const static Int styleSolid := 0
Constant identifier for solid style.
- styleToStr
-
Return "solid", "inset", "outset" for int constant.
- styleTop
-
const Int styleTop := styleSolid
Style of top side as one of styleX constants, default is solid.
- toSize
-
Size toSize()
Return widthRight+widthLeft, widthTop+widthBottom
- toStr
-
virtual const override Str toStr
String format - see
fromStr
for format. - widthBottom
-
const Int widthBottom := 1
Width in pixels of bottom side, default is 1.
- widthLeft
-
const Int widthLeft := 1
Width in pixels of left side, default is 1.
- widthRight
-
const Int widthRight := 1
Width in pixels of right side, default is 1.
- widthTop
-
const Int widthTop := 1
Width in pixels of top side, default is 1.