-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtigen.go
145 lines (128 loc) · 8.02 KB
/
gtigen.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
// Code generated by "goki generate"; DO NOT EDIT.
package main
import (
"goki.dev/gi/v2/filetree"
"goki.dev/gi/v2/gi"
"goki.dev/gti"
"goki.dev/ki/v2"
"goki.dev/ordmap"
)
// FileBrowseType is the [gti.Type] for [FileBrowse]
var FileBrowseType = gti.AddType(>i.Type{
Name: "main.FileBrowse",
ShortName: "main.FileBrowse",
IDName: "file-browse",
Doc: "FileBrowse is a simple file browser / viewer / editor with a file tree and\none or more editor windows. It is based on an early version of the Gide\nIDE framework, and remains simple to test / demo the file tree component.",
Directives: gti.Directives{},
Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"ProjRoot", >i.Field{Name: "ProjRoot", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjFilename", Directives: gti.Directives{}, Tag: "desc:\"root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjFilename\""}},
{"ActiveFilename", >i.Field{Name: "ActiveFilename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "filename of the currently-active texteditor", Directives: gti.Directives{}, Tag: "desc:\"filename of the currently-active texteditor\""}},
{"Changed", >i.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "has the root changed? we receive update signals from root for changes", Directives: gti.Directives{}, Tag: "json:\"-\" desc:\"has the root changed? we receive update signals from root for changes\""}},
{"Files", >i.Field{Name: "Files", Type: "*goki.dev/gi/v2/filetree.Tree", LocalType: "*filetree.Tree", Doc: "all the files in the project directory and subdirectories", Directives: gti.Directives{}, Tag: "desc:\"all the files in the project directory and subdirectories\""}},
{"NTextEditors", >i.Field{Name: "NTextEditors", Type: "int", LocalType: "int", Doc: "number of texteditors available for editing files (default 2) -- configurable with n-text-views property", Directives: gti.Directives{}, Tag: "xml:\"n-text-views\" desc:\"number of texteditors available for editing files (default 2) -- configurable with n-text-views property\""}},
{"ActiveTextEditorIdx", >i.Field{Name: "ActiveTextEditorIdx", Type: "int", LocalType: "int", Doc: "index of the currently-active texteditor -- new files will be viewed in other views if available", Directives: gti.Directives{}, Tag: "json:\"-\" desc:\"index of the currently-active texteditor -- new files will be viewed in other views if available\""}},
}),
Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}),
Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{
{"UpdateFiles", >i.Method{Name: "UpdateFiles", Doc: "UpdateFiles updates the list of files saved in project", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
{"OpenPath", >i.Method{Name: "OpenPath", Doc: "OpenPath opens a new browser viewer at given path, which can either be a\nspecific file or a directory containing multiple files of interest -- opens\nin current FileBrowse object if it is empty, or otherwise opens a new\nwindow.", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"path", >i.Field{Name: "path", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
{"SaveActiveView", >i.Method{Name: "SaveActiveView", Doc: "SaveActiveView saves the contents of the currently-active texteditor", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
{"SaveActiveViewAs", >i.Method{Name: "SaveActiveViewAs", Doc: "SaveActiveViewAs save with specified filename the contents of the\ncurrently-active texteditor", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"filename", >i.Field{Name: "filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
{"ConfigToolbar", >i.Method{Name: "ConfigToolbar", Doc: "", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"tb", >i.Field{Name: "tb", Type: "*goki.dev/gi/v2/gi.Toolbar", LocalType: "*gi.Toolbar", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
}),
Instance: &FileBrowse{},
})
// NewFileBrowse adds a new [FileBrowse] with the given name
// to the given parent. If the name is unspecified, it defaults
// to the ID (kebab-case) name of the type, plus the
// [ki.Ki.NumLifetimeChildren] of the given parent.
func NewFileBrowse(par ki.Ki, name ...string) *FileBrowse {
return par.NewChild(FileBrowseType, name...).(*FileBrowse)
}
// KiType returns the [*gti.Type] of [FileBrowse]
func (t *FileBrowse) KiType() *gti.Type {
return FileBrowseType
}
// New returns a new [*FileBrowse] value
func (t *FileBrowse) New() ki.Ki {
return &FileBrowse{}
}
// SetProjRoot sets the [FileBrowse.ProjRoot]:
// root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjFilename
func (t *FileBrowse) SetProjRoot(v gi.FileName) *FileBrowse {
t.ProjRoot = v
return t
}
// SetActiveFilename sets the [FileBrowse.ActiveFilename]:
// filename of the currently-active texteditor
func (t *FileBrowse) SetActiveFilename(v gi.FileName) *FileBrowse {
t.ActiveFilename = v
return t
}
// SetChanged sets the [FileBrowse.Changed]:
// has the root changed? we receive update signals from root for changes
func (t *FileBrowse) SetChanged(v bool) *FileBrowse {
t.Changed = v
return t
}
// SetFiles sets the [FileBrowse.Files]:
// all the files in the project directory and subdirectories
func (t *FileBrowse) SetFiles(v *filetree.Tree) *FileBrowse {
t.Files = v
return t
}
// SetNtextEditors sets the [FileBrowse.NTextEditors]:
// number of texteditors available for editing files (default 2) -- configurable with n-text-views property
func (t *FileBrowse) SetNtextEditors(v int) *FileBrowse {
t.NTextEditors = v
return t
}
// SetActiveTextEditorIdx sets the [FileBrowse.ActiveTextEditorIdx]:
// index of the currently-active texteditor -- new files will be viewed in other views if available
func (t *FileBrowse) SetActiveTextEditorIdx(v int) *FileBrowse {
t.ActiveTextEditorIdx = v
return t
}
// SetTooltip sets the [FileBrowse.Tooltip]
func (t *FileBrowse) SetTooltip(v string) *FileBrowse {
t.Tooltip = v
return t
}
// SetClass sets the [FileBrowse.Class]
func (t *FileBrowse) SetClass(v string) *FileBrowse {
t.Class = v
return t
}
// SetCustomContextMenu sets the [FileBrowse.CustomContextMenu]
func (t *FileBrowse) SetCustomContextMenu(v func(m *gi.Scene)) *FileBrowse {
t.CustomContextMenu = v
return t
}
// SetStackTop sets the [FileBrowse.StackTop]
func (t *FileBrowse) SetStackTop(v int) *FileBrowse {
t.StackTop = v
return t
}
// SetStripes sets the [FileBrowse.Stripes]
func (t *FileBrowse) SetStripes(v gi.Stripes) *FileBrowse {
t.Stripes = v
return t
}