summaryrefslogtreecommitdiff
path: root/button.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-06-05 10:01:36 -0700
committerJeff Carr <[email protected]>2019-06-05 10:01:36 -0700
commitba93e331fdc2a7ec883ac2f9e954e60d99f24285 (patch)
tree9398cafef120a380722bdf84ec5bf6d9a005fe08 /button.go
parent224740b4b8f346eba159004c82ed54ce52c2adb2 (diff)
reimplement the color button
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'button.go')
-rw-r--r--button.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/button.go b/button.go
index bf36f23..24dcd49 100644
--- a/button.go
+++ b/button.go
@@ -88,3 +88,28 @@ func CreateFontButton(box *GuiBox, action string) *GuiButton {
})
return &newGB
}
+
+func CreateColorButton(box *GuiBox, custom func(*GuiButton), name string, values interface {}) *GuiButton {
+ // create a 'fake' button entry for the mouse clicks
+ var newCB GuiButton
+ newCB.Name = name
+ newCB.CB = ui.NewColorButton()
+ newCB.Box = box
+ newCB.Custom = custom
+ newCB.Values = values
+
+ Data.AllButtons = append(Data.AllButtons, &newCB)
+
+ newCB.CB.OnChanged(func (*ui.ColorButton) {
+ log.Println("ColorButton.OnChanged() START Color Button Click")
+ r, g, b, a := newCB.CB.Color()
+ log.Println("ColorButton.OnChanged() Color() =", r, g, b, a)
+ if (newCB.Custom != nil) {
+ newCB.Custom(&newCB)
+ } else if (Data.MouseClick != nil) {
+ Data.MouseClick(&newCB)
+ }
+ })
+ box.UiBox.Append(newCB.CB, false)
+ return &newCB
+}