Commiting for C&C
This commit is contained in:
@@ -21,6 +21,8 @@ type PromptForTagWiddle struct {
|
||||
cancelButton *widdles.Button
|
||||
doneButton *widdles.Button
|
||||
|
||||
multipleValues bool
|
||||
|
||||
msg string
|
||||
}
|
||||
|
||||
@@ -72,6 +74,13 @@ func (w *PromptForTagWiddle) View(style wandle.Style) {
|
||||
wandle.TitledBorderFilled(title, w.x, w.y, w.x+w.w, w.y+w.h, style, wandle.BRD_CSIMPLE)
|
||||
w.keyInput.View(style)
|
||||
w.valInput.View(style)
|
||||
if w.multipleValues {
|
||||
red := wandle.NewStyle(
|
||||
termbox.RGBToAttribute(uint8(200), uint8(0), uint8(0)),
|
||||
termbox.RGBToAttribute(uint8(0), uint8(0), uint8(0)),
|
||||
)
|
||||
wandle.Print(w.valInput.GetX(), w.valInput.GetY()+1, red, "Changing a tag on timers that have different values!")
|
||||
}
|
||||
w.cancelButton.View(style)
|
||||
w.doneButton.View(style)
|
||||
wandle.Print(w.x+1, w.y+w.h-2, style, w.msg)
|
||||
@@ -188,8 +197,22 @@ func (w *PromptForTagWiddle) SetTag(key, val string) {
|
||||
}
|
||||
w.valInput.SetValue(val)
|
||||
}
|
||||
func (w *PromptForTagWiddle) GetTag() (string, string) {
|
||||
return w.keyInput.GetValue(), w.valInput.GetValue()
|
||||
}
|
||||
func (w *PromptForTagWiddle) SetMultiVal(v bool) { w.multipleValues = v }
|
||||
|
||||
func (w *PromptForTagWiddle) ClearCancelCommand() { w.SetCancelCommand(wandle.EmptyCmd) }
|
||||
func (w *PromptForTagWiddle) SetCancelCommand(cmd func() wandle.Msg) { w.cancelButton.SetCommand(cmd) }
|
||||
func (w *PromptForTagWiddle) ClearDoneCommand() { w.SetDoneCommand(wandle.EmptyCmd) }
|
||||
func (w *PromptForTagWiddle) SetDoneCommand(cmd func() wandle.Msg) { w.doneButton.SetCommand(cmd) }
|
||||
|
||||
func (w *PromptForTagWiddle) Done() {
|
||||
w.origKey, w.origVal = "", ""
|
||||
w.multipleValues = false
|
||||
w.keyInput.SetValue("")
|
||||
w.valInput.SetValue("")
|
||||
w.ClearCancelCommand()
|
||||
w.ClearDoneCommand()
|
||||
w.SetActive(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user