mirror of https://github.com/jroimartin/gocui.git
Add support for masked views
This commit is contained in:
parent
336b3337d1
commit
65dfdbf77a
7
view.go
7
view.go
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue