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

Method Init

core/frame.go:66–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66func (fr *Frame) Init() {
67 fr.WidgetBase.Init()
68 fr.FinalStyler(func(s *styles.Style) {
69 // we only enable, not disable, since some other widget like Slider may want to enable
70 if s.Overflow.X == styles.OverflowAuto || s.Overflow.Y == styles.OverflowAuto {
71 s.SetAbilities(true, abilities.Scrollable, abilities.Slideable)
72 }
73 })
74 fr.OnFinal(events.KeyChord, func(e events.Event) {
75 kf := keymap.Of(e.KeyChord())
76 if DebugSettings.KeyEventTrace {
77 slog.Info("Layout KeyInput", "widget", fr, "keyFunction", kf)
78 }
79 if kf == keymap.Abort {
80 if fr.Scene.Stage.closePopupAndBelow() {
81 e.SetHandled()
82 }
83 return
84 }
85 em := fr.Events()
86 if em == nil {
87 return
88 }
89 grid := fr.Styles.Display == styles.Grid
90 if fr.Styles.Direction == styles.Row || grid {
91 switch kf {
92 case keymap.MoveRight:
93 if fr.focusNextChild(false) {
94 e.SetHandled()
95 }
96 return
97 case keymap.MoveLeft:
98 if fr.focusPreviousChild(false) {
99 e.SetHandled()
100 }
101 return
102 }
103 }
104 if fr.Styles.Direction == styles.Column || grid {
105 switch kf {
106 case keymap.MoveDown:
107 if fr.focusNextChild(true) {
108 e.SetHandled()
109 }
110 return
111 case keymap.MoveUp:
112 if fr.focusPreviousChild(true) {
113 e.SetHandled()
114 }
115 return
116 case keymap.PageDown:
117 proc := false
118 for st := 0; st < SystemSettings.LayoutPageSteps; st++ {
119 if !fr.focusNextChild(true) {
120 break
121 }
122 proc = true
123 }

Callers

nothing calls this directly

Calls 15

focusNextChildMethod · 0.95
focusPreviousChildMethod · 0.95
focusOnNameMethod · 0.95
scrollDeltaMethod · 0.95
OfFunction · 0.92
Vector2FromPointFunction · 0.92
NewScrollFunction · 0.92
FinalStylerMethod · 0.80
SetAbilitiesMethod · 0.80
OnFinalMethod · 0.80
closePopupAndBelowMethod · 0.80
InitMethod · 0.65

Tested by

no test coverage detected