summaryrefslogtreecommitdiff
path: root/windowChats.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-01 13:32:25 -0500
committerJeff Carr <[email protected]>2025-09-01 13:32:25 -0500
commit5dadf3b5ef3f58c80c7a62f96a0a62b4a784961b (patch)
treeb1f4b5880aaaaab50cce43eac30eb203361d458b /windowChats.go
parentcdc4155ef1b783b10b3c74f43171d43c690dd995 (diff)
add a GUI
Diffstat (limited to 'windowChats.go')
-rw-r--r--windowChats.go89
1 files changed, 89 insertions, 0 deletions
diff --git a/windowChats.go b/windowChats.go
new file mode 100644
index 0000000..d92b4ce
--- /dev/null
+++ b/windowChats.go
@@ -0,0 +1,89 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// An app to submit patches for the 30 GO GUI repos
+
+import (
+ "time"
+
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/lib/protobuf/chatpb"
+ "go.wit.com/log"
+)
+
+/*
+type stdReposTableWin struct {
+ sync.Mutex
+ win *gadgets.GenericWindow // the machines gui window
+ boxTB *gui.Node // the machines gui parent box widget
+ TB *gitpb.ReposTable // the gui table buffer
+ pb *gitpb.Repos // the current repos protobuf
+ update bool // if the window should be updated
+}
+
+func (w *stdReposTableWin) Toggle() {
+ if w == nil {
+ return
+ }
+ if w.win == nil {
+ return
+ }
+ w.win.Toggle()
+}
+*/
+
+func makeChatsWindow() *gadgets.GenericWindow {
+ insertWin := gadgets.NewGenericWindow("regex Chats", "Display Chats")
+ insertWin.Win.Custom = func() {
+ log.Info("test delete window here")
+ }
+ grid := insertWin.Group.RawGrid()
+
+ var t *chatpb.ChatsTable
+ grid.NewButton("dirty", func() {
+ })
+
+ grid.NewButton("delete PB table", func() {
+ if t != nil {
+ t.Delete()
+ t = nil
+ log.Info("Table should have been deleted")
+ }
+ })
+ // display the protobuf
+ t = addChatsPB(insertWin, me.chats)
+ f := func(chat *chatpb.Chat) {
+ log.Info("got to ChatTable.Custom() id =", chat.GetUuid(), chat.GetChatName())
+ }
+ t.Custom(f)
+ log.Info("table has uuid", t.GetUuid())
+
+ return insertWin
+}
+
+func addChatsPB(win *gadgets.GenericWindow, pb *chatpb.Chats) *chatpb.ChatsTable {
+ t := pb.NewTable("testForgeRepos")
+ t.NewUuid()
+ tbox := win.Bottom.Box().SetProgName("TBOX")
+ t.SetParent(tbox)
+
+ sf := t.AddStringFunc("chat", func(r *chatpb.Chat) string {
+ return r.GetUuid()
+ })
+ sf.Custom = func(r *chatpb.Chat) {
+ log.Info("do button click on", r.GetUuid())
+ }
+ t.AddTimeFunc("age", func(chat *chatpb.Chat) time.Time {
+ return chat.GetCtime().AsTime()
+ })
+ t.AddChatName()
+ f := func(repo *chatpb.Chat) string {
+ log.Info("chat =", repo.GetUuid(), repo.GetChatName())
+ return repo.GetUuid()
+ }
+ t.AddButtonFunc("cur version", f)
+ t.ShowTable()
+ return t
+}