Add support for masked views

This commit is contained in:
Danny Tylman 2016-03-15 11:42:42 +02:00 committed by Roi Martin
parent 336b3337d1
commit 65dfdbf77a
1 changed files with 7 additions and 0 deletions

View File

@ -60,6 +60,9 @@ type View struct {
// If Frame is true, Title allows to configure a title for the view.
Title string
// If set and view is Editable, displays the mask instead of the real content
Mask rune
}
type viewLine struct {
@ -108,6 +111,10 @@ func (v *View) setRune(x, y int, ch rune) error {
fgColor = v.FgColor
bgColor = v.BgColor
}
if v.Mask != 0 {
ch = v.Mask
}
termbox.SetCell(v.x0+x+1, v.y0+y+1, ch,
termbox.Attribute(fgColor), termbox.Attribute(bgColor))
return nil