| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647 |
- // auto-generated
- // **** THIS FILE IS AUTO-GENERATED, PLEASE DO NOT EDIT IT **** //
- package binding
- import (
- "bytes"
- "fyne.io/fyne/v2"
- )
- // Bool supports binding a bool value.
- //
- // Since: 2.0
- type Bool interface {
- DataItem
- Get() (bool, error)
- Set(bool) error
- }
- // ExternalBool supports binding a bool value to an external value.
- //
- // Since: 2.0
- type ExternalBool interface {
- Bool
- Reload() error
- }
- // NewBool returns a bindable bool value that is managed internally.
- //
- // Since: 2.0
- func NewBool() Bool {
- var blank bool = false
- return &boundBool{val: &blank}
- }
- // BindBool returns a new bindable value that controls the contents of the provided bool variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.0
- func BindBool(v *bool) ExternalBool {
- if v == nil {
- var blank bool = false
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalBool{}
- b.val = v
- b.old = *v
- return b
- }
- type boundBool struct {
- base
- val *bool
- }
- func (b *boundBool) Get() (bool, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return false, nil
- }
- return *b.val, nil
- }
- func (b *boundBool) Set(val bool) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if *b.val == val {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalBool struct {
- boundBool
- old bool
- }
- func (b *boundExternalBool) Set(val bool) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if b.old == val {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalBool) Reload() error {
- return b.Set(*b.val)
- }
- // Bytes supports binding a []byte value.
- //
- // Since: 2.2
- type Bytes interface {
- DataItem
- Get() ([]byte, error)
- Set([]byte) error
- }
- // ExternalBytes supports binding a []byte value to an external value.
- //
- // Since: 2.2
- type ExternalBytes interface {
- Bytes
- Reload() error
- }
- // NewBytes returns a bindable []byte value that is managed internally.
- //
- // Since: 2.2
- func NewBytes() Bytes {
- var blank []byte = nil
- return &boundBytes{val: &blank}
- }
- // BindBytes returns a new bindable value that controls the contents of the provided []byte variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.2
- func BindBytes(v *[]byte) ExternalBytes {
- if v == nil {
- var blank []byte = nil
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalBytes{}
- b.val = v
- b.old = *v
- return b
- }
- type boundBytes struct {
- base
- val *[]byte
- }
- func (b *boundBytes) Get() ([]byte, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return nil, nil
- }
- return *b.val, nil
- }
- func (b *boundBytes) Set(val []byte) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if bytes.Equal(*b.val, val) {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalBytes struct {
- boundBytes
- old []byte
- }
- func (b *boundExternalBytes) Set(val []byte) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if bytes.Equal(b.old, val) {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalBytes) Reload() error {
- return b.Set(*b.val)
- }
- // Float supports binding a float64 value.
- //
- // Since: 2.0
- type Float interface {
- DataItem
- Get() (float64, error)
- Set(float64) error
- }
- // ExternalFloat supports binding a float64 value to an external value.
- //
- // Since: 2.0
- type ExternalFloat interface {
- Float
- Reload() error
- }
- // NewFloat returns a bindable float64 value that is managed internally.
- //
- // Since: 2.0
- func NewFloat() Float {
- var blank float64 = 0.0
- return &boundFloat{val: &blank}
- }
- // BindFloat returns a new bindable value that controls the contents of the provided float64 variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.0
- func BindFloat(v *float64) ExternalFloat {
- if v == nil {
- var blank float64 = 0.0
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalFloat{}
- b.val = v
- b.old = *v
- return b
- }
- type boundFloat struct {
- base
- val *float64
- }
- func (b *boundFloat) Get() (float64, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return 0.0, nil
- }
- return *b.val, nil
- }
- func (b *boundFloat) Set(val float64) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if *b.val == val {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalFloat struct {
- boundFloat
- old float64
- }
- func (b *boundExternalFloat) Set(val float64) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if b.old == val {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalFloat) Reload() error {
- return b.Set(*b.val)
- }
- // Int supports binding a int value.
- //
- // Since: 2.0
- type Int interface {
- DataItem
- Get() (int, error)
- Set(int) error
- }
- // ExternalInt supports binding a int value to an external value.
- //
- // Since: 2.0
- type ExternalInt interface {
- Int
- Reload() error
- }
- // NewInt returns a bindable int value that is managed internally.
- //
- // Since: 2.0
- func NewInt() Int {
- var blank int = 0
- return &boundInt{val: &blank}
- }
- // BindInt returns a new bindable value that controls the contents of the provided int variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.0
- func BindInt(v *int) ExternalInt {
- if v == nil {
- var blank int = 0
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalInt{}
- b.val = v
- b.old = *v
- return b
- }
- type boundInt struct {
- base
- val *int
- }
- func (b *boundInt) Get() (int, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return 0, nil
- }
- return *b.val, nil
- }
- func (b *boundInt) Set(val int) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if *b.val == val {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalInt struct {
- boundInt
- old int
- }
- func (b *boundExternalInt) Set(val int) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if b.old == val {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalInt) Reload() error {
- return b.Set(*b.val)
- }
- // Rune supports binding a rune value.
- //
- // Since: 2.0
- type Rune interface {
- DataItem
- Get() (rune, error)
- Set(rune) error
- }
- // ExternalRune supports binding a rune value to an external value.
- //
- // Since: 2.0
- type ExternalRune interface {
- Rune
- Reload() error
- }
- // NewRune returns a bindable rune value that is managed internally.
- //
- // Since: 2.0
- func NewRune() Rune {
- var blank rune = rune(0)
- return &boundRune{val: &blank}
- }
- // BindRune returns a new bindable value that controls the contents of the provided rune variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.0
- func BindRune(v *rune) ExternalRune {
- if v == nil {
- var blank rune = rune(0)
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalRune{}
- b.val = v
- b.old = *v
- return b
- }
- type boundRune struct {
- base
- val *rune
- }
- func (b *boundRune) Get() (rune, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return rune(0), nil
- }
- return *b.val, nil
- }
- func (b *boundRune) Set(val rune) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if *b.val == val {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalRune struct {
- boundRune
- old rune
- }
- func (b *boundExternalRune) Set(val rune) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if b.old == val {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalRune) Reload() error {
- return b.Set(*b.val)
- }
- // String supports binding a string value.
- //
- // Since: 2.0
- type String interface {
- DataItem
- Get() (string, error)
- Set(string) error
- }
- // ExternalString supports binding a string value to an external value.
- //
- // Since: 2.0
- type ExternalString interface {
- String
- Reload() error
- }
- // NewString returns a bindable string value that is managed internally.
- //
- // Since: 2.0
- func NewString() String {
- var blank string = ""
- return &boundString{val: &blank}
- }
- // BindString returns a new bindable value that controls the contents of the provided string variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.0
- func BindString(v *string) ExternalString {
- if v == nil {
- var blank string = ""
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalString{}
- b.val = v
- b.old = *v
- return b
- }
- type boundString struct {
- base
- val *string
- }
- func (b *boundString) Get() (string, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return "", nil
- }
- return *b.val, nil
- }
- func (b *boundString) Set(val string) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if *b.val == val {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalString struct {
- boundString
- old string
- }
- func (b *boundExternalString) Set(val string) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if b.old == val {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalString) Reload() error {
- return b.Set(*b.val)
- }
- // URI supports binding a fyne.URI value.
- //
- // Since: 2.1
- type URI interface {
- DataItem
- Get() (fyne.URI, error)
- Set(fyne.URI) error
- }
- // ExternalURI supports binding a fyne.URI value to an external value.
- //
- // Since: 2.1
- type ExternalURI interface {
- URI
- Reload() error
- }
- // NewURI returns a bindable fyne.URI value that is managed internally.
- //
- // Since: 2.1
- func NewURI() URI {
- var blank fyne.URI = fyne.URI(nil)
- return &boundURI{val: &blank}
- }
- // BindURI returns a new bindable value that controls the contents of the provided fyne.URI variable.
- // If your code changes the content of the variable this refers to you should call Reload() to inform the bindings.
- //
- // Since: 2.1
- func BindURI(v *fyne.URI) ExternalURI {
- if v == nil {
- var blank fyne.URI = fyne.URI(nil)
- v = &blank // never allow a nil value pointer
- }
- b := &boundExternalURI{}
- b.val = v
- b.old = *v
- return b
- }
- type boundURI struct {
- base
- val *fyne.URI
- }
- func (b *boundURI) Get() (fyne.URI, error) {
- b.lock.RLock()
- defer b.lock.RUnlock()
- if b.val == nil {
- return fyne.URI(nil), nil
- }
- return *b.val, nil
- }
- func (b *boundURI) Set(val fyne.URI) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if compareURI(*b.val, val) {
- return nil
- }
- *b.val = val
- b.trigger()
- return nil
- }
- type boundExternalURI struct {
- boundURI
- old fyne.URI
- }
- func (b *boundExternalURI) Set(val fyne.URI) error {
- b.lock.Lock()
- defer b.lock.Unlock()
- if compareURI(b.old, val) {
- return nil
- }
- *b.val = val
- b.old = val
- b.trigger()
- return nil
- }
- func (b *boundExternalURI) Reload() error {
- return b.Set(*b.val)
- }
|