giv

package
v2.0.0-dev0.0.28 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: BSD-3-Clause Imports: 56 Imported by: 20

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 Value framework allows for easy customization and extension of the GUI representation, based on the classic Go "Stringer"-like interface paradigm -- simply define a Value() method on any type, returning giv.Value that manages the interface between data structures and GUI representations.

See the wiki at: https://goki.dev/gi/v2/wiki/Views for more extensive docs.

Some of the most important view elements are:

Value

The Value 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 Inspector which will show you ample examples of the Value 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 ReadOnly, 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 TreeViewTempMovedTag = `_\&MOVED\&`

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

Variables

View Source
var (
	// MapInlineLen is the number of map elements at or below which an inline
	// representation of the map will be presented -- more convenient for small
	// numbers of properties
	MapInlineLen = 2

	// 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
	StructInlineLen = 4

	// SliceInlineLen is the number of slice elements at or below which inline will be used
	SliceInlineLen = 4
)
View Source
var ArgViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.ArgView",
	ShortName:  "giv.ArgView",
	IDName:     "arg-view",
	Doc:        "ArgView represents a slice of reflect.Value's and associated names, for the\npurpose of supplying arguments to methods called via the MethodView\nframework.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Title", &gti.Field{Name: "Title", Type: "string", LocalType: "string", Doc: "title / prompt to show above the editor fields", Directives: gti.Directives{}, Tag: ""}},
		{"Args", &gti.Field{Name: "Args", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "the args that we are a view onto", Directives: gti.Directives{}, Tag: ""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &ArgView{},
})

ArgViewType is the gti.Type for ArgView

View Source
var ColorViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.ColorView",
	ShortName:  "giv.ColorView",
	IDName:     "color-view",
	Doc:        "ColorView shows a color, using sliders or numbers to set values.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Color", &gti.Field{Name: "Color", Type: "goki.dev/cam/hct.HCT", LocalType: "hct.HCT", Doc: "the color that we view", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &ColorView{},
})

ColorViewType is the gti.Type for ColorView

View Source
var DateViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.DateView",
	ShortName:  "giv.DateView",
	IDName:     "date-view",
	Doc:        "DateView is a view for selecting a date",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Time", &gti.Field{Name: "Time", Type: "time.Time", LocalType: "time.Time", Doc: "the time that we are viewing", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change\nis made to one of the underlying values.\npass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view\ndisplayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
		{"ConfigTime", &gti.Field{Name: "ConfigTime", Type: "time.Time", LocalType: "time.Time", Doc: "ConfigTime is the time that was configured", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &DateView{},
})

DateViewType is the gti.Type for DateView

View Source
var FileViewKindColorMap = map[string]string{
	"folder": "pref(link)",
}

STYTODO: get rid of this or make it use actual color values FileViewKindColorMap translates file Kinds into different colors for the file viewer

View Source
var FileViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.FileView",
	ShortName:  "giv.FileView",
	IDName:     "file-view",
	Doc:        "FileView is a viewer onto files -- core of the file chooser dialog",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"DirPath", &gti.Field{Name: "DirPath", Type: "string", LocalType: "string", Doc: "path to directory of files to display", Directives: gti.Directives{}, Tag: ""}},
		{"SelFile", &gti.Field{Name: "SelFile", Type: "string", LocalType: "string", Doc: "selected file", Directives: gti.Directives{}, Tag: ""}},
		{"Ext", &gti.Field{Name: "Ext", Type: "string", LocalType: "string", Doc: "target extension(s) (comma separated if multiple, including initial .), if any", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"FilterFunc", &gti.Field{Name: "FilterFunc", Type: "goki.dev/gi/v2/giv.FileViewFilterFunc", LocalType: "FileViewFilterFunc", Doc: "optional styling function", Directives: gti.Directives{}, Tag: "view:\"-\" json:\"-\" xml:\"-\""}},
		{"ExtMap", &gti.Field{Name: "ExtMap", Type: "map[string]string", LocalType: "map[string]string", Doc: "map of lower-cased extensions from Ext -- used for highlighting files with one of these extensions -- maps onto original ext value", Directives: gti.Directives{}, Tag: ""}},
		{"Files", &gti.Field{Name: "Files", Type: "[]*goki.dev/fi.FileInfo", LocalType: "[]*fi.FileInfo", Doc: "files for current directory", Directives: gti.Directives{}, Tag: ""}},
		{"SelectedIdx", &gti.Field{Name: "SelectedIdx", Type: "int", LocalType: "int", Doc: "index of currently-selected file in Files list (-1 if none)", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\""}},
		{"SelectedDoubleClick", &gti.Field{Name: "SelectedDoubleClick", Type: "bool", LocalType: "bool", Doc: "set to true if a file was selected via double-click,\nwhich can then be a signal to dialogs to accept.", Directives: gti.Directives{}, Tag: ""}},
		{"Watcher", &gti.Field{Name: "Watcher", Type: "*github.com/fsnotify/fsnotify.Watcher", LocalType: "*fsnotify.Watcher", Doc: "change notify for current dir", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\""}},
		{"DoneWatcher", &gti.Field{Name: "DoneWatcher", Type: "chan bool", LocalType: "chan bool", Doc: "channel to close watcher watcher", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\""}},
		{"UpdtMu", &gti.Field{Name: "UpdtMu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "UpdateFiles mutex", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\""}},
		{"PrevPath", &gti.Field{Name: "PrevPath", Type: "string", LocalType: "string", Doc: "Previous path that was processed via UpdateFiles", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &FileView{},
})

FileViewType is the gti.Type for FileView

View Source
var FontChooserSize = units.Pt(18)

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

View Source
var FuncButtonType = gti.AddType(&gti.Type{
	Name:      "goki.dev/gi/v2/giv.FuncButton",
	ShortName: "giv.FuncButton",
	IDName:    "func-button",
	Doc:       "FuncButton is a button that is set up to call a function when it\nis pressed, using a dialog to prompt the user for any arguments.\nAlso, it automatically sets various properties of the button like\nthe name, text, tooltip, and icon based on the properties of the\nfunction, using reflect and gti. The function must be registered\nwith gti to get documentation information, but that is not required;\nadd a `//gti:add` comment directive and run `goki generate`\nif you want tooltips. If the function is a method, both the method and\nits receiver type must be added to gti to get documentation.",
	Directives: gti.Directives{
		&gti.Directive{Tool: "goki", Directive: "no-new", Args: []string{}},
	},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Func", &gti.Field{Name: "Func", Type: "*goki.dev/gti.Func", LocalType: "*gti.Func", Doc: "Func is the [gti.Func] associated with this button.\nThis function can also be a method, but it must be\nconverted to a [gti.Func] first. It should typically\nbe set using [FuncButton.SetFunc].", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"ReflectFunc", &gti.Field{Name: "ReflectFunc", Type: "reflect.Value", LocalType: "reflect.Value", Doc: "ReflectFunc is the [reflect.Value] of the function or\nmethod associated with this button. It should typically\nbet set using [FuncButton.SetFunc].", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Args", &gti.Field{Name: "Args", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Args are the [Value] objects associated with the\narguments of the function. They are automatically set in\n[SetFunc], but they can be customized to configure\ndefault values and other options.", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Returns", &gti.Field{Name: "Returns", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Returns are the [Value] objects associated with the\nreturn values of the function. They are automatically\nset in [SetFunc], but they can be customized to configure\ndefault values and other options. The [reflect.Value]s of\nthe [Value] objects are not set until the function is\ncalled, and are thus not typically applicable to access.", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Confirm", &gti.Field{Name: "Confirm", Type: "bool", LocalType: "bool", Doc: "Confirm is whether to prompt the user for confirmation\nbefore calling the function.", Directives: gti.Directives{}, Tag: ""}},
		{"ShowReturn", &gti.Field{Name: "ShowReturn", Type: "bool", LocalType: "bool", Doc: "ShowReturn is whether to display the return values of\nthe function (and a success message if there are none).\nThe way that the return values are shown is determined\nby ShowReturnAsDialog. ShowReturn is on by default, unless\nthe function has no return values.", Directives: gti.Directives{}, Tag: "def:\"true\""}},
		{"ShowReturnAsDialog", &gti.Field{Name: "ShowReturnAsDialog", Type: "bool", LocalType: "bool", Doc: "ShowReturnAsDialog, if and only if ShowReturn is true,\nindicates to show the return values of the function in\na dialog, instead of in a snackbar, as they are by default.\nIf there are multiple return values from the function, or if\none of them is a complex type (pointer, struct, slice,\narray, map), then ShowReturnAsDialog will\nautomatically be set to true.", Directives: gti.Directives{}, Tag: ""}},
		{"NewWindow", &gti.Field{Name: "NewWindow", Type: "bool", LocalType: "bool", Doc: "NewWindow makes the ReturnDialog a NewWindow dialog\n(if supported by platform).", Directives: gti.Directives{}, Tag: ""}},
		{"WarnUnadded", &gti.Field{Name: "WarnUnadded", Type: "bool", LocalType: "bool", Doc: "WarnUnadded is whether to log warnings when a function that\nhas not been added to gti is used. It is on by default and\nmust be set before [FuncButton.SetFunc] is called for it to\nhave any effect.", Directives: gti.Directives{}, Tag: "def:\"true\""}},
		{"Context", &gti.Field{Name: "Context", Type: "goki.dev/gi/v2/gi.Widget", LocalType: "gi.Widget", Doc: "Context is used for opening Dialogs if non-nil.", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Button", &gti.Field{Name: "Button", Type: "goki.dev/gi/v2/gi.Button", LocalType: "gi.Button", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &FuncButton{},
})

FuncButtonType is the gti.Type for FuncButton

View Source
var InspectorType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.Inspector",
	ShortName:  "giv.Inspector",
	IDName:     "inspector",
	Doc:        "Inspector represents a struct, creating a property editor of the fields --\nconstructs Children widgets to show the field names and editor fields for\neach field, within an overall frame with an optional title, and a button\nbox at the bottom where methods can be invoked",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"KiRoot", &gti.Field{Name: "KiRoot", Type: "goki.dev/ki/v2.Ki", LocalType: "ki.Ki", Doc: "root of tree being edited", Directives: gti.Directives{}, Tag: ""}},
		{"Changed", &gti.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "has the root changed via gui actions?  updated from treeview and structview for changes", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Filename", &gti.Field{Name: "Filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "current filename for saving / loading", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{
		{"UpdateItems", &gti.Method{Name: "UpdateItems", Doc: "UpdateItems updates the objects being edited (e.g., updating display changes)", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Save", &gti.Method{Name: "Save", Doc: "Save saves tree to current filename, in a standard JSON-formatted file", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"SaveAs", &gti.Method{Name: "SaveAs", Doc: "SaveAs saves tree to given filename, in a standard JSON-formatted file", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
			{"filename", &gti.Field{Name: "filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Open", &gti.Method{Name: "Open", Doc: "Open opens tree from given filename, in a standard JSON-formatted file", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
			{"filename", &gti.Field{Name: "filename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"ToggleSelectionMode", &gti.Method{Name: "ToggleSelectionMode", Doc: "ToggleSelectionMode toggles the editor between selection mode or not.\nIn selection mode, bounding boxes are rendered around each Widget,\nand clicking on a Widget pulls it up in the inspector.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"InspectApp", &gti.Method{Name: "InspectApp", Doc: "InspectApp displays the underlying operating system app", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
	}),
	Instance: &Inspector{},
})

InspectorType is the gti.Type for Inspector

View Source
var KeyChordEditType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.KeyChordEdit",
	ShortName:  "giv.KeyChordEdit",
	IDName:     "key-chord-edit",
	Doc:        "KeyChordEdit is a label widget that shows a key chord string, and, when in\nfocus (after being clicked) will update to whatever key chord is typed --\nused for representing and editing key chords.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"FocusActive", &gti.Field{Name: "FocusActive", Type: "bool", LocalType: "bool", Doc: "true if the keyboard focus is active or not -- when we lose active focus we apply changes", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Label", &gti.Field{Name: "Label", Type: "goki.dev/gi/v2/gi.Label", LocalType: "gi.Label", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &KeyChordEdit{},
})

KeyChordEditType is the gti.Type for KeyChordEdit

View Source
var MapViewInlineType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.MapViewInline",
	ShortName:  "giv.MapViewInline",
	IDName:     "map-view-inline",
	Doc:        "MapViewInline represents a map as a single line widget,\nfor smaller maps and those explicitly marked inline.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Map", &gti.Field{Name: "Map", Type: "any", LocalType: "any", Doc: "the map that we are a view onto", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"MapValView", &gti.Field{Name: "MapValView", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "Value for the map itself, if this was created within value view framework -- otherwise nil", Directives: gti.Directives{}, Tag: ""}},
		{"Changed", &gti.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "has the map been edited?", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Keys", &gti.Field{Name: "Keys", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the map keys", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"Values", &gti.Field{Name: "Values", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the fields", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "view:\"-\" json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Layout", &gti.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &MapViewInline{},
})

MapViewInlineType is the gti.Type for MapViewInline

View Source
var MapViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.MapView",
	ShortName:  "giv.MapView",
	IDName:     "map-view",
	Doc:        "MapView represents a map, creating a property editor of the values --\nconstructs Children widgets to show the key / value pairs, within an\noverall frame.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Map", &gti.Field{Name: "Map", Type: "any", LocalType: "any", Doc: "the map that we are a view onto", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"MapValView", &gti.Field{Name: "MapValView", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "Value for the map itself, if this was created within value view framework -- otherwise nil", Directives: gti.Directives{}, Tag: ""}},
		{"Changed", &gti.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "has the map been edited?", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Keys", &gti.Field{Name: "Keys", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the map keys", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"Values", &gti.Field{Name: "Values", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the map values", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"SortVals", &gti.Field{Name: "SortVals", Type: "bool", LocalType: "bool", Doc: "sort by values instead of keys", Directives: gti.Directives{}, Tag: ""}},
		{"NCols", &gti.Field{Name: "NCols", Type: "int", LocalType: "int", Doc: "the number of columns in the map; do not set externally; generally only access internally", Directives: gti.Directives{}, Tag: ""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &MapView{},
})

MapViewType is the gti.Type for MapView

View Source
var SliceViewBaseType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.SliceViewBase",
	ShortName:  "giv.SliceViewBase",
	IDName:     "slice-view-base",
	Doc:        "SliceViewBase is the base for SliceView and TableView and any other viewers\nof array-like data.  It automatically computes the number of rows that fit\nwithin its allocated space, and manages the offset view window into the full\nlist of items, and supports row selection, copy / paste, Drag-n-Drop, etc.\nSet to ReadOnly for select-only mode, which emits WidgetSig WidgetSelected\nsignals when selection is updated.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Slice", &gti.Field{Name: "Slice", Type: "any", LocalType: "any", Doc: "the slice that we are a view onto -- must be a pointer to that slice", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}},
		{"MinRows", &gti.Field{Name: "MinRows", Type: "int", LocalType: "int", Doc: "MinRows specifies the minimum number of rows to display, to ensure\nat least this amount is displayed.", Directives: gti.Directives{}, Tag: "def:\"4\""}},
		{"ViewMu", &gti.Field{Name: "ViewMu", Type: "*sync.Mutex", LocalType: "*sync.Mutex", Doc: "optional mutex that, if non-nil, will be used around any updates that\nread / modify the underlying Slice data.\nCan be used to protect against random updating if your code has specific\nupdate points that can be likewise protected with this same mutex.", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"Changed", &gti.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "Changed indicates whether the underlying slice\nhas been edited in any way", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"SliceNPVal", &gti.Field{Name: "SliceNPVal", Type: "reflect.Value", LocalType: "reflect.Value", Doc: "non-ptr reflect.Value of the slice", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"SliceValView", &gti.Field{Name: "SliceValView", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "Value for the slice itself, if this was created within value view framework -- otherwise nil", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"Values", &gti.Field{Name: "Values", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the slice values", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"SelVal", &gti.Field{Name: "SelVal", Type: "any", LocalType: "any", Doc: "current selection value -- initially select this value if set", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"SelIdx", &gti.Field{Name: "SelIdx", Type: "int", LocalType: "int", Doc: "index of currently-selected item, in ReadOnly mode only", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}},
		{"SelIdxs", &gti.Field{Name: "SelIdxs", Type: "map[int]struct{}", LocalType: "map[int]struct{}", Doc: "list of currently-selected slice indexes", Directives: gti.Directives{}, Tag: "copy:\"-\""}},
		{"InitSelIdx", &gti.Field{Name: "InitSelIdx", Type: "int", LocalType: "int", Doc: "index of row to select at start", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}},
		{"DraggedIdxs", &gti.Field{Name: "DraggedIdxs", Type: "[]int", LocalType: "[]int", Doc: "list of currently-dragged indexes", Directives: gti.Directives{}, Tag: "copy:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}},
		{"VisRows", &gti.Field{Name: "VisRows", Type: "int", LocalType: "int", Doc: "total number of rows visible in allocated display size", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
		{"StartIdx", &gti.Field{Name: "StartIdx", Type: "int", LocalType: "int", Doc: "starting slice index of visible rows", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
		{"SliceSize", &gti.Field{Name: "SliceSize", Type: "int", LocalType: "int", Doc: "size of slice", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
		{"ConfigIter", &gti.Field{Name: "ConfigIter", Type: "int", LocalType: "int", Doc: "iteration through the configuration process, reset when a new slice type is set", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
		{"TmpIdx", &gti.Field{Name: "TmpIdx", Type: "int", LocalType: "int", Doc: "temp idx state for e.g., dnd", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"ElVal", &gti.Field{Name: "ElVal", Type: "reflect.Value", LocalType: "reflect.Value", Doc: "ElVal is a Value representation of the underlying element type\nwhich is used whenever there are no slice elements available", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{
		{"CopyIdxs", &gti.Method{Name: "CopyIdxs", Doc: "CopyIdxs copies selected idxs to clip.Board, optionally resetting the selection", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
			{"reset", &gti.Field{Name: "reset", Type: "bool", LocalType: "bool", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"DeleteIdxs", &gti.Method{Name: "DeleteIdxs", Doc: "DeleteIdxs deletes all selected indexes", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"CutIdxs", &gti.Method{Name: "CutIdxs", Doc: "CutIdxs copies selected indexes to clip.Board and deletes selected indexes", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"PasteIdx", &gti.Method{Name: "PasteIdx", Doc: "PasteIdx pastes clipboard at given idx", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
			{"idx", &gti.Field{Name: "idx", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Duplicate", &gti.Method{Name: "Duplicate", Doc: "Duplicate copies selected items and inserts them after current selection --\nreturn idx of start of duplicates if successful, else -1", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
			{"int", &gti.Field{Name: "int", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		})}},
	}),
	Instance: &SliceViewBase{},
})

SliceViewBaseType is the gti.Type for SliceViewBase

View Source
var SliceViewGridType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.SliceViewGrid",
	ShortName:  "giv.SliceViewGrid",
	IDName:     "slice-view-grid",
	Doc:        "SliceViewGrid handles the resizing logic for SliceView, TableView.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"MinRows", &gti.Field{Name: "MinRows", Type: "int", LocalType: "int", Doc: "MinRows is set from parent SV", Directives: gti.Directives{}, Tag: "edit:\"-\""}},
		{"RowHeight", &gti.Field{Name: "RowHeight", Type: "float32", LocalType: "float32", Doc: "height of a single row, computed during layout", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
		{"VisRows", &gti.Field{Name: "VisRows", Type: "int", LocalType: "int", Doc: "total number of rows visible in allocated display size", Directives: gti.Directives{}, Tag: "edit:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &SliceViewGrid{},
})

SliceViewGridType is the gti.Type for SliceViewGrid

View Source
var SliceViewInlineType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.SliceViewInline",
	ShortName:  "giv.SliceViewInline",
	IDName:     "slice-view-inline",
	Doc:        "SliceViewInline represents a slice as a single line widget,\nfor smaller slices and those explicitly marked inline.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Slice", &gti.Field{Name: "Slice", Type: "any", LocalType: "any", Doc: "the slice that we are a view onto", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"SliceValView", &gti.Field{Name: "SliceValView", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "Value for the slice itself, if this was created within value view framework -- otherwise nil", Directives: gti.Directives{}, Tag: ""}},
		{"IsArray", &gti.Field{Name: "IsArray", Type: "bool", LocalType: "bool", Doc: "whether the slice is actually an array -- no modifications", Directives: gti.Directives{}, Tag: ""}},
		{"IsFixedLen", &gti.Field{Name: "IsFixedLen", Type: "bool", LocalType: "bool", Doc: "whether the slice has a fixed-len flag on it", Directives: gti.Directives{}, Tag: ""}},
		{"Changed", &gti.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "has the slice been edited?", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Values", &gti.Field{Name: "Values", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the fields", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "view:\"-\" json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Layout", &gti.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &SliceViewInline{},
})

SliceViewInlineType is the gti.Type for SliceViewInline

View Source
var SliceViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.SliceView",
	ShortName:  "giv.SliceView",
	IDName:     "slice-view",
	Doc:        "SliceView represents a slice, creating an interactive viewer / editor of the\nelements as rows in a table.  Widgets to show the index / value pairs, within an\noverall frame.\nSet to ReadOnly for select-only mode, which emits WidgetSig WidgetSelected\nsignals when selection is updated.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"StyleFunc", &gti.Field{Name: "StyleFunc", Type: "goki.dev/gi/v2/giv.SliceViewStyleFunc", LocalType: "SliceViewStyleFunc", Doc: "optional styling function", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"SliceViewBase", &gti.Field{Name: "SliceViewBase", Type: "goki.dev/gi/v2/giv.SliceViewBase", LocalType: "SliceViewBase", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &SliceView{},
})

SliceViewType is the gti.Type for SliceView

View Source
var StructViewInlineType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.StructViewInline",
	ShortName:  "giv.StructViewInline",
	IDName:     "struct-view-inline",
	Doc:        "StructViewInline represents a struct as a single line widget,\nfor smaller structs and those explicitly marked inline.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Struct", &gti.Field{Name: "Struct", Type: "any", LocalType: "any", Doc: "the struct that we are a view onto", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"StructValView", &gti.Field{Name: "StructValView", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "Value for the struct itself, if this was created within value view framework -- otherwise nil", Directives: gti.Directives{}, Tag: ""}},
		{"AddButton", &gti.Field{Name: "AddButton", Type: "bool", LocalType: "bool", Doc: "if true add an edit action button at the end -- other users of this widget can then configure that -- it is called 'edit-action'", Directives: gti.Directives{}, Tag: ""}},
		{"FieldViews", &gti.Field{Name: "FieldViews", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the fields", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" view:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
		{"HasDefs", &gti.Field{Name: "HasDefs", Type: "bool", LocalType: "bool", Doc: "if true, some fields have default values -- update labels when values change", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" edit:\"-\""}},
		{"HasViewIfs", &gti.Field{Name: "HasViewIfs", Type: "bool", LocalType: "bool", Doc: "if true, some fields have viewif conditional view tags -- update after..", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" edit:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Layout", &gti.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &StructViewInline{},
})

StructViewInlineType is the gti.Type for StructViewInline

View Source
var StructViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.StructView",
	ShortName:  "giv.StructView",
	IDName:     "struct-view",
	Doc:        "StructView represents a struct, creating a property editor of the fields --\nconstructs Children widgets to show the field names and editor fields for\neach field, within an overall frame.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Struct", &gti.Field{Name: "Struct", Type: "any", LocalType: "any", Doc: "the struct that we are a view onto", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"StructValView", &gti.Field{Name: "StructValView", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "Value for the struct itself, if this was created within value view framework -- otherwise nil", Directives: gti.Directives{}, Tag: ""}},
		{"Changed", &gti.Field{Name: "Changed", Type: "bool", LocalType: "bool", Doc: "has the value of any field changed?  updated by the ViewSig signals from fields", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"ChangeFlag", &gti.Field{Name: "ChangeFlag", Type: "*reflect.Value", LocalType: "*reflect.Value", Doc: "Value for a field marked with changeflag struct tag, which must be a bool type, which is updated when changes are registered in field values.", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"FieldViews", &gti.Field{Name: "FieldViews", Type: "[]goki.dev/gi/v2/giv.Value", LocalType: "[]Value", Doc: "Value representations of the fields", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
		{"HasDefs", &gti.Field{Name: "HasDefs", Type: "bool", LocalType: "bool", Doc: "if true, some fields have default values -- update labels when values change", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" edit:\"-\""}},
		{"HasViewIfs", &gti.Field{Name: "HasViewIfs", Type: "bool", LocalType: "bool", Doc: "if true, some fields have viewif conditional view tags -- update after..", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" edit:\"-\""}},
		{"TypeFieldTags", &gti.Field{Name: "TypeFieldTags", Type: "map[string]string", LocalType: "map[string]string", Doc: "extra tags by field name -- from type properties", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" edit:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &StructView{},
})

StructViewType is the gti.Type for StructView

View Source
var TableViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.TableView",
	ShortName:  "giv.TableView",
	IDName:     "table-view",
	Doc:        "TableView represents a slice-of-structs as a table, where the fields are\nthe columns, within an overall frame.  It is a full-featured editor with\nmultiple-selection, cut-and-paste, and drag-and-drop.\nIf ReadOnly, it functions as a mutually-exclusive item\nselector, highlighting the selected row and emitting a Selected action.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"StyleFunc", &gti.Field{Name: "StyleFunc", Type: "goki.dev/gi/v2/giv.TableViewStyleFunc", LocalType: "TableViewStyleFunc", Doc: "optional styling function", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"SelField", &gti.Field{Name: "SelField", Type: "string", LocalType: "string", Doc: "current selection field -- initially select value in this field", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"SortIdx", &gti.Field{Name: "SortIdx", Type: "int", LocalType: "int", Doc: "current sort index", Directives: gti.Directives{}, Tag: ""}},
		{"SortDesc", &gti.Field{Name: "SortDesc", Type: "bool", LocalType: "bool", Doc: "whether current sort order is descending", Directives: gti.Directives{}, Tag: ""}},
		{"StruType", &gti.Field{Name: "StruType", Type: "reflect.Type", LocalType: "reflect.Type", Doc: "struct type for each row", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"VisFields", &gti.Field{Name: "VisFields", Type: "[]reflect.StructField", LocalType: "[]reflect.StructField", Doc: "the visible fields", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"NVisFields", &gti.Field{Name: "NVisFields", Type: "int", LocalType: "int", Doc: "number of visible fields", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"SliceViewBase", &gti.Field{Name: "SliceViewBase", Type: "goki.dev/gi/v2/giv.SliceViewBase", LocalType: "SliceViewBase", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &TableView{},
})

TableViewType is the gti.Type for TableView

View Source
var TimeViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.TimeView",
	ShortName:  "giv.TimeView",
	IDName:     "time-view",
	Doc:        "TimeView is a view for selecting a time",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Time", &gti.Field{Name: "Time", Type: "time.Time", LocalType: "time.Time", Doc: "the time that we are viewing", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"TmpSave", &gti.Field{Name: "TmpSave", Type: "goki.dev/gi/v2/giv.Value", LocalType: "Value", Doc: "value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
		{"ViewPath", &gti.Field{Name: "ViewPath", Type: "string", LocalType: "string", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows", Directives: gti.Directives{}, Tag: ""}},
		{"Hour", &gti.Field{Name: "Hour", Type: "int", LocalType: "int", Doc: "the raw input hour", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"PM", &gti.Field{Name: "PM", Type: "bool", LocalType: "bool", Doc: "whether we are in PM mode (so we have to add 12h to everything)", Directives: gti.Directives{}, Tag: "set:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &TimeView{},
})

TimeViewType is the gti.Type for TimeView

View Source
var TreeViewPageSteps = 10

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

View Source
var TreeViewType = gti.AddType(&gti.Type{
	Name:       "goki.dev/gi/v2/giv.TreeView",
	ShortName:  "giv.TreeView",
	IDName:     "tree-view",
	Doc:        "TreeView provides a graphical representation of a tree tructure\nproviding full navigation and manipulation abilities.\n\nIf the SyncNode field is non-nil, typically via\nSyncRootNode method, then the TreeView mirrors another\nKi tree structure, and tree editing functions apply to\nthe source tree first, and then to the TreeView by sync.\n\nOtherwise, data can be directly encoded in a TreeView\nderived type, to represent any kind of tree structure\nand associated data.\n\nStandard events.Event are sent to any listeners, including\nSelect, Change, and DoubleClick.  The selected nodes\nare in the root SelectedNodes list.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"SyncNode", &gti.Field{Name: "SyncNode", Type: "goki.dev/ki/v2.Ki", LocalType: "ki.Ki", Doc: "If non-nil, the Ki Node that this widget is viewing in the tree (the source)", Directives: gti.Directives{}, Tag: "set:\"-\" copy:\"-\" json:\"-\" xml:\"-\""}},
		{"Text", &gti.Field{Name: "Text", Type: "string", LocalType: "string", Doc: "The text to display for the tree view item label, which automatically\ndefaults to the [ki.Node.Name] of the tree view node. It has no effect\nif [TreeView.SyncNode] is non-nil.", Directives: gti.Directives{}, Tag: ""}},
		{"Icon", &gti.Field{Name: "Icon", Type: "goki.dev/icons.Icon", LocalType: "icons.Icon", Doc: "optional icon, displayed to the the left of the text label", Directives: gti.Directives{}, Tag: ""}},
		{"Indent", &gti.Field{Name: "Indent", Type: "goki.dev/girl/units.Value", LocalType: "units.Value", Doc: "amount to indent children relative to this node", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}},
		{"OpenDepth", &gti.Field{Name: "OpenDepth", Type: "int", LocalType: "int", Doc: "depth for nodes be initialized as open (default 4).\nNodes beyond this depth will be initialized as closed.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\""}},
		{"ViewIdx", &gti.Field{Name: "ViewIdx", Type: "int", LocalType: "int", Doc: "linear index of this node within the entire tree.\nupdated on full rebuilds and may sometimes be off,\nbut close enough for expected uses", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" edit:\"-\""}},
		{"WidgetSize", &gti.Field{Name: "WidgetSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "size of just this node widget.\nour alloc includes all of our children, but we only draw us.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" edit:\"-\""}},
		{"RootView", &gti.Field{Name: "RootView", Type: "*goki.dev/gi/v2/giv.TreeView", LocalType: "*TreeView", Doc: "The cached root of the view. It is automatically set and does not need to be\nset by the end user.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" edit:\"-\""}},
		{"SelectedNodes", &gti.Field{Name: "SelectedNodes", Type: "[]goki.dev/gi/v2/giv.TreeViewer", LocalType: "[]TreeViewer", Doc: "SelectedNodes holds the currently-selected nodes, on the\nRootView node only.", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" edit:\"-\""}},
		{"actStateLayer", &gti.Field{Name: "actStateLayer", Type: "float32", LocalType: "float32", Doc: "actStateLayer is the actual state layer of the tree view, which\nshould be used when rendering it and its parts (but not its children).\nthe reason that it exists is so that the children of the tree view\n(other tree views) do not inherit its stateful background color, as\nthat does not look good.", Directives: gti.Directives{}, Tag: "set:\"-\""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"WidgetBase", &gti.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "gi.WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{
		{"InsertAfter", &gti.Method{Name: "InsertAfter", Doc: "InsertAfter inserts a new node in the tree\nafter this node, at the same (sibling) level,\nprompting for the type of node to insert.\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"InsertBefore", &gti.Method{Name: "InsertBefore", Doc: "InsertBefore inserts a new node in the tree\nbefore this node, at the same (sibling) level,\nprompting for the type of node to insert\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"AddChildNode", &gti.Method{Name: "AddChildNode", Doc: "AddChildNode adds a new child node to this one in the tree,\nprompting the user for the type of node to add\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"DeleteNode", &gti.Method{Name: "DeleteNode", Doc: "DeleteNode deletes the tree node or sync node corresponding\nto this view node in the sync tree.\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Duplicate", &gti.Method{Name: "Duplicate", Doc: "Duplicate duplicates the sync node corresponding to this view node in\nthe tree, and inserts the duplicate after this node (as a new sibling).\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"EditNode", &gti.Method{Name: "EditNode", Doc: "EditNode pulls up a StructViewDialog window on the node.\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"InspectNode", &gti.Method{Name: "InspectNode", Doc: "InspectNode pulls up a new Inspector window on the node.\nIf SyncNode is set, operates on Sync Tree.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"OpenAll", &gti.Method{Name: "OpenAll", Doc: "OpenAll opens the given node and all of its sub-nodes", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"CloseAll", &gti.Method{Name: "CloseAll", Doc: "CloseAll closes the given node and all of its sub-nodes.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Copy", &gti.Method{Name: "Copy", Doc: "Copy copies to clip.Board, optionally resetting the selection.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
			{"reset", &gti.Field{Name: "reset", Type: "bool", LocalType: "bool", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Cut", &gti.Method{Name: "Cut", Doc: "Cut copies to clip.Board and deletes selected items.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
		{"Paste", &gti.Method{Name: "Paste", Doc: "Paste pastes clipboard at given node.", Directives: gti.Directives{
			&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
		}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
	}),
	Instance: &TreeView{},
})

TreeViewType is the gti.Type for TreeView

View Source
var ValueMap map[string]ValueFunc

The ValueMap is used to connect type names with corresponding Value representations of those types -- this can be used when it is not possible to use the Valuer 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 laser.LongTypeName (full package name + "." . type name) for the type name, as that is how it will be looked up.

Functions

func CallFunc

func CallFunc(ctx gi.Widget, fun any)

CallFunc calls the given function in the context of the given widget, popping up a dialog to prompt for any arguments and show the return values of the function. It is a helper function that uses NewSoloFuncButton under the hood.

func FileViewDialog

func FileViewDialog(ctx gi.Widget, filename, exts, title string, fun func(selfile string))

func FileViewDirOnlyFilter

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

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

func FileViewExtOnlyFilter

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

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

func HiStylesView

func HiStylesView(st *histyle.Styles)

HiStylesView opens a view of highlighting styles

func InspectorDialog

func InspectorDialog(obj ki.Ki)

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

func KeyMapsView

func KeyMapsView(km *keyfun.Maps)

KeyMapsView opens a view of a key maps table

func OpenValueDialog

func OpenValueDialog(vv Value, ctx gi.Widget, fun func(), title ...string)

OpenValueDialog is a helper for OpenDialog for cases that use [ConfigDialog] method to configure the dialog contents. If a title is specified, it is used as the title for the dialog instead of the default one.

func PrefsDbgView

func PrefsDbgView(pf *gi.PrefsDebug)

PrefsDbgView opens a view of user debugging preferences

func PrefsDetView

func PrefsDetView(pf *gi.PrefsDetailed)

PrefsDetView opens a view of user detailed preferences

func PrefsView

func PrefsView(pf *gi.GeneralSettingsData)

PrefsView opens a view of user preferences

func SetSoloValueIface

func SetSoloValueIface(vv *ValueBase, val any)

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

func SliceIdxByValue

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

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

func StructFieldIsDef

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

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

func StructNonDefFieldsStr

func StructNonDefFieldsStr(structPtr any, path string) string

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

func StructSliceIdxByValue

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

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

func StructTagVal

func StructTagVal(key, tags string) string

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

func StructViewFieldDefTag

func StructViewFieldDefTag(vv Value, 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

func StructViewFieldTags(vv Value, lbl *gi.Label, w gi.Widget, isReadOnly bool) (hasDef, readOnlyTag bool)

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

func StructViewIf

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

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

func ValueMapAdd

func ValueMapAdd(typeNm string, fun ValueFunc)

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

func ViewStdKeyMaps

func ViewStdKeyMaps()

ViewStdKeyMaps shows the standard maps that are compiled into the program and have all the lastest key functions bound to standard values. Useful for comparing against custom maps.

Types

type ArgView

type ArgView struct {
	gi.Frame

	// title / prompt to show above the editor fields
	Title string

	// the args that we are a view onto
	Args []Value

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string
}

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

func NewArgView

func NewArgView(par ki.Ki, name ...string) *ArgView

NewArgView adds a new ArgView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

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

func (av *ArgView) ConfigArgsGrid()

ConfigArgsGrid configures the ArgsGrid for the current struct

func (*ArgView) ConfigWidget

func (av *ArgView) ConfigWidget()

Config configures the view

func (*ArgView) KiType

func (t *ArgView) KiType() *gti.Type

KiType returns the *gti.Type of ArgView

func (*ArgView) New

func (t *ArgView) New() ki.Ki

New returns a new *ArgView value

func (*ArgView) OnInit

func (av *ArgView) OnInit()

func (*ArgView) SetArgs

func (t *ArgView) SetArgs(v []Value) *ArgView

SetArgs sets the [ArgView.Args]: the args that we are a view onto

func (*ArgView) SetClass

func (t *ArgView) SetClass(v string) *ArgView

SetClass sets the [ArgView.Class]

func (*ArgView) SetCustomContextMenu

func (t *ArgView) SetCustomContextMenu(v func(m *gi.Scene)) *ArgView

SetCustomContextMenu sets the [ArgView.CustomContextMenu]

func (*ArgView) SetStackTop

func (t *ArgView) SetStackTop(v int) *ArgView

SetStackTop sets the [ArgView.StackTop]

func (*ArgView) SetStripes

func (t *ArgView) SetStripes(v gi.Stripes) *ArgView

SetStripes sets the [ArgView.Stripes]

func (*ArgView) SetStyles

func (av *ArgView) SetStyles()

func (*ArgView) SetTitle

func (t *ArgView) SetTitle(v string) *ArgView

SetTitle sets the [ArgView.Title]: title / prompt to show above the editor fields

func (*ArgView) SetTooltip

func (t *ArgView) SetTooltip(v string) *ArgView

SetTooltip sets the [ArgView.Tooltip]

func (*ArgView) SetViewPath

func (t *ArgView) SetViewPath(v string) *ArgView

SetViewPath sets the [ArgView.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

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 BitFlagValue

type BitFlagValue struct {
	ValueBase
}

BitFlagValue presents chip gi.Switches for editing bitflags

func (*BitFlagValue) ConfigWidget

func (vv *BitFlagValue) ConfigWidget(w gi.Widget)

func (*BitFlagValue) EnumValue

func (vv *BitFlagValue) EnumValue() enums.BitFlagSetter

func (*BitFlagValue) SetEnumValueFromInt

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

func (*BitFlagValue) UpdateWidget

func (vv *BitFlagValue) UpdateWidget()

func (*BitFlagValue) WidgetType

func (vv *BitFlagValue) WidgetType() *gti.Type

type BoolValue

type BoolValue struct {
	ValueBase
}

BoolValue presents a checkbox for a boolean

func (*BoolValue) ConfigWidget

func (vv *BoolValue) ConfigWidget(w gi.Widget)

func (*BoolValue) UpdateWidget

func (vv *BoolValue) UpdateWidget()

func (*BoolValue) WidgetType

func (vv *BoolValue) WidgetType() *gti.Type

type ByteSliceValue

type ByteSliceValue struct {
	ValueBase
}

ByteSliceValue presents a textfield of the bytes

func (*ByteSliceValue) ConfigWidget

func (vv *ByteSliceValue) ConfigWidget(w gi.Widget)

func (*ByteSliceValue) UpdateWidget

func (vv *ByteSliceValue) UpdateWidget()

func (*ByteSliceValue) WidgetType

func (vv *ByteSliceValue) WidgetType() *gti.Type

type ColorMapName

type ColorMapName string

ColorMapName represents the name of a color map, which can be edited using a ColorMapValue.

func (ColorMapName) Value

func (cmn ColorMapName) Value() Value

type ColorMapValue

type ColorMapValue struct {
	ValueBase

	// Dim is the dimension on which to display the color map spectrum
	Dim mat32.Dims
}

ColorMapValue displays a color map spectrum and can be clicked on to display a dialog for selecting different color map options. It represents a ColorMapName value.

func (*ColorMapValue) ConfigDialog

func (vv *ColorMapValue) ConfigDialog(d *gi.Body) (bool, func())

func (*ColorMapValue) ConfigWidget

func (vv *ColorMapValue) ConfigWidget(w gi.Widget)

func (*ColorMapValue) HasDialog

func (vv *ColorMapValue) HasDialog() bool

func (*ColorMapValue) OpenDialog

func (vv *ColorMapValue) OpenDialog(ctx gi.Widget, fun func())

func (*ColorMapValue) UpdateWidget

func (vv *ColorMapValue) UpdateWidget()

func (*ColorMapValue) WidgetType

func (vv *ColorMapValue) WidgetType() *gti.Type

type ColorNameValue

type ColorNameValue struct {
	ValueBase
}

ColorNameValue presents an button for displaying a ColorNameName and selecting meshes from a ChooserDialog

func (*ColorNameValue) ConfigDialog

func (vv *ColorNameValue) ConfigDialog(d *gi.Body) (bool, func())

func (*ColorNameValue) ConfigWidget

func (vv *ColorNameValue) ConfigWidget(w gi.Widget)

func (*ColorNameValue) HasDialog

func (vv *ColorNameValue) HasDialog() bool

func (*ColorNameValue) OpenDialog

func (vv *ColorNameValue) OpenDialog(ctx gi.Widget, fun func())

func (*ColorNameValue) UpdateWidget

func (vv *ColorNameValue) UpdateWidget()

func (*ColorNameValue) WidgetType

func (vv *ColorNameValue) WidgetType() *gti.Type

type ColorValue

type ColorValue struct {
	ValueBase
	TmpColor color.RGBA
}

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

func (*ColorValue) Color

func (vv *ColorValue) Color() (*color.RGBA, bool)

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

func (*ColorValue) ConfigDialog

func (vv *ColorValue) ConfigDialog(d *gi.Body) (bool, func())

func (*ColorValue) ConfigWidget

func (vv *ColorValue) ConfigWidget(w gi.Widget)

func (*ColorValue) HasDialog

func (vv *ColorValue) HasDialog() bool

func (*ColorValue) OpenDialog

func (vv *ColorValue) OpenDialog(ctx gi.Widget, fun func())

func (*ColorValue) SetColor

func (vv *ColorValue) SetColor(clr color.RGBA)

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

func (*ColorValue) UpdateWidget

func (vv *ColorValue) UpdateWidget()

func (*ColorValue) WidgetType

func (vv *ColorValue) WidgetType() *gti.Type

type ColorView

type ColorView struct {
	gi.Frame

	// the color that we view
	Color hct.HCT `set:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `json:"-" xml:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string
}

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

func NewColorView

func NewColorView(par ki.Ki, name ...string) *ColorView

NewColorView adds a new ColorView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*ColorView) ConfigWidget

func (cv *ColorView) ConfigWidget()

Config configures a standard setup of entire view

func (*ColorView) KiType

func (t *ColorView) KiType() *gti.Type

KiType returns the *gti.Type of ColorView

func (*ColorView) New

func (t *ColorView) New() ki.Ki

New returns a new *ColorView value

func (*ColorView) OnInit

func (cv *ColorView) OnInit()

func (*ColorView) SetClass

func (t *ColorView) SetClass(v string) *ColorView

SetClass sets the [ColorView.Class]

func (*ColorView) SetColor

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

SetColor sets the source color

func (*ColorView) SetCustomContextMenu

func (t *ColorView) SetCustomContextMenu(v func(m *gi.Scene)) *ColorView

SetCustomContextMenu sets the [ColorView.CustomContextMenu]

func (*ColorView) SetHCT

func (cv *ColorView) SetHCT(hct hct.HCT) *ColorView

SetHCT sets the source color in terms of HCT

func (*ColorView) SetStackTop

func (t *ColorView) SetStackTop(v int) *ColorView

SetStackTop sets the [ColorView.StackTop]

func (*ColorView) SetStripes

func (t *ColorView) SetStripes(v gi.Stripes) *ColorView

SetStripes sets the [ColorView.Stripes]

func (*ColorView) SetTmpSave

func (t *ColorView) SetTmpSave(v Value) *ColorView

SetTmpSave sets the [ColorView.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*ColorView) SetTooltip

func (t *ColorView) SetTooltip(v string) *ColorView

SetTooltip sets the [ColorView.Tooltip]

func (*ColorView) SetViewPath

func (t *ColorView) SetViewPath(v string) *ColorView

SetViewPath sets the [ColorView.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

type DateView

type DateView struct {
	gi.Frame

	// the time that we are viewing
	Time time.Time `set:"-"`

	// value view that needs to have SaveTmp called on it whenever a change
	// is made to one of the underlying values.
	// pass this down to any sub-views created from a parent
	TmpSave Value `json:"-" xml:"-"`

	// a record of parent View names that have led up to this view
	// displayed as extra contextual information in view dialog windows
	ViewPath string

	// ConfigTime is the time that was configured
	ConfigTime time.Time `set:"-" view:"-"`
}

DateView is a view for selecting a date

func NewDateView

func NewDateView(par ki.Ki, name ...string) *DateView

NewDateView adds a new DateView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*DateView) ConfigDateGrid

func (dv *DateView) ConfigDateGrid()

func (*DateView) ConfigWidget

func (dv *DateView) ConfigWidget()

func (*DateView) KiType

func (t *DateView) KiType() *gti.Type

KiType returns the *gti.Type of DateView

func (*DateView) New

func (t *DateView) New() ki.Ki

New returns a new *DateView value

func (*DateView) SetClass

func (t *DateView) SetClass(v string) *DateView

SetClass sets the [DateView.Class]

func (*DateView) SetCustomContextMenu

func (t *DateView) SetCustomContextMenu(v func(m *gi.Scene)) *DateView

SetCustomContextMenu sets the [DateView.CustomContextMenu]

func (*DateView) SetStackTop

func (t *DateView) SetStackTop(v int) *DateView

SetStackTop sets the [DateView.StackTop]

func (*DateView) SetStripes

func (t *DateView) SetStripes(v gi.Stripes) *DateView

SetStripes sets the [DateView.Stripes]

func (*DateView) SetTime

func (dv *DateView) SetTime(tim time.Time) *DateView

SetTime sets the source time and updates the view

func (*DateView) SetTmpSave

func (t *DateView) SetTmpSave(v Value) *DateView

SetTmpSave sets the [DateView.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values. pass this down to any sub-views created from a parent

func (*DateView) SetTooltip

func (t *DateView) SetTooltip(v string) *DateView

SetTooltip sets the [DateView.Tooltip]

func (*DateView) SetViewPath

func (t *DateView) SetViewPath(v string) *DateView

SetViewPath sets the [DateView.ViewPath]: a record of parent View names that have led up to this view displayed as extra contextual information in view dialog windows

type DurationValue

type DurationValue struct {
	ValueBase
}

DurationValue presents a spinner and unit chooser for a time.Duration

func (*DurationValue) ConfigWidget

func (vv *DurationValue) ConfigWidget(w gi.Widget)

func (*DurationValue) UpdateWidget

func (vv *DurationValue) UpdateWidget()

func (*DurationValue) WidgetType

func (vv *DurationValue) WidgetType() *gti.Type

type EnumValue

type EnumValue struct {
	ValueBase
}

EnumValue presents a chooser for choosing enums

func (*EnumValue) ConfigWidget

func (vv *EnumValue) ConfigWidget(w gi.Widget)

func (*EnumValue) EnumValue

func (vv *EnumValue) EnumValue() enums.Enum

func (*EnumValue) UpdateWidget

func (vv *EnumValue) UpdateWidget()

func (*EnumValue) WidgetType

func (vv *EnumValue) WidgetType() *gti.Type

type FieldValuer

type FieldValuer interface {
	FieldValue(field string, fval any) Value
}

FieldValuer interface supplies the appropriate type of Value 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 ToValue result

type FileValue

type FileValue struct {
	ValueBase
}

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

func (*FileValue) ConfigDialog

func (vv *FileValue) ConfigDialog(d *gi.Body) (bool, func())

func (*FileValue) ConfigWidget

func (vv *FileValue) ConfigWidget(w gi.Widget)

func (*FileValue) HasDialog

func (vv *FileValue) HasDialog() bool

func (*FileValue) OpenDialog

func (vv *FileValue) OpenDialog(ctx gi.Widget, fun func())

func (*FileValue) UpdateWidget

func (vv *FileValue) UpdateWidget()

func (*FileValue) WidgetType

func (vv *FileValue) WidgetType() *gti.Type

type FileView

type FileView struct {
	gi.Frame

	// path to directory of files to display
	DirPath string

	// selected file
	SelFile string

	// target extension(s) (comma separated if multiple, including initial .), if any
	Ext string `set:"-"`

	// optional styling function
	FilterFunc FileViewFilterFunc `view:"-" json:"-" xml:"-"`

	// map of lower-cased extensions from Ext -- used for highlighting files with one of these extensions -- maps onto original ext value
	ExtMap map[string]string

	// files for current directory
	Files []*fi.FileInfo

	// index of currently-selected file in Files list (-1 if none)
	SelectedIdx int `set:"-" edit:"-"`

	// set to true if a file was selected via double-click,
	// which can then be a signal to dialogs to accept.
	SelectedDoubleClick bool

	// change notify for current dir
	Watcher *fsnotify.Watcher `set:"-" view:"-"`

	// channel to close watcher watcher
	DoneWatcher chan bool `set:"-" view:"-"`

	// UpdateFiles mutex
	UpdtMu sync.Mutex `set:"-" view:"-"`

	// Previous path that was processed via UpdateFiles
	PrevPath string `set:"-" view:"-"`
}

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

func NewFileView

func NewFileView(par ki.Ki, name ...string) *FileView

NewFileView adds a new FileView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*FileView) AddPathToFavs

func (fv *FileView) AddPathToFavs()

AddPathToFavs adds the current path to favorites

func (*FileView) ApplyStyle

func (fv *FileView) ApplyStyle()

func (*FileView) ConfigFileView

func (fv *FileView) ConfigFileView()

func (*FileView) ConfigFilesRow

func (fv *FileView) ConfigFilesRow()

func (*FileView) ConfigPathBar

func (fv *FileView) ConfigPathBar()

func (*FileView) ConfigSelRow

func (fv *FileView) ConfigSelRow()

func (*FileView) ConfigWatcher

func (fv *FileView) ConfigWatcher() error

func (*FileView) ConfigWidget

func (fv *FileView) ConfigWidget()

func (*FileView) DirPathUp

func (fv *FileView) DirPathUp()

DirPathUp moves up one directory in the path

func (*FileView) Disconnect

func (fv *FileView) Disconnect()

func (*FileView) EditPaths

func (fv *FileView) EditPaths()

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

func (*FileView) ExtField

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

ExtField returns the TextField of the extension

func (*FileView) FavSelect

func (fv *FileView) FavSelect(idx int)

FavSelect selects a favorite path and goes there

func (*FileView) FavsView

func (fv *FileView) FavsView() *TableView

FavsView returns the TableView of the favorites

func (*FileView) FileComplete

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

FileComplete finds the possible completions for the file field

func (*FileView) FileCompleteEdit

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

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

func (*FileView) FileSelectAction

func (fv *FileView) FileSelectAction(idx int)

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

func (*FileView) FilesRow

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

func (*FileView) FilesView

func (fv *FileView) FilesView() *TableView

FilesView returns the TableView of the files

func (*FileView) HandleEvents

func (fv *FileView) HandleEvents()

func (*FileView) KeyInput

func (fv *FileView) KeyInput(kt events.Event)

func (*FileView) KiType

func (t *FileView) KiType() *gti.Type

KiType returns the *gti.Type of FileView

func (*FileView) New

func (t *FileView) New() ki.Ki

New returns a new *FileView value

func (*FileView) NewFolder

func (fv *FileView) NewFolder()

NewFolder creates a new folder in current directory

func (*FileView) OnInit

func (fv *FileView) OnInit()

func (*FileView) PathComplete

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

PathComplete finds the possible completions for the path field

func (*FileView) PathCompleteEdit

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

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

func (*FileView) PathField

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

PathField returns the chooser 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) ReadFiles

func (fv *FileView) ReadFiles()

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

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

func (*FileView) SelectFile

func (fv *FileView) SelectFile() bool

SelectFile selects the current file as the selection. if a directory it opens the directory and returns false. if a file it selects the file and returns true. if no selection, returns false.

func (*FileView) SelectedFile

func (fv *FileView) SelectedFile() string

SelectedFile returns the full path to selected file

func (*FileView) SelectedFileInfo

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

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

func (*FileView) SetClass

func (t *FileView) SetClass(v string) *FileView

SetClass sets the [FileView.Class]

func (*FileView) SetCustomContextMenu

func (t *FileView) SetCustomContextMenu(v func(m *gi.Scene)) *FileView

SetCustomContextMenu sets the [FileView.CustomContextMenu]

func (*FileView) SetDirPath

func (t *FileView) SetDirPath(v string) *FileView

SetDirPath sets the [FileView.DirPath]: path to directory of files to display

func (*FileView) SetExt

func (fv *FileView) SetExt(ext string) *FileView

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

func (*FileView) SetExtAction

func (fv *FileView) SetExtAction(ext string) *FileView

SetExtAction sets the current extension to highlight, and redisplays files

func (*FileView) SetExtMap

func (t *FileView) SetExtMap(v map[string]string) *FileView

SetExtMap sets the [FileView.ExtMap]: map of lower-cased extensions from Ext -- used for highlighting files with one of these extensions -- maps onto original ext value

func (*FileView) SetFilename

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

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

func (*FileView) SetFiles

func (t *FileView) SetFiles(v []*fi.FileInfo) *FileView

SetFiles sets the [FileView.Files]: files for current directory

func (*FileView) SetFilterFunc

func (t *FileView) SetFilterFunc(v FileViewFilterFunc) *FileView

SetFilterFunc sets the [FileView.FilterFunc]: optional styling function

func (*FileView) SetPathFile

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

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

func (*FileView) SetSelFile

func (t *FileView) SetSelFile(v string) *FileView

SetSelFile sets the [FileView.SelFile]: selected file

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

func (t *FileView) SetSelectedDoubleClick(v bool) *FileView

SetSelectedDoubleClick sets the [FileView.SelectedDoubleClick]: set to true if a file was selected via double-click, which can then be a signal to dialogs to accept.

func (*FileView) SetStackTop

func (t *FileView) SetStackTop(v int) *FileView

SetStackTop sets the [FileView.StackTop]

func (*FileView) SetStripes

func (t *FileView) SetStripes(v gi.Stripes) *FileView

SetStripes sets the [FileView.Stripes]

func (*FileView) SetStyles

func (fv *FileView) SetStyles()

func (*FileView) SetTooltip

func (t *FileView) SetTooltip(v string) *FileView

SetTooltip sets the [FileView.Tooltip]

func (*FileView) UpdateFavs

func (fv *FileView) UpdateFavs()

UpdateFavs updates list of files and other views for current path

func (*FileView) UpdateFiles

func (fv *FileView) UpdateFiles()

UpdateFiles updates list of files and other views for current path

func (*FileView) UpdateFilesAction

func (fv *FileView) UpdateFilesAction()

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

func (*FileView) UpdatePath

func (fv *FileView) UpdatePath()

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

func (*FileView) WatchWatcher

func (fv *FileView) WatchWatcher()

type FileViewFilterFunc

type FileViewFilterFunc func(fv *FileView, fi *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 FloatValue

type FloatValue struct {
	ValueBase
}

FloatValue presents a spinner

func (*FloatValue) ConfigWidget

func (vv *FloatValue) ConfigWidget(w gi.Widget)

func (*FloatValue) UpdateWidget

func (vv *FloatValue) UpdateWidget()

func (*FloatValue) WidgetType

func (vv *FloatValue) WidgetType() *gti.Type

type FontValue

type FontValue struct {
	ValueBase
}

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

func (*FontValue) ConfigDialog

func (vv *FontValue) ConfigDialog(d *gi.Body) (bool, func())

func (*FontValue) ConfigWidget

func (vv *FontValue) ConfigWidget(w gi.Widget)

func (*FontValue) HasDialog

func (vv *FontValue) HasDialog() bool

func (*FontValue) OpenDialog

func (vv *FontValue) OpenDialog(ctx gi.Widget, fun func())

func (*FontValue) UpdateWidget

func (vv *FontValue) UpdateWidget()

func (*FontValue) WidgetType

func (vv *FontValue) WidgetType() *gti.Type

type FuncButton

type FuncButton struct {
	gi.Button

	// Func is the [gti.Func] associated with this button.
	// This function can also be a method, but it must be
	// converted to a [gti.Func] first. It should typically
	// be set using [FuncButton.SetFunc].
	Func *gti.Func `set:"-"`

	// ReflectFunc is the [reflect.Value] of the function or
	// method associated with this button. It should typically
	// bet set using [FuncButton.SetFunc].
	ReflectFunc reflect.Value `set:"-"`

	// Args are the [Value] objects associated with the
	// arguments of the function. They are automatically set in
	// [SetFunc], but they can be customized to configure
	// default values and other options.
	Args []Value `set:"-"`

	// Returns are the [Value] objects associated with the
	// return values of the function. They are automatically
	// set in [SetFunc], but they can be customized to configure
	// default values and other options. The [reflect.Value]s of
	// the [Value] objects are not set until the function is
	// called, and are thus not typically applicable to access.
	Returns []Value `set:"-"`

	// Confirm is whether to prompt the user for confirmation
	// before calling the function.
	Confirm bool

	// ShowReturn is whether to display the return values of
	// the function (and a success message if there are none).
	// The way that the return values are shown is determined
	// by ShowReturnAsDialog. ShowReturn is on by default, unless
	// the function has no return values.
	ShowReturn bool `def:"true"`

	// ShowReturnAsDialog, if and only if ShowReturn is true,
	// indicates to show the return values of the function in
	// a dialog, instead of in a snackbar, as they are by default.
	// If there are multiple return values from the function, or if
	// one of them is a complex type (pointer, struct, slice,
	// array, map), then ShowReturnAsDialog will
	// automatically be set to true.
	ShowReturnAsDialog bool

	// NewWindow makes the ReturnDialog a NewWindow dialog
	// (if supported by platform).
	NewWindow bool

	// WarnUnadded is whether to log warnings when a function that
	// has not been added to gti is used. It is on by default and
	// must be set before [FuncButton.SetFunc] is called for it to
	// have any effect.
	WarnUnadded bool `def:"true"`

	// Context is used for opening Dialogs if non-nil.
	Context gi.Widget
}

FuncButton is a button that is set up to call a function when it is pressed, using a dialog to prompt the user for any arguments. Also, it automatically sets various properties of the button like the name, text, tooltip, and icon based on the properties of the function, using reflect and gti. The function must be registered with gti to get documentation information, but that is not required; add a `//gti:add` comment directive and run `goki generate` if you want tooltips. If the function is a method, both the method and its receiver type must be added to gti to get documentation.

func NewFuncButton

func NewFuncButton(par ki.Ki, fun any) *FuncButton

NewFuncButton adds a new FuncButton with the given function to the given parent.

func NewSoloFuncButton

func NewSoloFuncButton(ctx gi.Widget, fun any) *FuncButton

NewSoloFuncButton returns a standalone FuncButton with the given context for popping up any dialog elements.

func (*FuncButton) CallFunc

func (fb *FuncButton) CallFunc()

CallFunc calls the function or method associated with this button, prompting the user for any arguments.

func (*FuncButton) CallFuncShowReturns

func (fb *FuncButton) CallFuncShowReturns()

func (*FuncButton) ConfirmDialog

func (fb *FuncButton) ConfirmDialog()

ConfirmDialog runs the confirm dialog

func (*FuncButton) CopyFieldsFrom

func (fb *FuncButton) CopyFieldsFrom(frm any)

func (*FuncButton) GoodContext

func (fb *FuncButton) GoodContext() gi.Widget

func (*FuncButton) KiType

func (t *FuncButton) KiType() *gti.Type

KiType returns the *gti.Type of FuncButton

func (*FuncButton) New

func (t *FuncButton) New() ki.Ki

New returns a new *FuncButton value

func (*FuncButton) OnInit

func (fb *FuncButton) OnInit()

func (*FuncButton) SetArgs

func (fb *FuncButton) SetArgs()

SetArgs sets the appropriate Value objects for the arguments of the function associated with the function button. It is called in FuncButton.SetFunc and should typically not be called by end-user code.

func (*FuncButton) SetClass

func (t *FuncButton) SetClass(v string) *FuncButton

SetClass sets the [FuncButton.Class]

func (*FuncButton) SetConfirm

func (t *FuncButton) SetConfirm(v bool) *FuncButton

SetConfirm sets the [FuncButton.Confirm]: Confirm is whether to prompt the user for confirmation before calling the function.

func (*FuncButton) SetContext

func (t *FuncButton) SetContext(v gi.Widget) *FuncButton

SetContext sets the [FuncButton.Context]: Context is used for opening Dialogs if non-nil.

func (*FuncButton) SetCustomContextMenu

func (t *FuncButton) SetCustomContextMenu(v func(m *gi.Scene)) *FuncButton

SetCustomContextMenu sets the [FuncButton.CustomContextMenu]

func (*FuncButton) SetData

func (t *FuncButton) SetData(v any) *FuncButton

SetData sets the [FuncButton.Data]

func (*FuncButton) SetFunc

func (fb *FuncButton) SetFunc(fun any) *FuncButton

SetFunc sets the function associated with the FuncButton to the given function or method value. For documentation information for the function to be obtained, it must be added to gti. SetFunc is automatically called by NewFuncButton.

func (*FuncButton) SetFuncImpl

func (fb *FuncButton) SetFuncImpl(gfun *gti.Func, rfun reflect.Value) *FuncButton

SetFuncImpl is the underlying implementation of FuncButton.SetFunc. It should typically not be used by end-user code.

func (*FuncButton) SetIcon

func (t *FuncButton) SetIcon(v icons.Icon) *FuncButton

SetIcon sets the [FuncButton.Icon]

func (*FuncButton) SetIndicator

func (t *FuncButton) SetIndicator(v icons.Icon) *FuncButton

SetIndicator sets the [FuncButton.Indicator]

func (*FuncButton) SetKey

func (fb *FuncButton) SetKey(kf keyfun.Funs) *FuncButton

SetKey sets the shortcut of the function button from the given keyfun.Funs

func (*FuncButton) SetMenu

func (t *FuncButton) SetMenu(v func(m *gi.Scene)) *FuncButton

SetMenu sets the [FuncButton.Menu]

func (*FuncButton) SetMethodImpl

func (fb *FuncButton) SetMethodImpl(gmet *gti.Method, rmet reflect.Value) *FuncButton

SetMethodImpl is the underlying implementation of FuncButton.SetFunc for methods. It should typically not be used by end-user code.

func (*FuncButton) SetNewWindow

func (t *FuncButton) SetNewWindow(v bool) *FuncButton

SetNewWindow sets the [FuncButton.NewWindow]: NewWindow makes the ReturnDialog a NewWindow dialog (if supported by platform).

func (*FuncButton) SetReturnValues

func (fb *FuncButton) SetReturnValues(rets []reflect.Value)

SetReturnValues sets the [reflect.Value]s of the return value Value objects. It assumes that FuncButton.SetReturns has already been called. It is called in FuncButton.CallFunc and should typically not be called by end-user code.

func (*FuncButton) SetReturns

func (fb *FuncButton) SetReturns()

SetReturns sets the appropriate Value objects for the return values of the function associated with the function button. It is called in FuncButton.SetFunc and should typically not be called by end-user code.

func (*FuncButton) SetShortcut

func (t *FuncButton) SetShortcut(v key.Chord) *FuncButton

SetShortcut sets the [FuncButton.Shortcut]

func (*FuncButton) SetShowReturn

func (t *FuncButton) SetShowReturn(v bool) *FuncButton

SetShowReturn sets the [FuncButton.ShowReturn]: ShowReturn is whether to display the return values of the function (and a success message if there are none). The way that the return values are shown is determined by ShowReturnAsDialog. ShowReturn is on by default, unless the function has no return values.

func (*FuncButton) SetShowReturnAsDialog

func (t *FuncButton) SetShowReturnAsDialog(v bool) *FuncButton

SetShowReturnAsDialog sets the [FuncButton.ShowReturnAsDialog]: ShowReturnAsDialog, if and only if ShowReturn is true, indicates to show the return values of the function in a dialog, instead of in a snackbar, as they are by default. If there are multiple return values from the function, or if one of them is a complex type (pointer, struct, slice, array, map), then ShowReturnAsDialog will automatically be set to true.

func (*FuncButton) SetText

func (fb *FuncButton) SetText(v string) *FuncButton

SetText sets the [FuncButton.Text] and updates the tooltip to correspond to the new name.

func (*FuncButton) SetTooltip

func (t *FuncButton) SetTooltip(v string) *FuncButton

SetTooltip sets the [FuncButton.Tooltip]

func (*FuncButton) SetType

func (t *FuncButton) SetType(v gi.ButtonTypes) *FuncButton

SetType sets the [FuncButton.Type]

func (*FuncButton) SetWarnUnadded

func (t *FuncButton) SetWarnUnadded(v bool) *FuncButton

SetWarnUnadded sets the [FuncButton.WarnUnadded]: WarnUnadded is whether to log warnings when a function that has not been added to gti is used. It is on by default and must be set before FuncButton.SetFunc is called for it to have any effect.

func (*FuncButton) ShowReturnsDialog

func (fb *FuncButton) ShowReturnsDialog(rets []reflect.Value)

ShowReturnsDialog runs a dialog displaying the given function return values for the function associated with the function button. It does nothing if [FuncButton.ShowReturn] is dialog

type FuncValue

type FuncValue struct {
	ValueBase
}

FuncValue presents a FuncButton for viewing the information of and calling a function

func (*FuncValue) ConfigWidget

func (vv *FuncValue) ConfigWidget(w gi.Widget)

func (*FuncValue) UpdateWidget

func (vv *FuncValue) UpdateWidget()

func (*FuncValue) WidgetType

func (vv *FuncValue) WidgetType() *gti.Type

type HiStyleValue

type HiStyleValue struct {
	ValueBase
}

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

func (*HiStyleValue) ConfigDialog

func (vv *HiStyleValue) ConfigDialog(d *gi.Body) (bool, func())

func (*HiStyleValue) ConfigWidget

func (vv *HiStyleValue) ConfigWidget(w gi.Widget)

func (*HiStyleValue) HasDialog

func (vv *HiStyleValue) HasDialog() bool

func (*HiStyleValue) OpenDialog

func (vv *HiStyleValue) OpenDialog(ctx gi.Widget, fun func())

func (*HiStyleValue) UpdateWidget

func (vv *HiStyleValue) UpdateWidget()

func (*HiStyleValue) WidgetType

func (vv *HiStyleValue) WidgetType() *gti.Type

type IconValue

type IconValue struct {
	ValueBase
}

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

func (*IconValue) ConfigDialog

func (vv *IconValue) ConfigDialog(d *gi.Body) (bool, func())

func (*IconValue) ConfigWidget

func (vv *IconValue) ConfigWidget(w gi.Widget)

func (*IconValue) HasDialog

func (vv *IconValue) HasDialog() bool

func (*IconValue) OpenDialog

func (vv *IconValue) OpenDialog(ctx gi.Widget, fun func())

func (*IconValue) UpdateWidget

func (vv *IconValue) UpdateWidget()

func (*IconValue) WidgetType

func (vv *IconValue) WidgetType() *gti.Type

type Inspector

type Inspector struct {
	gi.Frame

	// root of tree being edited
	KiRoot ki.Ki

	// has the root changed via gui actions?  updated from treeview and structview for changes
	Changed bool `set:"-"`

	// current filename for saving / loading
	Filename gi.FileName
}

Inspector 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 NewInspector

func NewInspector(par ki.Ki, name ...string) *Inspector

NewInspector adds a new Inspector with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*Inspector) ConfigSplits

func (is *Inspector) ConfigSplits()

ConfigSplits configures the Splits.

func (*Inspector) ConfigToolbar

func (is *Inspector) ConfigToolbar(tb *gi.Toolbar)

func (*Inspector) ConfigWidget

func (is *Inspector) ConfigWidget()

Config configures the widget

func (*Inspector) InspectApp

func (is *Inspector) InspectApp()

InspectApp displays the underlying operating system app

func (*Inspector) KiType

func (t *Inspector) KiType() *gti.Type

KiType returns the *gti.Type of Inspector

func (*Inspector) New

func (t *Inspector) New() ki.Ki

New returns a new *Inspector value

func (*Inspector) OnInit

func (is *Inspector) OnInit()

func (*Inspector) Open

func (is *Inspector) Open(filename gi.FileName)

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

func (*Inspector) Save

func (is *Inspector) Save()

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

func (*Inspector) SaveAs

func (is *Inspector) SaveAs(filename gi.FileName)

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

func (*Inspector) SelectionMonitor

func (is *Inspector) SelectionMonitor()

SelectionMonitor monitors the selected widget

func (*Inspector) SetChanged

func (is *Inspector) SetChanged()

func (*Inspector) SetClass

func (t *Inspector) SetClass(v string) *Inspector

SetClass sets the [Inspector.Class]

func (*Inspector) SetCustomContextMenu

func (t *Inspector) SetCustomContextMenu(v func(m *gi.Scene)) *Inspector

SetCustomContextMenu sets the [Inspector.CustomContextMenu]

func (*Inspector) SetFilename

func (t *Inspector) SetFilename(v gi.FileName) *Inspector

SetFilename sets the [Inspector.Filename]: current filename for saving / loading

func (*Inspector) SetKiRoot

func (t *Inspector) SetKiRoot(v ki.Ki) *Inspector

SetKiRoot sets the [Inspector.KiRoot]: root of tree being edited

func (*Inspector) SetRoot

func (is *Inspector) SetRoot(root ki.Ki)

SetRoot sets the source root and ensures everything is configured

func (*Inspector) SetStackTop

func (t *Inspector) SetStackTop(v int) *Inspector

SetStackTop sets the [Inspector.StackTop]

func (*Inspector) SetStripes

func (t *Inspector) SetStripes(v gi.Stripes) *Inspector

SetStripes sets the [Inspector.Stripes]

func (*Inspector) SetStyles

func (is *Inspector) SetStyles()

func (*Inspector) SetTitle

func (is *Inspector) SetTitle(title string)

SetTitle sets the optional title and updates the Title label

func (*Inspector) SetTooltip

func (t *Inspector) SetTooltip(v string) *Inspector

SetTooltip sets the [Inspector.Tooltip]

func (*Inspector) Splits

func (is *Inspector) Splits() *gi.Splits

Splits returns the main Splits

func (*Inspector) StructView

func (is *Inspector) StructView() *StructView

StructView returns the main StructView

func (*Inspector) TitleWidget

func (is *Inspector) TitleWidget() *gi.Label

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

func (*Inspector) ToggleSelectionMode

func (is *Inspector) ToggleSelectionMode()

ToggleSelectionMode toggles the editor between selection mode or not. In selection mode, bounding boxes are rendered around each Widget, and clicking on a Widget pulls it up in the inspector.

func (*Inspector) TreeView

func (is *Inspector) TreeView() *TreeView

TreeView returns the main TreeSyncView

func (*Inspector) UpdateItems

func (is *Inspector) UpdateItems()

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

type IntValue

type IntValue struct {
	ValueBase
}

IntValue presents a spinner

func (*IntValue) ConfigWidget

func (vv *IntValue) ConfigWidget(w gi.Widget)

func (*IntValue) UpdateWidget

func (vv *IntValue) UpdateWidget()

func (*IntValue) WidgetType

func (vv *IntValue) WidgetType() *gti.Type

type KeyChordEdit

type KeyChordEdit struct {
	gi.Label

	// true if the keyboard focus is active or not -- when we lose active focus we apply changes
	FocusActive bool `json:"-" xml:"-"`
}

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 NewKeyChordEdit

func NewKeyChordEdit(par ki.Ki, name ...string) *KeyChordEdit

NewKeyChordEdit adds a new KeyChordEdit with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*KeyChordEdit) ContextMenu

func (kc *KeyChordEdit) ContextMenu(m *gi.Scene)

func (*KeyChordEdit) HandleEvents

func (kc *KeyChordEdit) HandleEvents()

func (*KeyChordEdit) HandleKeys

func (kc *KeyChordEdit) HandleKeys()

func (*KeyChordEdit) KiType

func (t *KeyChordEdit) KiType() *gti.Type

KiType returns the *gti.Type of KeyChordEdit

func (*KeyChordEdit) New

func (t *KeyChordEdit) New() ki.Ki

New returns a new *KeyChordEdit value

func (*KeyChordEdit) OnInit

func (kc *KeyChordEdit) OnInit()

func (*KeyChordEdit) SetClass

func (t *KeyChordEdit) SetClass(v string) *KeyChordEdit

SetClass sets the [KeyChordEdit.Class]

func (*KeyChordEdit) SetCustomContextMenu

func (t *KeyChordEdit) SetCustomContextMenu(v func(m *gi.Scene)) *KeyChordEdit

SetCustomContextMenu sets the [KeyChordEdit.CustomContextMenu]

func (*KeyChordEdit) SetFocusActive

func (t *KeyChordEdit) SetFocusActive(v bool) *KeyChordEdit

SetFocusActive sets the [KeyChordEdit.FocusActive]: true if the keyboard focus is active or not -- when we lose active focus we apply changes

func (*KeyChordEdit) SetStyles

func (kc *KeyChordEdit) SetStyles()

func (*KeyChordEdit) SetText

func (t *KeyChordEdit) SetText(v string) *KeyChordEdit

SetText sets the [KeyChordEdit.Text]

func (*KeyChordEdit) SetTooltip

func (t *KeyChordEdit) SetTooltip(v string) *KeyChordEdit

SetTooltip sets the [KeyChordEdit.Tooltip]

func (*KeyChordEdit) SetType

func (t *KeyChordEdit) SetType(v gi.LabelTypes) *KeyChordEdit

SetType sets the [KeyChordEdit.Type]

type KeyChordValue

type KeyChordValue struct {
	ValueBase
}

KeyChordValue presents an KeyChordEdit for key.Chord

func (*KeyChordValue) ConfigWidget

func (vv *KeyChordValue) ConfigWidget(w gi.Widget)

func (*KeyChordValue) HasDialog

func (vv *KeyChordValue) HasDialog() bool

func (*KeyChordValue) UpdateWidget

func (vv *KeyChordValue) UpdateWidget()

func (*KeyChordValue) WidgetType

func (vv *KeyChordValue) WidgetType() *gti.Type

type KeyMapValue

type KeyMapValue struct {
	ValueBase
}

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

func (*KeyMapValue) ConfigDialog

func (vv *KeyMapValue) ConfigDialog(d *gi.Body) (bool, func())

func (*KeyMapValue) ConfigWidget

func (vv *KeyMapValue) ConfigWidget(w gi.Widget)

func (*KeyMapValue) HasDialog

func (vv *KeyMapValue) HasDialog() bool

func (*KeyMapValue) OpenDialog

func (vv *KeyMapValue) OpenDialog(ctx gi.Widget, fun func())

func (*KeyMapValue) UpdateWidget

func (vv *KeyMapValue) UpdateWidget()

func (*KeyMapValue) WidgetType

func (vv *KeyMapValue) WidgetType() *gti.Type

type KiPtrValue

type KiPtrValue struct {
	ValueBase
}

KiPtrValue provides a chooser for pointers to Ki objects

func (*KiPtrValue) ConfigDialog

func (vv *KiPtrValue) ConfigDialog(d *gi.Body) (bool, func())

func (*KiPtrValue) ConfigWidget

func (vv *KiPtrValue) ConfigWidget(w gi.Widget)

func (*KiPtrValue) HasDialog

func (vv *KiPtrValue) HasDialog() bool

func (*KiPtrValue) KiStruct

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

get the Ki struct itself (or nil)

func (*KiPtrValue) OpenDialog

func (vv *KiPtrValue) OpenDialog(ctx gi.Widget, fun func())

func (*KiPtrValue) UpdateWidget

func (vv *KiPtrValue) UpdateWidget()

func (*KiPtrValue) WidgetType

func (vv *KiPtrValue) WidgetType() *gti.Type

type MapInlineValue

type MapInlineValue struct {
	ValueBase
}

MapInlineValue presents a MapViewInline for a map

func (*MapInlineValue) ConfigWidget

func (vv *MapInlineValue) ConfigWidget(w gi.Widget)

func (*MapInlineValue) UpdateWidget

func (vv *MapInlineValue) UpdateWidget()

func (*MapInlineValue) WidgetType

func (vv *MapInlineValue) WidgetType() *gti.Type

type MapValue

type MapValue struct {
	ValueBase
}

MapValue presents a button to edit maps

func (*MapValue) ConfigDialog

func (vv *MapValue) ConfigDialog(d *gi.Body) (bool, func())

func (*MapValue) ConfigWidget

func (vv *MapValue) ConfigWidget(w gi.Widget)

func (*MapValue) HasDialog

func (vv *MapValue) HasDialog() bool

func (*MapValue) OpenDialog

func (vv *MapValue) OpenDialog(ctx gi.Widget, fun func())

func (*MapValue) UpdateWidget

func (vv *MapValue) UpdateWidget()

func (*MapValue) WidgetType

func (vv *MapValue) WidgetType() *gti.Type

type MapView

type MapView struct {
	gi.Frame

	// the map that we are a view onto
	Map any `set:"-"`

	// Value for the map itself, if this was created within value view framework -- otherwise nil
	MapValView Value

	// has the map been edited?
	Changed bool `set:"-"`

	// Value representations of the map keys
	Keys []Value `json:"-" xml:"-"`

	// Value representations of the map values
	Values []Value `json:"-" xml:"-"`

	// sort by values instead of keys
	SortVals bool

	// the number of columns in the map; do not set externally; generally only access internally
	NCols int

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `json:"-" xml:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string
}

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 NewMapView

func NewMapView(par ki.Ki, name ...string) *MapView

NewMapView adds a new MapView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*MapView) ConfigMapGrid

func (mv *MapView) ConfigMapGrid()

ConfigMapGrid configures the MapGrid for the current map

func (*MapView) ConfigToolbar

func (mv *MapView) ConfigToolbar(tb *gi.Toolbar)

ConfigToolbar configures a gi.Toolbar for this view

func (*MapView) ConfigWidget

func (mv *MapView) ConfigWidget()

Config configures the view

func (*MapView) IsConfiged

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

func (t *MapView) KiType() *gti.Type

KiType returns the *gti.Type of MapView

func (*MapView) MapAdd

func (mv *MapView) MapAdd()

MapAdd adds a new entry to the map

func (*MapView) MapChangeValueType

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

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

func (*MapView) MapDelete

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

MapDelete deletes a key-value from the map

func (*MapView) MapGrid

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

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

func (*MapView) New

func (t *MapView) New() ki.Ki

New returns a new *MapView value

func (*MapView) OnInit

func (mv *MapView) OnInit()

func (*MapView) SetChanged

func (mv *MapView) SetChanged()

SetChanged sets the Changed flag and emits the ViewSig signal for the MapView, indicating that some kind of edit / change has taken place to the table data.

func (*MapView) SetClass

func (t *MapView) SetClass(v string) *MapView

SetClass sets the [MapView.Class]

func (*MapView) SetCustomContextMenu

func (t *MapView) SetCustomContextMenu(v func(m *gi.Scene)) *MapView

SetCustomContextMenu sets the [MapView.CustomContextMenu]

func (*MapView) SetKeys

func (t *MapView) SetKeys(v []Value) *MapView

SetKeys sets the [MapView.Keys]: Value representations of the map keys

func (*MapView) SetMap

func (mv *MapView) SetMap(mp any) *MapView

SetMap sets the source map that we are viewing. Rebuilds the children to represent this map

func (*MapView) SetMapValView

func (t *MapView) SetMapValView(v Value) *MapView

SetMapValView sets the [MapView.MapValView]: Value for the map itself, if this was created within value view framework -- otherwise nil

func (*MapView) SetNcols

func (t *MapView) SetNcols(v int) *MapView

SetNcols sets the [MapView.NCols]: the number of columns in the map; do not set externally; generally only access internally

func (*MapView) SetSortVals

func (t *MapView) SetSortVals(v bool) *MapView

SetSortVals sets the [MapView.SortVals]: sort by values instead of keys

func (*MapView) SetStackTop

func (t *MapView) SetStackTop(v int) *MapView

SetStackTop sets the [MapView.StackTop]

func (*MapView) SetStripes

func (t *MapView) SetStripes(v gi.Stripes) *MapView

SetStripes sets the [MapView.Stripes]

func (*MapView) SetStyles

func (mv *MapView) SetStyles()

func (*MapView) SetTmpSave

func (t *MapView) SetTmpSave(v Value) *MapView

SetTmpSave sets the [MapView.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*MapView) SetTooltip

func (t *MapView) SetTooltip(v string) *MapView

SetTooltip sets the [MapView.Tooltip]

func (*MapView) SetValues

func (t *MapView) SetValues(v []Value) *MapView

SetValues sets the [MapView.Values]: Value representations of the map values

func (*MapView) SetViewPath

func (t *MapView) SetViewPath(v string) *MapView

SetViewPath sets the [MapView.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

func (*MapView) ToggleSort

func (mv *MapView) ToggleSort()

ToggleSort toggles sorting by values vs. keys

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

	// the map that we are a view onto
	Map any `set:"-"`

	// Value for the map itself, if this was created within value view framework -- otherwise nil
	MapValView Value

	// has the map been edited?
	Changed bool `set:"-"`

	// Value representations of the map keys
	Keys []Value `json:"-" xml:"-"`

	// Value representations of the fields
	Values []Value `json:"-" xml:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `view:"-" json:"-" xml:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string
}

MapViewInline represents a map as a single line widget, for smaller maps and those explicitly marked inline.

func NewMapViewInline

func NewMapViewInline(par ki.Ki, name ...string) *MapViewInline

NewMapViewInline adds a new MapViewInline with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*MapViewInline) ConfigMap

func (mv *MapViewInline) ConfigMap() bool

ConfigMap configures children for map view

func (*MapViewInline) ConfigWidget

func (mv *MapViewInline) ConfigWidget()

func (*MapViewInline) KiType

func (t *MapViewInline) KiType() *gti.Type

KiType returns the *gti.Type of MapViewInline

func (*MapViewInline) MapAdd

func (mv *MapViewInline) MapAdd()

MapAdd adds a new entry to the map

func (*MapViewInline) New

func (t *MapViewInline) New() ki.Ki

New returns a new *MapViewInline value

func (*MapViewInline) OnInit

func (mv *MapViewInline) OnInit()

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

func (t *MapViewInline) SetClass(v string) *MapViewInline

SetClass sets the [MapViewInline.Class]

func (*MapViewInline) SetCustomContextMenu

func (t *MapViewInline) SetCustomContextMenu(v func(m *gi.Scene)) *MapViewInline

SetCustomContextMenu sets the [MapViewInline.CustomContextMenu]

func (*MapViewInline) SetKeys

func (t *MapViewInline) SetKeys(v []Value) *MapViewInline

SetKeys sets the [MapViewInline.Keys]: Value representations of the map keys

func (*MapViewInline) SetMap

func (mv *MapViewInline) SetMap(mp any) *MapViewInline

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

func (*MapViewInline) SetMapValView

func (t *MapViewInline) SetMapValView(v Value) *MapViewInline

SetMapValView sets the [MapViewInline.MapValView]: Value for the map itself, if this was created within value view framework -- otherwise nil

func (*MapViewInline) SetStackTop

func (t *MapViewInline) SetStackTop(v int) *MapViewInline

SetStackTop sets the [MapViewInline.StackTop]

func (*MapViewInline) SetStyles

func (mv *MapViewInline) SetStyles()

func (*MapViewInline) SetTmpSave

func (t *MapViewInline) SetTmpSave(v Value) *MapViewInline

SetTmpSave sets the [MapViewInline.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*MapViewInline) SetTooltip

func (t *MapViewInline) SetTooltip(v string) *MapViewInline

SetTooltip sets the [MapViewInline.Tooltip]

func (*MapViewInline) SetValues

func (t *MapViewInline) SetValues(v []Value) *MapViewInline

SetValues sets the [MapViewInline.Values]: Value representations of the fields

func (*MapViewInline) SetViewPath

func (t *MapViewInline) SetViewPath(v string) *MapViewInline

SetViewPath sets the [MapViewInline.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

func (*MapViewInline) UpdateValues

func (mv *MapViewInline) UpdateValues()

type NilValue

type NilValue struct {
	ValueBase
}

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

func (*NilValue) ConfigWidget

func (vv *NilValue) ConfigWidget(w gi.Widget)

func (*NilValue) UpdateWidget

func (vv *NilValue) UpdateWidget()

func (*NilValue) WidgetType

func (vv *NilValue) WidgetType() *gti.Type

type OptionValue

type OptionValue struct {
	ValueBase
}

OptionValue presents an [option.Option]

func (*OptionValue) ConfigWidget

func (vv *OptionValue) ConfigWidget(w gi.Widget)

func (*OptionValue) UpdateWidget

func (vv *OptionValue) UpdateWidget()

func (*OptionValue) WidgetType

func (vv *OptionValue) WidgetType() *gti.Type

type RuneSliceValue

type RuneSliceValue struct {
	ValueBase
}

RuneSliceValue presents a textfield of the bytes

func (*RuneSliceValue) ConfigWidget

func (vv *RuneSliceValue) ConfigWidget(w gi.Widget)

func (*RuneSliceValue) UpdateWidget

func (vv *RuneSliceValue) UpdateWidget()

func (*RuneSliceValue) WidgetType

func (vv *RuneSliceValue) WidgetType() *gti.Type

type SliceInlineValue

type SliceInlineValue struct {
	ValueBase
}

SliceInlineValue presents a SliceViewInline for a map

func (*SliceInlineValue) ConfigWidget

func (vv *SliceInlineValue) ConfigWidget(w gi.Widget)

func (*SliceInlineValue) UpdateWidget

func (vv *SliceInlineValue) UpdateWidget()

func (*SliceInlineValue) WidgetType

func (vv *SliceInlineValue) WidgetType() *gti.Type

type SliceValue

type SliceValue struct {
	ValueBase
	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
}

SliceValue presents a button to edit slices

func (*SliceValue) ConfigDialog

func (vv *SliceValue) ConfigDialog(d *gi.Body) (bool, func())

func (*SliceValue) ConfigWidget

func (vv *SliceValue) ConfigWidget(w gi.Widget)

func (*SliceValue) GetTypeInfo

func (vv *SliceValue) GetTypeInfo()

func (*SliceValue) HasDialog

func (vv *SliceValue) HasDialog() bool

func (*SliceValue) OpenDialog

func (vv *SliceValue) OpenDialog(ctx gi.Widget, fun func())

func (*SliceValue) UpdateWidget

func (vv *SliceValue) UpdateWidget()

func (*SliceValue) WidgetType

func (vv *SliceValue) WidgetType() *gti.Type

type SliceView

type SliceView struct {
	SliceViewBase

	// optional styling function
	StyleFunc SliceViewStyleFunc `copy:"-" view:"-" json:"-" xml:"-"`
}

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 ReadOnly for select-only mode, which emits WidgetSig WidgetSelected signals when selection is updated.

func NewSliceView

func NewSliceView(par ki.Ki, name ...string) *SliceView

NewSliceView adds a new SliceView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*SliceView) KiType

func (t *SliceView) KiType() *gti.Type

KiType returns the *gti.Type of SliceView

func (*SliceView) New

func (t *SliceView) New() ki.Ki

New returns a new *SliceView value

func (*SliceView) SetClass

func (t *SliceView) SetClass(v string) *SliceView

SetClass sets the [SliceView.Class]

func (*SliceView) SetConfigIter

func (t *SliceView) SetConfigIter(v int) *SliceView

SetConfigIter sets the [SliceView.ConfigIter]

func (*SliceView) SetCustomContextMenu

func (t *SliceView) SetCustomContextMenu(v func(m *gi.Scene)) *SliceView

SetCustomContextMenu sets the [SliceView.CustomContextMenu]

func (*SliceView) SetDraggedIdxs

func (t *SliceView) SetDraggedIdxs(v []int) *SliceView

SetDraggedIdxs sets the [SliceView.DraggedIdxs]

func (*SliceView) SetElVal

func (t *SliceView) SetElVal(v reflect.Value) *SliceView

SetElVal sets the [SliceView.ElVal]

func (*SliceView) SetInitSelIdx

func (t *SliceView) SetInitSelIdx(v int) *SliceView

SetInitSelIdx sets the [SliceView.InitSelIdx]

func (*SliceView) SetMinRows

func (t *SliceView) SetMinRows(v int) *SliceView

SetMinRows sets the [SliceView.MinRows]

func (*SliceView) SetSelIdx

func (t *SliceView) SetSelIdx(v int) *SliceView

SetSelIdx sets the [SliceView.SelIdx]

func (*SliceView) SetSelIdxs

func (t *SliceView) SetSelIdxs(v map[int]struct{}) *SliceView

SetSelIdxs sets the [SliceView.SelIdxs]

func (*SliceView) SetSelVal

func (t *SliceView) SetSelVal(v any) *SliceView

SetSelVal sets the [SliceView.SelVal]

func (*SliceView) SetSliceNpval

func (t *SliceView) SetSliceNpval(v reflect.Value) *SliceView

SetSliceNpval sets the [SliceView.SliceNPVal]

func (*SliceView) SetSliceSize

func (t *SliceView) SetSliceSize(v int) *SliceView

SetSliceSize sets the [SliceView.SliceSize]

func (*SliceView) SetSliceValView

func (t *SliceView) SetSliceValView(v Value) *SliceView

SetSliceValView sets the [SliceView.SliceValView]

func (*SliceView) SetStackTop

func (t *SliceView) SetStackTop(v int) *SliceView

SetStackTop sets the [SliceView.StackTop]

func (*SliceView) SetStartIdx

func (t *SliceView) SetStartIdx(v int) *SliceView

SetStartIdx sets the [SliceView.StartIdx]

func (*SliceView) SetStripes

func (t *SliceView) SetStripes(v gi.Stripes) *SliceView

SetStripes sets the [SliceView.Stripes]

func (*SliceView) SetStyleFunc

func (t *SliceView) SetStyleFunc(v SliceViewStyleFunc) *SliceView

SetStyleFunc sets the [SliceView.StyleFunc]: optional styling function

func (*SliceView) SetTmpIdx

func (t *SliceView) SetTmpIdx(v int) *SliceView

SetTmpIdx sets the [SliceView.TmpIdx]

func (*SliceView) SetTmpSave

func (t *SliceView) SetTmpSave(v Value) *SliceView

SetTmpSave sets the [SliceView.TmpSave]

func (*SliceView) SetTooltip

func (t *SliceView) SetTooltip(v string) *SliceView

SetTooltip sets the [SliceView.Tooltip]

func (*SliceView) SetValues

func (t *SliceView) SetValues(v []Value) *SliceView

SetValues sets the [SliceView.Values]

func (*SliceView) SetViewMu

func (t *SliceView) SetViewMu(v *sync.Mutex) *SliceView

SetViewMu sets the [SliceView.ViewMu]

func (*SliceView) SetViewPath

func (t *SliceView) SetViewPath(v string) *SliceView

SetViewPath sets the [SliceView.ViewPath]

func (*SliceView) SetVisRows

func (t *SliceView) SetVisRows(v int) *SliceView

SetVisRows sets the [SliceView.VisRows]

func (*SliceView) StyleRow

func (sv *SliceView) StyleRow(w gi.Widget, idx, fidx int)

type SliceViewBase

type SliceViewBase struct {
	gi.Frame

	// the slice that we are a view onto -- must be a pointer to that slice
	Slice any `set:"-" json:"-" xml:"-"`

	// MinRows specifies the minimum number of rows to display, to ensure
	// at least this amount is displayed.
	MinRows int `def:"4"`

	// optional mutex that, if non-nil, will be used around any updates that
	// read / modify the underlying Slice data.
	// Can be used to protect against random updating if your code has specific
	// update points that can be likewise protected with this same mutex.
	ViewMu *sync.Mutex `copy:"-" view:"-" json:"-" xml:"-"`

	// Changed indicates whether the underlying slice
	// has been edited in any way
	Changed bool `set:"-"`

	// non-ptr reflect.Value of the slice
	SliceNPVal reflect.Value `copy:"-" view:"-" json:"-" xml:"-"`

	// Value for the slice itself, if this was created within value view framework -- otherwise nil
	SliceValView Value `copy:"-" view:"-" json:"-" xml:"-"`

	// Value representations of the slice values
	Values []Value `copy:"-" view:"-" json:"-" xml:"-"`

	// current selection value -- initially select this value if set
	SelVal any `copy:"-" view:"-" json:"-" xml:"-"`

	// index of currently-selected item, in ReadOnly mode only
	SelIdx int `copy:"-" json:"-" xml:"-"`

	// list of currently-selected slice indexes
	SelIdxs map[int]struct{} `copy:"-"`

	// index of row to select at start
	InitSelIdx int `copy:"-" json:"-" xml:"-"`

	// list of currently-dragged indexes
	DraggedIdxs []int `copy:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `copy:"-" json:"-" xml:"-"`

	// total number of rows visible in allocated display size
	VisRows int `edit:"-" copy:"-" json:"-" xml:"-"`

	// starting slice index of visible rows
	StartIdx int `edit:"-" copy:"-" json:"-" xml:"-"`

	// size of slice
	SliceSize int `edit:"-" copy:"-" json:"-" xml:"-"`

	// iteration through the configuration process, reset when a new slice type is set
	ConfigIter int `edit:"-" copy:"-" json:"-" xml:"-"`

	// temp idx state for e.g., dnd
	TmpIdx int `copy:"-" view:"-" json:"-" xml:"-"`

	// ElVal is a Value representation of the underlying element type
	// which is used whenever there are no slice elements available
	ElVal reflect.Value `copy:"-" view:"-" json:"-" xml:"-"`
}

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 ReadOnly for select-only mode, which emits WidgetSig WidgetSelected signals when selection is updated.

func NewSliceViewBase

func NewSliceViewBase(par ki.Ki, name ...string) *SliceViewBase

NewSliceViewBase adds a new SliceViewBase with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*SliceViewBase) AsSliceViewBase

func (sv *SliceViewBase) AsSliceViewBase() *SliceViewBase

func (*SliceViewBase) BindSelectDialog

func (sv *SliceViewBase) BindSelectDialog(val *int) *SliceViewBase

BindSelectDialog makes the slice view a read-only selection slice view and then binds its events to its scene and its current selection index to the given value.

func (*SliceViewBase) ConfigFrame

func (sv *SliceViewBase) ConfigFrame()

func (*SliceViewBase) ConfigRows

func (sv *SliceViewBase) ConfigRows()

ConfigRows configures VisRows worth of widgets to display slice data.

func (*SliceViewBase) ConfigScroll

func (sv *SliceViewBase) ConfigScroll()

ConfigScroll configures the scrollbar

func (*SliceViewBase) ConfigSliceView

func (sv *SliceViewBase) ConfigSliceView()

ConfigSliceView handles entire config. ReConfig calls this, followed by ApplyStyleTree so we don't need to call that.

func (*SliceViewBase) ConfigToolbar

func (sv *SliceViewBase) ConfigToolbar(tb *gi.Toolbar)

ConfigToolbar configures a gi.Toolbar for this view

func (*SliceViewBase) ConfigWidget

func (sv *SliceViewBase) ConfigWidget()

Config configures a standard setup of the overall Frame

func (*SliceViewBase) ContextMenu

func (sv *SliceViewBase) ContextMenu(m *gi.Scene)

func (*SliceViewBase) CopyIdxs

func (sv *SliceViewBase) CopyIdxs(reset bool)

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

func (*SliceViewBase) CopySelToMime

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

CopySelToMime copies selected rows to mime data

func (*SliceViewBase) CutIdxs

func (sv *SliceViewBase) CutIdxs()

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

func (*SliceViewBase) DeleteIdxs

func (sv *SliceViewBase) DeleteIdxs()

DeleteIdxs deletes all selected indexes

func (*SliceViewBase) DragDrop

func (sv *SliceViewBase) DragDrop(e events.Event)

func (*SliceViewBase) DragStart

func (sv *SliceViewBase) DragStart(e events.Event)

func (*SliceViewBase) DropDeleteSource

func (sv *SliceViewBase) DropDeleteSource(e events.Event)

DropDeleteSource handles delete source event for DropMove case

func (*SliceViewBase) DropFinalize

func (sv *SliceViewBase) DropFinalize(de *events.DragDrop)

DropFinalize is called to finalize Drop actions on the Source node. Only relevant for DropMod == DropMove.

func (*SliceViewBase) Duplicate

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

func (sv *SliceViewBase) FlagType() enums.BitFlagSetter

func (*SliceViewBase) FromMimeData

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

FromMimeData creates a slice of structs from mime data

func (*SliceViewBase) GridLayout

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

GridLayout returns the Layout containing the Grid and the scrollbar

func (*SliceViewBase) HandleEvents

func (sv *SliceViewBase) HandleEvents()

func (*SliceViewBase) IdxFromPos

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

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

func (*SliceViewBase) IdxGrabFocus

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

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

IdxIsSelected returns the selected status of given slice index

func (*SliceViewBase) IdxPos

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

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

func (*SliceViewBase) IsIdxVisible

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

IsIdxVisible returns true if slice index is currently visible

func (*SliceViewBase) IsNil

func (sv *SliceViewBase) IsNil() bool

IsNil returns true if the Slice is nil

func (*SliceViewBase) IsRowInBounds

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

IsRowInBounds returns true if disp row is in bounds

func (*SliceViewBase) KeyInputEditable

func (sv *SliceViewBase) KeyInputEditable(kt events.Event)

func (*SliceViewBase) KeyInputNav

func (sv *SliceViewBase) KeyInputNav(kt events.Event)

KeyInputNav supports multiple selection navigation keys

func (*SliceViewBase) KeyInputReadOnly

func (sv *SliceViewBase) KeyInputReadOnly(kt events.Event)

func (*SliceViewBase) KiType

func (t *SliceViewBase) KiType() *gti.Type

KiType returns the *gti.Type of SliceViewBase

func (*SliceViewBase) MakePasteMenu

func (sv *SliceViewBase) MakePasteMenu(m *gi.Scene, md mimedata.Mimes, idx int, mod events.DropMods, fun func())

MakePasteMenu makes the menu of options for paste events

func (*SliceViewBase) MimeDataIdx

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

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

func (*SliceViewBase) MimeDataType

func (sv *SliceViewBase) MimeDataType() string

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

func (*SliceViewBase) MoveDown

func (sv *SliceViewBase) MoveDown(selMode events.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

func (sv *SliceViewBase) MoveDownAction(selMode events.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

func (sv *SliceViewBase) MovePageDown(selMode events.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

func (sv *SliceViewBase) MovePageDownAction(selMode events.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

func (sv *SliceViewBase) MovePageUp(selMode events.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

func (sv *SliceViewBase) MovePageUpAction(selMode events.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

func (sv *SliceViewBase) MoveUp(selMode events.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

func (sv *SliceViewBase) MoveUpAction(selMode events.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) New

func (t *SliceViewBase) New() ki.Ki

New returns a new *SliceViewBase value

func (*SliceViewBase) OnInit

func (sv *SliceViewBase) OnInit()

func (*SliceViewBase) PasteAssign

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

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

func (*SliceViewBase) PasteAtIdx

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

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

func (*SliceViewBase) PasteIdx

func (sv *SliceViewBase) PasteIdx(idx int)

PasteIdx pastes clipboard at given idx

func (*SliceViewBase) PasteMenu

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

func (sv *SliceViewBase) ResetSelectedIdxs()

func (*SliceViewBase) RowFirstWidget

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

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

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

func (*SliceViewBase) RowGrabFocus

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

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

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

func (*SliceViewBase) SaveDraggedIdxs

func (sv *SliceViewBase) SaveDraggedIdxs(idx int)

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

func (*SliceViewBase) ScrollBar

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

ScrollBar returns the SliceGrid scrollbar

func (*SliceViewBase) ScrollToIdx

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

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

func (*SliceViewBase) ScrollToIdxNoUpdt

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

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

func (*SliceViewBase) SelectAllIdxs

func (sv *SliceViewBase) SelectAllIdxs()

SelectAllIdxs selects all idxs

func (*SliceViewBase) SelectIdx

func (sv *SliceViewBase) SelectIdx(idx int)

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

func (*SliceViewBase) SelectIdxAction

func (sv *SliceViewBase) SelectIdxAction(idx int, mode events.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

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

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

SelectRowWidgets sets the selection state of given row of widgets

func (*SliceViewBase) SelectVal

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

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

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

func (*SliceViewBase) SetChanged

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

func (t *SliceViewBase) SetClass(v string) *SliceViewBase

SetClass sets the [SliceViewBase.Class]

func (*SliceViewBase) SetConfigIter

func (t *SliceViewBase) SetConfigIter(v int) *SliceViewBase

SetConfigIter sets the [SliceViewBase.ConfigIter]: iteration through the configuration process, reset when a new slice type is set

func (*SliceViewBase) SetCustomContextMenu

func (t *SliceViewBase) SetCustomContextMenu(v func(m *gi.Scene)) *SliceViewBase

SetCustomContextMenu sets the [SliceViewBase.CustomContextMenu]

func (*SliceViewBase) SetDraggedIdxs

func (t *SliceViewBase) SetDraggedIdxs(v []int) *SliceViewBase

SetDraggedIdxs sets the [SliceViewBase.DraggedIdxs]: list of currently-dragged indexes

func (*SliceViewBase) SetElVal

func (t *SliceViewBase) SetElVal(v reflect.Value) *SliceViewBase

SetElVal sets the [SliceViewBase.ElVal]: ElVal is a Value representation of the underlying element type which is used whenever there are no slice elements available

func (*SliceViewBase) SetInitSelIdx

func (t *SliceViewBase) SetInitSelIdx(v int) *SliceViewBase

SetInitSelIdx sets the [SliceViewBase.InitSelIdx]: index of row to select at start

func (*SliceViewBase) SetMinRows

func (t *SliceViewBase) SetMinRows(v int) *SliceViewBase

SetMinRows sets the [SliceViewBase.MinRows]: MinRows specifies the minimum number of rows to display, to ensure at least this amount is displayed.

func (*SliceViewBase) SetSelIdx

func (t *SliceViewBase) SetSelIdx(v int) *SliceViewBase

SetSelIdx sets the [SliceViewBase.SelIdx]: index of currently-selected item, in ReadOnly mode only

func (*SliceViewBase) SetSelIdxs

func (t *SliceViewBase) SetSelIdxs(v map[int]struct{}) *SliceViewBase

SetSelIdxs sets the [SliceViewBase.SelIdxs]: list of currently-selected slice indexes

func (*SliceViewBase) SetSelVal

func (t *SliceViewBase) SetSelVal(v any) *SliceViewBase

SetSelVal sets the [SliceViewBase.SelVal]: current selection value -- initially select this value if set

func (*SliceViewBase) SetSlice

func (sv *SliceViewBase) SetSlice(sl any) *SliceViewBase

SetSlice sets the source slice that we are viewing. This ReConfigs the view for this slice if different. Note: it is important to at least set an empty slice of the desired type at the start to enable initial configuration.

func (*SliceViewBase) SetSliceNpval

func (t *SliceViewBase) SetSliceNpval(v reflect.Value) *SliceViewBase

SetSliceNpval sets the [SliceViewBase.SliceNPVal]: non-ptr reflect.Value of the slice

func (*SliceViewBase) SetSliceSize

func (t *SliceViewBase) SetSliceSize(v int) *SliceViewBase

SetSliceSize sets the [SliceViewBase.SliceSize]: size of slice

func (*SliceViewBase) SetSliceValView

func (t *SliceViewBase) SetSliceValView(v Value) *SliceViewBase

SetSliceValView sets the [SliceViewBase.SliceValView]: Value for the slice itself, if this was created within value view framework -- otherwise nil

func (*SliceViewBase) SetStackTop

func (t *SliceViewBase) SetStackTop(v int) *SliceViewBase

SetStackTop sets the [SliceViewBase.StackTop]

func (*SliceViewBase) SetStartIdx

func (t *SliceViewBase) SetStartIdx(v int) *SliceViewBase

SetStartIdx sets the [SliceViewBase.StartIdx]: starting slice index of visible rows

func (*SliceViewBase) SetStripes

func (t *SliceViewBase) SetStripes(v gi.Stripes) *SliceViewBase

SetStripes sets the [SliceViewBase.Stripes]

func (*SliceViewBase) SetStyles

func (sv *SliceViewBase) SetStyles()

func (*SliceViewBase) SetTmpIdx

func (t *SliceViewBase) SetTmpIdx(v int) *SliceViewBase

SetTmpIdx sets the [SliceViewBase.TmpIdx]: temp idx state for e.g., dnd

func (*SliceViewBase) SetTmpSave

func (t *SliceViewBase) SetTmpSave(v Value) *SliceViewBase

SetTmpSave sets the [SliceViewBase.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*SliceViewBase) SetTooltip

func (t *SliceViewBase) SetTooltip(v string) *SliceViewBase

SetTooltip sets the [SliceViewBase.Tooltip]

func (*SliceViewBase) SetValues

func (t *SliceViewBase) SetValues(v []Value) *SliceViewBase

SetValues sets the [SliceViewBase.Values]: Value representations of the slice values

func (*SliceViewBase) SetViewMu

func (t *SliceViewBase) SetViewMu(v *sync.Mutex) *SliceViewBase

SetViewMu sets the [SliceViewBase.ViewMu]: optional mutex that, if non-nil, will be used around any updates that read / modify the underlying Slice data. Can be used to protect against random updating if your code has specific update points that can be likewise protected with this same mutex.

func (*SliceViewBase) SetViewPath

func (t *SliceViewBase) SetViewPath(v string) *SliceViewBase

SetViewPath sets the [SliceViewBase.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

func (*SliceViewBase) SetVisRows

func (t *SliceViewBase) SetVisRows(v int) *SliceViewBase

SetVisRows sets the [SliceViewBase.VisRows]: total number of rows visible in allocated display size

func (*SliceViewBase) SizeFinal

func (sv *SliceViewBase) SizeFinal()

func (*SliceViewBase) SliceDeleteAt

func (sv *SliceViewBase) SliceDeleteAt(idx int)

SliceDeleteAt deletes element at given index from slice

func (*SliceViewBase) SliceDeleteAtRow

func (sv *SliceViewBase) SliceDeleteAtRow(row int)

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

func (*SliceViewBase) SliceDeleteAtSel

func (sv *SliceViewBase) SliceDeleteAtSel(idx int)

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

func (*SliceViewBase) SliceGrid

func (sv *SliceViewBase) SliceGrid() *SliceViewGrid

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

func (*SliceViewBase) SliceNewAt

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

func (sv *SliceViewBase) SliceNewAtRow(row int)

SliceNewAtRow inserts a new blank element at given display row

func (*SliceViewBase) SliceNewAtSel

func (sv *SliceViewBase) SliceNewAtSel(idx int)

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

func (*SliceViewBase) SliceVal

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

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

func (*SliceViewBase) SliceViewContextMenu

func (sv *SliceViewBase) SliceViewContextMenu(m *gi.Scene)

func (*SliceViewBase) UnselectAllIdxs

func (sv *SliceViewBase) UnselectAllIdxs()

UnselectAllIdxs unselects all selected idxs

func (*SliceViewBase) UnselectIdx

func (sv *SliceViewBase) UnselectIdx(idx int)

UnselectIdx unselects given idx (if selected)

func (*SliceViewBase) UnselectIdxAction

func (sv *SliceViewBase) UnselectIdxAction(idx int)

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

func (*SliceViewBase) UpdateScroll

func (sv *SliceViewBase) UpdateScroll()

UpdateScroll updates grid scrollbar based on display

func (*SliceViewBase) UpdateSelectIdx

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

UpdateSelectIdx updates the selection for the given index

func (*SliceViewBase) UpdateSelectRow

func (sv *SliceViewBase) UpdateSelectRow(row int)

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

func (*SliceViewBase) UpdateStartIdx

func (sv *SliceViewBase) UpdateStartIdx()

UpdateStartIdx updates StartIdx to fit current view

func (*SliceViewBase) UpdateWidgets

func (sv *SliceViewBase) UpdateWidgets()

UpdateWidgets updates the row widget display to represent the current state of the slice data, including which range of data is being displayed. This is called for scrolling, navigation etc.

func (*SliceViewBase) UpdtSliceSize

func (sv *SliceViewBase) UpdtSliceSize() int

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

func (*SliceViewBase) ViewMuLock

func (sv *SliceViewBase) ViewMuLock()

ViewMuLock locks the ViewMu if non-nil

func (*SliceViewBase) ViewMuUnlock

func (sv *SliceViewBase) ViewMuUnlock()

ViewMuUnlock Unlocks the ViewMu if non-nil

type SliceViewFlags

type SliceViewFlags gi.WidgetFlags //enums:bitflag -trim-prefix SliceView

SliceViewFlags extend WidgetFlags to hold SliceView state

const (
	// indicates that the widgets have been configured and
	SliceViewConfiged SliceViewFlags = SliceViewFlags(gi.WidgetFlagsN) + iota

	// if true, user cannot add elements to the slice
	SliceViewNoAdd

	// if true, user cannot delete elements from the slice
	SliceViewNoDelete

	// whether the slice is actually an array -- no modifications -- set by SetSlice
	SliceViewIsArray

	// whether to show index or not
	SliceViewShowIndex

	// support key navigation when ReadOnly (default true).
	// uses a capture of up / down events to manipulate selection, not focus.
	SliceViewReadOnlyKeyNav

	// editing-mode select rows mode
	SliceViewSelectMode

	// if view is ReadOnly, default selection mode is to choose one row only -- if this is true, standard multiple selection logic with modifier keys is instead supported
	SliceViewReadOnlyMultiSel

	// guard for recursive focus grabbing
	SliceViewInFocusGrab

	// guard for recursive rebuild
	SliceViewInFullRebuild
)
const SliceViewFlagsN SliceViewFlags = 18

SliceViewFlagsN is the highest valid value for type SliceViewFlags, plus one.

func SliceViewFlagsValues

func SliceViewFlagsValues() []SliceViewFlags

SliceViewFlagsValues returns all possible values for the type SliceViewFlags.

func (SliceViewFlags) BitIndexString

func (i SliceViewFlags) BitIndexString() string

BitIndexString returns the string representation of this SliceViewFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.

func (SliceViewFlags) Desc

func (i SliceViewFlags) Desc() string

Desc returns the description of the SliceViewFlags value.

func (SliceViewFlags) HasFlag

func (i SliceViewFlags) HasFlag(f enums.BitFlag) bool

HasFlag returns whether these bit flags have the given bit flag set.

func (SliceViewFlags) Int64

func (i SliceViewFlags) Int64() int64

Int64 returns the SliceViewFlags value as an int64.

func (SliceViewFlags) IsValid

func (i SliceViewFlags) IsValid() bool

IsValid returns whether the value is a valid option for type SliceViewFlags.

func (SliceViewFlags) MarshalText

func (i SliceViewFlags) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*SliceViewFlags) SetFlag

func (i *SliceViewFlags) SetFlag(on bool, f ...enums.BitFlag)

SetFlag sets the value of the given flags in these flags to the given value.

func (*SliceViewFlags) SetInt64

func (i *SliceViewFlags) SetInt64(in int64)

SetInt64 sets the SliceViewFlags value from an int64.

func (*SliceViewFlags) SetString

func (i *SliceViewFlags) SetString(s string) error

SetString sets the SliceViewFlags value from its string representation, and returns an error if the string is invalid.

func (*SliceViewFlags) SetStringOr

func (i *SliceViewFlags) SetStringOr(s string) error

SetStringOr sets the SliceViewFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.

func (SliceViewFlags) String

func (i SliceViewFlags) String() string

String returns the string representation of this SliceViewFlags value.

func (*SliceViewFlags) UnmarshalText

func (i *SliceViewFlags) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (SliceViewFlags) Values

func (i SliceViewFlags) Values() []enums.Enum

Values returns all possible values for the type SliceViewFlags.

type SliceViewGrid

type SliceViewGrid struct {
	gi.Frame // note: must be a frame to support stripes!

	// MinRows is set from parent SV
	MinRows int `edit:"-"`

	// height of a single row, computed during layout
	RowHeight float32 `edit:"-" copy:"-" json:"-" xml:"-"`

	// total number of rows visible in allocated display size
	VisRows int `edit:"-" copy:"-" json:"-" xml:"-"`
}

SliceViewGrid handles the resizing logic for SliceView, TableView.

func NewSliceViewGrid

func NewSliceViewGrid(par ki.Ki, name ...string) *SliceViewGrid

NewSliceViewGrid adds a new SliceViewGrid with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*SliceViewGrid) KiType

func (t *SliceViewGrid) KiType() *gti.Type

KiType returns the *gti.Type of SliceViewGrid

func (*SliceViewGrid) New

func (t *SliceViewGrid) New() ki.Ki

New returns a new *SliceViewGrid value

func (*SliceViewGrid) OnInit

func (sg *SliceViewGrid) OnInit()

func (*SliceViewGrid) SetClass

func (t *SliceViewGrid) SetClass(v string) *SliceViewGrid

SetClass sets the [SliceViewGrid.Class]

func (*SliceViewGrid) SetCustomContextMenu

func (t *SliceViewGrid) SetCustomContextMenu(v func(m *gi.Scene)) *SliceViewGrid

SetCustomContextMenu sets the [SliceViewGrid.CustomContextMenu]

func (*SliceViewGrid) SetMinRows

func (t *SliceViewGrid) SetMinRows(v int) *SliceViewGrid

SetMinRows sets the [SliceViewGrid.MinRows]: MinRows is set from parent SV

func (*SliceViewGrid) SetRowHeight

func (t *SliceViewGrid) SetRowHeight(v float32) *SliceViewGrid

SetRowHeight sets the [SliceViewGrid.RowHeight]: height of a single row, computed during layout

func (*SliceViewGrid) SetStackTop

func (t *SliceViewGrid) SetStackTop(v int) *SliceViewGrid

SetStackTop sets the [SliceViewGrid.StackTop]

func (*SliceViewGrid) SetStripes

func (t *SliceViewGrid) SetStripes(v gi.Stripes) *SliceViewGrid

SetStripes sets the [SliceViewGrid.Stripes]

func (*SliceViewGrid) SetTooltip

func (t *SliceViewGrid) SetTooltip(v string) *SliceViewGrid

SetTooltip sets the [SliceViewGrid.Tooltip]

func (*SliceViewGrid) SetVisRows

func (t *SliceViewGrid) SetVisRows(v int) *SliceViewGrid

SetVisRows sets the [SliceViewGrid.VisRows]: total number of rows visible in allocated display size

func (*SliceViewGrid) SizeFromChildren

func (sg *SliceViewGrid) SizeFromChildren(iter int, pass gi.LayoutPasses) mat32.Vec2

type SliceViewInline

type SliceViewInline struct {
	gi.Layout

	// the slice that we are a view onto
	Slice any `set:"-"`

	// Value for the slice itself, if this was created within value view framework -- otherwise nil
	SliceValView Value

	// whether the slice is actually an array -- no modifications
	IsArray bool

	// whether the slice has a fixed-len flag on it
	IsFixedLen bool

	// has the slice been edited?
	Changed bool `set:"-"`

	// Value representations of the fields
	Values []Value `json:"-" xml:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `view:"-" json:"-" xml:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string
}

SliceViewInline represents a slice as a single line widget, for smaller slices and those explicitly marked inline.

func NewSliceViewInline

func NewSliceViewInline(par ki.Ki, name ...string) *SliceViewInline

NewSliceViewInline adds a new SliceViewInline with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*SliceViewInline) ConfigSlice

func (sv *SliceViewInline) ConfigSlice() bool

ConfigSlice configures children for slice view

func (*SliceViewInline) ConfigWidget

func (sv *SliceViewInline) ConfigWidget()

func (*SliceViewInline) KiType

func (t *SliceViewInline) KiType() *gti.Type

KiType returns the *gti.Type of SliceViewInline

func (*SliceViewInline) New

func (t *SliceViewInline) New() ki.Ki

New returns a new *SliceViewInline value

func (*SliceViewInline) OnInit

func (sv *SliceViewInline) OnInit()

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

func (t *SliceViewInline) SetClass(v string) *SliceViewInline

SetClass sets the [SliceViewInline.Class]

func (*SliceViewInline) SetCustomContextMenu

func (t *SliceViewInline) SetCustomContextMenu(v func(m *gi.Scene)) *SliceViewInline

SetCustomContextMenu sets the [SliceViewInline.CustomContextMenu]

func (*SliceViewInline) SetIsArray

func (t *SliceViewInline) SetIsArray(v bool) *SliceViewInline

SetIsArray sets the [SliceViewInline.IsArray]: whether the slice is actually an array -- no modifications

func (*SliceViewInline) SetIsFixedLen

func (t *SliceViewInline) SetIsFixedLen(v bool) *SliceViewInline

SetIsFixedLen sets the [SliceViewInline.IsFixedLen]: whether the slice has a fixed-len flag on it

func (*SliceViewInline) SetSlice

func (sv *SliceViewInline) SetSlice(sl any) *SliceViewInline

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

func (*SliceViewInline) SetSliceValView

func (t *SliceViewInline) SetSliceValView(v Value) *SliceViewInline

SetSliceValView sets the [SliceViewInline.SliceValView]: Value for the slice itself, if this was created within value view framework -- otherwise nil

func (*SliceViewInline) SetStackTop

func (t *SliceViewInline) SetStackTop(v int) *SliceViewInline

SetStackTop sets the [SliceViewInline.StackTop]

func (*SliceViewInline) SetStyles

func (sv *SliceViewInline) SetStyles()

func (*SliceViewInline) SetTmpSave

func (t *SliceViewInline) SetTmpSave(v Value) *SliceViewInline

SetTmpSave sets the [SliceViewInline.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*SliceViewInline) SetTooltip

func (t *SliceViewInline) SetTooltip(v string) *SliceViewInline

SetTooltip sets the [SliceViewInline.Tooltip]

func (*SliceViewInline) SetValues

func (t *SliceViewInline) SetValues(v []Value) *SliceViewInline

SetValues sets the [SliceViewInline.Values]: Value representations of the fields

func (*SliceViewInline) SetViewPath

func (t *SliceViewInline) SetViewPath(v string) *SliceViewInline

SetViewPath sets the [SliceViewInline.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

func (*SliceViewInline) SliceNewAt

func (sv *SliceViewInline) SliceNewAt(idx int)

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

func (*SliceViewInline) UpdateValues

func (sv *SliceViewInline) UpdateValues()

type SliceViewStyleFunc

type SliceViewStyleFunc func(w gi.Widget, s *styles.Style, row int)

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

type SliceViewer

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

	// SliceGrid returns the SliceViewGrid grid Layout widget,
	// which contains all the fields and values
	SliceGrid() *SliceViewGrid

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

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

	// UpdtSliceSize updates the current size of the slice
	// and sets SliceSize if changed.
	UpdtSliceSize() int

	// ConfigRows configures VisRows worth of widgets
	// to display slice data.
	ConfigRows()

	// UpdateWidgets updates the row widget display to
	// represent the current state of the slice data,
	// including which range of data is being displayed.
	// This is called for scrolling, navigation etc.
	UpdateWidgets()

	// StyleRow calls a custom style function on given row (and field)
	StyleRow(w gi.Widget, idx, fidx int)

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

	// MimeDataType returns the data type for mime clipboard
	// (copy / paste) data e.g., fi.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)

	MakePasteMenu(m *gi.Scene, md mimedata.Mimes, idx int, mod events.DropMods, fun func())
	DragStart(e events.Event)
	DragDrop(e events.Event)
	DropFinalize(de *events.DragDrop)
	DropDeleteSource(e events.Event)
}

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

type SliderValue

type SliderValue struct {
	ValueBase
}

SliderValue presents a slider

func (*SliderValue) ConfigWidget

func (vv *SliderValue) ConfigWidget(w gi.Widget)

func (*SliderValue) UpdateWidget

func (vv *SliderValue) UpdateWidget()

func (*SliderValue) WidgetType

func (vv *SliderValue) WidgetType() *gti.Type

type StructFieldVals

type StructFieldVals struct {

	// path of field.field parent fields to this field
	Path string

	// type information for field
	Field reflect.StructField

	// value of field (as a pointer)
	Val reflect.Value

	// def tag information for default values
	Defs string
}

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

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

StructNonDefFields processses "def" tag for default value(s) of fields in given struct and starting path, and returns all fields not at their default values. See also StructNoDefFieldsStr for a string representation of this information. Uses laser.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 StructInlineValue

type StructInlineValue struct {
	ValueBase
}

StructInlineValue presents a StructViewInline for a struct

func (*StructInlineValue) ConfigWidget

func (vv *StructInlineValue) ConfigWidget(w gi.Widget)

func (*StructInlineValue) UpdateWidget

func (vv *StructInlineValue) UpdateWidget()

func (*StructInlineValue) WidgetType

func (vv *StructInlineValue) WidgetType() *gti.Type

type StructValue

type StructValue struct {
	ValueBase
}

StructValue presents a button to edit the struct

func (*StructValue) ConfigDialog

func (vv *StructValue) ConfigDialog(d *gi.Body) (bool, func())

func (*StructValue) ConfigWidget

func (vv *StructValue) ConfigWidget(w gi.Widget)

func (*StructValue) HasDialog

func (vv *StructValue) HasDialog() bool

func (*StructValue) OpenDialog

func (vv *StructValue) OpenDialog(ctx gi.Widget, fun func())

func (*StructValue) UpdateWidget

func (vv *StructValue) UpdateWidget()

func (*StructValue) WidgetType

func (vv *StructValue) WidgetType() *gti.Type

type StructView

type StructView struct {
	gi.Frame

	// the struct that we are a view onto
	Struct any `set:"-"`

	// Value for the struct itself, if this was created within value view framework -- otherwise nil
	StructValView Value

	// has the value of any field changed?  updated by the ViewSig signals from fields
	Changed bool `set:"-"`

	// Value for a field marked with changeflag struct tag, which must be a bool type, which is updated when changes are registered in field values.
	ChangeFlag *reflect.Value `json:"-" xml:"-"`

	// Value representations of the fields
	FieldViews []Value `json:"-" xml:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `json:"-" xml:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string

	// if true, some fields have default values -- update labels when values change
	HasDefs bool `json:"-" xml:"-" edit:"-"`

	// if true, some fields have viewif conditional view tags -- update after..
	HasViewIfs bool `json:"-" xml:"-" edit:"-"`

	// extra tags by field name -- from type properties
	TypeFieldTags map[string]string `json:"-" xml:"-" edit:"-"`
}

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 NewStructView

func NewStructView(par ki.Ki, name ...string) *StructView

NewStructView adds a new StructView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*StructView) ConfigStructGrid

func (sv *StructView) ConfigStructGrid() bool

ConfigStructGrid configures the StructGrid for the current struct. returns true if any fields changed.

func (*StructView) ConfigWidget

func (sv *StructView) ConfigWidget()

Config configures the view

func (*StructView) FieldTags

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

FieldTags returns the integrated tags for this field

func (*StructView) IsConfiged

func (sv *StructView) IsConfiged() bool

IsConfiged returns true if the widget is fully configured

func (*StructView) KiType

func (t *StructView) KiType() *gti.Type

KiType returns the *gti.Type of StructView

func (*StructView) New

func (t *StructView) New() ki.Ki

New returns a new *StructView value

func (*StructView) OnInit

func (sv *StructView) OnInit()

func (*StructView) SetChangeFlag

func (t *StructView) SetChangeFlag(v *reflect.Value) *StructView

SetChangeFlag sets the [StructView.ChangeFlag]: Value for a field marked with changeflag struct tag, which must be a bool type, which is updated when changes are registered in field values.

func (*StructView) SetClass

func (t *StructView) SetClass(v string) *StructView

SetClass sets the [StructView.Class]

func (*StructView) SetCustomContextMenu

func (t *StructView) SetCustomContextMenu(v func(m *gi.Scene)) *StructView

SetCustomContextMenu sets the [StructView.CustomContextMenu]

func (*StructView) SetFieldViews

func (t *StructView) SetFieldViews(v []Value) *StructView

SetFieldViews sets the [StructView.FieldViews]: Value representations of the fields

func (*StructView) SetHasDefs

func (t *StructView) SetHasDefs(v bool) *StructView

SetHasDefs sets the [StructView.HasDefs]: if true, some fields have default values -- update labels when values change

func (*StructView) SetHasViewIfs

func (t *StructView) SetHasViewIfs(v bool) *StructView

SetHasViewIfs sets the [StructView.HasViewIfs]: if true, some fields have viewif conditional view tags -- update after..

func (*StructView) SetStackTop

func (t *StructView) SetStackTop(v int) *StructView

SetStackTop sets the [StructView.StackTop]

func (*StructView) SetStripes

func (t *StructView) SetStripes(v gi.Stripes) *StructView

SetStripes sets the [StructView.Stripes]

func (*StructView) SetStruct

func (sv *StructView) SetStruct(st any) *StructView

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

func (*StructView) SetStructValView

func (t *StructView) SetStructValView(v Value) *StructView

SetStructValView sets the [StructView.StructValView]: Value for the struct itself, if this was created within value view framework -- otherwise nil

func (*StructView) SetStyles

func (sv *StructView) SetStyles()

func (*StructView) SetTmpSave

func (t *StructView) SetTmpSave(v Value) *StructView

SetTmpSave sets the [StructView.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*StructView) SetTooltip

func (t *StructView) SetTooltip(v string) *StructView

SetTooltip sets the [StructView.Tooltip]

func (*StructView) SetTypeFieldTags

func (t *StructView) SetTypeFieldTags(v map[string]string) *StructView

SetTypeFieldTags sets the [StructView.TypeFieldTags]: extra tags by field name -- from type properties

func (*StructView) SetViewPath

func (t *StructView) SetViewPath(v string) *StructView

SetViewPath sets the [StructView.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

func (*StructView) StructGrid

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

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

func (*StructView) UpdateField

func (sv *StructView) UpdateField(field string)

UpdateField updates the value-view widget for the named field

func (*StructView) UpdateFieldAction

func (sv *StructView) UpdateFieldAction()

func (*StructView) UpdateFields

func (sv *StructView) UpdateFields()

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

type StructViewInline

type StructViewInline struct {
	gi.Layout

	// the struct that we are a view onto
	Struct any `set:"-"`

	// Value for the struct itself, if this was created within value view framework -- otherwise nil
	StructValView Value

	// if true add an edit action button at the end -- other users of this widget can then configure that -- it is called 'edit-action'
	AddButton bool

	// Value representations of the fields
	FieldViews []Value `json:"-" xml:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `json:"-" xml:"-" view:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string

	// if true, some fields have default values -- update labels when values change
	HasDefs bool `json:"-" xml:"-" edit:"-"`

	// if true, some fields have viewif conditional view tags -- update after..
	HasViewIfs bool `json:"-" xml:"-" edit:"-"`
}

StructViewInline represents a struct as a single line widget, for smaller structs and those explicitly marked inline.

func NewStructViewInline

func NewStructViewInline(par ki.Ki, name ...string) *StructViewInline

NewStructViewInline adds a new StructViewInline with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*StructViewInline) ConfigStruct

func (sv *StructViewInline) ConfigStruct() bool

ConfigStruct configures the children for the current struct

func (*StructViewInline) ConfigWidget

func (sv *StructViewInline) ConfigWidget()

func (*StructViewInline) KiType

func (t *StructViewInline) KiType() *gti.Type

KiType returns the *gti.Type of StructViewInline

func (*StructViewInline) New

func (t *StructViewInline) New() ki.Ki

New returns a new *StructViewInline value

func (*StructViewInline) OnInit

func (sv *StructViewInline) OnInit()

func (*StructViewInline) SetAddButton

func (t *StructViewInline) SetAddButton(v bool) *StructViewInline

SetAddButton sets the [StructViewInline.AddButton]: if true add an edit action button at the end -- other users of this widget can then configure that -- it is called 'edit-action'

func (*StructViewInline) SetClass

func (t *StructViewInline) SetClass(v string) *StructViewInline

SetClass sets the [StructViewInline.Class]

func (*StructViewInline) SetCustomContextMenu

func (t *StructViewInline) SetCustomContextMenu(v func(m *gi.Scene)) *StructViewInline

SetCustomContextMenu sets the [StructViewInline.CustomContextMenu]

func (*StructViewInline) SetFieldViews

func (t *StructViewInline) SetFieldViews(v []Value) *StructViewInline

SetFieldViews sets the [StructViewInline.FieldViews]: Value representations of the fields

func (*StructViewInline) SetHasDefs

func (t *StructViewInline) SetHasDefs(v bool) *StructViewInline

SetHasDefs sets the [StructViewInline.HasDefs]: if true, some fields have default values -- update labels when values change

func (*StructViewInline) SetHasViewIfs

func (t *StructViewInline) SetHasViewIfs(v bool) *StructViewInline

SetHasViewIfs sets the [StructViewInline.HasViewIfs]: if true, some fields have viewif conditional view tags -- update after..

func (*StructViewInline) SetStackTop

func (t *StructViewInline) SetStackTop(v int) *StructViewInline

SetStackTop sets the [StructViewInline.StackTop]

func (*StructViewInline) SetStruct

func (sv *StructViewInline) SetStruct(st any) *StructViewInline

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

func (*StructViewInline) SetStructValView

func (t *StructViewInline) SetStructValView(v Value) *StructViewInline

SetStructValView sets the [StructViewInline.StructValView]: Value for the struct itself, if this was created within value view framework -- otherwise nil

func (*StructViewInline) SetStyles

func (sv *StructViewInline) SetStyles()

func (*StructViewInline) SetTmpSave

func (t *StructViewInline) SetTmpSave(v Value) *StructViewInline

SetTmpSave sets the [StructViewInline.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*StructViewInline) SetTooltip

func (t *StructViewInline) SetTooltip(v string) *StructViewInline

SetTooltip sets the [StructViewInline.Tooltip]

func (*StructViewInline) SetViewPath

func (t *StructViewInline) SetViewPath(v string) *StructViewInline

SetViewPath sets the [StructViewInline.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

func (*StructViewInline) UpdateFieldAction

func (sv *StructViewInline) UpdateFieldAction()

func (*StructViewInline) UpdateFields

func (sv *StructViewInline) UpdateFields()

type TableView

type TableView struct {
	SliceViewBase

	// optional styling function
	StyleFunc TableViewStyleFunc `copy:"-" view:"-" json:"-" xml:"-"`

	// current selection field -- initially select value in this field
	SelField string `copy:"-" view:"-" json:"-" xml:"-"`

	// current sort index
	SortIdx int

	// whether current sort order is descending
	SortDesc bool

	// struct type for each row
	StruType reflect.Type `copy:"-" view:"-" json:"-" xml:"-"`

	// the visible fields
	VisFields []reflect.StructField `copy:"-" view:"-" json:"-" xml:"-"`

	// number of visible fields
	NVisFields int `copy:"-" view:"-" json:"-" xml:"-"`

	// HeaderWidths has number of characters in each header, per visfields
	HeaderWidths []int `copy:"-" view:"-" json:"-" xml:"-"`
}

TableView represents a slice-of-structs as a table, where the fields are the columns, within an overall frame. It is a full-featured editor with multiple-selection, cut-and-paste, and drag-and-drop. If ReadOnly, it functions as a mutually-exclusive item selector, highlighting the selected row and emitting a Selected action.

func NewTableView

func NewTableView(par ki.Ki, name ...string) *TableView

NewTableView adds a new TableView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

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

func (tv *TableView) ConfigFrame()

func (*TableView) ConfigHeader

func (tv *TableView) ConfigHeader()

func (*TableView) ConfigRows

func (tv *TableView) ConfigRows()

ConfigRows configures VisRows worth of widgets to display slice data. It should only be called when NeedsConfigRows is true: when VisRows changes.

func (*TableView) ConfigTableView

func (tv *TableView) ConfigTableView()

func (*TableView) ConfigWidget

func (tv *TableView) ConfigWidget()

Config configures the view

func (*TableView) ContextMenu

func (tv *TableView) ContextMenu(m *gi.Scene)

func (*TableView) EditIdx

func (tv *TableView) EditIdx(idx int)

func (*TableView) GridLayout

func (tv *TableView) GridLayout() *gi.Layout

GridLayout returns the SliceGrid grid-layout widget, with grid and scrollbar

func (*TableView) KiType

func (t *TableView) KiType() *gti.Type

KiType returns the *gti.Type of TableView

func (*TableView) New

func (t *TableView) New() ki.Ki

New returns a new *TableView value

func (*TableView) OnInit

func (tv *TableView) OnInit()

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

func (tv *TableView) ScrollBar() *gi.Slider

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

func (t *TableView) SetClass(v string) *TableView

SetClass sets the [TableView.Class]

func (*TableView) SetConfigIter

func (t *TableView) SetConfigIter(v int) *TableView

SetConfigIter sets the [TableView.ConfigIter]

func (*TableView) SetCustomContextMenu

func (t *TableView) SetCustomContextMenu(v func(m *gi.Scene)) *TableView

SetCustomContextMenu sets the [TableView.CustomContextMenu]

func (*TableView) SetDraggedIdxs

func (t *TableView) SetDraggedIdxs(v []int) *TableView

SetDraggedIdxs sets the [TableView.DraggedIdxs]

func (*TableView) SetElVal

func (t *TableView) SetElVal(v reflect.Value) *TableView

SetElVal sets the [TableView.ElVal]

func (*TableView) SetInitSelIdx

func (t *TableView) SetInitSelIdx(v int) *TableView

SetInitSelIdx sets the [TableView.InitSelIdx]

func (*TableView) SetMinRows

func (t *TableView) SetMinRows(v int) *TableView

SetMinRows sets the [TableView.MinRows]

func (*TableView) SetNvisFields

func (t *TableView) SetNvisFields(v int) *TableView

SetNvisFields sets the [TableView.NVisFields]: number of visible fields

func (*TableView) SetSelField

func (t *TableView) SetSelField(v string) *TableView

SetSelField sets the [TableView.SelField]: current selection field -- initially select value in this field

func (*TableView) SetSelIdx

func (t *TableView) SetSelIdx(v int) *TableView

SetSelIdx sets the [TableView.SelIdx]

func (*TableView) SetSelIdxs

func (t *TableView) SetSelIdxs(v map[int]struct{}) *TableView

SetSelIdxs sets the [TableView.SelIdxs]

func (*TableView) SetSelVal

func (t *TableView) SetSelVal(v any) *TableView

SetSelVal sets the [TableView.SelVal]

func (*TableView) SetSlice

func (tv *TableView) SetSlice(sl any) *TableView

SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice (does Update if already viewing).

func (*TableView) SetSliceNpval

func (t *TableView) SetSliceNpval(v reflect.Value) *TableView

SetSliceNpval sets the [TableView.SliceNPVal]

func (*TableView) SetSliceSize

func (t *TableView) SetSliceSize(v int) *TableView

SetSliceSize sets the [TableView.SliceSize]

func (*TableView) SetSliceValView

func (t *TableView) SetSliceValView(v Value) *TableView

SetSliceValView sets the [TableView.SliceValView]

func (*TableView) SetSortDesc

func (t *TableView) SetSortDesc(v bool) *TableView

SetSortDesc sets the [TableView.SortDesc]: whether current sort order is descending

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

func (t *TableView) SetSortIdx(v int) *TableView

SetSortIdx sets the [TableView.SortIdx]: current sort index

func (*TableView) SetStackTop

func (t *TableView) SetStackTop(v int) *TableView

SetStackTop sets the [TableView.StackTop]

func (*TableView) SetStartIdx

func (t *TableView) SetStartIdx(v int) *TableView

SetStartIdx sets the [TableView.StartIdx]

func (*TableView) SetStripes

func (t *TableView) SetStripes(v gi.Stripes) *TableView

SetStripes sets the [TableView.Stripes]

func (*TableView) SetStruType

func (t *TableView) SetStruType(v reflect.Type) *TableView

SetStruType sets the [TableView.StruType]: struct type for each row

func (*TableView) SetStyleFunc

func (t *TableView) SetStyleFunc(v TableViewStyleFunc) *TableView

SetStyleFunc sets the [TableView.StyleFunc]: optional styling function

func (*TableView) SetStyles

func (tv *TableView) SetStyles()

func (*TableView) SetTmpIdx

func (t *TableView) SetTmpIdx(v int) *TableView

SetTmpIdx sets the [TableView.TmpIdx]

func (*TableView) SetTmpSave

func (t *TableView) SetTmpSave(v Value) *TableView

SetTmpSave sets the [TableView.TmpSave]

func (*TableView) SetTooltip

func (t *TableView) SetTooltip(v string) *TableView

SetTooltip sets the [TableView.Tooltip]

func (*TableView) SetValues

func (t *TableView) SetValues(v []Value) *TableView

SetValues sets the [TableView.Values]

func (*TableView) SetViewMu

func (t *TableView) SetViewMu(v *sync.Mutex) *TableView

SetViewMu sets the [TableView.ViewMu]

func (*TableView) SetViewPath

func (t *TableView) SetViewPath(v string) *TableView

SetViewPath sets the [TableView.ViewPath]

func (*TableView) SetVisFields

func (t *TableView) SetVisFields(v []reflect.StructField) *TableView

SetVisFields sets the [TableView.VisFields]: the visible fields

func (*TableView) SetVisRows

func (t *TableView) SetVisRows(v int) *TableView

SetVisRows sets the [TableView.VisRows]

func (*TableView) SizeFinal

func (tv *TableView) SizeFinal()

func (*TableView) SliceDeleteAt

func (tv *TableView) SliceDeleteAt(idx int)

SliceDeleteAt deletes element at given index from slice

func (*TableView) SliceGrid

func (tv *TableView) SliceGrid() *SliceViewGrid

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

func (*TableView) SliceHeader

func (tv *TableView) SliceHeader() *gi.Frame

SliceHeader returns the Frame 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

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

func (tv *TableView) StyleRow(w gi.Widget, idx, fidx int)

func (*TableView) TableViewContextMenu

func (tv *TableView) TableViewContextMenu(m *gi.Scene)

func (*TableView) UpdateWidgets

func (tv *TableView) UpdateWidgets()

UpdateWidgets updates the row widget display to represent the current state of the slice data, including which range of data is being displayed. This is called for scrolling, navigation etc.

type TableViewStyleFunc

type TableViewStyleFunc func(w gi.Widget, s *styles.Style, row, col int)

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

type TextEditorValue

type TextEditorValue struct {
	ValueBase
}

TextEditorValue presents a texteditor.Editor for editing longer text

func (*TextEditorValue) ConfigDialog

func (vv *TextEditorValue) ConfigDialog(d *gi.Body) (bool, func())

func (*TextEditorValue) ConfigWidget

func (vv *TextEditorValue) ConfigWidget(w gi.Widget)

func (*TextEditorValue) HasDialog

func (vv *TextEditorValue) HasDialog() bool

func (*TextEditorValue) OpenDialog

func (vv *TextEditorValue) OpenDialog(ctx gi.Widget, fun func())

func (*TextEditorValue) UpdateWidget

func (vv *TextEditorValue) UpdateWidget()

func (*TextEditorValue) WidgetType

func (vv *TextEditorValue) WidgetType() *gti.Type

type TimeValue

type TimeValue struct {
	ValueBase
}

TimeValue presents two text fields for editing a date and time, both of which can pull up corresponding picker view dialogs.

func (*TimeValue) ConfigWidget

func (vv *TimeValue) ConfigWidget(w gi.Widget)

func (*TimeValue) TimeVal

func (vv *TimeValue) TimeVal() *time.Time

TimeVal decodes Value into a *time.Time value -- also handles FileTime case

func (*TimeValue) UpdateWidget

func (vv *TimeValue) UpdateWidget()

func (*TimeValue) WidgetType

func (vv *TimeValue) WidgetType() *gti.Type

type TimeView

type TimeView struct {
	gi.Frame

	// the time that we are viewing
	Time time.Time `set:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `json:"-" xml:"-"`

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string

	// the raw input hour
	Hour int `set:"-"`

	// whether we are in PM mode (so we have to add 12h to everything)
	PM bool `set:"-"`
}

TimeView is a view for selecting a time

func NewTimeView

func NewTimeView(par ki.Ki, name ...string) *TimeView

NewTimeView adds a new TimeView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*TimeView) ConfigWidget

func (tv *TimeView) ConfigWidget()

func (*TimeView) KiType

func (t *TimeView) KiType() *gti.Type

KiType returns the *gti.Type of TimeView

func (*TimeView) New

func (t *TimeView) New() ki.Ki

New returns a new *TimeView value

func (*TimeView) OnInit

func (tv *TimeView) OnInit()

func (*TimeView) SetClass

func (t *TimeView) SetClass(v string) *TimeView

SetClass sets the [TimeView.Class]

func (*TimeView) SetCustomContextMenu

func (t *TimeView) SetCustomContextMenu(v func(m *gi.Scene)) *TimeView

SetCustomContextMenu sets the [TimeView.CustomContextMenu]

func (*TimeView) SetStackTop

func (t *TimeView) SetStackTop(v int) *TimeView

SetStackTop sets the [TimeView.StackTop]

func (*TimeView) SetStripes

func (t *TimeView) SetStripes(v gi.Stripes) *TimeView

SetStripes sets the [TimeView.Stripes]

func (*TimeView) SetTime

func (tv *TimeView) SetTime(tim time.Time) *TimeView

SetTime sets the source time and updates the view

func (*TimeView) SetTmpSave

func (t *TimeView) SetTmpSave(v Value) *TimeView

SetTmpSave sets the [TimeView.TmpSave]: value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent

func (*TimeView) SetTooltip

func (t *TimeView) SetTooltip(v string) *TimeView

SetTooltip sets the [TimeView.Tooltip]

func (*TimeView) SetViewPath

func (t *TimeView) SetViewPath(v string) *TimeView

SetViewPath sets the [TimeView.ViewPath]: a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows

type TreeView

type TreeView struct {
	gi.WidgetBase

	// If non-nil, the Ki Node that this widget is viewing in the tree (the source)
	SyncNode ki.Ki `set:"-" copy:"-" json:"-" xml:"-"`

	// The text to display for the tree view item label, which automatically
	// defaults to the [ki.Node.Name] of the tree view node. It has no effect
	// if [TreeView.SyncNode] is non-nil.
	Text string

	// optional icon, displayed to the the left of the text label
	Icon icons.Icon

	// amount to indent children relative to this node
	Indent units.Value `copy:"-" json:"-" xml:"-"`

	// depth for nodes be initialized as open (default 4).
	// Nodes beyond this depth will be initialized as closed.
	OpenDepth int `copy:"-" json:"-" xml:"-"`

	// linear index of this node within the entire tree.
	// updated on full rebuilds and may sometimes be off,
	// but close enough for expected uses
	ViewIdx int `copy:"-" json:"-" xml:"-" edit:"-"`

	// size of just this node widget.
	// our alloc includes all of our children, but we only draw us.
	WidgetSize mat32.Vec2 `copy:"-" json:"-" xml:"-" edit:"-"`

	// The cached root of the view. It is automatically set and does not need to be
	// set by the end user.
	RootView *TreeView `copy:"-" json:"-" xml:"-" edit:"-"`

	// SelectedNodes holds the currently-selected nodes, on the
	// RootView node only.
	SelectedNodes []TreeViewer `copy:"-" json:"-" xml:"-" edit:"-"`
	// contains filtered or unexported fields
}

TreeView provides a graphical representation of a tree tructure providing full navigation and manipulation abilities.

If the SyncNode field is non-nil, typically via SyncRootNode method, then the TreeView mirrors another Ki tree structure, and tree editing functions apply to the source tree first, and then to the TreeView by sync.

Otherwise, data can be directly encoded in a TreeView derived type, to represent any kind of tree structure and associated data.

Standard events.Event are sent to any listeners, including Select, Change, and DoubleClick. The selected nodes are in the root SelectedNodes list.

func AsTreeView

func AsTreeView(k ki.Ki) *TreeView

AsTreeView returns the given value as a value of type TreeView if the type of the given value embeds TreeView, or nil otherwise

func NewTreeView

func NewTreeView(par ki.Ki, name ...string) *TreeView

NewTreeView adds a new TreeView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*TreeView) AddChildNode

func (tv *TreeView) AddChildNode()

AddChildNode adds a new child node to this one in the tree, prompting the user for the type of node to add If SyncNode is set, operates on Sync Tree.

func (*TreeView) AddSyncNodes

func (tv *TreeView) AddSyncNodes(rel, myidx int, typ *gti.Type, n int)

func (*TreeView) AddTreeNodes

func (tv *TreeView) AddTreeNodes(rel, myidx int, typ *gti.Type, n int)

func (*TreeView) ApplyStyle

func (tv *TreeView) ApplyStyle()

func (*TreeView) AsTreeView

func (tv *TreeView) AsTreeView() *TreeView

AsTreeView satisfies the [TreeViewEmbedder] interface

func (*TreeView) BaseType

func (tv *TreeView) BaseType() *gti.Type

func (*TreeView) BranchPart

func (tv *TreeView) BranchPart() (*gi.Switch, bool)

BranchPart returns the branch in parts, if it exists

func (*TreeView) CanOpen

func (tv *TreeView) CanOpen() bool

CanOpen returns true if the node is able to open. By default it checks HasChildren(), but could check other properties to perform lazy building of the tree.

func (*TreeView) Close

func (tv *TreeView) Close()

Close closes the given node and updates the view accordingly (if it is not already closed). Calls OnClose in TreeViewer interface for extensible actions.

func (*TreeView) CloseAll

func (tv *TreeView) CloseAll()

CloseAll closes the given node and all of its sub-nodes.

func (*TreeView) ConfigParts

func (tv *TreeView) ConfigParts()

func (*TreeView) ConfigWidget

func (tv *TreeView) ConfigWidget()

func (*TreeView) ContextMenu

func (tv *TreeView) ContextMenu(m *gi.Scene)

func (*TreeView) ContextMenuPos

func (tv *TreeView) ContextMenuPos(e events.Event) (pos image.Point)

func (*TreeView) Copy

func (tv *TreeView) Copy(reset bool)

Copy copies to clip.Board, optionally resetting the selection.

func (*TreeView) CopyFieldsFrom

func (tv *TreeView) CopyFieldsFrom(frm any)

func (*TreeView) Cut

func (tv *TreeView) Cut()

Cut copies to clip.Board and deletes selected items.

func (*TreeView) CutSync

func (tv *TreeView) CutSync()

CutSync copies to clip.Board and deletes selected items.

func (*TreeView) DeleteNode

func (tv *TreeView) DeleteNode()

DeleteNode deletes the tree node or sync node corresponding to this view node in the sync tree. If SyncNode is set, operates on Sync Tree.

func (*TreeView) DragDrop

func (tv *TreeView) DragDrop(e events.Event)

DragDrop handles drag drop event

func (*TreeView) DragStart

func (tv *TreeView) DragStart(e events.Event)

DragStart starts a drag-n-drop on this node -- it includes any other selected nodes as well, each as additional records in mimedata.

func (*TreeView) DropDeleteSource

func (tv *TreeView) DropDeleteSource(e events.Event)

DropDeleteSource handles delete source event for DropMove case

func (*TreeView) DropDeleteSourceSync

func (tv *TreeView) DropDeleteSourceSync(de *events.DragDrop)

DropDeleteSourceSync handles delete source event for DropMove case, for Sync

func (*TreeView) DropExternal

func (tv *TreeView) DropExternal(md mimedata.Mimes, mod events.DropMods)

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

func (*TreeView) DropFinalize

func (tv *TreeView) DropFinalize(de *events.DragDrop)

DropFinalize is called to finalize Drop actions on the Source node. Only relevant for DropMod == DropMove.

func (*TreeView) Duplicate

func (tv *TreeView) Duplicate()

Duplicate duplicates the sync node corresponding to this view node in the tree, and inserts the duplicate after this node (as a new sibling). If SyncNode is set, operates on Sync Tree.

func (*TreeView) DuplicateSync

func (tv *TreeView) DuplicateSync()

func (*TreeView) EditNode

func (tv *TreeView) EditNode()

EditNode pulls up a StructViewDialog window on the node. If SyncNode is set, operates on Sync Tree.

func (*TreeView) FindSyncNode

func (tv *TreeView) FindSyncNode(kn ki.Ki) *TreeView

FindSyncNode finds TreeView node for given source node, or nil if not found

func (*TreeView) FlagType

func (tv *TreeView) FlagType() enums.BitFlagSetter

func (*TreeView) HandleEvents

func (tv *TreeView) HandleEvents()

func (*TreeView) HandleKeys

func (tv *TreeView) HandleKeys()

func (*TreeView) HandleMouse

func (tv *TreeView) HandleMouse()

func (*TreeView) HasSelection

func (tv *TreeView) HasSelection() bool

HasSelection returns true if there are currently selected items

func (*TreeView) IconPart

func (tv *TreeView) IconPart() (*gi.Icon, bool)

IconPart returns the icon in parts, if it exists

func (*TreeView) InsertAfter

func (tv *TreeView) InsertAfter()

InsertAfter inserts a new node in the tree after this node, at the same (sibling) level, prompting for the type of node to insert. If SyncNode is set, operates on Sync Tree.

func (*TreeView) InsertAt

func (tv *TreeView) InsertAt(rel int, actNm string)

InsertAt inserts a new node in the tree at given relative offset from this node, at the same (sibling) level, prompting for the type of node to insert If SyncNode is set, operates on Sync Tree.

func (*TreeView) InsertBefore

func (tv *TreeView) InsertBefore()

InsertBefore inserts a new node in the tree before this node, at the same (sibling) level, prompting for the type of node to insert If SyncNode is set, operates on Sync Tree.

func (*TreeView) InspectNode

func (tv *TreeView) InspectNode()

InspectNode pulls up a new Inspector window on the node. If SyncNode is set, operates on Sync Tree.

func (*TreeView) IsClosed

func (tv *TreeView) IsClosed() bool

IsClosed returns whether this node itself closed?

func (*TreeView) IsRoot

func (tv *TreeView) IsRoot(op string) bool

IsRoot returns true if given node is the root of the tree.

func (*TreeView) KiType

func (t *TreeView) KiType() *gti.Type

KiType returns the *gti.Type of TreeView

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

func (tv *TreeView) MakePasteMenu(m *gi.Scene, md mimedata.Mimes, fun func())

MakePasteMenu makes the menu of options for paste events optional function is typically the DropFinalize but could also be other actions to take after each optional action.

func (*TreeView) MimeData

func (tv *TreeView) MimeData(md *mimedata.Mimes)

MimeData adds mimedata for this node: a text/plain of the Path.

func (*TreeView) MimeDataSync

func (tv *TreeView) MimeDataSync(md *mimedata.Mimes)

MimeDataSync adds mimedata for this node: a text/plain of the Path, and an application/json of the sync node.

func (*TreeView) MoveDown

func (tv *TreeView) MoveDown(selMode events.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 events.SelectModes) *TreeView

MoveDownAction moves the selection down to next element in the tree, using given select mode (from keyboard modifiers). Sends select event for newly selected item.

func (*TreeView) MoveDownSibling

func (tv *TreeView) MoveDownSibling(selMode events.SelectModes) *TreeView

MoveDownSibling moves down only to siblings, not down into children, using given select mode (from keyboard modifiers)

func (*TreeView) MoveEndAction

func (tv *TreeView) MoveEndAction(selMode events.SelectModes) *TreeView

MoveEndAction moves the selection to the very last node in the tree, using given select mode (from keyboard modifiers) Sends select event for newly selected item.

func (*TreeView) MoveHomeAction

func (tv *TreeView) MoveHomeAction(selMode events.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 events.SelectModes) *TreeView

MovePageDownAction moves the selection up to previous TreeViewPageSteps elements in the tree, using given select mode (from keyboard modifiers). Sends select event for newly selected item.

func (*TreeView) MovePageUpAction

func (tv *TreeView) MovePageUpAction(selMode events.SelectModes) *TreeView

MovePageUpAction moves the selection up to previous TreeViewPageSteps elements in the tree, using given select mode (from keyboard modifiers). Sends select event for newly selected item.

func (*TreeView) MoveToLastChild

func (tv *TreeView) MoveToLastChild(selMode events.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 events.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 events.SelectModes) *TreeView

MoveUpAction moves the selection up to previous element in the tree, using given select mode (from keyboard modifiers). Sends select event for newly selected item.

func (*TreeView) New

func (t *TreeView) New() ki.Ki

New returns a new *TreeView value

func (*TreeView) NodesFromMimeData

func (tv *TreeView) NodesFromMimeData(md mimedata.Mimes) (ki.Slice, []string)

NodesFromMimeData returns a slice of Ki nodes for the TreeView nodes and paths from mime data.

func (*TreeView) OnAdd

func (tv *TreeView) OnAdd()

func (*TreeView) OnClose

func (tv *TreeView) OnClose()

OnClose is called when a node is closed. The base version does nothing.

func (*TreeView) OnInit

func (tv *TreeView) OnInit()

func (*TreeView) OnOpen

func (tv *TreeView) OnOpen()

OnOpen is called when a node is opened. The base version does nothing.

func (*TreeView) Open

func (tv *TreeView) Open()

Open opens the given node and updates the view accordingly (if it is not already opened) Calls OnOpen in TreeViewer interface for extensible actions.

func (*TreeView) OpenAll

func (tv *TreeView) OpenAll()

OpenAll opens the given node and all of its sub-nodes

func (*TreeView) OpenParents

func (tv *TreeView) OpenParents()

OpenParents opens all the parents of this node, so that it will be visible.

func (*TreeView) Paste

func (tv *TreeView) Paste()

Paste pastes clipboard at given node.

func (*TreeView) PasteAfter

func (tv *TreeView) PasteAfter(md mimedata.Mimes, mod events.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) PasteAssignSync

func (tv *TreeView) PasteAssignSync(md mimedata.Mimes)

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

func (*TreeView) PasteAt

func (tv *TreeView) PasteAt(md mimedata.Mimes, mod events.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) PasteAtSync

func (tv *TreeView) PasteAtSync(md mimedata.Mimes, mod events.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 events.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 events.DropMods)

PasteChildren inserts object(s) from mime data at end of children of this node

func (*TreeView) PasteChildrenSync

func (tv *TreeView) PasteChildrenSync(md mimedata.Mimes, mod events.DropMods)

PasteChildrenSync 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, by popping up a menu to determine what specifically to do.

func (*TreeView) Position

func (tv *TreeView) Position()

func (*TreeView) ReSync

func (tv *TreeView) ReSync()

ReSync resynchronizes the view relative to the underlying nodes and forces a full rerender

func (*TreeView) Render

func (tv *TreeView) Render()

func (*TreeView) RenderNode

func (tv *TreeView) RenderNode()

func (*TreeView) RootIsReadOnly

func (tv *TreeView) RootIsReadOnly() bool

RootIsReadOnly returns the ReadOnly status of the root node, which is what controls the functional inactivity of the tree if individual nodes are ReadOnly that only affects display typically.

func (*TreeView) RootSetViewIdx

func (tv *TreeView) RootSetViewIdx() int

RootSetViewIdx sets the RootView and ViewIdx for all nodes. This must be called from the root node after construction or any modification to the tree. Returns the total number of leaves in the tree.

func (*TreeView) ScenePos

func (tv *TreeView) ScenePos()

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 events.SelectModes) bool

SelectAction updates selection to include this node, using selectmode from mouse event (ExtendContinuous, ExtendOne), and Root sends selection event. 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 events.SelectModes) bool

SelectUpdate updates selection to include this node, using selectmode from mouse event (ExtendContinuous, ExtendOne). Returns true if this node selected

func (*TreeView) SelectedSyncNodes

func (tv *TreeView) SelectedSyncNodes() ki.Slice

SelectedSyncNodes returns a slice of the currently-selected sync source nodes in the entire tree view

func (*TreeView) SelectedViews

func (tv *TreeView) SelectedViews() []TreeViewer

SelectedViews returns a slice of the currently-selected TreeViews within the entire tree, using a list maintained by the root node

func (*TreeView) SendChangeEvent

func (tv *TreeView) SendChangeEvent(ctx events.Event)

SendChangeEvent sends the events.Change event on the RootView node, using context event if avail (else nil).

func (*TreeView) SendChangeEventReSync

func (tv *TreeView) SendChangeEventReSync(ctx events.Event)

SendChangeEventReSync sends the events.Change event on the RootView node, using context event if avail (else nil). If SyncNode != nil, also does a re-sync from root.

func (*TreeView) SendSelectEvent

func (tv *TreeView) SendSelectEvent(ctx events.Event)

SendSelectEvent sends the events.Select event on the RootView node, using context event if avail (else nil).

func (*TreeView) SetBranchState

func (tv *TreeView) SetBranchState()

func (*TreeView) SetClass

func (t *TreeView) SetClass(v string) *TreeView

SetClass sets the [TreeView.Class]

func (*TreeView) SetClosed

func (tv *TreeView) SetClosed(closed bool)

SetClosed sets the closed flag for this node. Call Close() method to close a node and update view.

func (*TreeView) SetCustomContextMenu

func (t *TreeView) SetCustomContextMenu(v func(m *gi.Scene)) *TreeView

SetCustomContextMenu sets the [TreeView.CustomContextMenu]

func (*TreeView) SetIcon

func (t *TreeView) SetIcon(v icons.Icon) *TreeView

SetIcon sets the [TreeView.Icon]: optional icon, displayed to the the left of the text label

func (*TreeView) SetIndent

func (t *TreeView) SetIndent(v units.Value) *TreeView

SetIndent sets the [TreeView.Indent]: amount to indent children relative to this node

func (*TreeView) SetKidsVisibility

func (tv *TreeView) SetKidsVisibility(parentClosed bool)

func (*TreeView) SetOpenDepth

func (t *TreeView) SetOpenDepth(v int) *TreeView

SetOpenDepth sets the [TreeView.OpenDepth]: depth for nodes be initialized as open (default 4). Nodes beyond this depth will be initialized as closed.

func (*TreeView) SetRootView

func (t *TreeView) SetRootView(v *TreeView) *TreeView

SetRootView sets the [TreeView.RootView]: The cached root of the view. It is automatically set and does not need to be set by the end user.

func (*TreeView) SetSelectMode

func (tv *TreeView) SetSelectMode(selMode bool)

SetSelectMode updates the select mode

func (*TreeView) SetSelectedNodes

func (t *TreeView) SetSelectedNodes(v []TreeViewer) *TreeView

SetSelectedNodes sets the [TreeView.SelectedNodes]: SelectedNodes holds the currently-selected nodes, on the RootView node only.

func (*TreeView) SetSelectedViews

func (tv *TreeView) SetSelectedViews(sl []TreeViewer)

SetSelectedViews updates the selected views to given list

func (*TreeView) SetStyles

func (tv *TreeView) SetStyles()

func (*TreeView) SetSyncNode

func (tv *TreeView) SetSyncNode(sk ki.Ki, tvIdx *int, init bool, depth int)

SetSyncNode sets the sync source node that we are viewing, and syncs the view of its tree. It is called routinely via SyncToSrc during tree updating. It uses ki Config mechanism to perform minimal updates to remain in sync.

func (*TreeView) SetText

func (t *TreeView) SetText(v string) *TreeView

SetText sets the [TreeView.Text]: The text to display for the tree view item label, which automatically defaults to the ki.Node.Name of the tree view node. It has no effect if [TreeView.SyncNode] is non-nil.

func (*TreeView) SetTooltip

func (t *TreeView) SetTooltip(v string) *TreeView

SetTooltip sets the [TreeView.Tooltip]

func (*TreeView) SetViewIdx

func (t *TreeView) SetViewIdx(v int) *TreeView

SetViewIdx sets the [TreeView.ViewIdx]: linear index of this node within the entire tree. updated on full rebuilds and may sometimes be off, but close enough for expected uses

func (*TreeView) SetWidgetSize

func (t *TreeView) SetWidgetSize(v mat32.Vec2) *TreeView

SetWidgetSize sets the [TreeView.WidgetSize]: size of just this node widget. our alloc includes all of our children, but we only draw us.

func (*TreeView) SizeDown

func (tv *TreeView) SizeDown(iter int) bool

func (*TreeView) SizeUp

func (tv *TreeView) SizeUp()

func (*TreeView) StyleTreeView

func (tv *TreeView) StyleTreeView()

func (*TreeView) SyncNodesFromMimeData

func (tv *TreeView) SyncNodesFromMimeData(md mimedata.Mimes) (ki.Slice, []string)

SyncNodesFromMimeData creates a slice of Ki node(s) from given mime data and also a corresponding slice of original paths.

func (*TreeView) SyncRootNode

func (tv *TreeView) SyncRootNode(sk ki.Ki) *TreeView

SyncRootNode sets the root view to the root of the sync source node for this TreeView, and syncs the rest of the tree to match. Calls ki.UniquifyNamesAll on source tree to ensure that node names are unique which is essential for proper viewing!

func (*TreeView) SyncToSrc

func (tv *TreeView) SyncToSrc(tvIdx *int, init bool, depth int)

SyncToSrc updates the view tree to match the sync tree, using ConfigChildren to maximally preserve existing tree elements. init means we are doing initial build, and depth tracks depth (only during init).

func (*TreeView) ToggleClose

func (tv *TreeView) ToggleClose()

ToggleClose toggles the close / open status: if closed, opens, and vice-versa

func (*TreeView) TreeViewChanged

func (tv *TreeView) TreeViewChanged(ctx events.Event)

TreeViewChanged must be called after any structural change to the TreeView (adding or deleting nodes). It calls: RootSetViewIdx() to update indexes and SendChangeEvent to notify of changes.

func (*TreeView) TreeViewContextMenu

func (tv *TreeView) TreeViewContextMenu(m *gi.Scene)

func (*TreeView) TreeViewContextMenuReadOnly

func (tv *TreeView) TreeViewContextMenuReadOnly(m *gi.Scene)

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 Root sends a selection event.

func (*TreeView) UnselectAll

func (tv *TreeView) UnselectAll()

UnselectAll unselects all selected items in the view

func (*TreeView) UpdateBranchIcons

func (tv *TreeView) UpdateBranchIcons()

func (*TreeView) UpdateReadOnly

func (tv *TreeView) UpdateReadOnly() bool

UpdateReadOnly updates the ReadOnly state based on SyncNode. Returns true if ReadOnly. 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 ReadOnly to make entire tree read-only and non-modifiable)

type TreeViewFlags

type TreeViewFlags gi.WidgetFlags //enums:bitflag -trim-prefix TreeViewFlag

TreeViewFlags extend WidgetFlags to hold TreeView state

const (
	// TreeViewFlagClosed means node is toggled closed
	// (children not visible)  Otherwise Open.
	TreeViewFlagClosed TreeViewFlags = TreeViewFlags(gi.WidgetFlagsN) + iota

	// When set on the Root node determines whether keyboard movements
	// update selection or not.
	TreeViewFlagSelectMode

	// Set in the [Open] method to prevent recursive opening for lazy-open nodes
	TreeViewInOpen
)
const TreeViewFlagsN TreeViewFlags = 11

TreeViewFlagsN is the highest valid value for type TreeViewFlags, plus one.

func TreeViewFlagsValues

func TreeViewFlagsValues() []TreeViewFlags

TreeViewFlagsValues returns all possible values for the type TreeViewFlags.

func (TreeViewFlags) BitIndexString

func (i TreeViewFlags) BitIndexString() string

BitIndexString returns the string representation of this TreeViewFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.

func (TreeViewFlags) Desc

func (i TreeViewFlags) Desc() string

Desc returns the description of the TreeViewFlags value.

func (TreeViewFlags) HasFlag

func (i TreeViewFlags) HasFlag(f enums.BitFlag) bool

HasFlag returns whether these bit flags have the given bit flag set.

func (TreeViewFlags) Int64

func (i TreeViewFlags) Int64() int64

Int64 returns the TreeViewFlags value as an int64.

func (TreeViewFlags) IsValid

func (i TreeViewFlags) IsValid() bool

IsValid returns whether the value is a valid option for type TreeViewFlags.

func (TreeViewFlags) MarshalText

func (i TreeViewFlags) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*TreeViewFlags) SetFlag

func (i *TreeViewFlags) SetFlag(on bool, f ...enums.BitFlag)

SetFlag sets the value of the given flags in these flags to the given value.

func (*TreeViewFlags) SetInt64

func (i *TreeViewFlags) SetInt64(in int64)

SetInt64 sets the TreeViewFlags value from an int64.

func (*TreeViewFlags) SetString

func (i *TreeViewFlags) SetString(s string) error

SetString sets the TreeViewFlags value from its string representation, and returns an error if the string is invalid.

func (*TreeViewFlags) SetStringOr

func (i *TreeViewFlags) SetStringOr(s string) error

SetStringOr sets the TreeViewFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.

func (TreeViewFlags) String

func (i TreeViewFlags) String() string

String returns the string representation of this TreeViewFlags value.

func (*TreeViewFlags) UnmarshalText

func (i *TreeViewFlags) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (TreeViewFlags) Values

func (i TreeViewFlags) Values() []enums.Enum

Values returns all possible values for the type TreeViewFlags.

type TreeViewer

type TreeViewer interface {
	gi.Widget

	// AsTreeView returns the base *TreeView for this node
	AsTreeView() *TreeView

	// CanOpen returns true if the node is able to open.
	// By default it checks HasChildren(), but could check other properties
	// to perform lazy building of the tree.
	CanOpen() bool

	// OnOpen is called when a node is opened.
	// The base version does nothing.
	OnOpen()

	// OnClose is called when a node is closed
	// The base version does nothing.
	OnClose()

	// UpdateBranchIcons is called during DoLayout to update branch icons
	// when everything should be configured, prior to rendering.
	UpdateBranchIcons()

	// Following are all tree editing functions:
	DeleteNode()
	Duplicate()
	AddChildNode()
	InsertBefore()
	InsertAfter()
	MimeData(md *mimedata.Mimes)
	Cut()
	Copy(reset bool)
	Paste()
	DragStart(e events.Event)
	DragDrop(e events.Event)
	DropFinalize(de *events.DragDrop)
	DropDeleteSource(e events.Event)
	MakePasteMenu(m *gi.Scene, md mimedata.Mimes, fun func())
}

TreeViewer is an interface for TreeView types providing access to the base TreeView and overridable method hooks for actions taken on the TreeView, including OnOpen, OnClose, etc.

type TypeValue

type TypeValue struct {
	ValueBase
}

TypeValue presents a chooser for choosing types

func (*TypeValue) ConfigWidget

func (vv *TypeValue) ConfigWidget(w gi.Widget)

func (*TypeValue) UpdateWidget

func (vv *TypeValue) UpdateWidget()

func (*TypeValue) WidgetType

func (vv *TypeValue) WidgetType() *gti.Type

type Value

type Value interface {
	fmt.Stringer

	// AsValueBase gives access to the basic data fields so that the
	// interface doesn't need to provide accessors for them.
	AsValueBase() *ValueBase

	// AsWidget returns the widget associated with the value
	AsWidget() gi.Widget

	// AsWidgetBase returns the widget base associated with the value
	AsWidgetBase() *gi.WidgetBase

	// Name returns the name of the value
	Name() string

	// SetName sets the name of the value
	SetName(name string)

	// Label returns the label for the value
	Label() string

	// SetLabel sets the label for the value
	SetLabel(label string)

	// Doc returns the documentation for the value
	Doc() string

	// SetDoc sets the documentation for the value
	SetDoc(doc string)

	// Is checks if flag is set, using atomic, safe for concurrent access
	Is(f enums.BitFlag) bool

	// SetFlag sets the given flag(s) to given state
	// using atomic, safe for concurrent access
	SetFlag(on bool, f ...enums.BitFlag)

	// SetStructValue sets the value, owner and field information for a struct field.
	SetStructValue(val reflect.Value, owner any, field *reflect.StructField, tmpSave Value, viewPath string)

	// SetMapKey sets the key value and owner for a map key.
	SetMapKey(val reflect.Value, owner any, tmpSave Value)

	// SetMapValue sets the value, owner and map key information for a map
	// element -- needs pointer to Value representation of key to track
	// current key value.
	SetMapValue(val reflect.Value, owner any, key any, keyView Value, tmpSave Value, viewPath string)

	// SetSliceValue sets the value, owner and index information for a slice element.
	SetSliceValue(val reflect.Value, owner any, idx int, tmpSave Value, 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

	// IsReadOnly returns whether the value is ReadOnly, which prevents modification
	// of the underlying Value.  Can be flagged by container views, or
	// Map owners have ReadOnly values, and fields can be marked
	// as ReadOnly using a struct tag.
	IsReadOnly() bool

	// SetReadOnly marks this value as ReadOnly or not
	SetReadOnly(ro bool)

	// WidgetType returns an appropriate type of widget to represent the
	// current value.
	WidgetType() *gti.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 OnChange event listener to set the value
	// when the user edits it (values are always set immediately when the
	// widget is updated).  Note: use OnLast(events.Change) to ensure that
	// any other change modifiers have had a chance to intervene first.
	ConfigWidget(w gi.Widget)

	// HasDialog returns true if this value has an associated Dialog,
	// e.g., for FileName, StructView, SliceView, etc.
	// The OpenDialog method will open the dialog.
	HasDialog() bool

	// OpenDialog opens the dialog for this Value, if [HasDialog] is true.
	// Given function closure is called for the Ok action, after value
	// has been updated, if using the dialog as part of another control flow.
	// Note that some cases just pop up a menu chooser, not a full dialog.
	OpenDialog(ctx gi.Widget, fun func())

	// ConfigDialog adds content to given dialog body for this value,
	// for Values with [HasDialog] == true, that use full dialog scenes.
	// The bool return is false if the value does not use this method
	// (e.g., for simple menu choosers).
	// The [OpenValueDialog] function is used to construct and run the dialog.
	// The returned function is an optional closure to be called
	// in the Ok case, for cases where extra logic is required.
	ConfigDialog(d *gi.Body) (bool, func())

	// Val returns the reflect.Value representation for this item.
	Val() reflect.Value

	// SetValue assigns given value to this item (if not ReadOnly), using
	// Ki.SetField for Ki types and laser.SetRobust otherwise -- emits a ViewSig
	// signal when set.
	SetValue(val any) bool

	// SendChange sends events.Change event to all listeners registered on this view.
	// This is the primary notification event for all Value elements.
	// It takes an optional original event to base the event on.
	SendChange(orig ...events.Event)

	// OnChange registers given listener function for Change events on Value.
	// This is the primary notification event for all Value elements.
	OnChange(fun func(e events.Event))

	// SetTags sets tags for this valueview, for non-struct values, to
	// influence interface for this value -- see
	// https://goki.dev/gi/v2/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://goki.dev/gi/v2/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 Value has a pointer to any parent Value 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()
}

Value is an interface for managing the GUI representation of values (e.g., fields, map values, slice values) in Views (StructView, MapView, etc). It is a GUI version of the reflect.Value, and uses that for representing the underlying Value being represented graphically. The different types of Value are for different Kinds of values (bool, float, etc) -- which can have different Kinds of owners. The ValueBase class supports all the basic fields for managing the owner kinds.

func FieldToValue

func FieldToValue(it any, field string, fval any) Value

FieldToValue returns the appropriate Value for given field on a struct -- attempts to get the FieldValuer interface, and falls back on ToValue otherwise, using field value (fval) gopy:interface=handle

func NewSoloValue

func NewSoloValue(val any) Value

NewSoloValue makes and returns a new Value from the given value. It does not configure the widget, so most end-user code should call NewValue instead. It is intended for use in internal code that needs standalone solo values (for example, for a custom TmpSave).

func NewValue

func NewValue(par ki.Ki, val any, name ...string) Value

NewValue makes and returns a new Value from the given value and creates the widget for it with the given parent and optional name. It is the main way that end-user code should interact with giv. The given value needs to be a pointer for it to be settable.

NewValue is not appropriate for internal code configuring non-solo values (for example, in StructView), but it should be fine for most end-user code.

func ToValue

func ToValue(it any, tags string) Value

ToValue returns the appropriate Value for given item, based only on its type -- attempts to get the Valuer 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 FieldToValue for version that takes into account the properties of the owner.

type ValueBase

type ValueBase struct {
	// Nm is locally-unique name of Value
	Nm string

	// SavedLabel is the label for the Value
	SavedLabel string

	// SavedDoc is the saved documentation for the Value, if any
	// (only valid if [ValueHasSaveDoc] is true)
	SavedDoc string

	// Flags are atomic bit flags for Value state
	Flags ValueFlags

	// the reflect.Value representation of the value
	Value reflect.Value `set:"-"`

	// kind of owner that we have -- reflect.Struct, .Map, .Slice are supported
	OwnKind reflect.Kind

	// a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows
	ViewPath string

	// the object that owns this value, either a struct, slice, or map, if non-nil -- if a Ki Node, then SetField is used to set value, to provide proper updating
	Owner any

	// if Owner is a struct, this is the reflect.StructField associated with the value
	Field *reflect.StructField

	// set of tags that can be set to customize interface for different types of values -- only source for non-structfield values
	Tags map[string]string `set:"-"`

	// if Owner is a map, and this is a value, this is the key for this value in the map
	Key any `set:"-" edit:"-"`

	// if Owner is a map, and this is a value, this is the value view representing the key -- its value has the *current* value of the key, which can be edited
	KeyView Value `set:"-" edit:"-"`

	// if Owner is a slice, this is the index for the value in the slice
	Idx int `set:"-" edit:"-"`

	// type of widget to create -- cached during WidgetType method -- chosen based on the Value type and reflect.Value type -- see Valuer interface
	WidgetTyp *gti.Type `set:"-" edit:"-"`

	// the widget used to display and edit the value in the interface -- this is created for us externally and we cache it during ConfigWidget
	Widget gi.Widget `set:"-" edit:"-"`

	// Listeners are event listener functions for processing events on this widget.
	// type specific Listeners are added in OnInit when the widget is initialized.
	Listeners events.Listeners `set:"-" view:"-"`

	// value view that needs to have SaveTmp called on it whenever a change is made to one of the underlying values -- pass this down to any sub-views created from a parent
	TmpSave Value `set:"-" view:"-"`
}

ValueBase provides the basis for implementations of the Value 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 Valuer type.

func (*ValueBase) AllTags

func (vv *ValueBase) AllTags() map[string]string

func (*ValueBase) AsValueBase

func (vv *ValueBase) AsValueBase() *ValueBase

func (*ValueBase) AsWidget

func (vv *ValueBase) AsWidget() gi.Widget

func (*ValueBase) AsWidgetBase

func (vv *ValueBase) AsWidgetBase() *gi.WidgetBase

func (*ValueBase) ConfigDialog

func (vv *ValueBase) ConfigDialog(d *gi.Body) (bool, func())

func (*ValueBase) ConfigWidget

func (vv *ValueBase) ConfigWidget(w gi.Widget)

func (*ValueBase) CreateTempIfNotPtr

func (vv *ValueBase) CreateTempIfNotPtr() bool

func (*ValueBase) Doc

func (vv *ValueBase) Doc() string

func (*ValueBase) GetTitle

func (vv *ValueBase) GetTitle() (label, newPath string, isZero bool)

GetTitle returns a title 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 (*ValueBase) HandleEvent

func (vv *ValueBase) HandleEvent(ev events.Event)

HandleEvent sends the given event to all Listeners for that event type. It also checks if the State has changed and calls ApplyStyle if so. If more significant Config level changes are needed due to an event, the event handler must do this itself.

func (*ValueBase) HasDialog

func (vv *ValueBase) HasDialog() bool

func (*ValueBase) Is

func (vv *ValueBase) Is(f enums.BitFlag) bool

Is checks if flag is set, using atomic, safe for concurrent access

func (*ValueBase) IsReadOnly

func (vv *ValueBase) IsReadOnly() bool

func (*ValueBase) Label

func (vv *ValueBase) Label() string

func (*ValueBase) Name

func (vv *ValueBase) Name() string

func (*ValueBase) On

func (vv *ValueBase) On(etype events.Types, fun func(e events.Event))

On adds an event listener function for the given event type

func (*ValueBase) OnChange

func (vv *ValueBase) OnChange(fun func(e events.Event))

OnChange registers given listener function for Change events on Value. This is the primary notification event for all Value elements.

func (*ValueBase) OpenDialog

func (vv *ValueBase) OpenDialog(ctx gi.Widget, fun func())

func (*ValueBase) OwnerKind

func (vv *ValueBase) OwnerKind() reflect.Kind

we have this one accessor b/c it is more useful for outside consumers vs. internal usage

func (*ValueBase) OwnerLabel

func (vv *ValueBase) 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 (*ValueBase) SaveTmp

func (vv *ValueBase) SaveTmp()

func (*ValueBase) Send

func (vv *ValueBase) Send(typ events.Types, orig ...events.Event)

Send sends an NEW event of given type to this widget, optionally starting from values in the given original event (recommended to include where possible). Do NOT send an existing event using this method if you want the Handled state to persist throughout the call chain; call HandleEvent directly for any existing events.

func (*ValueBase) SendChange

func (vv *ValueBase) SendChange(orig ...events.Event)

SendChange sends events.Change event to all listeners registered on this view. This is the primary notification event for all Value elements. It takes an optional original event to base the event on.

func (*ValueBase) SetDialogType

func (vv *ValueBase) SetDialogType(e events.Event)

func (*ValueBase) SetDoc

func (vv *ValueBase) SetDoc(doc string)

func (*ValueBase) SetFlag

func (vv *ValueBase) SetFlag(on bool, f ...enums.BitFlag)

SetFlag sets the given flag(s) to given state using atomic, safe for concurrent access

func (*ValueBase) SetLabel

func (vv *ValueBase) SetLabel(label string)

func (*ValueBase) SetMapKey

func (vv *ValueBase) SetMapKey(key reflect.Value, owner any, tmpSave Value)

func (*ValueBase) SetMapValue

func (vv *ValueBase) SetMapValue(val reflect.Value, owner any, key any, keyView Value, tmpSave Value, viewPath string)

func (*ValueBase) SetName

func (vv *ValueBase) SetName(name string)

func (*ValueBase) SetReadOnly

func (vv *ValueBase) SetReadOnly(ro bool)

func (*ValueBase) SetSliceValue

func (vv *ValueBase) SetSliceValue(val reflect.Value, owner any, idx int, tmpSave Value, viewPath string)

func (*ValueBase) SetSoloValue

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

SetSoloValue sets the value for a singleton standalone value (e.g., for arg values).

func (*ValueBase) SetStructValue

func (vv *ValueBase) SetStructValue(val reflect.Value, owner any, field *reflect.StructField, tmpSave Value, viewPath string)

func (*ValueBase) SetTag

func (vv *ValueBase) SetTag(tag, value string)

func (*ValueBase) SetTags

func (vv *ValueBase) SetTags(tags map[string]string)

func (*ValueBase) SetValue

func (vv *ValueBase) SetValue(val any) bool

func (*ValueBase) SetValueMap

func (vv *ValueBase) SetValueMap(val any) (bool, error)

func (*ValueBase) StdConfigWidget

func (vv *ValueBase) StdConfigWidget(w gi.Widget)

StdConfigWidget does all of the standard widget configuration tag options

func (*ValueBase) String

func (vv *ValueBase) String() string

func (*ValueBase) Tag

func (vv *ValueBase) Tag(tag string) (string, bool)

func (*ValueBase) UpdateWidget

func (vv *ValueBase) UpdateWidget()

func (*ValueBase) Val

func (vv *ValueBase) Val() reflect.Value

func (*ValueBase) WidgetType

func (vv *ValueBase) WidgetType() *gti.Type

type ValueFlags

type ValueFlags int64 //enums:bitflag -trim-prefix Value

ValueFlags for Value bool state

const (
	// flagged after first configuration
	ValueReadOnly ValueFlags = iota

	// for OwnKind = Map, this value represents the Key -- otherwise the Value
	ValueMapKey

	// ValueHasSavedLabel is whether the value has a saved version of its
	// label, which can be set either automatically or explicitly
	ValueHasSavedLabel

	// ValueHasSavedDoc is whether the value has a saved version of its
	// documentation, which can be set either automatically or explicitly
	ValueHasSavedDoc

	// ValueDialogNewWindow indicates that the dialog should be opened with
	// in a new window, instead of a typical FullWindow in same current window.
	// this is triggered by holding down any modifier key while clicking on a
	// button that opens the window.
	ValueDialogNewWindow
)
const ValueFlagsN ValueFlags = 5

ValueFlagsN is the highest valid value for type ValueFlags, plus one.

func ValueFlagsValues

func ValueFlagsValues() []ValueFlags

ValueFlagsValues returns all possible values for the type ValueFlags.

func (ValueFlags) BitIndexString

func (i ValueFlags) BitIndexString() string

BitIndexString returns the string representation of this ValueFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.

func (ValueFlags) Desc

func (i ValueFlags) Desc() string

Desc returns the description of the ValueFlags value.

func (ValueFlags) HasFlag

func (i ValueFlags) HasFlag(f enums.BitFlag) bool

HasFlag returns whether these bit flags have the given bit flag set.

func (ValueFlags) Int64

func (i ValueFlags) Int64() int64

Int64 returns the ValueFlags value as an int64.

func (ValueFlags) IsValid

func (i ValueFlags) IsValid() bool

IsValid returns whether the value is a valid option for type ValueFlags.

func (ValueFlags) MarshalText

func (i ValueFlags) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*ValueFlags) SetFlag

func (i *ValueFlags) SetFlag(on bool, f ...enums.BitFlag)

SetFlag sets the value of the given flags in these flags to the given value.

func (*ValueFlags) SetInt64

func (i *ValueFlags) SetInt64(in int64)

SetInt64 sets the ValueFlags value from an int64.

func (*ValueFlags) SetString

func (i *ValueFlags) SetString(s string) error

SetString sets the ValueFlags value from its string representation, and returns an error if the string is invalid.

func (*ValueFlags) SetStringOr

func (i *ValueFlags) SetStringOr(s string) error

SetStringOr sets the ValueFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.

func (ValueFlags) String

func (i ValueFlags) String() string

String returns the string representation of this ValueFlags value.

func (*ValueFlags) UnmarshalText

func (i *ValueFlags) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ValueFlags) Values

func (i ValueFlags) Values() []enums.Enum

Values returns all possible values for the type ValueFlags.

type ValueFunc

type ValueFunc func() Value

ValueFunc is a function that returns a new initialized Value of an appropriate type as registered in the ValueMap

type Valuer

type Valuer interface {
	Value() Value
}

Valuer interface supplies the appropriate type of Value -- 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 Value before returning it

type ViewIFace

type ViewIFace struct {
}

giv.ViewIFace is THE implementation of the gi.ViewIFace interface

func (*ViewIFace) CallFunc

func (vi *ViewIFace) CallFunc(ctx gi.Widget, fun any)

func (*ViewIFace) HiStyleInit

func (vi *ViewIFace) HiStyleInit()

func (*ViewIFace) HiStylesView

func (vi *ViewIFace) HiStylesView(std bool)

func (*ViewIFace) Inspector

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

func (*ViewIFace) KeyMapsView

func (vi *ViewIFace) KeyMapsView(maps *keyfun.Maps)

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

func (*ViewIFace) SetHiStyleDefault

func (vi *ViewIFace) SetHiStyleDefault(hsty gi.HiStyleName)

Jump to

Keyboard shortcuts

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