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

Method MakeToolbar

plot/plotcore/ploteditor.go:565–639  ·  view source on GitHub ↗
(p *tree.Plan)

Source from the content-addressed store, hash-verified

563}
564
565func (pl *PlotEditor) MakeToolbar(p *tree.Plan) {
566 if pl.table == nil {
567 return
568 }
569 tree.Add(p, func(w *core.Button) {
570 w.SetIcon(icons.PanTool).
571 SetTooltip("toggle the ability to zoom and pan the view").OnClick(func(e events.Event) {
572 pw := pl.plotWidget
573 pw.SetReadOnly(!pw.IsReadOnly())
574 pw.Restyle()
575 })
576 })
577 tree.Add(p, func(w *core.Button) {
578 w.SetIcon(icons.ArrowForward).
579 SetTooltip("turn on select mode for selecting Plot elements").
580 OnClick(func(e events.Event) {
581 fmt.Println("this will select select mode")
582 })
583 })
584 tree.Add(p, func(w *core.Separator) {})
585
586 tree.Add(p, func(w *core.Button) {
587 w.SetText("Update").SetIcon(icons.Update).
588 SetTooltip("update fully redraws display, reflecting any new settings etc").
589 OnClick(func(e events.Event) {
590 pl.UpdateWidget()
591 pl.UpdatePlot()
592 })
593 })
594 tree.Add(p, func(w *core.Button) {
595 w.SetText("Options").SetIcon(icons.Settings).
596 SetTooltip("Options for how the plot is rendered").
597 OnClick(func(e events.Event) {
598 d := core.NewBody().AddTitle("Plot options")
599 core.NewForm(d).SetStruct(&pl.Options).
600 OnChange(func(e events.Event) {
601 pl.GoUpdatePlot()
602 })
603 d.RunWindowDialog(pl)
604 })
605 })
606 tree.Add(p, func(w *core.Button) {
607 w.SetText("Table").SetIcon(icons.Edit).
608 SetTooltip("open a Table window of the data").
609 OnClick(func(e events.Event) {
610 d := core.NewBody().AddTitle(pl.Name + " Data")
611 tv := tensorcore.NewTable(d).SetTable(pl.table.Table)
612 d.AddAppBar(tv.MakeToolbar)
613 d.RunWindowDialog(pl)
614 })
615 })
616 tree.Add(p, func(w *core.Separator) {})
617
618 tree.Add(p, func(w *core.Button) {
619 w.SetText("Save").SetIcon(icons.Save).SetMenu(func(m *core.Scene) {
620 core.NewFuncButton(m).SetFunc(pl.SaveSVG).SetIcon(icons.Save)
621 core.NewFuncButton(m).SetFunc(pl.SavePNG).SetIcon(icons.Save)
622 core.NewFuncButton(m).SetFunc(pl.SaveCSV).SetIcon(icons.Save)

Callers

nothing calls this directly

Calls 15

UpdatePlotMethod · 0.95
GoUpdatePlotMethod · 0.95
AddFunction · 0.92
NewBodyFunction · 0.92
NewFormFunction · 0.92
NewTableFunction · 0.92
NewFuncButtonFunction · 0.92
NewSeparatorFunction · 0.92
SetTooltipMethod · 0.80
RestyleMethod · 0.80
PrintlnMethod · 0.80
UpdateWidgetMethod · 0.80

Tested by

no test coverage detected