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