blob: 78ccdfb848cc15b703c5a14a39576d3ad90e1697 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
package widget
type Action struct {
ActionType ActionType
WidgetType WidgetType
WidgetId int
ParentId int
State State
// Text string // what is visable to the user
ProgName string // a name useful for programming
// most primitive widgets just store a single thing
Value any
// how to arrange widgets
Direction Orientation
// All the strings for things like dropdown menus
// They must be sent in display order
// These must be unique
Strings []string
Range RangeType
// RETHINK / REDO EVERYTHING BELOW HERE
// This is used for things like a slider(0,100)
X int
Y int
// This is for the grid size & widget position
W int
H int
AtW int
AtH int
// Put space around elements to improve look & feel
// Margin bool avoided due to use of action types
// Pad bool
// Make widgets fill up the space available
Expand bool
TablePB []byte // a table protobuf
WidgetPB []byte // a tree of widgets
}
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
const (
Add ActionType = iota + 1
Delete
SetText
AddText
Checked
Show
Hide
Enable
Disable
SetMargin
Margin
Unmargin
SetPad
Pad
Unpad
SetExpand
Append
Move
Dump
User // the user did something (mouse, keyboard, etc)
ToolkitLoad // attempts to load a new toolkit
ToolkitInit // initializes the toolkit
ToolkitClose // closes the toolkit
ToolkitPanic
Heartbeat
CloseWindow
UserQuit // the user closed the GUI
EnableDebug // open the debugging window
)
func (s ActionType) String() string {
switch s {
case Add:
return "Add"
case Delete:
return "Delete"
case SetText:
return "SetText"
case AddText:
return "AddText"
case Show:
return "Show"
case Hide:
return "Hide"
case Enable:
return "Enable"
case Disable:
return "Disable"
case Margin:
return "Margin"
case Unmargin:
return "Unmargin"
case Pad:
return "Pad"
case Unpad:
return "Unpad"
case Append:
return "Append"
case Move:
return "Move"
case Dump:
return "Dump"
case User:
return "User"
case ToolkitLoad:
return "ToolkitLoad"
case ToolkitInit:
return "ToolkitInit"
case ToolkitClose:
return "ToolkitClose"
case ToolkitPanic:
return "ToolkitPanic"
case Heartbeat:
return "Heartbeat"
case UserQuit:
return "UserQuit"
case EnableDebug:
return "EnableDebug"
}
return "gui ActionType.String() Error. must be missing something in the code here"
}
|