Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 46a87f913b | |||
| 5581cf14c1 |
@@ -58,7 +58,6 @@ func (w *BorderedWidget) Init(id string, s tcell.Style) {
|
||||
w.style = s
|
||||
w.widget.SetVisible(true)
|
||||
w.border = wh.BRD_CSIMPLE
|
||||
w.widget.SetFocusable(true)
|
||||
}
|
||||
|
||||
func (w *BorderedWidget) Id() string { return w.id }
|
||||
@@ -96,8 +95,6 @@ func (w *BorderedWidget) Active() bool { return w.widget.Active() }
|
||||
func (w *BorderedWidget) SetActive(a bool) bool { return w.widget.SetActive(a) }
|
||||
func (w *BorderedWidget) Visible() bool { return w.widget.Visible() }
|
||||
func (w *BorderedWidget) SetVisible(a bool) { w.SetVisible(a) }
|
||||
func (w *BorderedWidget) Focusable() bool { return w.widget.Focusable() }
|
||||
func (w *BorderedWidget) SetFocusable(b bool) { w.widget.SetFocusable(b) }
|
||||
func (w *BorderedWidget) SetX(x int) { w.x = x }
|
||||
func (w *BorderedWidget) SetY(y int) { w.y = y }
|
||||
func (w *BorderedWidget) GetX() int { return w.x }
|
||||
|
||||
@@ -148,9 +148,10 @@ func (w *Form) Draw(screen tcell.Screen) {
|
||||
|
||||
func (w *Form) SetStyle(s tcell.Style) { w.style = s }
|
||||
func (w *Form) Active() bool { return w.active }
|
||||
func (w *Form) SetActive(a bool) {
|
||||
func (w *Form) SetActive(a bool) bool {
|
||||
w.active = a
|
||||
w.updateWidgets()
|
||||
return w.active
|
||||
}
|
||||
func (w *Form) Visible() bool { return w.visible }
|
||||
func (w *Form) SetVisible(a bool) { w.visible = a }
|
||||
|
||||
@@ -52,7 +52,6 @@ type LinearLayout struct {
|
||||
|
||||
active bool
|
||||
visible bool
|
||||
focusable bool
|
||||
disableTab bool
|
||||
insetBorder bool
|
||||
|
||||
@@ -80,7 +79,6 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
|
||||
w.id = id
|
||||
w.style = s
|
||||
w.visible = true
|
||||
w.focusable = true
|
||||
w.defFlags = LayoutFlag(LFAlignHCenter | LFAlignVCenter)
|
||||
w.layoutFlags = make(map[Widget]LayoutFlag)
|
||||
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 {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
@@ -103,8 +100,7 @@ func (w *LinearLayout) 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
|
||||
}
|
||||
}
|
||||
@@ -174,8 +170,6 @@ func (w *LinearLayout) SetActive(a bool) bool {
|
||||
}
|
||||
func (w *LinearLayout) Visible() bool { return w.visible }
|
||||
func (w *LinearLayout) SetVisible(a bool) { w.visible = a }
|
||||
func (w *LinearLayout) Focusable() bool { return w.focusable }
|
||||
func (w *LinearLayout) SetFocusable(b bool) { w.focusable = b }
|
||||
func (w *LinearLayout) SetX(x int) { w.x = x }
|
||||
func (w *LinearLayout) SetY(y int) { w.y = y }
|
||||
func (w *LinearLayout) GetX() int { return w.x }
|
||||
@@ -291,8 +285,7 @@ func (w *LinearLayout) ActivateWidget(n Widget) {
|
||||
func (w *LinearLayout) 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
|
||||
@@ -305,8 +298,7 @@ func (w *LinearLayout) ActivateNext() bool {
|
||||
func (w *LinearLayout) 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
|
||||
|
||||
@@ -53,8 +53,6 @@ func (w *ShrinkWrap) SetActive(a bool) bool {
|
||||
}
|
||||
func (w *ShrinkWrap) Visible() bool { return w.widget.Visible() }
|
||||
func (w *ShrinkWrap) SetVisible(v bool) { w.widget.SetVisible(v) }
|
||||
func (w *ShrinkWrap) Focusable() bool { return w.widget.Focusable() }
|
||||
func (w *ShrinkWrap) SetFocusable(t bool) { w.widget.SetFocusable(t) }
|
||||
func (w *ShrinkWrap) SetX(x int) { w.widget.SetX(x) }
|
||||
func (w *ShrinkWrap) SetY(y int) { w.widget.SetY(y) }
|
||||
func (w *ShrinkWrap) GetX() int { return w.widget.GetX() }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user