giv

package
v1.3.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: BSD-3-Clause Imports: 66 Imported by: 195

Documentation

Overview

Package GiV (GoGi Views) provides a model / view framework to view Go data using reflection

Views are Widgets that automatically display and interact with standard Go data, including structs, maps, slices, and the primitive data elements (string, int, etc). This implements a form of model / view separation between data and GUI representation thereof, where the models are the Go data elements themselves.

This provides automatic, powerful GUI access to essentially any data in any other Go package. Furthermore, the ValueView framework allows for easy customization and extension of the GUI representation, based on the classic Go "Stringer"-like interface paradigm -- simply define a ValueView() method on any type, returning giv.ValueView that manages the interface between data structures and GUI representations.

See the wiki at: https://github.com/goki/gi/wiki/Views for more extensive docs.

Some of the most important view elements are:

ValueView

The ValueView provides a common API for representing values (int, string, etc) in the GUI, and are used by more complex views (StructView, MapView, SliceView, etc) to represents the elements of those data structures.

Do Ctrl+Alt+I in any window to pull up the GoGiEditor which will show you ample examples of the ValueView interface in action, and also allow you to customize your GUI.

TreeView

The TreeView displays GoKi Node Trees, using a standard tree-browser with collapse / open widgets and a menu for typical actions such as adding and deleting child nodes, along with full drag-n-drop and clipboard Copy/Cut/Paste functionality. You can connect to the selection signal to e.g., display a StructView field / property editor of the selected node.

TableView

TableView displays a slice-of-struct as a table with columns as the struct fields and rows as the elements in the struct. You can sort by the column headers and it supports full editing with drag-n-drop etc. If set to Inactive, then it serves as a chooser, as in the FileView.

MethodView

This is actually a collection of methods that provide a complete GUI for calling methods. Property lists defined on the kit Type registry are used for specifying the methods to call and their properties. Much of your toolbar and menu level GUI can be implemented in this system. See gi/prefs.go and giv/prefsview.go for how the GoGi Prefs dialog is implemented, and see the gide project for a more complex case.

Index

Constants

View Source
const (
	MaxLineLen = 64 * 1024 * 1024
	MaxNTags   = 1024
)

MaxLineLen prevents overflow in allocating line length

View Source
const (
	// EditSignal is used as an arg for edit methods with a signal arg, indicating
	// that a signal should be emitted.
	EditSignal = true

	// EditNoSignal is used as an arg for edit methods with a signal arg, indicating
	// that a signal should NOT be emitted.
	EditNoSignal = false

	// ReplaceMatchCase is used for MatchCase arg in ReplaceText method
	ReplaceMatchCase = true

	// ReplaceNoMatchCase is used for MatchCase arg in ReplaceText method
	ReplaceNoMatchCase = false
)
View Source
const (
	// TreeViewSelProp is a slice of tree views that are currently selected
	// -- much more efficient to update the list rather than regenerate it,
	// especially for a large tree
	TreeViewSelProp = "__SelectedList"

	// TreeViewSelModeProp is a bool that, if true, automatically selects nodes
	// when nodes are moved to via keyboard actions
	TreeViewSelModeProp = "__SelectMode"
)

These are special properties established on the RootView for maintaining overall tree state

View Source
const (
	// FileTreeExtFilesName is the name of the node that represents external files
	FileTreeExtFilesName = "[external files]"
)
View Source
const TreeViewTempMovedTag = `_\&MOVED\&`

This is a kind of hack to prevent moved items from being deleted, using DND

Variables

View Source
var ArgViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
	"#title": ki.Props{
		"max-width":      -1,
		"text-align":     gist.AlignCenter,
		"vertical-align": gist.AlignTop,
	},
}
View Source
var ColorViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
}
View Source
var DefaultTimeFormat = "2006-01-02 15:04:05 MST"
View Source
var DiffViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"max-width":        -1,
	"max-height":       -1,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"CallMethods": ki.PropSlice{
		{"SaveFileA", ki.Props{
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "FileA",
				}},
			},
		}},
		{"SaveFileB", ki.Props{
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "FileB",
				}},
			},
		}},
	},
}

DiffViewProps are style properties for DiffView

View Source
var FileInfoProps = ki.Props{
	"CtxtMenu": ki.PropSlice{
		{"Duplicate", ki.Props{
			"desc":    "Duplicate this file or folder",
			"confirm": true,
		}},
		{"Delete", ki.Props{
			"desc":    "Ok to delete this file or folder?  This is not undoable and is not moving to trash / recycle bin",
			"confirm": true,
		}},
		{"Rename", ki.Props{
			"desc": "Rename file to new file name",
			"Args": ki.PropSlice{
				{"New Name", ki.Props{
					"default-field": "Name",
				}},
			},
		}},
	},
}
View Source
var FileNodeHiStyle = histyle.StyleDefault

FileNodeHiStyle is the default style for syntax highlighting to use for file node buffers

View Source
var FileNodeProps = ki.Props{
	"EnumType:Flag": KiT_FileNodeFlags,
	"CallMethods": ki.PropSlice{
		{"RenameFile", ki.Props{
			"label": "Rename...",
			"desc":  "Rename file to new file name",
			"Args": ki.PropSlice{
				{"New Name", ki.Props{
					"width":         60,
					"default-field": "Nm",
				}},
			},
		}},
		{"OpenFileWith", ki.Props{
			"label": "Open With...",
			"desc":  "Open the file with given command...",
			"Args": ki.PropSlice{
				{"Command", ki.Props{
					"width": 60,
				}},
			},
		}},
		{"NewFile", ki.Props{
			"label": "New File...",
			"desc":  "Create a new file in this folder",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"width": 60,
				}},
				{"Add To Version Control", ki.Props{}},
			},
		}},
		{"NewFolder", ki.Props{
			"label": "New Folder...",
			"desc":  "Create a new folder within this folder",
			"Args": ki.PropSlice{
				{"Folder Name", ki.Props{
					"width": 60,
				}},
			},
		}},
		{"CommitToVcs", ki.Props{
			"label": "Commit to Vcs...",
			"desc":  "Commit this file to version control",
			"Args": ki.PropSlice{
				{"Message", ki.Props{
					"width": 60,
				}},
			},
		}},
	},
}
View Source
var FileTreeActiveDirFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		act.SetActiveState(fn.IsDir() && !fn.IsExternal())
	}
})

FileTreeActiveDirFunc is an ActionUpdateFunc that activates action if node is a dir

View Source
var FileTreeActiveExternFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		act.SetActiveState(fn.IsExternal() && !fn.IsIrregular())
	}
})

FileTreeActiveExternFunc is an ActionUpdateFunc that activates action if node is external

View Source
var FileTreeActiveInVcsFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		repo, _ := fn.Repo()
		if repo == nil || fn.IsDir() {
			act.SetActiveState((false))
			return
		}
		act.SetActiveState((fn.Info.Vcs >= vci.Stored))
	}
})

FileTreeActiveInVcsFunc is an ActionUpdateFunc that activates action if node is under version control

View Source
var FileTreeActiveInVcsModifiedFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		repo, _ := fn.Repo()
		if repo == nil || fn.IsDir() {
			act.SetActiveState((false))
			return
		}
		act.SetActiveState((fn.Info.Vcs == vci.Modified || fn.Info.Vcs == vci.Added))
	}
})

FileTreeActiveInVcsModifiedFunc is an ActionUpdateFunc that activates action if node is under version control and the file has been modified

View Source
var FileTreeActiveNotInVcsFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		repo, _ := fn.Repo()
		if repo == nil || fn.IsDir() {
			act.SetActiveState((false))
			return
		}
		act.SetActiveState((fn.Info.Vcs == vci.Untracked))
	}
})

FileTreeActiveNotInVcsFunc is an ActionUpdateFunc that inactivates action if node is not under version control

View Source
var FileTreeInactiveDirFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		act.SetInactiveState(fn.IsDir() || fn.IsExternal())
	}
})

FileTreeInactiveDirFunc is an ActionUpdateFunc that inactivates action if node is a dir

View Source
var FileTreeInactiveExternFunc = ActionUpdateFunc(func(fni any, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		act.SetInactiveState(fn.IsExternal())
	}
})

FileTreeInactiveExternFunc is an ActionUpdateFunc that inactivates action if node is external

View Source
var FileTreeProps = ki.Props{
	"EnumType:Flag": KiT_FileNodeFlags,
}
View Source
var FileTreeViewProps = ki.Props{
	"EnumType:Flag":    KiT_TreeViewFlags,
	"indent":           units.NewCh(2),
	"spacing":          units.NewCh(.5),
	"border-width":     units.NewPx(0),
	"border-radius":    units.NewPx(0),
	"padding":          units.NewPx(0),
	"margin":           units.NewPx(1),
	"text-align":       gist.AlignLeft,
	"vertical-align":   gist.AlignTop,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": "inherit",
	"no-templates":     true,
	".exec": ki.Props{
		"font-weight": gist.WeightBold,
	},
	".open": ki.Props{
		"font-style": gist.FontItalic,
	},
	".untracked": ki.Props{
		"color": "#808080",
	},
	".modified": ki.Props{
		"color": "#4b7fd1",
	},
	".added": ki.Props{
		"color": "#008800",
	},
	".deleted": ki.Props{
		"color": "#ff4252",
	},
	".conflicted": ki.Props{
		"color": "#ce8020",
	},
	".updated": ki.Props{
		"color": "#008060",
	},
	"#icon": ki.Props{
		"width":   units.NewEm(1),
		"height":  units.NewEm(1),
		"margin":  units.NewPx(0),
		"padding": units.NewPx(0),
		"fill":    &gi.Prefs.Colors.Icon,
		"stroke":  &gi.Prefs.Colors.Font,
	},
	"#branch": ki.Props{
		"icon":             "folder-open",
		"icon-off":         "folder",
		"margin":           units.NewPx(0),
		"padding":          units.NewPx(0),
		"background-color": color.Transparent,
		"max-width":        units.NewEm(.8),
		"max-height":       units.NewEm(.8),
	},
	"#space": ki.Props{
		"width": units.NewEm(.5),
	},
	"#label": ki.Props{
		"margin":    units.NewPx(0),
		"padding":   units.NewPx(0),
		"min-width": units.NewCh(16),
	},
	"#menu": ki.Props{
		"indicator": "none",
	},
	TreeViewSelectors[TreeViewActive]: ki.Props{},
	TreeViewSelectors[TreeViewSel]: ki.Props{
		"background-color": &gi.Prefs.Colors.Select,
	},
	TreeViewSelectors[TreeViewFocus]: ki.Props{
		"background-color": &gi.Prefs.Colors.Control,
	},
	"CtxtMenuActive": ki.PropSlice{
		{"ShowFileInfo", ki.Props{
			"label": "File Info",
		}},
		{"OpenFileDefault", ki.Props{
			"label": "Open (w/default app)",
		}},
		{"sep-act", ki.BlankProp{}},
		{"DuplicateFiles", ki.Props{
			"label":    "Duplicate",
			"updtfunc": FileTreeInactiveDirFunc,
			"shortcut": gi.KeyFunDuplicate,
		}},
		{"DeleteFiles", ki.Props{
			"label":    "Delete",
			"desc":     "Ok to delete file(s)?  This is not undoable and is not moving to trash / recycle bin",
			"updtfunc": FileTreeInactiveExternFunc,
			"shortcut": gi.KeyFunDelete,
		}},
		{"RenameFiles", ki.Props{
			"label":    "Rename",
			"desc":     "Rename file to new file name",
			"updtfunc": FileTreeInactiveExternFunc,
		}},
		{"sep-open", ki.BlankProp{}},
		{"OpenAll", ki.Props{
			"updtfunc": FileTreeActiveDirFunc,
		}},
		{"CloseAll", ki.Props{
			"updtfunc": FileTreeActiveDirFunc,
		}},
		{"SortBy", ki.Props{
			"desc":     "Choose how to sort files in the directory -- default by Name, optionally can use Modification Time",
			"updtfunc": FileTreeActiveDirFunc,
			"Args": ki.PropSlice{
				{"Modification Time", ki.Props{}},
			},
		}},
		{"sep-new", ki.BlankProp{}},
		{"NewFile", ki.Props{
			"label":    "New File...",
			"desc":     "make a new file in this folder",
			"shortcut": gi.KeyFunInsert,
			"updtfunc": FileTreeActiveDirFunc,
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"width": 60,
				}},
				{"Add To Version Control", ki.Props{}},
			},
		}},
		{"NewFolder", ki.Props{
			"label":    "New Folder...",
			"desc":     "make a new folder within this folder",
			"shortcut": gi.KeyFunInsertAfter,
			"updtfunc": FileTreeActiveDirFunc,
			"Args": ki.PropSlice{
				{"Folder Name", ki.Props{
					"width": 60,
				}},
			},
		}},
		{"sep-vcs", ki.BlankProp{}},
		{"AddToVcs", ki.Props{
			"desc":       "Add file to version control",
			"updtfunc":   FileTreeActiveNotInVcsFunc,
			"label-func": VcsLabelFunc,
		}},
		{"DeleteFromVcs", ki.Props{
			"desc":       "Delete file from version control",
			"updtfunc":   FileTreeActiveInVcsFunc,
			"label-func": VcsLabelFunc,
		}},
		{"CommitToVcs", ki.Props{
			"desc":       "Commit file to version control",
			"updtfunc":   FileTreeActiveInVcsModifiedFunc,
			"label-func": VcsLabelFunc,
		}},
		{"RevertVcs", ki.Props{
			"desc":       "Revert file to last commit",
			"updtfunc":   FileTreeActiveInVcsModifiedFunc,
			"label-func": VcsLabelFunc,
		}},
		{"sep-vcs-log", ki.BlankProp{}},
		{"DiffVcs", ki.Props{
			"desc":       "shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file.   -1, -2 etc also work as universal ways of specifying prior revisions.",
			"updtfunc":   FileTreeActiveInVcsFunc,
			"label-func": VcsLabelFunc,
			"Args": ki.PropSlice{
				{"Revision A", ki.Props{}},
				{"Revision B", ki.Props{}},
			},
		}},
		{"LogVcs", ki.Props{
			"desc":       "shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc (SVN only supports a max number of entries).  If allFiles is true, then the log will show revisions for all files, not just this one.",
			"updtfunc":   FileTreeActiveInVcsFunc,
			"label-func": VcsLabelFunc,
			"Args": ki.PropSlice{
				{"All Files", ki.Props{}},
				{"Since Date", ki.Props{}},
			},
		}},
		{"BlameVcs", ki.Props{
			"desc":       "shows the VCS blame report for this file, reporting for each line the revision and author of the last change.",
			"updtfunc":   FileTreeActiveInVcsFunc,
			"label-func": VcsLabelFunc,
		}},
		{"sep-extrn", ki.BlankProp{}},
		{"RemoveFromExterns", ki.Props{
			"desc":       "Remove file from external files listt",
			"updtfunc":   FileTreeActiveExternFunc,
			"label-func": VcsLabelFunc,
		}},
	},
}
View Source
var FileViewKindColorMap = map[string]string{
	"folder": "pref(link)",
}

FileViewKindColorMap translates file Kinds into different colors for the file viewer

View Source
var FileViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": &gi.Prefs.Colors.Background,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var FontChooserSize = 18

show fonts in a bigger size so you can actually see the differences

View Source
var FontChooserSizeDots = 18
View Source
var GiEditorProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
	"#title": ki.Props{
		"max-width":        -1,
		"horizontal-align": gist.AlignCenter,
		"vertical-align":   gist.AlignTop,
	},
	"ToolBar": ki.PropSlice{
		{"Update", ki.Props{
			"icon": "update",
			"updtfunc": ActionUpdateFunc(func(gei any, act *gi.Action) {
				ge := gei.(*GiEditor)
				act.SetActiveStateUpdt(ge.Changed)
			}),
		}},
		{"sep-file", ki.BlankProp{}},
		{"Open", ki.Props{
			"label": "Open",
			"icon":  "file-open",
			"desc":  "Open a json-formatted Ki tree structure",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "Filename",
					"ext":           ".json",
				}},
			},
		}},
		{"Save", ki.Props{
			"icon": "file-save",
			"desc": "Save json-formatted Ki tree structure to existing filename",
			"updtfunc": ActionUpdateFunc(func(gei any, act *gi.Action) {
				ge := gei.(*GiEditor)
				act.SetActiveStateUpdt(ge.Changed && ge.Filename != "")
			}),
		}},
		{"SaveAs", ki.Props{
			"label": "Save As...",
			"icon":  "file-save",
			"desc":  "Save as a json-formatted Ki tree structure",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "Filename",
					"ext":           ".json",
				}},
			},
		}},
	},
	"MainMenu": ki.PropSlice{
		{"AppMenu", ki.BlankProp{}},
		{"File", ki.PropSlice{
			{"Update", ki.Props{
				"updtfunc": ActionUpdateFunc(func(gei any, act *gi.Action) {
					ge := gei.(*GiEditor)
					act.SetActiveState(ge.Changed)
				}),
			}},
			{"sep-file", ki.BlankProp{}},
			{"Open", ki.Props{
				"shortcut": gi.KeyFunMenuOpen,
				"desc":     "Open a json-formatted Ki tree structure",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "Filename",
						"ext":           ".json",
					}},
				},
			}},
			{"Save", ki.Props{
				"shortcut": gi.KeyFunMenuSave,
				"desc":     "Save json-formatted Ki tree structure to existing filename",
				"updtfunc": ActionUpdateFunc(func(gei any, act *gi.Action) {
					ge := gei.(*GiEditor)
					act.SetActiveState(ge.Changed && ge.Filename != "")
				}),
			}},
			{"SaveAs", ki.Props{
				"shortcut": gi.KeyFunMenuSaveAs,
				"label":    "Save As...",
				"desc":     "Save as a json-formatted Ki tree structure",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "Filename",
						"ext":           ".json",
					}},
				},
			}},
			{"sep-close", ki.BlankProp{}},
			{"Close Window", ki.BlankProp{}},
		}},
		{"Edit", "Copy Cut Paste Dupe"},
		{"Window", "Windows"},
	},
}
View Source
var KeyChordEditProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"padding":          units.NewPx(2),
	"margin":           units.NewPx(2),
	"vertical-align":   gist.AlignTop,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": &gi.Prefs.Colors.Control,
	"border-width":     units.NewPx(1),
	"border-radius":    units.NewPx(4),
	"border-color":     &gi.Prefs.Colors.Border,
	"border-style":     gist.BorderSolid,
	"height":           units.NewEm(1),
	"width":            units.NewCh(20),
	"max-width":        -1,
	gi.LabelSelectors[gi.LabelActive]: ki.Props{
		"background-color": "lighter-0",
	},
	gi.LabelSelectors[gi.LabelInactive]: ki.Props{
		"color": "lighter-50",
	},
	gi.LabelSelectors[gi.LabelSelected]: ki.Props{
		"background-color": &gi.Prefs.Colors.Select,
	},
}
View Source
var KiT_ArgDataFlags = kit.Enums.AddEnumAltLower(ArgDataFlagsN, kit.BitFlag, nil, "ArgData")
View Source
var KiT_ArgView = kit.Types.AddType(&ArgView{}, ArgViewProps)
View Source
var KiT_BitFlagView = kit.Types.AddType(&BitFlagView{}, nil)
View Source
var KiT_BoolValueView = kit.Types.AddType(&BoolValueView{}, nil)
View Source
var KiT_ByteSliceValueView = kit.Types.AddType(&ByteSliceValueView{}, nil)
View Source
var KiT_ColorMapValueView = kit.Types.AddType(&ColorMapValueView{}, nil)
View Source
var KiT_ColorMapView = kit.Types.AddType(&ColorMapView{}, nil)
View Source
var KiT_ColorNameValueView = kit.Types.AddType(&ColorNameValueView{}, nil)
View Source
var KiT_ColorValueView = kit.Types.AddType(&ColorValueView{}, nil)
View Source
var KiT_ColorView = kit.Types.AddType(&ColorView{}, ColorViewProps)
View Source
var KiT_DiffTextView = kit.Types.AddType(&DiffTextView{}, TextViewProps)
View Source
var KiT_DiffView = kit.Types.AddType(&DiffView{}, DiffViewProps)
View Source
var KiT_DirFlags = kit.Enums.AddEnum(DirFlagsN, kit.BitFlag, nil)
View Source
var KiT_EnumValueView = kit.Types.AddType(&EnumValueView{}, nil)
View Source
var KiT_FileInfo = kit.Types.AddType(&FileInfo{}, FileInfoProps)
View Source
var KiT_FileNode = kit.Types.AddType(&FileNode{}, FileNodeProps)
View Source
var KiT_FileNodeFlags = kit.Enums.AddEnumExt(ki.KiT_Flags, FileNodeFlagsN, kit.BitFlag, nil)
View Source
var KiT_FileTree = kit.Types.AddType(&FileTree{}, FileTreeProps)
View Source
var KiT_FileTreeView = kit.Types.AddType(&FileTreeView{}, nil)
View Source
var KiT_FileValueView = kit.Types.AddType(&FileValueView{}, nil)
View Source
var KiT_FileView = kit.Types.AddType(&FileView{}, FileViewProps)
View Source
var KiT_FloatValueView = kit.Types.AddType(&FloatValueView{}, nil)
View Source
var KiT_FontValueView = kit.Types.AddType(&FontValueView{}, nil)
View Source
var KiT_GiEditor = kit.Types.AddType(&GiEditor{}, GiEditorProps)
View Source
var KiT_HiStyleValueView = kit.Types.AddType(&HiStyleValueView{}, nil)
View Source
var KiT_IconValueView = kit.Types.AddType(&IconValueView{}, nil)
View Source
var KiT_IntValueView = kit.Types.AddType(&IntValueView{}, nil)
View Source
var KiT_KeyChordEdit = kit.Types.AddType(&KeyChordEdit{}, KeyChordEditProps)
View Source
var KiT_KeyChordValueView = kit.Types.AddType(&KeyChordValueView{}, nil)
View Source
var KiT_KeyMapValueView = kit.Types.AddType(&KeyMapValueView{}, nil)
View Source
var KiT_KiPtrValueView = kit.Types.AddType(&KiPtrValueView{}, nil)
View Source
var KiT_MapInlineValueView = kit.Types.AddType(&MapInlineValueView{}, nil)
View Source
var KiT_MapValueView = kit.Types.AddType(&MapValueView{}, nil)
View Source
var KiT_MapView = kit.Types.AddType(&MapView{}, MapViewProps)
View Source
var KiT_MapViewInline = kit.Types.AddType(&MapViewInline{}, MapViewInlineProps)
View Source
var KiT_MethViewFlags = kit.Enums.AddEnumAltLower(MethViewFlagsN, kit.BitFlag, nil, "MethView")
View Source
var KiT_NilValueView = kit.Types.AddType(&NilValueView{}, nil)
View Source
var KiT_RuneSliceValueView = kit.Types.AddType(&RuneSliceValueView{}, nil)
View Source
var KiT_SliceInlineValueView = kit.Types.AddType(&SliceInlineValueView{}, nil)
View Source
var KiT_SliceValueView = kit.Types.AddType(&SliceValueView{}, nil)
View Source
var KiT_SliceView = kit.Types.AddType(&SliceView{}, SliceViewProps)
View Source
var KiT_SliceViewBase = kit.Types.AddType(&SliceViewBase{}, nil)
View Source
var KiT_SliceViewInline = kit.Types.AddType(&SliceViewInline{}, SliceViewInlineProps)
View Source
var KiT_StructInlineValueView = kit.Types.AddType(&StructInlineValueView{}, nil)
View Source
var KiT_StructValueView = kit.Types.AddType(&StructValueView{}, nil)
View Source
var KiT_StructView = kit.Types.AddType(&StructView{}, StructViewProps)
View Source
var KiT_StructViewInline = kit.Types.AddType(&StructViewInline{}, StructViewInlineProps)
View Source
var KiT_TableView = kit.Types.AddType(&TableView{}, TableViewProps)
View Source
var KiT_TextBuf = kit.Types.AddType(&TextBuf{}, TextBufProps)
View Source
var KiT_TextBufFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, TextBufFlagsN, kit.BitFlag, nil)
View Source
var KiT_TextView = kit.Types.AddType(&TextView{}, TextViewProps)
View Source
var KiT_TextViewFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, TextViewFlagsN, kit.BitFlag, nil)
View Source
var KiT_TimeValueView = kit.Types.AddType(&TimeValueView{}, nil)
View Source
var KiT_TreeView = kit.Types.AddType(&TreeView{}, nil)
View Source
var KiT_TreeViewFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, TreeViewFlagsN, kit.BitFlag, nil)
View Source
var KiT_TwinTextViews = kit.Types.AddType(&TwinTextViews{}, TwinTextViewsProps)
View Source
var KiT_TypeValueView = kit.Types.AddType(&TypeValueView{}, nil)
View Source
var KiT_VCSLogView = kit.Types.AddType(&VCSLogView{}, VCSLogViewProps)
View Source
var KiT_ValueViewBase = kit.Types.AddType(&ValueViewBase{}, ValueViewBaseProps)
View Source
var KiT_VersCtrlValueView = kit.Types.AddType(&VersCtrlValueView{}, nil)
View Source
var MapInlineLen = 3

MapInlineLen is the number of map elements at or below which an inline representation of the map will be presented -- more convenient for small #'s of props

View Source
var MapViewInlineProps = ki.Props{
	"EnumType:Flag": gi.KiT_NodeFlags,
	"min-width":     units.NewEx(60),
}
View Source
var MapViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var MethArgHist = map[string]any{}

MethArgHist stores the history of method arg values -- used for setting defaults for next time the method is called. Key is type:method name

View Source
var MethodViewCallMethsProp = "__MethViewCallMeths"

This is the name of the property that holds cached map of compiled callable methods

View Source
var PrevISearchString string

PrevISearchString is the previous ISearch string

View Source
var PrevQReplaceFinds []string

PrevQReplaceFinds are the previous QReplace strings

View Source
var PrevQReplaceRepls []string

PrevQReplaceRepls are the previous QReplace strings

View Source
var SliceInlineLen = 6

SliceInlineLen is the number of slice elements below which inline will be used

View Source
var SliceViewInlineProps = ki.Props{
	"EnumType:Flag": gi.KiT_NodeFlags,
	"min-width":     units.NewCh(20),
}
View Source
var SliceViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var StructInlineLen = 6

StructInlineLen is the number of elemental struct fields at or below which an inline representation of the struct will be presented -- more convenient for small structs

View Source
var StructViewInlineProps = ki.Props{
	"EnumType:Flag": gi.KiT_NodeFlags,
}
View Source
var StructViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var TVBranchProps = ki.Props{
	"fill":   &gi.Prefs.Colors.Icon,
	"stroke": &gi.Prefs.Colors.Font,
}
View Source
var TableViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var TextBufDiffRevertDiffs = 20

TextBufDiffRevertDiffs is max number of difference regions to apply for diff-based revert otherwise just reopens file

View Source
var TextBufDiffRevertLines = 10000

TextBufDiffRevertLines is max number of lines to use the diff-based revert, which results in faster reverts but only if the file isn't too big..

View Source
var TextBufMarkupDelayMSec = 1000

TextBufMarkupDelayMSec is the number of milliseconds to wait before starting a new background markup process, after text is entered in the line

View Source
var TextBufMaxScopeLines = 100

TextBufMaxScopeLines is the maximum lines to search for a scope marker, e.g. '}'

View Source
var TextBufProps = ki.Props{
	"EnumType:Flag": KiT_TextBufFlags,
	"CallMethods": ki.PropSlice{
		{"SaveAs", ki.Props{
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "Filename",
				}},
			},
		}},
	},
}
View Source
var TextViewBlinkMu sync.Mutex

TextViewBlinkMu is mutex protecting TextViewBlink updating and access

View Source
var TextViewBlinker *time.Ticker

TextViewBlinker is the time.Ticker for blinking cursors for text fields, only one of which can be active at at a time

View Source
var TextViewClipHistChooseLen = 40

TextViewClipHistChooseLen is the max length of clip history to show in chooser

View Source
var TextViewClipHistMax = 100

Maximum amount of clipboard history to retain

View Source
var TextViewClipHistory [][]byte

TextViewClipHistory is the text view clipboard history -- everything that has been copied

View Source
var TextViewClipRect *textbuf.Edit

TextViewClipRect is the internal clipboard for Rect rectangle-based regions -- the raw text is posted on the system clipboard but the rect information is in a special format.

View Source
var TextViewDepthColors = []gist.Color{
	{0, 0, 0, 0},
	{5, 5, 0, 0},
	{15, 15, 0, 0},
	{5, 15, 0, 0},
	{0, 15, 5, 0},
	{0, 15, 15, 0},
	{0, 5, 15, 0},
	{5, 0, 15, 0},
	{5, 0, 5, 0},
}

TextViewDepthOffsets are changes in color values from default background for different depths. For dark mode, these are increments, for light mode they are decrements.

View Source
var TextViewMaxFindHighlights = 1000

TextViewMaxFindHighlights is the maximum number of regions to highlight on find

View Source
var TextViewProps = ki.Props{
	"EnumType:Flag":    KiT_TextViewFlags,
	"white-space":      gist.WhiteSpacePreWrap,
	"border-width":     0,
	"cursor-width":     units.NewPx(3),
	"border-color":     &gi.Prefs.Colors.Border,
	"border-style":     gist.BorderSolid,
	"padding":          units.NewPx(2),
	"margin":           units.NewPx(2),
	"vertical-align":   gist.AlignTop,
	"text-align":       gist.AlignLeft,
	"tab-size":         4,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": &gi.Prefs.Colors.Background,
	TextViewSelectors[TextViewActive]: ki.Props{
		"background-color": "highlight-10",
	},
	TextViewSelectors[TextViewFocus]: ki.Props{
		"background-color": "lighter-0",
	},
	TextViewSelectors[TextViewInactive]: ki.Props{
		"background-color": "highlight-20",
	},
	TextViewSelectors[TextViewSel]: ki.Props{
		"background-color": &gi.Prefs.Colors.Select,
	},
	TextViewSelectors[TextViewHighlight]: ki.Props{
		"background-color": &gi.Prefs.Colors.Highlight,
	},
}
View Source
var TextViewSelectors = []string{":active", ":focus", ":inactive", ":selected", ":highlight"}

Style selector names for the different states

View Source
var TextViewSpriteName = "giv.TextView.Cursor"

TextViewSpriteName is the name of the window sprite used for the cursor

View Source
var TreeViewPageSteps = 10

TreeViewPageSteps is the number of steps to take in PageUp / Down events

View Source
var TreeViewProps = ki.Props{
	"EnumType:Flag":    KiT_TreeViewFlags,
	"indent":           units.NewCh(4),
	"spacing":          units.NewCh(.5),
	"border-width":     units.NewPx(0),
	"border-radius":    units.NewPx(0),
	"padding":          units.NewPx(0),
	"margin":           units.NewPx(1),
	"text-align":       gist.AlignLeft,
	"vertical-align":   gist.AlignTop,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": "inherit",
	"#icon": ki.Props{
		"width":   units.NewEm(1),
		"height":  units.NewEm(1),
		"margin":  units.NewPx(0),
		"padding": units.NewPx(0),
		"fill":    &gi.Prefs.Colors.Icon,
		"stroke":  &gi.Prefs.Colors.Font,
	},
	"#branch": ki.Props{
		"icon":             "wedge-down",
		"icon-off":         "wedge-right",
		"margin":           units.NewPx(0),
		"padding":          units.NewPx(0),
		"background-color": color.Transparent,
		"max-width":        units.NewEm(.8),
		"max-height":       units.NewEm(.8),
	},
	"#space": ki.Props{
		"width": units.NewEm(0.5),
	},
	"#label": ki.Props{
		"margin":    units.NewPx(0),
		"padding":   units.NewPx(0),
		"min-width": units.NewCh(16),
	},
	"#menu": ki.Props{
		"indicator": "none",
	},
	TreeViewSelectors[TreeViewActive]: ki.Props{},
	TreeViewSelectors[TreeViewSel]: ki.Props{
		"background-color": &gi.Prefs.Colors.Select,
	},
	TreeViewSelectors[TreeViewFocus]: ki.Props{
		"background-color": &gi.Prefs.Colors.Control,
	},
	TreeViewSelectors[TreeViewInactive]: ki.Props{
		"background-color": "highlight-10",
	},
	"CtxtMenuActive": ki.PropSlice{
		{"SrcAddChild", ki.Props{
			"label": "Add Child",
		}},
		{"SrcInsertBefore", ki.Props{
			"label":    "Insert Before",
			"shortcut": gi.KeyFunInsert,
			"updtfunc": ActionUpdateFunc(func(tvi any, act *gi.Action) {
				tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
				act.SetInactiveState(tv.IsRootOrField(""))
			}),
		}},
		{"SrcInsertAfter", ki.Props{
			"label":    "Insert After",
			"shortcut": gi.KeyFunInsertAfter,
			"updtfunc": ActionUpdateFunc(func(tvi any, act *gi.Action) {
				tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
				act.SetInactiveState(tv.IsRootOrField(""))
			}),
		}},
		{"SrcDuplicate", ki.Props{
			"label":    "Duplicate",
			"shortcut": gi.KeyFunDuplicate,
			"updtfunc": ActionUpdateFunc(func(tvi any, act *gi.Action) {
				tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
				act.SetInactiveState(tv.IsRootOrField(""))
			}),
		}},
		{"SrcDelete", ki.Props{
			"label":    "Delete",
			"shortcut": gi.KeyFunDelete,
			"updtfunc": ActionUpdateFunc(func(tvi any, act *gi.Action) {
				tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
				act.SetInactiveState(tv.IsRootOrField(""))
			}),
		}},
		{"sep-edit", ki.BlankProp{}},
		{"Copy", ki.Props{
			"shortcut": gi.KeyFunCopy,
			"Args": ki.PropSlice{
				{"reset", ki.Props{
					"value": true,
				}},
			},
		}},
		{"Cut", ki.Props{
			"shortcut": gi.KeyFunCut,
			"updtfunc": ActionUpdateFunc(func(tvi any, act *gi.Action) {
				tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
				act.SetInactiveState(tv.IsRootOrField(""))
			}),
		}},
		{"Paste", ki.Props{
			"shortcut": gi.KeyFunPaste,
		}},
		{"sep-win", ki.BlankProp{}},
		{"SrcEdit", ki.Props{
			"label": "Edit",
		}},
		{"SrcGoGiEditor", ki.Props{
			"label": "GoGi Editor",
		}},
		{"sep-open", ki.BlankProp{}},
		{"OpenAll", ki.Props{}},
		{"CloseAll", ki.Props{}},
	},
	"CtxtMenuInactive": ki.PropSlice{
		{"Copy", ki.Props{
			"shortcut": gi.KeyFunCopy,
			"Args": ki.PropSlice{
				{"reset", ki.Props{
					"value": true,
				}},
			},
		}},
		{"SrcEdit", ki.Props{
			"label": "Edit",
		}},
		{"SrcGoGiEditor", ki.Props{
			"label": "GoGi Editor",
		}},
	},
}
View Source
var TreeViewSelectors = []string{":active", ":selected", ":focus", ":inactive"}

TreeViewSelectors are Style selector names for the different states:

View Source
var TwinTextViewsProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"max-width":        -1,
	"max-height":       -1,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
}

TwinTextViewsProps are style properties for TwinTextViews

View Source
var VCSLogViewProps = ki.Props{
	"EnumType:Flag": gi.KiT_NodeFlags,
	"max-width":     -1,
	"max-height":    -1,
}

VCSLogViewProps are style properties for DebugView

View Source
var ValueViewBaseProps = ki.Props{
	"base-type": true,
}
View Source
var ValueViewMap map[string]ValueViewFunc

The ValueViewMap is used to connect type names with corresponding ValueView representations of those types -- this can be used when it is not possible to use the ValueViewer interface (e.g., interface methods can only be defined within the package that defines the type -- so we need this for all types in gi which don't know about giv). You must use kit.LongTypeName (full package name + "." . type name) for the type name, as that is how it will be looked up.

View Source
var VcsLabelFunc = LabelFunc(func(fni any, act *gi.Action) string {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	label := act.Text
	if fn != nil {
		repo, _ := fn.Repo()
		if repo != nil {
			label = strings.Replace(label, "Vcs", string(repo.Vcs()), 1)
		}
	}
	return label
})

VcsGetRemoveLabelFunc gets the appropriate label for removing from version control

View Source
var VersCtrlSystems = []string{"git", "svn", "bzr", "hg"}

VersCtrlSystems is a list of supported Version Control Systems. These must match the VCS Types from goki/pi/vci which in turn is based on masterminds/vcs

Functions

func ActionView

func ActionView(val any, vtyp reflect.Type, vp *gi.Viewport2D, ac *gi.Action, props ki.Props) bool

ActionView configures given action with given props

func ActionViewArgsValidate

func ActionViewArgsValidate(md *MethViewData, vtyp reflect.Type, meth reflect.Method, argprops ki.PropSlice) bool

ActionViewArgsValidate validates the Args properties relative to number of args on type

func ActionsView

func ActionsView(val any, vtyp reflect.Type, vp *gi.Viewport2D, pa *gi.Action, pp any) bool

ActionsView processes properties for parent action pa for overall object val of given type -- could have a sub-menu of further actions or might just be a single action

func ArgViewDialog

func ArgViewDialog(avp *gi.Viewport2D, args []ArgData, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

ArgViewDialog for editing args for a method call in the MethView system

func CallMethod

func CallMethod(val any, method string, vp *gi.Viewport2D) bool

CallMethod calls given method on given object val, using GUI interface to prompt for args. This only works for methods that have been configured either on the CallMethods list or any of the ToolBar, MainMenu, or CtxtMenu lists (in that order). List of available methods is cached in type properties after first call. gopy:interface=handle

func ColorViewDialog

func ColorViewDialog(avp *gi.Viewport2D, clr gist.Color, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

ColorViewDialog for editing a color using a ColorView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)

func ColorViewDialogValue

func ColorViewDialogValue(dlg *gi.Dialog) gist.Color

ColorViewDialogValue gets the color from the dialog

func CompleteEditPi added in v0.9.6

func CompleteEditPi(data any, text string, cursorPos int, comp complete.Completion, seed string) (ed complete.Edit)

CompleteEditPi uses the selected completion to edit the text

func CompletePi added in v0.9.6

func CompletePi(data any, text string, posLn, posCh int) (md complete.Matches)

CompletePi uses GoPi symbols and language -- the string is a line of text up to point where user has typed. The data must be the *FileState from which the language type is obtained.

func CompleteText

func CompleteText(data any, text string, posLn, posCh int) (md complete.Matches)

CompleteText does completion for text files

func CompleteTextEdit

func CompleteTextEdit(data any, text string, cursorPos int, completion complete.Completion, seed string) (ed complete.Edit)

CompleteTextEdit uses the selected completion to edit the text

func CopyFile

func CopyFile(dst, src string, perm os.FileMode) error

CopyFile copies the contents from src to dst atomically. If dst does not exist, CopyFile creates it with permissions perm. If the copy fails, CopyFile aborts and dst is preserved.

func CtxtMenuView

func CtxtMenuView(val any, inactive bool, vp *gi.Viewport2D, menu *gi.Menu) bool

CtxtMenuView configures a popup context menu according to the "CtxtMenu" properties registered on the type for given value element, through the kit.AddType method. See https://github.com/goki/gi/wiki/Views for full details on formats and options for configuring the menu. It looks first for "CtxtMenuActive" or "CtxtMenuInactive" depending on inactive flag (which applies to the gui view), so you can have different menus in those cases, and then falls back on "CtxtMenu". Returns false if there is no context menu defined for this type, or on errors (which are programmer errors sent to log).

func DirAndFile added in v0.9.11

func DirAndFile(file string) string

DirAndFile returns the final dir and file name.

func FileNames added in v0.9.5

func FileNames(d os.File, names *[]string) (err error)

FileNames recursively adds fullpath filenames within the starting directory to the "names" slice. Directory names within the starting directory are not added.

func FileNodeBufSigRecv added in v0.9.5

func FileNodeBufSigRecv(rvwki, sbufki ki.Ki, sig int64, data any)

FileNodeBufSigRecv receives a signal from the buffer and updates view accordingly

func FileNodeNameCountSort added in v0.9.15

func FileNodeNameCountSort(ecs []FileNodeNameCount)

func FileViewDialog

func FileViewDialog(avp *gi.Viewport2D, filename, ext string, opts DlgOpts, filterFunc FileViewFilterFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

FileViewDialog is for selecting / manipulating files -- ext is one or more (comma separated) extensions -- files with those will be highlighted (include the . at the start of the extension). recv and dlgFunc connect to the dialog signal: if signal value is gi.DialogAccepted use FileViewDialogValue to get the resulting selected file. The optional filterFunc can filter files shown in the view -- e.g., FileViewDirOnlyFilter (for only showing directories) and FileViewExtOnlyFilter (for only showing directories).

func FileViewDialogValue

func FileViewDialogValue(dlg *gi.Dialog) string

FileViewDialogValue gets the full path of selected file

func FileViewDirOnlyFilter

func FileViewDirOnlyFilter(fv *FileView, fi *FileInfo) bool

FileViewDirOnlyFilter is a FileViewFilterFunc that only shows directories (folders).

func FileViewExtOnlyFilter

func FileViewExtOnlyFilter(fv *FileView, fi *FileInfo) bool

FileViewExtOnlyFilter is a FileViewFilterFunc that only shows files that match the target extensions, and directories.

func FileViewStyleFunc

func FileViewStyleFunc(tv *TableView, slice any, widg gi.Node2D, row, col int, vv ValueView)

func FontChooserDialog

func FontChooserDialog(avp *gi.Viewport2D, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

FontChooserDialog for choosing a font -- the recv and func signal receivers if non-nil are connected to the selection signal for the struct table view, so they are updated with that

func FontInfoStyleFunc

func FontInfoStyleFunc(tv *TableView, slice any, widg gi.Node2D, row, col int, vv ValueView)

func HTMLEscapeBytes added in v0.9.7

func HTMLEscapeBytes(b []byte) []byte

HTMLEscapeBytes escapes special characters like "<" to become "&lt;". It escapes only five such characters: <, >, &, ' and ". It operates on a *copy* of the byte string and does not modify the input! otherwise it causes major problems..

func HTMLEscapeRunes added in v0.9.11

func HTMLEscapeRunes(r []rune) []byte

HTMLEscapeRunes escapes special characters like "<" to become "&lt;". It escapes only five such characters: <, >, &, ' and ". It operates on a *copy* of the byte string and does not modify the input! otherwise it causes major problems..

func HasMainMenuView

func HasMainMenuView(val any) bool

HasMainMenuView returns true if given val has a MainMenu type property registered -- call this to check before then calling MainMenuView

func HasToolBarView

func HasToolBarView(val any) bool

HasToolBarView returns true if given val has a ToolBar type property registered -- call this to check before then calling ToolBarView.

func HiStylesView

func HiStylesView(st *histyle.Styles)

HiStylesView opens a view of highlighting styles

func IconChooserDialog

func IconChooserDialog(avp *gi.Viewport2D, curIc gi.IconName, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

IconChooserDialog for choosing an Icon -- the recv and fun signal receivers if non-nil are connected to the selection signal for the slice view, and the dialog signal.

func IconChooserStyleFunc

func IconChooserStyleFunc(sv *SliceView, slice any, widg gi.Node2D, row int, vv ValueView)

func IsVersCtrlSystem added in v1.3.12

func IsVersCtrlSystem(str string) bool

IsVersCtrlSystem returns true if the given string matches one of the standard VersCtrlSystems -- uses lowercase version of str.

func KeyMapsView

func KeyMapsView(km *gi.KeyMaps)

KeyMapsView opens a view of a key maps table

func LookupPi added in v0.9.11

func LookupPi(data any, text string, posLn, posCh int) (ld complete.Lookup)

LookupPi uses GoPi symbols and language -- the string is a line of text up to point where user has typed. The data must be the *FileState from which the language type is obtained.

func MainMenuView(val any, win *gi.Window, mbar *gi.MenuBar) bool

MainMenuView configures the given MenuBar according to the "MainMenu" properties registered on the type for given value element, through the kit.AddType method. See https://github.com/goki/gi/wiki/Views for full details on formats and options for configuring the menu. Returns false if there is no main menu defined for this type, or on errors (which are programmer errors sent to log). gopy:interface=handle

func MapViewDialog

func MapViewDialog(avp *gi.Viewport2D, mp any, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

MapViewDialog is for editing elements of a map using a MapView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore) gopy:interface=handle

func MethViewArgDefaultVal

func MethViewArgDefaultVal(md *MethViewData, ai int) (any, bool)

MethViewArgDefaultVal returns the default value of the given argument index

func MethViewCall

func MethViewCall(recv, send ki.Ki, sig int64, data any)

MethViewCall is the receiver func for MethView actions that call a method -- it uses the MethViewData to call the target method.

func MethViewCallMeth

func MethViewCallMeth(md *MethViewData, args []reflect.Value)

MethViewCallMeth calls the method with given args, and processes the results as specified in the MethViewData.

func MethViewCallNoArgPrompt

func MethViewCallNoArgPrompt(ac *gi.Action, md *MethViewData, args []reflect.Value)

MethViewCallNoArgPrompt calls the method in case where there is no prompting otherwise of the user for arg values -- checks for Confirm case or otherwise directly calls method

func MethViewCompileActions

func MethViewCompileActions(cmp ki.Props, val any, vtyp reflect.Type, vp *gi.Viewport2D, pnm string, pp any) bool

MethViewCompileActions processes properties for parent action pa for overall object val of given type -- could have a sub-menu of further actions or might just be a single action

func MethViewCompileMeths

func MethViewCompileMeths(val any, vp *gi.Viewport2D) ki.Props

MethViewCompileMeths gets all methods either on the CallMethods list or any of the ToolBar, MainMenu, or CtxtMenu lists (in that order). Returns property list of them, which are just names -> Actions

func MethViewErr

func MethViewErr(vtyp reflect.Type, msg string)

MethViewErr is error logging function for MethView system, showing the type info

func MethViewFieldValue

func MethViewFieldValue(vval reflect.Value, field string) (*reflect.Value, bool)

MethViewFieldValue returns a reflect.Value for the given field name, checking safely (false if not found)

func MethViewNoUpdateAfterProp

func MethViewNoUpdateAfterProp(val any) bool

MethViewNoUpdateAfterProp returns true if given val has a top-level "MethViewNoUpdateAfter" type property registered -- some types generically want that and it is much easier to just specify once instead of every time..

func MethViewSetActionData

func MethViewSetActionData(ac *gi.Action, val any, vp *gi.Viewport2D)

MethViewSetActionData sets the MethViewData associated with the given action with values updated from the given val and viewport

func MethViewShowValue added in v0.9.7

func MethViewShowValue(vp *gi.Viewport2D, val reflect.Value, title, prompt string)

MethViewShowValue displays a value in a dialog window (e.g., for MethViewShowReturn)

func MethViewSubMenuFunc

func MethViewSubMenuFunc(aki ki.Ki, m *gi.Menu)

MethViewSubMenuFunc is a MakeMenuFunc for items that have submenus

func MethViewTypeProps

func MethViewTypeProps(val any) (ki.Props, reflect.Type, bool)

MethViewTypeProps gets props, typ of val, returns false if not found or other err

func MethViewUpdateFunc

func MethViewUpdateFunc(act *gi.Action)

MethViewUpdateFunc is general Action.UpdateFunc that then calls any MethViewData.UpdateFunc from its data

func OSOpenCommand added in v0.9.14

func OSOpenCommand() string

OSOpenCommand returns the generic file 'open' command to open file with default app open on Mac, xdg-open on Linux, and start on Windows

func PrefsDbgView

func PrefsDbgView(pf *gi.PrefsDebug) *gi.Window

PrefsDbgView opens a view of user debugging preferences

func PrefsDetView

func PrefsDetView(pf *gi.PrefsDetailed) *gi.Window

PrefsDetView opens a view of user detailed preferences

func PrefsView

func PrefsView(pf *gi.Preferences) *gi.Window

PrefsView opens a view of user preferences

func QReplaceDialog

func QReplaceDialog(avp *gi.Viewport2D, find string, lexitems bool, opts gi.DlgOpts, recv ki.Ki, fun ki.RecvFunc) *gi.Dialog

QReplaceDialog prompts the user for a query-replace items, with comboboxes with history

func QReplaceDialogValues

func QReplaceDialogValues(dlg *gi.Dialog) (find, repl string, lexItems bool)

QReplaceDialogValues gets the string values

func RelFilePath added in v0.9.11

func RelFilePath(file, root string) string

RelFilePath returns the file name relative to given root file path, if it is under that root -- otherwise it returns the final dir and file name.

func SetSoloValueIface added in v1.0.16

func SetSoloValueIface(vv *ValueViewBase, val any)

SetSoloValueIface sets the value for a singleton standalone value using an interface for the value -- you must pass a pointer. for now, this cannot be a method because gopy doesn't find the key comment below that tells it what to do with the interface gopy:interface=handle

func SliceIdxByValue added in v0.9.8

func SliceIdxByValue(slc any, fldVal any) (int, bool)

SliceIdxByValue searches for first index that contains given value in slice -- returns false if not found

func SliceViewDialog

func SliceViewDialog(avp *gi.Viewport2D, slice any, opts DlgOpts, styleFunc SliceViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

SliceViewDialog for editing elements of a slice using a SliceView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Also has an optional styling function for styling elements of the table. gopy:interface=handle

func SliceViewDialogNoStyle added in v0.9.9

func SliceViewDialogNoStyle(avp *gi.Viewport2D, slice any, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

SliceViewDialogNoStyle for editing elements of a slice using a SliceView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). This version does not have the style function. gopy:interface=handle

func SliceViewSelectDialog

func SliceViewSelectDialog(avp *gi.Viewport2D, slice, curVal any, opts DlgOpts, styleFunc SliceViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

SliceViewSelectDialog for selecting one row from given slice -- connections functions available for both the widget signal reporting selection events, and the overall dialog signal. Also has an optional styling function for styling elements of the table. gopy:interface=handle

func SliceViewSelectDialogValue

func SliceViewSelectDialogValue(dlg *gi.Dialog) int

SliceViewSelectDialogValue gets the index of the selected item (-1 if nothing selected)

func SrcNodeSignalFunc added in v0.9.11

func SrcNodeSignalFunc(tvki, send ki.Ki, sig int64, data any)

SrcNodeSignalFunc is the function for receiving node signals from our SrcNode

func StructFieldIsDef added in v0.9.8

func StructFieldIsDef(defs string, valPtr any, kind reflect.Kind) (bool, string)

StructFieldIsDef processses "def" tag for default value(s) of field defs = default values as strings as either comma-separated list of valid values or low:high value range (only for int or float numeric types) valPtr = pointer to value returns true if value is default, and string to add to tooltip for default values. Uses JSON format for composite types (struct, slice, map), replacing " with ' so it is easier to use in def tag.

func StructNonDefFieldsStr added in v0.9.8

func StructNonDefFieldsStr(structPtr any, path string) string

StructNonDefFieldsStr processses "def" tag for default value(s) of fields in given struct, and returns a string of all those not at their default values, in format: Path.Field: val // default value(s) Uses a recursive strategy -- any fields that are themselves structs are expanded, and the field name represented by dots path separators.

func StructSliceIdxByValue added in v0.9.8

func StructSliceIdxByValue(struSlice any, fldName string, fldVal any) (int, error)

StructSliceIdxByValue searches for first index that contains given value in field of given name.

func StructTagVal added in v1.0.16

func StructTagVal(key, tags string) string

StructTagVal returns the value for given key in given struct tag string uses reflect.StructTag Lookup method -- just a wrapper for external use (e.g., in Python code)

func StructViewDialog

func StructViewDialog(avp *gi.Viewport2D, stru any, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

StructViewDialog is for editing fields of a structure using a StructView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore) gopy:interface=handle

func StructViewFieldDefTag added in v0.9.8

func StructViewFieldDefTag(vv ValueView, lbl *gi.Label) (hasDef bool, isDef bool, defStr string)

StructViewFieldDefTag processes the "def" tag for default values -- can be called multiple times for updating as values change. returns true if value is default, and string to add to tooltip for default vals

func StructViewFieldTags added in v0.9.8

func StructViewFieldTags(vv ValueView, lbl *gi.Label, widg gi.Node2D, isInact bool) (hasDef, inactTag bool)

StructViewFieldTags processes the tags for a field in a struct view, setting the properties on the label or widget appropriately returns true if there were any "def" default tags -- if so, needs updating

func StructViewIf added in v1.3.10

func StructViewIf(viewif string, field reflect.StructField, stru any) bool

StructViewIf parses given `viewif:"expr"` expression and returns true if should be visible, false if not. Prints an error if the expression is not parsed properly or does not evaluate to a boolean.

func TableViewDialog

func TableViewDialog(avp *gi.Viewport2D, slcOfStru any, opts DlgOpts, styleFunc TableViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

TableViewDialog is for editing fields of a slice-of-struct using a TableView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Also has an optional styling function for styling elements of the table. gopy:interface=handle

func TableViewSelectDialog

func TableViewSelectDialog(avp *gi.Viewport2D, slcOfStru any, opts DlgOpts, initRow int, styleFunc TableViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

TableViewSelectDialog is for selecting a row from a slice-of-struct using a TableView -- optionally connects to given signal receiving object and functions for signals (nil to ignore): selFunc for the widget signal reporting selection events, and dlgFunc for the overall dialog signals. Also has an optional styling function for styling elements of the table. gopy:interface=handle

func TableViewSelectDialogValue

func TableViewSelectDialogValue(dlg *gi.Dialog) int

TableViewSelectDialogValue gets the index of the selected item (-1 if nothing selected)

func TextViewBlink()

TextViewBlink is function that blinks text field cursor

func TextViewBufSigRecv

func TextViewBufSigRecv(rvwki ki.Ki, sbufki ki.Ki, sig int64, data any)

TextViewBufSigRecv receives a signal from the buffer and updates view accordingly

func TextViewClipHistAdd

func TextViewClipHistAdd(clip []byte)

TextViewClipHistAdd adds the given clipboard bytes to top of history stack

func TextViewClipHistChooseList

func TextViewClipHistChooseList() []string

TextViewClipHistChooseList returns a string slice of length-limited clip history, for chooser

func ToolBarView

func ToolBarView(val any, vp *gi.Viewport2D, tb *gi.ToolBar) bool

ToolBarView configures ToolBar according to the "ToolBar" properties registered on the type for given value element, through the kit.AddType method. See https://github.com/goki/gi/wiki/Views for full details on formats and options for configuring the menu. Returns false if there is no toolbar defined for this type, or on errors (which are programmer errors sent to log).

func VCSLogViewDialog added in v0.9.13

func VCSLogViewDialog(repo vci.Repo, lg vci.Log, file, since string) *gi.Dialog

VCSLogViewDialog opens a VCS Log View for given repo, log and file (file could be empty)

func ValueViewMapAdd added in v0.9.8

func ValueViewMapAdd(typeNm string, fun ValueViewFunc)

ValueViewMapAdd adds a ValueViewFunc for a given type name. You must use kit.LongTypeName (full package name + "." . type name) for the type name, as that is how it will be looked up.

Types

type ActionUpdateFunc

type ActionUpdateFunc func(it any, act *gi.Action)

ActionUpdateFunc is a function that updates method active / inactive status first argument is the object on which the method is defined (receiver)

type ArgData

type ArgData struct {
	Val     reflect.Value
	Name    string
	Desc    string
	View    ValueView
	Default any
	Flags   ArgDataFlags
}

ArgData contains the relevant data for each arg, including the reflect.Value, name, optional description, and default value

func MethViewArgData

func MethViewArgData(md *MethViewData) (ads []ArgData, args []reflect.Value, nprompt int, ok bool)

MethViewArgData gets the arg data for the method args, returns false if errors -- nprompt is the number of args that require prompting from the user (minus any cases with value: set directly)

func (*ArgData) HasDef

func (ad *ArgData) HasDef() bool

func (*ArgData) HasValSet

func (ad *ArgData) HasValSet() bool

func (*ArgData) SetHasDef

func (ad *ArgData) SetHasDef()

type ArgDataFlags

type ArgDataFlags int32

ArgDataFlags define bitflags for method view action options

const (
	// ArgDataHasDef means that there was a Default value set
	ArgDataHasDef ArgDataFlags = iota

	// ArgDataValSet means that there is a fixed value for this arg, given in
	// the config props and set in the Default, so it does not need to be
	// prompted for
	ArgDataValSet

	ArgDataFlagsN
)

func (*ArgDataFlags) FromString

func (i *ArgDataFlags) FromString(s string) error

func (ArgDataFlags) String

func (i ArgDataFlags) String() string

type ArgView

type ArgView struct {
	gi.Frame
	Args     []ArgData `desc:"the args that we are a view onto"`
	Title    string    `desc:"title / prompt to show above the editor fields"`
	ViewSig  ki.Signal `` /* 179-byte string literal not displayed */
	ViewPath string    `` /* 134-byte string literal not displayed */
}

ArgView represents a slice of reflect.Value's and associated names, for the purpose of supplying arguments to methods called via the MethView framework.

func (*ArgView) ArgsGrid

func (av *ArgView) ArgsGrid() *gi.Frame

ArgsGrid returns the grid layout widget, which contains all the fields and values, and its index, within frame

func (*ArgView) Config added in v0.9.8

func (av *ArgView) Config()

Config configures the view

func (*ArgView) ConfigArgsGrid

func (av *ArgView) ConfigArgsGrid()

ConfigArgsGrid configures the ArgsGrid for the current struct

func (*ArgView) Disconnect added in v0.9.8

func (av *ArgView) Disconnect()

func (*ArgView) SetArgs

func (av *ArgView) SetArgs(arg []ArgData)

SetArgs sets the source args that we are viewing -- rebuilds the children to represent

func (*ArgView) SetTitle

func (av *ArgView) SetTitle(title string)

SetTitle sets the optional title and updates the Title label

func (*ArgView) TitleWidget

func (av *ArgView) TitleWidget() *gi.Label

Title returns the title label widget, and its index, within frame

func (*ArgView) UpdateArgs

func (av *ArgView) UpdateArgs()

UpdateArgs updates each of the value-view widgets for the args

type BitFlagView added in v0.9.9

type BitFlagView struct {
	ValueViewBase
	AltType reflect.Type // alternative type, e.g., from EnumType: property
}

BitFlagView presents a ButtonBox for bitflags

func (*BitFlagView) ConfigWidget added in v0.9.9

func (vv *BitFlagView) ConfigWidget(widg gi.Node2D)

func (*BitFlagView) EnumType added in v0.9.9

func (vv *BitFlagView) EnumType() reflect.Type

func (*BitFlagView) SetEnumValueFromInt added in v0.9.9

func (vv *BitFlagView) SetEnumValueFromInt(ival int64) bool

func (*BitFlagView) UpdateWidget added in v0.9.9

func (vv *BitFlagView) UpdateWidget()

func (*BitFlagView) WidgetType added in v0.9.9

func (vv *BitFlagView) WidgetType() reflect.Type

type BoolValueView

type BoolValueView struct {
	ValueViewBase
}

BoolValueView presents a checkbox for a boolean

func (*BoolValueView) ConfigWidget

func (vv *BoolValueView) ConfigWidget(widg gi.Node2D)

func (*BoolValueView) UpdateWidget

func (vv *BoolValueView) UpdateWidget()

func (*BoolValueView) WidgetType

func (vv *BoolValueView) WidgetType() reflect.Type

type ByteSliceValueView

type ByteSliceValueView struct {
	ValueViewBase
}

ByteSliceValueView presents a textfield of the bytes

func (*ByteSliceValueView) ConfigWidget

func (vv *ByteSliceValueView) ConfigWidget(widg gi.Node2D)

func (*ByteSliceValueView) UpdateWidget

func (vv *ByteSliceValueView) UpdateWidget()

func (*ByteSliceValueView) WidgetType

func (vv *ByteSliceValueView) WidgetType() reflect.Type

type ColorMapName added in v0.9.8

type ColorMapName string

ColorMapName provides a gui chooser of maps in AvailColorMaps

func (ColorMapName) ValueView added in v0.9.8

func (mn ColorMapName) ValueView() ValueView

ValueView registers ColorMapValueView as the viewer of ColorMapName

type ColorMapValueView added in v0.9.8

type ColorMapValueView struct {
	ValueViewBase
}

ColorMapValueView presents an action for displaying a ColorMapName and selecting meshes from a ChooserDialog

func (*ColorMapValueView) Activate added in v0.9.8

func (vv *ColorMapValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*ColorMapValueView) ConfigWidget added in v0.9.8

func (vv *ColorMapValueView) ConfigWidget(widg gi.Node2D)

func (*ColorMapValueView) HasAction added in v0.9.8

func (vv *ColorMapValueView) HasAction() bool

func (*ColorMapValueView) UpdateWidget added in v0.9.8

func (vv *ColorMapValueView) UpdateWidget()

func (*ColorMapValueView) WidgetType added in v0.9.8

func (vv *ColorMapValueView) WidgetType() reflect.Type

type ColorMapView added in v0.9.8

type ColorMapView struct {
	gi.WidgetBase
	Orient      mat32.Dims    `desc:"orientation along which to display the spectrum"`
	Map         *colormap.Map `desc:"the colormap that we view"`
	ColorMapSig ki.Signal     `json:"-" xml:"-" view:"-" desc:"signal for color map -- triggers when new color map is set via chooser"`
}

ColorMapView is a widget that displays a ColorMap. Note that this is not a ValueView widget

func AddNewColorMapView added in v0.9.8

func AddNewColorMapView(parent ki.Ki, name string, cmap *colormap.Map) *ColorMapView

AddNewColorMapView adds a new colorview to given parent node, with given name.

func (*ColorMapView) ChooseColorMap added in v0.9.8

func (cv *ColorMapView) ChooseColorMap()

ChooseColorMap pulls up a chooser to select a color map

func (*ColorMapView) ConnectEvents2D added in v0.9.8

func (cv *ColorMapView) ConnectEvents2D()

func (*ColorMapView) Disconnect added in v0.9.8

func (cv *ColorMapView) Disconnect()

func (*ColorMapView) MouseEvent added in v0.9.8

func (cv *ColorMapView) MouseEvent()

MouseEvent handles button MouseEvent

func (*ColorMapView) Render2D added in v0.9.8

func (cv *ColorMapView) Render2D()

func (*ColorMapView) RenderColorMap added in v0.9.8

func (cv *ColorMapView) RenderColorMap()

func (*ColorMapView) SetColorMap added in v0.9.8

func (cv *ColorMapView) SetColorMap(cmap *colormap.Map)

SetColorMap sets the color map and triggers a display update

func (*ColorMapView) SetColorMapAction added in v0.9.8

func (cv *ColorMapView) SetColorMapAction(cmap *colormap.Map)

SetColorMapAction sets the color map and triggers a display update and signals the ColorMapSig signal

type ColorNameValueView added in v0.9.8

type ColorNameValueView struct {
	ValueViewBase
}

ColorNameValueView presents an action for displaying a ColorNameName and selecting meshes from a ChooserDialog

func (*ColorNameValueView) Activate added in v0.9.8

func (vv *ColorNameValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*ColorNameValueView) ConfigWidget added in v0.9.8

func (vv *ColorNameValueView) ConfigWidget(widg gi.Node2D)

func (*ColorNameValueView) HasAction added in v0.9.8

func (vv *ColorNameValueView) HasAction() bool

func (*ColorNameValueView) UpdateWidget added in v0.9.8

func (vv *ColorNameValueView) UpdateWidget()

func (*ColorNameValueView) WidgetType added in v0.9.8

func (vv *ColorNameValueView) WidgetType() reflect.Type

type ColorValueView

type ColorValueView struct {
	ValueViewBase
	TmpColor gist.Color
}

ColorValueView presents a StructViewInline for a struct plus a ColorView button..

func (*ColorValueView) Activate

func (vv *ColorValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*ColorValueView) Color

func (vv *ColorValueView) Color() (*gist.Color, bool)

Color returns a standardized color value from whatever value is represented internally

func (*ColorValueView) ConfigWidget

func (vv *ColorValueView) ConfigWidget(widg gi.Node2D)

func (*ColorValueView) HasAction

func (vv *ColorValueView) HasAction() bool

func (*ColorValueView) SetColor

func (vv *ColorValueView) SetColor(clr gist.Color)

SetColor sets color value from a standard color value -- more robust than plain SetValue

func (*ColorValueView) UpdateWidget

func (vv *ColorValueView) UpdateWidget()

func (*ColorValueView) WidgetType

func (vv *ColorValueView) WidgetType() reflect.Type

type ColorView

type ColorView struct {
	gi.Frame
	Color    gist.Color `desc:"the color that we view"`
	NumView  ValueView  `desc:"inline struct view of the numbers"`
	TmpSave  ValueView  `` /* 189-byte string literal not displayed */
	ViewSig  ki.Signal  `` /* 179-byte string literal not displayed */
	ManipSig ki.Signal  `` /* 150-byte string literal not displayed */
	ViewPath string     `` /* 134-byte string literal not displayed */
}

ColorView shows a color, using sliders or numbers to set values.

func AddNewColorView added in v0.9.7

func AddNewColorView(parent ki.Ki, name string) *ColorView

AddNewColorView adds a new colorview to given parent node, with given name.

func (*ColorView) Config

func (cv *ColorView) Config()

Config configures a standard setup of entire view

func (*ColorView) ConfigHSLSlider

func (cv *ColorView) ConfigHSLSlider(sl *gi.Slider, hsl int)

func (*ColorView) ConfigPalette added in v1.2.3

func (cv *ColorView) ConfigPalette()

func (*ColorView) ConfigRGBSlider

func (cv *ColorView) ConfigRGBSlider(sl *gi.Slider, rgb int)

func (*ColorView) Disconnect added in v0.9.8

func (cv *ColorView) Disconnect()

func (*ColorView) IsConfiged added in v0.9.8

func (cv *ColorView) IsConfiged() bool

IsConfiged returns true if widget is fully configured

func (*ColorView) NumLay

func (cv *ColorView) NumLay() *gi.Layout

func (*ColorView) Render2D

func (cv *ColorView) Render2D()

func (*ColorView) SetColor

func (cv *ColorView) SetColor(clr color.Color)

SetColor sets the source color

func (*ColorView) SetHSLValue

func (cv *ColorView) SetHSLValue(val float32, hsl int)

func (*ColorView) SetRGBValue

func (cv *ColorView) SetRGBValue(val float32, rgb int)

func (*ColorView) SliderGrid

func (cv *ColorView) SliderGrid() *gi.Layout

func (*ColorView) SliderLay

func (cv *ColorView) SliderLay() *gi.Layout

func (*ColorView) Update

func (cv *ColorView) Update()

func (*ColorView) UpdateHSLSlider

func (cv *ColorView) UpdateHSLSlider(sl *gi.Slider, hsl int)

func (*ColorView) UpdateImpl added in v1.2.3

func (cv *ColorView) UpdateImpl()

UpdateImpl does the raw updates based on current value, without UpdateStart / End wrapper

func (*ColorView) UpdateRGBSlider

func (cv *ColorView) UpdateRGBSlider(sl *gi.Slider, rgb int)

func (*ColorView) UpdateSliderGrid

func (cv *ColorView) UpdateSliderGrid()

func (*ColorView) Value

func (cv *ColorView) Value() *gi.Frame

type DiffTextView added in v0.9.13

type DiffTextView struct {
	TextView
}

DiffTextView supports double-click based application of edits from one buffer to the other.

func AddNewDiffTextView added in v0.9.13

func AddNewDiffTextView(parent ki.Ki, name string) *DiffTextView

AddNewDiffTextView adds a new DiffTextView to given parent node, with given name.

func (*DiffTextView) ConnectEvents2D added in v0.9.13

func (tv *DiffTextView) ConnectEvents2D()

ConnectEvents2D indirectly sets connections between mouse and key events and actions

func (*DiffTextView) DiffView added in v0.9.13

func (tv *DiffTextView) DiffView() *DiffView

func (*DiffTextView) MouseEvent added in v0.9.13

func (tv *DiffTextView) MouseEvent(me *mouse.Event)

MouseEvent handles the mouse.Event to process double-click

func (*DiffTextView) TextViewEvents added in v0.9.13

func (tv *DiffTextView) TextViewEvents()

TextViewEvents sets connections between mouse and key events and actions

type DiffView added in v0.9.11

type DiffView struct {
	gi.Frame
	FileA  string        `desc:"first file name being compared"`
	FileB  string        `desc:"second file name being compared"`
	RevA   string        `desc:"revision for first file, if relevant"`
	RevB   string        `desc:"revision for second file, if relevant"`
	Diffs  textbuf.Diffs `json:"-" xml:"-" desc:"the diff records"`
	BufA   *TextBuf      `json:"-" xml:"-" desc:"textbuf for A"`
	BufB   *TextBuf      `json:"-" xml:"-" desc:"textbuf for B"`
	AlignD textbuf.Diffs `json:"-" xml:"-" desc:"aligned diffs records diff for aligned lines"`
	EditA  textbuf.Diffs `json:"-" xml:"-" desc:"edit diffs records aligned diffs with edits applied"`
	EditB  textbuf.Diffs `json:"-" xml:"-" desc:"edit diffs records aligned diffs with edits applied"`
	UndoA  textbuf.Diffs `json:"-" xml:"-" desc:"undo diffs records aligned diffs with edits applied"`
	UndoB  textbuf.Diffs `json:"-" xml:"-" desc:"undo diffs records aligned diffs with edits applied"`
}

DiffView presents two side-by-side TextView windows showing the differences between two files (represented as lines of strings).

func AddNewDiffView added in v0.9.11

func AddNewDiffView(parent ki.Ki, name string) *DiffView

AddNewDiffView adds a new diffview to given parent node, with given name.

func DiffFiles added in v1.1.3

func DiffFiles(afile, bfile string) (*DiffView, error)

DiffFiles shows the diffs between this file as the A file, and other file as B file, in a DiffViewDialog

func DiffViewDialog added in v0.9.11

func DiffViewDialog(avp *gi.Viewport2D, astr, bstr []string, afile, bfile, arev, brev string, opts DlgOpts) *DiffView

DiffViewDialog opens a dialog for displaying diff between two files as line-strings

func DiffViewDialogFromRevs added in v0.9.13

func DiffViewDialogFromRevs(avp *gi.Viewport2D, repo vci.Repo, file string, fbuf *TextBuf, rev_a, rev_b string) (*DiffView, error)

DiffViewDialogFromRevs opens a dialog for displaying diff between file at two different revisions from given repository if empty, defaults to: A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions.

func (*DiffView) ApplyDiff added in v0.9.13

func (dv *DiffView) ApplyDiff(ab int, line int) bool

ApplyDiff applies change from the other buffer to the buffer for given file name, from diff that includes given line.

func (*DiffView) Config added in v0.9.11

func (dv *DiffView) Config()

func (*DiffView) ConfigTexts added in v0.9.11

func (dv *DiffView) ConfigTexts()

func (*DiffView) ConfigToolBar added in v0.9.13

func (dv *DiffView) ConfigToolBar()

func (*DiffView) DiffLay added in v0.9.11

func (dv *DiffView) DiffLay() *gi.Layout

func (*DiffView) DiffStrings added in v0.9.11

func (dv *DiffView) DiffStrings(astr, bstr []string)

DiffStrings computes differences between two lines-of-strings and displays in DiffView.

func (*DiffView) FileModifiedUpdateA added in v0.9.13

func (dv *DiffView) FileModifiedUpdateA(act *gi.Action)

func (*DiffView) FileModifiedUpdateB added in v0.9.13

func (dv *DiffView) FileModifiedUpdateB(act *gi.Action)

func (*DiffView) HasDiffsUpdate added in v0.9.13

func (dv *DiffView) HasDiffsUpdate(act *gi.Action)

func (*DiffView) IsConfiged added in v0.9.11

func (dv *DiffView) IsConfiged() bool

func (*DiffView) NextDiff added in v0.9.13

func (dv *DiffView) NextDiff(ab int) bool

NextDiff moves to next diff region

func (*DiffView) PrevDiff added in v0.9.13

func (dv *DiffView) PrevDiff(ab int) bool

PrevDiff moves to previous diff region

func (*DiffView) RemoveAlignsA added in v0.9.13

func (dv *DiffView) RemoveAlignsA()

RemoveAlignsA removes extra blank text lines added to align with B

func (*DiffView) RemoveAlignsB added in v0.9.13

func (dv *DiffView) RemoveAlignsB()

RemoveAlignsB removes extra blank text lines added to align with A

func (*DiffView) ResetDiffs added in v0.9.13

func (dv *DiffView) ResetDiffs()

ResetDiffs resets all active diff state -- after saving

func (*DiffView) SaveFileA added in v0.9.13

func (dv *DiffView) SaveFileA(fname gi.FileName)

SaveFileA saves the current state of file A to given filename

func (*DiffView) SaveFileB added in v0.9.13

func (dv *DiffView) SaveFileB(fname gi.FileName)

SaveFileB saves the current state of file B to given filename

func (*DiffView) SetTextNames added in v0.9.13

func (dv *DiffView) SetTextNames()

func (*DiffView) TagWordDiffs added in v0.9.13

func (dv *DiffView) TagWordDiffs()

TagWordDiffs goes through replace diffs and tags differences at the word level between the two regions.

func (*DiffView) TextViewLays added in v0.9.11

func (dv *DiffView) TextViewLays() (*gi.Layout, *gi.Layout)

func (*DiffView) TextViews added in v0.9.11

func (dv *DiffView) TextViews() (*DiffTextView, *DiffTextView)

func (*DiffView) ToolBar added in v0.9.13

func (dv *DiffView) ToolBar() *gi.ToolBar

func (*DiffView) UndoDiff added in v0.9.13

func (dv *DiffView) UndoDiff(ab int)

UndoDiff undoes last applied change, if any -- just does Undo in buffer and updates the list of edits applied.

func (*DiffView) UpdateToolBar added in v0.9.13

func (dv *DiffView) UpdateToolBar()

type DirFlagMap added in v0.9.15

type DirFlagMap struct {
	Map map[string]DirFlags `desc:"map of paths and associated flags"`
	Mu  sync.Mutex          `view:"-" json:"-" xml:"-" desc:"mutex for accessing map"`
}

DirFlagMap is a map for encoding directories that are open in the file tree. The strings are typically relative paths. The bool value is used to mark active paths and inactive (unmarked) ones can be removed. Map access is protected by Mutex.

func (*DirFlagMap) ClearMarks added in v0.9.15

func (dm *DirFlagMap) ClearMarks()

ClearMarks clears all the marks -- do this prior to traversing full set of active paths -- can then call DeleteStale to get rid of unused paths.

func (*DirFlagMap) DeleteStale added in v0.9.15

func (dm *DirFlagMap) DeleteStale()

DeleteStale removes all entries with a bool = false value indicating that they have not been accessed since ClearFlags was called.

func (*DirFlagMap) Init added in v0.9.15

func (dm *DirFlagMap) Init()

Init initializes the map, and sets the Mutex lock -- must unlock manually

func (*DirFlagMap) IsOpen added in v0.9.15

func (dm *DirFlagMap) IsOpen(path string) bool

IsOpen returns true if path has IsOpen bit flag set

func (*DirFlagMap) SetMark added in v0.9.15

func (dm *DirFlagMap) SetMark(path string)

SetMark sets the mark flag indicating we visited file

func (*DirFlagMap) SetOpen added in v0.9.15

func (dm *DirFlagMap) SetOpen(path string, open bool)

SetOpenState sets the given directory's open flag

func (*DirFlagMap) SetSortBy added in v0.9.15

func (dm *DirFlagMap) SetSortBy(path string, modTime bool)

SetSortBy sets the given directory's sort by option

func (*DirFlagMap) SortByModTime added in v0.9.15

func (dm *DirFlagMap) SortByModTime(path string) bool

SortByModTime returns true if path is sorted by mod time

func (*DirFlagMap) SortByName added in v0.9.15

func (dm *DirFlagMap) SortByName(path string) bool

SortByName returns true if path is sorted by name (default if not in map)

type DirFlags added in v0.9.15

type DirFlags int32

DirFlags are flags on directories: Open, SortBy etc These flags are stored in the DirFlagMap for persistence.

const (
	// DirMark means directory is marked -- unmarked entries are deleted post-update
	DirMark DirFlags = iota

	// DirIsOpen means directory is open -- else closed
	DirIsOpen

	// DirSortByName means sort the directory entries by name.
	// this is mutex with other sorts -- keeping option open for non-binary sort choices.
	DirSortByName

	// DirSortByModTime means sort the directory entries by modification time
	DirSortByModTime

	DirFlagsN
)

func (*DirFlags) FromString added in v0.9.15

func (i *DirFlags) FromString(s string) error

func (DirFlags) String added in v0.9.15

func (i DirFlags) String() string

type DlgOpts

type DlgOpts struct {
	Title    string    `desc:"generally should be provided -- used for setting name of dialog and associated window"`
	Prompt   string    `` /* 153-byte string literal not displayed */
	CSS      ki.Props  `desc:"optional style properties applied to dialog -- can be used to customize any aspect of existing dialogs"`
	TmpSave  ValueView `` /* 172-byte string literal not displayed */
	ViewPath string    `` /* 134-byte string literal not displayed */
	Ok       bool      `` /* 320-byte string literal not displayed */
	Cancel   bool      `` /* 324-byte string literal not displayed */
	NoAdd    bool      `desc:"if true, user cannot add elements of the slice"`
	NoDelete bool      `desc:"if true, user cannot delete elements of the slice"`
	Inactive bool      `desc:"if true all fields will be inactive"`
	Data     any       `` /* 177-byte string literal not displayed */
	Filename string    `desc:"filename, e.g., for TextView, to get highlighting"`
	LineNos  bool      `desc:"include line numbers for TextView"`
}

DlgOpts are the basic dialog options accepted by all giv dialog methods -- provides a named, optional way to specify these args

func (*DlgOpts) ToGiOpts

func (d *DlgOpts) ToGiOpts() gi.DlgOpts

ToGiOpts converts giv opts to gi opts

type EnumValueView

type EnumValueView struct {
	ValueViewBase
	AltType reflect.Type // alternative type, e.g., from EnumType: property
}

EnumValueView presents a combobox for choosing enums

func (*EnumValueView) ConfigWidget

func (vv *EnumValueView) ConfigWidget(widg gi.Node2D)

func (*EnumValueView) EnumType

func (vv *EnumValueView) EnumType() reflect.Type

func (*EnumValueView) SetEnumValueFromInt

func (vv *EnumValueView) SetEnumValueFromInt(ival int64) bool

func (*EnumValueView) UpdateWidget

func (vv *EnumValueView) UpdateWidget()

func (*EnumValueView) WidgetType

func (vv *EnumValueView) WidgetType() reflect.Type

type FieldValueViewer

type FieldValueViewer interface {
	FieldValueView(field string, fval any) ValueView
}

FieldValueViewer interface supplies the appropriate type of ValueView for a given field name and current field value on the receiver parent struct -- called on a given receiver struct if defined for that receiver type (tries both pointer and non-pointer receivers) -- if a struct implements this interface, then it is used first for structs -- return nil to fall back on the default ToValueView result

type FileInfo

type FileInfo struct {
	Ic      gi.IconName       `tableview:"no-header" desc:"icon for file"`
	Name    string            `width:"40" desc:"name of the file, without any path"`
	Size    FileSize          `desc:"size of the file in bytes"`
	Kind    string            `` /* 128-byte string literal not displayed */
	Mime    string            `tableview:"-" desc:"full official mime type of the contents"`
	Cat     filecat.Cat       `tableview:"-" desc:"functional category of the file, based on mime data etc"`
	Sup     filecat.Supported `tableview:"-" desc:"supported file type"`
	Mode    os.FileMode       `desc:"file mode bits"`
	ModTime FileTime          `desc:"time that contents (only) were last modified"`
	Vcs     vci.FileStatus    `tableview:"-" desc:"version control system status, when enabled"`
	Path    string            `tableview:"-" desc:"full path to file, including name -- for file functions"`
}

FileInfo represents the information about a given file / directory, including icon, mimetype, etc

func NewFileInfo

func NewFileInfo(fname string) (*FileInfo, error)

NewFileInfo returns a new FileInfo based on a filename -- directly returns filepath.Abs or os.Stat error on the given file. filename can be anything that works given current directory -- Path will contain the full filepath.Abs path, and Name will be just the filename.

func (*FileInfo) Delete

func (fi *FileInfo) Delete() error

Delete deletes the file or if a directory the directory and all files and subdirectories

func (*FileInfo) Duplicate

func (fi *FileInfo) Duplicate() (string, error)

Duplicate creates a copy of given file -- only works for regular files, not directories.

func (*FileInfo) FileNames added in v0.9.5

func (fi *FileInfo) FileNames(names *[]string) (err error)

FileNames returns a slice of file names from the starting directory and its subdirectories

func (*FileInfo) FindIcon

func (fi *FileInfo) FindIcon() (gi.IconName, bool)

FindIcon uses file info to find an appropriate icon for this file -- uses Kind string first to find a correspondingly-named icon, and then tries the extension. Returns true on success.

func (*FileInfo) InitFile

func (fi *FileInfo) InitFile(fname string) error

InitFile initializes a FileInfo based on a filename -- directly returns filepath.Abs or os.Stat error on the given file. filename can be anything that works given current directory -- Path will contain the full filepath.Abs path, and Name will be just the filename.

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

IsDir returns true if file is a directory (folder)

func (*FileInfo) IsExec

func (fi *FileInfo) IsExec() bool

IsExec returns true if file is an executable file

func (*FileInfo) IsHidden added in v0.9.15

func (fi *FileInfo) IsHidden() bool

IsHidden returns true if file name starts with . or _ which are typically hidden

func (fi *FileInfo) IsSymlink() bool

IsSymLink returns true if file is a symbolic link

func (*FileInfo) Rename

func (fi *FileInfo) Rename(path string) (newpath string, err error)

Rename renames (moves) this file to given new path name Updates the FileInfo setting to the new name, although it might be out of scope if it moved into a new path

func (*FileInfo) RenamePath added in v1.1.3

func (fi *FileInfo) RenamePath(path string) (newpath string, err error)

RenamePath returns the proposed path or the new full path. Does not actually do the renaming -- see Rename method.

func (*FileInfo) Stat

func (fi *FileInfo) Stat() error

Stat runs os.Stat on file, returns any error directly but otherwise updates file info, including mime type, which then drives Kind and Icon -- this is the main function to call to update state.

type FileNode

type FileNode struct {
	ki.Node
	FPath     gi.FileName `json:"-" xml:"-" copy:"-" desc:"full path to this file"`
	Info      FileInfo    `json:"-" xml:"-" copy:"-" desc:"full standard file info about this file"`
	Buf       *TextBuf    `json:"-" xml:"-" copy:"-" desc:"file buffer for editing this file"`
	FRoot     *FileTree   `json:"-" xml:"-" copy:"-" desc:"root of the tree -- has global state"`
	DirRepo   vci.Repo    `` /* 168-byte string literal not displayed */
	RepoFiles vci.Files   `json:"-" xml:"-" copy:"-" desc:"version control system repository file status -- only valid during ReadDir"`
}

FileNode represents a file in the file system -- the name of the node is the name of the file. Folders have children containing further nodes.

func (*FileNode) AddToVcs added in v0.9.5

func (fn *FileNode) AddToVcs()

AddToVcs adds file to version control

func (*FileNode) BlameVcs added in v0.9.11

func (fn *FileNode) BlameVcs() ([]byte, error)

BlameVcs shows the VCS blame report for this file, reporting for each line the revision and author of the last change.

func (*FileNode) CloseAll added in v0.9.15

func (fn *FileNode) CloseAll()

CloseAll closes all directories under this one, this included

func (*FileNode) CloseBuf

func (fn *FileNode) CloseBuf() bool

CloseBuf closes the file in its buffer if it is open -- returns true if closed Connect to the fn.Buf.TextBufSig and look for the TextBufClosed signal to be notified when the buffer is closed.

func (*FileNode) CloseDir

func (fn *FileNode) CloseDir()

CloseDir closes given directory node -- updates memory state

func (*FileNode) CommitToVcs added in v0.9.5

func (fn *FileNode) CommitToVcs(message string) (err error)

CommitToVcs commits file changes to version control system

func (*FileNode) ConfigOfFiles

func (fn *FileNode) ConfigOfFiles(path string) kit.TypeAndNameList

ConfigOfFiles returns a type-and-name list for configuring nodes based on files immediately within given path

func (*FileNode) CopyFieldsFrom added in v0.9.11

func (fn *FileNode) CopyFieldsFrom(frm any)

func (*FileNode) CopyFileToDir

func (fn *FileNode) CopyFileToDir(filename string, perm os.FileMode)

CopyFileToDir copies given file path into node that is a directory. This does NOT check for overwriting -- that must be done at higher level!

func (*FileNode) DeleteFile

func (fn *FileNode) DeleteFile() (err error)

DeleteFile deletes this file

func (*FileNode) DeleteFromVcs added in v0.9.11

func (fn *FileNode) DeleteFromVcs()

DeleteFromVcs removes file from version control

func (*FileNode) DetectVcsRepo added in v0.9.13

func (fn *FileNode) DetectVcsRepo(updateFiles bool) bool

DetectVcsRepo detects and configures DirRepo if this directory is root of a VCS repository. if updateFiles is true, gets the files in the dir. returns true if a repository was newly found here.

func (*FileNode) DiffVcs added in v0.9.11

func (fn *FileNode) DiffVcs(rev_a, rev_b string) error

DiffVcs shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffViewDialog.

func (*FileNode) DirsTo added in v0.9.15

func (fn *FileNode) DirsTo(path string) (*FileNode, error)

DirsTo opens all the directories above the given filename, and returns the node for element at given path (can be a file or directory itself -- not opened -- just returned)

func (*FileNode) DuplicateFile

func (fn *FileNode) DuplicateFile() error

Duplicate creates a copy of given file -- only works for regular files, not directories

func (*FileNode) FileExtCounts

func (fn *FileNode) FileExtCounts(cat filecat.Cat) []FileNodeNameCount

FileExtCounts returns a count of all the different file extensions, sorted from highest to lowest. If cat is != filecat.Unknown then it only uses files of that type (e.g., filecat.Code to find any code files)

func (*FileNode) FilesMatching

func (fn *FileNode) FilesMatching(match string, ignoreCase bool) []*FileNode

FilesMatching returns list of all nodes whose file name contains given string (no regexp) -- ignoreCase transforms everything into lowercase

func (*FileNode) FindDirNode added in v1.1.3

func (fn *FileNode) FindDirNode(path string) (*FileNode, error)

FindDirNode finds directory node by given path -- must be a relative path already rooted at tree, or absolute path within tree

func (*FileNode) FindFile

func (fn *FileNode) FindFile(fnm string) (*FileNode, bool)

FindFile finds first node representing given file (false if not found) -- looks for full path names that have the given string as their suffix, so you can include as much of the path (including whole thing) as is relevant to disambiguate. See FilesMatching for a list of files that match a given string.

func (*FileNode) FirstVCS added in v0.9.15

func (fn *FileNode) FirstVCS() (vci.Repo, *FileNode)

FirstVCS returns the first VCS repository starting from this node and going down. also returns the node having that repository

func (*FileNode) HasClosedParent added in v1.0.0

func (fn *FileNode) HasClosedParent() bool

HasClosedParent returns true if node has a parent node with !IsOpen flag set

func (*FileNode) InitFileInfo added in v0.9.11

func (fn *FileNode) InitFileInfo() error

InitFileInfo initializes file info

func (*FileNode) IsAutoSave

func (fn *FileNode) IsAutoSave() bool

IsAutoSave returns true if file is an auto-save file (starts and ends with #)

func (*FileNode) IsChanged

func (fn *FileNode) IsChanged() bool

IsChanged returns true if the file is open and has been changed (edited) since last save

func (*FileNode) IsDir

func (fn *FileNode) IsDir() bool

IsDir returns true if file is a directory (folder)

func (*FileNode) IsExec

func (fn *FileNode) IsExec() bool

IsExec returns true if file is an executable file

func (*FileNode) IsExternal added in v0.9.11

func (fn *FileNode) IsExternal() bool

IsExternal returns true if file is external to main file tree

func (*FileNode) IsIrregular added in v0.9.11

func (fn *FileNode) IsIrregular() bool

IsIrregular returns true if file is a special "Irregular" node

func (*FileNode) IsOpen

func (fn *FileNode) IsOpen() bool

IsOpen returns true if file is flagged as open

func (fn *FileNode) IsSymLink() bool

IsSymLink returns true if file is a symlink

func (*FileNode) LatestFileMod added in v0.9.14

func (fn *FileNode) LatestFileMod(cat filecat.Cat) time.Time

LatestFileMod returns the most recent mod time of files in the tree. If cat is != filecat.Unknown then it only uses files of that type (e.g., filecat.Code to find any code files)

func (*FileNode) LogVcs added in v0.9.11

func (fn *FileNode) LogVcs(allFiles bool, since string) (vci.Log, error)

LogVcs shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.

func (*FileNode) MyRelPath

func (fn *FileNode) MyRelPath() string

MyRelPath returns the relative path from root for this node

func (*FileNode) NewFile

func (fn *FileNode) NewFile(filename string, addToVcs bool)

NewFile makes a new file in given selected directory node

func (*FileNode) NewFolder

func (fn *FileNode) NewFolder(foldername string)

NewFolder makes a new folder (directory) in given selected directory node

func (*FileNode) OpenAll added in v0.9.15

func (fn *FileNode) OpenAll()

OpenAll opens all directories under this one

func (*FileNode) OpenBuf

func (fn *FileNode) OpenBuf() (bool, error)

OpenBuf opens the file in its buffer if it is not already open. returns true if file is newly opened

func (*FileNode) OpenDir

func (fn *FileNode) OpenDir()

OpenDir opens given directory node

func (*FileNode) OpenFileDefault added in v0.9.14

func (fn *FileNode) OpenFileDefault() error

OpenFileDefault opens file with default app for that file type (os defined) runs open on Mac, xdg-open on Linux, and start on Windows

func (*FileNode) OpenFileWith added in v0.9.14

func (fn *FileNode) OpenFileWith(command string) error

OpenFileWith opens file with given command. does not wait for command to finish in this routine (separate routine Waits)

func (*FileNode) ReadDir

func (fn *FileNode) ReadDir(path string) error

ReadDir reads all the files at given directory into this directory node -- uses config children to preserve extra info already stored about files. The root node represents the directory at the given path. Returns os.Stat error if path cannot be accessed.

func (*FileNode) RelPath

func (fn *FileNode) RelPath(fpath gi.FileName) string

RelPath returns the relative path from node for given full path

func (*FileNode) RenameFile

func (fn *FileNode) RenameFile(newpath string) (err error)

RenameFile renames file to new name

func (*FileNode) Repo added in v0.9.5

func (fn *FileNode) Repo() (vci.Repo, *FileNode)

Repo returns the version control repository associated with this file, and the node for the directory where the repo is based. Goes up the tree until a repository is found.

func (*FileNode) RevertVcs added in v0.9.5

func (fn *FileNode) RevertVcs() (err error)

RevertVcs reverts file changes since last commit

func (*FileNode) SetClosed

func (fn *FileNode) SetClosed()

SetClosed clears the open flag

func (*FileNode) SetNodePath

func (fn *FileNode) SetNodePath(path string) error

SetNodePath sets the path for given node and updates it based on associated file

func (*FileNode) SetOpen

func (fn *FileNode) SetOpen()

SetOpen sets the open flag

func (*FileNode) SortBy added in v0.9.15

func (fn *FileNode) SortBy(modTime bool)

SortBy determines how to sort the files in the directory -- default is alpha by name, optionally can be sorted by modification time.

func (*FileNode) SortConfigByModTime added in v0.9.15

func (fn *FileNode) SortConfigByModTime(confg kit.TypeAndNameList)

SortConfigByModTime sorts given config list by mod time

func (*FileNode) UpdateAllVcs added in v0.9.13

func (fn *FileNode) UpdateAllVcs()

UpdateAllVcs does an update on any repositories below this one in file tree

func (*FileNode) UpdateDir added in v0.9.11

func (fn *FileNode) UpdateDir()

UpdateDir updates the directory and all the nodes under it

func (*FileNode) UpdateNode

func (fn *FileNode) UpdateNode() error

UpdateNode updates information in node based on its associated file in FPath. This is intended to be called ad-hoc for individual nodes that might need updating -- use ReadDir for mass updates as it is more efficient.

func (*FileNode) UpdateRepoFiles added in v0.9.11

func (fn *FileNode) UpdateRepoFiles()

type FileNodeFlags

type FileNodeFlags int64

FileNodeFlags define bitflags for FileNode state -- these extend ki.Flags and storage is an int64

const (
	// FileNodeOpen means file is open -- for directories, this means that
	// sub-files should be / have been loaded -- for files, means that they
	// have been opened e.g., for editing
	FileNodeOpen FileNodeFlags = FileNodeFlags(ki.FlagsN) + iota

	// FileNodeSymLink indicates that file is a symbolic link -- file info is
	// all for the target of the symlink
	FileNodeSymLink

	FileNodeFlagsN
)

func StringToFileNodeFlags

func StringToFileNodeFlags(s string) (FileNodeFlags, error)

func (FileNodeFlags) String

func (i FileNodeFlags) String() string

type FileNodeNameCount

type FileNodeNameCount struct {
	Name  string
	Count int
}

FileNodeNameCount is used to report counts of different string-based things in the file tree

type FileSize

type FileSize datasize.ByteSize

func (*FileSize) FromInt

func (fs *FileSize) FromInt(val int64)

FromInt satisfies the ints.Inter interface

func (FileSize) Int

func (fs FileSize) Int() int64

Int satisfies the kit.Inter interface for sorting etc

func (FileSize) String

func (fs FileSize) String() string

type FileTime

type FileTime time.Time

FileTime provides a default String format for file modification times, and other useful methods -- will plug into ValueView with date / time editor.

func (*FileTime) FromInt

func (ft *FileTime) FromInt(val int64)

FromInt satisfies the ints.Inter interface

func (FileTime) Int

func (ft FileTime) Int() int64

Int satisfies the ints.Inter interface for sorting etc

func (FileTime) MarshalBinary

func (ft FileTime) MarshalBinary() ([]byte, error)

func (FileTime) MarshalJSON

func (ft FileTime) MarshalJSON() ([]byte, error)

func (FileTime) MarshalText

func (ft FileTime) MarshalText() ([]byte, error)

func (FileTime) String

func (ft FileTime) String() string

func (*FileTime) UnmarshalBinary

func (ft *FileTime) UnmarshalBinary(data []byte) error

func (*FileTime) UnmarshalJSON

func (ft *FileTime) UnmarshalJSON(data []byte) error

func (*FileTime) UnmarshalText

func (ft *FileTime) UnmarshalText(data []byte) error

type FileTree

type FileTree struct {
	FileNode
	ExtFiles      []string          `` /* 167-byte string literal not displayed */
	Dirs          DirFlagMap        `` /* 185-byte string literal not displayed */
	DirsOnTop     bool              `desc:"if true, then all directories are placed at the top of the tree view -- otherwise everything is mixed"`
	NodeType      reflect.Type      `view:"-" json:"-" xml:"-" desc:"type of node to create -- defaults to giv.FileNode but can use custom node types"`
	InOpenAll     bool              `desc:"if true, we are in midst of an OpenAll call -- nodes should open all dirs"`
	Watcher       *fsnotify.Watcher `view:"-" desc:"change notify for all dirs"`
	DoneWatcher   chan bool         `view:"-" desc:"channel to close watcher watcher"`
	WatchedPaths  map[string]bool   `view:"-" desc:"map of paths that have been added to watcher -- only active if bool = true"`
	LastWatchUpdt string            `view:"-" desc:"last path updated by watcher"`
	LastWatchTime time.Time         `view:"-" desc:"timestamp of last update"`
	UpdtMu        sync.Mutex        `view:"-" desc:"Update mutex"`
}

FileTree is the root of a tree representing files in a given directory (and subdirectories thereof), and has some overall management state for how to view things. The FileTree can be viewed by a TreeView to provide a GUI interface into it.

func (*FileTree) AddExtFile added in v0.9.11

func (ft *FileTree) AddExtFile(fpath string) (*FileNode, error)

AddExtFile adds an external file outside of root of file tree and triggers an update, returning the FileNode for it, or error if filepath.Abs fails.

func (*FileTree) ConfigWatcher added in v1.1.3

func (ft *FileTree) ConfigWatcher() error

ConfigWatcher configures a new watcher for tree

func (*FileTree) CopyFieldsFrom added in v0.9.11

func (ft *FileTree) CopyFieldsFrom(frm any)

func (*FileTree) DirSortByModTime added in v0.9.15

func (ft *FileTree) DirSortByModTime(fpath gi.FileName) bool

DirSortByModTime returns true if dir is sorted by mod time

func (*FileTree) DirSortByName added in v0.9.15

func (ft *FileTree) DirSortByName(fpath gi.FileName) bool

DirSortByName returns true if dir is sorted by name

func (*FileTree) Disconnect added in v1.1.3

func (fv *FileTree) Disconnect()

func (*FileTree) ExtFileNodeByPath added in v0.9.11

func (ft *FileTree) ExtFileNodeByPath(fpath string) (*FileNode, error)

ExtFileNodeByPath returns FileNode for given file path, and true, if it exists in the external files list. Otherwise returns nil, false.

func (*FileTree) HasExtFile added in v0.9.11

func (ft *FileTree) HasExtFile(fpath string) (bool, int)

HasExtFile returns true and index if given abs path exists on ExtFiles list. false and -1 if not.

func (*FileTree) IsDirOpen

func (ft *FileTree) IsDirOpen(fpath gi.FileName) bool

IsDirOpen returns true if given directory path is open (i.e., has been opened in the view)

func (*FileTree) OpenPath

func (ft *FileTree) OpenPath(path string)

OpenPath opens a filetree at given directory path -- reads all the files at given path into this tree -- uses config children to preserve extra info already stored about files. Only paths listed in Dirs will be opened.

func (*FileTree) RemoveExtFile added in v0.9.11

func (ft *FileTree) RemoveExtFile(fpath string) bool

RemoveExtFile removes external file from maintained list, returns true if removed

func (*FileTree) SetDirClosed

func (ft *FileTree) SetDirClosed(fpath gi.FileName)

SetDirClosed sets the given directory path to be closed

func (*FileTree) SetDirOpen

func (ft *FileTree) SetDirOpen(fpath gi.FileName)

SetDirOpen sets the given directory path to be open

func (*FileTree) SetDirSortBy added in v0.9.15

func (ft *FileTree) SetDirSortBy(fpath gi.FileName, modTime bool)

SetDirSortBy sets the given directory path sort by option

func (*FileTree) UnWatchPath added in v1.1.3

func (ft *FileTree) UnWatchPath(path gi.FileName)

UnWatchPath removes given path from those watched

func (*FileTree) UpdateAll added in v1.0.0

func (ft *FileTree) UpdateAll()

UpdateAll does a full update of the tree -- calls ReadDir on current path

func (*FileTree) UpdateExtFiles added in v0.9.11

func (ft *FileTree) UpdateExtFiles(efn *FileNode)

UpdateExtFiles returns a type-and-name list for configuring nodes for ExtFiles

func (*FileTree) UpdateNewFile

func (ft *FileTree) UpdateNewFile(filename string)

UpdateNewFile should be called with path to a new file that has just been created -- will update view to show that file, and if that file doesn't exist, it updates the directory containing that file

func (*FileTree) UpdatePath added in v1.1.3

func (ft *FileTree) UpdatePath(path string)

UpdatePath updates the tree at the directory level for given path and everything below it

func (*FileTree) WatchPath added in v1.1.3

func (ft *FileTree) WatchPath(path gi.FileName) error

WatchPath adds given path to those watched

func (*FileTree) WatchUpdt added in v1.1.3

func (ft *FileTree) WatchUpdt(path string)

WatchUpdt does the update for given path

func (*FileTree) WatchWatcher added in v1.1.3

func (ft *FileTree) WatchWatcher()

WatchWatcher monitors the watcher channel for update events. It must be called once some paths have been added to watcher -- safe to call multiple times.

type FileTreeView

type FileTreeView struct {
	TreeView
}

FileTreeView is a TreeView that knows how to operate on FileNode nodes

func AddNewFileTreeView added in v0.9.7

func AddNewFileTreeView(parent ki.Ki, name string) *FileTreeView

AddNewFileTreeView adds a new filetreeview to given parent node, with given name.

func (*FileTreeView) AddToVcs added in v0.9.5

func (ftv *FileTreeView) AddToVcs()

AddToVcs adds the file to version control system

func (*FileTreeView) BlameVcs added in v0.9.11

func (ftv *FileTreeView) BlameVcs()

BlameVcs shows the VCS blame report for this file, reporting for each line the revision and author of the last change.

func (*FileTreeView) CloseAll added in v0.9.15

func (ftv *FileTreeView) CloseAll()

CloseAll closes all directories under this one

func (*FileTreeView) CommitToVcs added in v0.9.5

func (ftv *FileTreeView) CommitToVcs()

CommitToVcs commits the file from version control system

func (*FileTreeView) ConnectEvents2D added in v0.9.5

func (ftv *FileTreeView) ConnectEvents2D()

func (*FileTreeView) Cut

func (ftv *FileTreeView) Cut()

Cut copies to clip.Board and deletes selected items satisfies gi.Clipper interface and can be overridden by subtypes

func (*FileTreeView) DeleteFiles

func (ftv *FileTreeView) DeleteFiles()

DeleteFiles calls DeleteFile on any selected nodes. If any directory is selected all files and subdirectories are also deleted.

func (*FileTreeView) DeleteFilesImpl added in v0.9.11

func (ftv *FileTreeView) DeleteFilesImpl()

DeleteFilesImpl does the actual deletion, no prompts

func (*FileTreeView) DeleteFromVcs added in v0.9.11

func (ftv *FileTreeView) DeleteFromVcs()

DeleteFromVcs removes the file from version control system

func (*FileTreeView) DiffVcs added in v0.9.11

func (ftv *FileTreeView) DiffVcs(rev_a, rev_b string)

DiffVcs shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffViewDialog.

func (*FileTreeView) Dragged

func (ftv *FileTreeView) Dragged(de *dnd.Event)

Dragged is called after target accepts the drop -- we just remove elements that were moved satisfies gi.DragNDropper interface and can be overridden by subtypes

func (*FileTreeView) Drop

func (ftv *FileTreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)

Drop pops up a menu to determine what specifically to do with dropped items satisfies gi.DragNDropper interface and can be overridden by subtypes

func (*FileTreeView) DropExternal added in v0.9.11

func (ftv *FileTreeView) DropExternal(md mimedata.Mimes, mod dnd.DropMods)

DropExternal is not handled by base case but could be in derived

func (*FileTreeView) DuplicateFiles

func (ftv *FileTreeView) DuplicateFiles()

DuplicateFiles calls DuplicateFile on any selected nodes

func (*FileTreeView) FileNode

func (ftv *FileTreeView) FileNode() *FileNode

FileNode returns the SrcNode as a FileNode

func (*FileTreeView) FileTreeViewEvents added in v0.9.5

func (ftv *FileTreeView) FileTreeViewEvents()

func (*FileTreeView) KeyInput added in v0.9.5

func (ftv *FileTreeView) KeyInput(kt *key.ChordEvent)

func (*FileTreeView) LogVcs added in v0.9.11

func (ftv *FileTreeView) LogVcs(allFiles bool, since string)

LogVcs shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.

func (*FileTreeView) MimeData added in v0.9.11

func (ftv *FileTreeView) MimeData(md *mimedata.Mimes)

MimeData adds mimedata for this node: a text/plain of the Path, text/plain of filename, and text/

func (*FileTreeView) NewFile

func (ftv *FileTreeView) NewFile(filename string, addToVcs bool)

NewFile makes a new file in given selected directory node

func (*FileTreeView) NewFolder

func (ftv *FileTreeView) NewFolder(foldername string)

NewFolder makes a new file in given selected directory node

func (*FileTreeView) OpenAll added in v0.9.15

func (ftv *FileTreeView) OpenAll()

OpenAll opens all directories under this one

func (*FileTreeView) OpenDir added in v0.9.15

func (ftv *FileTreeView) OpenDir()

OpenDir opens given directory

func (*FileTreeView) OpenFileDefault added in v0.9.14

func (ftv *FileTreeView) OpenFileDefault()

OpenFileDefault opens file with default app for that file type (os defined) runs open on Mac, xdg-open on Linux, and start on Windows

func (*FileTreeView) OpenFileWith added in v0.9.14

func (ftv *FileTreeView) OpenFileWith()

OpenFileWith opens file with user-specified command.

func (*FileTreeView) Paste

func (ftv *FileTreeView) Paste()

Paste pastes clipboard at given node satisfies gi.Clipper interface and can be overridden by subtypes

func (*FileTreeView) PasteCheckExisting added in v0.9.11

func (ftv *FileTreeView) PasteCheckExisting(tfn *FileNode, md mimedata.Mimes) ([]string, *FileNode)

PasteCheckExisting checks for existing files in target node directory if that is non-nil (otherwise just uses absolute path), and returns list of existing and node for last one if exists.

func (*FileTreeView) PasteCopyFiles added in v0.9.11

func (ftv *FileTreeView) PasteCopyFiles(tdir *FileNode, md mimedata.Mimes)

PasteCopyFiles copies files in given data into given target directory

func (*FileTreeView) PasteMime

func (ftv *FileTreeView) PasteMime(md mimedata.Mimes)

PasteMime applies a paste / drop of mime data onto this node always does a copy of files into / onto target

func (*FileTreeView) PasteMimeCopyFilesCheck added in v0.9.14

func (ftv *FileTreeView) PasteMimeCopyFilesCheck(tdir *FileNode, md mimedata.Mimes)

PasteMimeCopyFilesCheck copies files into given directory node, first checking if any already exist -- if they exist, prompts.

func (*FileTreeView) RemoveFromExterns added in v0.9.11

func (ftv *FileTreeView) RemoveFromExterns()

RemoveFromExterns removes file from list of external files

func (*FileTreeView) RenameFiles

func (ftv *FileTreeView) RenameFiles()

RenameFiles calls RenameFile on any selected nodes

func (*FileTreeView) RevertVcs added in v0.9.5

func (ftv *FileTreeView) RevertVcs()

RevertVcs removes the file from version control system

func (*FileTreeView) ShowFileInfo added in v0.9.5

func (ftv *FileTreeView) ShowFileInfo()

ShowFileInfo calls ViewFile on selected files

func (*FileTreeView) SortBy added in v0.9.15

func (ftv *FileTreeView) SortBy(modTime bool)

SortBy determines how to sort the files in the directory -- default is alpha by name, optionally can be sorted by modification time.

func (*FileTreeView) Style2D

func (ft *FileTreeView) Style2D()

func (*FileTreeView) UpdateAllFiles added in v0.9.11

func (ftv *FileTreeView) UpdateAllFiles()

type FileValueView

type FileValueView struct {
	ValueViewBase
}

FileValueView presents an action for displaying a FileName and selecting icons from FileChooserDialog

func (*FileValueView) Activate

func (vv *FileValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*FileValueView) ConfigWidget

func (vv *FileValueView) ConfigWidget(widg gi.Node2D)

func (*FileValueView) HasAction

func (vv *FileValueView) HasAction() bool

func (*FileValueView) UpdateWidget

func (vv *FileValueView) UpdateWidget()

func (*FileValueView) WidgetType

func (vv *FileValueView) WidgetType() reflect.Type

type FileView

type FileView struct {
	gi.Frame
	DirPath     string             `desc:"path to directory of files to display"`
	SelFile     string             `desc:"selected file"`
	Ext         string             `desc:"target extension(s) (comma separated if multiple, including initial .), if any"`
	FilterFunc  FileViewFilterFunc `view:"-" json:"-" xml:"-" desc:"optional styling function"`
	ExtMap      map[string]string  `` /* 137-byte string literal not displayed */
	Files       []*FileInfo        `desc:"files for current directory"`
	SelectedIdx int                `desc:"index of currently-selected file in Files list (-1 if none)"`
	FileSig     ki.Signal          `desc:"signal for file actions"`
	Watcher     *fsnotify.Watcher  `view:"-" desc:"change notify for current dir"`
	DoneWatcher chan bool          `view:"-" desc:"channel to close watcher watcher"`
	UpdtMu      sync.Mutex         `view:"-" desc:"UpdateFiles mutex"`
	PrevPath    string             `view:"-" desc:"Previous path that was processed via UpdateFiles"`
}

FileView is a viewer onto files -- core of the file chooser dialog

func (*FileView) AddPathToFavs

func (fv *FileView) AddPathToFavs()

AddPathToFavs adds the current path to favorites

func (*FileView) Config added in v0.9.8

func (fv *FileView) Config()

Config configures the view

func (*FileView) ConfigFilesRow

func (fv *FileView) ConfigFilesRow()

func (*FileView) ConfigPathBar added in v0.9.15

func (fv *FileView) ConfigPathBar()

func (*FileView) ConfigSelRow

func (fv *FileView) ConfigSelRow()

func (*FileView) ConfigWatcher added in v1.1.3

func (fv *FileView) ConfigWatcher() error

func (*FileView) ConnectEvents2D

func (fv *FileView) ConnectEvents2D()

func (*FileView) DirPathUp

func (fv *FileView) DirPathUp()

DirPathUp moves up one directory in the path

func (*FileView) Disconnect added in v0.9.8

func (fv *FileView) Disconnect()

func (*FileView) EditPaths added in v0.9.4

func (fv *FileView) EditPaths()

EditPaths displays a dialog allowing user to delete paths from the path list

func (*FileView) ExtField

func (fv *FileView) ExtField() *gi.TextField

ExtField returns the TextField of the extension

func (*FileView) FavSelect

func (fv *FileView) FavSelect(idx int)

FavSelect selects a favorite path and goes there

func (*FileView) FavsView

func (fv *FileView) FavsView() *TableView

FavsView returns the TableView of the favorites

func (*FileView) FileComplete

func (fv *FileView) FileComplete(data any, text string, posLn, posCh int) (md complete.Matches)

FileComplete finds the possible completions for the file field

func (*FileView) FileCompleteEdit

func (fv *FileView) FileCompleteEdit(data any, text string, cursorPos int, c complete.Completion, seed string) (ed complete.Edit)

FileCompleteEdit is the editing function called when inserting the completion selection in the file field

func (*FileView) FileSelectAction

func (fv *FileView) FileSelectAction(idx int)

FileSelectAction updates selection with given selected file and emits selected signal on WidgetSig with full name of selected item

func (*FileView) FileViewEvents

func (fv *FileView) FileViewEvents()

func (*FileView) FilesRow added in v0.9.8

func (fv *FileView) FilesRow() *gi.Layout

func (*FileView) FilesView

func (fv *FileView) FilesView() *TableView

FilesView returns the TableView of the files

func (*FileView) HasFocus2D

func (fv *FileView) HasFocus2D() bool

func (*FileView) KeyInput

func (fv *FileView) KeyInput(kt *key.ChordEvent)

func (*FileView) NewFolder

func (fv *FileView) NewFolder()

NewFolder creates a new folder in current directory

func (*FileView) PathComplete

func (fv *FileView) PathComplete(data any, path string, posLn, posCh int) (md complete.Matches)

PathComplete finds the possible completions for the path field

func (*FileView) PathCompleteEdit

func (fv *FileView) PathCompleteEdit(data any, text string, cursorPos int, c complete.Completion, seed string) (ed complete.Edit)

PathCompleteEdit is the editing function called when inserting the completion selection in the path field

func (*FileView) PathField

func (fv *FileView) PathField() *gi.ComboBox

PathField returns the ComboBox of the path

func (*FileView) PathFieldHistNext

func (fv *FileView) PathFieldHistNext()

PathFieldHistNext goes to the next path in history

func (*FileView) PathFieldHistPrev

func (fv *FileView) PathFieldHistPrev()

PathFieldHistPrev goes to the previous path in history

func (*FileView) SaveSortPrefs

func (fv *FileView) SaveSortPrefs()

SaveSortPrefs saves current sorting preferences

func (*FileView) SelField

func (fv *FileView) SelField() *gi.TextField

SelField returns the TextField of the selected file

func (*FileView) SelRow added in v0.9.8

func (fv *FileView) SelRow() *gi.Layout

func (*FileView) SelectFile

func (fv *FileView) SelectFile()

SelectFile selects the current file -- if a directory it opens the directory; if a file it selects the file and closes dialog

func (*FileView) SelectedFile

func (fv *FileView) SelectedFile() string

SelectedFile returns the full path to selected file

func (*FileView) SelectedFileInfo

func (fv *FileView) SelectedFileInfo() (*FileInfo, bool)

SelectedFileInfo returns the currently-selected fileinfo, returns false if none

func (*FileView) SetExt

func (fv *FileView) SetExt(ext string)

SetExt updates the ext to given (list of, comma separated) extensions

func (*FileView) SetExtAction

func (fv *FileView) SetExtAction(ext string)

SetExtAction sets the current extension to highlight, and redisplays files

func (*FileView) SetFilename

func (fv *FileView) SetFilename(filename, ext string)

SetFilename sets the initial filename (splitting out path and filename) and initializes the view

func (*FileView) SetPathFile

func (fv *FileView) SetPathFile(path, file, ext string)

SetPathFile sets the path, initial select file (or "") and initializes the view

func (*FileView) SetSelFileAction

func (fv *FileView) SetSelFileAction(sel string)

SetSelFileAction sets the currently selected file to given name, and sends selection action with current full file name, and updates selection in table view

func (*FileView) Style2D

func (fv *FileView) Style2D()

func (*FileView) UpdateFavs

func (fv *FileView) UpdateFavs()

UpdateFavs updates list of files and other views for current path

func (*FileView) UpdateFiles

func (fv *FileView) UpdateFiles()

UpdateFiles updates list of files and other views for current path

func (*FileView) UpdateFilesAction

func (fv *FileView) UpdateFilesAction()

UpdateFilesAction updates list of files and other views for current path, emitting FileSig signals around it -- this is for gui-generated actions only.

func (*FileView) UpdatePath

func (fv *FileView) UpdatePath()

UpdatePath ensures that path is in abs form and ready to be used..

func (*FileView) WatchWatcher added in v1.1.3

func (fv *FileView) WatchWatcher()

type FileViewFilterFunc

type FileViewFilterFunc func(fv *FileView, fi *FileInfo) bool

FileViewFilterFunc is a filtering function for files -- returns true if the file should be visible in the view, and false if not

type FileViewSignals

type FileViewSignals int64

FileViewSignals are signals that fileview sends based on user actions.

const (
	// FileViewDoubleClicked emitted for double-click on a non-directory file
	// in table view (data is full selected file name w/ path) -- typically
	// closes dialog.
	FileViewDoubleClicked FileViewSignals = iota

	// FileViewWillUpdate emitted when list of files is about to be updated
	// based on user action (data is current path) -- current DirPath will be
	// used -- can intervene here if needed.
	FileViewWillUpdate

	// FileViewUpdated emitted after list of files has been updated (data is
	// current path).
	FileViewUpdated

	// FileViewNewFolder emitted when a new folder was created (data is
	// current path).
	FileViewNewFolder

	// FileViewFavAdded emitted when a new favorite was added (data is new
	// favorite path).
	FileViewFavAdded

	FileViewSignalsN
)

func (*FileViewSignals) FromString

func (i *FileViewSignals) FromString(s string) error

func (FileViewSignals) String

func (i FileViewSignals) String() string

type FloatValueView

type FloatValueView struct {
	ValueViewBase
}

FloatValueView presents a spinbox

func (*FloatValueView) ConfigWidget

func (vv *FloatValueView) ConfigWidget(widg gi.Node2D)

func (*FloatValueView) UpdateWidget

func (vv *FloatValueView) UpdateWidget()

func (*FloatValueView) WidgetType

func (vv *FloatValueView) WidgetType() reflect.Type

type FontValueView

type FontValueView struct {
	ValueViewBase
}

FontValueView presents an action for displaying a FontName and selecting fonts from FontChooserDialog

func (*FontValueView) Activate

func (vv *FontValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*FontValueView) ConfigWidget

func (vv *FontValueView) ConfigWidget(widg gi.Node2D)

func (*FontValueView) HasAction

func (vv *FontValueView) HasAction() bool

func (*FontValueView) UpdateWidget

func (vv *FontValueView) UpdateWidget()

func (*FontValueView) WidgetType

func (vv *FontValueView) WidgetType() reflect.Type

type GiEditor

type GiEditor struct {
	gi.Frame
	KiRoot   ki.Ki       `desc:"root of tree being edited"`
	Changed  bool        `desc:"has the root changed via gui actions?  updated from treeview and structview for changes"`
	Filename gi.FileName `desc:"current filename for saving / loading"`
}

GiEditor represents a struct, creating a property editor of the fields -- constructs Children widgets to show the field names and editor fields for each field, within an overall frame with an optional title, and a button box at the bottom where methods can be invoked

func AddNewGiEditor added in v0.9.7

func AddNewGiEditor(parent ki.Ki, name string) *GiEditor

AddNewGiEditor adds a new gieditor to given parent node, with given name.

func GoGiEditorDialog

func GoGiEditorDialog(obj ki.Ki) *GiEditor

GoGiEditorDialog opens an interactive editor of the given Ki tree, at its root, returns GiEditor and window

func (*GiEditor) Config added in v0.9.8

func (ge *GiEditor) Config()

Config configures the widget

func (*GiEditor) ConfigSplitView

func (ge *GiEditor) ConfigSplitView()

ConfigSplitView configures the SplitView.

func (*GiEditor) ConfigToolbar

func (ge *GiEditor) ConfigToolbar()

ConfigToolbar adds a GiEditor toolbar.

func (*GiEditor) Open

func (ge *GiEditor) Open(filename gi.FileName)

Open opens tree from given filename, in a standard JSON-formatted file

func (*GiEditor) Render2D

func (ge *GiEditor) Render2D()

func (*GiEditor) Save

func (ge *GiEditor) Save()

Save saves tree to current filename, in a standard JSON-formatted file

func (*GiEditor) SaveAs

func (ge *GiEditor) SaveAs(filename gi.FileName)

SaveAs saves tree to given filename, in a standard JSON-formatted file

func (*GiEditor) SetChanged

func (ge *GiEditor) SetChanged()

func (*GiEditor) SetRoot

func (ge *GiEditor) SetRoot(root ki.Ki)

SetRoot sets the source root and ensures everything is configured

func (*GiEditor) SetTitle

func (ge *GiEditor) SetTitle(title string)

SetTitle sets the optional title and updates the Title label

func (*GiEditor) SplitView

func (ge *GiEditor) SplitView() *gi.SplitView

SplitView returns the main SplitView

func (*GiEditor) StructView

func (ge *GiEditor) StructView() *StructView

StructView returns the main StructView

func (*GiEditor) TitleWidget

func (ge *GiEditor) TitleWidget() *gi.Label

Title returns the title label widget, and its index, within frame

func (*GiEditor) ToolBar

func (ge *GiEditor) ToolBar() *gi.ToolBar

ToolBar returns the toolbar widget

func (*GiEditor) TreeView

func (ge *GiEditor) TreeView() *TreeView

TreeView returns the main TreeView

func (*GiEditor) Update

func (ge *GiEditor) Update()

Update updates the objects being edited (e.g., updating display changes)

type HiMarkup

type HiMarkup struct {
	Info     *FileInfo      `desc:"full info about the file including category etc"`
	Style    gi.HiStyleName `desc:"syntax highlighting style"`
	Lang     string         `desc:"chroma-based language name for syntax highlighting the code"`
	Has      bool           `desc:"true if both lang and style are set"`
	TabSize  int            `desc:"tab size, in chars"`
	CSSProps ki.Props       `json:"-" xml:"-" desc:"Commpiled CSS properties for given highlighting style"`
	PiState  *pi.FileStates `desc:"pi parser state info"`
	PiLang   pi.Lang        `desc:"if supported, this is the pi Lang support for parsing"`
	HiStyle  *histyle.Style `desc:"current highlighting style"`
	Off      bool           `desc:"external toggle to turn off automatic highlighting"`
	// contains filtered or unexported fields
}

HiMarkup manages the syntax highlighting state for TextBuf it uses Pi if available, otherwise falls back on chroma

func (*HiMarkup) ChromaTagsAll added in v0.9.4

func (hm *HiMarkup) ChromaTagsAll(txt []byte) ([]lex.Line, error)

ChromaTagsAll returns all the markup tags according to current syntax highlighting settings

func (*HiMarkup) ChromaTagsForLine added in v0.9.4

func (hm *HiMarkup) ChromaTagsForLine(tags *lex.Line, toks []chroma.Token)

ChromaTagsForLine generates the chroma tags for one line of chroma tokens

func (*HiMarkup) ChromaTagsLine added in v0.9.4

func (hm *HiMarkup) ChromaTagsLine(txt []rune) (lex.Line, error)

ChromaTagsLine returns tags for one line according to current syntax highlighting settings

func (*HiMarkup) HasHi

func (hm *HiMarkup) HasHi() bool

HasHi returns true if there are highlighting parameters set (only valid after Init)

func (*HiMarkup) Init

func (hm *HiMarkup) Init(info *FileInfo, pist *pi.FileStates)

Init initializes the syntax highlighting for current params

func (*HiMarkup) MarkupLine

func (hm *HiMarkup) MarkupLine(txt []rune, hitags, tags lex.Line) []byte

MarkupLine returns the line with html class tags added for each tag takes both the hi tags and extra tags. Only fully nested tags are supported -- any dangling ends are truncated.

func (*HiMarkup) MarkupTagsAll

func (hm *HiMarkup) MarkupTagsAll(txt []byte) ([]lex.Line, error)

MarkupTagsAll returns all the markup tags according to current syntax highlighting settings

func (*HiMarkup) MarkupTagsLine

func (hm *HiMarkup) MarkupTagsLine(ln int, txt []rune) (lex.Line, error)

MarkupTagsLine returns tags for one line according to current syntax highlighting settings

func (*HiMarkup) SetHiStyle added in v0.9.11

func (hm *HiMarkup) SetHiStyle(style gi.HiStyleName)

SetHiStyle sets the highlighting style and updates corresponding settings

func (*HiMarkup) UsingPi added in v0.9.4

func (hm *HiMarkup) UsingPi() bool

UsingPi returns true if markup is using GoPi lexer / parser -- affects use of results

type HiStyleValueView

type HiStyleValueView struct {
	ValueViewBase
}

HiStyleValueView presents an action for displaying a mat32.Y and selecting from styles

func (*HiStyleValueView) Activate

func (vv *HiStyleValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*HiStyleValueView) ConfigWidget

func (vv *HiStyleValueView) ConfigWidget(widg gi.Node2D)

func (*HiStyleValueView) HasAction

func (vv *HiStyleValueView) HasAction() bool

func (*HiStyleValueView) UpdateWidget

func (vv *HiStyleValueView) UpdateWidget()

func (*HiStyleValueView) WidgetType

func (vv *HiStyleValueView) WidgetType() reflect.Type

type ISearch

type ISearch struct {
	On       bool            `json:"-" xml:"-" desc:"if true, in interactive search mode"`
	Find     string          `json:"-" xml:"-" desc:"current interactive search string"`
	UseCase  bool            `json:"-" xml:"-" desc:"pay attention to case in isearch -- triggered by typing an upper-case letter"`
	Matches  []textbuf.Match `json:"-" xml:"-" desc:"current search matches"`
	Pos      int             `json:"-" xml:"-" desc:"position within isearch matches"`
	PrevPos  int             `json:"-" xml:"-" desc:"position in search list from previous search"`
	StartPos lex.Pos         `json:"-" xml:"-" desc:"starting position for search -- returns there after on cancel"`
}

ISearch holds all the interactive search data

type IconValueView

type IconValueView struct {
	ValueViewBase
}

IconValueView presents an action for displaying an IconName and selecting icons from IconChooserDialog

func (*IconValueView) Activate

func (vv *IconValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*IconValueView) ConfigWidget

func (vv *IconValueView) ConfigWidget(widg gi.Node2D)

func (*IconValueView) HasAction

func (vv *IconValueView) HasAction() bool

func (*IconValueView) UpdateWidget

func (vv *IconValueView) UpdateWidget()

func (*IconValueView) WidgetType

func (vv *IconValueView) WidgetType() reflect.Type

type IntValueView

type IntValueView struct {
	ValueViewBase
}

IntValueView presents a spinbox

func (*IntValueView) ConfigWidget

func (vv *IntValueView) ConfigWidget(widg gi.Node2D)

func (*IntValueView) UpdateWidget

func (vv *IntValueView) UpdateWidget()

func (*IntValueView) WidgetType

func (vv *IntValueView) WidgetType() reflect.Type

type KeyChordEdit

type KeyChordEdit struct {
	gi.Label
	FocusActive bool      `json:"-" xml:"-" desc:"true if the keyboard focus is active or not -- when we lose active focus we apply changes"`
	KeyChordSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal -- only one event, when chord is updated from key input"`
}

KeyChordEdit is a label widget that shows a key chord string, and, when in focus (after being clicked) will update to whatever key chord is typed -- used for representing and editing key chords.

func (*KeyChordEdit) ChordUpdated

func (kc *KeyChordEdit) ChordUpdated()

ChordUpdated emits KeyChordSig when a new chord has been entered

func (*KeyChordEdit) ConnectEvents2D

func (kc *KeyChordEdit) ConnectEvents2D()

func (*KeyChordEdit) Disconnect added in v0.9.8

func (kc *KeyChordEdit) Disconnect()

func (*KeyChordEdit) FocusChanged2D

func (kc *KeyChordEdit) FocusChanged2D(change gi.FocusChanges)

func (*KeyChordEdit) KeyChordEvent

func (kc *KeyChordEdit) KeyChordEvent()

func (*KeyChordEdit) MakeContextMenu

func (kc *KeyChordEdit) MakeContextMenu(m *gi.Menu)

func (*KeyChordEdit) MouseEvent

func (kc *KeyChordEdit) MouseEvent()

func (*KeyChordEdit) Style2D

func (kc *KeyChordEdit) Style2D()

type KeyChordValueView

type KeyChordValueView struct {
	ValueViewBase
}

KeyChordValueView presents an KeyChordEdit for key.Chord

func (*KeyChordValueView) ConfigWidget

func (vv *KeyChordValueView) ConfigWidget(widg gi.Node2D)

func (*KeyChordValueView) HasAction

func (vv *KeyChordValueView) HasAction() bool

func (*KeyChordValueView) UpdateWidget

func (vv *KeyChordValueView) UpdateWidget()

func (*KeyChordValueView) WidgetType

func (vv *KeyChordValueView) WidgetType() reflect.Type

type KeyMapValueView

type KeyMapValueView struct {
	ValueViewBase
}

KeyMapValueView presents an action for displaying a KeyMapName and selecting from chooser

func (*KeyMapValueView) Activate

func (vv *KeyMapValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*KeyMapValueView) ConfigWidget

func (vv *KeyMapValueView) ConfigWidget(widg gi.Node2D)

func (*KeyMapValueView) HasAction

func (vv *KeyMapValueView) HasAction() bool

func (*KeyMapValueView) UpdateWidget

func (vv *KeyMapValueView) UpdateWidget()

func (*KeyMapValueView) WidgetType

func (vv *KeyMapValueView) WidgetType() reflect.Type

type KiPtrValueView

type KiPtrValueView struct {
	ValueViewBase
}

KiPtrValueView provides a chooser for pointers to Ki objects

func (*KiPtrValueView) Activate

func (vv *KiPtrValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)

func (*KiPtrValueView) ConfigWidget

func (vv *KiPtrValueView) ConfigWidget(widg gi.Node2D)

func (*KiPtrValueView) HasAction

func (vv *KiPtrValueView) HasAction() bool

func (*KiPtrValueView) KiStruct

func (vv *KiPtrValueView) KiStruct() ki.Ki

get the Ki struct itself (or nil)

func (*KiPtrValueView) UpdateWidget

func (vv *KiPtrValueView) UpdateWidget()

func (*KiPtrValueView) WidgetType

func (vv *KiPtrValueView) WidgetType() reflect.Type

type LabelFunc added in v0.9.5

type LabelFunc func(it any, act *gi.Action) string

LabelFunc is a function that returns a string to set a label first argument is the object on which the method is defined (receiver)

type MapInlineValueView

type MapInlineValueView struct {
	ValueViewBase
}

MapInlineValueView presents a MapViewInline for a map

func (*MapInlineValueView) ConfigWidget

func (vv *MapInlineValueView) ConfigWidget(widg gi.Node2D)

func (*MapInlineValueView) UpdateWidget

func (vv *MapInlineValueView) UpdateWidget()

func (*MapInlineValueView) WidgetType

func (vv *MapInlineValueView) WidgetType() reflect.Type

type MapValueView

type MapValueView struct {
	ValueViewBase
}

MapValueView presents a button to edit maps

func (*MapValueView) Activate

func (vv *MapValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)

func (*MapValueView) ConfigWidget

func (vv *MapValueView) ConfigWidget(widg gi.Node2D)

func (*MapValueView) HasAction

func (vv *MapValueView) HasAction() bool

func (*MapValueView) UpdateWidget

func (vv *MapValueView) UpdateWidget()

func (*MapValueView) WidgetType

func (vv *MapValueView) WidgetType() reflect.Type

type MapView

type MapView struct {
	gi.Frame
	Map        any         `desc:"the map that we are a view onto"`
	MapValView ValueView   `desc:"ValueView for the map itself, if this was created within value view framework -- otherwise nil"`
	Changed    bool        `desc:"has the map been edited?"`
	Keys       []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map keys"`
	Values     []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map values"`
	SortVals   bool        `desc:"sort by values instead of keys"`
	TmpSave    ValueView   `` /* 189-byte string literal not displayed */
	ViewSig    ki.Signal   `` /* 179-byte string literal not displayed */
	MapViewSig ki.Signal   `copy:"-" json:"-" xml:"-" desc:"map view specific signals: add, delete, double-click"`
	ViewPath   string      `` /* 134-byte string literal not displayed */
	ToolbarMap any         `desc:"the map that we successfully set a toolbar for"`
}

MapView represents a map, creating a property editor of the values -- constructs Children widgets to show the key / value pairs, within an overall frame. Automatically has a toolbar with Map ToolBar props if defined set prop toolbar = false to turn off

func AddNewMapView added in v0.9.7

func AddNewMapView(parent ki.Ki, name string) *MapView

AddNewMapView adds a new mapview to given parent node, with given name.

func (*MapView) Config added in v0.9.8

func (mv *MapView) Config()

Config configures the view

func (*MapView) ConfigMapGrid

func (mv *MapView) ConfigMapGrid()

ConfigMapGrid configures the MapGrid for the current map

func (*MapView) ConfigToolbar

func (mv *MapView) ConfigToolbar()

ConfigToolbar configures the toolbar actions

func (*MapView) Disconnect added in v0.9.8

func (mv *MapView) Disconnect()

func (*MapView) IsConfiged added in v0.9.8

func (mv *MapView) IsConfiged() bool

IsConfiged returns true if the widget is fully configured

func (*MapView) KiPropTag

func (mv *MapView) KiPropTag() string

KiPropTag returns the PropTag value from Ki owner of this map, if it is..

func (*MapView) MapAdd

func (mv *MapView) MapAdd()

MapAdd adds a new entry to the map

func (*MapView) MapChangeValueType

func (mv *MapView) MapChangeValueType(idx int, typ reflect.Type)

MapChangeValueType changes the type of the value for given map element at idx -- for maps with any values

func (*MapView) MapDelete

func (mv *MapView) MapDelete(key reflect.Value)

MapDelete deletes a key-value from the map

func (*MapView) MapGrid

func (mv *MapView) MapGrid() *gi.Frame

MapGrid returns the MapGrid grid layout widget, which contains all the fields and values

func (*MapView) Render2D

func (mv *MapView) Render2D()

func (*MapView) SetChanged

func (mv *MapView) SetChanged()

SetChanged sets the Changed flag and emits the ViewSig signal for the MapView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.

func (*MapView) SetMap

func (mv *MapView) SetMap(mp any)

SetMap sets the source map that we are viewing -- rebuilds the children to represent this map

func (*MapView) Style2D

func (mv *MapView) Style2D()

func (*MapView) ToggleSort

func (mv *MapView) ToggleSort()

ToggleSort toggles sorting by values vs. keys

func (*MapView) ToolBar

func (mv *MapView) ToolBar() *gi.ToolBar

ToolBar returns the toolbar widget

func (*MapView) UpdateValues

func (mv *MapView) UpdateValues()

UpdateValues updates the widget display of slice values, assuming same slice config

type MapViewInline

type MapViewInline struct {
	gi.PartsWidgetBase
	Map        any         `desc:"the map that we are a view onto"`
	MapValView ValueView   `desc:"ValueView for the map itself, if this was created within value view framework -- otherwise nil"`
	Changed    bool        `desc:"has the map been edited?"`
	Keys       []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map keys"`
	Values     []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"`
	TmpSave    ValueView   `` /* 189-byte string literal not displayed */
	ViewSig    ki.Signal   `` /* 179-byte string literal not displayed */
	ViewPath   string      `` /* 134-byte string literal not displayed */
}

MapViewInline represents a map as a single line widget, for smaller maps and those explicitly marked inline -- constructs widgets in Parts to show the key names and editor vals for each value.

func (*MapViewInline) ConfigParts

func (mv *MapViewInline) ConfigParts()

ConfigParts configures Parts for the current map

func (*MapViewInline) Disconnect added in v0.9.8

func (mv *MapViewInline) Disconnect()

func (*MapViewInline) MapAdd

func (mv *MapViewInline) MapAdd()

MapAdd adds a new entry to the map

func (*MapViewInline) Render2D

func (mv *MapViewInline) Render2D()

func (*MapViewInline) SetChanged

func (mv *MapViewInline) SetChanged()

SetChanged sets the Changed flag and emits the ViewSig signal for the SliceView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.

func (*MapViewInline) SetMap

func (mv *MapViewInline) SetMap(mp any)

SetMap sets the source map that we are viewing -- rebuilds the children to represent this map

func (*MapViewInline) Style2D

func (mv *MapViewInline) Style2D()

func (*MapViewInline) UpdateFromMap

func (mv *MapViewInline) UpdateFromMap()

func (*MapViewInline) UpdateValues

func (mv *MapViewInline) UpdateValues()

type MapViewSignals added in v0.9.14

type MapViewSignals int

MapViewSignals are signals that mapview can send, mostly for editing mode. Selection events are sent on WidgetSig WidgetSelected signals in both modes.

const (
	// MapViewDoubleClicked emitted during inactive mode when item
	// double-clicked -- can be used for accepting dialog.
	MapViewDoubleClicked MapViewSignals = iota

	// MapViewAdded emitted when a new blank item is added -- no data is sent.
	MapViewAdded

	// MapViewDeleted emitted when an item is deleted -- data is key of item deleted
	MapViewDeleted

	MapViewSignalsN
)

func (*MapViewSignals) FromString added in v0.9.15

func (i *MapViewSignals) FromString(s string) error

func (MapViewSignals) String added in v0.9.14

func (i MapViewSignals) String() string

type MethViewData

type MethViewData struct {
	Val            any
	ValVal         reflect.Value
	Vp             *gi.Viewport2D
	Method         string
	MethVal        reflect.Value
	MethTyp        reflect.Method
	ArgProps       ki.PropSlice     `desc:"names and other properties of args, in one-to-one with method args"`
	SpecProps      ki.Props         `desc:"props for special action types, e.g., FileView"`
	Desc           string           `desc:"prompt shown in arg dialog or confirm prompt dialog"`
	UpdateFunc     ActionUpdateFunc `desc:"update function defined in properties -- called by our wrapper update function"`
	SubMenuSlice   any              `desc:"value for submenu generation as a literal slice of items of appropriate type for method being called"`
	SubMenuField   string           `desc:"value for submenu generation as name of field on obj"`
	SubMenuFunc    SubMenuFunc      `desc:"function that will generate submenu items, as []string slice"`
	SubSubMenuFunc SubSubMenuFunc   `desc:"function that will generate sub-submenu items, as [][]string slice"`
	SubMenuVal     any              `` /* 129-byte string literal not displayed */
	KeyFun         gi.KeyFuns       `desc:"key function that we emit, if MethViewKeyFun type"`
	Flags          MethViewFlags
}

MethViewData is set to the Action.Data field for all MethView actions, containing info needed to actually call the Method on value Val.

func (*MethViewData) MakeMenuSliceValue added in v1.3.12

func (md *MethViewData) MakeMenuSliceValue(mvnp reflect.Value, m *gi.Menu, isSub bool, defstr string, gotDef bool)

func (*MethViewData) MethName added in v0.9.10

func (md *MethViewData) MethName() string

type MethViewFlags

type MethViewFlags int32

MethViewFlags define bitflags for method view action options

const (
	// MethViewConfirm confirms action before proceeding
	MethViewConfirm MethViewFlags = iota

	// MethViewShowReturn shows the return value from the method
	MethViewShowReturn

	// MethViewNoUpdateAfter means do not update window after method runs (default is to do so)
	MethViewNoUpdateAfter

	// MethViewHasSubMenu means that this action has a submenu option --
	// argument values will be selected from the auto-generated submenu
	MethViewHasSubMenu

	// MethViewHasSubMenuVal means that this action was called using a submenu
	// and the SubMenuVal has the selected value
	MethViewHasSubMenuVal

	// MethViewKeyFun means this action's only function is to emit the key fun
	MethViewKeyFun

	MethViewFlagsN
)

func (*MethViewFlags) FromString

func (i *MethViewFlags) FromString(s string) error

func (MethViewFlags) String

func (i MethViewFlags) String() string

type NilValueView added in v0.9.10

type NilValueView struct {
	ValueViewBase
}

NilValueView presents a label saying 'nil' -- for any nil or otherwise unrepresentable items

func (*NilValueView) ConfigWidget added in v0.9.10

func (vv *NilValueView) ConfigWidget(widg gi.Node2D)

func (*NilValueView) UpdateWidget added in v0.9.10

func (vv *NilValueView) UpdateWidget()

func (*NilValueView) WidgetType added in v0.9.10

func (vv *NilValueView) WidgetType() reflect.Type

type OutBuf added in v0.9.4

type OutBuf struct {
	Out        io.Reader        `desc:"the output that we are reading from, as an io.Reader"`
	Buf        *TextBuf         `desc:"the TextBuf that we output to"`
	BatchMSec  int              `desc:"default 200: how many milliseconds to wait while batching output"`
	MarkupFun  OutBufMarkupFunc `` /* 172-byte string literal not displayed */
	CurOutLns  [][]byte         `desc:"current buffered output raw lines -- not yet sent to Buf"`
	CurOutMus  [][]byte         `desc:"current buffered output markup lines -- not yet sent to Buf"`
	Mu         sync.Mutex       `desc:"mutex protecting updating of CurOutLns and Buf, and timer"`
	LastOut    time.Time        `desc:"time when last output was sent to buffer"`
	AfterTimer *time.Timer      `` /* 155-byte string literal not displayed */
}

OutBuf is a TextBuf that records the output from an io.Reader using bufio.Scanner -- optimized to combine fast chunks of output into large blocks of updating. Also supports arbitrary markup function that operates on each line of output bytes.

func (*OutBuf) Init added in v0.9.4

func (ob *OutBuf) Init(out io.Reader, buf *TextBuf, batchMSec int, markup OutBufMarkupFunc)

Init sets the various params and prepares for running

func (*OutBuf) MonOut added in v0.9.4

func (ob *OutBuf) MonOut()

MonOut monitors the output and updates the TextBuf

func (*OutBuf) OutToBuf added in v0.9.4

func (ob *OutBuf) OutToBuf()

OutToBuf sends the current output to TextBuf MUST be called under mutex protection

type OutBufMarkupFunc added in v0.9.4

type OutBufMarkupFunc func(line []byte) []byte

OutBufMarkupFunc is a function that returns a marked-up version of a given line of output text by adding html tags. It is essential that it ONLY adds tags, and otherwise has the exact same visible bytes as the input

type QReplace

type QReplace struct {
	On       bool            `json:"-" xml:"-" desc:"if true, in interactive search mode"`
	Find     string          `json:"-" xml:"-" desc:"current interactive search string"`
	Replace  string          `json:"-" xml:"-" desc:"current interactive search string"`
	UseCase  bool            `json:"-" xml:"-" desc:"pay attention to case in isearch -- triggered by typing an upper-case letter"`
	LexItems bool            `` /* 128-byte string literal not displayed */
	Matches  []textbuf.Match `json:"-" xml:"-" desc:"current search matches"`
	Pos      int             `json:"-" xml:"-" desc:"position within isearch matches"`
	PrevPos  int             `json:"-" xml:"-" desc:"position in search list from previous search"`
	StartPos lex.Pos         `json:"-" xml:"-" desc:"starting position for search -- returns there after on cancel"`
}

QReplace holds all the query-replace data

type RuneSliceValueView

type RuneSliceValueView struct {
	ValueViewBase
}

RuneSliceValueView presents a textfield of the bytes

func (*RuneSliceValueView) ConfigWidget

func (vv *RuneSliceValueView) ConfigWidget(widg gi.Node2D)

func (*RuneSliceValueView) UpdateWidget

func (vv *RuneSliceValueView) UpdateWidget()

func (*RuneSliceValueView) WidgetType

func (vv *RuneSliceValueView) WidgetType() reflect.Type

type ShortcutFunc

type ShortcutFunc func(it any, act *gi.Action) key.Chord

ShortcutFunc is a function that returns a key.Chord string for a shortcut used in MethView shortcut-func option first argument is the object on which the method is defined (receiver)

type SliceInlineValueView

type SliceInlineValueView struct {
	ValueViewBase
}

SliceInlineValueView presents a SliceViewInline for a map

func (*SliceInlineValueView) ConfigWidget

func (vv *SliceInlineValueView) ConfigWidget(widg gi.Node2D)

func (*SliceInlineValueView) UpdateWidget

func (vv *SliceInlineValueView) UpdateWidget()

func (*SliceInlineValueView) WidgetType

func (vv *SliceInlineValueView) WidgetType() reflect.Type

type SliceValueView

type SliceValueView struct {
	ValueViewBase
	IsArray    bool         // is an array, not a slice
	ElType     reflect.Type // type of element in the slice -- has pointer if slice has pointers
	ElIsStruct bool         // whether non-pointer element type is a struct or not
}

SliceValueView presents a button to edit slices

func (*SliceValueView) Activate

func (vv *SliceValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)

func (*SliceValueView) ConfigWidget

func (vv *SliceValueView) ConfigWidget(widg gi.Node2D)

func (*SliceValueView) HasAction

func (vv *SliceValueView) HasAction() bool

func (*SliceValueView) UpdateWidget

func (vv *SliceValueView) UpdateWidget()

func (*SliceValueView) WidgetType

func (vv *SliceValueView) WidgetType() reflect.Type

type SliceView

type SliceView struct {
	SliceViewBase
	StyleFunc SliceViewStyleFunc `copy:"-" view:"-" json:"-" xml:"-" desc:"optional styling function"`
}

SliceView represents a slice, creating an interactive viewer / editor of the elements as rows in a table. Widgets to show the index / value pairs, within an overall frame. Set to Inactive for select-only mode, which emits WidgetSig WidgetSelected signals when selection is updated.

func AddNewSliceView added in v0.9.7

func AddNewSliceView(parent ki.Ki, name string) *SliceView

AddNewSliceView adds a new sliceview to given parent node, with given name.

func (*SliceView) StyleRow added in v0.9.8

func (sv *SliceView) StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv ValueView)

type SliceViewBase added in v0.9.8

type SliceViewBase struct {
	gi.Frame
	Slice        any           `copy:"-" view:"-" json:"-" xml:"-" desc:"the slice that we are a view onto -- must be a pointer to that slice"`
	ViewMu       *sync.Mutex   `` /* 293-byte string literal not displayed */
	SliceNPVal   reflect.Value `copy:"-" view:"-" json:"-" xml:"-" desc:"non-ptr reflect.Value of the slice"`
	SliceValView ValueView     `` /* 138-byte string literal not displayed */

	NoAdd            bool             `desc:"if true, user cannot add elements to the slice"`
	NoDelete         bool             `desc:"if true, user cannot delete elements from the slice"`
	ShowViewCtxtMenu bool             `` /* 131-byte string literal not displayed */
	Changed          bool             `desc:"has the slice been edited?"`
	Values           []ValueView      `copy:"-" view:"-" json:"-" xml:"-" desc:"ValueView representations of the slice values"`
	ShowIndex        bool             `xml:"index" desc:"whether to show index or not -- updated from 'index' property (bool)"`
	InactKeyNav      bool             `` /* 223-byte string literal not displayed */
	SelVal           any              `copy:"-" view:"-" json:"-" xml:"-" desc:"current selection value -- initially select this value if set"`
	SelectedIdx      int              `copy:"-" json:"-" xml:"-" desc:"index of currently-selected item, in Inactive mode only"`
	SelectMode       bool             `copy:"-" desc:"editing-mode select rows mode"`
	InactMultiSel    bool             `` /* 170-byte string literal not displayed */
	SelectedIdxs     map[int]struct{} `copy:"-" desc:"list of currently-selected slice indexes"`
	DraggedIdxs      []int            `copy:"-" desc:"list of currently-dragged indexes"`
	SliceViewSig     ki.Signal        `copy:"-" json:"-" xml:"-" desc:"slice view specific signals: insert, delete, double-click"`
	ViewSig          ki.Signal        `` /* 188-byte string literal not displayed */
	ViewPath         string           `` /* 134-byte string literal not displayed */
	TmpSave          ValueView        `` /* 198-byte string literal not displayed */
	ToolbarSlice     any              `copy:"-" view:"-" json:"-" xml:"-" desc:"the slice that we successfully set a toolbar for"`

	SliceSize     int     `inactive:"+" copy:"-" json:"-" xml:"-" desc:"size of slice"`
	DispRows      int     `inactive:"+" copy:"-" json:"-" xml:"-" desc:"actual number of rows displayed = min(VisRows, SliceSize)"`
	StartIdx      int     `inactive:"+" copy:"-" json:"-" xml:"-" desc:"starting slice index of visible rows"`
	RowHeight     float32 `inactive:"+" copy:"-" json:"-" xml:"-" desc:"height of a single row"`
	VisRows       int     `inactive:"+" copy:"-" json:"-" xml:"-" desc:"total number of rows visible in allocated display size"`
	LayoutHeight  float32 `copy:"-" view:"-" json:"-" xml:"-" desc:"the height of grid from last layout -- determines when update needed"`
	RenderedRows  int     `copy:"-" view:"-" json:"-" xml:"-" desc:"the number of rows rendered -- determines update"`
	InFocusGrab   bool    `copy:"-" view:"-" json:"-" xml:"-" desc:"guard for recursive focus grabbing"`
	InFullRebuild bool    `copy:"-" view:"-" json:"-" xml:"-" desc:"guard for recursive rebuild"`
	CurIdx        int     `copy:"-" view:"-" json:"-" xml:"-" desc:"temp idx state for e.g., dnd"`
	// contains filtered or unexported fields
}

SliceViewBase is the base for SliceView and TableView and any other viewers of array-like data. It automatically computes the number of rows that fit within its allocated space, and manages the offset view window into the full list of items, and supports row selection, copy / paste, Drag-n-Drop, etc. Set to Inactive for select-only mode, which emits WidgetSig WidgetSelected signals when selection is updated. Automatically has a toolbar with Slice ToolBar props if defined set prop toolbar = false to turn off

func AddNewSliceViewBase added in v0.9.8

func AddNewSliceViewBase(parent ki.Ki, name string) *SliceViewBase

AddNewSliceViewBase adds a new sliceview to given parent node, with given name.

func (*SliceViewBase) AsSliceViewBase added in v0.9.8

func (sv *SliceViewBase) AsSliceViewBase() *SliceViewBase

func (*SliceViewBase) AvailHeight added in v0.9.8

func (sv *SliceViewBase) AvailHeight() float32

func (*SliceViewBase) Config added in v0.9.8

func (sv *SliceViewBase) Config()

Config configures a standard setup of the overall Frame

func (*SliceViewBase) ConfigScroll added in v0.9.8

func (sv *SliceViewBase) ConfigScroll()

ConfigScroll configures the scrollbar

func (*SliceViewBase) ConfigSliceGrid added in v0.9.8

func (sv *SliceViewBase) ConfigSliceGrid()

ConfigSliceGrid configures the SliceGrid for the current slice it is only called once at start, under overall Config

func (*SliceViewBase) ConfigToolbar added in v0.9.8

func (sv *SliceViewBase) ConfigToolbar()

ConfigToolbar configures the toolbar actions

func (*SliceViewBase) ConnectEvents2D added in v0.9.8

func (sv *SliceViewBase) ConnectEvents2D()

func (*SliceViewBase) Copy added in v0.9.8

func (sv *SliceViewBase) Copy(reset bool)

Copy copies selected rows to clip.Board, optionally resetting the selection satisfies gi.Clipper interface and can be overridden by subtypes

func (*SliceViewBase) CopyIdxs added in v0.9.8

func (sv *SliceViewBase) CopyIdxs(reset bool)

CopyIdxs copies selected idxs to clip.Board, optionally resetting the selection

func (*SliceViewBase) CopySelToMime added in v0.9.8

func (sv *SliceViewBase) CopySelToMime() mimedata.Mimes

CopySelToMime copies selected rows to mime data

func (*SliceViewBase) Cut added in v0.9.8

func (sv *SliceViewBase) Cut()

Cut copies selected indexes to clip.Board and deletes selected indexes satisfies gi.Clipper interface and can be overridden by subtypes

func (*SliceViewBase) CutIdxs added in v0.9.8

func (sv *SliceViewBase) CutIdxs()

CutIdxs copies selected indexes to clip.Board and deletes selected indexes

func (*SliceViewBase) DeleteIdxs added in v0.9.8

func (sv *SliceViewBase) DeleteIdxs()

DeleteIdxs deletes all selected indexes

func (*SliceViewBase) Disconnect added in v0.9.8

func (sv *SliceViewBase) Disconnect()

func (*SliceViewBase) DragNDropFinalize added in v0.9.8

func (sv *SliceViewBase) DragNDropFinalize(mod dnd.DropMods)

DragNDropFinalize is called to finalize actions on the Source node prior to performing target actions -- mod must indicate actual action taken by the target, including ignore -- ends up calling DragNDropSource if us..

func (*SliceViewBase) DragNDropSource added in v0.9.8

func (sv *SliceViewBase) DragNDropSource(de *dnd.Event)

DragNDropSource is called after target accepts the drop -- we just remove elements that were moved

func (*SliceViewBase) DragNDropStart added in v0.9.8

func (sv *SliceViewBase) DragNDropStart()

DragNDropStart starts a drag-n-drop

func (*SliceViewBase) DragNDropTarget added in v0.9.8

func (sv *SliceViewBase) DragNDropTarget(de *dnd.Event)

DragNDropTarget handles a drag-n-drop drop

func (*SliceViewBase) Drop added in v0.9.8

func (sv *SliceViewBase) Drop(md mimedata.Mimes, mod dnd.DropMods)

Drop pops up a menu to determine what specifically to do with dropped items this satisfies gi.DragNDropper interface, and can be overwritten in subtypes

func (*SliceViewBase) DropAfter added in v0.9.8

func (sv *SliceViewBase) DropAfter(md mimedata.Mimes, mod dnd.DropMods, idx int)

DropAfter inserts object(s) from mime data after this node

func (*SliceViewBase) DropAssign added in v0.9.8

func (sv *SliceViewBase) DropAssign(md mimedata.Mimes, idx int)

DropAssign assigns mime data (only the first one!) to this node

func (*SliceViewBase) DropBefore added in v0.9.8

func (sv *SliceViewBase) DropBefore(md mimedata.Mimes, mod dnd.DropMods, idx int)

DropBefore inserts object(s) from mime data before this node

func (*SliceViewBase) DropCancel added in v0.9.8

func (sv *SliceViewBase) DropCancel()

DropCancel cancels the drop action e.g., preventing deleting of source items in a Move case

func (*SliceViewBase) Duplicate added in v0.9.8

func (sv *SliceViewBase) Duplicate() int

Duplicate copies selected items and inserts them after current selection -- return idx of start of duplicates if successful, else -1

func (*SliceViewBase) FromMimeData added in v0.9.8

func (sv *SliceViewBase) FromMimeData(md mimedata.Mimes) []any

FromMimeData creates a slice of structs from mime data

func (*SliceViewBase) GridLayout added in v0.9.8

func (sv *SliceViewBase) GridLayout() *gi.Layout

GridLayout returns the Layout containing the Grid and the scrollbar

func (*SliceViewBase) HasFocus2D added in v0.9.8

func (sv *SliceViewBase) HasFocus2D() bool

func (*SliceViewBase) IdxFromPos added in v0.9.8

func (sv *SliceViewBase) IdxFromPos(posY int) (int, bool)

IdxFromPos returns the idx that contains given vertical position, false if not found

func (*SliceViewBase) IdxGrabFocus added in v0.9.8

func (sv *SliceViewBase) IdxGrabFocus(idx int) *gi.WidgetBase

IdxGrabFocus grabs the focus for the first focusable widget in given idx -- returns that element or nil if not successful

func (*SliceViewBase) IdxIsSelected added in v0.9.8

func (sv *SliceViewBase) IdxIsSelected(idx int) bool

IdxIsSelected returns the selected status of given slice index

func (*SliceViewBase) IdxPos added in v0.9.8

func (sv *SliceViewBase) IdxPos(idx int) image.Point

IdxPos returns center of window position of index label for idx (ContextMenuPos)

func (*SliceViewBase) IsConfiged added in v0.9.8

func (sv *SliceViewBase) IsConfiged() bool

IsConfiged returns true if the widget is fully configured

func (*SliceViewBase) IsIdxVisible added in v0.9.8

func (sv *SliceViewBase) IsIdxVisible(idx int) bool

IsIdxVisible returns true if slice index is currently visible

func (*SliceViewBase) IsRowInBounds added in v0.9.8

func (sv *SliceViewBase) IsRowInBounds(row int) bool

IsRowInBounds returns true if disp row is in bounds

func (*SliceViewBase) ItemCtxtMenu added in v0.9.8

func (sv *SliceViewBase) ItemCtxtMenu(idx int)

func (*SliceViewBase) KeyInputActive added in v0.9.8

func (sv *SliceViewBase) KeyInputActive(kt *key.ChordEvent)

func (*SliceViewBase) KeyInputInactive added in v0.9.8

func (sv *SliceViewBase) KeyInputInactive(kt *key.ChordEvent)

func (*SliceViewBase) KeyInputNav added in v1.1.6

func (sv *SliceViewBase) KeyInputNav(kt *key.ChordEvent)

KeyInputNav supports multiple selection navigation keys

func (*SliceViewBase) LayoutSliceGrid added in v0.9.8

func (sv *SliceViewBase) LayoutSliceGrid() bool

LayoutSliceGrid does the proper layout of slice grid depending on allocated size returns true if UpdateSliceGrid should be called after this

func (*SliceViewBase) MakeDropMenu added in v0.9.8

func (sv *SliceViewBase) MakeDropMenu(m *gi.Menu, data any, mod dnd.DropMods, idx int)

MakeDropMenu makes the menu of options for dropping on a target

func (*SliceViewBase) MakePasteMenu added in v0.9.8

func (sv *SliceViewBase) MakePasteMenu(m *gi.Menu, data any, idx int)

MakePasteMenu makes the menu of options for paste events

func (*SliceViewBase) MimeDataIdx added in v0.9.8

func (sv *SliceViewBase) MimeDataIdx(md *mimedata.Mimes, idx int)

MimeDataIdx adds mimedata for given idx: an application/json of the struct

func (*SliceViewBase) MimeDataType added in v0.9.10

func (sv *SliceViewBase) MimeDataType() string

MimeDataType returns the data type for mime clipboard (copy / paste) data e.g., filecat.DataJson

func (*SliceViewBase) MoveDown added in v0.9.8

func (sv *SliceViewBase) MoveDown(selMode mouse.SelectModes) int

MoveDown moves the selection down to next row, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed

func (*SliceViewBase) MoveDownAction added in v0.9.8

func (sv *SliceViewBase) MoveDownAction(selMode mouse.SelectModes) int

MoveDownAction moves the selection down to next row, using given select mode (from keyboard modifiers) -- and emits select event for newly selected row

func (*SliceViewBase) MovePageDown added in v0.9.8

func (sv *SliceViewBase) MovePageDown(selMode mouse.SelectModes) int

MovePageDown moves the selection down to next page, using given select mode (from keyboard modifiers) -- returns newly selected idx or -1 if failed

func (*SliceViewBase) MovePageDownAction added in v0.9.8

func (sv *SliceViewBase) MovePageDownAction(selMode mouse.SelectModes) int

MovePageDownAction moves the selection down to next page, using given select mode (from keyboard modifiers) -- and emits select event for newly selected idx

func (*SliceViewBase) MovePageUp added in v0.9.8

func (sv *SliceViewBase) MovePageUp(selMode mouse.SelectModes) int

MovePageUp moves the selection up to previous page, using given select mode (from keyboard modifiers) -- returns newly selected idx or -1 if failed

func (*SliceViewBase) MovePageUpAction added in v0.9.8

func (sv *SliceViewBase) MovePageUpAction(selMode mouse.SelectModes) int

MovePageUpAction moves the selection up to previous page, using given select mode (from keyboard modifiers) -- and emits select event for newly selected idx

func (*SliceViewBase) MoveUp added in v0.9.8

func (sv *SliceViewBase) MoveUp(selMode mouse.SelectModes) int

MoveUp moves the selection up to previous idx, using given select mode (from keyboard modifiers) -- returns newly selected idx or -1 if failed

func (*SliceViewBase) MoveUpAction added in v0.9.8

func (sv *SliceViewBase) MoveUpAction(selMode mouse.SelectModes) int

MoveUpAction moves the selection up to previous idx, using given select mode (from keyboard modifiers) -- and emits select event for newly selected idx

func (*SliceViewBase) NeedsDoubleReRender added in v1.3.19

func (sv *SliceViewBase) NeedsDoubleReRender() bool

func (*SliceViewBase) Paste added in v0.9.8

func (sv *SliceViewBase) Paste()

Paste pastes clipboard at CurIdx satisfies gi.Clipper interface and can be overridden by subtypes

func (*SliceViewBase) PasteAssign added in v0.9.8

func (sv *SliceViewBase) PasteAssign(md mimedata.Mimes, idx int)

PasteAssign assigns mime data (only the first one!) to this idx

func (*SliceViewBase) PasteAtIdx added in v0.9.8

func (sv *SliceViewBase) PasteAtIdx(md mimedata.Mimes, idx int)

PasteAtIdx inserts object(s) from mime data at (before) given slice index

func (*SliceViewBase) PasteIdx added in v0.9.8

func (sv *SliceViewBase) PasteIdx(idx int)

PasteIdx pastes clipboard at given idx

func (*SliceViewBase) PasteMenu added in v0.9.8

func (sv *SliceViewBase) PasteMenu(md mimedata.Mimes, idx int)

PasteMenu performs a paste from the clipboard using given data -- pops up a menu to determine what specifically to do

func (*SliceViewBase) Render2D added in v0.9.8

func (sv *SliceViewBase) Render2D()

func (*SliceViewBase) ResetSelectedIdxs added in v0.9.8

func (sv *SliceViewBase) ResetSelectedIdxs()

func (*SliceViewBase) RowFirstWidget added in v0.9.8

func (sv *SliceViewBase) RowFirstWidget(row int) (*gi.WidgetBase, bool)

RowFirstWidget returns the first widget for given row (could be index or not) -- false if out of range

func (*SliceViewBase) RowFromPos added in v0.9.8

func (sv *SliceViewBase) RowFromPos(posY int) (int, bool)

RowFromPos returns the row that contains given vertical position, false if not found

func (*SliceViewBase) RowGrabFocus added in v0.9.8

func (sv *SliceViewBase) RowGrabFocus(row int) *gi.WidgetBase

RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!

func (*SliceViewBase) RowWidgetNs added in v0.9.8

func (sv *SliceViewBase) RowWidgetNs() (nWidgPerRow, idxOff int)

RowWidgetNs returns number of widgets per row and offset for index label

func (*SliceViewBase) SaveDraggedIdxs added in v0.9.8

func (sv *SliceViewBase) SaveDraggedIdxs(idx int)

SaveDraggedIdxs saves selectedindexes into dragged indexes taking into account insertion at idx

func (*SliceViewBase) ScrollBar added in v0.9.8

func (sv *SliceViewBase) ScrollBar() *gi.ScrollBar

ScrollBar returns the SliceGrid scrollbar

func (*SliceViewBase) ScrollToIdx added in v0.9.8

func (sv *SliceViewBase) ScrollToIdx(idx int) bool

ScrollToIdx ensures that given slice idx is visible by scrolling display as needed

func (*SliceViewBase) ScrollToIdxNoUpdt added in v1.0.7

func (sv *SliceViewBase) ScrollToIdxNoUpdt(idx int) bool

ScrollToIdxNoUpdt ensures that given slice idx is visible by scrolling display as needed This version does not update the slicegrid -- just computes the StartIdx and updates the scrollbar

func (*SliceViewBase) SelectAllIdxs added in v0.9.8

func (sv *SliceViewBase) SelectAllIdxs()

SelectAllIdxs selects all idxs

func (*SliceViewBase) SelectIdx added in v0.9.8

func (sv *SliceViewBase) SelectIdx(idx int)

SelectIdx selects given idx (if not already selected) -- updates select status of index label

func (*SliceViewBase) SelectIdxAction added in v0.9.8

func (sv *SliceViewBase) SelectIdxAction(idx int, mode mouse.SelectModes)

SelectIdxAction is called when a select action has been received (e.g., a mouse click) -- translates into selection updates -- gets selection mode from mouse event (ExtendContinuous, ExtendOne)

func (*SliceViewBase) SelectIdxWidgets added in v0.9.8

func (sv *SliceViewBase) SelectIdxWidgets(idx int, sel bool) bool

SelectIdxWidgets sets the selection state of given slice index returns false if index is not visible

func (*SliceViewBase) SelectRowWidgets added in v0.9.8

func (sv *SliceViewBase) SelectRowWidgets(row int, sel bool)

SelectRowWidgets sets the selection state of given row of widgets

func (*SliceViewBase) SelectVal added in v0.9.8

func (sv *SliceViewBase) SelectVal(val string) bool

SelectVal sets SelVal and attempts to find corresponding row, setting SelectedIdx and selecting row if found -- returns true if found, false otherwise.

func (*SliceViewBase) SelectedIdxsList added in v0.9.8

func (sv *SliceViewBase) SelectedIdxsList(descendingSort bool) []int

SelectedIdxsList returns list of selected indexes, sorted either ascending or descending

func (*SliceViewBase) SetChanged added in v0.9.8

func (sv *SliceViewBase) SetChanged()

SetChanged sets the Changed flag and emits the ViewSig signal for the SliceViewBase, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.

func (*SliceViewBase) SetSlice added in v0.9.8

func (sv *SliceViewBase) SetSlice(sl any)

SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice

func (*SliceViewBase) SliceDeleteAt added in v0.9.8

func (sv *SliceViewBase) SliceDeleteAt(idx int, doupdt bool)

SliceDeleteAt deletes element at given index from slice if updt is true, then update the grid after

func (*SliceViewBase) SliceDeleteAtRow added in v0.9.8

func (sv *SliceViewBase) SliceDeleteAtRow(row int, updt bool)

SliceDeleteAtRow deletes element at given display row if updt is true, then update the grid after

func (*SliceViewBase) SliceDeleteAtSel added in v1.2.11

func (sv *SliceViewBase) SliceDeleteAtSel(idx int)

SliceDeleteAtSel updates selected rows based on deleting element at given index must be called with successful SliceDeleteAt

func (*SliceViewBase) SliceGrid added in v0.9.8

func (sv *SliceViewBase) SliceGrid() *gi.Frame

SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values

func (*SliceViewBase) SliceGridNeedsLayout added in v0.9.8

func (sv *SliceViewBase) SliceGridNeedsLayout() bool

func (*SliceViewBase) SliceGridNeedsUpdate added in v1.2.8

func (sv *SliceViewBase) SliceGridNeedsUpdate() bool

SliceGridNeedsUpdate returns true when slice grid needs to be updated. this should be true if the underlying size has changed, or other indication that the data might have changed.

func (*SliceViewBase) SliceNewAt added in v0.9.8

func (sv *SliceViewBase) SliceNewAt(idx int)

SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end

func (*SliceViewBase) SliceNewAtRow added in v0.9.8

func (sv *SliceViewBase) SliceNewAtRow(row int)

SliceNewAtRow inserts a new blank element at given display row

func (*SliceViewBase) SliceNewAtSel added in v1.2.11

func (sv *SliceViewBase) SliceNewAtSel(idx int)

SliceNewAtSel updates selected rows based on inserting new element at given index. must be called with successful SliceNewAt

func (*SliceViewBase) SliceVal added in v0.9.8

func (sv *SliceViewBase) SliceVal(idx int) any

SliceVal returns value interface at given slice index must be protected by mutex

func (*SliceViewBase) SliceViewBaseEvents added in v0.9.8

func (sv *SliceViewBase) SliceViewBaseEvents()

func (*SliceViewBase) StdCtxtMenu added in v0.9.8

func (sv *SliceViewBase) StdCtxtMenu(m *gi.Menu, idx int)

func (*SliceViewBase) Style2D added in v0.9.8

func (sv *SliceViewBase) Style2D()

func (*SliceViewBase) ToolBar added in v0.9.8

func (sv *SliceViewBase) ToolBar() *gi.ToolBar

ToolBar returns the toolbar widget

func (*SliceViewBase) UnselectAllIdxs added in v0.9.8

func (sv *SliceViewBase) UnselectAllIdxs()

UnselectAllIdxs unselects all selected idxs

func (*SliceViewBase) UnselectIdx added in v0.9.8

func (sv *SliceViewBase) UnselectIdx(idx int)

UnselectIdx unselects given idx (if selected)

func (*SliceViewBase) UnselectIdxAction added in v0.9.8

func (sv *SliceViewBase) UnselectIdxAction(idx int)

UnselectIdxAction unselects this idx (if selected) -- and emits a signal

func (*SliceViewBase) Update added in v0.9.8

func (sv *SliceViewBase) Update()

Update is the high-level update display call -- robust to any changes

func (*SliceViewBase) UpdateScroll added in v0.9.8

func (sv *SliceViewBase) UpdateScroll()

UpdateScroll updates grid scrollbar based on display

func (*SliceViewBase) UpdateSelectIdx added in v0.9.8

func (sv *SliceViewBase) UpdateSelectIdx(idx int, sel bool)

UpdateSelectIdx updates the selection for the given index

func (*SliceViewBase) UpdateSelectRow added in v0.9.8

func (sv *SliceViewBase) UpdateSelectRow(row int, sel bool)

UpdateSelectRow updates the selection for the given row callback from widgetsig select

func (*SliceViewBase) UpdateSliceGrid added in v0.9.8

func (sv *SliceViewBase) UpdateSliceGrid()

UpdateSliceGrid updates grid display -- robust to any time calling

func (*SliceViewBase) UpdateStartIdx added in v1.2.8

func (sv *SliceViewBase) UpdateStartIdx()

UpdateStartIdx updates StartIdx to fit current view

func (*SliceViewBase) UpdateValues added in v0.9.8

func (sv *SliceViewBase) UpdateValues()

UpdateValues updates the widget display of slice values, assuming same slice config

func (*SliceViewBase) UpdtSliceSize added in v0.9.8

func (sv *SliceViewBase) UpdtSliceSize() int

UpdtSliceSize updates and returns the size of the slice and sets SliceSize

func (*SliceViewBase) ViewMuLock added in v1.0.0

func (sv *SliceViewBase) ViewMuLock()

ViewMuLock locks the ViewMu if non-nil

func (*SliceViewBase) ViewMuUnlock added in v1.0.0

func (sv *SliceViewBase) ViewMuUnlock()

ViewMuUnlock Unlocks the ViewMu if non-nil

type SliceViewInline

type SliceViewInline struct {
	gi.PartsWidgetBase
	Slice        any         `desc:"the slice that we are a view onto"`
	SliceValView ValueView   `desc:"ValueView for the slice itself, if this was created within value view framework -- otherwise nil"`
	IsArray      bool        `desc:"whether the slice is actually an array -- no modifications"`
	IsFixedLen   bool        `desc:"whether the slice has a fixed-len flag on it"`
	Changed      bool        `desc:"has the slice been edited?"`
	Values       []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"`
	TmpSave      ValueView   `` /* 189-byte string literal not displayed */
	ViewSig      ki.Signal   `` /* 179-byte string literal not displayed */
	ViewPath     string      `` /* 134-byte string literal not displayed */
}

SliceViewInline represents a slice as a single line widget, for smaller slices and those explicitly marked inline -- constructs widgets in Parts to show the key names and editor vals for each value.

func (*SliceViewInline) ConfigParts

func (sv *SliceViewInline) ConfigParts()

ConfigParts configures Parts for the current slice

func (*SliceViewInline) Disconnect added in v0.9.8

func (sv *SliceViewInline) Disconnect()

func (*SliceViewInline) Render2D

func (sv *SliceViewInline) Render2D()

func (*SliceViewInline) SetChanged

func (sv *SliceViewInline) SetChanged()

SetChanged sets the Changed flag and emits the ViewSig signal for the SliceView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.

func (*SliceViewInline) SetSlice

func (sv *SliceViewInline) SetSlice(sl any)

SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice

func (*SliceViewInline) SliceNewAt

func (sv *SliceViewInline) SliceNewAt(idx int, reconfig bool)

SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end

func (*SliceViewInline) Style2D

func (sv *SliceViewInline) Style2D()

func (*SliceViewInline) UpdateFromSlice

func (sv *SliceViewInline) UpdateFromSlice()

func (*SliceViewInline) UpdateValues

func (sv *SliceViewInline) UpdateValues()

type SliceViewSignals

type SliceViewSignals int

SliceViewSignals are signals that sliceview can send, mostly for editing mode. Selection events are sent on WidgetSig WidgetSelected signals in both modes.

const (
	// SliceViewDoubleClicked emitted during inactive mode when item
	// double-clicked -- can be used for accepting dialog.
	SliceViewDoubleClicked SliceViewSignals = iota

	// SliceViewInserted emitted when a new item is inserted -- data is index of new item
	SliceViewInserted

	// SliceViewDeleted emitted when an item is deleted -- data is index of item deleted
	SliceViewDeleted

	SliceViewSignalsN
)

func (*SliceViewSignals) FromString

func (i *SliceViewSignals) FromString(s string) error

func (SliceViewSignals) String

func (i SliceViewSignals) String() string

type SliceViewStyleFunc

type SliceViewStyleFunc func(sv *SliceView, slice any, widg gi.Node2D, row int, vv ValueView)

SliceViewStyleFunc is a styling function for custom styling / configuration of elements in the view. If style properties are set then you must call widg.AsNode2dD().SetFullReRender() to trigger re-styling during re-render

type SliceViewer added in v0.9.8

type SliceViewer interface {
	// AsSliceViewBase returns the base for direct access to relevant fields etc
	AsSliceViewBase() *SliceViewBase

	// Config configures the view
	Config()

	// IsConfiged returns true if is fully configured for display
	IsConfiged() bool

	// SliceGrid returns the SliceGrid grid frame widget, which contains all the
	// fields and values
	SliceGrid() *gi.Frame

	// ScrollBar returns the SliceGrid scrollbar
	ScrollBar() *gi.ScrollBar

	// RowWidgetNs returns number of widgets per row and offset for index label
	RowWidgetNs() (nWidgPerRow, idxOff int)

	// SliceSize returns the current size of the slice and sets SliceSize
	UpdtSliceSize() int

	// LayoutSliceGrid does the proper layout of slice grid depending on allocated size
	// returns true if UpdateSliceGrid should be called after this
	LayoutSliceGrid() bool

	// UpdateSliceGrid updates grid display -- robust to any time calling
	UpdateSliceGrid()

	// SliceGridNeedsUpdate returns true when slice grid needs to be updated.
	// this should be true if the underlying size has changed, or other
	// indication that the data might have changed.
	SliceGridNeedsUpdate() bool

	// StyleRow calls a custom style function on given row (and field)
	StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv ValueView)

	// RowFirstWidget returns the first widget for given row (could be index or
	// not) -- false if out of range
	RowFirstWidget(row int) (*gi.WidgetBase, bool)

	// RowGrabFocus grabs the focus for the first focusable widget in given row --
	// returns that element or nil if not successful -- note: grid must have
	// already rendered for focus to be grabbed!
	RowGrabFocus(row int) *gi.WidgetBase

	// SelectRowWidgets sets the selection state of given row of widgets
	SelectRowWidgets(row int, sel bool)

	// SliceNewAt inserts a new blank element at given index in the slice -- -1
	// means the end
	SliceNewAt(idx int)

	// SliceDeleteAt deletes element at given index from slice
	// if updt is true, then update the grid after
	SliceDeleteAt(idx int, updt bool)

	// MimeDataType returns the data type for mime clipboard (copy / paste) data
	// e.g., filecat.DataJson
	MimeDataType() string

	// CopySelToMime copies selected rows to mime data
	CopySelToMime() mimedata.Mimes

	// PasteAssign assigns mime data (only the first one!) to this idx
	PasteAssign(md mimedata.Mimes, idx int)

	// PasteAtIdx inserts object(s) from mime data at (before) given slice index
	PasteAtIdx(md mimedata.Mimes, idx int)

	// ItemCtxtMenu pulls up the context menu for given slice index
	ItemCtxtMenu(idx int)

	// StdCtxtMenu generates the standard context menu for this view
	StdCtxtMenu(m *gi.Menu, idx int)

	// NeedsDoubleReRender returns true if initial render requires a 2nd pass
	NeedsDoubleReRender() bool
}

SliceViewer is the interface used by SliceViewBase to support any abstractions needed for different types of slice views.

type StructFieldVals added in v0.9.8

type StructFieldVals struct {
	Path  string              `desc:"path of field.field parent fields to this field"`
	Field reflect.StructField `desc:"type information for field"`
	Val   reflect.Value       `desc:"value of field (as a pointer)"`
	Defs  string              `desc:"def tag information for default values"`
}

StructFieldVals represents field values in a struct, at multiple levels of depth potentially (represented by the Path field) used for StructNonDefFields for example.

func StructNonDefFields added in v0.9.8

func StructNonDefFields(structPtr any, path string) []StructFieldVals

StructNonDefFields processses "def" tag for default value(s) of fields in given struct and starting path, and returns all fields not at their default values. See also StructNoDefFieldsStr for a string representation of this information. Uses kit.FlatFieldsValueFunc to get all embedded fields. Uses a recursive strategy -- any fields that are themselves structs are expanded, and the field name represented by dots path separators.

type StructInlineValueView

type StructInlineValueView struct {
	ValueViewBase
}

StructInlineValueView presents a StructViewInline for a struct

func (*StructInlineValueView) ConfigWidget

func (vv *StructInlineValueView) ConfigWidget(widg gi.Node2D)

func (*StructInlineValueView) UpdateWidget

func (vv *StructInlineValueView) UpdateWidget()

func (*StructInlineValueView) WidgetType

func (vv *StructInlineValueView) WidgetType() reflect.Type

type StructValueView

type StructValueView struct {
	ValueViewBase
}

StructValueView presents a button to edit the struct

func (*StructValueView) Activate

func (vv *StructValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)

func (*StructValueView) ConfigWidget

func (vv *StructValueView) ConfigWidget(widg gi.Node2D)

func (*StructValueView) HasAction

func (vv *StructValueView) HasAction() bool

func (*StructValueView) UpdateWidget

func (vv *StructValueView) UpdateWidget()

func (*StructValueView) WidgetType

func (vv *StructValueView) WidgetType() reflect.Type

type StructView

type StructView struct {
	gi.Frame
	Struct        any               `desc:"the struct that we are a view onto"`
	StructValView ValueView         `desc:"ValueView for the struct itself, if this was created within value view framework -- otherwise nil"`
	Changed       bool              `desc:"has the value of any field changed?  updated by the ViewSig signals from fields"`
	ChangeFlag    *reflect.Value    `` /* 169-byte string literal not displayed */
	FieldViews    []ValueView       `json:"-" xml:"-" desc:"ValueView representations of the fields"`
	TmpSave       ValueView         `` /* 189-byte string literal not displayed */
	ViewSig       ki.Signal         `` /* 179-byte string literal not displayed */
	ViewPath      string            `` /* 134-byte string literal not displayed */
	ToolbarStru   any               `desc:"the struct that we successfully set a toolbar for"`
	HasDefs       bool              `json:"-" xml:"-" inactive:"+" desc:"if true, some fields have default values -- update labels when values change"`
	HasViewIfs    bool              `json:"-" xml:"-" inactive:"+" desc:"if true, some fields have viewif conditional view tags -- update after.."`
	TypeFieldTags map[string]string `json:"-" xml:"-" inactive:"+" desc:"extra tags by field name -- from type properties"`
}

StructView represents a struct, creating a property editor of the fields -- constructs Children widgets to show the field names and editor fields for each field, within an overall frame. Automatically has a toolbar with Struct ToolBar props if defined set prop toolbar = false to turn off

func AddNewStructView added in v0.9.7

func AddNewStructView(parent ki.Ki, name string) *StructView

AddNewStructView adds a new structview to given parent node, with given name.

func (*StructView) Config added in v0.9.8

func (sv *StructView) Config()

Config configures the view

func (*StructView) ConfigStructGrid

func (sv *StructView) ConfigStructGrid()

ConfigStructGrid configures the StructGrid for the current struct

func (*StructView) ConfigToolbar

func (sv *StructView) ConfigToolbar()

ConfigToolbar adds a toolbar based on the methview ToolBarView function, if one has been defined for this struct type through its registered type properties.

func (*StructView) Disconnect added in v0.9.8

func (sv *StructView) Disconnect()

func (*StructView) FieldTags added in v0.9.11

func (sv *StructView) FieldTags(fld reflect.StructField) reflect.StructTag

FieldTags returns the integrated tags for this field

func (*StructView) IsConfiged added in v0.9.8

func (sv *StructView) IsConfiged() bool

IsConfiged returns true if the widget is fully configured

func (*StructView) Render2D

func (sv *StructView) Render2D()

func (*StructView) SetStruct

func (sv *StructView) SetStruct(st any)

SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct

func (*StructView) StructGrid

func (sv *StructView) StructGrid() *gi.Frame

StructGrid returns the grid layout widget, which contains all the fields and values

func (*StructView) Style2D

func (sv *StructView) Style2D()

func (*StructView) ToolBar

func (sv *StructView) ToolBar() *gi.ToolBar

ToolBar returns the toolbar widget

func (*StructView) UpdateField added in v0.9.9

func (sv *StructView) UpdateField(field string)

UpdateField updates the value-view widget for the named field

func (*StructView) UpdateFieldAction added in v1.3.10

func (sv *StructView) UpdateFieldAction()

func (*StructView) UpdateFields

func (sv *StructView) UpdateFields()

UpdateFields updates each of the value-view widgets for the fields -- called by the ViewSig update

type StructViewInline

type StructViewInline struct {
	gi.PartsWidgetBase
	Struct        any         `desc:"the struct that we are a view onto"`
	StructValView ValueView   `desc:"ValueView for the struct itself, if this was created within value view framework -- otherwise nil"`
	AddAction     bool        `` /* 135-byte string literal not displayed */
	FieldViews    []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"`
	TmpSave       ValueView   `` /* 189-byte string literal not displayed */
	ViewSig       ki.Signal   `` /* 188-byte string literal not displayed */
	ViewPath      string      `` /* 134-byte string literal not displayed */
	HasDefs       bool        `json:"-" xml:"-" view:"inactive" desc:"if true, some fields have default values -- update labels when values change"`
	HasViewIfs    bool        `json:"-" xml:"-" inactive:"+" desc:"if true, some fields have viewif conditional view tags -- update after.."`
}

StructViewInline represents a struct as a single line widget, for smaller structs and those explicitly marked inline in the kit type registry type properties -- constructs widgets in Parts to show the field names and editor fields for each field

func (*StructViewInline) ConfigParts

func (sv *StructViewInline) ConfigParts()

ConfigParts configures Parts for the current struct

func (*StructViewInline) Disconnect added in v0.9.8

func (sv *StructViewInline) Disconnect()

func (*StructViewInline) Render2D

func (sv *StructViewInline) Render2D()

func (*StructViewInline) SetStruct

func (sv *StructViewInline) SetStruct(st any)

SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct

func (*StructViewInline) UpdateFieldAction added in v1.3.10

func (sv *StructViewInline) UpdateFieldAction()

func (*StructViewInline) UpdateFields

func (sv *StructViewInline) UpdateFields()
type SubMenuFunc func(it any, vp *gi.Viewport2D) []string

SubMenuFunc is a function that returns a string slice of submenu items used in MethView submenu-func option first argument is the object on which the method is defined (receiver)

type SubSubMenuFunc added in v1.3.12

type SubSubMenuFunc func(it any, vp *gi.Viewport2D) [][]string

SubSubMenuFunc is a function that returns a slice of string slices to create submenu items each having their own submenus. used in MethView submenu-func option first argument is the object on which the method is defined (receiver)

type TableView

type TableView struct {
	SliceViewBase
	StyleFunc  TableViewStyleFunc    `copy:"-" view:"-" json:"-" xml:"-" desc:"optional styling function"`
	SelField   string                `copy:"-" view:"-" json:"-" xml:"-" desc:"current selection field -- initially select value in this field"`
	SortIdx    int                   `desc:"current sort index"`
	SortDesc   bool                  `desc:"whether current sort order is descending"`
	StruType   reflect.Type          `copy:"-" view:"-" json:"-" xml:"-" desc:"struct type for each row"`
	VisFields  []reflect.StructField `copy:"-" view:"-" json:"-" xml:"-" desc:"the visible fields"`
	NVisFields int                   `copy:"-" view:"-" json:"-" xml:"-" desc:"number of visible fields"`
}

TableView represents a slice-of-structs as a table, where the fields are the columns, within an overall frame. It has two modes, determined by Inactive flag: if Inactive, it functions as a mutually-exclusive item selector, highlighting the selected row and emitting a WidgetSig WidgetSelected signal, and TableViewDoubleClick for double clicks (can be used for closing dialogs). If !Inactive, it is a full-featured editor with multiple-selection, cut-and-paste, and drag-and-drop, reporting each action taken using the TableViewSig signals Automatically has a toolbar with Slice ToolBar props if defined set prop toolbar = false to turn off

func AddNewTableView added in v0.9.7

func AddNewTableView(parent ki.Ki, name string) *TableView

AddNewTableView adds a new tableview to given parent node, with given name.

func (*TableView) CacheVisFields

func (tv *TableView) CacheVisFields()

CacheVisFields computes the number of visible fields in nVisFields and caches those to skip in fieldSkip

func (*TableView) Config added in v0.9.8

func (tv *TableView) Config()

Config configures the view

func (*TableView) ConfigSliceGrid

func (tv *TableView) ConfigSliceGrid()

ConfigSliceGrid configures the SliceGrid for the current slice this is only called by global Config and updates are guarded by that

func (*TableView) ConfigToolbar

func (tv *TableView) ConfigToolbar()

ConfigToolbar configures the toolbar actions

func (*TableView) EditIdx added in v1.3.18

func (tv *TableView) EditIdx(idx int)

func (*TableView) GridLayout added in v0.9.8

func (tv *TableView) GridLayout() *gi.Layout

GridLayout returns the SliceGrid grid-layout widget, with grid and scrollbar

func (*TableView) IsConfiged added in v0.9.8

func (tv *TableView) IsConfiged() bool

IsConfiged returns true if the widget is fully configured

func (*TableView) Layout2D

func (tv *TableView) Layout2D(parBBox image.Rectangle, iter int) bool

func (*TableView) LayoutHeader added in v0.9.8

func (tv *TableView) LayoutHeader()

LayoutHeader updates the header layout based on field widths

func (*TableView) LayoutSliceGrid added in v0.9.8

func (tv *TableView) LayoutSliceGrid() bool

LayoutSliceGrid does the proper layout of slice grid depending on allocated size returns true if UpdateSliceGrid should be called after this

func (*TableView) RowFirstVisWidget

func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)

RowFirstVisWidget returns the first visible widget for given row (could be index or not) -- false if out of range

func (*TableView) RowGrabFocus

func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase

RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!

func (*TableView) RowWidgetNs

func (tv *TableView) RowWidgetNs() (nWidgPerRow, idxOff int)

RowWidgetNs returns number of widgets per row and offset for index label

func (*TableView) ScrollBar added in v0.9.8

func (tv *TableView) ScrollBar() *gi.ScrollBar

ScrollBar returns the SliceGrid scrollbar

func (*TableView) SelectFieldVal

func (tv *TableView) SelectFieldVal(fld, val string) bool

SelectFieldVal sets SelField and SelVal and attempts to find corresponding row, setting SelectedIdx and selecting row if found -- returns true if found, false otherwise

func (*TableView) SelectRowWidgets

func (tv *TableView) SelectRowWidgets(row int, sel bool)

SelectRowWidgets sets the selection state of given row of widgets

func (*TableView) SetSlice

func (tv *TableView) SetSlice(sl any)

SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice (does Update if already viewing).

func (*TableView) SetSortFieldName

func (tv *TableView) SetSortFieldName(nm string)

SetSortField sets sorting to happen on given field and direction -- see SortFieldName for details

func (*TableView) SliceDeleteAt added in v0.9.8

func (tv *TableView) SliceDeleteAt(idx int, doupdt bool)

SliceDeleteAt deletes element at given index from slice -- doupdt means call UpdateSliceGrid to update display

func (*TableView) SliceFrame

func (tv *TableView) SliceFrame() *gi.Frame

SliceFrame returns the outer frame widget, which contains all the header, fields and values

func (*TableView) SliceGrid

func (tv *TableView) SliceGrid() *gi.Frame

SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values, within SliceFrame

func (*TableView) SliceHeader

func (tv *TableView) SliceHeader() *gi.ToolBar

SliceHeader returns the Toolbar header for slice grid

func (*TableView) SliceNewAt

func (tv *TableView) SliceNewAt(idx int)

SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end

func (*TableView) SortFieldName

func (tv *TableView) SortFieldName() string

SortFieldName returns the name of the field being sorted, along with :up or :down depending on descending

func (*TableView) SortSlice added in v0.9.9

func (tv *TableView) SortSlice()

SortSlice sorts the slice according to current settings

func (*TableView) SortSliceAction

func (tv *TableView) SortSliceAction(fldIdx int)

SortSliceAction sorts the slice for given field index -- toggles ascending vs. descending if already sorting on this dimension

func (*TableView) StdCtxtMenu

func (tv *TableView) StdCtxtMenu(m *gi.Menu, idx int)

func (*TableView) StructType

func (tv *TableView) StructType() reflect.Type

StructType sets the StruType and returns the type of the struct within the slice -- this is a non-ptr type even if slice has pointers to structs

func (*TableView) StyleRow added in v0.9.8

func (tv *TableView) StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv ValueView)

func (*TableView) ToolBar

func (tv *TableView) ToolBar() *gi.ToolBar

ToolBar returns the toolbar widget

func (*TableView) UpdateSliceGrid added in v0.9.8

func (tv *TableView) UpdateSliceGrid()

UpdateSliceGrid updates grid display -- robust to any time calling

type TableViewStyleFunc

type TableViewStyleFunc func(tv *TableView, slice any, widg gi.Node2D, row, col int, vv ValueView)

TableViewStyleFunc is a styling function for custom styling / configuration of elements in the view. If style properties are set then you must call widg.AsNode2dD().SetFullReRender() to trigger re-styling during re-render

type TextBuf

type TextBuf struct {
	ki.Node
	Txt              []byte              `json:"-" xml:"text" desc:"the current value of the entire text being edited -- using []byte slice for greater efficiency"`
	Autosave         bool                `desc:"if true, auto-save file after changes (in a separate routine)"`
	Opts             textbuf.Opts        `desc:"options for how text editing / viewing works"`
	Filename         gi.FileName         `json:"-" xml:"-" desc:"filename of file last loaded or saved"`
	Info             FileInfo            `desc:"full info about file"`
	PiState          pi.FileStates       `desc:"Pi parsing state info for file"`
	Hi               HiMarkup            `desc:"syntax highlighting markup parameters (language, style, etc)"`
	NLines           int                 `json:"-" xml:"-" desc:"number of lines"`
	LineIcons        map[int]string      `desc:"icons for given lines -- use SetLineIcon and DeleteLineIcon"`
	LineColors       map[int]gist.Color  `desc:"special line number colors given lines -- use SetLineColor and DeleteLineColor"`
	Icons            map[string]*gi.Icon `json:"-" xml:"-" desc:"icons for each LineIcons being used"`
	Lines            [][]rune            `` /* 258-byte string literal not displayed */
	LineBytes        [][]byte            `` /* 267-byte string literal not displayed */
	Tags             []lex.Line          `json:"extra custom tagged regions for each line"`
	HiTags           []lex.Line          `json:"syntax highlighting tags -- auto-generated"`
	Markup           [][]byte            `` /* 162-byte string literal not displayed */
	MarkupEdits      []*textbuf.Edit     `json:"-" xml:"-" desc:"edits that have been made since last full markup"`
	ByteOffs         []int               `` /* 241-byte string literal not displayed */
	TotalBytes       int                 `json:"-" xml:"-" desc:"total bytes in document -- see ByteOffs for when it is updated"`
	LinesMu          sync.RWMutex        `json:"-" xml:"-" desc:"mutex for updating lines"`
	MarkupMu         sync.RWMutex        `json:"-" xml:"-" desc:"mutex for updating markup"`
	MarkupDelayTimer *time.Timer         `json:"-" xml:"-" desc:"markup delay timer"`
	MarkupDelayMu    sync.Mutex          `json:"-" xml:"-" desc:"mutex for updating markup delay timer"`
	TextBufSig       ki.Signal           `json:"-" xml:"-" view:"-" desc:"signal for buffer -- see TextBufSignals for the types"`
	Views            []*TextView         `json:"-" xml:"-" desc:"the TextViews that are currently viewing this buffer"`
	Undos            textbuf.Undo        `json:"-" xml:"-" desc:"undo manager"`
	PosHistory       []lex.Pos           `json:"-" xml:"-" desc:"history of cursor positions -- can move back through them"`
	Complete         *gi.Complete        `json:"-" xml:"-" desc:"functions and data for text completion"`
	Spell            *gi.Spell           `json:"-" xml:"-" desc:"functions and data for spelling correction"`
	CurView          *TextView           `` /* 177-byte string literal not displayed */
}

TextBuf is a buffer of text, which can be viewed by TextView(s). It holds the raw text lines (in original string and rune formats, and marked-up from syntax highlighting), and sends signals for making edits to the text and coordinating those edits across multiple views. Views always only view a single buffer, so they directly call methods on the buffer to drive updates, which are then broadcast. It also has methods for loading and saving buffers to files. Unlike GUI Widgets, its methods are generally signaling, without an explicit Action suffix. Internally, the buffer represents new lines using \n = LF, but saving and loading can deal with Windows/DOS CRLF format.

func NewTextBuf

func NewTextBuf() *TextBuf

func (*TextBuf) AddFileNode added in v0.9.5

func (tb *TextBuf) AddFileNode(fn *FileNode)

AddFileNode adds the FileNode to the list or receivers of changes to buffer

func (*TextBuf) AddTag

func (tb *TextBuf) AddTag(ln, st, ed int, tag token.Tokens)

AddTag adds a new custom tag for given line, at given position

func (*TextBuf) AddTagEdit

func (tb *TextBuf) AddTagEdit(tbe *textbuf.Edit, tag token.Tokens)

AddTagEdit adds a new custom tag for given line, using textbuf.Edit for location

func (*TextBuf) AddView

func (tb *TextBuf) AddView(vw *TextView)

AddView adds a viewer of this buffer -- connects our signals to the viewer

func (*TextBuf) AdjustPos

func (tb *TextBuf) AdjustPos(pos lex.Pos, t time.Time, del textbuf.AdjustPosDel) lex.Pos

AdjustPos adjusts given text position, which was recorded at given time for any edits that have taken place since that time (using the Undo stack). del determines what to do with positions within a deleted region -- either move to start or end of the region, or return an error

func (*TextBuf) AdjustReg

func (tb *TextBuf) AdjustReg(reg textbuf.Region) textbuf.Region

AdjustReg adjusts given text region for any edits that have taken place since time stamp on region (using the Undo stack). If region was wholly within a deleted region, then RegionNil will be returned -- otherwise it is clipped appropriately as function of deletes.

func (*TextBuf) AdjustedTags

func (tb *TextBuf) AdjustedTags(ln int) lex.Line

AdjustedTags updates tag positions for edits must be called under MarkupMu lock

func (*TextBuf) AdjustedTagsImpl added in v0.9.14

func (tb *TextBuf) AdjustedTagsImpl(tags lex.Line, ln int) lex.Line

AdjustedTagsImpl updates tag positions for edits, for given list of tags

func (*TextBuf) AppendText

func (tb *TextBuf) AppendText(text []byte, signal bool) *textbuf.Edit

AppendText appends new text to end of buffer, using insert, returns edit

func (*TextBuf) AppendTextLine

func (tb *TextBuf) AppendTextLine(text []byte, signal bool) *textbuf.Edit

AppendTextLine appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. Returns the edit region.

func (*TextBuf) AppendTextLineMarkup

func (tb *TextBuf) AppendTextLineMarkup(text []byte, markup []byte, signal bool) *textbuf.Edit

AppendTextLineMarkup appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. user-supplied markup is used. Returns the edit region.

func (*TextBuf) AppendTextMarkup

func (tb *TextBuf) AppendTextMarkup(text []byte, markup []byte, signal bool) *textbuf.Edit

AppendTextMarkup appends new text to end of buffer, using insert, returns edit, and uses supplied markup to render it

func (*TextBuf) AutoIndent

func (tb *TextBuf) AutoIndent(ln int) (tbe *textbuf.Edit, indLev, chPos int)

AutoIndent indents given line to the level of the prior line, adjusted appropriately if the current line starts with one of the given un-indent strings, or the prior line ends with one of the given indent strings. Returns any edit that took place (could be nil), along with the auto-indented level and character position for the indent of the current line.

func (*TextBuf) AutoIndentRegion

func (tb *TextBuf) AutoIndentRegion(st, ed int)

AutoIndentRegion does auto-indent over given region -- end is *exclusive*

func (*TextBuf) AutoSave

func (tb *TextBuf) AutoSave() error

AutoSave does the autosave -- safe to call in a separate goroutine

func (*TextBuf) AutoSaveCheck

func (tb *TextBuf) AutoSaveCheck() bool

AutoSaveCheck checks if an autosave file exists -- logic for dealing with it is left to larger app -- call this before opening a file

func (*TextBuf) AutoSaveDelete

func (tb *TextBuf) AutoSaveDelete()

AutoSaveDelete deletes any existing autosave file

func (*TextBuf) AutoSaveFilename

func (tb *TextBuf) AutoSaveFilename() string

AutoSaveFilename returns the autosave filename

func (*TextBuf) AutoSaveOff

func (tb *TextBuf) AutoSaveOff() bool

AutoSaveOff turns off autosave and returns the prior state of Autosave flag -- call AutoSaveRestore with rval when done -- good idea to turn autosave off for anything that does a block of updates

func (*TextBuf) AutoSaveRestore

func (tb *TextBuf) AutoSaveRestore(asv bool)

AutoSaveRestore restores prior Autosave setting, from AutoSaveOff()

func (*TextBuf) AutoScrollViews

func (tb *TextBuf) AutoScrollViews()

AutoscrollViews ensures that views are always viewing the end of the buffer

func (*TextBuf) BatchUpdateEnd

func (tb *TextBuf) BatchUpdateEnd(bufUpdt, winUpdt, autoSave bool)

BatchUpdateEnd call to complete BatchUpdateStart

func (*TextBuf) BatchUpdateStart

func (tb *TextBuf) BatchUpdateStart() (bufUpdt, winUpdt, autoSave bool)

BatchUpdateStart call this when starting a batch of updates to the buffer -- it blocks the window updates for views until all the updates are done, and calls AutoSaveOff. Calls UpdateStart on Buf too. Returns buf updt, win updt and autosave restore state. Must call BatchUpdateEnd at end with the result of this call.

func (*TextBuf) BraceMatch added in v0.9.11

func (tb *TextBuf) BraceMatch(r rune, st lex.Pos) (en lex.Pos, found bool)

BraceMatch finds the brace, bracket, or parens that is the partner of the one passed to function.

func (*TextBuf) BytesLine

func (tb *TextBuf) BytesLine(ln int) []byte

BytesLine is the concurrent-safe accessor to specific Line of LineBytes

func (*TextBuf) BytesToLines

func (tb *TextBuf) BytesToLines()

BytesToLines converts current Txt bytes into lines, and initializes markup with raw text

func (*TextBuf) ClearChanged

func (tb *TextBuf) ClearChanged()

ClearChanged marks buffer as un-changed

func (*TextBuf) Close

func (tb *TextBuf) Close(afterFun func(canceled bool)) bool

Close closes the buffer -- prompts to save if changes, and disconnects from views if afterFun is non-nil, then it is called with the status of the user action

func (*TextBuf) CommentRegion

func (tb *TextBuf) CommentRegion(st, ed int)

CommentRegion inserts comment marker on given lines -- end is *exclusive*

func (*TextBuf) CommentStart added in v0.9.4

func (tb *TextBuf) CommentStart(ln int) int

CommentStart returns the char index where the comment starts on given line, -1 if no comment

func (*TextBuf) CompleteExtend

func (tb *TextBuf) CompleteExtend(s string)

CompleteExtend inserts the extended seed at the current cursor position

func (*TextBuf) CompleteText

func (tb *TextBuf) CompleteText(s string)

CompleteText edits the text using the string chosen from the completion menu

func (*TextBuf) ConfigSupported added in v0.9.4

func (tb *TextBuf) ConfigSupported() bool

ConfigSupported configures options based on the supported language info in GoPi returns true if supported

func (*TextBuf) CorrectClear

func (tb *TextBuf) CorrectClear(s string)

CorrectClear clears the TextSpellErr tag for given word

func (*TextBuf) CorrectText

func (tb *TextBuf) CorrectText(s string)

CorrectText edits the text using the string chosen from the correction menu

func (*TextBuf) Defaults

func (tb *TextBuf) Defaults()

Defaults sets default parameters if they haven't been yet -- if Hi.Style is empty, then it considers it to not have been set

func (*TextBuf) DeleteCompleter added in v0.9.14

func (tb *TextBuf) DeleteCompleter()

func (*TextBuf) DeleteLineColor added in v0.9.11

func (tb *TextBuf) DeleteLineColor(ln int)

HasLineColor

func (*TextBuf) DeleteLineIcon added in v0.9.11

func (tb *TextBuf) DeleteLineIcon(ln int)

DeleteLineIcon deletes any icon at given line (0 starting) if ln = -1 then delete all line icons.

func (*TextBuf) DeleteSpell added in v0.9.14

func (tb *TextBuf) DeleteSpell()

DeleteSpell deletes any existing spell object

func (*TextBuf) DeleteText

func (tb *TextBuf) DeleteText(st, ed lex.Pos, signal bool) *textbuf.Edit

DeleteText is the primary method for deleting text from the buffer. It deletes region of text between start and end positions, optionally signaling views after text lines have been updated. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.

func (*TextBuf) DeleteTextImpl added in v0.9.11

func (tb *TextBuf) DeleteTextImpl(st, ed lex.Pos) *textbuf.Edit

DeleteTextImpl deletes region of text between start and end positions. Sets the timestamp on resulting textbuf.Edit to now. Must be called under LinesMu.Lock.

func (*TextBuf) DeleteTextRect added in v0.9.15

func (tb *TextBuf) DeleteTextRect(st, ed lex.Pos, signal bool) *textbuf.Edit

DeleteTextRect deletes rectangular region of text between start, end defining the upper-left and lower-right corners of a rectangle. Fails if st.Ch >= ed.Ch. Sets the timestamp on resulting textbuf.Edit to now. An Undo record is automatically saved depending on Undo.Off setting.

func (*TextBuf) DeleteTextRectImpl added in v0.9.15

func (tb *TextBuf) DeleteTextRectImpl(st, ed lex.Pos) *textbuf.Edit

DeleteTextRectImpl deletes rectangular region of text between start, end defining the upper-left and lower-right corners of a rectangle. Fails if st.Ch >= ed.Ch. Sets the timestamp on resulting textbuf.Edit to now. Must be called under LinesMu.Lock.

func (*TextBuf) DeleteView

func (tb *TextBuf) DeleteView(vw *TextView)

DeleteView removes given viewer from our buffer

func (*TextBuf) DiffBufs

func (tb *TextBuf) DiffBufs(ob *TextBuf) textbuf.Diffs

DiffBufs computes the diff between this buffer and the other buffer, reporting a sequence of operations that would convert this buffer (a) into the other buffer (b). Each operation is either an 'r' (replace), 'd' (delete), 'i' (insert) or 'e' (equal). Everything is line-based (0, offset).

func (*TextBuf) DiffBufsUnified

func (tb *TextBuf) DiffBufsUnified(ob *TextBuf, context int) []byte

DiffBufsUnified computes the diff between this buffer and the other buffer, returning a unified diff with given amount of context (default of 3 will be used if -1)

func (*TextBuf) Disconnect added in v0.9.8

func (tb *TextBuf) Disconnect()

func (*TextBuf) EditDone

func (tb *TextBuf) EditDone()

EditDone finalizes any current editing, sends signal

func (*TextBuf) EmacsUndoSave

func (tb *TextBuf) EmacsUndoSave()

EmacsUndoSave is called by TextView at end of latest set of undo commands. If EmacsUndo mode is active, saves the current UndoStack to the regular Undo stack at the end, and moves undo to the very end -- undo is a constant stream.

func (*TextBuf) EndPos

func (tb *TextBuf) EndPos() lex.Pos

EndPos returns the ending position at end of buffer

func (*TextBuf) FileModCheck

func (tb *TextBuf) FileModCheck() bool

FileModCheck checks if the underlying file has been modified since last Stat (open, save) -- if haven't yet prompted, user is prompted to ensure that this is OK. returns true if file was modified

func (*TextBuf) HasLineColor added in v0.9.14

func (tb *TextBuf) HasLineColor(ln int) bool

HasLineColor checks if given line has a line color set

func (*TextBuf) HiTagAtPos added in v0.9.13

func (tb *TextBuf) HiTagAtPos(pos lex.Pos) (*lex.Lex, int)

HiTagAtPos returns the highlighting (markup) lexical tag at given position using current Markup tags, and index, -- could be nil if none or out of range

func (*TextBuf) InComment added in v0.9.4

func (tb *TextBuf) InComment(pos lex.Pos) bool

InComment returns true if the given text position is within a commented region

func (*TextBuf) InLitString added in v0.9.13

func (tb *TextBuf) InLitString(pos lex.Pos) bool

InLitString returns true if position is in a string literal

func (*TextBuf) InTokenCode added in v0.9.14

func (tb *TextBuf) InTokenCode(pos lex.Pos) bool

InTokenCode returns true if position is in a Keyword, Name, Operator, or Punctuation. This is useful for turning off spell checking in docs

func (*TextBuf) InTokenSubCat added in v0.9.13

func (tb *TextBuf) InTokenSubCat(pos lex.Pos, subCat token.Tokens) bool

InTokenSubCat returns true if the given text position is marked with lexical type in given SubCat sub-category

func (*TextBuf) IndentLine

func (tb *TextBuf) IndentLine(ln, ind int) *textbuf.Edit

IndentLine indents line by given number of tab stops, using tabs or spaces, for given tab size (if using spaces) -- either inserts or deletes to reach target. Returns edit record for any change.

func (*TextBuf) InitialMarkup added in v0.9.11

func (tb *TextBuf) InitialMarkup()

InitialMarkup does the first-pass markup on the file

func (*TextBuf) InsertText

func (tb *TextBuf) InsertText(st lex.Pos, text []byte, signal bool) *textbuf.Edit

InsertText is the primary method for inserting text into the buffer. It inserts new text at given starting position, optionally signaling views after text has been inserted. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.

func (*TextBuf) InsertTextImpl added in v0.9.11

func (tb *TextBuf) InsertTextImpl(st lex.Pos, text []byte) *textbuf.Edit

InsertTextImpl does the raw insert of new text at given starting position, returning a new Edit with timestamp of Now. LinesMu must be locked surrounding this call.

func (*TextBuf) InsertTextRect added in v0.9.15

func (tb *TextBuf) InsertTextRect(tbe *textbuf.Edit, signal bool) *textbuf.Edit

InsertTextRect inserts a rectangle of text defined in given textbuf.Edit record, (e.g., from RegionRect or DeleteRect), optionally signaling views after text has been inserted. Returns a copy of the Edit record with an updated timestamp. An Undo record is automatically saved depending on Undo.Off setting.

func (*TextBuf) InsertTextRectImpl added in v0.9.15

func (tb *TextBuf) InsertTextRectImpl(tbe *textbuf.Edit) *textbuf.Edit

InsertTextRectImpl does the raw insert of new text at given starting position, using a Rect textbuf.Edit (e.g., from RegionRect or DeleteRect). Returns a copy of the Edit record with an updated timestamp.

func (*TextBuf) IsChanged

func (tb *TextBuf) IsChanged() bool

IsChanged indicates if the text has been changed (edited) relative to the original, since last save

func (*TextBuf) IsMarkingUp

func (tb *TextBuf) IsMarkingUp() bool

IsMarkingUp is true if the MarkupAllLines process is currently running

func (*TextBuf) IsSpellEnabled added in v0.9.14

func (tb *TextBuf) IsSpellEnabled(pos lex.Pos) bool

IsSpellEnabled returns true if spelling correction is enabled, taking into account given position in text if it is relevant for cases where it is only conditionally enabled

func (*TextBuf) IsValidLine

func (tb *TextBuf) IsValidLine(ln int) bool

IsValidLine returns true if given line is in range

func (*TextBuf) JoinParaLines added in v1.0.0

func (tb *TextBuf) JoinParaLines(stLn, edLn int)

JoinParaLines merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, within the given line regions -- edLn is *inclusive*

func (*TextBuf) LexObjPathString added in v0.9.15

func (tb *TextBuf) LexObjPathString(ln int, lx *lex.Lex) string

LexObjPathString returns the string at given lex, and including prior lex-tagged regions that include sequences of PunctSepPeriod and NameTag which are used for object paths -- used for e.g., debugger to pull out variable expressions that can be evaluated.

func (*TextBuf) LexString added in v0.9.14

func (tb *TextBuf) LexString(ln int, lx *lex.Lex) string

LexString returns the string associated with given Lex (Tag) at given line

func (*TextBuf) Line

func (tb *TextBuf) Line(ln int) []rune

Line is the concurrent-safe accessor to specific Line of Lines runes

func (*TextBuf) LineCommented added in v0.9.4

func (tb *TextBuf) LineCommented(ln int) bool

LineCommented returns true if the given line is a full-comment line (i.e., starts with a comment)

func (*TextBuf) LineLen

func (tb *TextBuf) LineLen(ln int) int

LineLen is the concurrent-safe accessor to length of specific Line of Lines runes

func (*TextBuf) LinesDeleted

func (tb *TextBuf) LinesDeleted(tbe *textbuf.Edit)

LinesDeleted deletes lines in Markup corresponding to lines deleted in Lines text. Locks and unlocks the Markup mutex, and must be called under lines mutex.

func (*TextBuf) LinesEdited

func (tb *TextBuf) LinesEdited(tbe *textbuf.Edit)

LinesEdited re-marks-up lines in edit (typically only 1). Locks and unlocks the Markup mutex. Must be called under Lines mutex lock.

func (*TextBuf) LinesInserted

func (tb *TextBuf) LinesInserted(tbe *textbuf.Edit)

LinesInserted inserts new lines in Markup corresponding to lines inserted in Lines text. Locks and unlocks the Markup mutex, and must be called under lines mutex

func (*TextBuf) LinesToBytes

func (tb *TextBuf) LinesToBytes()

LinesToBytes converts current Lines back to the Txt slice of bytes.

func (*TextBuf) LinesToBytesCopy

func (tb *TextBuf) LinesToBytesCopy() []byte

LinesToBytesCopy converts current Lines into a separate text byte copy -- e.g., for autosave or other "offline" uses of the text -- doesn't affect byte offsets etc

func (*TextBuf) MarkupAllLines

func (tb *TextBuf) MarkupAllLines(maxLines int)

MarkupAllLines does syntax highlighting markup for all lines in buffer, calling MarkupMu mutex when setting the marked-up lines with the result -- designed to be called in a separate goroutine. if maxLines > 0 then it specifies a maximum number of lines (for InitialMarkup)

func (*TextBuf) MarkupFromTags added in v0.9.4

func (tb *TextBuf) MarkupFromTags()

MarkupFromTags does syntax highlighting markup using existing HiTags without running new tagging -- for special case where tagging is under external control

func (*TextBuf) MarkupLine added in v0.9.11

func (tb *TextBuf) MarkupLine(ln int)

MarkupLine does markup on a single line

func (*TextBuf) MarkupLines

func (tb *TextBuf) MarkupLines(st, ed int) bool

MarkupLines generates markup of given range of lines. end is *inclusive* line. returns true if all lines were marked up successfully. This does NOT lock the MarkupMu mutex (done at outer loop)

func (*TextBuf) MarkupLinesLock added in v0.9.5

func (tb *TextBuf) MarkupLinesLock(st, ed int) bool

MarkupLinesLock does MarkupLines and gets the mutex lock first

func (*TextBuf) New

func (tb *TextBuf) New(nlines int)

New initializes a new buffer with n blank lines

func (*TextBuf) NumLines

func (tb *TextBuf) NumLines() int

NumLines is the concurrent-safe accessor to NLines

func (*TextBuf) Open

func (tb *TextBuf) Open(filename gi.FileName) error

Open loads text from a file into the buffer

func (*TextBuf) OpenFile

func (tb *TextBuf) OpenFile(filename gi.FileName) error

OpenFile just loads a file into the buffer -- doesn't do any markup or notification -- for temp bufs

func (*TextBuf) PatchFromBuf

func (tb *TextBuf) PatchFromBuf(ob *TextBuf, diffs textbuf.Diffs, signal bool) bool

PatchFromBuf patches (edits) this buffer using content from other buffer, according to diff operations (e.g., as generated from DiffBufs). signal determines whether each patch is signaled -- if an overall signal will be sent at the end, then that would not be necessary (typical)

func (*TextBuf) ReMarkup

func (tb *TextBuf) ReMarkup()

ReMarkup runs re-markup on text in background

func (*TextBuf) Redo

func (tb *TextBuf) Redo() *textbuf.Edit

Redo redoes next group of items on the undo stack, and returns the last record, nil if no more

func (*TextBuf) Refresh

func (tb *TextBuf) Refresh()

Refresh signals any views to refresh views

func (*TextBuf) RefreshViews

func (tb *TextBuf) RefreshViews()

RefreshViews does a refresh draw on all views

func (*TextBuf) Region

func (tb *TextBuf) Region(st, ed lex.Pos) *textbuf.Edit

Region returns a textbuf.Edit representation of text between start and end positions returns nil if not a valid region. sets the timestamp on the textbuf.Edit to now

func (*TextBuf) RegionImpl added in v0.9.11

func (tb *TextBuf) RegionImpl(st, ed lex.Pos) *textbuf.Edit

RegionImpl returns a textbuf.Edit representation of text between start and end positions. Returns nil if not a valid region. Sets the timestamp on the textbuf.Edit to now. Impl version must be called under LinesMu.RLock or Lock

func (*TextBuf) RegionRect added in v0.9.15

func (tb *TextBuf) RegionRect(st, ed lex.Pos) *textbuf.Edit

RegionRect returns a textbuf.Edit representation of text between start and end positions as a rectangle, returns nil if not a valid region. sets the timestamp on the textbuf.Edit to now

func (*TextBuf) RegionRectImpl added in v0.9.15

func (tb *TextBuf) RegionRectImpl(st, ed lex.Pos) *textbuf.Edit

RegionRectImpl returns a textbuf.Edit representation of rectangle of text between start (upper left) and end (bottom right) positions. Returns nil if not a valid region. All lines in Text are guaranteed to be of the same size, even if line had fewer chars. Sets the timestamp on the textbuf.Edit to now. Impl version must be called under LinesMu.RLock or Lock

func (*TextBuf) RemoveTag

func (tb *TextBuf) RemoveTag(pos lex.Pos, tag token.Tokens) (reg lex.Lex, ok bool)

RemoveTag removes tag (optionally only given tag if non-zero) at given position if it exists -- returns tag

func (*TextBuf) ReplaceText added in v0.9.14

func (tb *TextBuf) ReplaceText(delSt, delEd, insPos lex.Pos, insTxt string, signal, matchCase bool) *textbuf.Edit

ReplaceText does DeleteText for given region, and then InsertText at given position (typically same as delSt but not necessarily), optionally emitting a signal after the insert. if matchCase is true, then the lex.MatchCase function is called to match the case (upper / lower) of the new inserted text to that of the text being replaced. returns the textbuf.Edit for the inserted text.

func (*TextBuf) Revert

func (tb *TextBuf) Revert() bool

Revert re-opens text from current file, if filename set -- returns false if not -- uses an optimized diff-based update to preserve existing formatting -- very fast if not very different

func (*TextBuf) Save

func (tb *TextBuf) Save() error

Save saves the current text into current Filename associated with this buffer

func (*TextBuf) SaveAs

func (tb *TextBuf) SaveAs(filename gi.FileName)

SaveAs saves the current text into given file -- does an EditDone first to save edits and checks for an existing file -- if it does exist then prompts to overwrite or not.

func (*TextBuf) SaveAsFunc added in v0.9.4

func (tb *TextBuf) SaveAsFunc(filename gi.FileName, afterFunc func(canceled bool))

SaveAsFunc saves the current text into given file -- does an EditDone first to save edits and checks for an existing file -- if it does exist then prompts to overwrite or not. If afterFunc is non-nil, then it is called with the status of the user action.

func (*TextBuf) SaveFile

func (tb *TextBuf) SaveFile(filename gi.FileName) error

SaveFile writes current buffer to file, with no prompting, etc

func (*TextBuf) SavePosHistory

func (tb *TextBuf) SavePosHistory(pos lex.Pos) bool

SavePosHistory saves the cursor position in history stack of cursor positions -- tracks across views -- returns false if position was on same line as last one saved

func (*TextBuf) SaveUndo

func (tb *TextBuf) SaveUndo(tbe *textbuf.Edit)

SaveUndo saves given edit to undo stack

func (*TextBuf) Search

func (tb *TextBuf) Search(find []byte, ignoreCase, lexItems bool) (int, []textbuf.Match)

Search looks for a string (no regexp) within buffer, with given case-sensitivity, returning number of occurrences and specific match position list. column positions are in runes.

func (*TextBuf) SearchRegexp added in v1.0.2

func (tb *TextBuf) SearchRegexp(re *regexp.Regexp) (int, []textbuf.Match)

SearchRegexp looks for a string (regexp) within buffer, returning number of occurrences and specific match position list. Column positions are in runes.

func (*TextBuf) SetByteOffs

func (tb *TextBuf) SetByteOffs()

SetByteOffs sets the byte offsets for each line into the raw text

func (*TextBuf) SetChanged

func (tb *TextBuf) SetChanged()

SetChanged marks buffer as changed

func (*TextBuf) SetCompleter

func (tb *TextBuf) SetCompleter(data any, matchFun complete.MatchFunc, editFun complete.EditFunc,
	lookupFun complete.LookupFunc)

SetCompleter sets completion functions so that completions will automatically be offered as the user types

func (*TextBuf) SetHiStyle

func (tb *TextBuf) SetHiStyle(style gi.HiStyleName)

SetHiStyle sets the highlighting style -- needs to be protected by mutex

func (*TextBuf) SetInactive added in v0.9.11

func (tb *TextBuf) SetInactive(inactive bool)

SetInactive sets the buffer in an inactive state if inactive = true otherwise is in active state. Inactive = don't save Undos.

func (*TextBuf) SetLineColor added in v0.9.11

func (tb *TextBuf) SetLineColor(ln int, color string)

SetLineColor sets given color (name or hex string) at given line (0 starting)

func (*TextBuf) SetLineIcon added in v0.9.11

func (tb *TextBuf) SetLineIcon(ln int, icon string)

SetLineIcon sets given icon at given line (0 starting)

func (*TextBuf) SetSpell added in v0.9.14

func (tb *TextBuf) SetSpell()

SetSpell sets spell correct functions so that spell correct will automatically be offered as the user types

func (*TextBuf) SetText

func (tb *TextBuf) SetText(txt []byte)

SetText sets the text to given bytes

func (*TextBuf) SetTextLines added in v0.9.11

func (tb *TextBuf) SetTextLines(lns [][]byte, cpy bool)

SetTextLines sets the text to given lines of bytes if cpy is true, make a copy of bytes -- otherwise use

func (*TextBuf) SpacesToTabs added in v1.1.3

func (tb *TextBuf) SpacesToTabs(ln int)

SpacesToTabs replaces spaces with tabs in given line.

func (*TextBuf) SpacesToTabsRegion added in v1.1.3

func (tb *TextBuf) SpacesToTabsRegion(st, ed int)

SpacesToTabsRegion replaces tabs with spaces over given region -- end is *exclusive*

func (*TextBuf) SpellCheckLineErrs added in v0.9.14

func (tb *TextBuf) SpellCheckLineErrs(ln int) lex.Line

SpellCheckLineErrs runs spell check on given line, and returns Lex tags with token.TextSpellErr for any misspelled words

func (*TextBuf) SpellCheckLineTag added in v0.9.14

func (tb *TextBuf) SpellCheckLineTag(ln int)

SpellCheckLineTag runs spell check on given line, and sets Tags for any misspelled words and updates markup for that line.

func (*TextBuf) StartDelayedReMarkup added in v0.9.11

func (tb *TextBuf) StartDelayedReMarkup()

StartDelayedReMarkup starts a timer for doing markup after an interval

func (*TextBuf) Stat

func (tb *TextBuf) Stat() error

Stat gets info about the file, including highlighting language

func (*TextBuf) StopDelayedReMarkup added in v0.9.11

func (tb *TextBuf) StopDelayedReMarkup()

StopDelayedReMarkup stops timer for doing markup after an interval

func (*TextBuf) Strings added in v0.9.11

func (tb *TextBuf) Strings(addNewLn bool) []string

Strings returns the current text as []string array. If addNewLn is true, each string line has a \n appended at end.

func (*TextBuf) TabsToSpaces added in v1.0.15

func (tb *TextBuf) TabsToSpaces(ln int)

TabsToSpaces replaces tabs with spaces in given line.

func (*TextBuf) TabsToSpacesRegion added in v1.0.15

func (tb *TextBuf) TabsToSpacesRegion(st, ed int)

TabsToSpacesRegion replaces tabs with spaces over given region -- end is *exclusive*

func (*TextBuf) TagAt

func (tb *TextBuf) TagAt(pos lex.Pos) (reg lex.Lex, ok bool)

TagAt returns tag at given text position, if one exists -- returns false if not

func (*TextBuf) Text

func (tb *TextBuf) Text() []byte

Text returns the current text as a []byte array, applying all current changes -- calls EditDone and will generate that signal if there have been changes

func (*TextBuf) Undo

func (tb *TextBuf) Undo() *textbuf.Edit

Undo undoes next group of items on the undo stack

func (*TextBuf) ValidPos

func (tb *TextBuf) ValidPos(pos lex.Pos) lex.Pos

ValidPos returns a position that is in a valid range

func (*TextBuf) ViewportFromView

func (tb *TextBuf) ViewportFromView() *gi.Viewport2D

ViewportFromView returns Viewport from textview, if avail

type TextBufFlags added in v0.9.9

type TextBufFlags int

TextBufFlags extend NodeBase NodeFlags to hold TextBuf state

const (
	// TextBufAutoSaving is used in atomically safe way to protect autosaving
	TextBufAutoSaving TextBufFlags = TextBufFlags(gi.NodeFlagsN) + iota

	// TextBufMarkingUp indicates current markup operation in progress -- don't redo
	TextBufMarkingUp

	// TextBufChanged indicates if the text has been changed (edited) relative to the
	// original, since last save
	TextBufChanged

	// TextBufFileModOk have already asked about fact that file has changed since being
	// opened, user is ok
	TextBufFileModOk

	TextBufFlagsN
)

func StringToTextBufFlags added in v0.9.9

func StringToTextBufFlags(s string) (TextBufFlags, error)

func (TextBufFlags) String added in v0.9.9

func (i TextBufFlags) String() string

type TextBufList

type TextBufList struct {
	ki.Node
}

TextBufList is a list of text buffers, as a ki.Node, with buffers as children

var TextBufs TextBufList

TextBufs is the default list of TextBuf buffers for open texts

func (*TextBufList) New

func (tl *TextBufList) New() *TextBuf

New returns a new TextBuf buffer

type TextBufSignals

type TextBufSignals int64

TextBufSignals are signals that text buffer can send

const (
	// TextBufDone means that editing was completed and applied to Txt field
	// -- data is Txt bytes
	TextBufDone TextBufSignals = iota

	// TextBufNew signals that entirely new text is present -- all views
	// update -- data is Txt bytes.
	TextBufNew

	// TextBufInsert signals that some text was inserted -- data is
	// textbuf.Edit describing change -- the TextBuf always reflects the
	// current state *after* the edit.
	TextBufInsert

	// TextBufDelete signals that some text was deleted -- data is
	// textbuf.Edit describing change -- the TextBuf always reflects the
	// current state *after* the edit.
	TextBufDelete

	// TextBufMarkUpdt signals that the Markup text has been updated -- this
	// signal is typically sent from a separate goroutine so should be used
	// with a mutex
	TextBufMarkUpdt

	// TextBufClosed signals that the textbuf was closed
	TextBufClosed

	TextBufSignalsN
)

func (*TextBufSignals) FromString

func (i *TextBufSignals) FromString(s string) error

func (TextBufSignals) String

func (i TextBufSignals) String() string

type TextView

type TextView struct {
	gi.WidgetBase
	Buf                    *TextBuf                    `json:"-" xml:"-" desc:"the text buffer that we're editing"`
	Placeholder            string                      `json:"-" xml:"placeholder" desc:"text that is displayed when the field is empty, in a lower-contrast manner"`
	CursorWidth            units.Value                 `xml:"cursor-width" desc:"width of cursor -- set from cursor-width property (inherited)"`
	NLines                 int                         `` /* 135-byte string literal not displayed */
	Renders                []girl.Text                 `` /* 160-byte string literal not displayed */
	Offs                   []float32                   `json:"-" xml:"-" desc:"starting offsets for top of each line"`
	LineNoDigs             int                         `json:"-" xml:"-" desc:"number of line number digits needed"`
	LineNoOff              float32                     `json:"-" xml:"-" desc:"horizontal offset for start of text after line numbers"`
	LineNoRender           girl.Text                   `json:"-" xml:"-" desc:"render for line numbers"`
	LinesSize              image.Point                 `json:"-" xml:"-" desc:"total size of all lines as rendered"`
	RenderSz               mat32.Vec2                  `json:"-" xml:"-" desc:"size params to use in render call"`
	CursorPos              lex.Pos                     `json:"-" xml:"-" desc:"current cursor position"`
	CursorCol              int                         `` /* 179-byte string literal not displayed */
	ScrollToCursorOnRender bool                        `json:"-" xml:"-" desc:"if true, scroll screen to cursor on next render"`
	ScrollToCursorPos      lex.Pos                     `json:"-" xml:"-" desc:"cursor position to scroll to"`
	PosHistIdx             int                         `json:"-" xml:"-" desc:"current index within PosHistory"`
	SelectStart            lex.Pos                     `` /* 141-byte string literal not displayed */
	SelectReg              textbuf.Region              `json:"-" xml:"-" desc:"current selection region"`
	PrevSelectReg          textbuf.Region              `json:"-" xml:"-" desc:"previous selection region, that was actually rendered -- needed to update render"`
	Highlights             []textbuf.Region            `json:"-" xml:"-" desc:"highlighted regions, e.g., for search results"`
	Scopelights            []textbuf.Region            `json:"-" xml:"-" desc:"highlighted regions, specific to scope markers"`
	SelectMode             bool                        `json:"-" xml:"-" desc:"if true, select text as cursor moves"`
	ForceComplete          bool                        `json:"-" xml:"-" desc:"if true, complete regardless of any disqualifying reasons"`
	ISearch                ISearch                     `json:"-" xml:"-" desc:"interactive search data"`
	QReplace               QReplace                    `json:"-" xml:"-" desc:"query replace data"`
	TextViewSig            ki.Signal                   `json:"-" xml:"-" view:"-" desc:"signal for text view -- see TextViewSignals for the types"`
	LinkSig                ki.Signal                   `` /* 167-byte string literal not displayed */
	StateStyles            [TextViewStatesN]gist.Style `json:"-" xml:"-" desc:"normal style and focus style"`
	FontHeight             float32                     `json:"-" xml:"-" desc:"font height, cached during styling"`
	LineHeight             float32                     `json:"-" xml:"-" desc:"line height, cached during styling"`
	VisSize                image.Point                 `json:"-" xml:"-" desc:"height in lines and width in chars of the visible area"`
	BlinkOn                bool                        `json:"-" xml:"-" desc:"oscillates between on and off for blinking"`
	CursorMu               sync.Mutex                  `json:"-" xml:"-" view:"-" desc:"mutex protecting cursor rendering -- shared between blink and main code"`
	HasLinks               bool                        `json:"-" xml:"-" desc:"at least one of the renders has links -- determines if we set the cursor for hand movements"`
	// contains filtered or unexported fields
}

TextView is a widget for editing multiple lines of text (as compared to TextField for a single line). The View is driven by a TextBuf buffer which contains all the text, and manages all the edits, sending update signals out to the views -- multiple views can be attached to a given buffer. All updating in the TextView should be within a single goroutine -- it would require extensive protections throughout code otherwise.

var BlinkingTextView *TextView

BlinkingTextView is the text field that is blinking

func AddNewTextView added in v0.9.7

func AddNewTextView(parent ki.Ki, name string) *TextView

AddNewTextView adds a new textview to given parent node, with given name.

func AddNewTextViewLayout added in v1.2.8

func AddNewTextViewLayout(parent ki.Ki, name string) (*TextView, *gi.Layout)

AddNewTextViewLayout adds a new layout with textview to given parent node, with given name. Layout adds "-lay" suffix. Textview should always have a parent Layout to manage the scrollbars.

func TextViewDialog added in v0.9.8

func TextViewDialog(avp *gi.Viewport2D, text []byte, opts DlgOpts) *TextView

TextViewDialog opens a dialog for displaying multi-line text in a non-editable TextView -- user can copy contents to clipboard etc. there is no input from the user.

func TextViewDialogTextView added in v0.9.14

func TextViewDialogTextView(dlg *gi.Dialog) *TextView

TextViewDialogTextView returns the text view from a TextViewDialog

func (*TextView) AutoScroll

func (tv *TextView) AutoScroll(pos image.Point) bool

AutoScroll tells any parent scroll layout to scroll to do its autoscroll based on given location -- for dragging

func (*TextView) CancelComplete

func (tv *TextView) CancelComplete()

CancelComplete cancels any pending completion -- call this when new events have moved beyond any prior completion scenario

func (*TextView) CancelCorrect

func (tv *TextView) CancelCorrect()

CancelCorrect cancels any pending spell correction -- call this when new events have moved beyond any prior correction scenario

func (*TextView) CharEndPos

func (tv *TextView) CharEndPos(pos lex.Pos) mat32.Vec2

CharEndPos returns the ending (bottom right) render coords for the given position -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too)

func (*TextView) CharStartPos

func (tv *TextView) CharStartPos(pos lex.Pos) mat32.Vec2

CharStartPos returns the starting (top left) render coords for the given position -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too)

func (*TextView) Clear added in v0.9.4

func (tv *TextView) Clear()

Clear resets all the text in the buffer for this view

func (*TextView) ClearHighlights

func (tv *TextView) ClearHighlights()

ClearHighlights clears the Highlights slice of all regions

func (*TextView) ClearNeedsRefresh

func (tv *TextView) ClearNeedsRefresh()

ClearNeedsRefresh clears needs refresh flag -- atomically safe

func (*TextView) ClearScopelights added in v0.9.4

func (tv *TextView) ClearScopelights()

ClearScopelights clears the Highlights slice of all regions

func (*TextView) ClearSelected

func (tv *TextView) ClearSelected()

ClearSelected resets both the global selected flag and any current selection

func (*TextView) ConnectEvents2D

func (tv *TextView) ConnectEvents2D()

ConnectEvents2D indirectly sets connections between mouse and key events and actions

func (*TextView) ContextMenu

func (tv *TextView) ContextMenu()

ContextMenu displays the context menu with options dependent on situation

func (*TextView) ContextMenuPos

func (tv *TextView) ContextMenuPos() (pos image.Point)

ContextMenuPos returns the position of the context menu

func (*TextView) Copy

func (tv *TextView) Copy(reset bool) *textbuf.Edit

Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection

func (*TextView) CopyRect added in v0.9.15

func (tv *TextView) CopyRect(reset bool) *textbuf.Edit

CopyRect copies any selected text to the clipboard, and returns that text, optionally resetting the current selection

func (*TextView) CursorBBox

func (tv *TextView) CursorBBox(pos lex.Pos) image.Rectangle

CursorBBox returns a bounding-box for a cursor at given position

func (*TextView) CursorBackspace

func (tv *TextView) CursorBackspace(steps int)

CursorBackspace deletes character(s) immediately before cursor

func (*TextView) CursorBackspaceWord

func (tv *TextView) CursorBackspaceWord(steps int)

CursorBackspaceWord deletes words(s) immediately before cursor

func (*TextView) CursorBackward

func (tv *TextView) CursorBackward(steps int)

CursorBackward moves the cursor backward

func (*TextView) CursorBackwardWord

func (tv *TextView) CursorBackwardWord(steps int)

CursorBackwardWord moves the cursor backward by words

func (*TextView) CursorDelete

func (tv *TextView) CursorDelete(steps int)

CursorDelete deletes character(s) immediately after the cursor

func (*TextView) CursorDeleteWord

func (tv *TextView) CursorDeleteWord(steps int)

CursorDeleteWord deletes word(s) immediately after the cursor

func (*TextView) CursorDown

func (tv *TextView) CursorDown(steps int)

CursorDown moves the cursor down line(s)

func (*TextView) CursorEndDoc

func (tv *TextView) CursorEndDoc()

CursorEndDoc moves the cursor to the end of the text, updating selection if select mode is active

func (*TextView) CursorEndLine

func (tv *TextView) CursorEndLine()

CursorEndLine moves the cursor to the end of the text

func (*TextView) CursorForward

func (tv *TextView) CursorForward(steps int)

CursorForward moves the cursor forward

func (*TextView) CursorForwardWord

func (tv *TextView) CursorForwardWord(steps int)

CursorForwardWord moves the cursor forward by words

func (*TextView) CursorKill

func (tv *TextView) CursorKill()

CursorKill deletes text from cursor to end of text

func (*TextView) CursorMovedSig

func (tv *TextView) CursorMovedSig()

CursorMovedSig sends the signal that cursor has moved

func (tv *TextView) CursorNextLink(wraparound bool) bool

CursorNextLink moves cursor to next link. wraparound wraps around to top of buffer if none found -- returns true if found

func (*TextView) CursorPageDown

func (tv *TextView) CursorPageDown(steps int)

CursorPageDown moves the cursor down page(s), where a page is defined abcdef dynamically as just moving the cursor off the screen

func (*TextView) CursorPageUp

func (tv *TextView) CursorPageUp(steps int)

CursorPageUp moves the cursor up page(s), where a page is defined dynamically as just moving the cursor off the screen

func (tv *TextView) CursorPrevLink(wraparound bool) bool

CursorPrevLink moves cursor to previous link. wraparound wraps around to bottom of buffer if none found. returns true if found

func (*TextView) CursorRecenter

func (tv *TextView) CursorRecenter()

CursorRecenter re-centers the view around the cursor position, toggling between putting cursor in middle, top, and bottom of view

func (*TextView) CursorSelect

func (tv *TextView) CursorSelect(org lex.Pos)

CursorSelect updates selection based on cursor movements, given starting cursor position and tv.CursorPos is current

func (*TextView) CursorSprite

func (tv *TextView) CursorSprite() *gi.Sprite

CursorSprite returns the sprite for the cursor, which is only rendered once with a vertical bar, and just activated and inactivated depending on render status.

func (*TextView) CursorSpriteName added in v0.9.11

func (tv *TextView) CursorSpriteName() string

CursorSpriteName returns the name of the cursor sprite

func (*TextView) CursorStartDoc

func (tv *TextView) CursorStartDoc()

CursorStartDoc moves the cursor to the start of the text, updating selection if select mode is active

func (*TextView) CursorStartLine

func (tv *TextView) CursorStartLine()

CursorStartLine moves the cursor to the start of the line, updating selection if select mode is active

func (*TextView) CursorToHistNext

func (tv *TextView) CursorToHistNext() bool

CursorToHistNext moves cursor to previous position on history list -- returns true if moved

func (*TextView) CursorToHistPrev

func (tv *TextView) CursorToHistPrev() bool

CursorToHistPrev moves cursor to previous position on history list -- returns true if moved

func (*TextView) CursorTranspose added in v0.9.15

func (tv *TextView) CursorTranspose()

CursorTranspose swaps the character at the cursor with the one before it

func (*TextView) CursorTransposeWord added in v0.9.15

func (tv *TextView) CursorTransposeWord()

CursorTranspose swaps the word at the cursor with the one before it

func (*TextView) CursorUp

func (tv *TextView) CursorUp(steps int)

CursorUp moves the cursor up line(s)

func (*TextView) Cut

func (tv *TextView) Cut() *textbuf.Edit

Cut cuts any selected text and adds it to the clipboard, also returns cut text

func (*TextView) CutRect added in v0.9.15

func (tv *TextView) CutRect() *textbuf.Edit

CutRect cuts rectangle defined by selected text (upper left to lower right) and adds it to the clipboard, also returns cut text.

func (*TextView) DeleteSelection

func (tv *TextView) DeleteSelection() *textbuf.Edit

DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted as textbuf.Edit (nil if none)

func (*TextView) Disconnect added in v0.9.8

func (tv *TextView) Disconnect()

func (*TextView) EditDone

func (tv *TextView) EditDone()

EditDone completes editing and copies the active edited text to the text -- called when the return key is pressed or goes out of focus

func (*TextView) EscPressed

func (tv *TextView) EscPressed()

EscPressed emitted for KeyFunAbort or KeyFunCancelSelect -- effect depends on state..

func (*TextView) FindMatches

func (tv *TextView) FindMatches(find string, useCase, lexItems bool) ([]textbuf.Match, bool)

FindMatches finds the matches with given search string (literal, not regex) and case sensitivity, updates highlights for all. returns false if none found

func (tv *TextView) FindNextLink(pos lex.Pos) (lex.Pos, textbuf.Region, bool)

FindNextLink finds next link after given position, returns false if no such links

func (tv *TextView) FindPrevLink(pos lex.Pos) (lex.Pos, textbuf.Region, bool)

FindPrevLink finds previous link before given position, returns false if no such links

func (*TextView) FirstVisibleLine

func (tv *TextView) FirstVisibleLine(stln int) int

FirstVisibleLine finds the first visible line, starting at given line (typically cursor -- if zero, a visible line is first found) -- returns stln if nothing found above it.

func (*TextView) FocusChanged2D

func (tv *TextView) FocusChanged2D(change gi.FocusChanges)

FocusChanged2D appropriate actions for various types of focus changes

func (*TextView) HasLineNos

func (tv *TextView) HasLineNos() bool

HasLineNos returns true if view is showing line numbers (per textbuf option, cached here)

func (*TextView) HasSelection

func (tv *TextView) HasSelection() bool

HasSelection returns whether there is a selected region of text

func (*TextView) HiStyle

func (tv *TextView) HiStyle()

HiStyle applies the highlighting styles from buffer markup style

func (*TextView) HighlightRegion

func (tv *TextView) HighlightRegion(reg textbuf.Region)

HighlightRegion creates a new highlighted region, and renders it, un-drawing any prior highlights

func (*TextView) ISearchBackspace

func (tv *TextView) ISearchBackspace()

ISearchBackspace gets rid of one item in search string

func (*TextView) ISearchCancel

func (tv *TextView) ISearchCancel()

ISearchCancel cancels ISearch mode

func (*TextView) ISearchKeyInput

func (tv *TextView) ISearchKeyInput(kt *key.ChordEvent)

ISearchKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode

func (*TextView) ISearchMatches

func (tv *TextView) ISearchMatches() bool

ISearchMatches finds ISearch matches -- returns true if there are any

func (*TextView) ISearchNextMatch

func (tv *TextView) ISearchNextMatch(cpos lex.Pos) bool

ISearchNextMatch finds next match after given cursor position, and highlights it, etc

func (*TextView) ISearchSelectMatch

func (tv *TextView) ISearchSelectMatch(midx int)

ISearchSelectMatch selects match at given match index (e.g., tv.ISearch.Pos)

func (*TextView) ISearchSig

func (tv *TextView) ISearchSig()

ISearchSig sends the signal that ISearch is updated

func (*TextView) ISearchStart

func (tv *TextView) ISearchStart()

ISearchStart is an emacs-style interactive search mode -- this is called when the search command itself is entered

func (*TextView) ISpellKeyInput added in v0.9.4

func (tv *TextView) ISpellKeyInput(kt *key.ChordEvent)

ISpellKeyInput locates the word to spell check based on cursor position and the key input, then passes the text region to SpellCheck

func (*TextView) Init2D

func (tv *TextView) Init2D()

Init2D calls Init on widget

func (*TextView) InsertAtCursor

func (tv *TextView) InsertAtCursor(txt []byte)

InsertAtCursor inserts given text at current cursor position

func (*TextView) IsChanged

func (tv *TextView) IsChanged() bool

IsChanged returns true if buffer was changed (edited)

func (*TextView) IsFocusActive

func (tv *TextView) IsFocusActive() bool

IsFocusActive returns true if we have active focus for keyboard input

func (*TextView) IsWordEnd

func (tv *TextView) IsWordEnd(tp lex.Pos) bool

IsWordEnd returns true if the cursor is just past the last letter of a word word is a string of characters none of which are classified as a word break

func (*TextView) IsWordMiddle

func (tv *TextView) IsWordMiddle(tp lex.Pos) bool

IsWordMiddle - returns true if the cursor is anywhere inside a word, i.e. the character before the cursor and the one after the cursor are not classified as word break characters

func (*TextView) IsWordStart

func (tv *TextView) IsWordStart(tp lex.Pos) bool

IsWordStart returns true if the cursor is just before the start of a word word is a string of characters none of which are classified as a word break

func (*TextView) JumpToLine

func (tv *TextView) JumpToLine(ln int)

JumpToLine jumps to given line number (minus 1)

func (*TextView) JumpToLinePrompt

func (tv *TextView) JumpToLinePrompt()

JumpToLinePrompt jumps to given line number (minus 1) from prompt

func (*TextView) KeyInput

func (tv *TextView) KeyInput(kt *key.ChordEvent)

KeyInput handles keyboard input into the text field and from the completion menu

func (*TextView) KeyInputInsertBra added in v0.9.15

func (tv *TextView) KeyInputInsertBra(kt *key.ChordEvent)

KeyInputInsertBra handle input of opening bracket-like entity (paren, brace, bracket)

func (*TextView) KeyInputInsertRune added in v0.9.4

func (tv *TextView) KeyInputInsertRune(kt *key.ChordEvent)

KeyInputInsertRune handles the insertion of a typed character

func (*TextView) LastVisibleLine

func (tv *TextView) LastVisibleLine(stln int) int

LastVisibleLine finds the last visible line, starting at given line (typically cursor) -- returns stln if nothing found beyond it.

func (*TextView) Layout2D

func (tv *TextView) Layout2D(parBBox image.Rectangle, iter int) bool

Layout2Dn

func (*TextView) LayoutAllLines

func (tv *TextView) LayoutAllLines(inLayout bool) bool

LayoutAllLines generates TextRenders of lines from our TextBuf, from the Markup version of the source, and returns whether the current rendered size is different from what it was previously

func (*TextView) LayoutLines

func (tv *TextView) LayoutLines(st, ed int, isDel bool) bool

LayoutLines generates render of given range of lines (including highlighting). end is *inclusive* line. isDel means this is a delete and thus offsets for all higher lines need to be recomputed. returns true if overall number of effective lines (e.g., from word-wrap) is now different than before, and thus a full re-render is needed.

func (*TextView) LinesDeleted

func (tv *TextView) LinesDeleted(tbe *textbuf.Edit)

LinesDeleted deletes lines of text and reformats remaining one

func (*TextView) LinesInserted

func (tv *TextView) LinesInserted(tbe *textbuf.Edit)

LinesInserted inserts new lines of text and reformats them

func (*TextView) LinkAt

func (tv *TextView) LinkAt(pos lex.Pos) (*girl.TextLink, bool)

LinkAt returns link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise

func (*TextView) Lookup added in v0.9.11

func (tv *TextView) Lookup()

Lookup attempts to lookup symbol at current location, popping up a window if something is found

func (*TextView) MakeContextMenu

func (tv *TextView) MakeContextMenu(m *gi.Menu)

MakeContextMenu builds the textview context menu

func (*TextView) MatchFromPos

func (tv *TextView) MatchFromPos(matches []textbuf.Match, cpos lex.Pos) (int, bool)

MatchFromPos finds the match at or after the given text position -- returns 0, false if none

func (*TextView) MouseDragEvent added in v0.9.11

func (tv *TextView) MouseDragEvent()

func (*TextView) MouseEvent

func (tv *TextView) MouseEvent(me *mouse.Event)

MouseEvent handles the mouse.Event

func (*TextView) MouseFocusEvent added in v0.9.11

func (tv *TextView) MouseFocusEvent()

func (*TextView) MouseMoveEvent

func (tv *TextView) MouseMoveEvent()

MouseMoveEvent

func (*TextView) NeedsRefresh

func (tv *TextView) NeedsRefresh() bool

NeedsRefresh checks if a refresh is required -- atomically safe for other routines to set the NeedsRefresh flag

func (*TextView) OfferComplete

func (tv *TextView) OfferComplete()

OfferComplete pops up a menu of possible completions

func (*TextView) OfferCorrect

func (tv *TextView) OfferCorrect() bool

OfferCorrect pops up a menu of possible spelling corrections for word at current CursorPos -- if no misspelling there or not in spellcorrect mode returns false

func (tv *TextView) OpenLink(tl *girl.TextLink)

OpenLink opens given link, either by sending LinkSig signal if there are receivers, or by calling the TextLinkHandler if non-nil, or URLHandler if non-nil (which by default opens user's default browser via oswin/App.OpenURL())

func (*TextView) OpenLinkAt

func (tv *TextView) OpenLinkAt(pos lex.Pos) (*girl.TextLink, bool)

OpenLinkAt opens a link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise -- highlights selected link

func (*TextView) ParentLayout

func (tv *TextView) ParentLayout() *gi.Layout

ParentLayout returns our parent layout -- we ensure this is our immediate parent which is necessary for textview

func (*TextView) Paste

func (tv *TextView) Paste()

Paste inserts text from the clipboard at current cursor position

func (*TextView) PasteHist

func (tv *TextView) PasteHist()

PasteHist presents a chooser of clip history items, pastes into text if selected

func (*TextView) PasteRect added in v0.9.15

func (tv *TextView) PasteRect()

PasteRect inserts text from the clipboard at current cursor position

func (*TextView) PixelToCursor

func (tv *TextView) PixelToCursor(pt image.Point) lex.Pos

PixelToCursor finds the cursor position that corresponds to the given pixel location (e.g., from mouse click) which has had WinBBox.Min subtracted from it (i.e, relative to upper left of text area)

func (*TextView) QReplaceCancel

func (tv *TextView) QReplaceCancel()

QReplaceCancel cancels QReplace mode

func (*TextView) QReplaceKeyInput

func (tv *TextView) QReplaceKeyInput(kt *key.ChordEvent)

QReplaceKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode

func (*TextView) QReplaceMatches

func (tv *TextView) QReplaceMatches() bool

QReplaceMatches finds QReplace matches -- returns true if there are any

func (*TextView) QReplaceNextMatch

func (tv *TextView) QReplaceNextMatch() bool

QReplaceNextMatch finds next match using, QReplace.Pos and highlights it, etc

func (*TextView) QReplacePrompt

func (tv *TextView) QReplacePrompt()

QReplacePrompt is an emacs-style query-replace mode -- this starts the process, prompting user for items to search etc

func (*TextView) QReplaceReplace

func (tv *TextView) QReplaceReplace(midx int)

QReplaceReplace replaces at given match index (e.g., tv.QReplace.Pos)

func (*TextView) QReplaceReplaceAll

func (tv *TextView) QReplaceReplaceAll(midx int)

QReplaceReplaceAll replaces all remaining from index

func (*TextView) QReplaceSelectMatch

func (tv *TextView) QReplaceSelectMatch(midx int)

QReplaceSelectMatch selects match at given match index (e.g., tv.QReplace.Pos)

func (*TextView) QReplaceSig

func (tv *TextView) QReplaceSig()

QReplaceSig sends the signal that QReplace is updated

func (*TextView) QReplaceStart

func (tv *TextView) QReplaceStart(find, repl string, lexItems bool)

QReplaceStart starts query-replace using given find, replace strings

func (*TextView) ReCaseSelection added in v0.9.15

func (tv *TextView) ReCaseSelection(c textbuf.Cases) string

ReCaseSelection changes the case of the currently-selected text. Returns the new text -- empty if nothing selected.

func (*TextView) ReMarkup

func (tv *TextView) ReMarkup()

Remarkup triggers a complete re-markup of the entire text -- can do this when needed if the markup gets off due to multi-line formatting issues -- via Recenter key

func (*TextView) Redo

func (tv *TextView) Redo()

Redo redoes previously undone action

func (*TextView) Refresh

func (tv *TextView) Refresh()

Refresh re-displays everything anew from the buffer

func (*TextView) RefreshIfNeeded

func (tv *TextView) RefreshIfNeeded() bool

RefreshIfNeeded re-displays everything if SetNeedsRefresh was called -- returns true if refreshed

func (*TextView) Render2D

func (tv *TextView) Render2D()

Render2D does some preliminary work and then calls render on children

func (*TextView) RenderAllLines

func (tv *TextView) RenderAllLines()

RenderAllLines displays all the visible lines on the screen -- this is called outside of update process and has its own bounds check and updating

func (*TextView) RenderAllLinesInBounds

func (tv *TextView) RenderAllLinesInBounds()

RenderAllLinesInBounds displays all the visible lines on the screen -- after PushBounds has already been called

func (*TextView) RenderCursor

func (tv *TextView) RenderCursor(on bool)

RenderCursor renders the cursor on or off, as a sprite that is either on or off

func (*TextView) RenderDepthBg added in v0.9.4

func (tv *TextView) RenderDepthBg(stln, edln int)

RenderDepthBg renders the depth background color

func (*TextView) RenderHighlights

func (tv *TextView) RenderHighlights(stln, edln int)

RenderHighlights renders the highlight regions as a highlighted background color -- always called within context of outer RenderLines or RenderAllLines

func (*TextView) RenderLineNo

func (tv *TextView) RenderLineNo(ln int, defFill bool, vpUpload bool)

RenderLineNo renders given line number -- called within context of other render if defFill is true, it fills box color for default background color (use false for batch mode) and if vpUpload is true it uploads the rendered region to viewport directly (only if totally separate from other updates)

func (*TextView) RenderLineNosBox

func (tv *TextView) RenderLineNosBox(st, ed int)

RenderLineNosBox renders the background for the line numbers in given range, in a darker shade

func (*TextView) RenderLineNosBoxAll

func (tv *TextView) RenderLineNosBoxAll()

RenderLineNosBoxAll renders the background for the line numbers in a darker shade

func (*TextView) RenderLines

func (tv *TextView) RenderLines(st, ed int) bool

RenderLines displays a specific range of lines on the screen, also painting selection. end is *inclusive* line. returns false if nothing visible.

func (*TextView) RenderRegionBox

func (tv *TextView) RenderRegionBox(reg textbuf.Region, state TextViewStates)

RenderRegionBox renders a region in background color according to given state style

func (*TextView) RenderRegionBoxSty added in v0.9.4

func (tv *TextView) RenderRegionBoxSty(reg textbuf.Region, sty *gist.Style, bgclr *gist.ColorSpec)

RenderRegionBoxSty renders a region in given style and background color

func (*TextView) RenderRegionToEnd added in v0.9.4

func (tv *TextView) RenderRegionToEnd(st lex.Pos, sty *gist.Style, bgclr *gist.ColorSpec)

RenderRegionToEnd renders a region in given style and background color, to end of line from start

func (*TextView) RenderScopelights added in v0.9.4

func (tv *TextView) RenderScopelights(stln, edln int)

RenderScopelights renders a highlight background color for regions in the Scopelights list -- always called within context of outer RenderLines or RenderAllLines

func (*TextView) RenderScrolls

func (tv *TextView) RenderScrolls()

RenderScrolls renders scrollbars if needed

func (*TextView) RenderSelect

func (tv *TextView) RenderSelect()

RenderSelect renders the selection region as a selected background color -- always called within context of outer RenderLines or RenderAllLines

func (*TextView) RenderSelectLines

func (tv *TextView) RenderSelectLines()

RenderSelectLines renders the lines within the current selection region

func (*TextView) RenderSize

func (tv *TextView) RenderSize() mat32.Vec2

RenderSize is the size we should pass to text rendering, based on alloc

func (*TextView) RenderStartPos

func (tv *TextView) RenderStartPos() mat32.Vec2

RenderStartPos is absolute rendering start position from our allocpos

func (*TextView) ResetState

func (tv *TextView) ResetState()

ResetState resets all the random state variables, when opening a new buffer etc

func (*TextView) ResizeIfNeeded

func (tv *TextView) ResizeIfNeeded(nwSz image.Point) bool

ResizeIfNeeded resizes the edit area if different from current setting -- returns true if resizing was performed

func (*TextView) SavePosHistory

func (tv *TextView) SavePosHistory(pos lex.Pos)

SavePosHistory saves the cursor position in history stack of cursor positions

func (*TextView) ScrollCursorInView

func (tv *TextView) ScrollCursorInView() bool

ScrollCursorInView tells any parent scroll layout to scroll to get cursor in view -- returns true if scrolled

func (*TextView) ScrollCursorToBottom

func (tv *TextView) ScrollCursorToBottom() bool

ScrollCursorToBottom tells any parent scroll layout to scroll to get cursor at bottom of view to extent possible -- returns true if scrolled.

func (*TextView) ScrollCursorToCenterIfHidden

func (tv *TextView) ScrollCursorToCenterIfHidden() bool

ScrollCursorToCenterIfHidden checks if the cursor is not visible, and if so, scrolls to the center, along both dimensions.

func (*TextView) ScrollCursorToHorizCenter

func (tv *TextView) ScrollCursorToHorizCenter() bool

ScrollCursorToHorizCenter tells any parent scroll layout to scroll to get cursor at horiz center of view to extent possible -- returns true if scrolled.

func (*TextView) ScrollCursorToLeft

func (tv *TextView) ScrollCursorToLeft() bool

ScrollCursorToLeft tells any parent scroll layout to scroll to get cursor at left of view to extent possible -- returns true if scrolled.

func (*TextView) ScrollCursorToRight

func (tv *TextView) ScrollCursorToRight() bool

ScrollCursorToRight tells any parent scroll layout to scroll to get cursor at right of view to extent possible -- returns true if scrolled.

func (*TextView) ScrollCursorToTop

func (tv *TextView) ScrollCursorToTop() bool

ScrollCursorToTop tells any parent scroll layout to scroll to get cursor at top of view to extent possible -- returns true if scrolled.

func (*TextView) ScrollCursorToVertCenter

func (tv *TextView) ScrollCursorToVertCenter() bool

ScrollCursorToVertCenter tells any parent scroll layout to scroll to get cursor at vert center of view to extent possible -- returns true if scrolled.

func (*TextView) ScrollInView

func (tv *TextView) ScrollInView(bbox image.Rectangle) bool

ScrollInView tells any parent scroll layout to scroll to get given box (e.g., cursor BBox) in view -- returns true if scrolled

func (*TextView) ScrollToBottom

func (tv *TextView) ScrollToBottom(pos int) bool

ScrollToBottom tells any parent scroll layout to scroll to get given vertical coordinate at bottom of view to extent possible -- returns true if scrolled

func (*TextView) ScrollToHorizCenter

func (tv *TextView) ScrollToHorizCenter(pos int) bool

ScrollToHorizCenter tells any parent scroll layout to scroll to get given horizontal coordinate to center of view to extent possible -- returns true if scrolled

func (*TextView) ScrollToLeft

func (tv *TextView) ScrollToLeft(pos int) bool

ScrollToLeft tells any parent scroll layout to scroll to get given horizontal coordinate at left of view to extent possible -- returns true if scrolled

func (*TextView) ScrollToRight

func (tv *TextView) ScrollToRight(pos int) bool

ScrollToRight tells any parent scroll layout to scroll to get given horizontal coordinate at right of view to extent possible -- returns true if scrolled

func (*TextView) ScrollToTop

func (tv *TextView) ScrollToTop(pos int) bool

ScrollToTop tells any parent scroll layout to scroll to get given vertical coordinate at top of view to extent possible -- returns true if scrolled

func (*TextView) ScrollToVertCenter

func (tv *TextView) ScrollToVertCenter(pos int) bool

ScrollToVertCenter tells any parent scroll layout to scroll to get given vertical coordinate to center of view to extent possible -- returns true if scrolled

func (*TextView) SelectAll

func (tv *TextView) SelectAll()

SelectAll selects all the text

func (*TextView) SelectModeToggle

func (tv *TextView) SelectModeToggle()

SelectModeToggle toggles the SelectMode, updating selection with cursor movement

func (*TextView) SelectRegUpdate

func (tv *TextView) SelectRegUpdate(pos lex.Pos)

SelectRegUpdate updates current select region based on given cursor position relative to SelectStart position

func (*TextView) SelectReset

func (tv *TextView) SelectReset()

SelectReset resets the selection

func (*TextView) SelectWord

func (tv *TextView) SelectWord() bool

SelectWord selects the word (whitespace, punctuation delimited) that the cursor is on returns true if word selected

func (*TextView) Selection

func (tv *TextView) Selection() *textbuf.Edit

Selection returns the currently selected text as a textbuf.Edit, which captures start, end, and full lines in between -- nil if no selection

func (*TextView) SetBuf

func (tv *TextView) SetBuf(buf *TextBuf)

SetBuf sets the TextBuf that this is a view of, and interconnects their signals

func (*TextView) SetCursor

func (tv *TextView) SetCursor(pos lex.Pos)

SetCursor sets a new cursor position, enforcing it in range

func (*TextView) SetCursorCol

func (tv *TextView) SetCursorCol(pos lex.Pos)

SetCursorCol sets the current target cursor column (CursorCol) to that of the given position

func (*TextView) SetCursorFromMouse

func (tv *TextView) SetCursorFromMouse(pt image.Point, newPos lex.Pos, selMode mouse.SelectModes)

SetCursorFromMouse sets cursor position from mouse mouse action -- handles the selection updating etc.

func (*TextView) SetCursorShow

func (tv *TextView) SetCursorShow(pos lex.Pos)

SetCursorShow sets a new cursor position, enforcing it in range, and shows the cursor (scroll to if hidden, render)

func (*TextView) SetNeedsRefresh

func (tv *TextView) SetNeedsRefresh()

SetNeedsRefresh flags that a refresh is required -- atomically safe for other routines to call this

func (*TextView) SetSize

func (tv *TextView) SetSize() bool

SetSize updates our size only if larger than our allocation

func (*TextView) ShiftSelect

func (tv *TextView) ShiftSelect(kt *key.ChordEvent)

ShiftSelect sets the selection start if the shift key is down but wasn't on the last key move. If the shift key has been released the select region is set to textbuf.RegionNil

func (*TextView) ShiftSelectExtend added in v0.9.4

func (tv *TextView) ShiftSelectExtend(kt *key.ChordEvent)

ShiftSelectExtend updates the select region if the shift key is down and renders the selected text. If the shift key is not down the previously selected text is rerendered to clear the highlight

func (*TextView) Size2D

func (tv *TextView) Size2D(iter int)

Size2D

func (*TextView) SpellCheck

func (tv *TextView) SpellCheck(reg *textbuf.Edit) bool

SpellCheck offers spelling corrections if we are at a word break or other word termination and the word before the break is unknown -- returns true if misspelled word found

func (*TextView) StartCursor

func (tv *TextView) StartCursor()

StartCursor starts the cursor blinking and renders it

func (*TextView) StopCursor

func (tv *TextView) StopCursor()

StopCursor stops the cursor from blinking

func (*TextView) Style2D

func (tv *TextView) Style2D()

Style2D calls StyleTextView and sets the style

func (*TextView) StyleTextView

func (tv *TextView) StyleTextView()

StyleTextView sets the style of widget

func (*TextView) TextViewEvents

func (tv *TextView) TextViewEvents()

TextViewEvents sets connections between mouse and key events and actions

func (*TextView) Undo

func (tv *TextView) Undo()

Undo undoes previous action

func (*TextView) UpdateHighlights

func (tv *TextView) UpdateHighlights(prev []textbuf.Region)

UpdateHighlights re-renders lines from previous highlights and current highlights -- assumed to be within a window update block

func (*TextView) ValidateCursor

func (tv *TextView) ValidateCursor()

ValidateCursor sets current cursor to a valid cursor position

func (*TextView) VisSizes

func (tv *TextView) VisSizes()

VisSizes computes the visible size of view given current parameters

func (*TextView) WordAt added in v0.9.4

func (tv *TextView) WordAt() (reg textbuf.Region)

WordAt finds the region of the word at the current cursor position

func (*TextView) WordBefore

func (tv *TextView) WordBefore(tp lex.Pos) *textbuf.Edit

WordBefore returns the word before the lex.Pos uses IsWordBreak to determine the bounds of the word

func (*TextView) WrappedLineNo

func (tv *TextView) WrappedLineNo(pos lex.Pos) (si, ri int, ok bool)

WrappedLineNo returns the wrapped line number (span index) and rune index within that span of the given character position within line in position, and false if out of range (last valid position returned in that case -- still usable).

func (*TextView) WrappedLines

func (tv *TextView) WrappedLines(ln int) int

WrappedLines returns the number of wrapped lines (spans) for given line number

type TextViewFlags added in v0.9.9

type TextViewFlags int

TextViewFlags extend NodeBase NodeFlags to hold TextView state

const (
	// TextViewNeedsRefresh indicates when refresh is required
	TextViewNeedsRefresh TextViewFlags = TextViewFlags(gi.NodeFlagsN) + iota

	// TextViewInReLayout indicates that we are currently resizing ourselves via parent layout
	TextViewInReLayout

	// TextViewRenderScrolls indicates that parent layout scrollbars need to be re-rendered at next rerender
	TextViewRenderScrolls

	// TextViewFocusActive is set if the keyboard focus is active -- when we lose active focus we apply changes
	TextViewFocusActive

	// TextViewHasLineNos indicates that this view has line numbers (per TextBuf option)
	TextViewHasLineNos

	// TextViewLastWasTabAI indicates that last key was a Tab auto-indent
	TextViewLastWasTabAI

	// TextViewLastWasUndo indicates that last key was an undo
	TextViewLastWasUndo

	TextViewFlagsN
)

func StringToTextViewFlags added in v0.9.9

func StringToTextViewFlags(s string) (TextViewFlags, error)

func (TextViewFlags) String added in v0.9.9

func (i TextViewFlags) String() string

type TextViewSignals

type TextViewSignals int64

TextViewSignals are signals that text view can send

const (
	// TextViewDone signal indicates return was pressed and an edit was completed -- data is the text
	TextViewDone TextViewSignals = iota

	// TextViewSelected signal indicates some text was selected (for Inactive state, selection is via WidgetSig)
	TextViewSelected

	// TextViewCursorMoved signal indicates cursor moved emitted for every cursor movement -- e.g., for displaying cursor pos
	TextViewCursorMoved

	// TextViewISearch is emitted for every update of interactive search process -- see
	// ISearch.* members for current state
	TextViewISearch

	// TextViewQReplace is emitted for every update of query-replace process -- see
	// QReplace.* members for current state
	TextViewQReplace

	// TextViewSignalsN is the number of TextViewSignals
	TextViewSignalsN
)

func (*TextViewSignals) FromString

func (i *TextViewSignals) FromString(s string) error

func (TextViewSignals) String

func (i TextViewSignals) String() string

type TextViewStates

type TextViewStates int32

TextViewStates are mutually-exclusive textfield states -- determines appearance

const (
	// TextViewActive is the normal state -- there but not being interacted with
	TextViewActive TextViewStates = iota

	// TextViewFocus states means textvieww is the focus -- will respond to keyboard input
	TextViewFocus

	// TextViewInactive means the textview is inactive -- not editable
	TextViewInactive

	// TextViewSel means the text region is selected
	TextViewSel

	// TextViewHighlight means the text region is highlighted
	TextViewHighlight

	// TextViewStatesN is the number of textview states
	TextViewStatesN
)

func (*TextViewStates) FromString

func (i *TextViewStates) FromString(s string) error

func (TextViewStates) String

func (i TextViewStates) String() string

type TimeValueView added in v1.0.4

type TimeValueView struct {
	ValueViewBase
}

TimeValueView presents a checkbox for a boolean

func (*TimeValueView) ConfigWidget added in v1.0.4

func (vv *TimeValueView) ConfigWidget(widg gi.Node2D)

func (*TimeValueView) TimeVal added in v1.0.5

func (vv *TimeValueView) TimeVal() *time.Time

TimeVal decodes Value into a *time.Time value -- also handles FileTime case

func (*TimeValueView) UpdateWidget added in v1.0.4

func (vv *TimeValueView) UpdateWidget()

func (*TimeValueView) WidgetType added in v1.0.4

func (vv *TimeValueView) WidgetType() reflect.Type

type TreeView

type TreeView struct {
	gi.PartsWidgetBase
	SrcNode          ki.Ki                       `copy:"-" json:"-" xml:"-" desc:"Ki Node that this widget is viewing in the tree -- the source"`
	ShowViewCtxtMenu bool                        `` /* 128-byte string literal not displayed */
	ViewIdx          int                         `` /* 144-byte string literal not displayed */
	Indent           units.Value                 `xml:"indent" desc:"styled amount to indent children relative to this node"`
	OpenDepth        int                         `` /* 150-byte string literal not displayed */
	TreeViewSig      ki.Signal                   `` /* 157-byte string literal not displayed */
	StateStyles      [TreeViewStatesN]gist.Style `` /* 217-byte string literal not displayed */
	WidgetSize       mat32.Vec2                  `desc:"just the size of our widget -- our alloc includes all of our children, but we only draw us"`
	Icon             gi.IconName                 `json:"-" xml:"icon" view:"show-name" desc:"optional icon, displayed to the the left of the text label"`
	RootView         *TreeView                   `json:"-" xml:"-" desc:"cached root of the view"`
}

TreeView provides a graphical representation of source tree structure (which can be any type of Ki nodes), providing full manipulation abilities of that source tree (move, cut, add, etc) through drag-n-drop and cut/copy/paste and menu actions.

There are special style Props interpreted by these nodes:

  • no-templates -- if present (assumed to be true) then style templates are not used to optimize rendering speed. Set this for nodes that have styling applied differentially to individual nodes (e.g., FileNode).

func AddNewTreeView added in v0.9.7

func AddNewTreeView(parent ki.Ki, name string) *TreeView

AddNewTreeView adds a new treeview to given parent node, with given name.

func (*TreeView) BBox2D

func (tv *TreeView) BBox2D() image.Rectangle

func (*TreeView) BranchPart

func (tv *TreeView) BranchPart() (*gi.CheckBox, bool)

BranchPart returns the branch in parts, if it exists

func (*TreeView) ChildrenBBox2D

func (tv *TreeView) ChildrenBBox2D() image.Rectangle

func (*TreeView) Close

func (tv *TreeView) Close()

Close closes the given node and updates the view accordingly (if it is not already closed)

func (*TreeView) CloseAll added in v0.9.4

func (tv *TreeView) CloseAll()

CloseAll closes the given node and all of its sub-nodes

func (*TreeView) ConfigParts

func (tv *TreeView) ConfigParts()

func (*TreeView) ConfigPartsIfNeeded

func (tv *TreeView) ConfigPartsIfNeeded()

func (*TreeView) ConnectEvents2D

func (tv *TreeView) ConnectEvents2D()

func (*TreeView) ContextMenuPos

func (tv *TreeView) ContextMenuPos() (pos image.Point)

func (*TreeView) Copy

func (tv *TreeView) Copy(reset bool)

Copy copies to clip.Board, optionally resetting the selection satisfies gi.Clipper interface and can be overridden by subtypes

func (*TreeView) Cut

func (tv *TreeView) Cut()

Cut copies to clip.Board and deletes selected items satisfies gi.Clipper interface and can be overridden by subtypes

func (*TreeView) Disconnect added in v0.9.8

func (tv *TreeView) Disconnect()

func (*TreeView) DragNDropExternal added in v0.9.11

func (tv *TreeView) DragNDropExternal(de *dnd.Event)

DragNDropExternal handles a drag-n-drop external drop onto this node

func (*TreeView) DragNDropFinalize

func (tv *TreeView) DragNDropFinalize(mod dnd.DropMods)

DragNDropFinalize is called to finalize actions on the Source node prior to performing target actions -- mod must indicate actual action taken by the target, including ignore

func (*TreeView) DragNDropFinalizeDefMod added in v0.9.11

func (tv *TreeView) DragNDropFinalizeDefMod()

DragNDropFinalizeDefMod is called to finalize actions on the Source node prior to performing target actions -- uses default drop mod in place when event was dropped.

func (*TreeView) DragNDropStart

func (tv *TreeView) DragNDropStart()

DragNDropStart starts a drag-n-drop on this node -- it includes any other selected nodes as well, each as additional records in mimedata

func (*TreeView) DragNDropTarget

func (tv *TreeView) DragNDropTarget(de *dnd.Event)

DragNDropTarget handles a drag-n-drop onto this node

func (*TreeView) Dragged

func (tv *TreeView) Dragged(de *dnd.Event)

Dragged is called after target accepts the drop -- we just remove elements that were moved satisfies gi.DragNDropper interface and can be overridden by subtypes

func (*TreeView) Drop

func (tv *TreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)

Drop pops up a menu to determine what specifically to do with dropped items satisfies gi.DragNDropper interface and can be overridden by subtypes

func (*TreeView) DropAfter

func (tv *TreeView) DropAfter(md mimedata.Mimes, mod dnd.DropMods)

DropAfter inserts object(s) from mime data after this node

func (*TreeView) DropAssign

func (tv *TreeView) DropAssign(md mimedata.Mimes)

DropAssign assigns mime data (only the first one!) to this node

func (*TreeView) DropBefore

func (tv *TreeView) DropBefore(md mimedata.Mimes, mod dnd.DropMods)

DropBefore inserts object(s) from mime data before this node

func (*TreeView) DropCancel

func (tv *TreeView) DropCancel()

DropCancel cancels the drop action e.g., preventing deleting of source items in a Move case

func (*TreeView) DropChildren

func (tv *TreeView) DropChildren(md mimedata.Mimes, mod dnd.DropMods)

DropChildren inserts object(s) from mime data at end of children of this node

func (*TreeView) DropExternal added in v0.9.11

func (tv *TreeView) DropExternal(md mimedata.Mimes, mod dnd.DropMods)

DropExternal is not handled by base case but could be in derived

func (*TreeView) FindSrcNode added in v1.2.3

func (tv *TreeView) FindSrcNode(kn ki.Ki) *TreeView

FindSrcNode finds TreeView node for given source node, or nil if not found

func (*TreeView) FocusChanged2D

func (tv *TreeView) FocusChanged2D(change gi.FocusChanges)

func (*TreeView) HasClosedParent

func (tv *TreeView) HasClosedParent() bool

HasClosedParent returns whether this node have a closed parent? if so, don't render!

func (*TreeView) IconPart

func (tv *TreeView) IconPart() (*gi.Icon, bool)

IconPart returns the icon in parts, if it exists

func (*TreeView) Init2D

func (tv *TreeView) Init2D()

func (*TreeView) IsChanged

func (tv *TreeView) IsChanged() bool

IsChanged returns whether this node has the changed flag set? Only updated on the root note by GUI actions.

func (*TreeView) IsClosed

func (tv *TreeView) IsClosed() bool

IsClosed returns whether this node itself closed?

func (*TreeView) IsRootOrField

func (tv *TreeView) IsRootOrField(op string) bool

IsRootOrField returns true if given node is either the root of the tree or a field -- various operations can not be performed on these -- if string is passed, then a prompt dialog is presented with that as the name of the operation being attempted -- otherwise it silently returns (suitable for context menu UpdateFunc).

func (*TreeView) IsVisible

func (tv *TreeView) IsVisible() bool

func (*TreeView) KeyInput

func (tv *TreeView) KeyInput(kt *key.ChordEvent)

func (*TreeView) Label

func (tv *TreeView) Label() string

Label returns the display label for this node, satisfying the Labeler interface

func (*TreeView) LabelPart

func (tv *TreeView) LabelPart() (*gi.Label, bool)

LabelPart returns the label in parts, if it exists

func (*TreeView) Layout2D

func (tv *TreeView) Layout2D(parBBox image.Rectangle, iter int) bool

func (*TreeView) Layout2DParts

func (tv *TreeView) Layout2DParts(parBBox image.Rectangle, iter int)

func (*TreeView) MakeContextMenu

func (tv *TreeView) MakeContextMenu(m *gi.Menu)

func (*TreeView) MakeDropMenu

func (tv *TreeView) MakeDropMenu(m *gi.Menu, data any, mod dnd.DropMods)

MakeDropMenu makes the menu of options for dropping on a target

func (*TreeView) MakePasteMenu

func (tv *TreeView) MakePasteMenu(m *gi.Menu, data any)

MakePasteMenu makes the menu of options for paste events

func (*TreeView) MimeData

func (tv *TreeView) MimeData(md *mimedata.Mimes)

MimeData adds mimedata for this node: a text/plain of the Path, and an application/json of the source node. satisfies Clipper.MimeData interface

func (*TreeView) MoveDown

func (tv *TreeView) MoveDown(selMode mouse.SelectModes) *TreeView

MoveDown moves the selection down to next element in the tree, using given select mode (from keyboard modifiers) -- returns newly selected node

func (*TreeView) MoveDownAction

func (tv *TreeView) MoveDownAction(selMode mouse.SelectModes) *TreeView

MoveDownAction moves the selection down to next element in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item

func (*TreeView) MoveDownSibling

func (tv *TreeView) MoveDownSibling(selMode mouse.SelectModes) *TreeView

MoveDownSibling moves down only to siblings, not down into children, using given select mode (from keyboard modifiers)

func (*TreeView) MoveEndAction added in v0.9.4

func (tv *TreeView) MoveEndAction(selMode mouse.SelectModes) *TreeView

MoveEndAction moves the selection to the very last node in the tree using given select mode (from keyboard modifiers) -- and emits select event for newly selected item

func (*TreeView) MoveHomeAction added in v0.9.4

func (tv *TreeView) MoveHomeAction(selMode mouse.SelectModes) *TreeView

MoveHomeAction moves the selection up to top of the tree, using given select mode (from keyboard modifiers) and emits select event for newly selected item

func (*TreeView) MovePageDownAction

func (tv *TreeView) MovePageDownAction(selMode mouse.SelectModes) *TreeView

MovePageDownAction moves the selection up to previous TreeViewPageSteps elements in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item

func (*TreeView) MovePageUpAction

func (tv *TreeView) MovePageUpAction(selMode mouse.SelectModes) *TreeView

MovePageUpAction moves the selection up to previous TreeViewPageSteps elements in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item

func (*TreeView) MoveToLastChild

func (tv *TreeView) MoveToLastChild(selMode mouse.SelectModes) *TreeView

MoveToLastChild moves to the last child under me, using given select mode (from keyboard modifiers)

func (*TreeView) MoveUp

func (tv *TreeView) MoveUp(selMode mouse.SelectModes) *TreeView

MoveUp moves selection up to previous element in the tree, using given select mode (from keyboard modifiers) -- returns newly selected node

func (*TreeView) MoveUpAction

func (tv *TreeView) MoveUpAction(selMode mouse.SelectModes) *TreeView

MoveUpAction moves the selection up to previous element in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item

func (*TreeView) NodesFromMimeData

func (tv *TreeView) NodesFromMimeData(md mimedata.Mimes) (ki.Slice, []string)

NodesFromMimeData creates a slice of Ki node(s) from given mime data and also a corresponding slice of original paths

func (*TreeView) Open

func (tv *TreeView) Open()

Open opens the given node and updates the view accordingly (if it is not already opened)

func (*TreeView) OpenAll added in v0.9.4

func (tv *TreeView) OpenAll()

OpenAll opens the given node and all of its sub-nodes

func (*TreeView) OpenParents added in v1.2.3

func (tv *TreeView) OpenParents()

OpenParents opens all the parents of this node, so that it will be visible

func (*TreeView) Paste

func (tv *TreeView) Paste()

Paste pastes clipboard at given node satisfies gi.Clipper interface and can be overridden by subtypes

func (*TreeView) PasteAfter

func (tv *TreeView) PasteAfter(md mimedata.Mimes, mod dnd.DropMods)

PasteAfter inserts object(s) from mime data after this node. If another item with the same name already exists, it will append _Copy on the name of the inserted objects

func (*TreeView) PasteAssign

func (tv *TreeView) PasteAssign(md mimedata.Mimes)

PasteAssign assigns mime data (only the first one!) to this node

func (*TreeView) PasteAt added in v0.9.4

func (tv *TreeView) PasteAt(md mimedata.Mimes, mod dnd.DropMods, rel int, actNm string)

PasteAt inserts object(s) from mime data at rel position to this node. If another item with the same name already exists, it will append _Copy on the name of the inserted objects

func (*TreeView) PasteBefore

func (tv *TreeView) PasteBefore(md mimedata.Mimes, mod dnd.DropMods)

PasteBefore inserts object(s) from mime data before this node. If another item with the same name already exists, it will append _Copy on the name of the inserted objects

func (*TreeView) PasteChildren

func (tv *TreeView) PasteChildren(md mimedata.Mimes, mod dnd.DropMods)

PasteChildren inserts object(s) from mime data at end of children of this node

func (*TreeView) PasteMenu

func (tv *TreeView) PasteMenu(md mimedata.Mimes)

PasteMenu performs a paste from the clipboard using given data -- pops up a menu to determine what specifically to do

func (*TreeView) PushBounds added in v0.9.11

func (tv *TreeView) PushBounds() bool

func (*TreeView) ReSync added in v1.1.3

func (tv *TreeView) ReSync()

ReSync resynchronizes the view relative to the underlying nodes and forces a full rerender

func (*TreeView) Render2D

func (tv *TreeView) Render2D()

func (*TreeView) RootIsInactive added in v0.9.5

func (tv *TreeView) RootIsInactive() bool

RootIsInactive returns the inactive status of the root node, which is what controls the functional inactivity of the tree -- if individual nodes are inactive that only affects display typically.

func (*TreeView) RootTreeView

func (tv *TreeView) RootTreeView() *TreeView

RootTreeView returns the root node of TreeView tree -- typically cached in RootView on each node, but this can be used if that cached value needs to be updated for any reason.

func (*TreeView) Select

func (tv *TreeView) Select()

Select selects this node (if not already selected) -- must use this method to update global selection list

func (*TreeView) SelectAction

func (tv *TreeView) SelectAction(mode mouse.SelectModes) bool

SelectAction updates selection to include this node, using selectmode from mouse event (ExtendContinuous, ExtendOne), and emits selection signal returns true if signal emitted

func (*TreeView) SelectAll

func (tv *TreeView) SelectAll()

SelectAll all items in view

func (*TreeView) SelectMode

func (tv *TreeView) SelectMode() bool

SelectMode returns true if keyboard movements should automatically select nodes

func (*TreeView) SelectModeToggle

func (tv *TreeView) SelectModeToggle()

SelectModeToggle toggles the SelectMode

func (*TreeView) SelectUpdate

func (tv *TreeView) SelectUpdate(mode mouse.SelectModes) bool

SelectUpdate updates selection to include this node, using selectmode from mouse event (ExtendContinuous, ExtendOne). Returns true if this node selected

func (*TreeView) SelectedSrcNodes

func (tv *TreeView) SelectedSrcNodes() ki.Slice

SelectedSrcNodes returns a slice of the currently-selected source nodes in the entire tree view

func (*TreeView) SelectedViews

func (tv *TreeView) SelectedViews() []*TreeView

SelectedViews returns a slice of the currently-selected TreeViews within the entire tree, using a list maintained by the root node

func (*TreeView) SetChanged

func (tv *TreeView) SetChanged()

SetChanged is called whenever a gui action updates the tree -- sets Changed flag on root node and emits signal

func (*TreeView) SetClosed

func (tv *TreeView) SetClosed()

SetClosed sets the closed flag for this node -- call Close() method to close a node and update view

func (*TreeView) SetClosedState

func (tv *TreeView) SetClosedState(closed bool)

SetClosedState sets the closed state based on arg

func (*TreeView) SetOpen

func (tv *TreeView) SetOpen()

SetOpen clears the closed flag for this node -- call Open() method to open a node and update view

func (*TreeView) SetRootNode

func (tv *TreeView) SetRootNode(sk ki.Ki)

SetRootNode sets the root view to the root of the source node that we are viewing, and builds-out the view of its tree. Calls ki.UniquifyNamesAll on source tree to ensure that node names are unique which is essential for proper viewing!

func (*TreeView) SetSelectMode

func (tv *TreeView) SetSelectMode(selMode bool)

SetSelectMode updates the select mode

func (*TreeView) SetSelectedViews

func (tv *TreeView) SetSelectedViews(sl []*TreeView)

SetSelectedViews updates the selected views to given list

func (*TreeView) SetSrcNode

func (tv *TreeView) SetSrcNode(sk ki.Ki, tvIdx *int, init bool, depth int)

SetSrcNode sets the source node that we are viewing, and builds-out the view of its tree. It is called routinely via SyncToSrc during tree updating.

func (*TreeView) Size2D

func (tv *TreeView) Size2D(iter int)

func (*TreeView) SrcAddChild

func (tv *TreeView) SrcAddChild()

SrcAddChild adds a new child node to this one in the source tree, prompting the user for the type of node to add

func (*TreeView) SrcDelete

func (tv *TreeView) SrcDelete()

SrcDelete deletes the source node corresponding to this view node in the source tree

func (*TreeView) SrcDuplicate

func (tv *TreeView) SrcDuplicate()

SrcDuplicate duplicates the source node corresponding to this view node in the source tree, and inserts the duplicate after this node (as a new sibling)

func (*TreeView) SrcEdit

func (tv *TreeView) SrcEdit()

SrcEdit pulls up a StructViewDialog window on the source object viewed by this node

func (*TreeView) SrcGoGiEditor

func (tv *TreeView) SrcGoGiEditor()

SrcGoGiEditor pulls up a new GoGiEditor window on the source object viewed by this node

func (*TreeView) SrcInsertAfter

func (tv *TreeView) SrcInsertAfter()

SrcInsertAfter inserts a new node in the source tree after this node, at the same (sibling) level, prompting for the type of node to insert

func (*TreeView) SrcInsertAt added in v0.9.4

func (tv *TreeView) SrcInsertAt(rel int, actNm string)

SrcInsertAt inserts a new node in the source tree at given relative offset from this node, at the same (sibling) level, prompting for the type of node to insert

func (*TreeView) SrcInsertBefore

func (tv *TreeView) SrcInsertBefore()

SrcInsertBefore inserts a new node in the source tree before this node, at the same (sibling) level, prompting for the type of node to insert

func (*TreeView) Style2D

func (tv *TreeView) Style2D()

func (*TreeView) StyleTreeView

func (tv *TreeView) StyleTreeView()

func (*TreeView) SyncToSrc

func (tv *TreeView) SyncToSrc(tvIdx *int, init bool, depth int)

SyncToSrc updates the view tree to match the source tree, using ConfigChildren to maximally preserve existing tree elements. init means we are doing initial build, and depth tracks depth (only during init).

func (*TreeView) ToggleClose

func (tv *TreeView) ToggleClose()

ToggleClose toggles the close / open status: if closed, opens, and vice-versa

func (*TreeView) TreeViewEvents

func (tv *TreeView) TreeViewEvents()

func (*TreeView) TreeViewParent

func (tv *TreeView) TreeViewParent() *TreeView

func (*TreeView) Unselect

func (tv *TreeView) Unselect()

Unselect unselects this node (if selected) -- must use this method to update global selection list

func (*TreeView) UnselectAction

func (tv *TreeView) UnselectAction()

UnselectAction unselects this node (if selected) -- and emits a signal

func (*TreeView) UnselectAll

func (tv *TreeView) UnselectAll()

UnselectAll unselects all selected items in the view

func (*TreeView) UpdateInactive added in v0.9.4

func (tv *TreeView) UpdateInactive() bool

UpdateInactive updates the Inactive state based on SrcNode -- returns true if inactive. The inactivity of individual nodes only affects display properties typically, and not overall functional behavior, which is controlled by inactivity of the root node (i.e, make the root inactive to make entire tree read-only and non-modifiable)

type TreeViewFlags added in v0.9.9

type TreeViewFlags int

TreeViewFlags extend NodeBase NodeFlags to hold TreeView state

const (
	// TreeViewFlagClosed means node is toggled closed (children not visible)
	TreeViewFlagClosed TreeViewFlags = TreeViewFlags(gi.NodeFlagsN) + iota

	// TreeViewFlagChanged is updated on the root node whenever a gui edit is
	// made through the tree view on the tree -- this does not track any other
	// changes that might have occurred in the tree itself.
	// Also emits a TreeViewChanged signal on the root node.
	TreeViewFlagChanged

	// TreeViewFlagNoTemplate -- this node is not using a style template -- should
	// be restyled on any full re-render change
	TreeViewFlagNoTemplate

	// TreeViewFlagUpdtRoot -- for any update signal that comes from the source
	// root node, do a full update of the treeview.  This increases responsiveness
	// of the updating and makes it easy to trigger a full update by updating the root
	// node, but can be slower when not needed
	TreeViewFlagUpdtRoot

	TreeViewFlagsN
)

func StringToTreeViewFlags added in v0.9.9

func StringToTreeViewFlags(s string) (TreeViewFlags, error)

func (TreeViewFlags) String added in v0.9.9

func (i TreeViewFlags) String() string

type TreeViewSignals

type TreeViewSignals int64

TreeViewSignals are signals that treeview can send -- these are all sent from the root tree view widget node, with data being the relevant node widget

const (
	// node was selected
	TreeViewSelected TreeViewSignals = iota

	// TreeView unselected
	TreeViewUnselected

	// TreeView all items were selected
	TreeViewAllSelected

	// TreeView all items were unselected
	TreeViewAllUnselected

	// closed TreeView was opened
	TreeViewOpened

	// open TreeView was closed -- children not visible
	TreeViewClosed

	// means that some kind of edit operation has taken place
	// by the user via the gui -- we don't track the details, just that
	// changes have happened
	TreeViewChanged

	// a node was inserted into the tree (Paste, DND)
	// in this case, the data is the *source node* that was inserted
	TreeViewInserted

	// a node was deleted from the tree (Cut, DND Move)
	TreeViewDeleted

	TreeViewSignalsN
)

func (*TreeViewSignals) FromString

func (i *TreeViewSignals) FromString(s string) error

func (TreeViewSignals) String

func (i TreeViewSignals) String() string

type TreeViewStates

type TreeViewStates int32

TreeViewStates are mutually-exclusive tree view states -- determines appearance

const (
	// TreeViewActive is normal state -- there but not being interacted with
	TreeViewActive TreeViewStates = iota

	// TreeViewSel is selected
	TreeViewSel

	// TreeViewFocus is in focus -- will respond to keyboard input
	TreeViewFocus

	// TreeViewInactive is inactive -- if SrcNode is nil, or source has "inactive" property
	// set, or treeview node has inactive property set directly
	TreeViewInactive

	TreeViewStatesN
)

func (*TreeViewStates) FromString

func (i *TreeViewStates) FromString(s string) error

func (TreeViewStates) String

func (i TreeViewStates) String() string

type TwinTextViews added in v0.9.13

type TwinTextViews struct {
	gi.SplitView
	BufA *TextBuf `json:"-" xml:"-" desc:"textbuf for A"`
	BufB *TextBuf `json:"-" xml:"-" desc:"textbuf for B"`
}

TwinTextViews presents two side-by-side TextView windows in SplitView that scroll in sync with each other.

func AddNewTwinTextViews added in v0.9.13

func AddNewTwinTextViews(parent ki.Ki, name string) *TwinTextViews

AddNewTwinTextViews adds a new diffview to given parent node, with given name.

func BlameDialog added in v0.9.13

func BlameDialog(avp *gi.Viewport2D, fname string, blame, fbytes []byte) *TwinTextViews

BlameDialog opens a dialog for displaying VCS blame data using TwinTextViews. blame is the annotated blame code, while fbytes is the original file contents.

func (*TwinTextViews) ConfigTexts added in v0.9.13

func (tv *TwinTextViews) ConfigTexts()

func (*TwinTextViews) MakeBufs added in v0.9.13

func (tv *TwinTextViews) MakeBufs()

MakeBufs ensures that the TextBufs are made, if nil

func (*TwinTextViews) SetFiles added in v0.9.13

func (tv *TwinTextViews) SetFiles(fileA, fileB string, lineNos bool)

SetFiles sets files for each text buf

func (*TwinTextViews) TextViewLays added in v0.9.13

func (tv *TwinTextViews) TextViewLays() (*gi.Layout, *gi.Layout)

TextViewLays returns the two layouts that control the two textviews

func (*TwinTextViews) TextViews added in v0.9.13

func (tv *TwinTextViews) TextViews() (*TextView, *TextView)

TextViews returns the two textviews

type TypeValueView

type TypeValueView struct {
	ValueViewBase
}

TypeValueView presents a combobox for choosing types

func (*TypeValueView) ConfigWidget

func (vv *TypeValueView) ConfigWidget(widg gi.Node2D)

func (*TypeValueView) UpdateWidget

func (vv *TypeValueView) UpdateWidget()

func (*TypeValueView) WidgetType

func (vv *TypeValueView) WidgetType() reflect.Type

type VCSLogView added in v0.9.13

type VCSLogView struct {
	gi.Layout
	Log   vci.Log  `desc:"current log"`
	File  string   `desc:"file that this is a log of -- if blank then it is entire repository"`
	Since string   `desc:"date expression for how long ago to include log entries from"`
	Repo  vci.Repo `json:"-" xml:"-" copy:"-" desc:"version control system repository"`
	RevA  string   `desc:"revision A -- defaults to HEAD"`
	RevB  string   `desc:"revision B -- blank means current working copy"`
	SetA  bool     `desc:"double-click will set the A revision -- else B"`
}

VCSLogView is a view of the variables

func (*VCSLogView) Config added in v0.9.13

func (lv *VCSLogView) Config(repo vci.Repo, lg vci.Log, file, since string)

Config configures to given repo, log and file (file could be empty)

func (*VCSLogView) ConfigToolBar added in v0.9.13

func (lv *VCSLogView) ConfigToolBar()

ConfigToolBar

func (*VCSLogView) SetRevA added in v0.9.13

func (lv *VCSLogView) SetRevA(rev string)

SetRevA sets the RevA to use

func (*VCSLogView) SetRevB added in v0.9.13

func (lv *VCSLogView) SetRevB(rev string)

SetRevB sets the RevB to use

func (*VCSLogView) TableView added in v0.9.13

func (lv *VCSLogView) TableView() *TableView

TableView returns the tableview

func (*VCSLogView) ToggleRev added in v0.9.14

func (lv *VCSLogView) ToggleRev()

ToggleRev switches the active revision to set

func (*VCSLogView) ToolBar added in v0.9.13

func (lv *VCSLogView) ToolBar() *gi.ToolBar

ToolBar returns the toolbar

type ValueView

type ValueView interface {
	ki.Ki

	// AsValueViewBase gives access to the basic data fields so that the
	// interface doesn't need to provide accessors for them.
	AsValueViewBase() *ValueViewBase

	// SetStructValue sets the value, owner and field information for a struct field.
	SetStructValue(val reflect.Value, owner any, field *reflect.StructField, tmpSave ValueView, viewPath string)

	// SetMapKey sets the key value and owner for a map key.
	SetMapKey(val reflect.Value, owner any, tmpSave ValueView)

	// SetMapValue sets the value, owner and map key information for a map
	// element -- needs pointer to ValueView representation of key to track
	// current key value.
	SetMapValue(val reflect.Value, owner any, key any, keyView ValueView, tmpSave ValueView, viewPath string)

	// SetSliceValue sets the value, owner and index information for a slice element.
	SetSliceValue(val reflect.Value, owner any, idx int, tmpSave ValueView, viewPath string)

	// SetSoloValue sets the value for a singleton standalone value
	// (e.g., for arg values).
	SetSoloValue(val reflect.Value)

	// OwnerKind returns the reflect.Kind of the owner: Struct, Map, or Slice
	// (or Invalid for standalone values such as args).
	OwnerKind() reflect.Kind

	// IsInactive returns whether the value is inactive -- e.g., Map owners
	// have Inactive values, and some fields can be marked as Inactive using a
	// struct tag.
	IsInactive() bool

	// WidgetType returns an appropriate type of widget to represent the
	// current value.
	WidgetType() reflect.Type

	// UpdateWidget updates the widget representation to reflect the current
	// value.  Must first check for a nil widget -- can be called in a
	// no-widget context (e.g., for single-argument values with actions).
	UpdateWidget()

	// ConfigWidget configures a widget of WidgetType for representing the
	// value, including setting up the signal connections to set the value
	// when the user edits it (values are always set immediately when the
	// widget is updated).
	ConfigWidget(widg gi.Node2D)

	// HasAction returns true if this value has an associated action, such as
	// pulling up a dialog or chooser for this value.  Activate method will
	// trigger this action.
	HasAction() bool

	// Activate triggers any action associated with this value, such as
	// pulling up a dialog or chooser for this value.  This is called by
	// default for single-argument methods that have value representations
	// with actions.  The viewport provides a context for opening other
	// windows, and the receiver and dlgFunc should receive the DialogSig for
	// the relevant dialog, or a pass-on call thereof, including the
	// DialogAccepted or Canceled signal, so that the caller can execute its
	// own actions based on the user hitting Ok or Cancel.
	Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)

	// Val returns the reflect.Value representation for this item.
	Val() reflect.Value

	// SetValue assigns given value to this item (if not Inactive), using
	// Ki.SetField for Ki types and kit.SetRobust otherwise -- emits a ViewSig
	// signal when set.
	SetValue(val any) bool

	// SetTags sets tags for this valueview, for non-struct values, to
	// influence interface for this value -- see
	// https://github.com/goki/gi/wiki/Tags for valid options.  Adds to
	// existing tags if some are already set.
	SetTags(tags map[string]string)

	// SetTag sets given tag to given value for this valueview, for non-struct
	// values, to influence interface for this value -- see
	// https://github.com/goki/gi/wiki/Tags for valid options.
	SetTag(tag, value string)

	// Tag returns value for given tag -- looks first at tags set by
	// SetTag(s) methods, and then at field tags if this is a field in a
	// struct -- returns false if tag was not set.
	Tag(tag string) (string, bool)

	// AllTags returns all the tags for this value view, from structfield or set
	// specifically using SetTag* methods
	AllTags() map[string]string

	// SaveTmp saves a temporary copy of a struct to a map -- map values must
	// be explicitly re-saved and cannot be directly written to by the value
	// elements -- each ValueView has a pointer to any parent ValueView that
	// might need to be saved after SetValue -- SaveTmp called automatically
	// in SetValue but other cases that use something different need to call
	// it explicitly.
	SaveTmp()
}

ValueView is an interface for managing the GUI representation of values (e.g., fields, map values, slice values) in Views (StructView, MapView, etc). The different types of ValueView are for different Kinds of values (bool, float, etc) -- which can have different Kinds of owners. The ValueViewBase class supports all the basic fields for managing the owner kinds.

func FieldToValueView

func FieldToValueView(it any, field string, fval any) ValueView

FieldToValueView returns the appropriate ValueView for given field on a struct -- attempts to get the FieldValueViewer interface, and falls back on ToValueView otherwise, using field value (fval) gopy:interface=handle

func ToValueView

func ToValueView(it any, tags string) ValueView

ToValueView returns the appropriate ValueView for given item, based only on its type -- attempts to get the ValueViewer interface and failing that, falls back on default Kind-based options. tags are optional tags, e.g., from the field in a struct, that control the view properties -- see the gi wiki for details on supported tags -- these are NOT set for the view element, only used for options that affect what kind of view to create. See FieldToValueView for version that takes into account the properties of the owner. gopy:interface=handle

type ValueViewBase

type ValueViewBase struct {
	ki.Node
	ViewSig   ki.Signal            `` /* 213-byte string literal not displayed */
	Value     reflect.Value        `desc:"the reflect.Value representation of the value"`
	OwnKind   reflect.Kind         `desc:"kind of owner that we have -- reflect.Struct, .Map, .Slice are supported"`
	IsMapKey  bool                 `desc:"for OwnKind = Map, this value represents the Key -- otherwise the Value"`
	ViewPath  string               `` /* 134-byte string literal not displayed */
	Owner     any                  `` /* 162-byte string literal not displayed */
	Field     *reflect.StructField `desc:"if Owner is a struct, this is the reflect.StructField associated with the value"`
	Tags      map[string]string    `` /* 129-byte string literal not displayed */
	Key       any                  `desc:"if Owner is a map, and this is a value, this is the key for this value in the map"`
	KeyView   ValueView            `` /* 159-byte string literal not displayed */
	Idx       int                  `desc:"if Owner is a slice, this is the index for the value in the slice"`
	WidgetTyp reflect.Type         `` /* 156-byte string literal not displayed */
	Widget    gi.Node2D            `` /* 142-byte string literal not displayed */
	TmpSave   ValueView            `` /* 172-byte string literal not displayed */
}

ValueViewBase provides the basis for implementations of the ValueView interface, representing values in the interface -- it implements a generic TextField representation of the string value, and provides the generic fallback for everything that doesn't provide a specific ValueViewer type.

func (*ValueViewBase) Activate

func (vv *ValueViewBase) Activate(vp *gi.Viewport2D, recv ki.Ki, fun ki.RecvFunc)

func (*ValueViewBase) AllTags

func (vv *ValueViewBase) AllTags() map[string]string

func (*ValueViewBase) AsValueViewBase

func (vv *ValueViewBase) AsValueViewBase() *ValueViewBase

func (*ValueViewBase) ConfigWidget

func (vv *ValueViewBase) ConfigWidget(widg gi.Node2D)

func (*ValueViewBase) CreateTempIfNotPtr

func (vv *ValueViewBase) CreateTempIfNotPtr() bool

func (*ValueViewBase) Disconnect added in v0.9.8

func (vv *ValueViewBase) Disconnect()

func (*ValueViewBase) HasAction

func (vv *ValueViewBase) HasAction() bool

func (*ValueViewBase) IsInactive

func (vv *ValueViewBase) IsInactive() bool

func (*ValueViewBase) Label added in v0.9.8

func (vv *ValueViewBase) Label() (label, newPath string, isZero bool)

Label returns a label for this item suitable for a window title etc. Based on the underlying value type name, owner label, and ViewPath. newPath returns just what should be added to a ViewPath also includes zero value check reported in the isZero bool, which can be used for not proceeding in case of non-value-based types.

func (*ValueViewBase) OwnerKind

func (vv *ValueViewBase) OwnerKind() reflect.Kind

we have this one accessor b/c it is more useful for outside consumers vs. internal usage

func (*ValueViewBase) OwnerLabel

func (vv *ValueViewBase) OwnerLabel() string

OwnerLabel returns some extra info about the owner of this value view which is useful to put in title of our object

func (*ValueViewBase) SaveTmp

func (vv *ValueViewBase) SaveTmp()

func (*ValueViewBase) SetMapKey

func (vv *ValueViewBase) SetMapKey(key reflect.Value, owner any, tmpSave ValueView)

func (*ValueViewBase) SetMapValue

func (vv *ValueViewBase) SetMapValue(val reflect.Value, owner any, key any, keyView ValueView, tmpSave ValueView, viewPath string)

func (*ValueViewBase) SetSliceValue

func (vv *ValueViewBase) SetSliceValue(val reflect.Value, owner any, idx int, tmpSave ValueView, viewPath string)

func (*ValueViewBase) SetSoloValue added in v0.9.10

func (vv *ValueViewBase) SetSoloValue(val reflect.Value)

SetSoloValue sets the value for a singleton standalone value (e.g., for arg values).

func (*ValueViewBase) SetStructValue

func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner any, field *reflect.StructField, tmpSave ValueView, viewPath string)

func (*ValueViewBase) SetTag

func (vv *ValueViewBase) SetTag(tag, value string)

func (*ValueViewBase) SetTags

func (vv *ValueViewBase) SetTags(tags map[string]string)

func (*ValueViewBase) SetValue

func (vv *ValueViewBase) SetValue(val any) bool

func (*ValueViewBase) StdConfigWidget added in v0.9.10

func (vv *ValueViewBase) StdConfigWidget(widg gi.Node2D)

StdConfigWidget does all of the standard widget configuration tag options

func (*ValueViewBase) Tag

func (vv *ValueViewBase) Tag(tag string) (string, bool)

func (*ValueViewBase) UpdateWidget

func (vv *ValueViewBase) UpdateWidget()

func (*ValueViewBase) Val

func (vv *ValueViewBase) Val() reflect.Value

func (*ValueViewBase) WidgetType

func (vv *ValueViewBase) WidgetType() reflect.Type

type ValueViewFunc added in v0.9.8

type ValueViewFunc func() ValueView

ValueViewFunc is a function that returns a new initialized ValueView of an appropriate type as registered in the ValueViewMap

type ValueViewer

type ValueViewer interface {
	ValueView() ValueView
}

ValueViewer interface supplies the appropriate type of ValueView -- called on a given receiver item if defined for that receiver type (tries both pointer and non-pointer receivers) -- can use this for custom types to provide alternative custom interfaces -- must call Init on ValueView before returning it

type VersCtrlName added in v0.9.5

type VersCtrlName string

VersCtrlName is the name of a version control system

func VersCtrlNameProper added in v0.9.5

func VersCtrlNameProper(vc string) VersCtrlName

func (VersCtrlName) ValueView added in v0.9.5

func (kn VersCtrlName) ValueView() ValueView

ValueView registers VersCtrlValueView as the viewer of VersCtrlName

type VersCtrlValueView added in v0.9.5

type VersCtrlValueView struct {
	ValueViewBase
}

VersCtrlValueView presents an action for displaying an VersCtrlName and selecting from StringPopup

func (*VersCtrlValueView) Activate added in v0.9.5

func (vv *VersCtrlValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*VersCtrlValueView) ConfigWidget added in v0.9.5

func (vv *VersCtrlValueView) ConfigWidget(widg gi.Node2D)

func (*VersCtrlValueView) HasAction added in v0.9.5

func (vv *VersCtrlValueView) HasAction() bool

func (*VersCtrlValueView) UpdateWidget added in v0.9.5

func (vv *VersCtrlValueView) UpdateWidget()

func (*VersCtrlValueView) WidgetType added in v0.9.5

func (vv *VersCtrlValueView) WidgetType() reflect.Type

type ViewIFace

type ViewIFace struct {
}

giv.ViewIFace is THE implementation of the gi.ViewIFace interface

func (*ViewIFace) CtxtMenuView

func (vi *ViewIFace) CtxtMenuView(val any, inactive bool, vp *gi.Viewport2D, menu *gi.Menu) bool

func (*ViewIFace) GoGiEditor

func (vi *ViewIFace) GoGiEditor(obj ki.Ki)

func (*ViewIFace) HiStyleInit added in v0.9.11

func (vi *ViewIFace) HiStyleInit()

func (*ViewIFace) HiStylesView

func (vi *ViewIFace) HiStylesView(std bool)

func (*ViewIFace) KeyMapsView

func (vi *ViewIFace) KeyMapsView(maps *gi.KeyMaps)

func (*ViewIFace) PrefsDbgView

func (vi *ViewIFace) PrefsDbgView(prefs *gi.PrefsDebug)

func (*ViewIFace) PrefsDetApply

func (vi *ViewIFace) PrefsDetApply(pf *gi.PrefsDetailed)

func (*ViewIFace) PrefsDetDefaults

func (vi *ViewIFace) PrefsDetDefaults(pf *gi.PrefsDetailed)

func (*ViewIFace) PrefsDetView

func (vi *ViewIFace) PrefsDetView(prefs *gi.PrefsDetailed)

func (*ViewIFace) PrefsView

func (vi *ViewIFace) PrefsView(prefs *gi.Preferences)

func (*ViewIFace) SetHiStyleDefault added in v0.9.11

func (vi *ViewIFace) SetHiStyleDefault(hsty gi.HiStyleName)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL