diff options
author | xengineering <me@xengineering.eu> | 2023-04-11 21:44:11 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-04-11 21:44:11 +0200 |
commit | e1bdf36d098df698ac5cff08debfef9c0f539d89 (patch) | |
tree | 85e6e3bd1a0bd92c66da63596a695022b3edb594 | |
parent | f363e37146a108ad22227a7b28249bc82ac33aeb (diff) | |
download | limox-e1bdf36d098df698ac5cff08debfef9c0f539d89.tar limox-e1bdf36d098df698ac5cff08debfef9c0f539d89.tar.zst limox-e1bdf36d098df698ac5cff08debfef9c0f539d89.zip |
Implement dummy functionality for first view
-rw-r--r-- | go/main.go | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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) }, ), |