Documentation ¶
Overview ¶
Package views allows you to view and edit Go data in the GUI using reflection.
Index ¶
- Constants
- Variables
- func AddValue(val any, fun func() Value)
- func CallFunc(ctx core.Widget, fun any)
- func Config(v Value, w core.Widget)
- func ConfigBase(v Value, w core.Widget)
- func ConfigDialogWidget(v Value, allowReadOnly bool)
- func ConfigImageToolbar(tb *core.Toolbar, im *core.Image)
- func ConfigSVGToolbar(tb *core.Toolbar, sv *core.SVG)
- func FileViewDialog(ctx core.Widget, filename, exts, title string, fun func(selfile string))
- func FileViewDirOnlyFilter(fv *FileView, fi *fileinfo.FileInfo) bool
- func FileViewExtOnlyFilter(fv *FileView, fi *fileinfo.FileInfo) bool
- func InspectorView(b *core.Body, k tree.Node)
- func InspectorWindow(k tree.Node)
- func JoinViewPath(a, b string) string
- func NoSentenceCaseForType(tnm string) bool
- func OpenDialog(v Value, ctx core.Widget, fun, beforeFunc func()) bool
- func OpenDialogBase(v Value, cd ConfigDialoger, ctx core.Widget, fun func())
- func SettingsView(b *core.Body)
- func SettingsViewToolbarBase(tb *core.Toolbar)
- func SettingsWindow()
- func SliceIndexByValue(slc any, fldVal any) (int, bool)
- func StructFieldIsDef(defs string, valPtr any, kind reflect.Kind) (bool, string)
- func StructNonDefFieldsStr(structPtr any, path string) string
- func StructSliceIndexByValue(struSlice any, fldName string, fldVal any) (int, error)
- func StructViewDialog(ctx core.Widget, stru any, title string, newWindow bool)
- func StructViewFieldTags(vv Value, lbl *core.Label, w core.Widget, isReadOnly bool) (hasDef, readOnlyTag bool)
- type ArgView
- func (av *ArgView) ArgsGrid() *core.Frame
- func (av *ArgView) Config()
- func (av *ArgView) ConfigArgsGrid()
- func (t *ArgView) New() tree.Node
- func (t *ArgView) NodeType() *types.Type
- func (av *ArgView) OnInit()
- func (t *ArgView) SetArgs(v ...Value) *ArgView
- func (av *ArgView) SetStyles()
- func (t *ArgView) SetTooltip(v string) *ArgView
- func (av *ArgView) TitleWidget() *core.Label
- type BitFlagValue
- type BoolValue
- type ByteSliceValue
- type ColorMapName
- type ColorMapValue
- type ColorValue
- type ColorView
- func (cv *ColorView) Config()
- func (t *ColorView) New() tree.Node
- func (t *ColorView) NodeType() *types.Type
- func (cv *ColorView) OnInit()
- func (cv *ColorView) SetColor(clr color.Color) *ColorView
- func (cv *ColorView) SetHCT(hct hct.HCT) *ColorView
- func (t *ColorView) SetTooltip(v string) *ColorView
- type ConfigDialoger
- type DateView
- type DurationValue
- type EnumValue
- type FieldValuer
- type FileValue
- type FileView
- func (fv *FileView) AddPathToFavs()
- func (fv *FileView) ApplyStyle()
- func (fv *FileView) Config()
- func (fv *FileView) ConfigFileView()
- func (fv *FileView) ConfigFilesRow()
- func (fv *FileView) ConfigSelRow()
- func (fv *FileView) ConfigToolbar(tb *core.Toolbar)
- func (fv *FileView) ConfigWatcher() error
- func (fv *FileView) DirPathUp()
- func (fv *FileView) Disconnect()
- func (fv *FileView) EditRecentPaths()
- func (fv *FileView) ExtField() *core.TextField
- func (fv *FileView) FavSelect(idx int)
- func (fv *FileView) FavsView() *TableView
- func (fv *FileView) FileComplete(data any, text string, posLn, posCh int) (md complete.Matches)
- func (fv *FileView) FileCompleteEdit(data any, text string, cursorPos int, c complete.Completion, seed string) (ed complete.Edit)
- func (fv *FileView) FileSelectAction(idx int)
- func (fv *FileView) FilesRow() *core.Layout
- func (fv *FileView) FilesView() *TableView
- func (fv *FileView) HandleEvents()
- func (fv *FileView) KeyInput(kt events.Event)
- func (t *FileView) New() tree.Node
- func (fv *FileView) NewFolder(name string) error
- func (t *FileView) NodeType() *types.Type
- func (fv *FileView) OnInit()
- func (fv *FileView) PathComplete(data any, path string, posLn, posCh int) (md complete.Matches)
- func (fv *FileView) PathCompleteEdit(data any, text string, cursorPos int, c complete.Completion, seed string) (ed complete.Edit)
- func (fv *FileView) ReadFiles()
- func (fv *FileView) SaveSortSettings()
- func (fv *FileView) SelectField() *core.TextField
- func (fv *FileView) SelectFile() bool
- func (fv *FileView) SelectRow() *core.Layout
- func (fv *FileView) SelectedFile() string
- func (fv *FileView) SelectedFileInfo() (*fileinfo.FileInfo, bool)
- func (fv *FileView) SetExt(ext string) *FileView
- func (fv *FileView) SetExtAction(ext string) *FileView
- func (t *FileView) SetExtMap(v map[string]string) *FileView
- func (fv *FileView) SetFilename(filename, ext string) *FileView
- func (t *FileView) SetFiles(v ...*fileinfo.FileInfo) *FileView
- func (t *FileView) SetFilterFunc(v FileViewFilterFunc) *FileView
- func (fv *FileView) SetPathFile(path, file, ext string) *FileView
- func (fv *FileView) SetSelFileAction(sel string)
- func (fv *FileView) SetStyles()
- func (t *FileView) SetTooltip(v string) *FileView
- func (fv *FileView) UpdateFavs()
- func (fv *FileView) UpdateFiles()
- func (fv *FileView) UpdateFilesAction()
- func (fv *FileView) UpdatePath()
- func (fv *FileView) WatchWatcher()
- type FileViewFilterFunc
- type FontValue
- type FuncButton
- func (fb *FuncButton) CallFunc()
- func (fb *FuncButton) CallFuncShowReturns()
- func (fb *FuncButton) ConfirmDialog()
- func (fb *FuncButton) GoodContext() core.Widget
- func (t *FuncButton) New() tree.Node
- func (t *FuncButton) NodeType() *types.Type
- func (fb *FuncButton) OnInit()
- func (t *FuncButton) SetAfterFunc(v func()) *FuncButton
- func (fb *FuncButton) SetArgs()
- func (t *FuncButton) SetConfirm(v bool) *FuncButton
- func (t *FuncButton) SetContext(v core.Widget) *FuncButton
- func (fb *FuncButton) SetFunc(fun any) *FuncButton
- func (fb *FuncButton) SetFuncImpl(gfun *types.Func, rfun reflect.Value) *FuncButton
- func (t *FuncButton) SetIcon(v icons.Icon) *FuncButton
- func (t *FuncButton) SetIndicator(v icons.Icon) *FuncButton
- func (fb *FuncButton) SetKey(kf keymap.Functions) *FuncButton
- func (t *FuncButton) SetMenu(v func(m *core.Scene)) *FuncButton
- func (fb *FuncButton) SetMethodImpl(gmet *types.Method, rmet reflect.Value) *FuncButton
- func (t *FuncButton) SetNewWindow(v bool) *FuncButton
- func (fb *FuncButton) SetReturnValues(rets []reflect.Value)
- func (fb *FuncButton) SetReturns()
- func (t *FuncButton) SetShortcut(v key.Chord) *FuncButton
- func (t *FuncButton) SetShowReturn(v bool) *FuncButton
- func (t *FuncButton) SetShowReturnAsDialog(v bool) *FuncButton
- func (fb *FuncButton) SetText(v string) *FuncButton
- func (t *FuncButton) SetTooltip(v string) *FuncButton
- func (t *FuncButton) SetType(v core.ButtonTypes) *FuncButton
- func (t *FuncButton) SetWarnUnadded(v bool) *FuncButton
- func (fb *FuncButton) ShowReturnsDialog(rets []reflect.Value)
- type FuncValue
- type IconValue
- type Inspector
- func (is *Inspector) Config()
- func (is *Inspector) ConfigSplits()
- func (is *Inspector) ConfigToolbar(tb *core.Toolbar)
- func (is *Inspector) InspectApp()
- func (t *Inspector) New() tree.Node
- func (t *Inspector) NodeType() *types.Type
- func (is *Inspector) OnInit()
- func (is *Inspector) Open(filename core.Filename) error
- func (is *Inspector) Save() error
- func (is *Inspector) SaveAs(filename core.Filename) error
- func (is *Inspector) SelectionMonitor()
- func (t *Inspector) SetFilename(v core.Filename) *Inspector
- func (t *Inspector) SetKiRoot(v tree.Node) *Inspector
- func (is *Inspector) SetRoot(root tree.Node)
- func (is *Inspector) SetStyles()
- func (is *Inspector) SetTitle(k tree.Node)
- func (t *Inspector) SetTooltip(v string) *Inspector
- func (is *Inspector) Splits() *core.Splits
- func (is *Inspector) StructView() *StructView
- func (is *Inspector) TitleWidget() *core.Label
- func (is *Inspector) ToggleSelectionMode()
- func (is *Inspector) TreeView() *TreeView
- type KeyChordValue
- type KeyMapValue
- type KiValue
- type MapInlineValue
- type MapValue
- type MapView
- func (mv *MapView) Config()
- func (mv *MapView) ConfigMapGrid()
- func (mv *MapView) ConfigToolbar(tb *core.Toolbar)
- func (mv *MapView) ContextMenu(m *core.Scene, keyv reflect.Value)
- func (mv *MapView) IsConfiged() bool
- func (mv *MapView) MapAdd()
- func (mv *MapView) MapDelete(key reflect.Value)
- func (mv *MapView) MapGrid() *core.Frame
- func (t *MapView) New() tree.Node
- func (t *MapView) NodeType() *types.Type
- func (mv *MapView) OnInit()
- func (mv *MapView) SetChanged()
- func (mv *MapView) SetMap(mp any) *MapView
- func (t *MapView) SetMapValView(v Value) *MapView
- func (t *MapView) SetSortVals(v bool) *MapView
- func (mv *MapView) SetStyles()
- func (t *MapView) SetTooltip(v string) *MapView
- func (t *MapView) SetViewPath(v string) *MapView
- func (mv *MapView) ToggleSort()
- func (mv *MapView) UpdateValues()
- type MapViewInline
- func (mv *MapViewInline) Config()
- func (mv *MapViewInline) ContextMenu(m *core.Scene, keyv reflect.Value)
- func (mv *MapViewInline) MapAdd()
- func (mv *MapViewInline) MapDelete(key reflect.Value)
- func (mv *MapViewInline) MapSizeChanged() bool
- func (t *MapViewInline) New() tree.Node
- func (t *MapViewInline) NodeType() *types.Type
- func (mv *MapViewInline) OnInit()
- func (mv *MapViewInline) SetChanged()
- func (mv *MapViewInline) SetMap(mp any) *MapViewInline
- func (mv *MapViewInline) SetStyles()
- func (t *MapViewInline) SetTooltip(v string) *MapViewInline
- func (t *MapViewInline) SetViewPath(v string) *MapViewInline
- func (mv *MapViewInline) SizeUp()
- func (mv *MapViewInline) UpdateValues()
- type NilValue
- type NumberValue
- type OpenDialoger
- type RuneSliceValue
- type SliceInlineValue
- type SliceValue
- type SliceView
- func (sv *SliceView) HasStyleFunc() bool
- func (t *SliceView) New() tree.Node
- func (t *SliceView) NodeType() *types.Type
- func (t *SliceView) SetInitSelectedIndex(v int) *SliceView
- func (t *SliceView) SetMinRows(v int) *SliceView
- func (t *SliceView) SetSelectedIndex(v int) *SliceView
- func (t *SliceView) SetSelectedValue(v any) *SliceView
- func (t *SliceView) SetStyleFunc(v SliceViewStyleFunc) *SliceView
- func (t *SliceView) SetTooltip(v string) *SliceView
- func (t *SliceView) SetViewPath(v string) *SliceView
- func (sv *SliceView) StyleRow(w core.Widget, idx, fidx int)
- type SliceViewBase
- func (sv *SliceViewBase) AsSliceViewBase() *SliceViewBase
- func (sv *SliceViewBase) BindSelect(val *int) *SliceViewBase
- func (sv *SliceViewBase) ClickSelectEvent(e events.Event) bool
- func (sv *SliceViewBase) Config()
- func (sv *SliceViewBase) ConfigFrame()
- func (sv *SliceViewBase) ConfigRows()
- func (sv *SliceViewBase) ConfigSliceView()
- func (sv *SliceViewBase) ConfigToolbar(tb *core.Toolbar)
- func (sv *SliceViewBase) ContextMenu(m *core.Scene)
- func (sv *SliceViewBase) CopyIndexes(reset bool)
- func (sv *SliceViewBase) CopySelectToMime() mimedata.Mimes
- func (sv *SliceViewBase) CutIndexes()
- func (sv *SliceViewBase) DeleteIndexes()
- func (sv *SliceViewBase) DragDrop(e events.Event)
- func (sv *SliceViewBase) DragStart(e events.Event)
- func (sv *SliceViewBase) DropDeleteSource(e events.Event)
- func (sv *SliceViewBase) DropFinalize(de *events.DragDrop)
- func (sv *SliceViewBase) Duplicate() int
- func (sv *SliceViewBase) FlagType() enums.BitFlagSetter
- func (sv *SliceViewBase) FromMimeData(md mimedata.Mimes) []any
- func (sv *SliceViewBase) HandleEvents()
- func (sv *SliceViewBase) IndexFromPos(posY int) (int, bool)
- func (sv *SliceViewBase) IndexGrabFocus(idx int) *core.WidgetBase
- func (sv *SliceViewBase) IndexIsSelected(idx int) bool
- func (sv *SliceViewBase) IndexPos(idx int) image.Point
- func (sv *SliceViewBase) IsIndexVisible(idx int) bool
- func (sv *SliceViewBase) IsNil() bool
- func (sv *SliceViewBase) IsRowInBounds(row int) bool
- func (sv *SliceViewBase) KeyInputEditable(kt events.Event)
- func (sv *SliceViewBase) KeyInputNav(kt events.Event)
- func (sv *SliceViewBase) KeyInputReadOnly(kt events.Event)
- func (sv *SliceViewBase) MakePasteMenu(m *core.Scene, md mimedata.Mimes, idx int, mod events.DropMods, fun func())
- func (sv *SliceViewBase) MimeDataIndex(md *mimedata.Mimes, idx int)
- func (sv *SliceViewBase) MimeDataType() string
- func (sv *SliceViewBase) MousePosInGrid(e events.Event) bool
- func (sv *SliceViewBase) MoveDown(selMode events.SelectModes) int
- func (sv *SliceViewBase) MoveDownAction(selMode events.SelectModes) int
- func (sv *SliceViewBase) MovePageDown(selMode events.SelectModes) int
- func (sv *SliceViewBase) MovePageDownAction(selMode events.SelectModes) int
- func (sv *SliceViewBase) MovePageUp(selMode events.SelectModes) int
- func (sv *SliceViewBase) MovePageUpAction(selMode events.SelectModes) int
- func (sv *SliceViewBase) MoveUp(selMode events.SelectModes) int
- func (sv *SliceViewBase) MoveUpAction(selMode events.SelectModes) int
- func (t *SliceViewBase) New() tree.Node
- func (t *SliceViewBase) NodeType() *types.Type
- func (sv *SliceViewBase) OnInit()
- func (sv *SliceViewBase) PasteAssign(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) PasteAtIndex(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) PasteIndex(idx int)
- func (sv *SliceViewBase) PasteMenu(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) ResetSelectedIndexes()
- func (sv *SliceViewBase) RowFirstWidget(row int) (*core.WidgetBase, bool)
- func (sv *SliceViewBase) RowFromEventPos(e events.Event) (row, idx int, isValid bool)
- func (sv *SliceViewBase) RowFromPos(posY int) (int, bool)
- func (sv *SliceViewBase) RowGrabFocus(row int) *core.WidgetBase
- func (sv *SliceViewBase) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (sv *SliceViewBase) RowWidgetsFunc(row int, fun func(w core.Widget))
- func (sv *SliceViewBase) SaveDraggedIndexes(idx int)
- func (sv *SliceViewBase) ScrollToIndex(idx int) bool
- func (sv *SliceViewBase) ScrollToIndexNoUpdate(idx int) bool
- func (sv *SliceViewBase) SelectAllIndexes()
- func (sv *SliceViewBase) SelectIndex(idx int)
- func (sv *SliceViewBase) SelectIndexAction(idx int, mode events.SelectModes)
- func (sv *SliceViewBase) SelectIndexWidgets(idx int, sel bool) bool
- func (sv *SliceViewBase) SelectRowIfNone(e events.Event) bool
- func (sv *SliceViewBase) SelectRowWidgets(row int, sel bool)
- func (sv *SliceViewBase) SelectValue(val string) bool
- func (sv *SliceViewBase) SelectedIndexesList(descendingSort bool) []int
- func (sv *SliceViewBase) SetChanged()
- func (t *SliceViewBase) SetInitSelectedIndex(v int) *SliceViewBase
- func (t *SliceViewBase) SetMinRows(v int) *SliceViewBase
- func (sv *SliceViewBase) SetRowWidgetsState(row int, ability abilities.Abilities, on bool, state states.States)
- func (sv *SliceViewBase) SetRowWidgetsStateEvent(e events.Event, ability abilities.Abilities, on bool, state states.States) (int, bool)
- func (t *SliceViewBase) SetSelectedIndex(v int) *SliceViewBase
- func (t *SliceViewBase) SetSelectedValue(v any) *SliceViewBase
- func (sv *SliceViewBase) SetSlice(sl any) *SliceViewBase
- func (sv *SliceViewBase) SetSliceBase()
- func (sv *SliceViewBase) SetStyles()
- func (t *SliceViewBase) SetTooltip(v string) *SliceViewBase
- func (t *SliceViewBase) SetViewPath(v string) *SliceViewBase
- func (sv *SliceViewBase) SizeFinal()
- func (sv *SliceViewBase) SliceDeleteAt(i int)
- func (sv *SliceViewBase) SliceDeleteAtRow(row int)
- func (sv *SliceViewBase) SliceDeleteAtSelect(i int)
- func (sv *SliceViewBase) SliceGrid() *SliceViewGrid
- func (sv *SliceViewBase) SliceNewAt(idx int)
- func (sv *SliceViewBase) SliceNewAtRow(row int)
- func (sv *SliceViewBase) SliceNewAtSelect(i int)
- func (sv *SliceViewBase) SliceVal(idx int) any
- func (sv *SliceViewBase) StyleValueWidget(w core.Widget, s *styles.Style, row, col int)
- func (sv *SliceViewBase) UnselectAllIndexes()
- func (sv *SliceViewBase) UnselectIndex(idx int)
- func (sv *SliceViewBase) UnselectIndexAction(idx int)
- func (sv *SliceViewBase) UpdateScroll()
- func (sv *SliceViewBase) UpdateSelectIndex(idx int, sel bool, selMode events.SelectModes)
- func (sv *SliceViewBase) UpdateSelectRow(row int, selMode events.SelectModes)
- func (sv *SliceViewBase) UpdateSliceSize() int
- func (sv *SliceViewBase) UpdateStartIndex()
- func (sv *SliceViewBase) UpdateWidgets()
- func (sv *SliceViewBase) ViewMuLock()
- func (sv *SliceViewBase) ViewMuUnlock()
- func (sv *SliceViewBase) WidgetIndex(w core.Widget) (row, col int)
- type SliceViewFlags
- func (i SliceViewFlags) BitIndexString() string
- func (i SliceViewFlags) Desc() string
- func (i SliceViewFlags) HasFlag(f enums.BitFlag) bool
- func (i SliceViewFlags) Int64() int64
- func (i SliceViewFlags) MarshalText() ([]byte, error)
- func (i *SliceViewFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *SliceViewFlags) SetInt64(in int64)
- func (i *SliceViewFlags) SetString(s string) error
- func (i *SliceViewFlags) SetStringOr(s string) error
- func (i SliceViewFlags) String() string
- func (i *SliceViewFlags) UnmarshalText(text []byte) error
- func (i SliceViewFlags) Values() []enums.Enum
- type SliceViewGrid
- func (sg *SliceViewGrid) ChildBackground(child core.Widget) image.Image
- func (sg *SliceViewGrid) IndexFromPixel(pt image.Point) (row, col int, isValid bool)
- func (sg *SliceViewGrid) MousePosInGrid(pt image.Point) bool
- func (t *SliceViewGrid) New() tree.Node
- func (t *SliceViewGrid) NodeType() *types.Type
- func (sg *SliceViewGrid) OnInit()
- func (sg *SliceViewGrid) RenderStripes()
- func (sg *SliceViewGrid) RenderWidget()
- func (sg *SliceViewGrid) RowBackground(sel, stripe, hover bool) image.Image
- func (sg *SliceViewGrid) ScrollChanged(d math32.Dims, sb *core.Slider)
- func (sg *SliceViewGrid) ScrollValues(d math32.Dims) (maxSize, visSize, visPct float32)
- func (t *SliceViewGrid) SetLastBackground(v image.Image) *SliceViewGrid
- func (sg *SliceViewGrid) SetScrollParams(d math32.Dims, sb *core.Slider)
- func (t *SliceViewGrid) SetTooltip(v string) *SliceViewGrid
- func (sg *SliceViewGrid) SizeFromChildren(iter int, pass core.LayoutPasses) math32.Vector2
- func (sg *SliceViewGrid) SliceView() (SliceViewer, *SliceViewBase)
- func (sg *SliceViewGrid) UpdateBackgrounds()
- func (sg *SliceViewGrid) UpdateScroll(idx int)
- type SliceViewInline
- func (sv *SliceViewInline) Config()
- func (sv *SliceViewInline) ContextMenu(m *core.Scene, idx int)
- func (t *SliceViewInline) New() tree.Node
- func (t *SliceViewInline) NodeType() *types.Type
- func (sv *SliceViewInline) OnInit()
- func (sv *SliceViewInline) SetChanged()
- func (sv *SliceViewInline) SetSlice(sl any) *SliceViewInline
- func (sv *SliceViewInline) SetStyles()
- func (t *SliceViewInline) SetTooltip(v string) *SliceViewInline
- func (t *SliceViewInline) SetViewPath(v string) *SliceViewInline
- func (sv *SliceViewInline) SizeUp()
- func (sv *SliceViewInline) SliceDeleteAt(idx int)
- func (sv *SliceViewInline) SliceNewAt(idx int)
- func (sv *SliceViewInline) SliceSizeChanged() bool
- func (sv *SliceViewInline) UpdateValues()
- type SliceViewStyleFunc
- type SliceViewer
- type SliderValue
- type StringValue
- type StructFieldVals
- type StructInlineValue
- type StructValue
- type StructView
- func (sv *StructView) Config()
- func (sv *StructView) ConfigStructGrid() bool
- func (sv *StructView) FieldTags(fld reflect.StructField) reflect.StructTag
- func (sv *StructView) IsConfiged() bool
- func (t *StructView) New() tree.Node
- func (t *StructView) NodeType() *types.Type
- func (sv *StructView) OnInit()
- func (sv *StructView) SetStruct(st any) *StructView
- func (sv *StructView) SetStyles()
- func (t *StructView) SetTooltip(v string) *StructView
- func (t *StructView) SetViewPath(v string) *StructView
- func (sv *StructView) StructGrid() *core.Frame
- func (sv *StructView) UpdateField(field string)
- func (sv *StructView) UpdateFieldAction()
- func (sv *StructView) UpdateFields()
- type StructViewInline
- func (sv *StructViewInline) Config()
- func (t *StructViewInline) New() tree.Node
- func (t *StructViewInline) NodeType() *types.Type
- func (sv *StructViewInline) OnInit()
- func (t *StructViewInline) SetAddButton(v bool) *StructViewInline
- func (t *StructViewInline) SetFieldViews(v ...Value) *StructViewInline
- func (sv *StructViewInline) SetStruct(st any) *StructViewInline
- func (sv *StructViewInline) SetStyles()
- func (t *StructViewInline) SetTooltip(v string) *StructViewInline
- func (t *StructViewInline) SetViewPath(v string) *StructViewInline
- func (sv *StructViewInline) UpdateFieldAction()
- func (sv *StructViewInline) UpdateFields()
- type TableView
- func (tv *TableView) CacheVisFields()
- func (tv *TableView) Config()
- func (tv *TableView) ConfigFrame()
- func (tv *TableView) ConfigHeader()
- func (tv *TableView) ConfigRows()
- func (tv *TableView) ConfigTableView()
- func (tv *TableView) ContextMenu(m *core.Scene)
- func (tv *TableView) EditIndex(idx int)
- func (tv *TableView) HasStyleFunc() bool
- func (t *TableView) New() tree.Node
- func (t *TableView) NodeType() *types.Type
- func (tv *TableView) OnInit()
- func (tv *TableView) RowFirstVisWidget(row int) (*core.WidgetBase, bool)
- func (tv *TableView) RowGrabFocus(row int) *core.WidgetBase
- func (tv *TableView) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (tv *TableView) SelectFieldVal(fld, val string) bool
- func (t *TableView) SetInitSelectedIndex(v int) *TableView
- func (t *TableView) SetMinRows(v int) *TableView
- func (t *TableView) SetSelectedField(v string) *TableView
- func (t *TableView) SetSelectedIndex(v int) *TableView
- func (t *TableView) SetSelectedValue(v any) *TableView
- func (tv *TableView) SetSlice(sl any) *TableView
- func (t *TableView) SetSortDesc(v bool) *TableView
- func (tv *TableView) SetSortFieldName(nm string)
- func (t *TableView) SetSortIndex(v int) *TableView
- func (t *TableView) SetStyleFunc(v TableViewStyleFunc) *TableView
- func (tv *TableView) SetStyles()
- func (t *TableView) SetTooltip(v string) *TableView
- func (t *TableView) SetViewPath(v string) *TableView
- func (tv *TableView) SizeFinal()
- func (tv *TableView) SliceDeleteAt(idx int)
- func (tv *TableView) SliceHeader() *core.Frame
- func (tv *TableView) SliceNewAt(idx int)
- func (tv *TableView) SortFieldName() string
- func (tv *TableView) SortSlice()
- func (tv *TableView) SortSliceAction(fldIndex int)
- func (tv *TableView) StructType() reflect.Type
- func (tv *TableView) StyleRow(w core.Widget, idx, fidx int)
- func (tv *TableView) StyleValueWidget(w core.Widget, s *styles.Style, row, col int)
- func (tv *TableView) UpdateWidgets()
- type TableViewStyleFunc
- type TimeValue
- type TimeView
- type TreeTableView
- type TreeView
- func (tv *TreeView) AddChildNode()
- func (tv *TreeView) AddSyncNodes(rel, myidx int, typ *types.Type, n int)
- func (tv *TreeView) AddTreeNodes(rel, myidx int, typ *types.Type, n int)
- func (tv *TreeView) ApplyStyle()
- func (tv *TreeView) AsTreeView() *TreeView
- func (tv *TreeView) BaseType() *types.Type
- func (tv *TreeView) BranchPart() (*core.Switch, bool)
- func (tv *TreeView) CanOpen() bool
- func (tv *TreeView) Close()
- func (tv *TreeView) CloseAll()
- func (tv *TreeView) Config()
- func (tv *TreeView) ContextMenu(m *core.Scene)
- func (tv *TreeView) ContextMenuPos(e events.Event) (pos image.Point)
- func (tv *TreeView) ContextMenuReadOnly(m *core.Scene)
- func (tv *TreeView) Copy(reset bool)
- func (tv *TreeView) Cut()
- func (tv *TreeView) CutSync()
- func (tv *TreeView) DeleteNode()
- func (tv *TreeView) DragClearStates()
- func (tv *TreeView) DragDrop(e events.Event)
- func (tv *TreeView) DragStart(e events.Event)
- func (tv *TreeView) DropDeleteSource(e events.Event)
- func (tv *TreeView) DropDeleteSourceSync(de *events.DragDrop)
- func (tv *TreeView) DropExternal(md mimedata.Mimes, mod events.DropMods)
- func (tv *TreeView) DropFinalize(de *events.DragDrop)
- func (tv *TreeView) Duplicate()
- func (tv *TreeView) DuplicateSync()
- func (tv *TreeView) EditNode()
- func (tv *TreeView) FindSyncNode(kn tree.Node) *TreeView
- func (tv *TreeView) FlagType() enums.BitFlagSetter
- func (tv *TreeView) HandleEvents()
- func (tv *TreeView) HandleKeys()
- func (tv *TreeView) HandleMouse()
- func (tv *TreeView) HasSelection() bool
- func (tv *TreeView) IconPart() (*core.Icon, bool)
- func (tv *TreeView) InsertAfter()
- func (tv *TreeView) InsertAt(rel int, actNm string)
- func (tv *TreeView) InsertBefore()
- func (tv *TreeView) InspectNode()
- func (tv *TreeView) IsClosed() bool
- func (tv *TreeView) IsRoot(op string) bool
- func (tv *TreeView) Label() string
- func (tv *TreeView) LabelPart() (*core.Label, bool)
- func (tv *TreeView) MakePasteMenu(m *core.Scene, md mimedata.Mimes, fun func())
- func (tv *TreeView) MimeData(md *mimedata.Mimes)
- func (tv *TreeView) MimeDataSync(md *mimedata.Mimes)
- func (tv *TreeView) MoveDown(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveDownAction(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveDownSibling(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveEndAction(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveHomeAction(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MovePageDownAction(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MovePageUpAction(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveToLastChild(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveUp(selMode events.SelectModes) *TreeView
- func (tv *TreeView) MoveUpAction(selMode events.SelectModes) *TreeView
- func (t *TreeView) New() tree.Node
- func (t *TreeView) NodeType() *types.Type
- func (tv *TreeView) NodesFromMimeData(md mimedata.Mimes) (tree.Slice, []string)
- func (tv *TreeView) OnAdd()
- func (tv *TreeView) OnClose()
- func (tv *TreeView) OnDoubleClick(e events.Event)
- func (tv *TreeView) OnInit()
- func (tv *TreeView) OnOpen()
- func (tv *TreeView) Open()
- func (tv *TreeView) OpenAll()
- func (tv *TreeView) OpenParents()
- func (tv *TreeView) Paste()
- func (tv *TreeView) PasteAfter(md mimedata.Mimes, mod events.DropMods)
- func (tv *TreeView) PasteAssign(md mimedata.Mimes)
- func (tv *TreeView) PasteAssignSync(md mimedata.Mimes)
- func (tv *TreeView) PasteAt(md mimedata.Mimes, mod events.DropMods, rel int, actNm string)
- func (tv *TreeView) PasteAtSync(md mimedata.Mimes, mod events.DropMods, rel int, actNm string)
- func (tv *TreeView) PasteBefore(md mimedata.Mimes, mod events.DropMods)
- func (tv *TreeView) PasteChildren(md mimedata.Mimes, mod events.DropMods)
- func (tv *TreeView) PasteChildrenSync(md mimedata.Mimes, mod events.DropMods)
- func (tv *TreeView) PasteMenu(md mimedata.Mimes)
- func (tv *TreeView) Position()
- func (tv *TreeView) ReSync()
- func (tv *TreeView) Render()
- func (tv *TreeView) RenderWidget()
- func (tv *TreeView) RootIsReadOnly() bool
- func (tv *TreeView) RootSetViewIndex() int
- func (tv *TreeView) ScenePos()
- func (tv *TreeView) Select()
- func (tv *TreeView) SelectAction(mode events.SelectModes) bool
- func (tv *TreeView) SelectAll()
- func (tv *TreeView) SelectMode() bool
- func (tv *TreeView) SelectModeToggle()
- func (tv *TreeView) SelectUpdate(mode events.SelectModes) bool
- func (tv *TreeView) SelectedSyncNodes() tree.Slice
- func (tv *TreeView) SelectedViews() []TreeViewer
- func (tv *TreeView) SendChangeEvent(ctx events.Event)
- func (tv *TreeView) SendChangeEventReSync(ctx events.Event)
- func (tv *TreeView) SendSelectEvent(ctx events.Event)
- func (tv *TreeView) SetBranchState()
- func (tv *TreeView) SetClosed(closed bool)
- func (t *TreeView) SetIcon(v icons.Icon) *TreeView
- func (t *TreeView) SetIconClosed(v icons.Icon) *TreeView
- func (t *TreeView) SetIconLeaf(v icons.Icon) *TreeView
- func (t *TreeView) SetIconOpen(v icons.Icon) *TreeView
- func (t *TreeView) SetIndent(v units.Value) *TreeView
- func (tv *TreeView) SetKidsVisibility(parentClosed bool)
- func (t *TreeView) SetOpenDepth(v int) *TreeView
- func (t *TreeView) SetRootView(v *TreeView) *TreeView
- func (tv *TreeView) SetSelectMode(selMode bool)
- func (t *TreeView) SetSelectedNodes(v ...TreeViewer) *TreeView
- func (tv *TreeView) SetSelectedViews(sl []TreeViewer)
- func (tv *TreeView) SetStyles()
- func (tv *TreeView) SetSyncNode(sn tree.Node, tvIndex *int, init bool, depth int)
- func (t *TreeView) SetText(v string) *TreeView
- func (t *TreeView) SetTooltip(v string) *TreeView
- func (t *TreeView) SetViewIndex(v int) *TreeView
- func (t *TreeView) SetWidgetSize(v math32.Vector2) *TreeView
- func (tv *TreeView) SizeDown(iter int) bool
- func (tv *TreeView) SizeUp()
- func (tv *TreeView) SyncNodesFromMimeData(md mimedata.Mimes) (tree.Slice, []string)
- func (tv *TreeView) SyncToSrc(tvIndex *int, init bool, depth int)
- func (tv *TreeView) SyncTree(n tree.Node) *TreeView
- func (tv *TreeView) ToggleClose()
- func (tv *TreeView) TreeViewChanged(ctx events.Event)
- func (tv *TreeView) TreeViewParent() *TreeView
- func (tv *TreeView) Unselect()
- func (tv *TreeView) UnselectAction()
- func (tv *TreeView) UnselectAll()
- func (tv *TreeView) UpdateBranchIcons()
- func (tv *TreeView) UpdateReadOnly() bool
- type TreeViewFlags
- func (i TreeViewFlags) BitIndexString() string
- func (i TreeViewFlags) Desc() string
- func (i TreeViewFlags) HasFlag(f enums.BitFlag) bool
- func (i TreeViewFlags) Int64() int64
- func (i TreeViewFlags) MarshalText() ([]byte, error)
- func (i *TreeViewFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *TreeViewFlags) SetInt64(in int64)
- func (i *TreeViewFlags) SetString(s string) error
- func (i *TreeViewFlags) SetStringOr(s string) error
- func (i TreeViewFlags) String() string
- func (i *TreeViewFlags) UnmarshalText(text []byte) error
- func (i TreeViewFlags) Values() []enums.Enum
- type TreeViewer
- type TypeValue
- type Value
- type ValueBase
- func (v *ValueBase[W]) AsWidget() core.Widget
- func (v *ValueBase[W]) AsWidgetBase() *core.WidgetBase
- func (v *ValueBase[W]) SetValue(value any) bool
- func (v *ValueBase[W]) SetValueMap(val any) (bool, error)
- func (v *ValueBase[W]) SetWidget(w core.Widget)
- func (v *ValueBase[W]) WidgetType() *types.Type
- type ValueData
- func (v *ValueData) AllTags() map[string]string
- func (v *ValueData) AsValueData() *ValueData
- func (v *ValueData) Doc() string
- func (v *ValueData) GetTitle() (label, newPath string, isZero bool)
- func (v *ValueData) HandleEvent(ev events.Event)
- func (v *ValueData) Is(f enums.BitFlag) bool
- func (v *ValueData) IsReadOnly() bool
- func (v *ValueData) Label() string
- func (v *ValueData) Name() string
- func (v *ValueData) On(etype events.Types, fun func(e events.Event))
- func (v *ValueData) OnChange(fun func(e events.Event))
- func (v *ValueData) OwnerKind() reflect.Kind
- func (v *ValueData) OwnerLabel() string
- func (v *ValueData) Send(typ events.Types, orig ...events.Event)
- func (v *ValueData) SendChange(orig ...events.Event)
- func (v *ValueData) SetDoc(doc string) *ValueData
- func (v *ValueData) SetFlag(on bool, f ...enums.BitFlag)
- func (v *ValueData) SetLabel(label string) *ValueData
- func (v *ValueData) SetMapKey(key reflect.Value, owner any)
- func (v *ValueData) SetMapValue(val reflect.Value, owner any, key any, keyView Value, viewPath string)
- func (v *ValueData) SetName(name string)
- func (v *ValueData) SetReadOnly(ro bool)
- func (v *ValueData) SetSliceValue(val reflect.Value, owner any, idx int, viewPath string)
- func (v *ValueData) SetSoloValue(val reflect.Value)
- func (v *ValueData) SetStructValue(val reflect.Value, owner any, field *reflect.StructField, viewPath string)
- func (v *ValueData) SetTag(tag, value string)
- func (v *ValueData) SetTags(tags map[string]string)
- func (v *ValueData) String() string
- func (v *ValueData) Tag(tag string) (string, bool)
- func (v *ValueData) Val() reflect.Value
- type ValueFlags
- func (i ValueFlags) BitIndexString() string
- func (i ValueFlags) Desc() string
- func (i ValueFlags) HasFlag(f enums.BitFlag) bool
- func (i ValueFlags) Int64() int64
- func (i ValueFlags) MarshalText() ([]byte, error)
- func (i *ValueFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *ValueFlags) SetInt64(in int64)
- func (i *ValueFlags) SetString(s string) error
- func (i *ValueFlags) SetStringOr(s string) error
- func (i ValueFlags) String() string
- func (i *ValueFlags) UnmarshalText(text []byte) error
- func (i ValueFlags) Values() []enums.Enum
- type Valuer
Constants ¶
const ( SliceViewRowProperty = "sv-row" SliceViewColProperty = "sv-col" )
const TreeViewTempMovedTag = `_\&MOVED\&`
TreeViewTempMovedTag is a kind of hack to prevent moved items from being deleted, using DND
Variables ¶
var ArgViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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.", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Args", Doc: "Args are the args that we are a view onto"}}, Instance: &ArgView{}})
ArgViewType is the types.Type for ArgView
var ColorViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.ColorView", IDName: "color-view", Doc: "ColorView shows a color, using sliders or numbers to set values.", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Color", Doc: "the color that we view"}}, Instance: &ColorView{}})
ColorViewType is the types.Type for ColorView
var DateViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.DateView", IDName: "date-view", Doc: "DateView is a view for selecting a date", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Time", Doc: "the time that we are viewing"}, {Name: "ConfigTime", Doc: "ConfigTime is the time that was configured"}}, Instance: &DateView{}})
DateViewType is the types.Type for DateView
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
var FileViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.FileView", IDName: "file-view", Doc: "FileView is a viewer onto files -- core of the file chooser dialog", Methods: []types.Method{{Name: "UpdateFilesAction", Doc: "UpdateFilesAction updates the list of files and other views for the current path.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "AddPathToFavs", Doc: "AddPathToFavs adds the current path to favorites", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "DirPathUp", Doc: "DirPathUp moves up one directory in the path", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "NewFolder", Doc: "NewFolder creates a new folder with the given name in the current directory.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"name"}, Returns: []string{"error"}}}, Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "DirPath", Doc: "path to directory of files to display"}, {Name: "CurrentSelectedFile", Doc: "currently selected file"}, {Name: "Ext", Doc: "target extension(s) (comma separated if multiple, including initial .), if any"}, {Name: "FilterFunc", Doc: "optional styling function"}, {Name: "ExtMap", Doc: "map of lower-cased extensions from Ext -- used for highlighting files with one of these extensions -- maps onto original ext value"}, {Name: "Files", Doc: "files for current directory"}, {Name: "SelectedIndex", Doc: "index of currently-selected file in Files list (-1 if none)"}, {Name: "Watcher", Doc: "change notify for current dir"}, {Name: "DoneWatcher", Doc: "channel to close watcher watcher"}, {Name: "UpdateMu", Doc: "UpdateFiles mutex"}, {Name: "PrevPath", Doc: "Previous path that was processed via UpdateFiles"}}, Instance: &FileView{}})
FileViewType is the types.Type for FileView
var FuncButtonType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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 [types]. The function must be registered\nwith [types] to get documentation information, but that is not\nrequired; add a `//types:add` comment directive and run `core generate`\nif you want tooltips. If the function is a method, both the method and\nits receiver type must be added to [types] to get documentation.", Directives: []types.Directive{{Tool: "core", Directive: "no-new"}}, Embeds: []types.Field{{Name: "Button"}}, Fields: []types.Field{{Name: "Func", Doc: "Func is the [types.Func] associated with this button.\nThis function can also be a method, but it must be\nconverted to a [types.Func] first. It should typically\nbe set using [FuncButton.SetFunc]."}, {Name: "ReflectFunc", Doc: "ReflectFunc is the [reflect.Value] of the function or\nmethod associated with this button. It should typically\nbet set using [FuncButton.SetFunc]."}, {Name: "Args", 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."}, {Name: "Returns", 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."}, {Name: "Confirm", Doc: "Confirm is whether to prompt the user for confirmation\nbefore calling the function."}, {Name: "ShowReturn", 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. Non-nil error return values will\nalways be shown, even if ShowReturn is set to false."}, {Name: "ShowReturnAsDialog", 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."}, {Name: "NewWindow", Doc: "NewWindow makes the ReturnDialog a NewWindow dialog\n(if supported by platform)."}, {Name: "WarnUnadded", Doc: "WarnUnadded is whether to log warnings when a function that\nhas not been added to [types] is used. It is on by default and\nmust be set before [FuncButton.SetFunc] is called for it to\nhave any effect."}, {Name: "Context", Doc: "Context is used for opening Dialogs if non-nil."}, {Name: "AfterFunc", Doc: "AfterFunc is an optional function called after the func button\nfunction is executed"}}, Instance: &FuncButton{}})
FuncButtonType is the types.Type for FuncButton
var InspectorType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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", Methods: []types.Method{{Name: "Save", Doc: "Save saves tree to current filename, in a standard JSON-formatted file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"error"}}, {Name: "SaveAs", Doc: "SaveAs saves tree to given filename, in a standard JSON-formatted file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename"}, Returns: []string{"error"}}, {Name: "Open", Doc: "Open opens tree from given filename, in a standard JSON-formatted file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename"}, Returns: []string{"error"}}, {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: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "InspectApp", Doc: "InspectApp displays the underlying operating system app", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}}, Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "KiRoot", Doc: "root of tree being edited"}, {Name: "Changed", Doc: "has the root changed via gui actions? updated from treeview and structview for changes"}, {Name: "Filename", Doc: "current filename for saving / loading"}}, Instance: &Inspector{}})
InspectorType is the types.Type for Inspector
var MapViewInlineType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.MapViewInline", IDName: "map-view-inline", Doc: "MapViewInline represents a map as a single line widget,\nfor smaller maps and those explicitly marked inline.", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Map", Doc: "the map that we are a view onto"}, {Name: "MapValue", Doc: "MapValue is the Value for the map itself\nif this was created within the Value framework.\nOtherwise, it is nil."}, {Name: "Changed", Doc: "has the map been edited?"}, {Name: "Keys", Doc: "Value representations of the map keys"}, {Name: "Values", Doc: "Value representations of the fields"}, {Name: "ViewPath", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows"}, {Name: "ConfigSize", Doc: "size of map when gui configed"}}, Instance: &MapViewInline{}})
MapViewInlineType is the types.Type for MapViewInline
var MapViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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.", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Map", Doc: "the map that we are a view onto"}, {Name: "MapValView", Doc: "Value for the map itself, if this was created within value view framework; otherwise nil"}, {Name: "Changed", Doc: "has the map been edited?"}, {Name: "Keys", Doc: "Value representations of the map keys"}, {Name: "Values", Doc: "Value representations of the map values"}, {Name: "SortVals", Doc: "sort by values instead of keys"}, {Name: "NCols", Doc: "the number of columns in the map; do not set externally;\ngenerally only access internally"}, {Name: "ViewPath", Doc: "a record of parent View names that have led up to this view.\nDisplayed as extra contextual information in view dialog windows."}}, Instance: &MapView{}})
MapViewType is the types.Type for MapView
var NoSentenceCaseFor []string
NoSentenceCaseFor indicates to not transform field names in [StructView]s into "Sentence case" for types whose full, package-path-qualified name contains any of these strings. For example, this can be used to disable sentence casing for types with scientific abbreviations in field names, which are more readable when not sentence cased. However, this should not be needed in most circumstances.
var SliceViewBaseType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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.", Methods: []types.Method{{Name: "CopyIndexes", Doc: "CopyIndexes copies selected idxs to system.Clipboard, optionally resetting the selection", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"reset"}}, {Name: "DeleteIndexes", Doc: "DeleteIndexes deletes all selected indexes", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "CutIndexes", Doc: "CutIndexes copies selected indexes to system.Clipboard and deletes selected indexes", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "PasteIndex", Doc: "PasteIndex pastes clipboard at given idx", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"idx"}}, {Name: "Duplicate", Doc: "Duplicate copies selected items and inserts them after current selection --\nreturn idx of start of duplicates if successful, else -1", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"int"}}}, Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Slice", Doc: "the slice that we are a view onto -- must be a pointer to that slice"}, {Name: "MinRows", Doc: "MinRows specifies the minimum number of rows to display, to ensure\nat least this amount is displayed."}, {Name: "ViewPath", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows"}, {Name: "ViewMu", 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."}, {Name: "Changed", Doc: "Changed indicates whether the underlying slice\nhas been edited in any way"}, {Name: "SelectedValue", Doc: "current selection value -- initially select this value if set"}, {Name: "SelectedIndex", Doc: "index of currently selected item"}, {Name: "InitSelectedIndex", Doc: "index of row to select at start"}, {Name: "SelectedIndexes", Doc: "list of currently-selected slice indexes"}, {Name: "LastClick", Doc: "LastClick is the last row that has been clicked on.\nThis is used to prevent erroneous double click events\nfrom being sent when the user clicks on multiple different\nrows in quick succession."}, {Name: "NormalCursor", Doc: "NormalCursor is the cached cursor to display when there\nis no row being hovered."}, {Name: "CurrentCursor", Doc: "CurrentCursor is the cached cursor that should currently be\ndisplayed."}, {Name: "SliceNPVal", Doc: "non-ptr reflect.Value of the slice"}, {Name: "SliceValue", Doc: "Value for the slice itself, if this was created within value view framework -- otherwise nil"}, {Name: "Values", Doc: "Value representations of the slice values"}, {Name: "HoverRow", Doc: "currently-hovered row"}, {Name: "DraggedIndexes", Doc: "list of currently-dragged indexes"}, {Name: "VisRows", Doc: "total number of rows visible in allocated display size"}, {Name: "StartIndex", Doc: "starting slice index of visible rows"}, {Name: "SliceSize", Doc: "size of slice"}, {Name: "ConfigIter", Doc: "iteration through the configuration process, reset when a new slice type is set"}, {Name: "TmpIndex", Doc: "temp idx state for e.g., dnd"}, {Name: "ElVal", Doc: "ElVal is a Value representation of the underlying element type\nwhich is used whenever there are no slice elements available"}, {Name: "MaxWidth", Doc: "maximum width of value column in chars, if string"}}, Instance: &SliceViewBase{}})
SliceViewBaseType is the types.Type for SliceViewBase
var SliceViewGridType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.SliceViewGrid", IDName: "slice-view-grid", Doc: "SliceViewGrid handles the resizing logic for SliceView, TableView.", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "MinRows", Doc: "MinRows is set from parent SV"}, {Name: "RowHeight", Doc: "height of a single row, computed during layout"}, {Name: "VisRows", Doc: "total number of rows visible in allocated display size"}, {Name: "BgStripe", Doc: "Various computed backgrounds"}, {Name: "BgSelect", Doc: "Various computed backgrounds"}, {Name: "BgSelectStripe", Doc: "Various computed backgrounds"}, {Name: "BgHover", Doc: "Various computed backgrounds"}, {Name: "BgHoverStripe", Doc: "Various computed backgrounds"}, {Name: "BgHoverSelect", Doc: "Various computed backgrounds"}, {Name: "BgHoverSelectStripe", Doc: "Various computed backgrounds"}, {Name: "LastBackground", Doc: "LastBackground is the background for which modified\nbackgrounds were computed -- don't update if same"}}, Instance: &SliceViewGrid{}})
SliceViewGridType is the types.Type for SliceViewGrid
var SliceViewInlineType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.SliceViewInline", IDName: "slice-view-inline", Doc: "SliceViewInline represents a slice as a single line widget,\nfor smaller slices and those explicitly marked inline.", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Slice", Doc: "the slice that we are a view onto"}, {Name: "SliceValue", Doc: "SliceValue is the Value for the slice itself\nif this was created within the Value framework.\nOtherwise, it is nil."}, {Name: "IsArray", Doc: "whether the slice is actually an array -- no modifications"}, {Name: "IsFixedLen", Doc: "whether the slice has a fixed-len flag on it"}, {Name: "Changed", Doc: "has the slice been edited?"}, {Name: "Values", Doc: "Value representations of the fields"}, {Name: "ViewPath", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows"}, {Name: "ConfigSize", Doc: "size of map when gui was configured"}}, Instance: &SliceViewInline{}})
SliceViewInlineType is the types.Type for SliceViewInline
var SliceViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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.", Embeds: []types.Field{{Name: "SliceViewBase"}}, Fields: []types.Field{{Name: "StyleFunc", Doc: "optional styling function"}}, Instance: &SliceView{}})
SliceViewType is the types.Type for SliceView
var StructViewInlineType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.StructViewInline", IDName: "struct-view-inline", Doc: "StructViewInline represents a struct as a single line widget,\nfor smaller structs and those explicitly marked inline.", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Struct", Doc: "the struct that we are a view onto"}, {Name: "StructValue", Doc: "Value for the struct itself, if this was created within value view framework -- otherwise nil"}, {Name: "AddButton", Doc: "if true, add an edit button at the end"}, {Name: "FieldViews", Doc: "Value representations of the fields"}, {Name: "ViewPath", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows"}, {Name: "IsShouldShower", Doc: "IsShouldShower is whether the struct implements [core.ShouldShower], which results\nin additional updating being done at certain points."}}, Instance: &StructViewInline{}})
StructViewInlineType is the types.Type for StructViewInline
var StructViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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.", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Struct", Doc: "the struct that we are a view onto"}, {Name: "StructValue", Doc: "StructValue is the Value for the struct itself\nif this was created within the Value framework.\nOtherwise, it is nil."}, {Name: "FieldViews", Doc: "Value representations of the fields"}, {Name: "ViewPath", Doc: "a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows"}, {Name: "IsShouldShower", Doc: "IsShouldShower is whether the struct implements [core.ShouldShower], which results\nin additional updating being done at certain points."}, {Name: "TypeFieldTags", Doc: "extra tags by field name -- from type properties"}}, Instance: &StructView{}})
StructViewType is the types.Type for StructView
var TableViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.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.", Embeds: []types.Field{{Name: "SliceViewBase"}}, Fields: []types.Field{{Name: "StyleFunc", Doc: "optional styling function"}, {Name: "SelectedField", Doc: "current selection field -- initially select value in this field"}, {Name: "SortIndex", Doc: "current sort index"}, {Name: "SortDesc", Doc: "whether current sort order is descending"}, {Name: "StruType", Doc: "struct type for each row"}, {Name: "VisFields", Doc: "the visible fields"}, {Name: "NVisFields", Doc: "number of visible fields"}, {Name: "HeaderWidths", Doc: "HeaderWidths has number of characters in each header, per visfields"}, {Name: "ColMaxWidths", Doc: "ColMaxWidths records maximum width in chars of string type fields"}}, Instance: &TableView{}})
TableViewType is the types.Type for TableView
var TimeViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.TimeView", IDName: "time-view", Doc: "TimeView is a view for selecting a time", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Time", Doc: "the time that we are viewing"}, {Name: "Hour", Doc: "the raw input hour"}, {Name: "PM", Doc: "whether we are in PM mode (so we have to add 12h to everything)"}}, Instance: &TimeView{}})
TimeViewType is the types.Type for TimeView
var TreeTableViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.TreeTableView", IDName: "tree-table-view", Doc: "TreeTableView combines a [TreeView] and [TableView].", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Tree", Doc: "Tree is the tree view component of the tree table view."}, {Name: "Table", Doc: "Table is the table view component of the tree table view."}}, Instance: &TreeTableView{}})
TreeTableViewType is the types.Type for TreeTableView
var TreeViewPageSteps = 10
TreeViewPageSteps is the number of steps to take in PageUp / Down events
var TreeViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/views.TreeView", IDName: "tree-view", Doc: "TreeView provides a graphical representation of a tree structure,\nproviding full navigation and manipulation abilities.\n\nIt does not handle layout by itself, so if you want it to scroll\nseparately from the rest of the surrounding context, use [NewTreeViewFrame].\n\nIf the SyncNode field is non-nil, typically via\nSyncRootNode method, then the TreeView mirrors another\ntree 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.", Methods: []types.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: []types.Directive{{Tool: "types", Directive: "add"}}}, {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: []types.Directive{{Tool: "types", Directive: "add"}}}, {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: []types.Directive{{Tool: "types", Directive: "add"}}}, {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: []types.Directive{{Tool: "types", Directive: "add"}}}, {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: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "EditNode", Doc: "EditNode pulls up a StructViewDialog window on the node.\nIf SyncNode is set, operates on Sync Tree.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "InspectNode", Doc: "InspectNode pulls up a new Inspector window on the node.\nIf SyncNode is set, operates on Sync Tree.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "OpenAll", Doc: "OpenAll opens the given node and all of its sub-nodes", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "CloseAll", Doc: "CloseAll closes the given node and all of its sub-nodes.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Copy", Doc: "Copy copies to system.Clipboard, optionally resetting the selection.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"reset"}}, {Name: "Cut", Doc: "Cut copies to system.Clipboard and deletes selected items.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Paste", Doc: "Paste pastes clipboard at given node.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}}, Embeds: []types.Field{{Name: "WidgetBase"}}, Fields: []types.Field{{Name: "SyncNode", Doc: "If non-nil, the [tree.Node] that this widget is viewing in the tree (the source)"}, {Name: "Text", Doc: "The text to display for the tree view item label, which automatically\ndefaults to the [tree.Node.Name] of the tree view node. It has no effect\nif [TreeView.SyncNode] is non-nil."}, {Name: "Icon", Doc: "optional icon, displayed to the the left of the text label"}, {Name: "IconOpen", Doc: "icon to use for an open (expanded) branch; defaults to [icons.KeyboardArrowDown]"}, {Name: "IconClosed", Doc: "icon to use for a closed (collapsed) branch; defaults to [icons.KeyboardArrowRight]"}, {Name: "IconLeaf", Doc: "icon to use for a terminal node branch that has no children; defaults to [icons.Blank]"}, {Name: "Indent", Doc: "amount to indent children relative to this node"}, {Name: "OpenDepth", Doc: "depth for nodes be initialized as open (default 4).\nNodes beyond this depth will be initialized as closed."}, {Name: "ViewIndex", 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"}, {Name: "WidgetSize", Doc: "size of just this node widget.\nour alloc includes all of our children, but we only draw us."}, {Name: "RootView", Doc: "The cached root of the view. It is automatically set and does not need to be\nset by the end user."}, {Name: "SelectedNodes", Doc: "SelectedNodes holds the currently-selected nodes, on the\nRootView node only."}, {Name: "actStateLayer", 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."}}, Instance: &TreeView{}})
TreeViewType is the types.Type for TreeView
var ValueMap = map[string]func() Value{}
ValueMap is a map from fully package path qualified type names to the corresponding Value objects that should be used to represent those types. You should add to this using AddValue.
Functions ¶
func AddValue ¶
AddValue indicates that the given value should be represented by the given Value object. For example:
AddValue(icons.Icon(""), func() Value { return &IconValue{} })
func CallFunc ¶
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 Config ¶
Config configures the given core.Widget to represent the given Value.
func ConfigBase ¶
ConfigBase does the base configuration for the given core.Widget to represent the given Value.
func ConfigDialogWidget ¶
ConfigDialogWidget configures the widget for the given value to open the dialog for the given value when clicked and have the appropriate tooltip for that. If allowReadOnly is false, the dialog will not be opened if the value is read only.
func ConfigImageToolbar ¶
ConfigImageToolbar configures the given toolbar for the given image.
func ConfigSVGToolbar ¶
ConfigSVGToolbar configures the given toolbar for the given SVG.
func FileViewDialog ¶
FileViewDialog opens a dialog for selecting a file.
func FileViewDirOnlyFilter ¶
FileViewDirOnlyFilter is a FileViewFilterFunc that only shows directories (folders).
func FileViewExtOnlyFilter ¶
FileViewExtOnlyFilter is a FileViewFilterFunc that only shows files that match the target extensions, and directories.
func InspectorView ¶
InspectorView configures the given body to have an interactive inspector of the given tree.
func InspectorWindow ¶
InspectorWindow opens an interactive editor of the given tree in a new window.
func JoinViewPath ¶
JoinViewPath returns a view path composed of two elements, with a • path separator, handling the cases where either or both can be empty.
func NoSentenceCaseForType ¶
NoSentenceCaseForType returns whether the given fully package-path-qualified name contains anything in the NoSentenceCaseFor list.
func OpenDialog ¶
OpenDialog opens any applicable dialog for the given value in the context of the given widget. It first tries OpenDialoger, then ConfigDialoger with OpenDialogBase. If both of those fail, it returns false. It calls the given beforeFunc before opening any dialog.
func OpenDialogBase ¶
func OpenDialogBase(v Value, cd ConfigDialoger, ctx core.Widget, fun func())
OpenDialogBase is a helper for OpenDialog for cases that do not implement OpenDialoger but do implement ConfigDialoger to configure the dialog contents.
func SettingsView ¶
SettingsView adds to the given body a view of user settings
func SettingsViewToolbarBase ¶
SettingsViewToolbarBase is the base toolbar configuration function used in SettingsView.
func SettingsWindow ¶
func SettingsWindow()
SettingsWindow makes and runs a new window for viewing user settings.
func SliceIndexByValue ¶
SliceIndexByValue searches for first index that contains given value in slice -- returns false if not found
func StructFieldIsDef ¶
StructFieldIsDef processses "default" 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 ¶
StructNonDefFieldsStr processses "default" 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 StructSliceIndexByValue ¶
StructSliceIndexByValue searches for first index that contains given value in field of given name.
func StructViewDialog ¶
StructViewDialog opens a dialog (optionally in a new, separate window) for viewing / editing the given struct object, in the context of given ctx widget
func StructViewFieldTags ¶
func StructViewFieldTags(vv Value, lbl *core.Label, w core.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 "default" default tags -- if so, needs updating
Types ¶
type ArgView ¶
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 ¶
NewArgView adds a new ArgView with the given name to the given parent: 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 (*ArgView) ArgsGrid ¶
ArgsGrid returns the grid layout widget, which contains all the fields and values
func (*ArgView) ConfigArgsGrid ¶
func (av *ArgView) ConfigArgsGrid()
ConfigArgsGrid configures the ArgsGrid for the current struct
func (*ArgView) NodeType ¶
NodeType returns the *types.Type of ArgView
func (*ArgView) SetArgs ¶
SetArgs sets the [ArgView.Args]: Args are the args that we are a view onto
func (*ArgView) SetTooltip ¶
SetTooltip sets the [ArgView.Tooltip]
func (*ArgView) TitleWidget ¶
TitleWidget returns the title label widget
type BitFlagValue ¶
BitFlagValue represents an enums.BitFlag value with chip switches.
func (*BitFlagValue) Config ¶
func (v *BitFlagValue) Config()
func (*BitFlagValue) EnumValue ¶
func (v *BitFlagValue) EnumValue() enums.BitFlagSetter
EnumValue returns the underlying enums.BitFlagSetter value.
func (*BitFlagValue) Update ¶
func (v *BitFlagValue) Update()
type ByteSliceValue ¶
ByteSliceValue represents a slice of bytes with a text field.
func (*ByteSliceValue) Config ¶
func (v *ByteSliceValue) Config()
func (*ByteSliceValue) Update ¶
func (v *ByteSliceValue) Update()
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 ¶
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) Config ¶
func (v *ColorMapValue) Config()
func (*ColorMapValue) ConfigDialog ¶
func (v *ColorMapValue) ConfigDialog(d *core.Body) (bool, func())
func (*ColorMapValue) Update ¶
func (v *ColorMapValue) Update()
type ColorValue ¶
ColorValue represents a color value with a button.
func (*ColorValue) ColorValue ¶
func (v *ColorValue) ColorValue() color.RGBA
ColorValue returns a standardized color value from whatever value is represented internally, or nil.
func (*ColorValue) Config ¶
func (v *ColorValue) Config()
func (*ColorValue) ConfigDialog ¶
func (v *ColorValue) ConfigDialog(d *core.Body) (bool, func())
func (*ColorValue) Update ¶
func (v *ColorValue) Update()
type ColorView ¶
ColorView shows a color, using sliders or numbers to set values.
func NewColorView ¶
NewColorView adds a new ColorView with the given name to the given parent: ColorView shows a color, using sliders or numbers to set values.
func (*ColorView) Config ¶
func (cv *ColorView) Config()
Config configures a standard setup of entire view
func (*ColorView) NodeType ¶
NodeType returns the *types.Type of ColorView
func (*ColorView) SetTooltip ¶
SetTooltip sets the [ColorView.Tooltip]
type ConfigDialoger ¶
type ConfigDialoger interface { // ConfigDialog adds content to the given dialog body for this value. // The bool return is false if the value does not use this method // (e.g., for simple menu choosers). // The returned function is an optional closure to be called // in the Ok case, for cases where extra logic is required. ConfigDialog(d *core.Body) (bool, func()) }
ConfigDialoger is an optional interface that [Value]s may implement to indicate that they have a dialog associated with them that is configured with the ConfigDialog method. The dialog body itself is constructed and run using OpenDialog.
type DateView ¶
type DateView struct { core.Frame // the time that we are viewing Time time.Time `set:"-"` // ConfigTime is the time that was configured ConfigTime time.Time `set:"-" view:"-"` }
DateView is a view for selecting a date
func NewDateView ¶
NewDateView adds a new DateView with the given name to the given parent: DateView is a view for selecting a date
func (*DateView) ConfigDateGrid ¶
func (dv *DateView) ConfigDateGrid()
func (*DateView) NodeType ¶
NodeType returns the *types.Type of DateView
func (*DateView) SetTooltip ¶
SetTooltip sets the [DateView.Tooltip]
type DurationValue ¶
DurationValue represents a time.Duration value with a spinner and unit chooser.
func (*DurationValue) Config ¶
func (v *DurationValue) Config()
func (*DurationValue) Update ¶
func (v *DurationValue) Update()
type EnumValue ¶
EnumValue represents an enums.Enum value with a chooser.
type FieldValuer ¶
FieldValuer is an interface that struct types can implement to specify the Value that should be used to represent their fields in the GUI. If the return value is nil, then the default Value for the value will be used.
type FileValue ¶
FileValue represents a core.Filename value with a button.
type FileView ¶
type FileView struct { core.Frame // path to directory of files to display DirPath string `set:"-"` // currently selected file CurrentSelectedFile string `set:"-"` // 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 []*fileinfo.FileInfo // index of currently-selected file in Files list (-1 if none) SelectedIndex int `set:"-" edit:"-"` // change notify for current dir Watcher *fsnotify.Watcher `set:"-" view:"-"` // channel to close watcher watcher DoneWatcher chan bool `set:"-" view:"-"` // UpdateFiles mutex UpdateMu 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 ¶
NewFileView adds a new FileView with the given name to the given parent: FileView is a viewer onto files -- core of the file chooser dialog
func (*FileView) AddPathToFavs ¶
func (fv *FileView) AddPathToFavs()
AddPathToFavs adds the current path to favorites
func (*FileView) ApplyStyle ¶
func (fv *FileView) ApplyStyle()
func (*FileView) ConfigFileView ¶
func (fv *FileView) ConfigFileView()
func (*FileView) ConfigFilesRow ¶
func (fv *FileView) ConfigFilesRow()
func (*FileView) ConfigSelRow ¶
func (fv *FileView) ConfigSelRow()
func (*FileView) ConfigToolbar ¶
ConfigToolbar configures the given toolbar to have file view actions and completions.
func (*FileView) ConfigWatcher ¶
func (*FileView) DirPathUp ¶
func (fv *FileView) DirPathUp()
DirPathUp moves up one directory in the path
func (*FileView) Disconnect ¶
func (fv *FileView) Disconnect()
func (*FileView) EditRecentPaths ¶
func (fv *FileView) EditRecentPaths()
EditRecentPaths displays a dialog allowing the user to edit the recent paths list.
func (*FileView) FileComplete ¶
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 ¶
FileSelectAction updates selection with given selected file and emits selected signal on WidgetSig with full name of selected item
func (*FileView) HandleEvents ¶
func (fv *FileView) HandleEvents()
func (*FileView) NewFolder ¶
NewFolder creates a new folder with the given name in the current directory.
func (*FileView) NodeType ¶
NodeType returns the *types.Type of FileView
func (*FileView) PathComplete ¶
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) SaveSortSettings ¶
func (fv *FileView) SaveSortSettings()
SaveSortSettings saves current sorting preferences
func (*FileView) SelectField ¶
SelectField returns the TextField of the select file
func (*FileView) SelectFile ¶
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 ¶
SelectedFile returns the full path to selected file
func (*FileView) SelectedFileInfo ¶
SelectedFileInfo returns the currently-selected fileinfo, returns false if none
func (*FileView) SetExtAction ¶
SetExtAction sets the current extension to highlight, and redisplays files
func (*FileView) SetExtMap ¶
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 ¶
SetFilename sets the initial filename (splitting out path and filename) and initializes the view
func (*FileView) SetFilterFunc ¶
func (t *FileView) SetFilterFunc(v FileViewFilterFunc) *FileView
SetFilterFunc sets the [FileView.FilterFunc]: optional styling function
func (*FileView) SetPathFile ¶
SetPathFile sets the path, initial select file (or "") and initializes the view
func (*FileView) SetSelFileAction ¶
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) SetTooltip ¶
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 the list of files and other views for the current path.
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 ¶
FileViewFilterFunc is a filtering function for files -- returns true if the file should be visible in the view, and false if not
type FontValue ¶
FontValue represents a core.FontName value with a button.
type FuncButton ¶
type FuncButton struct { core.Button // Func is the [types.Func] associated with this button. // This function can also be a method, but it must be // converted to a [types.Func] first. It should typically // be set using [FuncButton.SetFunc]. Func *types.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. Non-nil error return values will // always be shown, even if ShowReturn is set to false. ShowReturn bool // 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 [types] is used. It is on by default and // must be set before [FuncButton.SetFunc] is called for it to // have any effect. WarnUnadded bool `default:"true"` // Context is used for opening Dialogs if non-nil. Context core.Widget // AfterFunc is an optional function called after the func button // function is executed AfterFunc func() }
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 types. The function must be registered with types to get documentation information, but that is not required; add a `//types:add` comment directive and run `core generate` if you want tooltips. If the function is a method, both the method and its receiver type must be added to types to get documentation.
func NewFuncButton ¶
func NewFuncButton(parent tree.Node, fun any) *FuncButton
NewFuncButton adds a new FuncButton with the given function to the given parent.
func NewSoloFuncButton ¶
func NewSoloFuncButton(ctx core.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) GoodContext ¶
func (fb *FuncButton) GoodContext() core.Widget
func (*FuncButton) NodeType ¶
func (t *FuncButton) NodeType() *types.Type
NodeType returns the *types.Type of FuncButton
func (*FuncButton) OnInit ¶
func (fb *FuncButton) OnInit()
func (*FuncButton) SetAfterFunc ¶
func (t *FuncButton) SetAfterFunc(v func()) *FuncButton
SetAfterFunc sets the [FuncButton.AfterFunc]: AfterFunc is an optional function called after the func button function is executed
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) 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 core.Widget) *FuncButton
SetContext sets the [FuncButton.Context]: Context is used for opening Dialogs if non-nil.
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 types. SetFunc is automatically called by NewFuncButton.
func (*FuncButton) SetFuncImpl ¶
func (fb *FuncButton) SetFuncImpl(gfun *types.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 keymap.Functions) *FuncButton
SetKey sets the shortcut of the function button from the given keymap.Functions
func (*FuncButton) SetMenu ¶
func (t *FuncButton) SetMenu(v func(m *core.Scene)) *FuncButton
SetMenu sets the [FuncButton.Menu]
func (*FuncButton) SetMethodImpl ¶
func (fb *FuncButton) SetMethodImpl(gmet *types.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. Non-nil error return values will always be shown, even if ShowReturn is set to false.
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 core.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 types 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[*FuncButton] }
FuncValue represents a function value with a FuncButton.
type IconValue ¶
IconValue represents an icons.Icon value with a button.
type Inspector ¶
type Inspector struct { core.Frame // root of tree being edited KiRoot tree.Node // has the root changed via gui actions? updated from treeview and structview for changes Changed bool `set:"-"` // current filename for saving / loading Filename core.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 ¶
NewInspector adds a new Inspector with the given name to the given parent: 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 (*Inspector) ConfigSplits ¶
func (is *Inspector) ConfigSplits()
ConfigSplits configures the Splits.
func (*Inspector) ConfigToolbar ¶
func (*Inspector) InspectApp ¶
func (is *Inspector) InspectApp()
InspectApp displays the underlying operating system app
func (*Inspector) NodeType ¶
NodeType returns the *types.Type of Inspector
func (*Inspector) SelectionMonitor ¶
func (is *Inspector) SelectionMonitor()
SelectionMonitor monitors for the selected widget
func (*Inspector) SetFilename ¶
SetFilename sets the [Inspector.Filename]: current filename for saving / loading
func (*Inspector) SetTooltip ¶
SetTooltip sets the [Inspector.Tooltip]
func (*Inspector) StructView ¶
func (is *Inspector) StructView() *StructView
StructView returns the main StructView
func (*Inspector) TitleWidget ¶
TitleWidget returns the title label widget
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.
type KeyChordValue ¶
KeyChordValue represents a key.Chord value with a button.
func (*KeyChordValue) Config ¶
func (v *KeyChordValue) Config()
func (*KeyChordValue) Update ¶
func (v *KeyChordValue) Update()
type KeyMapValue ¶
KeyMapValue represents a keymap.MapName value with a button.
func (*KeyMapValue) Config ¶
func (v *KeyMapValue) Config()
func (*KeyMapValue) ConfigDialog ¶
func (v *KeyMapValue) ConfigDialog(d *core.Body) (bool, func())
func (*KeyMapValue) Update ¶
func (v *KeyMapValue) Update()
type KiValue ¶
KiValue represents a tree.Node value with a button.
type MapInlineValue ¶
type MapInlineValue struct { ValueBase[*MapViewInline] }
MapInlineValue represents a map value with a MapViewInline.
func (*MapInlineValue) Config ¶
func (v *MapInlineValue) Config()
func (*MapInlineValue) Update ¶
func (v *MapInlineValue) Update()
type MapView ¶
type MapView struct { core.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:"-" set:"-"` // Value representations of the map values Values []Value `json:"-" xml:"-" set:"-"` // 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 `set:"-"` // 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 ¶
NewMapView adds a new MapView with the given name to the given parent: 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 (*MapView) ConfigMapGrid ¶
func (mv *MapView) ConfigMapGrid()
ConfigMapGrid configures the MapGrid for the current map
func (*MapView) ConfigToolbar ¶
ConfigToolbar configures a core.Toolbar for this view
func (*MapView) IsConfiged ¶
IsConfiged returns true if the widget is fully configured
func (*MapView) MapGrid ¶
MapGrid returns the MapGrid grid layout widget, which contains all the fields and values
func (*MapView) NodeType ¶
NodeType returns the *types.Type of MapView
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) SetMap ¶
SetMap sets the source map that we are viewing. Rebuilds the children to represent this map
func (*MapView) SetMapValView ¶
SetMapValView sets the [MapView.MapValView]: Value for the map itself, if this was created within value view framework; otherwise nil
func (*MapView) SetSortVals ¶
SetSortVals sets the [MapView.SortVals]: sort by values instead of keys
func (*MapView) SetTooltip ¶
SetTooltip sets the [MapView.Tooltip]
func (*MapView) SetViewPath ¶
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 { core.Layout // the map that we are a view onto Map any `set:"-"` // MapValue is the Value for the map itself // if this was created within the Value framework. // Otherwise, it is nil. MapValue Value `set:"-"` // has the map been edited? Changed bool `set:"-"` // Value representations of the map keys Keys []Value `json:"-" xml:"-" set:"-"` // Value representations of the fields Values []Value `json:"-" xml:"-" set:"-"` // a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows ViewPath string // size of map when gui configed ConfigSize int `set:"-"` }
MapViewInline represents a map as a single line widget, for smaller maps and those explicitly marked inline.
func NewMapViewInline ¶
func NewMapViewInline(parent tree.Node, name ...string) *MapViewInline
NewMapViewInline adds a new MapViewInline with the given name to the given parent: MapViewInline represents a map as a single line widget, for smaller maps and those explicitly marked inline.
func (*MapViewInline) Config ¶
func (mv *MapViewInline) Config()
func (*MapViewInline) ContextMenu ¶
func (mv *MapViewInline) ContextMenu(m *core.Scene, keyv reflect.Value)
func (*MapViewInline) MapDelete ¶
func (mv *MapViewInline) MapDelete(key reflect.Value)
MapDelete deletes a key-value from the map
func (*MapViewInline) MapSizeChanged ¶
func (mv *MapViewInline) MapSizeChanged() bool
func (*MapViewInline) New ¶
func (t *MapViewInline) New() tree.Node
New returns a new *MapViewInline value
func (*MapViewInline) NodeType ¶
func (t *MapViewInline) NodeType() *types.Type
NodeType returns the *types.Type of MapViewInline
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) 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) SetStyles ¶
func (mv *MapViewInline) SetStyles()
func (*MapViewInline) SetTooltip ¶
func (t *MapViewInline) SetTooltip(v string) *MapViewInline
SetTooltip sets the [MapViewInline.Tooltip]
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) SizeUp ¶
func (mv *MapViewInline) SizeUp()
func (*MapViewInline) UpdateValues ¶
func (mv *MapViewInline) UpdateValues()
type NumberValue ¶
NumberValue represents an integer or float value with a spinner.
func (*NumberValue) Config ¶
func (v *NumberValue) Config()
func (*NumberValue) Update ¶
func (v *NumberValue) Update()
type OpenDialoger ¶
type OpenDialoger interface { // OpenDialog opens the dialog for this Value. // 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 core.Widget, fun func()) }
OpenDialoger is an optional interface that [Value]s may implement to indicate that they have a dialog associated with them that is created, configured, and run with the OpenDialog method. This method typically calls a separate ConfigDialog method. If the Value does not implement OpenDialoger but does implement ConfigDialoger, then OpenDialogBase will be used to create and run the dialog, and [ConfigDialoger.ConfigDialog] will be used to configure it.
type RuneSliceValue ¶
RuneSliceValue represents a slice of runes with a text field.
func (*RuneSliceValue) Config ¶
func (v *RuneSliceValue) Config()
func (*RuneSliceValue) Update ¶
func (v *RuneSliceValue) Update()
type SliceInlineValue ¶
type SliceInlineValue struct { ValueBase[*SliceViewInline] }
SliceInlineValue represents a slice or array value with a SliceViewInline.
func (*SliceInlineValue) Config ¶
func (v *SliceInlineValue) Config()
func (*SliceInlineValue) Update ¶
func (v *SliceInlineValue) Update()
type SliceValue ¶
SliceValue represents a slice or array value with a button.
func (*SliceValue) Config ¶
func (v *SliceValue) Config()
func (*SliceValue) ConfigDialog ¶
func (v *SliceValue) ConfigDialog(d *core.Body) (bool, func())
func (*SliceValue) Update ¶
func (v *SliceValue) Update()
type SliceView ¶
type SliceView struct { SliceViewBase // optional styling function StyleFunc SliceViewStyleFunc `copier:"-" 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 ¶
NewSliceView adds a new SliceView with the given name to the given parent: 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 (*SliceView) HasStyleFunc ¶
func (*SliceView) NodeType ¶
NodeType returns the *types.Type of SliceView
func (*SliceView) SetInitSelectedIndex ¶
SetInitSelectedIndex sets the [SliceView.InitSelectedIndex]
func (*SliceView) SetMinRows ¶
SetMinRows sets the [SliceView.MinRows]
func (*SliceView) SetSelectedIndex ¶
SetSelectedIndex sets the [SliceView.SelectedIndex]
func (*SliceView) SetSelectedValue ¶
SetSelectedValue sets the [SliceView.SelectedValue]
func (*SliceView) SetStyleFunc ¶
func (t *SliceView) SetStyleFunc(v SliceViewStyleFunc) *SliceView
SetStyleFunc sets the [SliceView.StyleFunc]: optional styling function
func (*SliceView) SetTooltip ¶
SetTooltip sets the [SliceView.Tooltip]
func (*SliceView) SetViewPath ¶
SetViewPath sets the [SliceView.ViewPath]
type SliceViewBase ¶
type SliceViewBase struct { core.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 `default:"4"` // a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows ViewPath string // 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 `copier:"-" view:"-" json:"-" xml:"-" set:"-"` // Changed indicates whether the underlying slice // has been edited in any way Changed bool `set:"-"` // current selection value -- initially select this value if set SelectedValue any `copier:"-" view:"-" json:"-" xml:"-"` // index of currently selected item SelectedIndex int `copier:"-" json:"-" xml:"-"` // index of row to select at start InitSelectedIndex int `copier:"-" json:"-" xml:"-"` // list of currently-selected slice indexes SelectedIndexes map[int]struct{} `set:"-" copier:"-"` // LastClick is the last row that has been clicked on. // This is used to prevent erroneous double click events // from being sent when the user clicks on multiple different // rows in quick succession. LastClick int `set:"-" copier:"-" json:"-" xml:"-"` // NormalCursor is the cached cursor to display when there // is no row being hovered. NormalCursor cursors.Cursor `copier:"-" xml:"-" json:"-" set:"-"` // CurrentCursor is the cached cursor that should currently be // displayed. CurrentCursor cursors.Cursor `copier:"-" xml:"-" json:"-" set:"-"` // non-ptr reflect.Value of the slice SliceNPVal reflect.Value `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // Value for the slice itself, if this was created within value view framework -- otherwise nil SliceValue Value `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // Value representations of the slice values Values []Value `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // currently-hovered row HoverRow int `set:"-" view:"-" copier:"-" json:"-" xml:"-"` // list of currently-dragged indexes DraggedIndexes []int `set:"-" view:"-" copier:"-" json:"-" xml:"-"` // total number of rows visible in allocated display size VisRows int `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // starting slice index of visible rows StartIndex int `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // size of slice SliceSize int `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // iteration through the configuration process, reset when a new slice type is set ConfigIter int `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // temp idx state for e.g., dnd TmpIndex int `set:"-" copier:"-" 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 `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // maximum width of value column in chars, if string MaxWidth int `set:"-" copier:"-" 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(parent tree.Node, name ...string) *SliceViewBase
NewSliceViewBase adds a new SliceViewBase with the given name to the given parent: 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 (*SliceViewBase) AsSliceViewBase ¶
func (sv *SliceViewBase) AsSliceViewBase() *SliceViewBase
func (*SliceViewBase) BindSelect ¶
func (sv *SliceViewBase) BindSelect(val *int) *SliceViewBase
BindSelect 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) ClickSelectEvent ¶
func (sv *SliceViewBase) ClickSelectEvent(e events.Event) bool
ClickSelectEvent is a helper for processing selection events based on a mouse click, which could be a double or triple in addition to a regular click. Returns false if no further processing should occur, because the user clicked outside the range of active rows.
func (*SliceViewBase) Config ¶
func (sv *SliceViewBase) Config()
Config configures a standard setup of the overall Frame
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) 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 *core.Toolbar)
ConfigToolbar configures a core.Toolbar for this view
func (*SliceViewBase) ContextMenu ¶
func (sv *SliceViewBase) ContextMenu(m *core.Scene)
func (*SliceViewBase) CopyIndexes ¶
func (sv *SliceViewBase) CopyIndexes(reset bool)
CopyIndexes copies selected idxs to system.Clipboard, optionally resetting the selection
func (*SliceViewBase) CopySelectToMime ¶
func (sv *SliceViewBase) CopySelectToMime() mimedata.Mimes
CopySelectToMime copies selected rows to mime data
func (*SliceViewBase) CutIndexes ¶
func (sv *SliceViewBase) CutIndexes()
CutIndexes copies selected indexes to system.Clipboard and deletes selected indexes
func (*SliceViewBase) DeleteIndexes ¶
func (sv *SliceViewBase) DeleteIndexes()
DeleteIndexes 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) HandleEvents ¶
func (sv *SliceViewBase) HandleEvents()
func (*SliceViewBase) IndexFromPos ¶
func (sv *SliceViewBase) IndexFromPos(posY int) (int, bool)
IndexFromPos returns the idx that contains given vertical position, false if not found
func (*SliceViewBase) IndexGrabFocus ¶
func (sv *SliceViewBase) IndexGrabFocus(idx int) *core.WidgetBase
IndexGrabFocus grabs the focus for the first focusable widget in given idx. returns that element or nil if not successful.
func (*SliceViewBase) IndexIsSelected ¶
func (sv *SliceViewBase) IndexIsSelected(idx int) bool
IndexIsSelected returns the selected status of given slice index
func (*SliceViewBase) IndexPos ¶
func (sv *SliceViewBase) IndexPos(idx int) image.Point
IndexPos returns center of window position of index label for idx (ContextMenuPos)
func (*SliceViewBase) IsIndexVisible ¶
func (sv *SliceViewBase) IsIndexVisible(idx int) bool
IsIndexVisible 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) MakePasteMenu ¶
func (sv *SliceViewBase) MakePasteMenu(m *core.Scene, md mimedata.Mimes, idx int, mod events.DropMods, fun func())
MakePasteMenu makes the menu of options for paste events
func (*SliceViewBase) MimeDataIndex ¶
func (sv *SliceViewBase) MimeDataIndex(md *mimedata.Mimes, idx int)
MimeDataIndex 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., fileinfo.DataJson
func (*SliceViewBase) MousePosInGrid ¶
func (sv *SliceViewBase) MousePosInGrid(e events.Event) bool
MousePosInGrid returns true if the event mouse position is located within the slicegrid.
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() tree.Node
New returns a new *SliceViewBase value
func (*SliceViewBase) NodeType ¶
func (t *SliceViewBase) NodeType() *types.Type
NodeType returns the *types.Type of SliceViewBase
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) PasteAtIndex ¶
func (sv *SliceViewBase) PasteAtIndex(md mimedata.Mimes, idx int)
PasteAtIndex inserts object(s) from mime data at (before) given slice index
func (*SliceViewBase) PasteIndex ¶
func (sv *SliceViewBase) PasteIndex(idx int)
PasteIndex 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) ResetSelectedIndexes ¶
func (sv *SliceViewBase) ResetSelectedIndexes()
func (*SliceViewBase) RowFirstWidget ¶
func (sv *SliceViewBase) RowFirstWidget(row int) (*core.WidgetBase, bool)
RowFirstWidget returns the first widget for given row (could be index or not) -- false if out of range
func (*SliceViewBase) RowFromEventPos ¶
func (sv *SliceViewBase) RowFromEventPos(e events.Event) (row, idx int, isValid bool)
RowFromEventPos returns the widget row, slice index, and whether the index is in slice range, for given event position.
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) *core.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) RowWidgetsFunc ¶
func (sv *SliceViewBase) RowWidgetsFunc(row int, fun func(w core.Widget))
RowWidgetsFunc calls function on each widget in given row (row, not index), with an UpdateStart / EndRender wrapper
func (*SliceViewBase) SaveDraggedIndexes ¶
func (sv *SliceViewBase) SaveDraggedIndexes(idx int)
SaveDraggedIndexes saves selectedindexes into dragged indexes taking into account insertion at idx
func (*SliceViewBase) ScrollToIndex ¶
func (sv *SliceViewBase) ScrollToIndex(idx int) bool
ScrollToIndex ensures that given slice idx is visible by scrolling display as needed.
func (*SliceViewBase) ScrollToIndexNoUpdate ¶
func (sv *SliceViewBase) ScrollToIndexNoUpdate(idx int) bool
ScrollToIndexNoUpdate ensures that given slice idx is visible by scrolling display as needed. This version does not update the slicegrid. Just computes the StartIndex and updates the scrollbar
func (*SliceViewBase) SelectAllIndexes ¶
func (sv *SliceViewBase) SelectAllIndexes()
SelectAllIndexes selects all idxs
func (*SliceViewBase) SelectIndex ¶
func (sv *SliceViewBase) SelectIndex(idx int)
SelectIndex selects given idx (if not already selected) -- updates select status of index label
func (*SliceViewBase) SelectIndexAction ¶
func (sv *SliceViewBase) SelectIndexAction(idx int, mode events.SelectModes)
SelectIndexAction 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) SelectIndexWidgets ¶
func (sv *SliceViewBase) SelectIndexWidgets(idx int, sel bool) bool
SelectIndexWidgets sets the selection state of given slice index returns false if index is not visible
func (*SliceViewBase) SelectRowIfNone ¶
func (sv *SliceViewBase) SelectRowIfNone(e events.Event) bool
SelectRowIfNone selects the row the mouse is on if there are no currently selected items. Returns false if no valid mouse row.
func (*SliceViewBase) SelectRowWidgets ¶
func (sv *SliceViewBase) SelectRowWidgets(row int, sel bool)
SelectRowWidgets sets the selection state of given row of widgets
func (*SliceViewBase) SelectValue ¶
func (sv *SliceViewBase) SelectValue(val string) bool
SelectValue sets SelVal and attempts to find corresponding row, setting SelectedIndex and selecting row if found -- returns true if found, false otherwise.
func (*SliceViewBase) SelectedIndexesList ¶
func (sv *SliceViewBase) SelectedIndexesList(descendingSort bool) []int
SelectedIndexesList 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) SetInitSelectedIndex ¶
func (t *SliceViewBase) SetInitSelectedIndex(v int) *SliceViewBase
SetInitSelectedIndex sets the [SliceViewBase.InitSelectedIndex]: 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) SetRowWidgetsState ¶
func (sv *SliceViewBase) SetRowWidgetsState(row int, ability abilities.Abilities, on bool, state states.States)
SetRowWidgetsState sets given state conditional on given ability for widget
func (*SliceViewBase) SetRowWidgetsStateEvent ¶
func (sv *SliceViewBase) SetRowWidgetsStateEvent(e events.Event, ability abilities.Abilities, on bool, state states.States) (int, bool)
SetRowWidgetsStateEvent sets given state conditional on given ability for widget, for given event. returns the row and whether it represents an valid slice idex
func (*SliceViewBase) SetSelectedIndex ¶
func (t *SliceViewBase) SetSelectedIndex(v int) *SliceViewBase
SetSelectedIndex sets the [SliceViewBase.SelectedIndex]: index of currently selected item
func (*SliceViewBase) SetSelectedValue ¶
func (t *SliceViewBase) SetSelectedValue(v any) *SliceViewBase
SetSelectedValue sets the [SliceViewBase.SelectedValue]: 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) SetSliceBase ¶
func (sv *SliceViewBase) SetSliceBase()
func (*SliceViewBase) SetStyles ¶
func (sv *SliceViewBase) SetStyles()
func (*SliceViewBase) SetTooltip ¶
func (t *SliceViewBase) SetTooltip(v string) *SliceViewBase
SetTooltip sets the [SliceViewBase.Tooltip]
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) SizeFinal ¶
func (sv *SliceViewBase) SizeFinal()
func (*SliceViewBase) SliceDeleteAt ¶
func (sv *SliceViewBase) SliceDeleteAt(i 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) SliceDeleteAtSelect ¶
func (sv *SliceViewBase) SliceDeleteAtSelect(i int)
SliceDeleteAtSelect 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) SliceNewAtSelect ¶
func (sv *SliceViewBase) SliceNewAtSelect(i int)
SliceNewAtSelect 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) StyleValueWidget ¶
StyleValueWidget performs additional value widget styling
func (*SliceViewBase) UnselectAllIndexes ¶
func (sv *SliceViewBase) UnselectAllIndexes()
UnselectAllIndexes unselects all selected idxs
func (*SliceViewBase) UnselectIndex ¶
func (sv *SliceViewBase) UnselectIndex(idx int)
UnselectIndex unselects given idx (if selected)
func (*SliceViewBase) UnselectIndexAction ¶
func (sv *SliceViewBase) UnselectIndexAction(idx int)
UnselectIndexAction unselects this idx (if selected) -- and emits a signal
func (*SliceViewBase) UpdateScroll ¶
func (sv *SliceViewBase) UpdateScroll()
UpdateScroll updates the scroll value
func (*SliceViewBase) UpdateSelectIndex ¶
func (sv *SliceViewBase) UpdateSelectIndex(idx int, sel bool, selMode events.SelectModes)
UpdateSelectIndex updates the selection for the given index
func (*SliceViewBase) UpdateSelectRow ¶
func (sv *SliceViewBase) UpdateSelectRow(row int, selMode events.SelectModes)
UpdateSelectRow updates the selection for the given row
func (*SliceViewBase) UpdateSliceSize ¶
func (sv *SliceViewBase) UpdateSliceSize() int
UpdateSliceSize updates and returns the size of the slice and sets SliceSize
func (*SliceViewBase) UpdateStartIndex ¶
func (sv *SliceViewBase) UpdateStartIndex()
UpdateStartIndex updates StartIndex 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) 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
func (*SliceViewBase) WidgetIndex ¶
func (sv *SliceViewBase) WidgetIndex(w core.Widget) (row, col int)
WidgetIndex returns the row and column indexes for given widget, from the properties set during construction.
type SliceViewFlags ¶
type SliceViewFlags core.WidgetFlags //enums:bitflag -trim-prefix SliceView
SliceViewFlags extend WidgetFlags to hold SliceView state
const ( // SliceViewConfigured indicates that the widgets have been configured SliceViewConfigured SliceViewFlags = SliceViewFlags(core.WidgetFlagsN) + iota // SliceViewIsArray is whether the slice is actually an array -- no modifications -- set by SetSlice SliceViewIsArray // SliceViewShowIndex is whether to show index or not SliceViewShowIndex // uses a capture of up / down events to manipulate selection, not focus. SliceViewReadOnlyKeyNav // SliceViewSelectMode is whether to be in select rows mode or editing mode SliceViewSelectMode // SliceViewReadOnlyMultiSelect: 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 SliceViewReadOnlyMultiSelect // SliceViewInFocusGrab is a guard for recursive focus grabbing SliceViewInFocusGrab // SliceViewInFullRebuild is a guard for recursive rebuild SliceViewInFullRebuild )
const SliceViewFlagsN SliceViewFlags = 10
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) 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 { core.Frame // note: must be a frame to support stripes! // MinRows is set from parent SV MinRows int `set:"-" edit:"-"` // height of a single row, computed during layout RowHeight float32 `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // total number of rows visible in allocated display size VisRows int `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // Various computed backgrounds BgStripe, BgSelect, BgSelectStripe, BgHover, BgHoverStripe, BgHoverSelect, BgHoverSelectStripe image.Image `set:"-" edit:"-" copier:"-" json:"-" xml:"-"` // LastBackground is the background for which modified // backgrounds were computed -- don't update if same LastBackground image.Image }
SliceViewGrid handles the resizing logic for SliceView, TableView.
func NewSliceViewGrid ¶
func NewSliceViewGrid(parent tree.Node, name ...string) *SliceViewGrid
NewSliceViewGrid adds a new SliceViewGrid with the given name to the given parent: SliceViewGrid handles the resizing logic for SliceView, TableView.
func (*SliceViewGrid) ChildBackground ¶
func (sg *SliceViewGrid) ChildBackground(child core.Widget) image.Image
func (*SliceViewGrid) IndexFromPixel ¶
func (sg *SliceViewGrid) IndexFromPixel(pt image.Point) (row, col int, isValid bool)
IndexFromPixel returns the row, column indexes of given pixel point within grid. Takes a scene-level position.
func (*SliceViewGrid) MousePosInGrid ¶
func (sg *SliceViewGrid) MousePosInGrid(pt image.Point) bool
MousePosInGrid returns true if the event mouse position is located within the slicegrid.
func (*SliceViewGrid) New ¶
func (t *SliceViewGrid) New() tree.Node
New returns a new *SliceViewGrid value
func (*SliceViewGrid) NodeType ¶
func (t *SliceViewGrid) NodeType() *types.Type
NodeType returns the *types.Type of SliceViewGrid
func (*SliceViewGrid) OnInit ¶
func (sg *SliceViewGrid) OnInit()
func (*SliceViewGrid) RenderStripes ¶
func (sg *SliceViewGrid) RenderStripes()
func (*SliceViewGrid) RenderWidget ¶
func (sg *SliceViewGrid) RenderWidget()
func (*SliceViewGrid) RowBackground ¶
func (sg *SliceViewGrid) RowBackground(sel, stripe, hover bool) image.Image
func (*SliceViewGrid) ScrollChanged ¶
func (sg *SliceViewGrid) ScrollChanged(d math32.Dims, sb *core.Slider)
func (*SliceViewGrid) ScrollValues ¶
func (sg *SliceViewGrid) ScrollValues(d math32.Dims) (maxSize, visSize, visPct float32)
func (*SliceViewGrid) SetLastBackground ¶
func (t *SliceViewGrid) SetLastBackground(v image.Image) *SliceViewGrid
SetLastBackground sets the [SliceViewGrid.LastBackground]: LastBackground is the background for which modified backgrounds were computed -- don't update if same
func (*SliceViewGrid) SetScrollParams ¶
func (sg *SliceViewGrid) SetScrollParams(d math32.Dims, sb *core.Slider)
func (*SliceViewGrid) SetTooltip ¶
func (t *SliceViewGrid) SetTooltip(v string) *SliceViewGrid
SetTooltip sets the [SliceViewGrid.Tooltip]
func (*SliceViewGrid) SizeFromChildren ¶
func (sg *SliceViewGrid) SizeFromChildren(iter int, pass core.LayoutPasses) math32.Vector2
func (*SliceViewGrid) SliceView ¶
func (sg *SliceViewGrid) SliceView() (SliceViewer, *SliceViewBase)
func (*SliceViewGrid) UpdateBackgrounds ¶
func (sg *SliceViewGrid) UpdateBackgrounds()
func (*SliceViewGrid) UpdateScroll ¶
func (sg *SliceViewGrid) UpdateScroll(idx int)
type SliceViewInline ¶
type SliceViewInline struct { core.Layout // the slice that we are a view onto Slice any `set:"-"` // SliceValue is the Value for the slice itself // if this was created within the Value framework. // Otherwise, it is nil. SliceValue Value `set:"-"` // whether the slice is actually an array -- no modifications IsArray bool `set:"-"` // whether the slice has a fixed-len flag on it IsFixedLen bool `set:"-"` // has the slice been edited? Changed bool `set:"-"` // Value representations of the fields Values []Value `json:"-" xml:"-" set:"-"` // a record of parent View names that have led up to this view -- displayed as extra contextual information in view dialog windows ViewPath string // size of map when gui was configured ConfigSize int `set:"-"` }
SliceViewInline represents a slice as a single line widget, for smaller slices and those explicitly marked inline.
func NewSliceViewInline ¶
func NewSliceViewInline(parent tree.Node, name ...string) *SliceViewInline
NewSliceViewInline adds a new SliceViewInline with the given name to the given parent: SliceViewInline represents a slice as a single line widget, for smaller slices and those explicitly marked inline.
func (*SliceViewInline) Config ¶
func (sv *SliceViewInline) Config()
func (*SliceViewInline) ContextMenu ¶
func (sv *SliceViewInline) ContextMenu(m *core.Scene, idx int)
func (*SliceViewInline) New ¶
func (t *SliceViewInline) New() tree.Node
New returns a new *SliceViewInline value
func (*SliceViewInline) NodeType ¶
func (t *SliceViewInline) NodeType() *types.Type
NodeType returns the *types.Type of SliceViewInline
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) 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) SetStyles ¶
func (sv *SliceViewInline) SetStyles()
func (*SliceViewInline) SetTooltip ¶
func (t *SliceViewInline) SetTooltip(v string) *SliceViewInline
SetTooltip sets the [SliceViewInline.Tooltip]
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) SizeUp ¶
func (sv *SliceViewInline) SizeUp()
func (*SliceViewInline) SliceDeleteAt ¶
func (sv *SliceViewInline) SliceDeleteAt(idx int)
SliceDeleteAt deletes element at given index from slice
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) SliceSizeChanged ¶
func (sv *SliceViewInline) SliceSizeChanged() bool
func (*SliceViewInline) UpdateValues ¶
func (sv *SliceViewInline) UpdateValues()
type SliceViewStyleFunc ¶
SliceViewStyleFunc is a styling function for custom styling and configuration of elements in the slice view.
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 // RowWidgetNs returns number of widgets per row and // offset for index label RowWidgetNs() (nWidgPerRow, idxOff int) // UpdateSliceSize updates the current size of the slice // and sets SliceSize if changed. UpdateSliceSize() int // StyleValueWidget performs additional value widget styling StyleValueWidget(w core.Widget, s *styles.Style, row, col 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() // HasStyleFunc returns whether there is a custom style function. HasStyleFunc() bool // StyleRow calls a custom style function on given row (and field) StyleRow(w core.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) (*core.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) *core.WidgetBase // 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 SliceDeleteAt(idx int) // MimeDataType returns the data type for mime clipboard // (copy / paste) data e.g., fileinfo.DataJson MimeDataType() string // CopySelectToMime copies selected rows to mime data CopySelectToMime() mimedata.Mimes // PasteAssign assigns mime data (only the first one!) to this idx PasteAssign(md mimedata.Mimes, idx int) // PasteAtIndex inserts object(s) from mime data at // (before) given slice index PasteAtIndex(md mimedata.Mimes, idx int) MakePasteMenu(m *core.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 ¶
SliderValue represents an integer or float value with a slider.
func (*SliderValue) Config ¶
func (v *SliderValue) Config()
func (*SliderValue) Update ¶
func (v *SliderValue) Update()
type StringValue ¶
StringValue represents any value with a text field.
func (*StringValue) Config ¶
func (v *StringValue) Config()
func (*StringValue) Update ¶
func (v *StringValue) Update()
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 "default" 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 reflectx.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[*StructViewInline] }
StructInlineValue represents a struct value with a StructViewInline.
func (*StructInlineValue) Config ¶
func (v *StructInlineValue) Config()
func (*StructInlineValue) Update ¶
func (v *StructInlineValue) Update()
type StructValue ¶
StructValue represents a struct value with a button.
func (*StructValue) Config ¶
func (v *StructValue) Config()
func (*StructValue) ConfigDialog ¶
func (v *StructValue) ConfigDialog(d *core.Body) (bool, func())
func (*StructValue) Update ¶
func (v *StructValue) Update()
type StructView ¶
type StructView struct { core.Frame // the struct that we are a view onto Struct any `set:"-"` // StructValue is the Value for the struct itself // if this was created within the Value framework. // Otherwise, it is nil. StructValue Value `set:"-"` // Value representations of the fields FieldViews []Value `set:"-" 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 // IsShouldShower is whether the struct implements [core.ShouldShower], which results // in additional updating being done at certain points. IsShouldShower bool `set:"-" json:"-" xml:"-" edit:"-"` // extra tags by field name -- from type properties TypeFieldTags map[string]string `set:"-" 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(parent tree.Node, name ...string) *StructView
NewStructView adds a new StructView with the given name to the given parent: 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 (*StructView) ConfigStructGrid ¶
func (sv *StructView) ConfigStructGrid() bool
ConfigStructGrid configures the StructGrid for the current struct. returns true if any fields changed.
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) NodeType ¶
func (t *StructView) NodeType() *types.Type
NodeType returns the *types.Type of StructView
func (*StructView) OnInit ¶
func (sv *StructView) OnInit()
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) SetStyles ¶
func (sv *StructView) SetStyles()
func (*StructView) SetTooltip ¶
func (t *StructView) SetTooltip(v string) *StructView
SetTooltip sets the [StructView.Tooltip]
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() *core.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 { core.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 StructValue Value `set:"-"` // if true, add an edit button at the end AddButton bool // Value representations of the fields FieldViews []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 // IsShouldShower is whether the struct implements [core.ShouldShower], which results // in additional updating being done at certain points. IsShouldShower bool `set:"-" json:"-" xml:"-" edit:"-"` }
StructViewInline represents a struct as a single line widget, for smaller structs and those explicitly marked inline.
func NewStructViewInline ¶
func NewStructViewInline(parent tree.Node, name ...string) *StructViewInline
NewStructViewInline adds a new StructViewInline with the given name to the given parent: StructViewInline represents a struct as a single line widget, for smaller structs and those explicitly marked inline.
func (*StructViewInline) Config ¶
func (sv *StructViewInline) Config()
func (*StructViewInline) New ¶
func (t *StructViewInline) New() tree.Node
New returns a new *StructViewInline value
func (*StructViewInline) NodeType ¶
func (t *StructViewInline) NodeType() *types.Type
NodeType returns the *types.Type of StructViewInline
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 button at the end
func (*StructViewInline) SetFieldViews ¶
func (t *StructViewInline) SetFieldViews(v ...Value) *StructViewInline
SetFieldViews sets the [StructViewInline.FieldViews]: Value representations of the fields
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) SetStyles ¶
func (sv *StructViewInline) SetStyles()
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 `copier:"-" view:"-" json:"-" xml:"-"` // current selection field -- initially select value in this field SelectedField string `copier:"-" view:"-" json:"-" xml:"-"` // current sort index SortIndex int // whether current sort order is descending SortDesc bool // struct type for each row StruType reflect.Type `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // the visible fields VisFields []reflect.StructField `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // number of visible fields NVisFields int `set:"-" copier:"-" view:"-" json:"-" xml:"-"` // HeaderWidths has number of characters in each header, per visfields HeaderWidths []int `set:"-" copier:"-" json:"-" xml:"-"` // ColMaxWidths records maximum width in chars of string type fields ColMaxWidths []int `set:"-" copier:"-" 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 ¶
NewTableView adds a new TableView with the given name to the given parent: 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 (*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) ContextMenu ¶
func (*TableView) HasStyleFunc ¶
func (*TableView) NodeType ¶
NodeType returns the *types.Type of TableView
func (*TableView) RowFirstVisWidget ¶
func (tv *TableView) RowFirstVisWidget(row int) (*core.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) *core.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 ¶
RowWidgetNs returns number of widgets per row and offset for index label
func (*TableView) SelectFieldVal ¶
SelectFieldVal sets SelField and SelVal and attempts to find corresponding row, setting SelectedIndex and selecting row if found -- returns true if found, false otherwise
func (*TableView) SetInitSelectedIndex ¶
SetInitSelectedIndex sets the [TableView.InitSelectedIndex]
func (*TableView) SetMinRows ¶
SetMinRows sets the [TableView.MinRows]
func (*TableView) SetSelectedField ¶
SetSelectedField sets the [TableView.SelectedField]: current selection field -- initially select value in this field
func (*TableView) SetSelectedIndex ¶
SetSelectedIndex sets the [TableView.SelectedIndex]
func (*TableView) SetSelectedValue ¶
SetSelectedValue sets the [TableView.SelectedValue]
func (*TableView) SetSlice ¶
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice (does Update if already viewing).
func (*TableView) SetSortDesc ¶
SetSortDesc sets the [TableView.SortDesc]: whether current sort order is descending
func (*TableView) SetSortFieldName ¶
SetSortFieldName sets sorting to happen on given field and direction -- see SortFieldName for details
func (*TableView) SetSortIndex ¶
SetSortIndex sets the [TableView.SortIndex]: current sort index
func (*TableView) SetStyleFunc ¶
func (t *TableView) SetStyleFunc(v TableViewStyleFunc) *TableView
SetStyleFunc sets the [TableView.StyleFunc]: optional styling function
func (*TableView) SetTooltip ¶
SetTooltip sets the [TableView.Tooltip]
func (*TableView) SetViewPath ¶
SetViewPath sets the [TableView.ViewPath]
func (*TableView) SliceDeleteAt ¶
SliceDeleteAt deletes element at given index from slice
func (*TableView) SliceHeader ¶
SliceHeader returns the Frame header for slice grid
func (*TableView) SliceNewAt ¶
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*TableView) SortFieldName ¶
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 ¶
SortSliceAction sorts the slice for given field index -- toggles ascending vs. descending if already sorting on this dimension
func (*TableView) StructType ¶
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) StyleValueWidget ¶
StyleValueWidget performs additional value widget styling
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 ¶
TableViewStyleFunc is a styling function for custom styling and configuration of elements in the table view.
type TimeValue ¶
TimeValue presents two text fields for editing a date and time, both of which can pull up corresponding picker view dialogs.
func (*TimeValue) TimeValue ¶
TimeValue decodes the value into a *time.Time value, also handling the fileinfo.FileTime case.
type TimeView ¶
type TimeView struct { core.Frame // the time that we are viewing Time time.Time `set:"-"` // 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 ¶
NewTimeView adds a new TimeView with the given name to the given parent: TimeView is a view for selecting a time
func (*TimeView) NodeType ¶
NodeType returns the *types.Type of TimeView
func (*TimeView) SetTooltip ¶
SetTooltip sets the [TimeView.Tooltip]
type TreeTableView ¶
type TreeTableView struct { core.Frame // Tree is the tree view component of the tree table view. Tree *TreeView `set:"-"` // Table is the table view component of the tree table view. Table *TableView `set:"-"` }
TreeTableView combines a TreeView and TableView.
func NewTreeTableView ¶
func NewTreeTableView(parent tree.Node, name ...string) *TreeTableView
NewTreeTableView adds a new TreeTableView with the given name to the given parent: TreeTableView combines a TreeView and TableView.
func (*TreeTableView) Config ¶
func (tt *TreeTableView) Config()
func (*TreeTableView) New ¶
func (t *TreeTableView) New() tree.Node
New returns a new *TreeTableView value
func (*TreeTableView) NodeType ¶
func (t *TreeTableView) NodeType() *types.Type
NodeType returns the *types.Type of TreeTableView
func (*TreeTableView) SetTooltip ¶
func (t *TreeTableView) SetTooltip(v string) *TreeTableView
SetTooltip sets the [TreeTableView.Tooltip]
type TreeView ¶
type TreeView struct { core.WidgetBase // If non-nil, the [tree.Node] that this widget is viewing in the tree (the source) SyncNode tree.Node `set:"-" copier:"-" json:"-" xml:"-"` // The text to display for the tree view item label, which automatically // defaults to the [tree.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 // icon to use for an open (expanded) branch; defaults to [icons.KeyboardArrowDown] IconOpen icons.Icon `view:"show-name"` // icon to use for a closed (collapsed) branch; defaults to [icons.KeyboardArrowRight] IconClosed icons.Icon `view:"show-name"` // icon to use for a terminal node branch that has no children; defaults to [icons.Blank] IconLeaf icons.Icon `view:"show-name"` // amount to indent children relative to this node Indent units.Value `copier:"-" json:"-" xml:"-"` // depth for nodes be initialized as open (default 4). // Nodes beyond this depth will be initialized as closed. OpenDepth int `copier:"-" 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 ViewIndex int `copier:"-" json:"-" xml:"-" edit:"-"` // size of just this node widget. // our alloc includes all of our children, but we only draw us. WidgetSize math32.Vector2 `copier:"-" 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 `copier:"-" json:"-" xml:"-" edit:"-"` // SelectedNodes holds the currently-selected nodes, on the // RootView node only. SelectedNodes []TreeViewer `copier:"-" json:"-" xml:"-" edit:"-"` // contains filtered or unexported fields }
TreeView provides a graphical representation of a tree structure, providing full navigation and manipulation abilities.
It does not handle layout by itself, so if you want it to scroll separately from the rest of the surrounding context, use NewTreeViewFrame.
If the SyncNode field is non-nil, typically via SyncRootNode method, then the TreeView mirrors another 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 ¶
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 ¶
NewTreeView adds a new TreeView with the given name to the given parent: TreeView provides a graphical representation of a tree structure, providing full navigation and manipulation abilities.
It does not handle layout by itself, so if you want it to scroll separately from the rest of the surrounding context, use NewTreeViewFrame.
If the SyncNode field is non-nil, typically via SyncRootNode method, then the TreeView mirrors another 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 NewTreeViewFrame ¶
NewTreeViewFrame adds a new TreeView with the given name to a new frame in the given parent that ensures that the tree view scrolls separately from the surrounding context. If a name is provided, it sets the name of the tree view to that and the name of the frame to that plus "-frame".
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 (*TreeView) AddTreeNodes ¶
func (*TreeView) ApplyStyle ¶
func (tv *TreeView) ApplyStyle()
func (*TreeView) AsTreeView ¶
AsTreeView satisfies the [TreeViewEmbedder] interface
func (*TreeView) BranchPart ¶
BranchPart returns the branch in parts, if it exists
func (*TreeView) CanOpen ¶
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) ContextMenu ¶
func (*TreeView) ContextMenuPos ¶
func (*TreeView) ContextMenuReadOnly ¶
func (*TreeView) Cut ¶
func (tv *TreeView) Cut()
Cut copies to system.Clipboard and deletes selected items.
func (*TreeView) CutSync ¶
func (tv *TreeView) CutSync()
CutSync copies to system.Clipboard 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) DragClearStates ¶
func (tv *TreeView) DragClearStates()
DragClearStates clears the drag-drop related states for this widget
func (*TreeView) DragStart ¶
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 ¶
DropDeleteSource handles delete source event for DropMove case
func (*TreeView) DropDeleteSourceSync ¶
DropDeleteSourceSync handles delete source event for DropMove case, for Sync
func (*TreeView) DropExternal ¶
DropExternal is not handled by base case but could be in derived
func (*TreeView) DropFinalize ¶
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 ¶
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 ¶
HasSelection returns true if there are currently selected items
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 ¶
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) Label ¶
Label returns the display label for this node, satisfying the Labeler interface
func (*TreeView) MakePasteMenu ¶
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) MimeDataSync ¶
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) NodeType ¶
NodeType returns the *types.Type of TreeView
func (*TreeView) NodesFromMimeData ¶
NodesFromMimeData returns a slice of tree nodes for the TreeView nodes and paths from mime data.
func (*TreeView) OnClose ¶
func (tv *TreeView) OnClose()
OnClose is called when a node is closed. The base version does nothing.
func (*TreeView) OnDoubleClick ¶
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) PasteAfter ¶
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 ¶
PasteAssign assigns mime data (only the first one!) to this node
func (*TreeView) PasteAssignSync ¶
PasteAssignSync assigns mime data (only the first one!) to this node
func (*TreeView) PasteAt ¶
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 ¶
PasteAtSync 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 ¶
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 ¶
PasteChildren inserts object(s) from mime data at end of children of this node
func (*TreeView) PasteChildrenSync ¶
PasteChildrenSync inserts object(s) from mime data at end of children of this node
func (*TreeView) PasteMenu ¶
PasteMenu performs a paste from the clipboard using given data, by popping up a menu to determine what specifically to do.
func (*TreeView) ReSync ¶
func (tv *TreeView) ReSync()
ReSync resynchronizes the view relative to the underlying nodes and forces a full rerender
func (*TreeView) RenderWidget ¶
func (tv *TreeView) RenderWidget()
func (*TreeView) RootIsReadOnly ¶
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) RootSetViewIndex ¶
RootSetViewIndex sets the RootView and ViewIndex 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) 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) SelectMode ¶
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 ¶
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 ¶
SendChangeEvent sends the events.Change event on the RootView node, using context event if avail (else nil).
func (*TreeView) SendChangeEventReSync ¶
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 ¶
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) SetClosed ¶
SetClosed sets the closed flag for this node. Call Close() method to close a node and update view.
func (*TreeView) SetIcon ¶
SetIcon sets the [TreeView.Icon]: optional icon, displayed to the the left of the text label
func (*TreeView) SetIconClosed ¶
SetIconClosed sets the [TreeView.IconClosed]: icon to use for a closed (collapsed) branch; defaults to icons.KeyboardArrowRight
func (*TreeView) SetIconLeaf ¶
SetIconLeaf sets the [TreeView.IconLeaf]: icon to use for a terminal node branch that has no children; defaults to icons.Blank
func (*TreeView) SetIconOpen ¶
SetIconOpen sets the [TreeView.IconOpen]: icon to use for an open (expanded) branch; defaults to icons.KeyboardArrowDown
func (*TreeView) SetIndent ¶
SetIndent sets the [TreeView.Indent]: amount to indent children relative to this node
func (*TreeView) SetKidsVisibility ¶
func (*TreeView) SetOpenDepth ¶
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 ¶
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 ¶
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) SetSyncNode ¶
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 tree Config mechanism to perform minimal updates to remain in sync.
func (*TreeView) SetText ¶
SetText sets the [TreeView.Text]: The text to display for the tree view item label, which automatically defaults to the tree.Node.Name of the tree view node. It has no effect if [TreeView.SyncNode] is non-nil.
func (*TreeView) SetTooltip ¶
SetTooltip sets the [TreeView.Tooltip]
func (*TreeView) SetViewIndex ¶
SetViewIndex sets the [TreeView.ViewIndex]: 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 ¶
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) SyncNodesFromMimeData ¶
SyncNodesFromMimeData creates a slice of tree node(s) from given mime data and also a corresponding slice of original paths.
func (*TreeView) SyncToSrc ¶
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) SyncTree ¶
SyncTree sets the root view to the root of the sync source tree node for this TreeView, and syncs the rest of the tree to match. The source tree must have unique names for each child within a given parent.
func (*TreeView) ToggleClose ¶
func (tv *TreeView) ToggleClose()
ToggleClose toggles the close / open status: if closed, opens, and vice-versa
func (*TreeView) TreeViewChanged ¶
TreeViewChanged must be called after any structural change to the TreeView (adding or deleting nodes). It calls: RootSetViewIndex() to update indexes and SendChangeEvent to notify of changes.
func (*TreeView) TreeViewParent ¶
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 ¶
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 core.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(core.WidgetFlagsN) + iota // TreeViewFlagSelectMode, when set on the Root node, determines whether keyboard movements // update selection or not. TreeViewFlagSelectMode // TreeViewInOpen is set in the Open method to prevent recursive opening for lazy-open nodes TreeViewInOpen )
const TreeViewFlagsN TreeViewFlags = 5
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) 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 { core.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() // OnDoubleClick is called when a node is double-clicked // The base version does ToggleClose OnDoubleClick(e events.Event) // 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 *core.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 ¶
TypeValue represents a types.Type value with a chooser.
type Value ¶
type Value interface { fmt.Stringer // AsValueData gives access to the basic data fields so that the // interface doesn't need to provide accessors for them. AsValueData() *ValueData // AsWidget returns the widget associated with the value. AsWidget() core.Widget // AsWidgetBase returns the widget base associated with the value. AsWidgetBase() *core.WidgetBase // WidgetType returns the type of widget associated with this value. WidgetType() *types.Type // SetWidget sets the widget used to represent the value. // It is typically only used internally in [Config]. SetWidget(w core.Widget) // Config configures the widget to represent 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). // You should typically call the global [Config] function instead of this; // this is the method that values implement, which is called in the global // Config helper function. Config() // Update updates the widget representation to reflect the current value. Update() // 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) *ValueData // Doc returns the documentation for the value Doc() string // SetDoc sets the documentation for the value SetDoc(doc string) *ValueData // 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, viewPath string) // SetMapKey sets the key value and owner for a map key. SetMapKey(val reflect.Value, owner any) // 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, viewPath string) // SetSliceValue sets the value, owner and index information for a slice element. SetSliceValue(val reflect.Value, owner any, idx int, 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) // Val returns the reflect.Value representation for this item. Val() reflect.Value // SetValue assigns the given value to this item (if not ReadOnly), // using [xreflect.SetRobust] and emitting a change event. 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://cogentcore.org/core/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://cogentcore.org/core/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 }
A Value is a bridge between Go values like strings, integers, and structs and GUI widgets. It allows you to represent simple and complicated values of any kind with automatic, editable, and user-friendly widgets. The most common pathway for making [Value]s is NewValue.
func FieldToValue ¶
FieldToValue converts the given value into its appropriate Value representation, using its type, tags, value, field name, and parent struct. It checks FieldValuer before falling back on ToValue, which you should use for values that are not struct fields.
func NewValue ¶
NewValue makes and returns a new Value from the given value and creates the widget for it with the given parent and optional tags (only the first argument is used). It is the main way that end-user code should interact with [Value]s. The given value needs to be a pointer for it to be modified.
NewValue is not appropriate for internal code configuring non-solo values (for example, in StructView), but it should be fine for end-user code.
func ToValue ¶
ToValue converts the given value into its appropriate Value representation, using its type, tags, and value. It checks the Valuer interface and the ValueMap before falling back on checks for standard primitive and compound types. If it can not find any good representation for the value, it falls back on StringValue. The tags are optional tags in reflect.StructTag format that can affect what Value is returned; see the Tags page in the Cogent Core Docs to learn more. You should use FieldToValue when making a value in the context of a broader struct owner.
type ValueBase ¶
type ValueBase[W core.Widget] struct { ValueData // Widget is the GUI widget used to display and edit the value in the GUI. Widget W }
ValueBase is the base type that all Value objects extend. It contains both ValueData and a generically parameterized core.Widget.
func (*ValueBase[W]) AsWidgetBase ¶
func (v *ValueBase[W]) AsWidgetBase() *core.WidgetBase
func (*ValueBase[W]) SetValue ¶
SetValue updates the underlying value representation of the Value to the given value. It also sends a change event. It does nothing if the value is read-only. It returns whether the value was successfully set.
func (*ValueBase[W]) WidgetType ¶
type ValueData ¶
type ValueData 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 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 Index int `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:"-"` }
ValueData contains the base data common to all Value objects. Value objects should extend ValueBase, not ValueData.
func (*ValueData) AsValueData ¶
func (*ValueData) GetTitle ¶
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 (*ValueData) HandleEvent ¶
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 (*ValueData) IsReadOnly ¶
func (*ValueData) OnChange ¶
OnChange registers given listener function for Change events on Value. This is the primary notification event for all Value elements.
func (*ValueData) OwnerKind ¶
OwnerKind we have this one accessor b/c it is more useful for outside consumers vs. internal usage
func (*ValueData) OwnerLabel ¶
OwnerLabel returns some extra info about the owner of this value view which is useful to put in title of our object
func (*ValueData) Send ¶
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 (*ValueData) SendChange ¶
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 (*ValueData) SetFlag ¶
SetFlag sets the given flag(s) to given state using atomic, safe for concurrent access
func (*ValueData) SetMapValue ¶
func (*ValueData) SetReadOnly ¶
func (*ValueData) SetSliceValue ¶
func (*ValueData) SetSoloValue ¶
SetSoloValue sets the value for a singleton standalone value (e.g., for arg values).
func (*ValueData) SetStructValue ¶
type ValueFlags ¶
type ValueFlags int64 //enums:bitflag -trim-prefix Value
ValueFlags for Value bool state
const ( // ValueReadOnly flagged after first configuration ValueReadOnly ValueFlags = iota // ValueMapKey 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) 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 Valuer ¶
type Valuer interface {
Value() Value
}
Valuer is an interface that types can implement to specify the Value that should be used to represent them in the GUI. If the return value is nil, then the default Value for the value will be used. For example:
func (m *MyType) Value() views.Value { return &MyValue{} }
Source Files ¶
- argview.go
- colormap.go
- colorview.go
- enumgen.go
- fileview.go
- funcbutton.go
- inspector.go
- keychordview.go
- keymapsview.go
- mapview.go
- mapviewinline.go
- settingsview.go
- sliceview.go
- sliceviewinline.go
- structview.go
- structviewinline.go
- tableview.go
- timeview.go
- toolbar.go
- treesync.go
- treetableview.go
- treeview.go
- typegen.go
- value.go
- valuer.go
- values.go