Modes width, style, color, and radius of a rectangular border.
Slots
-
static private Color black := Color(0)
- colorBottomSource
-
const Color colorBottom := black
Color of bottom side, default is black.
- colorLeftSource
-
const Color colorLeft := black
Color of left side, default is black.
- colorRightSource
-
const Color colorRight := black
Color of right side, default is black.
- colorTopSource
-
const Color colorTop := black
Color of top side, default is black.
- defValSource
-
static Border defVal := Border.make() |Border->Void| { ... }
Default is 1 pixel solid black border with no radius.
- equalsSource
-
override Bool equals(Obj? obj)
Overrides sys::Obj.equals
Equality is based on string format.
-
private StrBuf formatPart(StrBuf s, Obj t, Obj r, Obj b, Obj l, |Obj -> Str| f)
-
private Str formatStr()
- fromStrSource
-
static Border? 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
- hashSource
-
override Int hash()
Overrides sys::Obj.hash
Hash is based on string format.
- makeSource
-
new make(|Border| f)
Construct with it-block
-
new makeStr(Str str)
- radiusBottomLeftSource
-
const Int radiusBottomLeft := 0
Radius in pixels of bottom-left corner, default is 0.
- radiusBottomRightSource
-
const Int radiusBottomRight := 0
Radius in pixels of bottom-right corner, default is 0.
- radiusTopLeftSource
-
const Int radiusTopLeft := 0
Radius in pixels of top-left corner, default is 0.
- radiusTopRightSource
-
const Int radiusTopRight := 0
Radius in pixels of top-right corner, default is 0.
- styleBottomSource
-
const Int styleBottom := styleSolid
Style of bottom side as one of styleX constants, default is solid.
- styleFromStrSource
-
static Int? styleFromStr(Str s, Bool checked := true)
Parse style string into int constant - see styleToStr.
- styleInsetSource
-
static Int styleInset := 1
Constant identifier for inset style.
- styleLeftSource
-
const Int styleLeft := styleSolid
Style of left side as one of styleX constants, default is solid.
- styleOutsetSource
-
static Int styleOutset := 2
Constant identifier for outside style.
- styleRightSource
-
const Int styleRight := styleSolid
Style of right side as one of styleX constants, default is solid.
- styleSolidSource
-
static Int styleSolid := 0
Constant identifier for solid style.
- styleToStrSource
-
Return "solid", "inset", "outset" for int constant.
- styleTopSource
-
const Int styleTop := styleSolid
Style of top side as one of styleX constants, default is solid.
- toSizeSource
-
Size toSize()
Return widthRight+widthLeft, widthTop+widthBottom
- toStrSource
-
override const Str toStr
Overrides sys::Obj.toStr
String format - see fromStr for format.
- widthBottomSource
-
const Int widthBottom := 1
Width in pixels of bottom side, default is 1.
- widthLeftSource
-
const Int widthLeft := 1
Width in pixels of left side, default is 1.
- widthRightSource
-
const Int widthRight := 1
Width in pixels of right side, default is 1.
- widthTopSource
-
const Int widthTop := 1
Width in pixels of top side, default is 1.