/
enumgen.go
205 lines (149 loc) · 10.7 KB
/
enumgen.go
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// Code generated by "core generate"; DO NOT EDIT.
package views
import (
"cogentcore.org/core/core"
"cogentcore.org/core/enums"
)
var _SliceViewFlagsValues = []SliceViewFlags{2, 3, 4, 5, 6, 7, 8, 9}
// SliceViewFlagsN is the highest valid value for type SliceViewFlags, plus one.
const SliceViewFlagsN SliceViewFlags = 10
var _SliceViewFlagsValueMap = map[string]SliceViewFlags{`Configured`: 2, `IsArray`: 3, `ShowIndex`: 4, `ReadOnlyKeyNav`: 5, `SelectMode`: 6, `ReadOnlyMultiSelect`: 7, `InFocusGrab`: 8, `InFullRebuild`: 9}
var _SliceViewFlagsDescMap = map[SliceViewFlags]string{2: `SliceViewConfigured indicates that the widgets have been configured`, 3: `SliceViewIsArray is whether the slice is actually an array -- no modifications -- set by SetSlice`, 4: `SliceViewShowIndex is whether to show index or not`, 5: `SliceViewReadOnlyKeyNav is whether support key navigation when ReadOnly (default true). uses a capture of up / down events to manipulate selection, not focus.`, 6: `SliceViewSelectMode is whether to be in select rows mode or editing mode`, 7: `SliceViewReadOnlyMultiSelect: if view is ReadOnly, default selection mode is to choose one row only. If this is true, standard multiple selection logic with modifier keys is instead supported`, 8: `SliceViewInFocusGrab is a guard for recursive focus grabbing`, 9: `SliceViewInFullRebuild is a guard for recursive rebuild`}
var _SliceViewFlagsMap = map[SliceViewFlags]string{2: `Configured`, 3: `IsArray`, 4: `ShowIndex`, 5: `ReadOnlyKeyNav`, 6: `SelectMode`, 7: `ReadOnlyMultiSelect`, 8: `InFocusGrab`, 9: `InFullRebuild`}
// String returns the string representation of this SliceViewFlags value.
func (i SliceViewFlags) String() string {
return enums.BitFlagStringExtended(i, _SliceViewFlagsValues, core.WidgetFlagsValues())
}
// BitIndexString returns the string representation of this SliceViewFlags value
// if it is a bit index value (typically an enum constant), and
// not an actual bit flag value.
func (i SliceViewFlags) BitIndexString() string {
return enums.BitIndexStringExtended[SliceViewFlags, core.WidgetFlags](i, _SliceViewFlagsMap)
}
// SetString sets the SliceViewFlags value from its string representation,
// and returns an error if the string is invalid.
func (i *SliceViewFlags) SetString(s string) error { *i = 0; return i.SetStringOr(s) }
// SetStringOr sets the SliceViewFlags value from its string representation
// while preserving any bit flags already set, and returns an
// error if the string is invalid.
func (i *SliceViewFlags) SetStringOr(s string) error {
return enums.SetStringOrExtended(i, (*core.WidgetFlags)(i), s, _SliceViewFlagsValueMap)
}
// Int64 returns the SliceViewFlags value as an int64.
func (i SliceViewFlags) Int64() int64 { return int64(i) }
// SetInt64 sets the SliceViewFlags value from an int64.
func (i *SliceViewFlags) SetInt64(in int64) { *i = SliceViewFlags(in) }
// Desc returns the description of the SliceViewFlags value.
func (i SliceViewFlags) Desc() string {
return enums.DescExtended[SliceViewFlags, core.WidgetFlags](i, _SliceViewFlagsDescMap)
}
// SliceViewFlagsValues returns all possible values for the type SliceViewFlags.
func SliceViewFlagsValues() []SliceViewFlags {
return enums.ValuesGlobalExtended(_SliceViewFlagsValues, core.WidgetFlagsValues())
}
// Values returns all possible values for the type SliceViewFlags.
func (i SliceViewFlags) Values() []enums.Enum {
return enums.ValuesExtended(_SliceViewFlagsValues, core.WidgetFlagsValues())
}
// HasFlag returns whether these bit flags have the given bit flag set.
func (i SliceViewFlags) HasFlag(f enums.BitFlag) bool { return enums.HasFlag((*int64)(&i), f) }
// SetFlag sets the value of the given flags in these flags to the given value.
func (i *SliceViewFlags) SetFlag(on bool, f ...enums.BitFlag) { enums.SetFlag((*int64)(i), on, f...) }
// MarshalText implements the [encoding.TextMarshaler] interface.
func (i SliceViewFlags) MarshalText() ([]byte, error) { return []byte(i.String()), nil }
// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
func (i *SliceViewFlags) UnmarshalText(text []byte) error {
return enums.UnmarshalText(i, text, "SliceViewFlags")
}
var _TreeViewFlagsValues = []TreeViewFlags{2, 3, 4}
// TreeViewFlagsN is the highest valid value for type TreeViewFlags, plus one.
const TreeViewFlagsN TreeViewFlags = 5
var _TreeViewFlagsValueMap = map[string]TreeViewFlags{`Closed`: 2, `SelectMode`: 3, `TreeViewInOpen`: 4}
var _TreeViewFlagsDescMap = map[TreeViewFlags]string{2: `TreeViewFlagClosed means node is toggled closed (children not visible) Otherwise Open.`, 3: `TreeViewFlagSelectMode, when set on the Root node, determines whether keyboard movements update selection or not.`, 4: `TreeViewInOpen is set in the Open method to prevent recursive opening for lazy-open nodes`}
var _TreeViewFlagsMap = map[TreeViewFlags]string{2: `Closed`, 3: `SelectMode`, 4: `TreeViewInOpen`}
// String returns the string representation of this TreeViewFlags value.
func (i TreeViewFlags) String() string {
return enums.BitFlagStringExtended(i, _TreeViewFlagsValues, core.WidgetFlagsValues())
}
// BitIndexString returns the string representation of this TreeViewFlags value
// if it is a bit index value (typically an enum constant), and
// not an actual bit flag value.
func (i TreeViewFlags) BitIndexString() string {
return enums.BitIndexStringExtended[TreeViewFlags, core.WidgetFlags](i, _TreeViewFlagsMap)
}
// SetString sets the TreeViewFlags value from its string representation,
// and returns an error if the string is invalid.
func (i *TreeViewFlags) SetString(s string) error { *i = 0; return i.SetStringOr(s) }
// SetStringOr sets the TreeViewFlags value from its string representation
// while preserving any bit flags already set, and returns an
// error if the string is invalid.
func (i *TreeViewFlags) SetStringOr(s string) error {
return enums.SetStringOrExtended(i, (*core.WidgetFlags)(i), s, _TreeViewFlagsValueMap)
}
// Int64 returns the TreeViewFlags value as an int64.
func (i TreeViewFlags) Int64() int64 { return int64(i) }
// SetInt64 sets the TreeViewFlags value from an int64.
func (i *TreeViewFlags) SetInt64(in int64) { *i = TreeViewFlags(in) }
// Desc returns the description of the TreeViewFlags value.
func (i TreeViewFlags) Desc() string {
return enums.DescExtended[TreeViewFlags, core.WidgetFlags](i, _TreeViewFlagsDescMap)
}
// TreeViewFlagsValues returns all possible values for the type TreeViewFlags.
func TreeViewFlagsValues() []TreeViewFlags {
return enums.ValuesGlobalExtended(_TreeViewFlagsValues, core.WidgetFlagsValues())
}
// Values returns all possible values for the type TreeViewFlags.
func (i TreeViewFlags) Values() []enums.Enum {
return enums.ValuesExtended(_TreeViewFlagsValues, core.WidgetFlagsValues())
}
// HasFlag returns whether these bit flags have the given bit flag set.
func (i TreeViewFlags) HasFlag(f enums.BitFlag) bool { return enums.HasFlag((*int64)(&i), f) }
// SetFlag sets the value of the given flags in these flags to the given value.
func (i *TreeViewFlags) SetFlag(on bool, f ...enums.BitFlag) { enums.SetFlag((*int64)(i), on, f...) }
// MarshalText implements the [encoding.TextMarshaler] interface.
func (i TreeViewFlags) MarshalText() ([]byte, error) { return []byte(i.String()), nil }
// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
func (i *TreeViewFlags) UnmarshalText(text []byte) error {
return enums.UnmarshalText(i, text, "TreeViewFlags")
}
var _ValueFlagsValues = []ValueFlags{0, 1, 2, 3, 4}
// ValueFlagsN is the highest valid value for type ValueFlags, plus one.
const ValueFlagsN ValueFlags = 5
var _ValueFlagsValueMap = map[string]ValueFlags{`ReadOnly`: 0, `MapKey`: 1, `HasSavedLabel`: 2, `HasSavedDoc`: 3, `DialogNewWindow`: 4}
var _ValueFlagsDescMap = map[ValueFlags]string{0: `ValueReadOnly flagged after first configuration`, 1: `ValueMapKey for OwnKind = Map, this value represents the Key -- otherwise the Value`, 2: `ValueHasSavedLabel is whether the value has a saved version of its label, which can be set either automatically or explicitly`, 3: `ValueHasSavedDoc is whether the value has a saved version of its documentation, which can be set either automatically or explicitly`, 4: `ValueDialogNewWindow indicates that the dialog should be opened with in a new window, instead of a typical FullWindow in same current window. this is triggered by holding down any modifier key while clicking on a button that opens the window.`}
var _ValueFlagsMap = map[ValueFlags]string{0: `ReadOnly`, 1: `MapKey`, 2: `HasSavedLabel`, 3: `HasSavedDoc`, 4: `DialogNewWindow`}
// String returns the string representation of this ValueFlags value.
func (i ValueFlags) String() string { return enums.BitFlagString(i, _ValueFlagsValues) }
// BitIndexString returns the string representation of this ValueFlags value
// if it is a bit index value (typically an enum constant), and
// not an actual bit flag value.
func (i ValueFlags) BitIndexString() string { return enums.String(i, _ValueFlagsMap) }
// SetString sets the ValueFlags value from its string representation,
// and returns an error if the string is invalid.
func (i *ValueFlags) SetString(s string) error { *i = 0; return i.SetStringOr(s) }
// SetStringOr sets the ValueFlags value from its string representation
// while preserving any bit flags already set, and returns an
// error if the string is invalid.
func (i *ValueFlags) SetStringOr(s string) error {
return enums.SetStringOr(i, s, _ValueFlagsValueMap, "ValueFlags")
}
// Int64 returns the ValueFlags value as an int64.
func (i ValueFlags) Int64() int64 { return int64(i) }
// SetInt64 sets the ValueFlags value from an int64.
func (i *ValueFlags) SetInt64(in int64) { *i = ValueFlags(in) }
// Desc returns the description of the ValueFlags value.
func (i ValueFlags) Desc() string { return enums.Desc(i, _ValueFlagsDescMap) }
// ValueFlagsValues returns all possible values for the type ValueFlags.
func ValueFlagsValues() []ValueFlags { return _ValueFlagsValues }
// Values returns all possible values for the type ValueFlags.
func (i ValueFlags) Values() []enums.Enum { return enums.Values(_ValueFlagsValues) }
// HasFlag returns whether these bit flags have the given bit flag set.
func (i ValueFlags) HasFlag(f enums.BitFlag) bool { return enums.HasFlag((*int64)(&i), f) }
// SetFlag sets the value of the given flags in these flags to the given value.
func (i *ValueFlags) SetFlag(on bool, f ...enums.BitFlag) { enums.SetFlag((*int64)(i), on, f...) }
// MarshalText implements the [encoding.TextMarshaler] interface.
func (i ValueFlags) MarshalText() ([]byte, error) { return []byte(i.String()), nil }
// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
func (i *ValueFlags) UnmarshalText(text []byte) error {
return enums.UnmarshalText(i, text, "ValueFlags")
}