diff options
| author | Jeff Carr <[email protected]> | 2019-06-05 10:01:36 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-06-05 10:01:36 -0700 |
| commit | ba93e331fdc2a7ec883ac2f9e954e60d99f24285 (patch) | |
| tree | 9398cafef120a380722bdf84ec5bf6d9a005fe08 /button.go | |
| parent | 224740b4b8f346eba159004c82ed54ce52c2adb2 (diff) | |
reimplement the color button
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'button.go')
| -rw-r--r-- | button.go | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 +} |
