Documentation ¶
Overview ¶
Package binding provides support for binding data to widgets.
Index ¶
- type Bool
- type BoolList
- type Bytes
- type BytesList
- type DataItem
- type DataList
- type DataListener
- type DataMap
- type ExternalBool
- type ExternalBoolList
- type ExternalBytes
- type ExternalBytesList
- type ExternalFloat
- type ExternalFloatList
- type ExternalInt
- type ExternalIntList
- type ExternalRune
- type ExternalRuneList
- type ExternalString
- type ExternalStringList
- type ExternalURI
- type ExternalURIList
- type ExternalUntyped
- type ExternalUntypedList
- type ExternalUntypedMap
- type Float
- type FloatList
- type Int
- type IntList
- type Rune
- type RuneList
- type String
- func BindPreferenceString(key string, p fyne.Preferences) String
- func BoolToString(v Bool) String
- func BoolToStringWithFormat(v Bool, format string) String
- func FloatToString(v Float) String
- func FloatToStringWithFormat(v Float, format string) String
- func IntToString(v Int) String
- func IntToStringWithFormat(v Int, format string) String
- func NewSprintf(format string, b ...DataItem) String
- func NewString() String
- func StringToStringWithFormat(str String, format string) String
- func URIToString(v URI) String
- type StringList
- type Struct
- type URI
- type URIList
- type Untyped
- type UntypedList
- type UntypedMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool supports binding a bool value.
Since: 2.0
func BindPreferenceBool ¶
BindPreferenceBool returns a bindable bool value that is managed by the application preferences. Changes to this value will be saved to application storage and when the app starts the previous values will be read.
Since: 2.0
func NewBool ¶
func NewBool() Bool
NewBool returns a bindable bool value that is managed internally.
Since: 2.0
func StringToBool ¶
StringToBool creates a binding that connects a String data item to a Bool. Changes to the String will be parsed and pushed to the Bool if the parse was successful, and setting the Bool update the String binding.
Since: 2.0
func StringToBoolWithFormat ¶
StringToBoolWithFormat creates a binding that connects a String data item to a Bool and is presented using the specified format. Changes to the Bool will be parsed and if the format matches and the parse is successful it will be pushed to the String. Setting the Bool will push a formatted value into the String.
Since: 2.0
type BoolList ¶
type BoolList interface { DataList Append(value bool) error Get() ([]bool, error) GetValue(index int) (bool, error) Prepend(value bool) error Set(list []bool) error SetValue(index int, value bool) error }
BoolList supports binding a list of bool values.
Since: 2.0
func NewBoolList ¶
func NewBoolList() BoolList
NewBoolList returns a bindable list of bool values.
Since: 2.0
type BytesList ¶
type BytesList interface { DataList Append(value []byte) error Get() ([][]byte, error) GetValue(index int) ([]byte, error) Prepend(value []byte) error Set(list [][]byte) error SetValue(index int, value []byte) error }
BytesList supports binding a list of []byte values.
Since: 2.2
func NewBytesList ¶
func NewBytesList() BytesList
NewBytesList returns a bindable list of []byte values.
Since: 2.2
type DataItem ¶
type DataItem interface { // AddListener attaches a new change listener to this DataItem. // Listeners are called each time the data inside this DataItem changes. // Additionally the listener will be triggered upon successful connection to get the current value. AddListener(DataListener) // RemoveListener will detach the specified change listener from the DataItem. // Disconnected listener will no longer be triggered when changes occur. RemoveListener(DataListener) }
DataItem is the base interface for all bindable data items.
Since: 2.0
type DataListener ¶
type DataListener interface {
DataChanged()
}
DataListener is any object that can register for changes in a bindable DataItem. See NewDataListener to define a new listener using just an inline function.
Since: 2.0
func NewDataListener ¶
func NewDataListener(fn func()) DataListener
NewDataListener is a helper function that creates a new listener type from a simple callback function.
Since: 2.0
type ExternalBool ¶
ExternalBool supports binding a bool value to an external value.
Since: 2.0
func BindBool ¶
func BindBool(v *bool) ExternalBool
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
type ExternalBoolList ¶
ExternalBoolList supports binding a list of bool values from an external variable.
Since: 2.0
func BindBoolList ¶
func BindBoolList(v *[]bool) ExternalBoolList
BindBoolList returns a bound list of bool values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.0
type ExternalBytes ¶
ExternalBytes supports binding a []byte value to an external value.
Since: 2.2
func BindBytes ¶
func BindBytes(v *[]byte) ExternalBytes
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
type ExternalBytesList ¶
ExternalBytesList supports binding a list of []byte values from an external variable.
Since: 2.2
func BindBytesList ¶
func BindBytesList(v *[][]byte) ExternalBytesList
BindBytesList returns a bound list of []byte values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.2
type ExternalFloat ¶
ExternalFloat supports binding a float64 value to an external value.
Since: 2.0
func BindFloat ¶
func BindFloat(v *float64) ExternalFloat
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
type ExternalFloatList ¶
ExternalFloatList supports binding a list of float64 values from an external variable.
Since: 2.0
func BindFloatList ¶
func BindFloatList(v *[]float64) ExternalFloatList
BindFloatList returns a bound list of float64 values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.0
type ExternalInt ¶
ExternalInt supports binding a int value to an external value.
Since: 2.0
func BindInt ¶
func BindInt(v *int) ExternalInt
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
type ExternalIntList ¶
ExternalIntList supports binding a list of int values from an external variable.
Since: 2.0
func BindIntList ¶
func BindIntList(v *[]int) ExternalIntList
BindIntList returns a bound list of int values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.0
type ExternalRune ¶
ExternalRune supports binding a rune value to an external value.
Since: 2.0
func BindRune ¶
func BindRune(v *rune) ExternalRune
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
type ExternalRuneList ¶
ExternalRuneList supports binding a list of rune values from an external variable.
Since: 2.0
func BindRuneList ¶
func BindRuneList(v *[]rune) ExternalRuneList
BindRuneList returns a bound list of rune values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.0
type ExternalString ¶
ExternalString supports binding a string value to an external value.
Since: 2.0
func BindString ¶
func BindString(v *string) ExternalString
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
type ExternalStringList ¶
type ExternalStringList interface { StringList Reload() error }
ExternalStringList supports binding a list of string values from an external variable.
Since: 2.0
func BindStringList ¶
func BindStringList(v *[]string) ExternalStringList
BindStringList returns a bound list of string values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.0
type ExternalURI ¶
ExternalURI supports binding a fyne.URI value to an external value.
Since: 2.1
func BindURI ¶
func BindURI(v *fyne.URI) ExternalURI
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
type ExternalURIList ¶
ExternalURIList supports binding a list of fyne.URI values from an external variable.
Since: 2.1
func BindURIList ¶
func BindURIList(v *[]fyne.URI) ExternalURIList
BindURIList returns a bound list of fyne.URI values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.1
type ExternalUntyped ¶
ExternalUntyped supports binding a interface{} value to an external value.
Since: 2.1
func BindUntyped ¶
func BindUntyped(v interface{}) ExternalUntyped
BindUntyped returns a bindable interface{} value that is bound to an external type. The parameter must be a pointer to the type you wish to bind.
Since: 2.1
type ExternalUntypedList ¶
type ExternalUntypedList interface { UntypedList Reload() error }
ExternalUntypedList supports binding a list of interface{} values from an external variable.
Since: 2.1
func BindUntypedList ¶
func BindUntypedList(v *[]interface{}) ExternalUntypedList
BindUntypedList returns a bound list of interface{} values, based on the contents of the passed slice. If your code changes the content of the slice this refers to you should call Reload() to inform the bindings.
Since: 2.1
type ExternalUntypedMap ¶
type ExternalUntypedMap interface { UntypedMap Reload() error }
ExternalUntypedMap is a map data binding with all values untyped (interface{}), connected to an external data source.
Since: 2.0
func BindUntypedMap ¶
func BindUntypedMap(d *map[string]interface{}) ExternalUntypedMap
BindUntypedMap creates a new map binding of string to interface{} based on the data passed. If your code changes the content of the map this refers to you should call Reload() to inform the bindings.
Since: 2.0
type Float ¶
Float supports binding a float64 value.
Since: 2.0
func BindPreferenceFloat ¶
BindPreferenceFloat returns a bindable float64 value that is managed by the application preferences. Changes to this value will be saved to application storage and when the app starts the previous values will be read.
Since: 2.0
func NewFloat ¶
func NewFloat() Float
NewFloat returns a bindable float64 value that is managed internally.
Since: 2.0
func StringToFloat ¶
StringToFloat creates a binding that connects a String data item to a Float. Changes to the String will be parsed and pushed to the Float if the parse was successful, and setting the Float update the String binding.
Since: 2.0
func StringToFloatWithFormat ¶
StringToFloatWithFormat creates a binding that connects a String data item to a Float and is presented using the specified format. Changes to the Float will be parsed and if the format matches and the parse is successful it will be pushed to the String. Setting the Float will push a formatted value into the String.
Since: 2.0
type FloatList ¶
type FloatList interface { DataList Append(value float64) error Get() ([]float64, error) GetValue(index int) (float64, error) Prepend(value float64) error Set(list []float64) error SetValue(index int, value float64) error }
FloatList supports binding a list of float64 values.
Since: 2.0
func NewFloatList ¶
func NewFloatList() FloatList
NewFloatList returns a bindable list of float64 values.
Since: 2.0
type Int ¶
Int supports binding a int value.
Since: 2.0
func BindPreferenceInt ¶
BindPreferenceInt returns a bindable int value that is managed by the application preferences. Changes to this value will be saved to application storage and when the app starts the previous values will be read.
Since: 2.0
func NewInt ¶
func NewInt() Int
NewInt returns a bindable int value that is managed internally.
Since: 2.0
func StringToInt ¶
StringToInt creates a binding that connects a String data item to a Int. Changes to the String will be parsed and pushed to the Int if the parse was successful, and setting the Int update the String binding.
Since: 2.0
func StringToIntWithFormat ¶
StringToIntWithFormat creates a binding that connects a String data item to a Int and is presented using the specified format. Changes to the Int will be parsed and if the format matches and the parse is successful it will be pushed to the String. Setting the Int will push a formatted value into the String.
Since: 2.0
type IntList ¶
type IntList interface { DataList Append(value int) error Get() ([]int, error) GetValue(index int) (int, error) Prepend(value int) error Set(list []int) error SetValue(index int, value int) error }
IntList supports binding a list of int values.
Since: 2.0
func NewIntList ¶
func NewIntList() IntList
NewIntList returns a bindable list of int values.
Since: 2.0
type RuneList ¶
type RuneList interface { DataList Append(value rune) error Get() ([]rune, error) GetValue(index int) (rune, error) Prepend(value rune) error Set(list []rune) error SetValue(index int, value rune) error }
RuneList supports binding a list of rune values.
Since: 2.0
func NewRuneList ¶
func NewRuneList() RuneList
NewRuneList returns a bindable list of rune values.
Since: 2.0
type String ¶
String supports binding a string value.
Since: 2.0
func BindPreferenceString ¶
BindPreferenceString returns a bindable string value that is managed by the application preferences. Changes to this value will be saved to application storage and when the app starts the previous values will be read.
Since: 2.0
func BoolToString ¶
BoolToString creates a binding that connects a Bool data item to a String. Changes to the Bool will be pushed to the String and setting the string will parse and set the Bool if the parse was successful.
Since: 2.0
func BoolToStringWithFormat ¶
BoolToStringWithFormat creates a binding that connects a Bool data item to a String and is presented using the specified format. Changes to the Bool will be pushed to the String and setting the string will parse and set the Bool if the string matches the format and its parse was successful.
Since: 2.0
func FloatToString ¶
FloatToString creates a binding that connects a Float data item to a String. Changes to the Float will be pushed to the String and setting the string will parse and set the Float if the parse was successful.
Since: 2.0
func FloatToStringWithFormat ¶
FloatToStringWithFormat creates a binding that connects a Float data item to a String and is presented using the specified format. Changes to the Float will be pushed to the String and setting the string will parse and set the Float if the string matches the format and its parse was successful.
Since: 2.0
func IntToString ¶
IntToString creates a binding that connects a Int data item to a String. Changes to the Int will be pushed to the String and setting the string will parse and set the Int if the parse was successful.
Since: 2.0
func IntToStringWithFormat ¶
IntToStringWithFormat creates a binding that connects a Int data item to a String and is presented using the specified format. Changes to the Int will be pushed to the String and setting the string will parse and set the Int if the string matches the format and its parse was successful.
Since: 2.0
func NewSprintf ¶
NewSprintf returns a String binding that format its content using the format string and the provide additional parameter that must be other data bindings. This data binding use fmt.Sprintf and fmt.Scanf internally and will have all the same limitation as those function.
Since: 2.2
func NewString ¶
func NewString() String
NewString returns a bindable string value that is managed internally.
Since: 2.0
func StringToStringWithFormat ¶
StringToStringWithFormat creates a binding that converts a string to another string using the specified format. Changes to the returned String will be pushed to the passed in String and setting a new string value will parse and set the underlying String if it matches the format and the parse was successful.
Since: 2.2
func URIToString ¶
URIToString creates a binding that connects a URI data item to a String. Changes to the URI will be pushed to the String and setting the string will parse and set the URI if the parse was successful.
Since: 2.1
type StringList ¶
type StringList interface { DataList Append(value string) error Get() ([]string, error) GetValue(index int) (string, error) Prepend(value string) error Set(list []string) error SetValue(index int, value string) error }
StringList supports binding a list of string values.
Since: 2.0
func NewStringList ¶
func NewStringList() StringList
NewStringList returns a bindable list of string values.
Since: 2.0
type Struct ¶
type Struct interface { DataMap GetValue(string) (interface{}, error) SetValue(string, interface{}) error Reload() error }
Struct is the base interface for a bound struct type.
Since: 2.0
func BindStruct ¶
func BindStruct(i interface{}) Struct
BindStruct creates a new map binding of string to interface{} using the struct passed as data. The key for each item is a string representation of each exported field with the value set as an interface{}. Only exported fields are included.
Since: 2.0
type URI ¶
URI supports binding a fyne.URI value.
Since: 2.1
func NewURI ¶
func NewURI() URI
NewURI returns a bindable fyne.URI value that is managed internally.
Since: 2.1
func StringToURI ¶
StringToURI creates a binding that connects a String data item to a URI. Changes to the String will be parsed and pushed to the URI if the parse was successful, and setting the URI update the String binding.
Since: 2.1
type URIList ¶
type URIList interface { DataList Append(value fyne.URI) error Get() ([]fyne.URI, error) GetValue(index int) (fyne.URI, error) Prepend(value fyne.URI) error Set(list []fyne.URI) error SetValue(index int, value fyne.URI) error }
URIList supports binding a list of fyne.URI values.
Since: 2.1
func NewURIList ¶
func NewURIList() URIList
NewURIList returns a bindable list of fyne.URI values.
Since: 2.1
type Untyped ¶
Untyped supports binding a interface{} value.
Since: 2.1
func NewUntyped ¶
func NewUntyped() Untyped
NewUntyped returns a bindable interface{} value that is managed internally.
Since: 2.1
type UntypedList ¶
type UntypedList interface { DataList Append(value interface{}) error Get() ([]interface{}, error) GetValue(index int) (interface{}, error) Prepend(value interface{}) error Set(list []interface{}) error SetValue(index int, value interface{}) error }
UntypedList supports binding a list of interface{} values.
Since: 2.1
func NewUntypedList ¶
func NewUntypedList() UntypedList
NewUntypedList returns a bindable list of interface{} values.
Since: 2.1
type UntypedMap ¶
type UntypedMap interface { DataMap Delete(string) Get() (map[string]interface{}, error) GetValue(string) (interface{}, error) Set(map[string]interface{}) error SetValue(string, interface{}) error }
UntypedMap is a map data binding with all values Untyped (interface{}).
Since: 2.0
func NewUntypedMap ¶
func NewUntypedMap() UntypedMap
NewUntypedMap creates a new, empty map binding of string to interface{}.
Since: 2.0