attempt sending a protobuf tree
This commit is contained in:
parent
91ff254e25
commit
eb37c0b449
|
@ -7,7 +7,6 @@ package gitpb;
|
||||||
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
||||||
import "widget.proto"; // Import the well-known type for Timestamp
|
import "widget.proto"; // Import the well-known type for Timestamp
|
||||||
|
|
||||||
|
|
||||||
message StringRow {
|
message StringRow {
|
||||||
Widget header = 1;
|
Widget header = 1;
|
||||||
repeated string vals = 2;
|
repeated string vals = 2;
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
33
widget.proto
33
widget.proto
|
@ -7,7 +7,6 @@ package gitpb;
|
||||||
// import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
// import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
||||||
import "google/protobuf/any.proto"; // Import 'Any'
|
import "google/protobuf/any.proto"; // Import 'Any'
|
||||||
|
|
||||||
|
|
||||||
message Size {
|
message Size {
|
||||||
int64 width = 1;
|
int64 width = 1;
|
||||||
int64 height = 2;
|
int64 height = 2;
|
||||||
|
@ -19,31 +18,37 @@ message Location {
|
||||||
int64 y = 2;
|
int64 y = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Tree { // `autogenpb:marshal`
|
|
||||||
Widget parent = 1;
|
|
||||||
repeated Widget children = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Widget {
|
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;
|
int64 id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
int64 size = 3;
|
google.protobuf.Any val = 3;
|
||||||
google.protobuf.Any val = 4;
|
|
||||||
google.protobuf.Any TK = 5;
|
|
||||||
WidgetType Type = 6;
|
WidgetType Type = 6;
|
||||||
Location location = 7;
|
Location location = 7;
|
||||||
|
repeated Widget children = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Widgets { // `autogenpb:marshal`
|
message Widgets { // `autogenpb:marshal`
|
||||||
string uuid = 1; // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c`
|
string uuid = 1; // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c`
|
||||||
string version = 2; // `autogenpb:version:v1`
|
string version = 2; // `autogenpb:version:v1`
|
||||||
repeated Widget Widgets = 3; // this never gets used, but it's not worth violating the autogenpb standard
|
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 {
|
enum WidgetType {
|
||||||
Root = 0; // the master 'root' node of the binary tree
|
Root = 0; // the master 'root' node of the binary tree
|
||||||
Flag = 1; // internal use
|
Flag = 1; // internal use
|
||||||
|
|
Loading…
Reference in New Issue