Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5581cf14c1 | |||
| 16a92c8f99 | |||
| 62ef3b5d44 | |||
| 16f7e7466a | |||
| b04cc91245 | |||
| c821a8fa06 | |||
| c1296b1dc1 |
@@ -75,8 +75,9 @@ const (
|
|||||||
LFSizeAll = LayoutFlag(0x11110000)
|
LFSizeAll = LayoutFlag(0x11110000)
|
||||||
)
|
)
|
||||||
|
|
||||||
func (f LayoutFlag) Add(fl LayoutFlag) { f |= fl }
|
func (f LayoutFlag) Has(fl LayoutFlag) bool { return f&fl != 0 }
|
||||||
func (f LayoutFlag) Remove(fl LayoutFlag) { f = f &^ fl }
|
func (f LayoutFlag) Add(fl LayoutFlag) { f |= fl }
|
||||||
|
func (f LayoutFlag) Remove(fl LayoutFlag) { f = f &^ fl }
|
||||||
func (f LayoutFlag) ClearAll() {
|
func (f LayoutFlag) ClearAll() {
|
||||||
f.ClearAllAlign()
|
f.ClearAllAlign()
|
||||||
f.ClearAllSize()
|
f.ClearAllSize()
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ func (w *AbsoluteLayout) HandleKey(ev *tcell.EventKey) bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if w.widgets[i].Focusable() {
|
if w.widgets[i].SetActive(true) {
|
||||||
w.widgets[i].SetActive(true)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,8 +104,7 @@ func (w *AbsoluteLayout) HandleKey(ev *tcell.EventKey) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for i := 0; i < fndP; i++ {
|
for i := 0; i < fndP; i++ {
|
||||||
if w.widgets[i].Focusable() {
|
if w.widgets[i].SetActive(true) {
|
||||||
w.widgets[i].SetActive(true)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,8 +137,12 @@ func (w *AbsoluteLayout) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *AbsoluteLayout) Active() bool { return w.active }
|
func (w *AbsoluteLayout) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *AbsoluteLayout) SetActive(a bool) { w.active = a }
|
func (w *AbsoluteLayout) Active() bool { return w.active }
|
||||||
|
func (w *AbsoluteLayout) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.Active()
|
||||||
|
}
|
||||||
func (w *AbsoluteLayout) Visible() bool { return w.visible }
|
func (w *AbsoluteLayout) Visible() bool { return w.visible }
|
||||||
func (w *AbsoluteLayout) SetVisible(a bool) { w.visible = a }
|
func (w *AbsoluteLayout) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *AbsoluteLayout) Focusable() bool { return w.focusable }
|
func (w *AbsoluteLayout) Focusable() bool { return w.focusable }
|
||||||
|
|||||||
@@ -125,8 +125,12 @@ func (w *Alert) Draw(screen tcell.Screen) {
|
|||||||
w.GetPos().DrawOffset(w.layout, screen)
|
w.GetPos().DrawOffset(w.layout, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Alert) Active() bool { return w.active }
|
func (w *Alert) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Alert) SetActive(a bool) { w.active = a }
|
func (w *Alert) Active() bool { return w.active }
|
||||||
|
func (w *Alert) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Alert) Visible() bool { return w.visible }
|
func (w *Alert) Visible() bool { return w.visible }
|
||||||
func (w *Alert) SetVisible(a bool) { w.visible = a }
|
func (w *Alert) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Alert) SetX(x int) { w.x = x }
|
func (w *Alert) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -80,8 +80,12 @@ func (w *ArtWidget) Draw(screen tcell.Screen) {
|
|||||||
w.buffer.Draw(w.x, w.y, screen)
|
w.buffer.Draw(w.x, w.y, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *ArtWidget) Active() bool { return w.active }
|
func (w *ArtWidget) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *ArtWidget) SetActive(a bool) { w.active = a }
|
func (w *ArtWidget) Active() bool { return w.active }
|
||||||
|
func (w *ArtWidget) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *ArtWidget) Visible() bool { return w.visible }
|
func (w *ArtWidget) Visible() bool { return w.visible }
|
||||||
func (w *ArtWidget) SetVisible(v bool) { w.visible = v }
|
func (w *ArtWidget) SetVisible(v bool) { w.visible = v }
|
||||||
func (w *ArtWidget) Focusable() bool { return w.focusable }
|
func (w *ArtWidget) Focusable() bool { return w.focusable }
|
||||||
|
|||||||
@@ -51,27 +51,28 @@ func (w *BlankWidget) HandleKey(ev *tcell.EventKey) bool { return false }
|
|||||||
func (w *BlankWidget) HandleTime(ev *tcell.EventTime) {}
|
func (w *BlankWidget) HandleTime(ev *tcell.EventTime) {}
|
||||||
func (w *BlankWidget) Draw(screen tcell.Screen) {}
|
func (w *BlankWidget) Draw(screen tcell.Screen) {}
|
||||||
|
|
||||||
func (w *BlankWidget) Active() bool { return false }
|
func (w *BlankWidget) SetStyle(s tcell.Style) {}
|
||||||
func (w *BlankWidget) SetActive(a bool) {}
|
func (w *BlankWidget) Active() bool { return false }
|
||||||
func (w *BlankWidget) Visible() bool { return true }
|
func (w *BlankWidget) SetActive(a bool) bool { return false }
|
||||||
func (w *BlankWidget) SetVisible(v bool) {}
|
func (w *BlankWidget) Visible() bool { return true }
|
||||||
func (w *BlankWidget) Focusable() bool { return false }
|
func (w *BlankWidget) SetVisible(v bool) {}
|
||||||
func (w *BlankWidget) SetFocusable(t bool) {}
|
func (w *BlankWidget) Focusable() bool { return false }
|
||||||
func (w *BlankWidget) SetX(x int) {}
|
func (w *BlankWidget) SetFocusable(t bool) {}
|
||||||
func (w *BlankWidget) SetY(y int) {}
|
func (w *BlankWidget) SetX(x int) {}
|
||||||
func (w *BlankWidget) GetX() int { return w.x }
|
func (w *BlankWidget) SetY(y int) {}
|
||||||
func (w *BlankWidget) GetY() int { return w.y }
|
func (w *BlankWidget) GetX() int { return w.x }
|
||||||
func (w *BlankWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
func (w *BlankWidget) GetY() int { return w.y }
|
||||||
func (w *BlankWidget) SetPos(pos Coord) {}
|
func (w *BlankWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||||
func (w *BlankWidget) SetSize(size Coord) {}
|
func (w *BlankWidget) SetPos(pos Coord) {}
|
||||||
func (w *BlankWidget) SetW(wd int) {}
|
func (w *BlankWidget) SetSize(size Coord) {}
|
||||||
func (w *BlankWidget) SetH(h int) {}
|
func (w *BlankWidget) SetW(wd int) {}
|
||||||
func (w *BlankWidget) GetW() int { return 0 }
|
func (w *BlankWidget) SetH(h int) {}
|
||||||
func (w *BlankWidget) GetH() int { return 0 }
|
func (w *BlankWidget) GetW() int { return 0 }
|
||||||
func (w *BlankWidget) WantW() int { return w.wantW }
|
func (w *BlankWidget) GetH() int { return 0 }
|
||||||
func (w *BlankWidget) WantH() int { return w.wantH }
|
func (w *BlankWidget) WantW() int { return w.wantW }
|
||||||
func (w *BlankWidget) MinW() int { return 0 }
|
func (w *BlankWidget) WantH() int { return w.wantH }
|
||||||
func (w *BlankWidget) MinH() int { return 0 }
|
func (w *BlankWidget) MinW() int { return 0 }
|
||||||
|
func (w *BlankWidget) MinH() int { return 0 }
|
||||||
|
|
||||||
func (w *BlankWidget) SetWantH(v int) { w.wantH = v }
|
func (w *BlankWidget) SetWantH(v int) { w.wantH = v }
|
||||||
func (w *BlankWidget) SetWantW(v int) { w.wantW = v }
|
func (w *BlankWidget) SetWantW(v int) { w.wantW = v }
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ func (w *BorderedWidget) Init(id string, s tcell.Style) {
|
|||||||
w.style = s
|
w.style = s
|
||||||
w.widget.SetVisible(true)
|
w.widget.SetVisible(true)
|
||||||
w.border = wh.BRD_CSIMPLE
|
w.border = wh.BRD_CSIMPLE
|
||||||
w.widget.SetFocusable(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *BorderedWidget) Id() string { return w.id }
|
func (w *BorderedWidget) Id() string { return w.id }
|
||||||
@@ -91,27 +90,26 @@ func (w *BorderedWidget) Draw(screen tcell.Screen) {
|
|||||||
w.GetPos().DrawOffset(w.widget, screen)
|
w.GetPos().DrawOffset(w.widget, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *BorderedWidget) Active() bool { return w.widget.Active() }
|
func (w *BorderedWidget) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *BorderedWidget) SetActive(a bool) { w.widget.SetActive(a) }
|
func (w *BorderedWidget) Active() bool { return w.widget.Active() }
|
||||||
func (w *BorderedWidget) Visible() bool { return w.widget.Visible() }
|
func (w *BorderedWidget) SetActive(a bool) bool { return w.widget.SetActive(a) }
|
||||||
func (w *BorderedWidget) SetVisible(a bool) { w.SetVisible(a) }
|
func (w *BorderedWidget) Visible() bool { return w.widget.Visible() }
|
||||||
func (w *BorderedWidget) Focusable() bool { return w.widget.Focusable() }
|
func (w *BorderedWidget) SetVisible(a bool) { w.SetVisible(a) }
|
||||||
func (w *BorderedWidget) SetFocusable(b bool) { w.widget.SetFocusable(b) }
|
func (w *BorderedWidget) SetX(x int) { w.x = x }
|
||||||
func (w *BorderedWidget) SetX(x int) { w.x = x }
|
func (w *BorderedWidget) SetY(y int) { w.y = y }
|
||||||
func (w *BorderedWidget) SetY(y int) { w.y = y }
|
func (w *BorderedWidget) GetX() int { return w.x }
|
||||||
func (w *BorderedWidget) GetX() int { return w.x }
|
func (w *BorderedWidget) GetY() int { return w.y }
|
||||||
func (w *BorderedWidget) GetY() int { return w.y }
|
func (w *BorderedWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||||
func (w *BorderedWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
func (w *BorderedWidget) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||||
func (w *BorderedWidget) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
func (w *BorderedWidget) GetW() int { return w.w }
|
||||||
func (w *BorderedWidget) GetW() int { return w.w }
|
func (w *BorderedWidget) GetH() int { return w.h }
|
||||||
func (w *BorderedWidget) GetH() int { return w.h }
|
func (w *BorderedWidget) SetW(wd int) { w.w = wd }
|
||||||
func (w *BorderedWidget) SetW(wd int) { w.w = wd }
|
func (w *BorderedWidget) SetH(h int) { w.h = h }
|
||||||
func (w *BorderedWidget) SetH(h int) { w.h = h }
|
func (w *BorderedWidget) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||||
func (w *BorderedWidget) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
func (w *BorderedWidget) WantW() int { return w.w }
|
||||||
func (w *BorderedWidget) WantW() int { return w.w }
|
func (w *BorderedWidget) WantH() int { return w.h }
|
||||||
func (w *BorderedWidget) WantH() int { return w.h }
|
func (w *BorderedWidget) MinW() int { return 2 + w.widget.MinW() }
|
||||||
func (w *BorderedWidget) MinW() int { return 2 + w.widget.MinW() }
|
func (w *BorderedWidget) MinH() int { return 2 + w.widget.MinH() }
|
||||||
func (w *BorderedWidget) MinH() int { return 2 + w.widget.MinH() }
|
|
||||||
|
|
||||||
func (w *BorderedWidget) SetBorder(r []rune) { w.border = r }
|
func (w *BorderedWidget) SetBorder(r []rune) { w.border = r }
|
||||||
func (w *BorderedWidget) SetTitle(ttl string) { w.title = ttl }
|
func (w *BorderedWidget) SetTitle(ttl string) { w.title = ttl }
|
||||||
|
|||||||
@@ -75,23 +75,28 @@ func (w *BufferWidget) HandleKey(ev *tcell.EventKey) bool {
|
|||||||
}
|
}
|
||||||
func (w *BufferWidget) HandleTime(ev *tcell.EventTime) { w.timeMap.Handle(ev) }
|
func (w *BufferWidget) HandleTime(ev *tcell.EventTime) { w.timeMap.Handle(ev) }
|
||||||
func (w *BufferWidget) Draw(screen tcell.Screen) { w.buffer.Draw(w.x, w.y, screen) }
|
func (w *BufferWidget) Draw(screen tcell.Screen) { w.buffer.Draw(w.x, w.y, screen) }
|
||||||
func (w *BufferWidget) Active() bool { return w.active }
|
|
||||||
func (w *BufferWidget) SetActive(a bool) { w.active = a }
|
func (w *BufferWidget) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *BufferWidget) Visible() bool { return w.visible }
|
func (w *BufferWidget) Active() bool { return w.active }
|
||||||
func (w *BufferWidget) SetVisible(a bool) { w.visible = a }
|
func (w *BufferWidget) SetActive(a bool) bool {
|
||||||
func (w *BufferWidget) Focusable() bool { return w.focusable }
|
w.active = a
|
||||||
func (w *BufferWidget) SetFocusable(b bool) { w.focusable = b }
|
return w.active
|
||||||
func (w *BufferWidget) SetX(x int) { w.x = x }
|
}
|
||||||
func (w *BufferWidget) SetY(y int) { w.y = y }
|
func (w *BufferWidget) Visible() bool { return w.visible }
|
||||||
func (w *BufferWidget) GetX() int { return w.x }
|
func (w *BufferWidget) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *BufferWidget) GetY() int { return w.y }
|
func (w *BufferWidget) Focusable() bool { return w.focusable }
|
||||||
func (w *BufferWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
func (w *BufferWidget) SetFocusable(b bool) { w.focusable = b }
|
||||||
func (w *BufferWidget) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
func (w *BufferWidget) SetX(x int) { w.x = x }
|
||||||
func (w *BufferWidget) GetW() int { return w.buffer.Width() }
|
func (w *BufferWidget) SetY(y int) { w.y = y }
|
||||||
func (w *BufferWidget) GetH() int { return w.buffer.Height() }
|
func (w *BufferWidget) GetX() int { return w.x }
|
||||||
func (w *BufferWidget) SetW(wd int) { w.w = wd }
|
func (w *BufferWidget) GetY() int { return w.y }
|
||||||
func (w *BufferWidget) SetH(h int) { w.h = h }
|
func (w *BufferWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||||
func (w *BufferWidget) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
func (w *BufferWidget) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||||
|
func (w *BufferWidget) GetW() int { return w.buffer.Width() }
|
||||||
|
func (w *BufferWidget) GetH() int { return w.buffer.Height() }
|
||||||
|
func (w *BufferWidget) SetW(wd int) { w.w = wd }
|
||||||
|
func (w *BufferWidget) SetH(h int) { w.h = h }
|
||||||
|
func (w *BufferWidget) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||||
|
|
||||||
func (w *BufferWidget) WantW() int { return w.buffer.Width() }
|
func (w *BufferWidget) WantW() int { return w.buffer.Width() }
|
||||||
func (w *BufferWidget) WantH() int { return w.buffer.Height() }
|
func (w *BufferWidget) WantH() int { return w.buffer.Height() }
|
||||||
|
|||||||
@@ -119,8 +119,12 @@ func (w *Button) Draw(screen tcell.Screen) {
|
|||||||
wh.DrawText(w.x, w.y+2, fmt.Sprintf("╰%s╯", strings.Repeat("─", w.w-2)), dStyle, screen)
|
wh.DrawText(w.x, w.y+2, fmt.Sprintf("╰%s╯", strings.Repeat("─", w.w-2)), dStyle, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Button) Active() bool { return w.active }
|
func (w *Button) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Button) SetActive(a bool) { w.active = a }
|
func (w *Button) Active() bool { return w.active }
|
||||||
|
func (w *Button) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Button) Visible() bool { return w.visible }
|
func (w *Button) Visible() bool { return w.visible }
|
||||||
func (w *Button) SetVisible(a bool) { w.visible = a }
|
func (w *Button) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Button) SetX(x int) { w.x = x }
|
func (w *Button) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -158,8 +158,12 @@ func (w *Chat) Draw(screen tcell.Screen) {
|
|||||||
// x += len(post) - 1
|
// x += len(post) - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Chat) Active() bool { return w.active }
|
func (w *Chat) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Chat) SetActive(a bool) { w.active = a }
|
func (w *Chat) Active() bool { return w.active }
|
||||||
|
func (w *Chat) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Chat) Visible() bool { return w.visible }
|
func (w *Chat) Visible() bool { return w.visible }
|
||||||
func (w *Chat) SetVisible(a bool) { w.visible = a }
|
func (w *Chat) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Chat) Focusable() bool { return w.focusable }
|
func (w *Chat) Focusable() bool { return w.focusable }
|
||||||
|
|||||||
@@ -92,8 +92,12 @@ func (w *Checkbox) Draw(screen tcell.Screen) {
|
|||||||
wh.DrawText(w.x, w.y, fmt.Sprintf("[%s] %s", string(w.stateRunes[w.state]), w.label), dStyle, screen)
|
wh.DrawText(w.x, w.y, fmt.Sprintf("[%s] %s", string(w.stateRunes[w.state]), w.label), dStyle, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Checkbox) Active() bool { return w.active }
|
func (w *Checkbox) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Checkbox) SetActive(a bool) { w.active = a }
|
func (w *Checkbox) Active() bool { return w.active }
|
||||||
|
func (w *Checkbox) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Checkbox) Visible() bool { return w.visible }
|
func (w *Checkbox) Visible() bool { return w.visible }
|
||||||
func (w *Checkbox) SetVisible(a bool) { w.visible = a }
|
func (w *Checkbox) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Checkbox) SetX(x int) { w.x = x }
|
func (w *Checkbox) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -172,8 +172,12 @@ func (w *Cli) Draw(screen tcell.Screen) {
|
|||||||
wh.DrawText(x, y, wh.PadR(post, w.w-x-2), dStyle, screen)
|
wh.DrawText(x, y, wh.PadR(post, w.w-x-2), dStyle, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Cli) Active() bool { return w.active }
|
func (w *Cli) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Cli) SetActive(a bool) { w.active = a }
|
func (w *Cli) Active() bool { return w.active }
|
||||||
|
func (w *Cli) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Cli) Visible() bool { return w.visible }
|
func (w *Cli) Visible() bool { return w.visible }
|
||||||
func (w *Cli) SetVisible(a bool) { w.visible = a }
|
func (w *Cli) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Cli) Focusable() bool { return true }
|
func (w *Cli) Focusable() bool { return true }
|
||||||
|
|||||||
@@ -129,13 +129,15 @@ func (w *DatePicker) Draw(screen tcell.Screen) {
|
|||||||
w.GetPos().DrawOffset(w.dateNow, screen)
|
w.GetPos().DrawOffset(w.dateNow, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *DatePicker) Active() bool { return w.active }
|
func (w *DatePicker) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *DatePicker) SetActive(a bool) {
|
func (w *DatePicker) Active() bool { return w.active }
|
||||||
|
func (w *DatePicker) SetActive(a bool) bool {
|
||||||
if !w.active && a {
|
if !w.active && a {
|
||||||
// Wasn't active, but turning on
|
// Wasn't active, but turning on
|
||||||
w.dateFld.SetActive(true)
|
w.dateFld.SetActive(true)
|
||||||
}
|
}
|
||||||
w.active = a
|
w.active = a
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *DatePicker) Visible() bool { return w.visible }
|
func (w *DatePicker) Visible() bool { return w.visible }
|
||||||
func (w *DatePicker) SetVisible(a bool) { w.visible = a }
|
func (w *DatePicker) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -165,10 +165,11 @@ func (w *DebugWidget) Draw(screen tcell.Screen) {
|
|||||||
w.GetPos().DrawOffset(w.widget, screen)
|
w.GetPos().DrawOffset(w.widget, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *DebugWidget) Active() bool { return w.active }
|
func (w *DebugWidget) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *DebugWidget) SetActive(a bool) {
|
func (w *DebugWidget) Active() bool { return w.active }
|
||||||
|
func (w *DebugWidget) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
w.widget.SetActive(a)
|
return w.widget.SetActive(a)
|
||||||
}
|
}
|
||||||
func (w *DebugWidget) Visible() bool { return w.visible }
|
func (w *DebugWidget) Visible() bool { return w.visible }
|
||||||
func (w *DebugWidget) SetVisible(a bool) { w.visible = a }
|
func (w *DebugWidget) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -155,8 +155,12 @@ func (w *Field) Draw(screen tcell.Screen) {
|
|||||||
wh.DrawText(x, w.y, post, valueStyle, screen)
|
wh.DrawText(x, w.y, post, valueStyle, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Field) Active() bool { return w.active }
|
func (w *Field) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Field) SetActive(a bool) { w.active = a }
|
func (w *Field) Active() bool { return w.active }
|
||||||
|
func (w *Field) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Field) Visible() bool { return w.visible }
|
func (w *Field) Visible() bool { return w.visible }
|
||||||
func (w *Field) SetVisible(a bool) { w.visible = a }
|
func (w *Field) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Field) SetX(x int) { w.x = x }
|
func (w *Field) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -121,8 +121,12 @@ func (w *FilePicker) Draw(screen tcell.Screen) {
|
|||||||
p.DrawOffset(w.btnSelect, screen)
|
p.DrawOffset(w.btnSelect, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *FilePicker) Active() bool { return w.active }
|
func (w *FilePicker) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *FilePicker) SetActive(a bool) { w.active = a }
|
func (w *FilePicker) Active() bool { return w.active }
|
||||||
|
func (w *FilePicker) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *FilePicker) Visible() bool { return w.visible }
|
func (w *FilePicker) Visible() bool { return w.visible }
|
||||||
func (w *FilePicker) SetVisible(a bool) { w.visible = a }
|
func (w *FilePicker) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *FilePicker) SetX(x int) { w.x = x }
|
func (w *FilePicker) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -146,10 +146,12 @@ func (w *Form) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Form) Active() bool { return w.active }
|
func (w *Form) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Form) SetActive(a bool) {
|
func (w *Form) Active() bool { return w.active }
|
||||||
|
func (w *Form) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
w.updateWidgets()
|
w.updateWidgets()
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *Form) Visible() bool { return w.visible }
|
func (w *Form) Visible() bool { return w.visible }
|
||||||
func (w *Form) SetVisible(a bool) { w.visible = a }
|
func (w *Form) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ type LinearLayout struct {
|
|||||||
|
|
||||||
active bool
|
active bool
|
||||||
visible bool
|
visible bool
|
||||||
focusable bool
|
|
||||||
disableTab bool
|
disableTab bool
|
||||||
insetBorder bool
|
insetBorder bool
|
||||||
|
|
||||||
@@ -80,7 +79,6 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
|
|||||||
w.id = id
|
w.id = id
|
||||||
w.style = s
|
w.style = s
|
||||||
w.visible = true
|
w.visible = true
|
||||||
w.focusable = true
|
|
||||||
w.defFlags = LayoutFlag(LFAlignHCenter | LFAlignVCenter)
|
w.defFlags = LayoutFlag(LFAlignHCenter | LFAlignVCenter)
|
||||||
w.layoutFlags = make(map[Widget]LayoutFlag)
|
w.layoutFlags = make(map[Widget]LayoutFlag)
|
||||||
w.layoutWeights = make(map[Widget]int)
|
w.layoutWeights = make(map[Widget]int)
|
||||||
@@ -89,8 +87,7 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
|
|||||||
if active == nil && len(w.widgets) > 0 {
|
if active == nil && len(w.widgets) > 0 {
|
||||||
// No widget is active, but we do have some
|
// No widget is active, but we do have some
|
||||||
for i := range w.widgets {
|
for i := range w.widgets {
|
||||||
if w.widgets[i].Focusable() {
|
if w.widgets[i].SetActive(true) {
|
||||||
w.widgets[i].SetActive(true)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,8 +100,7 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
|
|||||||
if active == nil && len(w.widgets) > 0 {
|
if active == nil && len(w.widgets) > 0 {
|
||||||
// No widget is active, but we do have some
|
// No widget is active, but we do have some
|
||||||
for i := len(w.widgets) - 1; i >= 0; i-- {
|
for i := len(w.widgets) - 1; i >= 0; i-- {
|
||||||
if w.widgets[i].Focusable() {
|
if w.widgets[i].SetActive(true) {
|
||||||
w.widgets[i].SetActive(true)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,8 +156,9 @@ func (w *LinearLayout) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *LinearLayout) Active() bool { return w.active }
|
func (w *LinearLayout) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *LinearLayout) SetActive(a bool) {
|
func (w *LinearLayout) Active() bool { return w.active }
|
||||||
|
func (w *LinearLayout) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
if w.active {
|
if w.active {
|
||||||
act := w.findActiveOrFirst()
|
act := w.findActiveOrFirst()
|
||||||
@@ -169,23 +166,22 @@ func (w *LinearLayout) SetActive(a bool) {
|
|||||||
act.SetActive(true)
|
act.SetActive(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *LinearLayout) Visible() bool { return w.visible }
|
func (w *LinearLayout) Visible() bool { return w.visible }
|
||||||
func (w *LinearLayout) SetVisible(a bool) { w.visible = a }
|
func (w *LinearLayout) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *LinearLayout) Focusable() bool { return w.focusable }
|
func (w *LinearLayout) SetX(x int) { w.x = x }
|
||||||
func (w *LinearLayout) SetFocusable(b bool) { w.focusable = b }
|
func (w *LinearLayout) SetY(y int) { w.y = y }
|
||||||
func (w *LinearLayout) SetX(x int) { w.x = x }
|
func (w *LinearLayout) GetX() int { return w.x }
|
||||||
func (w *LinearLayout) SetY(y int) { w.y = y }
|
func (w *LinearLayout) GetY() int { return w.y }
|
||||||
func (w *LinearLayout) GetX() int { return w.x }
|
func (w *LinearLayout) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||||
func (w *LinearLayout) GetY() int { return w.y }
|
func (w *LinearLayout) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
||||||
func (w *LinearLayout) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
func (w *LinearLayout) GetW() int { return w.w }
|
||||||
func (w *LinearLayout) SetPos(c Coord) { w.x, w.y = c.X, c.Y }
|
func (w *LinearLayout) GetH() int { return w.h }
|
||||||
func (w *LinearLayout) GetW() int { return w.w }
|
func (w *LinearLayout) SetW(wd int) { w.w = wd }
|
||||||
func (w *LinearLayout) GetH() int { return w.h }
|
func (w *LinearLayout) SetH(h int) { w.h = h }
|
||||||
func (w *LinearLayout) SetW(wd int) { w.w = wd }
|
func (w *LinearLayout) getSize() Coord { return Coord{X: w.w, Y: w.h} }
|
||||||
func (w *LinearLayout) SetH(h int) { w.h = h }
|
func (w *LinearLayout) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
||||||
func (w *LinearLayout) getSize() Coord { return Coord{X: w.w, Y: w.h} }
|
|
||||||
func (w *LinearLayout) SetSize(c Coord) { w.w, w.h = c.X, c.Y }
|
|
||||||
func (w *LinearLayout) WantW() int {
|
func (w *LinearLayout) WantW() int {
|
||||||
var wantW int
|
var wantW int
|
||||||
for _, wd := range w.widgets {
|
for _, wd := range w.widgets {
|
||||||
|
|||||||
@@ -224,8 +224,13 @@ func (w *Menu) drawVMenu(screen tcell.Screen) {
|
|||||||
y++
|
y++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (w *Menu) Active() bool { return w.active }
|
|
||||||
func (w *Menu) SetActive(a bool) { w.active = a }
|
func (w *Menu) SetStyle(s tcell.Style) { w.style = s }
|
||||||
|
func (w *Menu) Active() bool { return w.active }
|
||||||
|
func (w *Menu) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Menu) Visible() bool { return w.visible }
|
func (w *Menu) Visible() bool { return w.visible }
|
||||||
func (w *Menu) SetVisible(a bool) { w.visible = a }
|
func (w *Menu) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Menu) SetX(x int) { w.x = x }
|
func (w *Menu) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -197,12 +197,14 @@ func (w *MenuItem) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *MenuItem) Active() bool { return w.active }
|
func (w *MenuItem) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *MenuItem) SetActive(a bool) {
|
func (w *MenuItem) Active() bool { return w.active }
|
||||||
|
func (w *MenuItem) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
if !w.manualExpand {
|
if !w.manualExpand {
|
||||||
w.expanded = a
|
w.expanded = a
|
||||||
}
|
}
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *MenuItem) Visible() bool { return w.visible }
|
func (w *MenuItem) Visible() bool { return w.visible }
|
||||||
func (w *MenuItem) SetVisible(a bool) { w.visible = a }
|
func (w *MenuItem) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -114,8 +114,12 @@ func (w *Prompt) Draw(screen tcell.Screen) {
|
|||||||
w.GetPos().DrawOffset(w.btnCancel, screen)
|
w.GetPos().DrawOffset(w.btnCancel, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Prompt) Active() bool { return w.active }
|
func (w *Prompt) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Prompt) SetActive(a bool) { w.active = a }
|
func (w *Prompt) Active() bool { return w.active }
|
||||||
|
func (w *Prompt) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Prompt) Visible() bool { return w.visible }
|
func (w *Prompt) Visible() bool { return w.visible }
|
||||||
func (w *Prompt) SetVisible(a bool) { w.visible = a }
|
func (w *Prompt) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Prompt) SetX(x int) { w.x = x }
|
func (w *Prompt) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -112,8 +112,12 @@ func (w *RelativeLayout) Draw(screen tcell.Screen) {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *RelativeLayout) Active() bool { return w.active }
|
func (w *RelativeLayout) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *RelativeLayout) SetActive(a bool) { w.active = a }
|
func (w *RelativeLayout) Active() bool { return w.active }
|
||||||
|
func (w *RelativeLayout) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *RelativeLayout) Visible() bool { return w.visible }
|
func (w *RelativeLayout) Visible() bool { return w.visible }
|
||||||
func (w *RelativeLayout) SetVisible(a bool) { w.visible = a }
|
func (w *RelativeLayout) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *RelativeLayout) Focusable() bool { return w.focusable }
|
func (w *RelativeLayout) Focusable() bool { return w.focusable }
|
||||||
|
|||||||
@@ -257,10 +257,12 @@ func (w *Searcher) buildBuffer() {
|
|||||||
w.buffer = b
|
w.buffer = b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Searcher) Active() bool { return w.active }
|
func (w *Searcher) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Searcher) SetActive(a bool) {
|
func (w *Searcher) Active() bool { return w.active }
|
||||||
|
func (w *Searcher) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
w.search.SetActive(a)
|
w.search.SetActive(a)
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *Searcher) Visible() bool { return w.visible }
|
func (w *Searcher) Visible() bool { return w.visible }
|
||||||
func (w *Searcher) SetVisible(a bool) { w.visible = a }
|
func (w *Searcher) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -46,24 +46,25 @@ func (w *ShrinkWrap) HandleKey(ev *tcell.EventKey) bool { return w.widget.Handle
|
|||||||
func (w *ShrinkWrap) HandleTime(ev *tcell.EventTime) { w.widget.HandleTime(ev) }
|
func (w *ShrinkWrap) HandleTime(ev *tcell.EventTime) { w.widget.HandleTime(ev) }
|
||||||
func (w *ShrinkWrap) Draw(screen tcell.Screen) { w.widget.Draw(screen) }
|
func (w *ShrinkWrap) Draw(screen tcell.Screen) { w.widget.Draw(screen) }
|
||||||
|
|
||||||
func (w *ShrinkWrap) Active() bool { return w.widget.Active() }
|
func (w *ShrinkWrap) SetStyle(s tcell.Style) { w.widget.SetStyle(s) }
|
||||||
func (w *ShrinkWrap) SetActive(a bool) { w.widget.SetActive(a) }
|
func (w *ShrinkWrap) Active() bool { return w.widget.Active() }
|
||||||
func (w *ShrinkWrap) Visible() bool { return w.widget.Visible() }
|
func (w *ShrinkWrap) SetActive(a bool) bool {
|
||||||
func (w *ShrinkWrap) SetVisible(v bool) { w.widget.SetVisible(v) }
|
return w.widget.SetActive(a)
|
||||||
func (w *ShrinkWrap) Focusable() bool { return w.widget.Focusable() }
|
}
|
||||||
func (w *ShrinkWrap) SetFocusable(t bool) { w.widget.SetFocusable(t) }
|
func (w *ShrinkWrap) Visible() bool { return w.widget.Visible() }
|
||||||
func (w *ShrinkWrap) SetX(x int) { w.widget.SetX(x) }
|
func (w *ShrinkWrap) SetVisible(v bool) { w.widget.SetVisible(v) }
|
||||||
func (w *ShrinkWrap) SetY(y int) { w.widget.SetY(y) }
|
func (w *ShrinkWrap) SetX(x int) { w.widget.SetX(x) }
|
||||||
func (w *ShrinkWrap) GetX() int { return w.widget.GetX() }
|
func (w *ShrinkWrap) SetY(y int) { w.widget.SetY(y) }
|
||||||
func (w *ShrinkWrap) GetY() int { return w.widget.GetY() }
|
func (w *ShrinkWrap) GetX() int { return w.widget.GetX() }
|
||||||
func (w *ShrinkWrap) GetPos() Coord { return w.widget.GetPos() }
|
func (w *ShrinkWrap) GetY() int { return w.widget.GetY() }
|
||||||
func (w *ShrinkWrap) SetPos(pos Coord) { w.widget.SetPos(pos) }
|
func (w *ShrinkWrap) GetPos() Coord { return w.widget.GetPos() }
|
||||||
func (w *ShrinkWrap) SetSize(size Coord) { w.widget.SetSize(size) }
|
func (w *ShrinkWrap) SetPos(pos Coord) { w.widget.SetPos(pos) }
|
||||||
func (w *ShrinkWrap) SetW(wd int) { w.widget.SetW(wd) }
|
func (w *ShrinkWrap) SetSize(size Coord) { w.widget.SetSize(size) }
|
||||||
func (w *ShrinkWrap) SetH(h int) { w.widget.SetH(h) }
|
func (w *ShrinkWrap) SetW(wd int) { w.widget.SetW(wd) }
|
||||||
func (w *ShrinkWrap) GetW() int { return w.widget.GetW() }
|
func (w *ShrinkWrap) SetH(h int) { w.widget.SetH(h) }
|
||||||
func (w *ShrinkWrap) GetH() int { return w.widget.GetH() }
|
func (w *ShrinkWrap) GetW() int { return w.widget.GetW() }
|
||||||
func (w *ShrinkWrap) WantW() int { return w.widget.MinW() }
|
func (w *ShrinkWrap) GetH() int { return w.widget.GetH() }
|
||||||
func (w *ShrinkWrap) WantH() int { return w.widget.MinH() }
|
func (w *ShrinkWrap) WantW() int { return w.widget.MinW() }
|
||||||
func (w *ShrinkWrap) MinW() int { return w.widget.MinW() }
|
func (w *ShrinkWrap) WantH() int { return w.widget.MinH() }
|
||||||
func (w *ShrinkWrap) MinH() int { return w.widget.MinH() }
|
func (w *ShrinkWrap) MinW() int { return w.widget.MinW() }
|
||||||
|
func (w *ShrinkWrap) MinH() int { return w.widget.MinH() }
|
||||||
|
|||||||
@@ -185,8 +185,12 @@ func (w *SimpleList) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *SimpleList) Active() bool { return w.active }
|
func (w *SimpleList) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *SimpleList) SetActive(a bool) { w.active = a }
|
func (w *SimpleList) Active() bool { return w.active }
|
||||||
|
func (w *SimpleList) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *SimpleList) Visible() bool { return w.visible }
|
func (w *SimpleList) Visible() bool { return w.visible }
|
||||||
func (w *SimpleList) SetVisible(a bool) { w.visible = a }
|
func (w *SimpleList) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *SimpleList) SetX(x int) { w.x = x }
|
func (w *SimpleList) SetX(x int) { w.x = x }
|
||||||
@@ -226,6 +230,12 @@ func (w *SimpleList) MinW() int {
|
|||||||
|
|
||||||
func (w *SimpleList) MinH() int { return 4 }
|
func (w *SimpleList) MinH() int { return 4 }
|
||||||
|
|
||||||
|
func (w *SimpleList) getItemAt(idx int) {
|
||||||
|
for idx >= len(w.list) {
|
||||||
|
idx--
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
func (w *SimpleList) SetCursorWrap(b bool) { w.cursorWrap = b }
|
func (w *SimpleList) SetCursorWrap(b bool) { w.cursorWrap = b }
|
||||||
func (w *SimpleList) MoveUp() bool {
|
func (w *SimpleList) MoveUp() bool {
|
||||||
if w.cursor > 0 {
|
if w.cursor > 0 {
|
||||||
@@ -327,7 +337,12 @@ func (w *SimpleList) SetItem(idx int, txt string) {
|
|||||||
w.list[idx] = txt
|
w.list[idx] = txt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (w *SimpleList) SelectedIndex() int { return w.cursor }
|
func (w *SimpleList) SelectedIndex() int {
|
||||||
|
if w.cursor >= len(w.list) {
|
||||||
|
w.cursor = len(w.list) - 1
|
||||||
|
}
|
||||||
|
return w.cursor
|
||||||
|
}
|
||||||
func (w *SimpleList) SetSelectedIndex(i int) {
|
func (w *SimpleList) SetSelectedIndex(i int) {
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
i = 0
|
i = 0
|
||||||
@@ -349,6 +364,11 @@ func (w *SimpleList) Log(txt string, args ...any) {
|
|||||||
|
|
||||||
func (w *SimpleList) SetOnChange(c func(int, string) bool) { w.onChange = c }
|
func (w *SimpleList) SetOnChange(c func(int, string) bool) { w.onChange = c }
|
||||||
|
|
||||||
func (w *SimpleList) GetSelectedItem() string { return w.list[w.cursor] }
|
func (w *SimpleList) GetSelectedItem() string {
|
||||||
|
if w.cursor >= len(w.list) {
|
||||||
|
w.cursor = len(w.list) - 1
|
||||||
|
}
|
||||||
|
return w.list[w.cursor]
|
||||||
|
}
|
||||||
func (w *SimpleList) GetAllItems() []string { return w.list }
|
func (w *SimpleList) GetAllItems() []string { return w.list }
|
||||||
func (w *SimpleList) GetAllItemStyles() map[int]tcell.Style { return w.itemsStyle }
|
func (w *SimpleList) GetAllItemStyles() map[int]tcell.Style { return w.itemsStyle }
|
||||||
|
|||||||
@@ -84,10 +84,11 @@ func (w *SimpleListWithHelp) Draw(screen tcell.Screen) {
|
|||||||
w.GetPos().DrawOffset(w.help, screen)
|
w.GetPos().DrawOffset(w.help, screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *SimpleListWithHelp) Active() bool { return w.list.Active() }
|
func (w *SimpleListWithHelp) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *SimpleListWithHelp) SetActive(a bool) {
|
func (w *SimpleListWithHelp) Active() bool { return w.list.Active() }
|
||||||
w.list.SetActive(a)
|
func (w *SimpleListWithHelp) SetActive(a bool) bool {
|
||||||
w.help.SetVisible(a)
|
w.help.SetVisible(a)
|
||||||
|
return w.list.SetActive(a)
|
||||||
}
|
}
|
||||||
func (w *SimpleListWithHelp) Visible() bool { return w.visible }
|
func (w *SimpleListWithHelp) Visible() bool { return w.visible }
|
||||||
func (w *SimpleListWithHelp) SetVisible(a bool) { w.visible = a }
|
func (w *SimpleListWithHelp) SetVisible(a bool) { w.visible = a }
|
||||||
@@ -78,27 +78,28 @@ func (w *Spinner) Draw(screen tcell.Screen) {
|
|||||||
screen.SetContent(w.x, w.y, w.frames[w.currentFrame], nil, w.style)
|
screen.SetContent(w.x, w.y, w.frames[w.currentFrame], nil, w.style)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Spinner) Active() bool { return false }
|
func (w *Spinner) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Spinner) SetActive(a bool) {}
|
func (w *Spinner) Active() bool { return false }
|
||||||
func (w *Spinner) Visible() bool { return w.visible }
|
func (w *Spinner) SetActive(a bool) bool { return false }
|
||||||
func (w *Spinner) SetVisible(v bool) { w.visible = v }
|
func (w *Spinner) Visible() bool { return w.visible }
|
||||||
func (w *Spinner) Focusable() bool { return false }
|
func (w *Spinner) SetVisible(v bool) { w.visible = v }
|
||||||
func (w *Spinner) SetFocusable(t bool) {}
|
func (w *Spinner) Focusable() bool { return false }
|
||||||
func (w *Spinner) SetX(x int) { w.x = x }
|
func (w *Spinner) SetFocusable(t bool) {}
|
||||||
func (w *Spinner) SetY(y int) { w.y = y }
|
func (w *Spinner) SetX(x int) { w.x = x }
|
||||||
func (w *Spinner) GetX() int { return w.x }
|
func (w *Spinner) SetY(y int) { w.y = y }
|
||||||
func (w *Spinner) GetY() int { return w.y }
|
func (w *Spinner) GetX() int { return w.x }
|
||||||
func (w *Spinner) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
func (w *Spinner) GetY() int { return w.y }
|
||||||
func (w *Spinner) SetPos(pos Coord) { w.x, w.y = pos.X, pos.Y }
|
func (w *Spinner) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
||||||
func (w *Spinner) SetSize(size Coord) {}
|
func (w *Spinner) SetPos(pos Coord) { w.x, w.y = pos.X, pos.Y }
|
||||||
func (w *Spinner) SetW(wd int) {}
|
func (w *Spinner) SetSize(size Coord) {}
|
||||||
func (w *Spinner) SetH(h int) {}
|
func (w *Spinner) SetW(wd int) {}
|
||||||
func (w *Spinner) GetW() int { return 1 }
|
func (w *Spinner) SetH(h int) {}
|
||||||
func (w *Spinner) GetH() int { return 1 }
|
func (w *Spinner) GetW() int { return 1 }
|
||||||
func (w *Spinner) WantW() int { return 1 }
|
func (w *Spinner) GetH() int { return 1 }
|
||||||
func (w *Spinner) WantH() int { return 1 }
|
func (w *Spinner) WantW() int { return 1 }
|
||||||
func (w *Spinner) MinW() int { return 1 }
|
func (w *Spinner) WantH() int { return 1 }
|
||||||
func (w *Spinner) MinH() int { return 1 }
|
func (w *Spinner) MinW() int { return 1 }
|
||||||
|
func (w *Spinner) MinH() int { return 1 }
|
||||||
|
|
||||||
func (w *Spinner) SetFrames(frames []rune) {
|
func (w *Spinner) SetFrames(frames []rune) {
|
||||||
w.frames = frames
|
w.frames = frames
|
||||||
|
|||||||
@@ -153,8 +153,9 @@ func (w *ScrollingWidgetList) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *ScrollingWidgetList) Active() bool { return w.active }
|
func (w *ScrollingWidgetList) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *ScrollingWidgetList) SetActive(a bool) {
|
func (w *ScrollingWidgetList) Active() bool { return w.active }
|
||||||
|
func (w *ScrollingWidgetList) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
if w.active {
|
if w.active {
|
||||||
act := w.findActiveOrFirst()
|
act := w.findActiveOrFirst()
|
||||||
@@ -162,6 +163,7 @@ func (w *ScrollingWidgetList) SetActive(a bool) {
|
|||||||
act.SetActive(true)
|
act.SetActive(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *ScrollingWidgetList) Visible() bool { return w.visible }
|
func (w *ScrollingWidgetList) Visible() bool { return w.visible }
|
||||||
func (w *ScrollingWidgetList) SetVisible(a bool) { w.visible = a }
|
func (w *ScrollingWidgetList) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -149,8 +149,12 @@ func (w *Table) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Table) Active() bool { return w.active }
|
func (w *Table) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Table) SetActive(a bool) { w.active = a }
|
func (w *Table) Active() bool { return w.active }
|
||||||
|
func (w *Table) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Table) Visible() bool { return w.visible }
|
func (w *Table) Visible() bool { return w.visible }
|
||||||
func (w *Table) SetVisible(a bool) { w.visible = a }
|
func (w *Table) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Table) SetX(x int) { w.x = x }
|
func (w *Table) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -82,8 +82,12 @@ func (w *Text) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Text) Active() bool { return w.active }
|
func (w *Text) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *Text) SetActive(a bool) { w.active = a }
|
func (w *Text) Active() bool { return w.active }
|
||||||
|
func (w *Text) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *Text) Visible() bool { return w.visible }
|
func (w *Text) Visible() bool { return w.visible }
|
||||||
func (w *Text) SetVisible(a bool) { w.visible = a }
|
func (w *Text) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *Text) SetX(x int) { w.x = x }
|
func (w *Text) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -181,8 +181,12 @@ func (w *TimeField) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *TimeField) Active() bool { return w.active }
|
func (w *TimeField) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *TimeField) SetActive(a bool) { w.active = a }
|
func (w *TimeField) Active() bool { return w.active }
|
||||||
|
func (w *TimeField) SetActive(a bool) bool {
|
||||||
|
w.active = a
|
||||||
|
return w.active
|
||||||
|
}
|
||||||
func (w *TimeField) Visible() bool { return w.visible }
|
func (w *TimeField) Visible() bool { return w.visible }
|
||||||
func (w *TimeField) SetVisible(a bool) { w.visible = a }
|
func (w *TimeField) SetVisible(a bool) { w.visible = a }
|
||||||
func (w *TimeField) SetX(x int) { w.x = x }
|
func (w *TimeField) SetX(x int) { w.x = x }
|
||||||
|
|||||||
@@ -158,12 +158,14 @@ func (w *TopMenuLayout) Draw(screen tcell.Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *TopMenuLayout) Active() bool { return w.active }
|
func (w *TopMenuLayout) SetStyle(s tcell.Style) { w.style = s }
|
||||||
func (w *TopMenuLayout) SetActive(a bool) {
|
func (w *TopMenuLayout) Active() bool { return w.active }
|
||||||
|
func (w *TopMenuLayout) SetActive(a bool) bool {
|
||||||
w.active = a
|
w.active = a
|
||||||
if w.widget != nil {
|
if w.widget != nil {
|
||||||
w.widget.SetActive(a)
|
w.widget.SetActive(a)
|
||||||
}
|
}
|
||||||
|
return w.active
|
||||||
}
|
}
|
||||||
func (w *TopMenuLayout) Visible() bool { return w.visible }
|
func (w *TopMenuLayout) Visible() bool { return w.visible }
|
||||||
func (w *TopMenuLayout) SetVisible(a bool) { w.visible = a }
|
func (w *TopMenuLayout) SetVisible(a bool) { w.visible = a }
|
||||||
|
|||||||
@@ -38,12 +38,11 @@ type Widget interface {
|
|||||||
SetKeyMap(km *KeyMap)
|
SetKeyMap(km *KeyMap)
|
||||||
|
|
||||||
Draw(tcell.Screen)
|
Draw(tcell.Screen)
|
||||||
|
SetStyle(tcell.Style)
|
||||||
Active() bool
|
Active() bool
|
||||||
SetActive(bool)
|
SetActive(bool) bool
|
||||||
Visible() bool
|
Visible() bool
|
||||||
SetVisible(bool)
|
SetVisible(bool)
|
||||||
Focusable() bool
|
|
||||||
SetFocusable(bool)
|
|
||||||
SetX(int)
|
SetX(int)
|
||||||
SetY(int)
|
SetY(int)
|
||||||
GetX() int
|
GetX() int
|
||||||
|
|||||||
Reference in New Issue
Block a user