struct
TermBuf::Border
- TermBuf::Border
- Struct
- Value
- Object
Overview
A box drawn around something, with an optional title in its top edge.
It lives at the widget layer root rather than inside Field because
anything else drawn in a box wants the same thing.
Defined in:
termbuf/widgets/border.crConstant Summary
-
ASCII =
Glyphs.new('+', '-', '+', '|', '|', '+', '-', '+') -
For a terminal whose font has no box drawing, and for a screen someone is going to copy out of.
-
DOUBLE =
Glyphs.new('╔', '═', '╗', '║', '║', '╚', '═', '╝') -
HEAVY =
Glyphs.new('┏', '━', '┓', '┃', '┃', '┗', '━', '┛') -
PADDING =
2 -
Rows and columns a border adds to whatever it surrounds.
-
PLAIN =
Glyphs.new('┌', '─', '┐', '│', '│', '└', '─', '┘') -
ROUNDED =
Glyphs.new('╭', '─', '╮', '│', '│', '╰', '─', '╯')
Constructors
-
.ascii(style : Style = Style::DEFAULT, title : String | Nil = nil, title_style : Style = Style::DEFAULT) : Border
A ascii border.
-
.double(style : Style = Style::DEFAULT, title : String | Nil = nil, title_style : Style = Style::DEFAULT) : Border
A double border.
-
.heavy(style : Style = Style::DEFAULT, title : String | Nil = nil, title_style : Style = Style::DEFAULT) : Border
A heavy border.
- .new(glyphs : Glyphs = PLAIN, style : Style = Style::DEFAULT, title : String | Nil = nil, title_style : Style = Style::DEFAULT)
-
.plain(style : Style = Style::DEFAULT, title : String | Nil = nil, title_style : Style = Style::DEFAULT) : Border
A plain border.
-
.rounded(style : Style = Style::DEFAULT, title : String | Nil = nil, title_style : Style = Style::DEFAULT) : Border
A rounded border.
Class Method Summary
-
.inset(rect : Rect) : Rect
The area inside the box.
Instance Method Summary
-
#draw(screen : Drawing, rect : Rect) : Nil
Draws the box around the edge of rect.
-
#glyphs : Glyphs
Which characters the box is drawn with.
-
#inset(rect : Rect) : Rect
The area inside the box.
-
#style : Style
What the box itself is drawn in.
-
#title : String | Nil
Shown in the top edge, trimmed to fit.
-
#title_style : Style
What the title is drawn in, which is often not what the box is.
-
#with_title(title : String | Nil) : Border
A copy carrying a different title.
Constructor Detail
A ascii border.
A double border.
A heavy border.
A plain border.
A rounded border.
Class Method Detail
The area inside the box. Empty when rect has no room for one.
Instance Method Detail
Draws the box around the edge of rect.
The last cell written is the bottom right corner, which on a terminal that scrolls rather than holding the wrap would take the top edge with it. The painter turns wrapping off for the duration of a frame, so it does not.
The area inside the box. Empty when rect has no room for one.
What the title is drawn in, which is often not what the box is.