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

Method insertNewTab

core/tabs.go:210–221  ·  view source on GitHub ↗

insertNewTab inserts a new tab with the given label at the given index position within the list of tabs and returns the resulting tab frame. An optional icon can also be passed for the tab button.

(label string, idx int, icon ...icons.Icon)

Source from the content-addressed store, hash-verified

208// within the list of tabs and returns the resulting tab frame. An optional icon
209// can also be passed for the tab button.
210func (ts *Tabs) insertNewTab(label string, idx int, icon ...icons.Icon) *Frame {
211 tfr := ts.getFrame()
212 frame := NewFrame()
213 tfr.InsertChild(frame, idx)
214 frame.SetName(label)
215 frame.Styler(func(s *styles.Style) {
216 s.Direction = styles.Column
217 })
218 ts.insertTabOnlyAt(label, idx, icon...)
219 ts.Update()
220 return frame
221}
222
223// insertTabOnlyAt inserts just the tab button at given index, after the panel has
224// already been added to the frame; assumed to be wrapped in update. Generally

Callers 1

NewTabMethod · 0.95

Calls 7

getFrameMethod · 0.95
insertTabOnlyAtMethod · 0.95
NewFrameFunction · 0.85
InsertChildMethod · 0.80
StylerMethod · 0.80
SetNameMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected