attempt sending a protobuf tree

This commit is contained in:
Jeff Carr 2025-04-30 14:41:14 -05:00
parent 91ff254e25
commit eb37c0b449
3 changed files with 43 additions and 29 deletions

View File

@ -7,7 +7,6 @@ package gitpb;
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
import "widget.proto"; // Import the well-known type for Timestamp
message StringRow {
Widget header = 1;
repeated string vals = 2;

10
widget.common.go Normal file
View File

@ -0,0 +1,10 @@
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
package guipb
func (x *Widget) IsButton() bool {
if _, ok := x.GetType().(*Widget_Button); ok {
return true
}
return false
}

View File

@ -7,7 +7,6 @@ package gitpb;
// import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
import "google/protobuf/any.proto"; // Import 'Any'
message Size {
int64 width = 1;
int64 height = 2;
@ -19,44 +18,50 @@ message Location {
int64 y = 2;
}
message Tree { // `autogenpb:marshal`
Widget parent = 1;
repeated Widget children = 2;
}
message Widget {
message Internal {
string progName = 1;
}
message Standard {
string progName = 1;
string name = 2;
}
oneof type {
Internal root = 9;
Standard button = 10;
Standard window = 11;
Standard tab = 12;
Standard checkbox = 13;
bytes tablePB = 14;
Standard textbox = 15;
}
int64 id = 1;
string name = 2;
int64 size = 3;
google.protobuf.Any val = 4;
google.protobuf.Any TK = 5;
google.protobuf.Any val = 3;
WidgetType Type = 6;
Location location = 7;
repeated Widget children = 8;
}
message Widgets { // `autogenpb:marshal`
string uuid = 1; // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c`
string version = 2; // `autogenpb:version:v1`
repeated Widget Widgets = 3; // this never gets used, but it's not worth violating the autogenpb standard
Tree tree = 4; // everything is sent from go.wit.com/gui here
Widget tree = 4; // everything is sent from go.wit.com/gui here
}
//
// Widget names should try to match [Wikipedia Graphical widget]
// TODO: fix autogenpb to look for enum
enum WidgetType {
Root = 0; // the master 'root' node of the binary tree
Flag = 1; // internal use
Window = 2; //
Tab = 3; // a tab like in firefox
Box = 4; // must be either Vertical or Horizontal arrangment
Group = 5; // think 'Appetizers' on a restaurant menu
Grid = 6; // like drawers in a chest or post office boxes
Button = 7; // user can click on this
Checkbox = 8; // true or false
Dropdown = 9; //
Combobox = 10; // a dropdown menu that can be edited by the user
Label = 11; // a simple label
Textbox = 12; // enter text
TablePB = 13; // special case to allow the arbitrary GUI display of any other protobuf
Root = 0; // the master 'root' node of the binary tree
Flag = 1; // internal use
Window = 2; //
Tab = 3; // a tab like in firefox
Box = 4; // must be either Vertical or Horizontal arrangment
Group = 5; // think 'Appetizers' on a restaurant menu
Grid = 6; // like drawers in a chest or post office boxes
Button = 7; // user can click on this
Checkbox = 8; // true or false
Dropdown = 9; //
Combobox = 10; // a dropdown menu that can be edited by the user
Label = 11; // a simple label
Textbox = 12; // enter text
TablePB = 13; // special case to allow the arbitrary GUI display of any other protobuf
}