// 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() }