summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui.go37
1 files changed, 30 insertions, 7 deletions
diff --git a/gui.go b/gui.go
index d3f6b2d..c3256eb 100644
--- a/gui.go
+++ b/gui.go
@@ -11,6 +11,36 @@ import (
)
func (l *Limox) draw(e system.FrameEvent) {
+ switch l.State {
+ case Connected:
+ l.rosterView(e)
+ default:
+ l.mainView(e)
+ }
+}
+
+func (l *Limox) rosterView(e system.FrameEvent) {
+ gtx := layout.NewContext(&l.Operations, e)
+
+ flex := layout.Flex{
+ Axis: layout.Vertical,
+ Spacing: layout.SpaceStart,
+ }
+
+ flex.Layout(gtx,
+ layout.Rigid(
+ func(gtx layout.Context) layout.Dimensions {
+ btn := material.Button(l.Theme, &l.DisconnectButton,
+ "Disconnect")
+ return btn.Layout(gtx)
+ },
+ ),
+ )
+
+ e.Frame(gtx.Ops)
+}
+
+func (l *Limox) mainView(e system.FrameEvent) {
gtx := layout.NewContext(&l.Operations, e)
flex := layout.Flex{
@@ -49,13 +79,6 @@ func (l *Limox) draw(e system.FrameEvent) {
return btn.Layout(gtx)
},
),
- layout.Rigid(
- func(gtx layout.Context) layout.Dimensions {
- btn := material.Button(l.Theme, &l.DisconnectButton,
- "Disconnect")
- return btn.Layout(gtx)
- },
- ),
)
e.Frame(gtx.Ops)