Working on Layout Stuff
This commit is contained in:
@@ -328,6 +328,14 @@ func (w *LinearLayout) IndexOf(n Widget) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (w *LinearLayout) FindById(id string) Widget {
|
||||
for i := range w.widgets {
|
||||
if w.widgets[i].Id() == id {
|
||||
return w.widgets[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (w *LinearLayout) Contains(n Widget) bool {
|
||||
return w.IndexOf(n) >= 0
|
||||
}
|
||||
@@ -344,6 +352,13 @@ func (w *LinearLayout) Replace(n, with Widget) {
|
||||
w.layoutFlags[with], w.layoutWeights[with] = pFlags, pWeight
|
||||
}
|
||||
|
||||
func (w *LinearLayout) AddAll(n Widget, more ...Widget) {
|
||||
w.Add(n)
|
||||
for i := range more {
|
||||
w.Add(more[i])
|
||||
}
|
||||
}
|
||||
|
||||
func (w *LinearLayout) Add(n Widget) {
|
||||
if w.Contains(n) {
|
||||
// If the widget is already in the layout, move it to the end
|
||||
|
||||
Reference in New Issue
Block a user