diff options
| author | Jeff Carr <[email protected]> | 2025-03-11 20:17:46 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-11 20:17:46 -0500 |
| commit | 50d16b3d86882456f4e17e400c4b8beed79d30e5 (patch) | |
| tree | 1244bfa54bfd8e8605e73dee5ccb76f5d3cd5970 /windowEvents.go | |
| parent | 19b1588512e60419915913a109c14355166ed33d (diff) | |
early events
Diffstat (limited to 'windowEvents.go')
| -rw-r--r-- | windowEvents.go | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/windowEvents.go b/windowEvents.go new file mode 100644 index 0000000..912dc2e --- /dev/null +++ b/windowEvents.go @@ -0,0 +1,77 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "sync" + + "go.wit.com/gui" + "go.wit.com/lib/gadgets" + "go.wit.com/lib/protobuf/virtpb" + "go.wit.com/log" +) + +type stdEventTableWin struct { + sync.Mutex + win *gadgets.GenericWindow // the machines gui window + box *gui.Node // the machines gui parent box widget + pb *virtpb.Events // the protobuf + TB *virtpb.EventsTable // the gui table buffer + update bool // if the window should be updated +} + +func (w *stdEventTableWin) Toggle() { + if w == nil { + return + } + if w.win == nil { + return + } + w.win.Toggle() +} + +func newEventsWindow() *stdEventTableWin { + dwin := new(stdEventTableWin) + dwin.win = gadgets.NewGenericWindow("virtigo current events", "things to do") + dwin.win.Custom = func() { + log.Info("test delete window here") + } + + // make a box at the bottom of the window for the protobuf table + dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX") + return dwin +} + +// default table protobuf window +func (dw *stdEventTableWin) doStdEvents(pb *virtpb.Events) { + dw.Lock() + defer dw.Unlock() + + // erase the old table + if dw.TB != nil { + dw.TB.Delete() + dw.TB = nil + } + + // init the table + dw.pb = pb + t := dw.pb.NewTable("EventsPB Off") + t.NewUuid() + t.SetParent(dw.box) + + // pick the columns + t.AddDroplet() + t.AddDropletUuid() + t.AddHypervisor() + + // display the protobuf + dw.TB = t + f := func(e *virtpb.Event) { + log.Info("std EventWindow() something here", e.Droplet) + // m.Enabled = true + } + dw.TB.Custom(f) + + dw.TB.ShowTable() +} |
