preferences.go 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package fyne
  2. // Preferences describes the ways that an app can save and load user preferences
  3. type Preferences interface {
  4. // Bool looks up a bool value for the key
  5. Bool(key string) bool
  6. // BoolWithFallback looks up a bool value and returns the given fallback if not found
  7. BoolWithFallback(key string, fallback bool) bool
  8. // SetBool saves a bool value for the given key
  9. SetBool(key string, value bool)
  10. // BoolList looks up a list of bool values for the key
  11. //
  12. // Since: 2.4
  13. BoolList(key string) []bool
  14. // BoolListWithFallback looks up a list of bool values and returns the given fallback if not found
  15. //
  16. // Since: 2.4
  17. BoolListWithFallback(key string, fallback []bool) []bool
  18. // SetBoolList saves a list of bool values for the given key
  19. //
  20. // Since: 2.4
  21. SetBoolList(key string, value []bool)
  22. // Float looks up a float64 value for the key
  23. Float(key string) float64
  24. // FloatWithFallback looks up a float64 value and returns the given fallback if not found
  25. FloatWithFallback(key string, fallback float64) float64
  26. // SetFloat saves a float64 value for the given key
  27. SetFloat(key string, value float64)
  28. // FloatList looks up a list of float64 values for the key
  29. //
  30. // Since: 2.4
  31. FloatList(key string) []float64
  32. // FloatListWithFallback looks up a list of float64 values and returns the given fallback if not found
  33. //
  34. // Since: 2.4
  35. FloatListWithFallback(key string, fallback []float64) []float64
  36. // SetFloatList saves a list of float64 values for the given key
  37. //
  38. // Since: 2.4
  39. SetFloatList(key string, value []float64)
  40. // Int looks up an integer value for the key
  41. Int(key string) int
  42. // IntWithFallback looks up an integer value and returns the given fallback if not found
  43. IntWithFallback(key string, fallback int) int
  44. // SetInt saves an integer value for the given key
  45. SetInt(key string, value int)
  46. // IntList looks up a list of int values for the key
  47. //
  48. // Since: 2.4
  49. IntList(key string) []int
  50. // IntListWithFallback looks up a list of int values and returns the given fallback if not found
  51. //
  52. // Since: 2.4
  53. IntListWithFallback(key string, fallback []int) []int
  54. // SetIntList saves a list of string values for the given key
  55. //
  56. // Since: 2.4
  57. SetIntList(key string, value []int)
  58. // String looks up a string value for the key
  59. String(key string) string
  60. // StringWithFallback looks up a string value and returns the given fallback if not found
  61. StringWithFallback(key, fallback string) string
  62. // SetString saves a string value for the given key
  63. SetString(key string, value string)
  64. // StringList looks up a list of string values for the key
  65. //
  66. // Since: 2.4
  67. StringList(key string) []string
  68. // StringListWithFallback looks up a list of string values and returns the given fallback if not found
  69. //
  70. // Since: 2.4
  71. StringListWithFallback(key string, fallback []string) []string
  72. // SetStringList saves a list of string values for the given key
  73. //
  74. // Since: 2.4
  75. SetStringList(key string, value []string)
  76. // RemoveValue removes a value for the given key (not currently supported on iOS)
  77. RemoveValue(key string)
  78. // AddChangeListener allows code to be notified when some preferences change. This will fire on any update.
  79. AddChangeListener(func())
  80. // ChangeListeners returns a list of the known change listeners for this preference set.
  81. //
  82. // Since: 2.3
  83. ChangeListeners() []func()
  84. }