diff options
| author | Jeff Carr <[email protected]> | 2019-05-23 17:44:00 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-05-23 17:44:00 -0700 |
| commit | e00e6670ed861ddfbc7eb6b17e1f75dfc24801ef (patch) | |
| tree | dc034885553202a318b1ae257fc1f3f2d2383c5f /gui.go | |
| parent | cdf7ee0962b06812cce2219eb84d81b2426e8e3d (diff) | |
make custom buttons for the account sockets
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui.go')
| -rw-r--r-- | gui.go | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -66,6 +66,7 @@ type ButtonMap struct { custom func (int, string) Name string // the text on the button Note string // what type of button + AccNick string // what account this button is for } /* @@ -182,8 +183,10 @@ func defaultButtonClick(button *ui.Button) { } else if Data.allButtons[key].custom != nil { Data.allButtons[key].custom(42, "BUTTON DOES NOTHING") } + return } } + log.Println("\tBUTTON NOT FOUND") } func defaultFontButtonClick(button *ui.FontButton) { @@ -208,6 +211,23 @@ func CreateButton(name string, note string, custom func(int, string)) *ui.Button return newB } +func CreateAccountButton(account string, custom func(int, string)) *ui.Button { + name := "Show " + account + newB := ui.NewButton(name) + + newB.OnClicked(defaultButtonClick) + + var newmap ButtonMap + newmap.B = newB + newmap.Note = "SHOW" + newmap.Name = name + newmap.AccNick = account + newmap.custom = custom + Data.allButtons = append(Data.allButtons, newmap) + + return newB +} + func CreateFontButton(name string, note string, custom func(int, string)) *ui.FontButton { newB := ui.NewFontButton() @@ -216,7 +236,6 @@ func CreateFontButton(name string, note string, custom func(int, string)) *ui.Fo var newmap ButtonMap newmap.FB = newB newmap.Note = note - newmap.Name = name newmap.custom = custom Data.allButtons = append(Data.allButtons, newmap) |
