Files
AynaLivePlayer/gui/helper.go
aynakeya f926f15606 rewrite
2024-04-10 00:42:33 -07:00

42 lines
1014 B
Go

package gui
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
func newPaddedBoarder(top, bottom, left, right fyne.CanvasObject, objects ...fyne.CanvasObject) *fyne.Container {
return container.NewPadded(container.NewBorder(top, bottom, left, right, objects...))
}
func newLabelWithWrapping(text string, wrapping fyne.TextWrap) *widget.Label {
w := widget.NewLabel(text)
w.Wrapping = wrapping
return w
}
type ContextMenuButton struct {
widget.Button
menu *fyne.Menu
}
func (b *ContextMenuButton) Tapped(e *fyne.PointEvent) {
widget.ShowPopUpMenuAtPosition(b.menu, fyne.CurrentApp().Driver().CanvasForObject(b), e.AbsolutePosition)
}
func newContextMenuButton(label string, menu *fyne.Menu) *ContextMenuButton {
b := &ContextMenuButton{menu: menu}
b.Text = label
b.ExtendBaseWidget(b)
return b
}
func newCheckInit(name string, changed func(bool), checked bool) *widget.Check {
check := widget.NewCheck(name, changed)
check.SetChecked(checked)
return check
}