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

Method Init

core/values.go:175–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173func (fb *FontButton) WidgetValue() any { return &fb.Text }
174
175func (fb *FontButton) Init() {
176 fb.Button.Init()
177 fb.SetType(ButtonTonal)
178 InitValueButton(fb, false, func(d *Body) {
179 d.SetTitle("Select a font family")
180 si := 0
181 fi := paint.FontLibrary.FontInfo
182 tb := NewTable(d)
183 tb.SetSlice(&fi).SetSelectedField("Name").SetSelectedValue(fb.Text).BindSelect(&si)
184 tb.SetTableStyler(func(w Widget, s *styles.Style, row, col int) {
185 if col != 4 {
186 return
187 }
188 s.Font.Family = fi[row].Name
189 s.Font.Stretch = fi[row].Stretch
190 s.Font.Weight = fi[row].Weight
191 s.Font.Style = fi[row].Style
192 s.Font.Size.Pt(18)
193 })
194 tb.OnChange(func(e events.Event) {
195 fb.Text = fi[si].Name
196 })
197 })
198}
199
200// HighlightingName is a highlighting style name.
201// TODO: move this to texteditor/highlighting.

Callers

nothing calls this directly

Calls 12

SetSliceMethod · 0.95
SetTableStylerMethod · 0.95
InitValueButtonFunction · 0.85
BindSelectMethod · 0.80
SetSelectedValueMethod · 0.80
SetSelectedFieldMethod · 0.80
NewTableFunction · 0.70
InitMethod · 0.65
SetTitleMethod · 0.65
SetTypeMethod · 0.45
PtMethod · 0.45
OnChangeMethod · 0.45

Tested by

no test coverage detected