MCPcopy Create free account
hub / github.com/cogentcore/core / Init

Method Init

texteditor/diffbrowser/node.go:44–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44func (tn *Node) Init() {
45 tn.Tree.Init()
46 tn.IconOpen = icons.FolderOpen
47 tn.IconClosed = icons.Folder
48 tn.ContextMenus = nil
49 tn.AddContextMenu(tn.ContextMenu)
50
51 tn.Parts.AsWidget().OnDoubleClick(func(e events.Event) {
52 if tn.HasChildren() {
53 return
54 }
55 br := tn.Browser()
56 if br == nil {
57 return
58 }
59 sels := tn.GetSelectedNodes()
60 if sels != nil {
61 br.ViewDiff(tn)
62 }
63 })
64 tn.Parts.Styler(func(s *styles.Style) {
65 s.Gap.X.Em(0.4)
66 })
67 tree.AddChildInit(tn.Parts, "branch", func(w *core.Switch) {
68 tree.AddChildInit(w, "stack", func(w *core.Frame) {
69 f := func(name string) {
70 tree.AddChildInit(w, name, func(w *core.Icon) {
71 w.Styler(func(s *styles.Style) {
72 s.Min.Set(units.Em(1))
73 })
74 })
75 }
76 f("icon-on")
77 f("icon-off")
78 f("icon-indeterminate")
79 })
80 })
81}
82
83// Browser returns the parent browser
84func (tn *Node) Browser() *Browser {

Callers

nothing calls this directly

Calls 13

BrowserMethod · 0.95
AddChildInitFunction · 0.92
EmFunction · 0.92
AddContextMenuMethod · 0.80
OnDoubleClickMethod · 0.80
GetSelectedNodesMethod · 0.80
ViewDiffMethod · 0.80
StylerMethod · 0.80
InitMethod · 0.65
AsWidgetMethod · 0.65
SetMethod · 0.65
HasChildrenMethod · 0.45

Tested by

no test coverage detected