summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-04-11 21:44:11 +0200
committerxengineering <me@xengineering.eu>2023-04-11 21:44:11 +0200
commite1bdf36d098df698ac5cff08debfef9c0f539d89 (patch)
tree85e6e3bd1a0bd92c66da63596a695022b3edb594
parentf363e37146a108ad22227a7b28249bc82ac33aeb (diff)
downloadlimox-e1bdf36d098df698ac5cff08debfef9c0f539d89.tar
limox-e1bdf36d098df698ac5cff08debfef9c0f539d89.tar.zst
limox-e1bdf36d098df698ac5cff08debfef9c0f539d89.zip
Implement dummy functionality for first view
-rw-r--r--go/main.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/go/main.go b/go/main.go
index f646d7d..d055aa8 100644
--- a/go/main.go
+++ b/go/main.go
@@ -20,6 +20,7 @@ type Limox struct {
JidEditor widget.Editor
PwdEditor widget.Editor
ConnectClickable widget.Clickable
+ Connecting bool
Window *app.Window
Operations op.Ops
Theme *material.Theme
@@ -47,6 +48,7 @@ func NewLimox() Limox {
),
Operations: op.Ops{},
Theme: material.NewTheme(gofont.Collection()),
+ Connecting: false,
}
}
@@ -57,6 +59,15 @@ func (l *Limox) run() error {
case system.DestroyEvent:
return e.Err
case system.FrameEvent:
+ if l.ConnectClickable.Clicked() {
+ l.Connecting = !l.Connecting
+ if l.Connecting {
+ log.Printf("User wants to connect with '%s' and '%s'.\n",
+ l.JidEditor.Text(),
+ l.PwdEditor.Text(),
+ )
+ }
+ }
l.draw(e)
}
}
@@ -94,7 +105,13 @@ func (l *Limox) draw(e system.FrameEvent) {
),
layout.Rigid(
func(gtx layout.Context) layout.Dimensions {
- btn := material.Button(l.Theme, &l.ConnectClickable, "connect")
+ var label string
+ if l.Connecting {
+ label = "abort"
+ } else {
+ label = "connect"
+ }
+ btn := material.Button(l.Theme, &l.ConnectClickable, label)
return btn.Layout(gtx)
},
),