From 9554b6a28765db7debce2cc27587476dc90e5d3e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 3 Mar 2025 00:12:12 -0600 Subject: starting to stub in widgetpb --- node.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'node.go') diff --git a/node.go b/node.go index 3fdea60..6866848 100644 --- a/node.go +++ b/node.go @@ -1,6 +1,7 @@ package gui import ( + "go.wit.com/lib/protobuf/guipb" "go.wit.com/log" "go.wit.com/widget" ) @@ -87,6 +88,36 @@ func (parent *Node) Append(n *Node) { // honor the visable settings of the parent n.visable = parent.visable + + // deprecate everything above and switch to protobuf below + if n.widget == nil { + n.widget = new(guipb.Widget) + } + n.widget.Id = int64(n.id) + n.widget.Type = n.TypePB() +} + +func (n *Node) TypePB() guipb.WidgetType { + switch n.WidgetType { + case widget.Window: + return guipb.WidgetType_Window + case widget.Group: + return guipb.WidgetType_Group + case widget.Grid: + return guipb.WidgetType_Grid + case widget.Box: + return guipb.WidgetType_Box + case widget.Label: + return guipb.WidgetType_Label + case widget.Button: + return guipb.WidgetType_Button + case widget.Checkbox: + return guipb.WidgetType_Checkbox + case widget.Dropdown: + return guipb.WidgetType_Dropdown + default: + return guipb.WidgetType_Label + } } // returns the parent widget -- cgit v1.2.3