18
swatch.go
18
swatch.go
@@ -36,6 +36,11 @@ func NewSwatch (value color.Color) *Swatch {
|
||||
return swatch
|
||||
}
|
||||
|
||||
// Value returns the color of the swatch.
|
||||
func (this *Swatch) Value () color.Color {
|
||||
return this.value
|
||||
}
|
||||
|
||||
// SetValue sets the color of the swatch.
|
||||
func (this *Swatch) SetValue (value color.Color) {
|
||||
this.value = value
|
||||
@@ -43,9 +48,10 @@ func (this *Swatch) SetValue (value color.Color) {
|
||||
this.Invalidate()
|
||||
}
|
||||
|
||||
// Value returns the color of the swatch.
|
||||
func (this *Swatch) Value () color.Color {
|
||||
return this.value
|
||||
// OnValueChange specifies a function to be called when the swatch's color
|
||||
// is changed by the user.
|
||||
func (this *Swatch) OnValueChange (callback func ()) event.Cookie {
|
||||
return this.on.valueChange.Connect(callback)
|
||||
}
|
||||
|
||||
// RGBA satisfies the color.Color interface
|
||||
@@ -54,12 +60,6 @@ func (this *Swatch) RGBA () (r, g, b, a uint32) {
|
||||
return this.value.RGBA()
|
||||
}
|
||||
|
||||
// OnValueChange specifies a function to be called when the swatch's color
|
||||
// is changed by the user.
|
||||
func (this *Swatch) OnValueChange (callback func ()) event.Cookie {
|
||||
return this.on.valueChange.Connect(callback)
|
||||
}
|
||||
|
||||
// OnEnter specifies a function to be called when the user selects "OK" in the
|
||||
// color picker.
|
||||
func (this *Swatch) OnEnter (callback func ()) event.Cookie {
|
||||
|
||||
Reference in New Issue
Block a user