giv

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: BSD-3-Clause Imports: 56 Imported by: 201

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 (
	// 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

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":     gi.AlignCenter,
		"vertical-align": gi.AlignTop,
	},
}
View Source
var AvailColorMaps = map[string]*ColorMap{}

AvailColorMaps is the list of all available color maps

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 DefaultIndentStrings = []string{"{"}
View Source
var DefaultUnindentStrings = []string{"}"}
View Source
var FileInfoProps = ki.Props{
	"CtxtMenu": ki.PropSlice{
		{"Duplicate", ki.Props{
			"updtfunc": ActionUpdateFunc(func(fii interface{}, act *gi.Action) {
				fi := fii.(*FileInfo)
				act.SetInactiveState(fi.IsDir())
			}),
		}},
		{"Delete", ki.Props{
			"desc":    "Ok to delete this file?  This is not undoable and is not moving to trash / recycle bin",
			"confirm": true,
			"updtfunc": ActionUpdateFunc(func(fii interface{}, act *gi.Action) {
				fi := fii.(*FileInfo)
				act.SetInactiveState(fi.IsDir())
			}),
		}},
		{"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",
				}},
			},
		}},
		{"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 FileSearchContext = 30

FileSearchContext is how much text to include on either side of the search match

View Source
var FileTreeActiveDirFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		act.SetActiveState(fn.IsDir())
	}
})

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

View Source
var FileTreeActiveInVcsFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		if fn.Repo() == nil || fn.IsDir() {
			act.SetActiveState((false))
			return
		}
		act.SetActiveState((fn.VcsState >= FileNodeVcsAdded))
	}
})

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

View Source
var FileTreeActiveInVcsModifiedFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		if fn.Repo() == nil || fn.IsDir() {
			act.SetActiveState((false))
			return
		}
		act.SetActiveState((fn.VcsState == FileNodeVcsModified || fn.VcsState == FileNodeVcsAdded))
	}
})

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 interface{}, act *gi.Action) {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	if fn != nil {
		if fn.Repo() == nil || fn.IsDir() {
			act.SetActiveState((false))
			return
		}
		act.SetActiveState((fn.VcsState == FileNodeNotInVcs))
	}
})

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

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

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

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":       gi.AlignLeft,
	"vertical-align":   gi.AlignTop,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": "inherit",
	".exec": ki.Props{
		"font-weight": gi.WeightBold,
	},
	".open": ki.Props{
		"font-style": gi.FontItalic,
	},
	".notinvcs": ki.Props{
		"color": "#ce4252",
	},
	".changed": ki.Props{
		"color": "#4b7fd1",
	},
	"#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(.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",
		}},
		{"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",
			"shortcut": gi.KeyFunDelete,
		}},
		{"RenameFiles", ki.Props{
			"label": "Rename",
			"desc":  "Rename file to new file name",
		}},
		{"sep-open", ki.BlankProp{}},
		{"OpenDirs", ki.Props{
			"label":    "Open Dir",
			"desc":     "open given folder to see files within",
			"updtfunc": FileTreeActiveDirFunc,
		}},
		{"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,
		}},
		{"RemoveFromVcs", ki.Props{
			"desc":       "Remove 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,
		}},
	},
}
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": gi.AlignCenter,
		"vertical-align":   gi.AlignTop,
	},
	"ToolBar": ki.PropSlice{
		{"Update", ki.Props{
			"icon": "update",
			"updtfunc": ActionUpdateFunc(func(gei interface{}, 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 interface{}, 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 interface{}, 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 interface{}, 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":   gi.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":     gi.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_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_FileNodeVcsStates = kit.Enums.AddEnum(FileNodeVcsStatesN, kit.NotBitFlag, 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_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_TypeValueView = kit.Types.AddType(&TypeValueView{}, nil)
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 MaxScopeLines = 100

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

View Source
var MethArgHist = map[string]interface{}{}

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 StdColorMaps = map[string]*ColorMap{
	"ColdHot":        &ColorMap{"ColdHot", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 255, 255, 255}, {0, 0, 255, 255}, {127, 127, 127, 255}, {255, 0, 0, 255}, {255, 255, 0, 255}}},
	"Jet":            &ColorMap{"Jet", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 127, 255}, {0, 0, 255, 255}, {0, 127, 255, 255}, {0, 255, 255, 255}, {127, 255, 127, 255}, {255, 255, 0, 255}, {255, 127, 0, 255}, {255, 0, 0, 255}, {127, 0, 0, 255}}},
	"JetMuted":       &ColorMap{"JetMuted", gi.Color{200, 200, 200, 255}, []gi.Color{{25, 25, 153, 255}, {25, 102, 230, 255}, {0, 230, 230, 255}, {0, 179, 0, 255}, {230, 230, 0, 255}, {230, 102, 25, 255}, {153, 25, 25, 255}}},
	"Viridis":        &ColorMap{"Viridis", gi.Color{200, 200, 200, 255}, []gi.Color{{72, 33, 114, 255}, {67, 62, 133, 255}, {56, 87, 140, 255}, {45, 111, 142, 255}, {36, 133, 142, 255}, {30, 155, 138, 255}, {42, 176, 127, 255}, {81, 197, 105, 255}, {134, 212, 73, 255}, {194, 223, 35, 255}, {253, 231, 37, 255}}},
	"Plasma":         &ColorMap{"Plasma", gi.Color{200, 200, 200, 255}, []gi.Color{{61, 4, 155, 255}, {99, 0, 167, 255}, {133, 6, 166, 255}, {166, 32, 152, 255}, {192, 58, 131, 255}, {213, 84, 110, 255}, {231, 111, 90, 255}, {246, 141, 69, 255}, {253, 174, 50, 255}, {252, 210, 36, 255}, {240, 248, 33, 255}}},
	"Inferno":        &ColorMap{"Inferno", gi.Color{200, 200, 200, 255}, []gi.Color{{37, 12, 3, 255}, {19, 11, 52, 255}, {57, 9, 99, 255}, {95, 19, 110, 255}, {133, 33, 107, 255}, {169, 46, 94, 255}, {203, 65, 73, 255}, {230, 93, 47, 255}, {247, 131, 17, 255}, {252, 174, 19, 255}, {245, 219, 76, 255}, {252, 254, 164, 255}}},
	"BlueBlackRed":   &ColorMap{"BlueBlackRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {76, 76, 76, 255}, {255, 0, 0, 255}}},
	"BlueGreyRed":    &ColorMap{"BlueGreyRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {127, 127, 127, 255}, {255, 0, 0, 255}}},
	"BlueWhiteRed":   &ColorMap{"BlueWhiteRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {230, 230, 230, 255}, {255, 0, 0, 255}}},
	"BlueGreenRed":   &ColorMap{"BlueGreenRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {0, 230, 0, 255}, {255, 0, 0, 255}}},
	"Rainbow":        &ColorMap{"Rainbow", gi.Color{200, 200, 200, 255}, []gi.Color{{255, 0, 255, 255}, {0, 0, 255, 255}, {0, 255, 0, 255}, {255, 255, 0, 255}, {255, 0, 0, 255}}},
	"ROYGBIV":        &ColorMap{"ROYGBIV", gi.Color{200, 200, 200, 255}, []gi.Color{{255, 0, 255, 255}, {0, 0, 127, 255}, {0, 0, 255, 255}, {0, 255, 0, 255}, {255, 255, 0, 255}, {255, 0, 0, 255}}},
	"DarkLight":      &ColorMap{"DarkLight", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 0, 255}, {250, 250, 250, 255}}},
	"DarkLightDark":  &ColorMap{"DarkLightDark", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 0, 255}, {250, 250, 250, 255}, {0, 0, 0, 255}}},
	"LightDarkLight": &ColorMap{"DarkLightDark", gi.Color{200, 200, 200, 255}, []gi.Color{{250, 250, 250, 255}, {0, 0, 0, 255}, {250, 250, 250, 255}}},
}

StdColorMaps is a list of standard color maps

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 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 TextPosErr = TextPos{-1, -1}

TextPosErr represents an error text position (-1 for both line and char) used as a return value for cases where error positions are possible

View Source
var TextPosZero = TextPos{}

TextPosZero is the uninitialized zero text position (which is still a valid position)

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 TextViewDepthColors = []gi.Color{
	{255, 255, 255, 255},
	{250, 250, 255, 255},
	{240, 240, 255, 255},
	{250, 240, 255, 255},
	{255, 240, 255, 255},
	{255, 240, 240, 255},
	{255, 240, 240, 255},
	{255, 250, 240, 255},
	{255, 255, 240, 255},
}
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":      gi.WhiteSpacePreWrap,
	"font-family":      "Go Mono",
	"border-width":     0,
	"cursor-width":     units.NewPx(3),
	"border-color":     &gi.Prefs.Colors.Border,
	"border-style":     gi.BorderSolid,
	"padding":          units.NewPx(2),
	"margin":           units.NewPx(2),
	"vertical-align":   gi.AlignTop,
	"text-align":       gi.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":       gi.AlignLeft,
	"vertical-align":   gi.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 interface{}, 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 interface{}, 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 interface{}, 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 interface{}, 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 interface{}, 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 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 interface{}, act *gi.Action) string {
	ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView)
	fn := ftv.FileNode()
	label := act.Text
	if fn != nil {
		label = strings.Replace(label, "Vcs", fn.RepoType(), 1)
	}
	return label
})

VcsGetRemoveLabelFunc gets the appropriate label for removing from version control

View Source
var VersCtrlSystems = []string{"Git", "SVN"}

VersCtrlSystems is a list of supported Version Control Systems -- use these names in commands to select commands for the current VCS for this project (i.e., use shortest version of name, typically three letters)

Functions

func ActionView

func ActionView(val interface{}, 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 interface{}, vtyp reflect.Type, vp *gi.Viewport2D, pa *gi.Action, pp interface{}) 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 AvailColorMapsList added in v0.9.8

func AvailColorMapsList() []string

AvailColorMapsList returns a sorted list of color map names, e.g., for choosers

func CallMethod

func CallMethod(val interface{}, 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.

func ColorViewDialog

func ColorViewDialog(avp *gi.Viewport2D, clr gi.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) gi.Color

ColorViewDialogValue gets the color from the dialog

func CompleteEditPi added in v0.9.6

func CompleteEditPi(data interface{}, text string, cursorPos int, comp complete.Completion, seed string) (ed complete.EditData)

CompleteEditPi uses the selected completion to edit the text

func CompletePi added in v0.9.6

func CompletePi(data interface{}, text string, posLn, posCh int) (md complete.MatchData)

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 interface{}, text string, posLn, posCh int) (md complete.MatchData)

CompleteText does completion for text files

func CompleteTextEdit

func CompleteTextEdit(data interface{}, text string, cursorPos int, completion complete.Completion, seed string) (ed complete.EditData)

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 interface{}, 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 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 interface{})

FileNodeBufSigRecv receives a signal from the buffer and updates view accordingly

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 interface{}, 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 interface{}, 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 HasMainMenuView

func HasMainMenuView(val interface{}) 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 interface{}) bool

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

func HasUpperCase

func HasUpperCase(str string) bool

HasUpperCase returns true if string has an upper-case letter

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 interface{}, widg gi.Node2D, row int, vv ValueView)

func KeyMapsView

func KeyMapsView(km *gi.KeyMaps)

KeyMapsView opens a view of a key maps table

func MainMenuView(val interface{}, 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).

func MapViewDialog

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

connects to given signal receiving object and function for dialog signals (nil to ignore)

func MethViewArgDefaultVal

func MethViewArgDefaultVal(md *MethViewData, ai int) (interface{}, bool)

MethViewArgDefaultVal returns the default value of the given argument index

func MethViewCall

func MethViewCall(recv, send ki.Ki, sig int64, data interface{})

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 interface{}, vtyp reflect.Type, vp *gi.Viewport2D, pnm string, pp interface{}) 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 interface{}, 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 interface{}) 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 interface{}, 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 interface{}) (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 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 PrintDiffs

func PrintDiffs(diffs TextDiffs)

PrintDiffs prints out the diffs

func PunctGpMatch added in v0.9.4

func PunctGpMatch(r rune) (match rune, right bool)

PunctGpMatch returns the matching grouping punctuation for given rune, which must be a left or right brace {}, bracket [] or paren () -- also returns true if it is *right*

func QReplaceDialog

func QReplaceDialog(avp *gi.Viewport2D, find string, 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)

QReplaceDialogValues gets the string values

func SliceIdxByValue added in v0.9.8

func SliceIdxByValue(slc interface{}, fldVal interface{}) (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 interface{}, opts DlgOpts, styleFunc SliceViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog

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.

func SliceViewDialogNoStyle added in v0.9.9

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

optionally connects to given signal receiving object and function for dialog signals (nil to ignore). This version does not have the style function.

func SliceViewSelectDialog

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

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.

func SliceViewSelectDialogValue

func SliceViewSelectDialogValue(dlg *gi.Dialog) int

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

func SpellCorrectEdit

func SpellCorrectEdit(data interface{}, nwstr string, old string) (ed spell.EditData)

SpellCorrectEdit uses the selected correction to edit the text

func SrcNodeSignal

func SrcNodeSignal(tvki, send ki.Ki, sig int64, data interface{})

SrcNodeSignal is the function for receiving node signals from our SrcNode

func StructFieldIsDef added in v0.9.8

func StructFieldIsDef(defs string, valPtr interface{}) (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

func StructNonDefFieldsStr added in v0.9.8

func StructNonDefFieldsStr(structPtr interface{}, 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 interface{}, fldName string, fldVal interface{}) (int, error)

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

func StructViewDialog

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

optionally connects to given signal receiving object and function for dialog signals (nil to ignore)

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 TableViewDialog

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

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.

func TableViewSelectDialog

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

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.

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, sbufki ki.Ki, sig int64, data interface{})

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 TextViewDialog added in v0.9.8

func TextViewDialog(avp *gi.Viewport2D, text []byte, opts DlgOpts)

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 ToolBarView

func ToolBarView(val interface{}, 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 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 interface{}, 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 AdjustPosDel

type AdjustPosDel int

AdjustPosDel determines what to do with positions within deleted region

const (
	// AdjustPosDelErr means return a TextPosErr when in deleted region
	AdjustPosDelErr AdjustPosDel = iota

	// AdjustPosDelStart means return start of deleted region
	AdjustPosDelStart

	// AdjustPosDelEnd means return end of deleted region
	AdjustPosDelEnd
)

these are options for what to do with positions within deleted region for the AdjustPos function

type ArgData

type ArgData struct {
	Val     reflect.Value
	Name    string
	Desc    string
	View    ValueView
	Default interface{}
	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 ColorMap added in v0.9.8

type ColorMap struct {
	Name    string
	NoColor gi.Color   `desc:"color to display for invalid numbers (e.g., NaN)"`
	Colors  []gi.Color `desc:"list of colors to interpolate between"`
}

ColorMap maps a value onto a color by interpolating between a list of colors defining a spectrum

func (*ColorMap) Map added in v0.9.8

func (cm *ColorMap) Map(val float64) gi.Color

Map returns color for normalized value in range 0-1. NaN returns NoColor which can be used to indicate missing values.

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      gi.Dims2D `desc:"orientation along which to display the spectrum"`
	Map         *ColorMap `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) *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)

SetColorMap sets the color map and triggers a display update

func (*ColorMapView) SetColorMapAction added in v0.9.8

func (cv *ColorMapView) SetColorMapAction(cmap *ColorMap)

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 gi.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() (*gi.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 gi.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    gi.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 */
	ViewPath string    `` /* 134-byte string literal not displayed */
}

ColorView shows a color, using sliders 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) ConfigLabel

func (cv *ColorView) ConfigLabel(lab *gi.Label, txt string)

func (*ColorView) ConfigRGBSlider

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

func (*ColorView) ConfigSliderGrid

func (cv *ColorView) ConfigSliderGrid()

ConfigSliderGrid configures the SliderGrid

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) NumLayConfig

func (cv *ColorView) NumLayConfig()

NumLayConfig configures the numerical 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) SliderLayConfig

func (cv *ColorView) SliderLayConfig()

SliderLayConfig configures the sliders layout

func (*ColorView) Update

func (cv *ColorView) Update()

func (*ColorView) UpdateHSLSlider

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

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 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"`
}

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 interface{}) 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"` // tableview:"no-header"
	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"`
	Path    string            `view:"-" 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 retuns 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 (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 returns the proposed path or the new full path

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       `desc:"full path to this file"`
	Info     FileInfo          `desc:"full standard file info about this file"`
	Buf      *TextBuf          `json:"-" xml:"-" desc:"file buffer for editing this file"`
	FRoot    *FileTree         `json:"-" xml:"-" desc:"root of the tree -- has global state"`
	VcsState FileNodeVcsStates `json:"-" xml:"-" desc:"status of file in regards to version control"`
}

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) CloseBuf

func (fn *FileNode) CloseBuf() bool

CloseBuf closes the file in its buffer if it is open -- returns true if 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) CopyFileToDir

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

CopyFileToDir copies given file path into node that is a directory prompts before overwriting any existing

func (*FileNode) CopyFileToFile

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

CopyFileToFile copies given file path into node that is an existing file prompts before doing so

func (*FileNode) DeleteFile

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

DeleteFile deletes this file

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() []FileNodeNameCount

FileExtCounts returns a count of all the different file extensions, sorted from highest to lowest

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) 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) 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) 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) 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) 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) OpenDirsTo

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

OpenDirsTo 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) 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) RemoveFromVcs added in v0.9.5

func (fn *FileNode) RemoveFromVcs()

RemoveFromVcs removes file from version control

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

VcsRepo

func (*FileNode) RepoType added in v0.9.5

func (fn *FileNode) RepoType() string

VcsRepoType

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) UpdateNode

func (fn *FileNode) UpdateNode() error

UpdateNode updates information in node based on its associated file in FPath

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 FileNodeVcsStates added in v0.9.6

type FileNodeVcsStates int32

FileNodeVcsStates are the possible version control states for a file

const (
	// FileNodeNotInVcs means that the project files are using version control but
	// this file is not in the repository
	FileNodeNotInVcs FileNodeVcsStates = iota

	// FileNodeVcsAdded means the file has been marked to add when a commit is done
	FileNodeVcsAdded

	// FileNodeInVcs means the file is in the repository and unmodified compared to last commit
	FileNodeInVcs

	// FileNodeVcsModified means the file is in the repository and modified since last commit
	FileNodeVcsModified

	// FileNodeVcsStatesN is the number of FileNodeVcsStates
	FileNodeVcsStatesN
)

func (*FileNodeVcsStates) FromString added in v0.9.6

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

func (FileNodeVcsStates) String added in v0.9.6

func (i FileNodeVcsStates) String() string

type FileSearchMatch

type FileSearchMatch struct {
	Reg  TextRegion `desc:"region surrounding the match"`
	Text []byte     `desc:"text surrounding the match, at most FileSearchContext on either side (within a single line)"`
}

FileSearchMatch records one match for search within file

func ByteBufSearch

func ByteBufSearch(reader io.Reader, find []byte, ignoreCase bool) (int, []FileSearchMatch)

ByteBufSearch looks for a string (no regexp) within a byte buffer, with given case-sensitivity, returning number of occurrences and specific match position list -- column positions are in runes

func FileSearch

func FileSearch(filename string, find []byte, ignoreCase bool) (int, []FileSearchMatch)

FileSearch looks for a string (no regexp) within a file, in a case-sensitive way, returning number of occurrences and specific match position list -- column positions are in bytes, not runes.

func NewFileSearchMatch added in v0.9.4

func NewFileSearchMatch(rn []rune, st, ed, ln int) FileSearchMatch

NewFileSearchMatch returns a new FileSearchMatch entry for given rune line with match starting at st and ending before ed, on given line

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
	OpenDirs  OpenDirMap   `` /* 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 alpha sorted"`
	NodeType  reflect.Type `view:"-" json:"-" xml:"-" desc:"type of node to create -- defaults to giv.FileNode but can use custom node types"`
	Repo      vci.Repo     `view:"-" json:"-" xml:"-" desc:"interface for version control system calls"`
	RepoType  string       `desc:"the repository type, git, svn, etc cached for performance"`
}

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) 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 OpenDirs will be opened.

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) 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

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) CommitToVcs added in v0.9.5

func (ftv *FileTreeView) CommitToVcs()

CommitToVcs removes 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) 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) 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) 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) OpenDirs

func (ftv *FileTreeView) OpenDirs()

OpenDirs

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) 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) RemoveFromVcs added in v0.9.5

func (ftv *FileTreeView) RemoveFromVcs()

RemoveFromVcs removes the file from version control system

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) Style2D

func (ft *FileTreeView) Style2D()

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"`
}

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) ConfigPathRow

func (fv *FileView) ConfigPathRow()

func (*FileView) ConfigSelRow

func (fv *FileView) ConfigSelRow()

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 interface{}, text string, posLn, posCh int) (md complete.MatchData)

FileComplete finds the possible completions for the file field

func (*FileView) FileCompleteEdit

func (fv *FileView) FileCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, seed string) (ed complete.EditData)

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 interface{}, path string, posLn, posCh int) (md complete.MatchData)

PathComplete finds the possible completions for the path field

func (*FileView) PathCompleteEdit

func (fv *FileView) PathCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, seed string) (ed complete.EditData)

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..

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    histyle.StyleName `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.FileState     `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 []byte) (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.FileState)

Init initializes the syntax highlighting for current params

func (*HiMarkup) MarkupLine

func (hm *HiMarkup) MarkupLine(txt []byte, 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 []byte) (lex.Line, error)

MarkupTagsLine returns tags for one line according to current syntax highlighting 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 histyle.StyleName 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  []FileSearchMatch `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 TextPos           `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 interface{}, 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        interface{} `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 */
	ViewPath   string      `` /* 134-byte string literal not displayed */
	ToolbarMap interface{} `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.

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 interface{} 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 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 (*MapView) SetMap

func (mv *MapView) SetMap(mp interface{})

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        interface{} `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 interface{})

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 MethViewData

type MethViewData struct {
	Val          interface{}
	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 interface{}      `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"`
	SubMenuVal   interface{}      `` /* 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) 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 OpenDirMap

type OpenDirMap map[string]bool

OpenDirMap 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.

func (*OpenDirMap) ClearFlags

func (dm *OpenDirMap) ClearFlags()

ClearFlags sets all the bool flags to false -- do this prior to traversing full set of active paths -- can then call RemoveStale to get rid of unused paths

func (*OpenDirMap) Init

func (dm *OpenDirMap) Init()

Init initializes the map

func (*OpenDirMap) IsOpen

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

IsOpen returns true if path is listed on the open map

func (*OpenDirMap) RemoveStale

func (dm *OpenDirMap) RemoveStale()

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

func (*OpenDirMap) SetClosed

func (dm *OpenDirMap) SetClosed(path string)

SetClosed removes given path from the open map

func (*OpenDirMap) SetOpen

func (dm *OpenDirMap) SetOpen(path string)

SetOpen adds the given path to the open map

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"`
	Matches  []FileSearchMatch `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 TextPos           `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 interface{}, 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        interface{}   `copy:"-" view:"-" json:"-" xml:"-" desc:"the slice that we are a view onto -- must be a pointer to that slice"`
	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           interface{}      `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"`
	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 interactive editing signals"`
	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     interface{}      `copy:"-" view:"-" json:"-" xml:"-" desc:"the slice that we successfully set a toolbar for"`

	SliceSize    int     `view:"inactive" copy:"-" json:"-" xml:"-" desc:"size of slice"`
	DispRows     int     `view:"inactive" copy:"-" json:"-" xml:"-" desc:"actual number of rows displayed = min(VisRows, SliceSize)"`
	StartIdx     int     `view:"inactive" copy:"-" json:"-" xml:"-" desc:"starting slice index of visible rows"`
	RowHeight    float32 `view:"inactive" copy:"-" json:"-" xml:"-" desc:"height of a single row"`
	VisRows      int     `view:"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"`
	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.

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) []interface{}

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) 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 interface{}, 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 interface{}, 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) 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) 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 interface{})

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) 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) 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) SliceVal added in v0.9.8

func (sv *SliceViewBase) SliceVal(idx int) interface{}

SliceVal returns value interface at given slice index

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)

UpdateSelectRow 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) 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

type SliceViewInline

type SliceViewInline struct {
	gi.PartsWidgetBase
	Slice        interface{} `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 interface{})

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 int64

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

	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 interface{}, 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()

	// 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)
}

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 interface{}, 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        interface{}    `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   interface{}    `desc:"the struct that we successfully set a toolbar for"`
	HasDefs       bool           `json:"-" xml:"-" view:"inactive" desc:"if true, some fields have default values -- update labels when values change"`
}

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.

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) 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 interface{})

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) UpdateDefaults added in v0.9.8

func (sv *StructView) UpdateDefaults()

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) 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        interface{} `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"`
}

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 interface{})

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

func (*StructViewInline) UpdateDefaults added in v0.9.8

func (sv *StructViewInline) UpdateDefaults()

func (*StructViewInline) UpdateFields

func (sv *StructViewInline) UpdateFields()
type SubMenuFunc func(it interface{}, 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 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"`
	NVisFields int                   `copy:"-" view:"-" json:"-" xml:"-" desc:"number of visible fields"`
	VisFields  []reflect.StructField `copy:"-" view:"-" json:"-" xml:"-" desc:"the 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

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) 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 interface{})

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

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) 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 interface{}, 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         TextBufOpts      `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.FileState     `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"`
	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 */
	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"`
	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        []*TextBufEdit   `json:"-" xml:"-" desc:"undo stack of edits"`
	UndoUndos    []*TextBufEdit   `json:"-" xml:"-" desc:"undo stack of *undo* edits -- added to "`
	UndoPos      int              `json:"-" xml:"-" desc:"undo position"`
	PosHistory   []TextPos        `json:"-" xml:"-" desc:"history of cursor positions -- can move back through them"`
	Complete     *gi.Complete     `json:"-" xml:"-" desc:"functions and data for text completion"`
	SpellCorrect *gi.SpellCorrect `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 *TextBufEdit, tag token.Tokens)

AddTagEdit adds a new custom tag for given line, using TextBufEdit 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 TextPos, t time.Time, del AdjustPosDel) TextPos

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 TextRegion) TextRegion

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 TextRegionNil 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

func (*TextBuf) AppendText

func (tb *TextBuf) AppendText(text []byte, saveUndo, signal bool) *TextBufEdit

AppendText appends new text to end of buffer, using insert, returns edit

func (*TextBuf) AppendTextLine

func (tb *TextBuf) AppendTextLine(text []byte, saveUndo, signal bool) *TextBufEdit

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, saveUndo, signal bool) *TextBufEdit

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, saveUndo, signal bool) *TextBufEdit

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, indents, unindents []string) (tbe *TextBufEdit, 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. Will have to be replaced with a smarter parsing-based mechanism for indent / unindent but this will do for now. 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, indents, unindents []string)

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) 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)

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) DeleteText

func (tb *TextBuf) DeleteText(st, ed TextPos, saveUndo, signal bool) *TextBufEdit

DeleteText deletes region of text between start and end positions, signaling views after text lines have been updated. Sets the timestamp on resulting TextBufEdit to now

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) TextDiffs

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 if EmacsUndo mode is active, saves the UndoUndos 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() TextPos

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) FindScopeMatch added in v0.9.4

func (tb *TextBuf) FindScopeMatch(r rune, st TextPos) (en TextPos, found bool)

FindScopeMatch finds the brace or parenthesis that is the partner of the one passed to function

func (*TextBuf) InComment added in v0.9.4

func (tb *TextBuf) InComment(pos TextPos) bool

InComment returns true if the given text position is within a commented region

func (*TextBuf) IndentLine

func (tb *TextBuf) IndentLine(ln, n int) *TextBufEdit

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

func (*TextBuf) InsertText

func (tb *TextBuf) InsertText(st TextPos, text []byte, saveUndo, signal bool) *TextBufEdit

Insert inserts new text at given starting position, signaling views after text has been inserted. Sets the timestamp on resulting TextBufEdit to now

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) IsSpellCorrectEnabled added in v0.9.4

func (tb *TextBuf) IsSpellCorrectEnabled(pos TextPos) bool

IsSpellCorrectEnabled 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) 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) LineIndent

func (tb *TextBuf) LineIndent(ln int, tabSz int) (n int, ichr indent.Char)

LineIndent returns the number of tabs or spaces at start of given line -- if line starts with tabs, then those are counted, else spaces -- combinations of tabs and spaces won't produce sensible results

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 *TextBufEdit)

LinesDeleted deletes lines in Markup corresponding to lines deleted in Lines text. Locks and unlocks the Markup mutex.

func (*TextBuf) LinesEdited

func (tb *TextBuf) LinesEdited(tbe *TextBufEdit)

LinesEdited re-marks-up lines in edit (typically only 1). Locks and unlocks the Markup mutex.

func (*TextBuf) LinesInserted

func (tb *TextBuf) LinesInserted(tbe *TextBufEdit)

LinesInserted inserts new lines in Markup corresponding to lines inserted in Lines text. Locks and unlocks the Markup 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()

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

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) 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 TextDiffs, 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) PrevLineIndent

func (tb *TextBuf) PrevLineIndent(ln int) (n int, ichr indent.Char, txt string)

PrevLineIndent returns previous line from given line that has indentation -- skips blank lines

func (*TextBuf) ReMarkup

func (tb *TextBuf) ReMarkup()

ReMarkup runs re-markup on text in background

func (*TextBuf) Redo

func (tb *TextBuf) Redo() *TextBufEdit

Redo redoes next item on the undo stack, and returns that 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 TextPos) *TextBufEdit

Region returns a TextBufEdit representation of text between start and end positions returns nil if not a valid region. sets the timestamp on the TextBufEdit to now

func (*TextBuf) RemoveTag

func (tb *TextBuf) RemoveTag(pos TextPos, 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) 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 TextPos) 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 *TextBufEdit)

SaveUndo saves given edit to undo stack

func (*TextBuf) Search

func (tb *TextBuf) Search(find []byte, ignoreCase bool) (int, []FileSearchMatch)

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) 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 interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc)

SetCompleter sets completion functions so that completions will automatically be offered as the user types

func (*TextBuf) SetHiStyle

func (tb *TextBuf) SetHiStyle(style histyle.StyleName)

SetHiStyle sets the highlighting style -- needs to be protected by mutex

func (*TextBuf) SetSpellCorrect

func (tb *TextBuf) SetSpellCorrect(data interface{}, editFun spell.EditFunc)

SetSpellCorrect 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) Stat

func (tb *TextBuf) Stat() error

Stat gets info about the file, including highlighting language

func (*TextBuf) TagAt

func (tb *TextBuf) TagAt(pos TextPos) (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() *TextBufEdit

Undo undoes next item on the undo stack, and returns that record -- nil if no more

func (*TextBuf) ValidPos

func (tb *TextBuf) ValidPos(pos TextPos) TextPos

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 TextBufEdit

type TextBufEdit struct {
	Reg    TextRegion `` /* 198-byte string literal not displayed */
	Delete bool       `desc:"action is either a deletion or an insertion"`
	Text   [][]rune   `desc:"text to be inserted"`
}

TextBufEdit describes an edit action to a buffer -- this is the data passed via signals to viewers of the buffer. Actions are only deletions and insertions (a change is a sequence of those, given normal editing processes). The TextBuf always reflects the current state *after* the edit.

func (*TextBufEdit) AdjustPos

func (te *TextBufEdit) AdjustPos(pos TextPos, del AdjustPosDel) TextPos

AdjustPos adjusts the given text position as a function of the edit. if the position was within a deleted region of text, del determines what is returned

func (*TextBufEdit) AdjustPosIfAfterTime

func (te *TextBufEdit) AdjustPosIfAfterTime(pos TextPos, t time.Time, del AdjustPosDel) TextPos

AdjustPosIfAfterTime checks the time stamp and IfAfterTime, it adjusts the given text position as a function of the edit 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 (*TextBufEdit) AdjustReg

func (te *TextBufEdit) AdjustReg(reg TextRegion) TextRegion

AdjustReg adjusts the given text region as a function of the edit, including checking that the timestamp on the region is after the edit time, if the region has a valid Time stamp (otherwise always does adjustment). If the starting position is within a deleted region, it is moved to the end of the deleted region, and if the ending position was within a deleted region, it is moved to the start. If the region becomes empty, TextRegionNil will be returned.

func (*TextBufEdit) ToBytes

func (te *TextBufEdit) ToBytes() []byte

ToBytes returns the Text of this edit record to a byte string, with newlines at end of each line -- nil if Text is empty

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 TextBufOpts

type TextBufOpts struct {
	SpaceIndent  bool   `` /* 127-byte string literal not displayed */
	TabSize      int    `desc:"size of a tab, in chars -- also determines indent level for space indent"`
	AutoIndent   bool   `desc:"auto-indent on newline (enter) or tab"`
	LineNos      bool   `desc:"show line numbers at left end of editor"`
	Completion   bool   `desc:"use the completion system to suggest options while typing"`
	SpellCorrect bool   `desc:"use spell checking to suggest corrections while typing"`
	EmacsUndo    bool   `` /* 165-byte string literal not displayed */
	DepthColor   bool   `desc:"colorize the background according to nesting depth"`
	CommentLn    string `desc:"character(s) that start a single-line comment -- if empty then multi-line comment syntax will be used"`
	CommentSt    string `desc:"character(s) that start a multi-line comment or one that requires both start and end"`
	CommentEd    string `desc:"character(s) that end a multi-line comment or one that requires both start and end"`
}

TextBufOpts contains options for TextBufs -- contains everything necessary to conditionalize editing of a given text file

func (*TextBufOpts) CommentStrs added in v0.9.4

func (tb *TextBufOpts) CommentStrs() (comst, comed string)

CommentStrs returns the comment start and end strings, using line-based CommentLn first if set and falling back on multi-line / general purpose start / end syntax

func (*TextBufOpts) ConfigSupported added in v0.9.4

func (tb *TextBufOpts) ConfigSupported(sup filecat.Supported) bool

ConfigSupported configures options based on the supported language info in GoPi returns true if supported

func (*TextBufOpts) IndentChar added in v0.9.4

func (tb *TextBufOpts) IndentChar() indent.Char

IndentChar returns the indent character based on SpaceIndent option

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
	// TextBufEdit describing change -- the TextBuf always reflects the
	// current state *after* the edit.
	TextBufInsert

	// TextBufDelete signals that some text was deleted -- data is
	// TextBufEdit 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

	TextBufSignalsN
)

func (*TextBufSignals) FromString

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

func (TextBufSignals) String

func (i TextBufSignals) String() string

type TextDiffs

type TextDiffs []difflib.OpCode

TextDiffs are raw differences between text, in terms of lines, reporting a sequence of operations that would convert one buffer (a) into the other buffer (b). Each operation is either an 'r' (replace), 'd' (delete), 'i' (insert) or 'e' (equal).

type TextPos

type TextPos struct {
	Ln, Ch int
}

TextPos represents line, character positions within the TextBuf and TextView the Ch character position is in *runes* not bytes!

func (*TextPos) FromString

func (tp *TextPos) FromString(link string) bool

FromString decodes text position from a string representation of form: [#]LxxCxx -- used in e.g., URL links -- returns true if successful

func (*TextPos) IsLess

func (tp *TextPos) IsLess(cmp TextPos) bool

IsLess returns true if receiver position is less than given comparison

type TextRegion

type TextRegion struct {
	Start TextPos
	End   TextPos
	Time  nptime.Time `` /* 131-byte string literal not displayed */
}

TextRegion represents a text region as a start / end position, and includes a Time stamp for when the region was created as valid positions into the TextBuf. The character end position is an *exclusive* position (i.e., the region ends at the character just prior to that character) but the lines are always *inclusive* (i.e., it is the actual line, not the next line).

var TextRegionNil TextRegion

TextRegionNil is the empty (zero) text region -- all zeros

func NewTextRegion

func NewTextRegion(stLn, stCh, edLn, edCh int) TextRegion

NewTextRegion creates a new text region using separate line and char values for start and end, and also sets the time stamp to now

func NewTextRegionLen

func NewTextRegionLen(start TextPos, len int) TextRegion

NewTextRegionLen makes a new TextRegion from a starting point and a length along same line

func NewTextRegionPos

func NewTextRegionPos(st, ed TextPos) TextRegion

NewTextRegionPos creates a new text region using position values and also sets the time stamp to now

func (*TextRegion) FromString

func (tr *TextRegion) FromString(link string) bool

FromString decodes text region from a string representation of form: [#]LxxCxx-LxxCxx -- used in e.g., URL links -- returns true if successful

func (*TextRegion) IsAfterTime

func (tr *TextRegion) IsAfterTime(t time.Time) bool

IsAfterTime reports if this region's time stamp is after given time value if region Time stamp has not been set, it always returns true

func (*TextRegion) IsNil

func (tr *TextRegion) IsNil() bool

IsNil checks if the region is empty, because the start is after or equal to the end

func (*TextRegion) TimeNow

func (tr *TextRegion) TimeNow()

TimeNow grabs the current time as the edit time

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)"`
	LineIcons     map[int]gi.IconName       `desc:"icons for each line -- use SetLineIcon and DeleteLineIcon"`
	NLines        int                       `` /* 135-byte string literal not displayed */
	Renders       []gi.TextRender           `` /* 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  gi.TextRender             `json:"-" xml:"-" desc:"render for line numbers"`
	LinesSize     image.Point               `json:"-" xml:"-" desc:"total size of all lines as rendered"`
	RenderSz      gi.Vec2D                  `json:"-" xml:"-" desc:"size params to use in render call"`
	CursorPos     TextPos                   `json:"-" xml:"-" desc:"current cursor position"`
	CursorCol     int                       `` /* 179-byte string literal not displayed */
	CorrectPos    TextPos                   `` /* 153-byte string literal not displayed */
	PosHistIdx    int                       `json:"-" xml:"-" desc:"current index within PosHistory"`
	SelectStart   TextPos                   `` /* 141-byte string literal not displayed */
	SelectReg     TextRegion                `json:"-" xml:"-" desc:"current selection region"`
	PrevSelectReg TextRegion                `json:"-" xml:"-" desc:"previous selection region, that was actually rendered -- needed to update render"`
	Highlights    []TextRegion              `json:"-" xml:"-" desc:"highlighted regions, e.g., for search results"`
	Scopelights   []TextRegion              `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]gi.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 (*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 TextPos) gi.Vec2D

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 TextPos) gi.Vec2D

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) *TextBufEdit

Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection

func (*TextView) CursorBBox

func (tv *TextView) CursorBBox(pos TextPos) 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 TextPos)

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) 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) CursorUp

func (tv *TextView) CursorUp(steps int)

CursorUp moves the cursor up line(s)

func (*TextView) Cut

func (tv *TextView) Cut() *TextBufEdit

Cut cuts any selected text and adds it to the clipboard, also returns cut text

func (*TextView) DeleteSelection

func (tv *TextView) DeleteSelection() *TextBufEdit

DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted as TextBufEdit (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 bool) ([]FileSearchMatch, 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 TextPos) (TextPos, TextRegion, bool)

FindNextLink finds next link after given position, returns false if no such links

func (tv *TextView) FindPrevLink(pos TextPos) (TextPos, TextRegion, 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 TextRegion)

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 TextPos) 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) IsWordBreak

func (tv *TextView) IsWordBreak(r1, r2 rune) bool

IsWordBreak defines what counts as a word break for the purposes of selecting words r1 is the rune in question, r2 is the rune past r1 in the direction you are moving Pass rune(-1) for r2 if there is no rune past r1

func (*TextView) IsWordEnd

func (tv *TextView) IsWordEnd(tp TextPos) 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 TextPos) 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 TextPos) 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) KeyInputInsertRune added in v0.9.4

func (tv *TextView) KeyInputInsertRune(kt *key.ChordEvent)

KeyInputInsertRune handles the insertion of a typed character

func (*TextView) Label

func (tv *TextView) Label() string

Label returns the display label for this node, satisfying the Labeler interface

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 *TextBufEdit)

LinesDeleted deletes lines of text and reformats remaining one

func (*TextView) LinesInserted

func (tv *TextView) LinesInserted(tbe *TextBufEdit)

LinesInserted inserts new lines of text and reformats them

func (*TextView) LinkAt

func (tv *TextView) LinkAt(pos TextPos) (*gi.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) MakeContextMenu

func (tv *TextView) MakeContextMenu(m *gi.Menu)

MakeContextMenu builds the textview context menu

func (*TextView) MatchFromPos

func (tv *TextView) MatchFromPos(matches []FileSearchMatch, cpos TextPos) (int, bool)

MatchFromPos finds the match at or after the given text position -- returns 0, false if none

func (*TextView) MouseEvent

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

MouseEvent handles the mouse.Event

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 *gi.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 TextPos) (*gi.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) PixelToCursor

func (tv *TextView) PixelToCursor(pt image.Point) TextPos

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)

QReplaceStart starts query-replace using given find, replace strings

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)

RenderLineNo renders given line number -- called within context of other render

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 TextRegion, 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 TextRegion, sty *gi.Style, bgclr *gi.ColorSpec)

RenderRegionBoxSty renders a region in given style and background color

func (*TextView) RenderRegionToEnd added in v0.9.4

func (tv *TextView) RenderRegionToEnd(st TextPos, sty *gi.Style, bgclr *gi.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() gi.Vec2D

RenderSize is the size we should pass to text rendering, based on alloc

func (*TextView) RenderStartPos

func (tv *TextView) RenderStartPos() gi.Vec2D

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 TextPos)

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 TextPos)

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() *TextBufEdit

Selection returns the currently selected text as a TextBufEdit, 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 TextPos)

SetCursor sets a new cursor position, enforcing it in range

func (*TextView) SetCursorCol

func (tv *TextView) SetCursorCol(pos TextPos)

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 TextPos, selMode mouse.SelectModes)

SetCursorFromMouse sets cursor position from mouse mouse action -- handles the selection updating etc.

func (*TextView) SetCursorShow

func (tv *TextView) SetCursorShow(pos TextPos)

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 TextRegionNil

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(region *TextBufEdit) 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 []TextRegion)

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() (region TextRegion)

WordAt finds the region of the word at the current cursor position

func (*TextView) WordBefore

func (tv *TextView) WordBefore(tp TextPos) *TextBufEdit

WordBefore returns the word before the TextPos uses IsWordBreak to determine the bounds of the word

func (*TextView) WrappedLineNo

func (tv *TextView) WrappedLineNo(pos TextPos) (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 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"`
	TreeViewSig      ki.Signal                 `` /* 157-byte string literal not displayed */
	StateStyles      [TreeViewStatesN]gi.Style `` /* 217-byte string literal not displayed */
	WidgetSize       gi.Vec2D                  `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.

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) CopyAction

func (tv *TreeView) CopyAction(reset bool)

CopyAction copies to clip.Board, optionally resetting the selection-- calls Clipper copy

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) CutAction

func (tv *TreeView) CutAction()

CutAction copies to clip.Board and deletes selected items -- calls Clipper cut

func (*TreeView) Disconnect added in v0.9.8

func (tv *TreeView) Disconnect()

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) DragNDropSource

func (tv *TreeView) DragNDropSource(de *dnd.Event)

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

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) 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 interface{}, 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 interface{})

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 PathUnique, and an application/json of the source node

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

NodesFromMimeData creates a slice of Ki node(s) from given mime data

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) Paste

func (tv *TreeView) Paste()

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

func (*TreeView) PasteAction

func (tv *TreeView) PasteAction()

PasteAction pastes clipboard at given node -- calls Clipper paste

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) 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

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)

SetSrcNode sets the source node that we are viewing, and builds-out the view of its tree

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)

SyncToSrc updates the view tree to match the source tree, using ConfigChildren to maximally preserve existing tree elements

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 TreeVi
	TreeViewFlagChanged

	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

	// TreeViewChanged 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

	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 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 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 interface{}, field *reflect.StructField, tmpSave ValueView, viewPath string)

	// SetMapKey sets the key value and owner for a map key.
	SetMapKey(val reflect.Value, owner interface{}, 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 interface{}, key interface{}, keyView ValueView, tmpSave ValueView, viewPath string)

	// SetSliceValue sets the value, owner and index information for a slice element.
	SetSliceValue(val reflect.Value, owner interface{}, 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 interface{}) 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 interface{}, field string, fval interface{}) 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)

func ToValueView

func ToValueView(it interface{}, 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.

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     interface{}          `` /* 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       interface{}          `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 interface{}, tmpSave ValueView)

func (*ValueViewBase) SetMapValue

func (vv *ValueViewBase) SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, tmpSave ValueView, viewPath string)

func (*ValueViewBase) SetSliceValue

func (vv *ValueViewBase) SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView, viewPath string)

func (*ValueViewBase) SetSoloValue added in v0.9.10

func (vv *ValueViewBase) SetSoloValue(val reflect.Value)

func (*ValueViewBase) SetStructValue

func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner interface{}, 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 interface{}) 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 interface{}, inactive bool, vp *gi.Viewport2D, menu *gi.Menu) bool

func (*ViewIFace) GoGiEditor

func (vi *ViewIFace) GoGiEditor(obj ki.Ki)

func (*ViewIFace) HiStylesView

func (vi *ViewIFace) HiStylesView(styles interface{})

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL