summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-06-02 20:51:26 -0700
committerJeff Carr <[email protected]>2019-06-02 20:51:26 -0700
commit52a7c95ca42eca86934bda14ffd20bd767ad552d (patch)
tree2e68c87c00dd51a1ac36f9913cb48d9a986032b9
parent1ae99628b59e24c666d48c0d6d9d604393912a7b (diff)
This might be stable enough to leave alone.
Up to this point it's been needing 10 patches a day. Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--button.go29
-rw-r--r--structs.go6
2 files changed, 4 insertions, 31 deletions
diff --git a/button.go b/button.go
index 0e23991..d605fd9 100644
--- a/button.go
+++ b/button.go
@@ -3,7 +3,6 @@ package gui
import "log"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
-import pb "git.wit.com/wit/witProtobuf"
// import "github.com/davecgh/go-spew/spew"
// This is the default mouse click handler
@@ -38,7 +37,7 @@ func defaultButtonClick(button *ui.Button) {
}
func guiButtonClick(button *GuiButton) {
- log.Println("\tgui.guiButtonClick() button.Action =", button.Action)
+ log.Println("\tgui.guiButtonClick() button.Name =", button.Name)
if button.Custom != nil {
log.Println("\tgui.guiButtonClick() DOING CUSTOM FUNCTION")
button.Custom(button)
@@ -51,28 +50,6 @@ func guiButtonClick(button *GuiButton) {
}
}
-func CreateButton(box *GuiBox, a *pb.Account, vm *pb.Event_VM, name string, action string, custom func(*GuiButton)) *GuiButton {
- newUiB := ui.NewButton(name)
- newUiB.OnClicked(defaultButtonClick)
-
- var newB *GuiButton
- newB = new(GuiButton)
- newB.B = newUiB
- if (box.Window == nil) {
- log.Println("CreateButton() box.Window == nil")
- panic("crap")
- }
- newB.Account = a
- newB.VM = vm
- newB.Box = box
- newB.Action = action
- newB.Custom = custom
- Data.AllButtons = append(Data.AllButtons, newB)
-
- box.UiBox.Append(newB.B, false)
- return newB
-}
-
func NewCreateButton(box *GuiBox, custom func(*GuiButton), name string, values interface {}) *GuiButton {
newUiB := ui.NewButton(name)
newUiB.OnClicked(defaultButtonClick)
@@ -82,7 +59,8 @@ func NewCreateButton(box *GuiBox, custom func(*GuiButton), name string, values i
newB.B = newUiB
if (box.Window == nil) {
log.Println("CreateButton() box.Window == nil")
- panic("crap")
+ // ErrorWindow(box.Window, "Login Failed", msg) // can't even do this
+ panic("maybe print an error and return nil? or make a fake button?")
}
newB.Box = box
newB.Custom = custom
@@ -98,7 +76,6 @@ func CreateFontButton(box *GuiBox, action string) *GuiButton {
// create a 'fake' button entry for the mouse clicks
var newGB GuiButton
newGB.Name = "FONT"
- newGB.Action = action
newGB.FB = ui.NewFontButton()
newGB.Box = box
Data.AllButtons = append(Data.AllButtons, &newGB)
diff --git a/structs.go b/structs.go
index b2d55f3..1ef8513 100644
--- a/structs.go
+++ b/structs.go
@@ -6,8 +6,6 @@ import "golang.org/x/image/font"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
-import pb "git.wit.com/wit/witProtobuf"
-
//
// All GUI Data Structures and functions that are external
// If you need cross platform support, these might only
@@ -101,9 +99,7 @@ type GuiButton struct {
Custom func (*GuiButton)
Values interface {}
- Action string // what type of button
- Account *pb.Account // associated with what account?
- VM *pb.Event_VM // associated with which VM?
+// Action string // what type of button
// andlabs/ui abstraction mapping
B *ui.Button