aboutsummaryrefslogtreecommitdiff
path: root/go/ui/prompt.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/ui/prompt.go')
-rw-r--r--go/ui/prompt.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/go/ui/prompt.go b/go/ui/prompt.go
index a7f2ce07..a289ae13 100644
--- a/go/ui/prompt.go
+++ b/go/ui/prompt.go
@@ -17,6 +17,7 @@ type Prompt struct {
y, width int
action game.Action
components []Widget
+ cancelable bool
}
func NewPrompt(y, width int, action game.Action, promptText string) *Prompt {
@@ -30,10 +31,15 @@ func NewPrompt(y, width int, action game.Action, promptText string) *Prompt {
return p
}
-func (p *Prompt) Action() game.Action {
- return p.action
+func NewCancelablePrompt(y, width int, action game.Action, promptText string) *Prompt {
+ p := NewPrompt(y, width, action, promptText)
+ p.cancelable = true
+ return p
}
+func (p *Prompt) Cancelable() bool { return p.cancelable }
+func (p *Prompt) Action() game.Action { return p.action }
+
func (p *Prompt) Add(obj interface{}) error {
if handCard, ok := obj.(HandCard); ok {
obj = handCard.C