|
|
|
|
@@ -79,8 +79,7 @@ func (w *ScrollingWidgetList) Init(id string, s tcell.Style) {
|
|
|
|
|
if active == nil && len(w.widgets) > 0 {
|
|
|
|
|
// No widget is active, but we do have some
|
|
|
|
|
for i := range w.widgets {
|
|
|
|
|
if w.widgets[i].Focusable() {
|
|
|
|
|
w.widgets[i].SetActive(true)
|
|
|
|
|
if w.widgets[i].SetActive(true) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -93,8 +92,7 @@ func (w *ScrollingWidgetList) Init(id string, s tcell.Style) {
|
|
|
|
|
if active == nil && len(w.widgets) > 0 {
|
|
|
|
|
// No widget is active, but we do have some
|
|
|
|
|
for i := len(w.widgets) - 1; i >= 0; i-- {
|
|
|
|
|
if w.widgets[i].Focusable() {
|
|
|
|
|
w.widgets[i].SetActive(true)
|
|
|
|
|
if w.widgets[i].SetActive(true) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -167,8 +165,6 @@ func (w *ScrollingWidgetList) SetActive(a bool) bool {
|
|
|
|
|
}
|
|
|
|
|
func (w *ScrollingWidgetList) Visible() bool { return w.visible }
|
|
|
|
|
func (w *ScrollingWidgetList) SetVisible(a bool) { w.visible = a }
|
|
|
|
|
func (w *ScrollingWidgetList) Focusable() bool { return w.focusable }
|
|
|
|
|
func (w *ScrollingWidgetList) SetFocusable(b bool) { w.focusable = b }
|
|
|
|
|
func (w *ScrollingWidgetList) SetX(x int) { w.x = x }
|
|
|
|
|
func (w *ScrollingWidgetList) SetY(y int) { w.y = y }
|
|
|
|
|
func (w *ScrollingWidgetList) GetX() int { return w.x }
|
|
|
|
|
@@ -284,8 +280,7 @@ func (w *ScrollingWidgetList) ActivateWidget(n Widget) {
|
|
|
|
|
func (w *ScrollingWidgetList) ActivateNext() bool {
|
|
|
|
|
var found bool
|
|
|
|
|
for i := range w.widgets {
|
|
|
|
|
if found && w.widgets[i].Focusable() {
|
|
|
|
|
w.widgets[i].SetActive(true)
|
|
|
|
|
if found && w.widgets[i].SetActive(true) {
|
|
|
|
|
return true
|
|
|
|
|
} else if w.widgets[i].Active() {
|
|
|
|
|
found = true
|
|
|
|
|
@@ -298,8 +293,7 @@ func (w *ScrollingWidgetList) ActivateNext() bool {
|
|
|
|
|
func (w *ScrollingWidgetList) ActivatePrev() bool {
|
|
|
|
|
var found bool
|
|
|
|
|
for i := len(w.widgets) - 1; i >= 0; i-- {
|
|
|
|
|
if found && w.widgets[i].Focusable() {
|
|
|
|
|
w.widgets[i].SetActive(true)
|
|
|
|
|
if found && w.widgets[i].SetActive(true) {
|
|
|
|
|
return true
|
|
|
|
|
} else if w.widgets[i].Active() {
|
|
|
|
|
found = true
|
|
|
|
|
|