Documentation ¶
Overview ¶
Package GiV (GoGi Views) provides a model / view framework to view Go data using reflection
Views are Widgets that automatically display and interact with standard Go data, including structs, maps, slices, and the primitive data elements (string, int, etc). This implements a form of model / view separation between data and GUI representation thereof, where the models are the Go data elements themselves.
This provides automatic, powerful GUI access to essentially any data in any other Go package. Furthermore, the ValueView framework allows for easy customization and extension of the GUI representation, based on the classic Go "Stringer"-like interface paradigm -- simply define a ValueView() method on any type, returning giv.ValueView that manages the interface between data structures and GUI representations.
See the wiki at: https://github.com/goki/gi/wiki/Views for more extensive docs.
Some of the most important view elements are:
ValueView ¶
The ValueView provides a common API for representing values (int, string, etc) in the GUI, and are used by more complex views (StructView, MapView, SliceView, etc) to represents the elements of those data structures.
Do Ctrl+Alt+I in any window to pull up the GoGiEditor which will show you ample examples of the ValueView interface in action, and also allow you to customize your GUI.
TreeView ¶
The TreeView displays GoKi Node Trees, using a standard tree-browser with collapse / open widgets and a menu for typical actions such as adding and deleting child nodes, along with full drag-n-drop and clipboard Copy/Cut/Paste functionality. You can connect to the selection signal to e.g., display a StructView field / property editor of the selected node.
TableView ¶
TableView displays a slice-of-struct as a table with columns as the struct fields and rows as the elements in the struct. You can sort by the column headers and it supports full editing with drag-n-drop etc. If set to Inactive, then it serves as a chooser, as in the FileView.
MethodView ¶
This is actually a collection of methods that provide a complete GUI for calling methods. Property lists defined on the kit Type registry are used for specifying the methods to call and their properties. Much of your toolbar and menu level GUI can be implemented in this system. See gi/prefs.go and giv/prefsview.go for how the GoGi Prefs dialog is implemented, and see the gide project for a more complex case.
Index ¶
- Constants
- Variables
- func ActionView(val interface{}, vtyp reflect.Type, vp *gi.Viewport2D, ac *gi.Action, ...) bool
- func ActionViewArgsValidate(md *MethViewData, vtyp reflect.Type, meth reflect.Method, ...) bool
- func ActionsView(val interface{}, vtyp reflect.Type, vp *gi.Viewport2D, pa *gi.Action, ...) bool
- func ArgViewDialog(avp *gi.Viewport2D, args []ArgData, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func AvailColorMapsList() []string
- func CallMethod(val interface{}, method string, vp *gi.Viewport2D) bool
- func ColorViewDialog(avp *gi.Viewport2D, clr gi.Color, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func ColorViewDialogValue(dlg *gi.Dialog) gi.Color
- func CompleteEditPi(data interface{}, text string, cursorPos int, comp complete.Completion, ...) (ed complete.Edit)
- func CompletePi(data interface{}, text string, posLn, posCh int) (md complete.Matches)
- func CompleteText(data interface{}, text string, posLn, posCh int) (md complete.Matches)
- func CompleteTextEdit(data interface{}, text string, cursorPos int, completion complete.Completion, ...) (ed complete.Edit)
- func CopyFile(dst, src string, perm os.FileMode) error
- func CtxtMenuView(val interface{}, inactive bool, vp *gi.Viewport2D, menu *gi.Menu) bool
- func DirAndFile(file string) string
- func FileNames(d os.File, names *[]string) (err error)
- func FileNodeBufSigRecv(rvwki, sbufki ki.Ki, sig int64, data interface{})
- func FileNodeNameCountSort(ecs []FileNodeNameCount)
- func FileViewDialog(avp *gi.Viewport2D, filename, ext string, opts DlgOpts, ...) *gi.Dialog
- func FileViewDialogValue(dlg *gi.Dialog) string
- func FileViewDirOnlyFilter(fv *FileView, fi *FileInfo) bool
- func FileViewExtOnlyFilter(fv *FileView, fi *FileInfo) bool
- func FileViewStyleFunc(tv *TableView, slice interface{}, widg gi.Node2D, row, col int, vv ValueView)
- func FontChooserDialog(avp *gi.Viewport2D, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
- func FontInfoStyleFunc(tv *TableView, slice interface{}, widg gi.Node2D, row, col int, vv ValueView)
- func HTMLEscapeBytes(b []byte) []byte
- func HTMLEscapeRunes(r []rune) []byte
- func HasMainMenuView(val interface{}) bool
- func HasToolBarView(val interface{}) bool
- func HiStylesView(st *histyle.Styles)
- func IconChooserDialog(avp *gi.Viewport2D, curIc gi.IconName, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func IconChooserStyleFunc(sv *SliceView, slice interface{}, widg gi.Node2D, row int, vv ValueView)
- func KeyMapsView(km *gi.KeyMaps)
- func LookupPi(data interface{}, text string, posLn, posCh int) (ld complete.Lookup)
- func MainMenuView(val interface{}, win *gi.Window, mbar *gi.MenuBar) bool
- func MapViewDialog(avp *gi.Viewport2D, mp interface{}, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func MethViewArgDefaultVal(md *MethViewData, ai int) (interface{}, bool)
- func MethViewCall(recv, send ki.Ki, sig int64, data interface{})
- func MethViewCallMeth(md *MethViewData, args []reflect.Value)
- func MethViewCallNoArgPrompt(ac *gi.Action, md *MethViewData, args []reflect.Value)
- func MethViewCompileActions(cmp ki.Props, val interface{}, vtyp reflect.Type, vp *gi.Viewport2D, ...) bool
- func MethViewCompileMeths(val interface{}, vp *gi.Viewport2D) ki.Props
- func MethViewErr(vtyp reflect.Type, msg string)
- func MethViewFieldValue(vval reflect.Value, field string) (*reflect.Value, bool)
- func MethViewNoUpdateAfterProp(val interface{}) bool
- func MethViewSetActionData(ac *gi.Action, val interface{}, vp *gi.Viewport2D)
- func MethViewShowValue(vp *gi.Viewport2D, val reflect.Value, title, prompt string)
- func MethViewSubMenuFunc(aki ki.Ki, m *gi.Menu)
- func MethViewTypeProps(val interface{}) (ki.Props, reflect.Type, bool)
- func MethViewUpdateFunc(act *gi.Action)
- func OSOpenCommand() string
- func PrefsDbgView(pf *gi.PrefsDebug) *gi.Window
- func PrefsDetView(pf *gi.PrefsDetailed) *gi.Window
- func PrefsView(pf *gi.Preferences) *gi.Window
- func QReplaceDialog(avp *gi.Viewport2D, find string, lexitems bool, opts gi.DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func QReplaceDialogValues(dlg *gi.Dialog) (find, repl string, lexItems bool)
- func RelFilePath(file, root string) string
- func SliceIdxByValue(slc interface{}, fldVal interface{}) (int, bool)
- func SliceViewDialog(avp *gi.Viewport2D, slice interface{}, opts DlgOpts, ...) *gi.Dialog
- func SliceViewDialogNoStyle(avp *gi.Viewport2D, slice interface{}, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func SliceViewSelectDialog(avp *gi.Viewport2D, slice, curVal interface{}, opts DlgOpts, ...) *gi.Dialog
- func SliceViewSelectDialogValue(dlg *gi.Dialog) int
- func SrcNodeSignalFunc(tvki, send ki.Ki, sig int64, data interface{})
- func StructFieldIsDef(defs string, valPtr interface{}) (bool, string)
- func StructNonDefFieldsStr(structPtr interface{}, path string) string
- func StructSliceIdxByValue(struSlice interface{}, fldName string, fldVal interface{}) (int, error)
- func StructViewDialog(avp *gi.Viewport2D, stru interface{}, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func StructViewFieldDefTag(vv ValueView, lbl *gi.Label) (hasDef bool, isDef bool, defStr string)
- func StructViewFieldTags(vv ValueView, lbl *gi.Label, widg gi.Node2D, isInact bool) (hasDef, inactTag bool)
- func TableViewDialog(avp *gi.Viewport2D, slcOfStru interface{}, opts DlgOpts, ...) *gi.Dialog
- func TableViewSelectDialog(avp *gi.Viewport2D, slcOfStru interface{}, opts DlgOpts, initRow int, ...) *gi.Dialog
- func TableViewSelectDialogValue(dlg *gi.Dialog) int
- func TextViewBlink()
- func TextViewBufSigRecv(rvwki ki.Ki, sbufki ki.Ki, sig int64, data interface{})
- func TextViewClipHistAdd(clip []byte)
- func TextViewClipHistChooseList() []string
- func ToolBarView(val interface{}, vp *gi.Viewport2D, tb *gi.ToolBar) bool
- func VCSLogViewDialog(repo vci.Repo, lg vci.Log, file, since string) *gi.Dialog
- func ValueViewMapAdd(typeNm string, fun ValueViewFunc)
- type ActionUpdateFunc
- type ArgData
- type ArgDataFlags
- type ArgView
- type BitFlagView
- type BoolValueView
- type ByteSliceValueView
- type ColorMap
- type ColorMapName
- type ColorMapValueView
- type ColorMapView
- func (cv *ColorMapView) ChooseColorMap()
- func (cv *ColorMapView) ConnectEvents2D()
- func (cv *ColorMapView) Disconnect()
- func (cv *ColorMapView) MouseEvent()
- func (cv *ColorMapView) Render2D()
- func (cv *ColorMapView) RenderColorMap()
- func (cv *ColorMapView) SetColorMap(cmap *ColorMap)
- func (cv *ColorMapView) SetColorMapAction(cmap *ColorMap)
- type ColorNameValueView
- func (vv *ColorNameValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
- func (vv *ColorNameValueView) ConfigWidget(widg gi.Node2D)
- func (vv *ColorNameValueView) HasAction() bool
- func (vv *ColorNameValueView) UpdateWidget()
- func (vv *ColorNameValueView) WidgetType() reflect.Type
- type ColorValueView
- func (vv *ColorValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
- func (vv *ColorValueView) Color() (*gi.Color, bool)
- func (vv *ColorValueView) ConfigWidget(widg gi.Node2D)
- func (vv *ColorValueView) HasAction() bool
- func (vv *ColorValueView) SetColor(clr gi.Color)
- func (vv *ColorValueView) UpdateWidget()
- func (vv *ColorValueView) WidgetType() reflect.Type
- type ColorView
- func (cv *ColorView) Config()
- func (cv *ColorView) ConfigHSLSlider(sl *gi.Slider, hsl int)
- func (cv *ColorView) ConfigLabel(lab *gi.Label, txt string)
- func (cv *ColorView) ConfigRGBSlider(sl *gi.Slider, rgb int)
- func (cv *ColorView) ConfigSliderGrid()
- func (cv *ColorView) Disconnect()
- func (cv *ColorView) IsConfiged() bool
- func (cv *ColorView) NumLay() *gi.Layout
- func (cv *ColorView) NumLayConfig()
- func (cv *ColorView) Render2D()
- func (cv *ColorView) SetColor(clr color.Color)
- func (cv *ColorView) SetHSLValue(val float32, hsl int)
- func (cv *ColorView) SetRGBValue(val float32, rgb int)
- func (cv *ColorView) SliderGrid() *gi.Layout
- func (cv *ColorView) SliderLay() *gi.Layout
- func (cv *ColorView) SliderLayConfig()
- func (cv *ColorView) Update()
- func (cv *ColorView) UpdateHSLSlider(sl *gi.Slider, hsl int)
- func (cv *ColorView) UpdateRGBSlider(sl *gi.Slider, rgb int)
- func (cv *ColorView) UpdateSliderGrid()
- func (cv *ColorView) Value() *gi.Frame
- type DiffTextView
- type DiffView
- func (dv *DiffView) ApplyDiff(ab int, line int) bool
- func (dv *DiffView) Config()
- func (dv *DiffView) ConfigTexts()
- func (dv *DiffView) ConfigToolBar()
- func (dv *DiffView) DiffLay() *gi.Layout
- func (dv *DiffView) DiffStrings(astr, bstr []string)
- func (dv *DiffView) FileModifiedUpdateA(act *gi.Action)
- func (dv *DiffView) FileModifiedUpdateB(act *gi.Action)
- func (dv *DiffView) HasDiffsUpdate(act *gi.Action)
- func (dv *DiffView) IsConfiged() bool
- func (dv *DiffView) NextDiff(ab int) bool
- func (dv *DiffView) PrevDiff(ab int) bool
- func (dv *DiffView) RemoveAlignsA()
- func (dv *DiffView) RemoveAlignsB()
- func (dv *DiffView) ResetDiffs()
- func (dv *DiffView) SaveFileA(fname gi.FileName)
- func (dv *DiffView) SaveFileB(fname gi.FileName)
- func (dv *DiffView) SetTextNames()
- func (dv *DiffView) TagWordDiffs()
- func (dv *DiffView) TextViewLays() (*gi.Layout, *gi.Layout)
- func (dv *DiffView) TextViews() (*DiffTextView, *DiffTextView)
- func (dv *DiffView) ToolBar() *gi.ToolBar
- func (dv *DiffView) UndoDiff(ab int)
- func (dv *DiffView) UpdateToolBar()
- type DirFlagMap
- func (dm *DirFlagMap) ClearMarks()
- func (dm *DirFlagMap) DeleteStale()
- func (dm *DirFlagMap) Init()
- func (dm *DirFlagMap) IsOpen(path string) bool
- func (dm *DirFlagMap) SetMark(path string)
- func (dm *DirFlagMap) SetOpen(path string, open bool)
- func (dm *DirFlagMap) SetSortBy(path string, modTime bool)
- func (dm *DirFlagMap) SortByModTime(path string) bool
- func (dm *DirFlagMap) SortByName(path string) bool
- type DirFlags
- type DlgOpts
- type EnumValueView
- type FieldValueViewer
- type FileInfo
- func (fi *FileInfo) Delete() error
- func (fi *FileInfo) Duplicate() (string, error)
- func (fi *FileInfo) FileNames(names *[]string) (err error)
- func (fi *FileInfo) FindIcon() (gi.IconName, bool)
- func (fi *FileInfo) InitFile(fname string) error
- func (fi *FileInfo) IsDir() bool
- func (fi *FileInfo) IsExec() bool
- func (fi *FileInfo) IsHidden() bool
- func (fi *FileInfo) IsSymlink() bool
- func (fi *FileInfo) Rename(path string) (newpath string, err error)
- func (fi *FileInfo) Stat() error
- type FileNode
- func (fn *FileNode) AddToVcs()
- func (fn *FileNode) BlameVcs() ([]byte, error)
- func (fn *FileNode) CloseAll()
- func (fn *FileNode) CloseBuf() bool
- func (fn *FileNode) CloseDir()
- func (fn *FileNode) CommitToVcs(message string) (err error)
- func (fn *FileNode) ConfigOfFiles(path string) kit.TypeAndNameList
- func (fn *FileNode) CopyFieldsFrom(frm interface{})
- func (fn *FileNode) CopyFileToDir(filename string, perm os.FileMode)
- func (fn *FileNode) DeleteFile() (err error)
- func (fn *FileNode) DeleteFromVcs()
- func (fn *FileNode) DetectVcsRepo(updateFiles bool) bool
- func (fn *FileNode) DiffVcs(rev_a, rev_b string) error
- func (fn *FileNode) DirsTo(path string) (*FileNode, error)
- func (fn *FileNode) DuplicateFile() error
- func (fn *FileNode) FileExtCounts(cat filecat.Cat) []FileNodeNameCount
- func (fn *FileNode) FilesMatching(match string, ignoreCase bool) []*FileNode
- func (fn *FileNode) FindFile(fnm string) (*FileNode, bool)
- func (fn *FileNode) FirstVCS() (vci.Repo, *FileNode)
- func (fn *FileNode) HasClosedParent() bool
- func (fn *FileNode) InitFileInfo() error
- func (fn *FileNode) IsAutoSave() bool
- func (fn *FileNode) IsChanged() bool
- func (fn *FileNode) IsDir() bool
- func (fn *FileNode) IsExec() bool
- func (fn *FileNode) IsExternal() bool
- func (fn *FileNode) IsIrregular() bool
- func (fn *FileNode) IsOpen() bool
- func (fn *FileNode) IsSymLink() bool
- func (fn *FileNode) LatestFileMod(cat filecat.Cat) time.Time
- func (fn *FileNode) LogVcs(allFiles bool, since string) (vci.Log, error)
- func (fn *FileNode) MyRelPath() string
- func (fn *FileNode) NewFile(filename string, addToVcs bool)
- func (fn *FileNode) NewFolder(foldername string)
- func (fn *FileNode) OpenAll()
- func (fn *FileNode) OpenBuf() (bool, error)
- func (fn *FileNode) OpenDir()
- func (fn *FileNode) OpenFileDefault() error
- func (fn *FileNode) OpenFileWith(command string) error
- func (fn *FileNode) ReadDir(path string) error
- func (fn *FileNode) RelPath(fpath gi.FileName) string
- func (fn *FileNode) RenameFile(newpath string) (err error)
- func (fn *FileNode) Repo() (vci.Repo, *FileNode)
- func (fn *FileNode) RevertVcs() (err error)
- func (fn *FileNode) SetClosed()
- func (fn *FileNode) SetNodePath(path string) error
- func (fn *FileNode) SetOpen()
- func (fn *FileNode) SortBy(modTime bool)
- func (fn *FileNode) SortConfigByModTime(confg kit.TypeAndNameList)
- func (fn *FileNode) UpdateAllVcs()
- func (fn *FileNode) UpdateDir()
- func (fn *FileNode) UpdateNode() error
- func (fn *FileNode) UpdateRepoFiles()
- type FileNodeFlags
- type FileNodeNameCount
- type FileSize
- type FileTime
- func (ft *FileTime) FromInt(val int64)
- func (ft FileTime) Int() int64
- func (ft FileTime) MarshalBinary() ([]byte, error)
- func (ft FileTime) MarshalJSON() ([]byte, error)
- func (ft FileTime) MarshalText() ([]byte, error)
- func (ft FileTime) String() string
- func (ft *FileTime) UnmarshalBinary(data []byte) error
- func (ft *FileTime) UnmarshalJSON(data []byte) error
- func (ft *FileTime) UnmarshalText(data []byte) error
- type FileTree
- func (ft *FileTree) AddExtFile(fpath string) (*FileNode, error)
- func (ft *FileTree) CopyFieldsFrom(frm interface{})
- func (ft *FileTree) DirSortByModTime(fpath gi.FileName) bool
- func (ft *FileTree) DirSortByName(fpath gi.FileName) bool
- func (ft *FileTree) ExtFileNodeByPath(fpath string) (*FileNode, error)
- func (ft *FileTree) HasExtFile(fpath string) (bool, int)
- func (ft *FileTree) IsDirOpen(fpath gi.FileName) bool
- func (ft *FileTree) OpenPath(path string)
- func (ft *FileTree) RemoveExtFile(fpath string) bool
- func (ft *FileTree) SetDirClosed(fpath gi.FileName)
- func (ft *FileTree) SetDirOpen(fpath gi.FileName)
- func (ft *FileTree) SetDirSortBy(fpath gi.FileName, modTime bool)
- func (ft *FileTree) UpdateAll()
- func (ft *FileTree) UpdateExtFiles(efn *FileNode)
- func (ft *FileTree) UpdateNewFile(filename string)
- type FileTreeView
- func (ftv *FileTreeView) AddToVcs()
- func (ftv *FileTreeView) BlameVcs()
- func (ftv *FileTreeView) CloseAll()
- func (ftv *FileTreeView) CommitToVcs()
- func (ftv *FileTreeView) ConnectEvents2D()
- func (ftv *FileTreeView) Cut()
- func (ftv *FileTreeView) DeleteFiles()
- func (ftv *FileTreeView) DeleteFilesImpl()
- func (ftv *FileTreeView) DeleteFromVcs()
- func (ftv *FileTreeView) DiffVcs(rev_a, rev_b string)
- func (ftv *FileTreeView) Dragged(de *dnd.Event)
- func (ftv *FileTreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)
- func (ftv *FileTreeView) DropExternal(md mimedata.Mimes, mod dnd.DropMods)
- func (ftv *FileTreeView) DuplicateFiles()
- func (ftv *FileTreeView) FileNode() *FileNode
- func (ftv *FileTreeView) FileTreeViewEvents()
- func (ftv *FileTreeView) KeyInput(kt *key.ChordEvent)
- func (ftv *FileTreeView) LogVcs(allFiles bool, since string)
- func (ftv *FileTreeView) MimeData(md *mimedata.Mimes)
- func (ftv *FileTreeView) NewFile(filename string, addToVcs bool)
- func (ftv *FileTreeView) NewFolder(foldername string)
- func (ftv *FileTreeView) OpenAll()
- func (ftv *FileTreeView) OpenDir()
- func (ftv *FileTreeView) OpenFileDefault()
- func (ftv *FileTreeView) OpenFileWith()
- func (ftv *FileTreeView) Paste()
- func (ftv *FileTreeView) PasteCheckExisting(tfn *FileNode, md mimedata.Mimes) ([]string, *FileNode)
- func (ftv *FileTreeView) PasteCopyFiles(tdir *FileNode, md mimedata.Mimes)
- func (ftv *FileTreeView) PasteMime(md mimedata.Mimes)
- func (ftv *FileTreeView) PasteMimeCopyFilesCheck(tdir *FileNode, md mimedata.Mimes)
- func (ftv *FileTreeView) RemoveFromExterns()
- func (ftv *FileTreeView) RenameFiles()
- func (ftv *FileTreeView) RevertVcs()
- func (ftv *FileTreeView) ShowFileInfo()
- func (ftv *FileTreeView) SortBy(modTime bool)
- func (ft *FileTreeView) Style2D()
- func (ftv *FileTreeView) UpdateAllFiles()
- type FileValueView
- type FileView
- func (fv *FileView) AddPathToFavs()
- func (fv *FileView) Config()
- func (fv *FileView) ConfigFilesRow()
- func (fv *FileView) ConfigPathBar()
- func (fv *FileView) ConfigSelRow()
- func (fv *FileView) ConnectEvents2D()
- func (fv *FileView) DirPathUp()
- func (fv *FileView) Disconnect()
- func (fv *FileView) EditPaths()
- func (fv *FileView) ExtField() *gi.TextField
- func (fv *FileView) FavSelect(idx int)
- func (fv *FileView) FavsView() *TableView
- func (fv *FileView) FileComplete(data interface{}, text string, posLn, posCh int) (md complete.Matches)
- func (fv *FileView) FileCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, ...) (ed complete.Edit)
- func (fv *FileView) FileSelectAction(idx int)
- func (fv *FileView) FileViewEvents()
- func (fv *FileView) FilesRow() *gi.Layout
- func (fv *FileView) FilesView() *TableView
- func (fv *FileView) HasFocus2D() bool
- func (fv *FileView) KeyInput(kt *key.ChordEvent)
- func (fv *FileView) NewFolder()
- func (fv *FileView) PathComplete(data interface{}, path string, posLn, posCh int) (md complete.Matches)
- func (fv *FileView) PathCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, ...) (ed complete.Edit)
- func (fv *FileView) PathField() *gi.ComboBox
- func (fv *FileView) PathFieldHistNext()
- func (fv *FileView) PathFieldHistPrev()
- func (fv *FileView) SaveSortPrefs()
- func (fv *FileView) SelField() *gi.TextField
- func (fv *FileView) SelRow() *gi.Layout
- func (fv *FileView) SelectFile()
- func (fv *FileView) SelectedFile() string
- func (fv *FileView) SelectedFileInfo() (*FileInfo, bool)
- func (fv *FileView) SetExt(ext string)
- func (fv *FileView) SetExtAction(ext string)
- func (fv *FileView) SetFilename(filename, ext string)
- func (fv *FileView) SetPathFile(path, file, ext string)
- func (fv *FileView) SetSelFileAction(sel string)
- func (fv *FileView) Style2D()
- func (fv *FileView) UpdateFavs()
- func (fv *FileView) UpdateFiles()
- func (fv *FileView) UpdateFilesAction()
- func (fv *FileView) UpdatePath()
- type FileViewFilterFunc
- type FileViewSignals
- type FloatValueView
- type FontValueView
- type GiEditor
- func (ge *GiEditor) Config()
- func (ge *GiEditor) ConfigSplitView()
- func (ge *GiEditor) ConfigToolbar()
- func (ge *GiEditor) Open(filename gi.FileName)
- func (ge *GiEditor) Render2D()
- func (ge *GiEditor) Save()
- func (ge *GiEditor) SaveAs(filename gi.FileName)
- func (ge *GiEditor) SetChanged()
- func (ge *GiEditor) SetRoot(root ki.Ki)
- func (ge *GiEditor) SetTitle(title string)
- func (ge *GiEditor) SplitView() *gi.SplitView
- func (ge *GiEditor) StructView() *StructView
- func (ge *GiEditor) TitleWidget() *gi.Label
- func (ge *GiEditor) ToolBar() *gi.ToolBar
- func (ge *GiEditor) TreeView() *TreeView
- func (ge *GiEditor) Update()
- type HiMarkup
- func (hm *HiMarkup) ChromaTagsAll(txt []byte) ([]lex.Line, error)
- func (hm *HiMarkup) ChromaTagsForLine(tags *lex.Line, toks []chroma.Token)
- func (hm *HiMarkup) ChromaTagsLine(txt []rune) (lex.Line, error)
- func (hm *HiMarkup) HasHi() bool
- func (hm *HiMarkup) Init(info *FileInfo, pist *pi.FileStates)
- func (hm *HiMarkup) MarkupLine(txt []rune, hitags, tags lex.Line) []byte
- func (hm *HiMarkup) MarkupTagsAll(txt []byte) ([]lex.Line, error)
- func (hm *HiMarkup) MarkupTagsLine(ln int, txt []rune) (lex.Line, error)
- func (hm *HiMarkup) SetHiStyle(style gi.HiStyleName)
- func (hm *HiMarkup) UsingPi() bool
- type HiStyleValueView
- type ISearch
- type IconValueView
- type IntValueView
- type KeyChordEdit
- func (kc *KeyChordEdit) ChordUpdated()
- func (kc *KeyChordEdit) ConnectEvents2D()
- func (kc *KeyChordEdit) Disconnect()
- func (kc *KeyChordEdit) FocusChanged2D(change gi.FocusChanges)
- func (kc *KeyChordEdit) KeyChordEvent()
- func (kc *KeyChordEdit) MakeContextMenu(m *gi.Menu)
- func (kc *KeyChordEdit) MouseEvent()
- func (kc *KeyChordEdit) Style2D()
- type KeyChordValueView
- type KeyMapValueView
- type KiPtrValueView
- func (vv *KiPtrValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
- func (vv *KiPtrValueView) ConfigWidget(widg gi.Node2D)
- func (vv *KiPtrValueView) HasAction() bool
- func (vv *KiPtrValueView) KiStruct() ki.Ki
- func (vv *KiPtrValueView) UpdateWidget()
- func (vv *KiPtrValueView) WidgetType() reflect.Type
- type LabelFunc
- type MapInlineValueView
- type MapValueView
- type MapView
- func (mv *MapView) Config()
- func (mv *MapView) ConfigMapGrid()
- func (mv *MapView) ConfigToolbar()
- func (mv *MapView) Disconnect()
- func (mv *MapView) IsConfiged() bool
- func (mv *MapView) KiPropTag() string
- func (mv *MapView) MapAdd()
- func (mv *MapView) MapChangeValueType(idx int, typ reflect.Type)
- func (mv *MapView) MapDelete(key reflect.Value)
- func (mv *MapView) MapGrid() *gi.Frame
- func (mv *MapView) Render2D()
- func (mv *MapView) SetChanged()
- func (mv *MapView) SetMap(mp interface{})
- func (mv *MapView) Style2D()
- func (mv *MapView) ToggleSort()
- func (mv *MapView) ToolBar() *gi.ToolBar
- func (mv *MapView) UpdateValues()
- type MapViewInline
- func (mv *MapViewInline) ConfigParts()
- func (mv *MapViewInline) Disconnect()
- func (mv *MapViewInline) MapAdd()
- func (mv *MapViewInline) Render2D()
- func (mv *MapViewInline) SetChanged()
- func (mv *MapViewInline) SetMap(mp interface{})
- func (mv *MapViewInline) Style2D()
- func (mv *MapViewInline) UpdateFromMap()
- func (mv *MapViewInline) UpdateValues()
- type MapViewSignals
- type MethViewData
- type MethViewFlags
- type NilValueView
- type OutBuf
- type OutBufMarkupFunc
- type QReplace
- type RuneSliceValueView
- type ShortcutFunc
- type SliceInlineValueView
- type SliceValueView
- type SliceView
- type SliceViewBase
- func (sv *SliceViewBase) AsSliceViewBase() *SliceViewBase
- func (sv *SliceViewBase) AvailHeight() float32
- func (sv *SliceViewBase) Config()
- func (sv *SliceViewBase) ConfigScroll()
- func (sv *SliceViewBase) ConfigSliceGrid()
- func (sv *SliceViewBase) ConfigToolbar()
- func (sv *SliceViewBase) ConnectEvents2D()
- func (sv *SliceViewBase) Copy(reset bool)
- func (sv *SliceViewBase) CopyIdxs(reset bool)
- func (sv *SliceViewBase) CopySelToMime() mimedata.Mimes
- func (sv *SliceViewBase) Cut()
- func (sv *SliceViewBase) CutIdxs()
- func (sv *SliceViewBase) DeleteIdxs()
- func (sv *SliceViewBase) Disconnect()
- func (sv *SliceViewBase) DragNDropFinalize(mod dnd.DropMods)
- func (sv *SliceViewBase) DragNDropSource(de *dnd.Event)
- func (sv *SliceViewBase) DragNDropStart()
- func (sv *SliceViewBase) DragNDropTarget(de *dnd.Event)
- func (sv *SliceViewBase) Drop(md mimedata.Mimes, mod dnd.DropMods)
- func (sv *SliceViewBase) DropAfter(md mimedata.Mimes, mod dnd.DropMods, idx int)
- func (sv *SliceViewBase) DropAssign(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) DropBefore(md mimedata.Mimes, mod dnd.DropMods, idx int)
- func (sv *SliceViewBase) DropCancel()
- func (sv *SliceViewBase) Duplicate() int
- func (sv *SliceViewBase) FromMimeData(md mimedata.Mimes) []interface{}
- func (sv *SliceViewBase) GridLayout() *gi.Layout
- func (sv *SliceViewBase) HasFocus2D() bool
- func (sv *SliceViewBase) IdxFromPos(posY int) (int, bool)
- func (sv *SliceViewBase) IdxGrabFocus(idx int) *gi.WidgetBase
- func (sv *SliceViewBase) IdxIsSelected(idx int) bool
- func (sv *SliceViewBase) IdxPos(idx int) image.Point
- func (sv *SliceViewBase) IsConfiged() bool
- func (sv *SliceViewBase) IsIdxVisible(idx int) bool
- func (sv *SliceViewBase) IsRowInBounds(row int) bool
- func (sv *SliceViewBase) ItemCtxtMenu(idx int)
- func (sv *SliceViewBase) KeyInputActive(kt *key.ChordEvent)
- func (sv *SliceViewBase) KeyInputInactive(kt *key.ChordEvent)
- func (sv *SliceViewBase) LayoutSliceGrid() bool
- func (sv *SliceViewBase) MakeDropMenu(m *gi.Menu, data interface{}, mod dnd.DropMods, idx int)
- func (sv *SliceViewBase) MakePasteMenu(m *gi.Menu, data interface{}, idx int)
- func (sv *SliceViewBase) MimeDataIdx(md *mimedata.Mimes, idx int)
- func (sv *SliceViewBase) MimeDataType() string
- func (sv *SliceViewBase) MoveDown(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MoveDownAction(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MovePageDown(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MovePageDownAction(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MovePageUp(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MovePageUpAction(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MoveUp(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) MoveUpAction(selMode mouse.SelectModes) int
- func (sv *SliceViewBase) Paste()
- func (sv *SliceViewBase) PasteAssign(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) PasteAtIdx(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) PasteIdx(idx int)
- func (sv *SliceViewBase) PasteMenu(md mimedata.Mimes, idx int)
- func (sv *SliceViewBase) Render2D()
- func (sv *SliceViewBase) ResetSelectedIdxs()
- func (sv *SliceViewBase) RowFirstWidget(row int) (*gi.WidgetBase, bool)
- func (sv *SliceViewBase) RowFromPos(posY int) (int, bool)
- func (sv *SliceViewBase) RowGrabFocus(row int) *gi.WidgetBase
- func (sv *SliceViewBase) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (sv *SliceViewBase) SaveDraggedIdxs(idx int)
- func (sv *SliceViewBase) ScrollBar() *gi.ScrollBar
- func (sv *SliceViewBase) ScrollToIdx(idx int) bool
- func (sv *SliceViewBase) SelectAllIdxs()
- func (sv *SliceViewBase) SelectIdx(idx int)
- func (sv *SliceViewBase) SelectIdxAction(idx int, mode mouse.SelectModes)
- func (sv *SliceViewBase) SelectIdxWidgets(idx int, sel bool) bool
- func (sv *SliceViewBase) SelectRowWidgets(row int, sel bool)
- func (sv *SliceViewBase) SelectVal(val string) bool
- func (sv *SliceViewBase) SelectedIdxsList(descendingSort bool) []int
- func (sv *SliceViewBase) SetChanged()
- func (sv *SliceViewBase) SetSlice(sl interface{})
- func (sv *SliceViewBase) SliceDeleteAt(idx int, doupdt bool)
- func (sv *SliceViewBase) SliceDeleteAtRow(row int, updt bool)
- func (sv *SliceViewBase) SliceGrid() *gi.Frame
- func (sv *SliceViewBase) SliceGridNeedsLayout() bool
- func (sv *SliceViewBase) SliceNewAt(idx int)
- func (sv *SliceViewBase) SliceNewAtRow(row int)
- func (sv *SliceViewBase) SliceVal(idx int) interface{}
- func (sv *SliceViewBase) SliceViewBaseEvents()
- func (sv *SliceViewBase) StdCtxtMenu(m *gi.Menu, idx int)
- func (sv *SliceViewBase) Style2D()
- func (sv *SliceViewBase) ToolBar() *gi.ToolBar
- func (sv *SliceViewBase) UnselectAllIdxs()
- func (sv *SliceViewBase) UnselectIdx(idx int)
- func (sv *SliceViewBase) UnselectIdxAction(idx int)
- func (sv *SliceViewBase) Update()
- func (sv *SliceViewBase) UpdateScroll()
- func (sv *SliceViewBase) UpdateSelectIdx(idx int, sel bool)
- func (sv *SliceViewBase) UpdateSelectRow(row int, sel bool)
- func (sv *SliceViewBase) UpdateSliceGrid()
- func (sv *SliceViewBase) UpdateValues()
- func (sv *SliceViewBase) UpdtSliceSize() int
- func (sv *SliceViewBase) ViewMuLock()
- func (sv *SliceViewBase) ViewMuUnlock()
- type SliceViewInline
- func (sv *SliceViewInline) ConfigParts()
- func (sv *SliceViewInline) Disconnect()
- func (sv *SliceViewInline) Render2D()
- func (sv *SliceViewInline) SetChanged()
- func (sv *SliceViewInline) SetSlice(sl interface{})
- func (sv *SliceViewInline) SliceNewAt(idx int, reconfig bool)
- func (sv *SliceViewInline) Style2D()
- func (sv *SliceViewInline) UpdateFromSlice()
- func (sv *SliceViewInline) UpdateValues()
- type SliceViewSignals
- type SliceViewStyleFunc
- type SliceViewer
- type StructFieldVals
- type StructInlineValueView
- type StructValueView
- type StructView
- func (sv *StructView) Config()
- func (sv *StructView) ConfigStructGrid()
- func (sv *StructView) ConfigToolbar()
- func (sv *StructView) Disconnect()
- func (sv *StructView) FieldTags(fld reflect.StructField) reflect.StructTag
- func (sv *StructView) IsConfiged() bool
- func (sv *StructView) Render2D()
- func (sv *StructView) SetStruct(st interface{})
- func (sv *StructView) StructGrid() *gi.Frame
- func (sv *StructView) Style2D()
- func (sv *StructView) ToolBar() *gi.ToolBar
- func (sv *StructView) UpdateDefaults()
- func (sv *StructView) UpdateField(field string)
- func (sv *StructView) UpdateFields()
- type StructViewInline
- type SubMenuFunc
- type TableView
- func (tv *TableView) CacheVisFields()
- func (tv *TableView) Config()
- func (tv *TableView) ConfigSliceGrid()
- func (tv *TableView) ConfigToolbar()
- func (tv *TableView) GridLayout() *gi.Layout
- func (tv *TableView) IsConfiged() bool
- func (tv *TableView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tv *TableView) LayoutHeader()
- func (tv *TableView) LayoutSliceGrid() bool
- func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
- func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase
- func (tv *TableView) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (tv *TableView) ScrollBar() *gi.ScrollBar
- func (tv *TableView) SelectFieldVal(fld, val string) bool
- func (tv *TableView) SelectRowWidgets(row int, sel bool)
- func (tv *TableView) SetSlice(sl interface{})
- func (tv *TableView) SetSortFieldName(nm string)
- func (tv *TableView) SliceDeleteAt(idx int, doupdt bool)
- func (tv *TableView) SliceFrame() *gi.Frame
- func (tv *TableView) SliceGrid() *gi.Frame
- func (tv *TableView) SliceHeader() *gi.ToolBar
- func (tv *TableView) SliceNewAt(idx int)
- func (tv *TableView) SortFieldName() string
- func (tv *TableView) SortSlice()
- func (tv *TableView) SortSliceAction(fldIdx int)
- func (tv *TableView) StructType() reflect.Type
- func (tv *TableView) StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv ValueView)
- func (tv *TableView) ToolBar() *gi.ToolBar
- func (tv *TableView) UpdateSliceGrid()
- type TableViewStyleFunc
- type TextBuf
- func (tb *TextBuf) AddFileNode(fn *FileNode)
- func (tb *TextBuf) AddTag(ln, st, ed int, tag token.Tokens)
- func (tb *TextBuf) AddTagEdit(tbe *textbuf.Edit, tag token.Tokens)
- func (tb *TextBuf) AddView(vw *TextView)
- func (tb *TextBuf) AdjustPos(pos lex.Pos, t time.Time, del textbuf.AdjustPosDel) lex.Pos
- func (tb *TextBuf) AdjustReg(reg textbuf.Region) textbuf.Region
- func (tb *TextBuf) AdjustedTags(ln int) lex.Line
- func (tb *TextBuf) AdjustedTagsImpl(tags lex.Line, ln int) lex.Line
- func (tb *TextBuf) AppendText(text []byte, signal bool) *textbuf.Edit
- func (tb *TextBuf) AppendTextLine(text []byte, signal bool) *textbuf.Edit
- func (tb *TextBuf) AppendTextLineMarkup(text []byte, markup []byte, signal bool) *textbuf.Edit
- func (tb *TextBuf) AppendTextMarkup(text []byte, markup []byte, signal bool) *textbuf.Edit
- func (tb *TextBuf) AutoIndent(ln int) (tbe *textbuf.Edit, indLev, chPos int)
- func (tb *TextBuf) AutoIndentRegion(st, ed int)
- func (tb *TextBuf) AutoSave() error
- func (tb *TextBuf) AutoSaveCheck() bool
- func (tb *TextBuf) AutoSaveDelete()
- func (tb *TextBuf) AutoSaveFilename() string
- func (tb *TextBuf) AutoSaveOff() bool
- func (tb *TextBuf) AutoSaveRestore(asv bool)
- func (tb *TextBuf) AutoScrollViews()
- func (tb *TextBuf) BatchUpdateEnd(bufUpdt, winUpdt, autoSave bool)
- func (tb *TextBuf) BatchUpdateStart() (bufUpdt, winUpdt, autoSave bool)
- func (tb *TextBuf) BraceMatch(r rune, st lex.Pos) (en lex.Pos, found bool)
- func (tb *TextBuf) BytesLine(ln int) []byte
- func (tb *TextBuf) BytesToLines()
- func (tb *TextBuf) ClearChanged()
- func (tb *TextBuf) Close(afterFun func(canceled bool)) bool
- func (tb *TextBuf) CommentRegion(st, ed int)
- func (tb *TextBuf) CommentStart(ln int) int
- func (tb *TextBuf) CompleteExtend(s string)
- func (tb *TextBuf) CompleteText(s string)
- func (tb *TextBuf) ConfigSupported() bool
- func (tb *TextBuf) CorrectClear(s string)
- func (tb *TextBuf) CorrectText(s string)
- func (tb *TextBuf) Defaults()
- func (tb *TextBuf) DeleteCompleter()
- func (tb *TextBuf) DeleteLineColor(ln int)
- func (tb *TextBuf) DeleteLineIcon(ln int)
- func (tb *TextBuf) DeleteSpell()
- func (tb *TextBuf) DeleteText(st, ed lex.Pos, signal bool) *textbuf.Edit
- func (tb *TextBuf) DeleteTextImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *TextBuf) DeleteTextRect(st, ed lex.Pos, signal bool) *textbuf.Edit
- func (tb *TextBuf) DeleteTextRectImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *TextBuf) DeleteView(vw *TextView)
- func (tb *TextBuf) DiffBufs(ob *TextBuf) textbuf.Diffs
- func (tb *TextBuf) DiffBufsUnified(ob *TextBuf, context int) []byte
- func (tb *TextBuf) Disconnect()
- func (tb *TextBuf) EditDone()
- func (tb *TextBuf) EmacsUndoSave()
- func (tb *TextBuf) EndPos() lex.Pos
- func (tb *TextBuf) FileModCheck() bool
- func (tb *TextBuf) HasLineColor(ln int) bool
- func (tb *TextBuf) HiTagAtPos(pos lex.Pos) (*lex.Lex, int)
- func (tb *TextBuf) InComment(pos lex.Pos) bool
- func (tb *TextBuf) InLitString(pos lex.Pos) bool
- func (tb *TextBuf) InTokenCode(pos lex.Pos) bool
- func (tb *TextBuf) InTokenSubCat(pos lex.Pos, subCat token.Tokens) bool
- func (tb *TextBuf) IndentLine(ln, ind int) *textbuf.Edit
- func (tb *TextBuf) InitialMarkup()
- func (tb *TextBuf) InsertText(st lex.Pos, text []byte, signal bool) *textbuf.Edit
- func (tb *TextBuf) InsertTextImpl(st lex.Pos, text []byte) *textbuf.Edit
- func (tb *TextBuf) InsertTextRect(tbe *textbuf.Edit, signal bool) *textbuf.Edit
- func (tb *TextBuf) InsertTextRectImpl(tbe *textbuf.Edit) *textbuf.Edit
- func (tb *TextBuf) IsChanged() bool
- func (tb *TextBuf) IsMarkingUp() bool
- func (tb *TextBuf) IsSpellEnabled(pos lex.Pos) bool
- func (tb *TextBuf) IsValidLine(ln int) bool
- func (tb *TextBuf) JoinParaLines(stLn, edLn int)
- func (tb *TextBuf) LexObjPathString(ln int, lx *lex.Lex) string
- func (tb *TextBuf) LexString(ln int, lx *lex.Lex) string
- func (tb *TextBuf) Line(ln int) []rune
- func (tb *TextBuf) LineCommented(ln int) bool
- func (tb *TextBuf) LineLen(ln int) int
- func (tb *TextBuf) LinesDeleted(tbe *textbuf.Edit)
- func (tb *TextBuf) LinesEdited(tbe *textbuf.Edit)
- func (tb *TextBuf) LinesInserted(tbe *textbuf.Edit)
- func (tb *TextBuf) LinesToBytes()
- func (tb *TextBuf) LinesToBytesCopy() []byte
- func (tb *TextBuf) MarkupAllLines(maxLines int)
- func (tb *TextBuf) MarkupFromTags()
- func (tb *TextBuf) MarkupLine(ln int)
- func (tb *TextBuf) MarkupLines(st, ed int) bool
- func (tb *TextBuf) MarkupLinesLock(st, ed int) bool
- func (tb *TextBuf) New(nlines int)
- func (tb *TextBuf) NumLines() int
- func (tb *TextBuf) Open(filename gi.FileName) error
- func (tb *TextBuf) OpenFile(filename gi.FileName) error
- func (tb *TextBuf) PatchFromBuf(ob *TextBuf, diffs textbuf.Diffs, signal bool) bool
- func (tb *TextBuf) ReMarkup()
- func (tb *TextBuf) Redo() *textbuf.Edit
- func (tb *TextBuf) Refresh()
- func (tb *TextBuf) RefreshViews()
- func (tb *TextBuf) Region(st, ed lex.Pos) *textbuf.Edit
- func (tb *TextBuf) RegionImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *TextBuf) RegionRect(st, ed lex.Pos) *textbuf.Edit
- func (tb *TextBuf) RegionRectImpl(st, ed lex.Pos) *textbuf.Edit
- func (tb *TextBuf) RemoveTag(pos lex.Pos, tag token.Tokens) (reg lex.Lex, ok bool)
- func (tb *TextBuf) ReplaceText(delSt, delEd, insPos lex.Pos, insTxt string, signal, matchCase bool) *textbuf.Edit
- func (tb *TextBuf) Revert() bool
- func (tb *TextBuf) Save() error
- func (tb *TextBuf) SaveAs(filename gi.FileName)
- func (tb *TextBuf) SaveAsFunc(filename gi.FileName, afterFunc func(canceled bool))
- func (tb *TextBuf) SaveFile(filename gi.FileName) error
- func (tb *TextBuf) SavePosHistory(pos lex.Pos) bool
- func (tb *TextBuf) SaveUndo(tbe *textbuf.Edit)
- func (tb *TextBuf) Search(find []byte, ignoreCase, lexItems bool) (int, []textbuf.Match)
- func (tb *TextBuf) SearchRegexp(re *regexp.Regexp) (int, []textbuf.Match)
- func (tb *TextBuf) SetByteOffs()
- func (tb *TextBuf) SetChanged()
- func (tb *TextBuf) SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc, ...)
- func (tb *TextBuf) SetHiStyle(style gi.HiStyleName)
- func (tb *TextBuf) SetInactive(inactive bool)
- func (tb *TextBuf) SetLineColor(ln int, color string)
- func (tb *TextBuf) SetLineIcon(ln int, icon string)
- func (tb *TextBuf) SetSpell()
- func (tb *TextBuf) SetText(txt []byte)
- func (tb *TextBuf) SetTextLines(lns [][]byte, cpy bool)
- func (tb *TextBuf) SpellCheckLineErrs(ln int) lex.Line
- func (tb *TextBuf) SpellCheckLineTag(ln int)
- func (tb *TextBuf) StartDelayedReMarkup()
- func (tb *TextBuf) Stat() error
- func (tb *TextBuf) StopDelayedReMarkup()
- func (tb *TextBuf) Strings(addNewLn bool) []string
- func (tb *TextBuf) TagAt(pos lex.Pos) (reg lex.Lex, ok bool)
- func (tb *TextBuf) Text() []byte
- func (tb *TextBuf) Undo() *textbuf.Edit
- func (tb *TextBuf) ValidPos(pos lex.Pos) lex.Pos
- func (tb *TextBuf) ViewportFromView() *gi.Viewport2D
- type TextBufFlags
- type TextBufList
- type TextBufSignals
- type TextView
- func (tv *TextView) AutoScroll(pos image.Point) bool
- func (tv *TextView) CancelComplete()
- func (tv *TextView) CancelCorrect()
- func (tv *TextView) CharEndPos(pos lex.Pos) mat32.Vec2
- func (tv *TextView) CharStartPos(pos lex.Pos) mat32.Vec2
- func (tv *TextView) Clear()
- func (tv *TextView) ClearHighlights()
- func (tv *TextView) ClearNeedsRefresh()
- func (tv *TextView) ClearScopelights()
- func (tv *TextView) ClearSelected()
- func (tv *TextView) ConnectEvents2D()
- func (tv *TextView) ContextMenu()
- func (tv *TextView) ContextMenuPos() (pos image.Point)
- func (tv *TextView) Copy(reset bool) *textbuf.Edit
- func (tv *TextView) CopyRect(reset bool) *textbuf.Edit
- func (tv *TextView) CursorBBox(pos lex.Pos) image.Rectangle
- func (tv *TextView) CursorBackspace(steps int)
- func (tv *TextView) CursorBackspaceWord(steps int)
- func (tv *TextView) CursorBackward(steps int)
- func (tv *TextView) CursorBackwardWord(steps int)
- func (tv *TextView) CursorDelete(steps int)
- func (tv *TextView) CursorDeleteWord(steps int)
- func (tv *TextView) CursorDown(steps int)
- func (tv *TextView) CursorEndDoc()
- func (tv *TextView) CursorEndLine()
- func (tv *TextView) CursorForward(steps int)
- func (tv *TextView) CursorForwardWord(steps int)
- func (tv *TextView) CursorKill()
- func (tv *TextView) CursorMovedSig()
- func (tv *TextView) CursorNextLink(wraparound bool) bool
- func (tv *TextView) CursorPageDown(steps int)
- func (tv *TextView) CursorPageUp(steps int)
- func (tv *TextView) CursorPrevLink(wraparound bool) bool
- func (tv *TextView) CursorRecenter()
- func (tv *TextView) CursorSelect(org lex.Pos)
- func (tv *TextView) CursorSprite() *gi.Sprite
- func (tv *TextView) CursorSpriteName() string
- func (tv *TextView) CursorStartDoc()
- func (tv *TextView) CursorStartLine()
- func (tv *TextView) CursorToHistNext() bool
- func (tv *TextView) CursorToHistPrev() bool
- func (tv *TextView) CursorTranspose()
- func (tv *TextView) CursorTransposeWord()
- func (tv *TextView) CursorUp(steps int)
- func (tv *TextView) Cut() *textbuf.Edit
- func (tv *TextView) CutRect() *textbuf.Edit
- func (tv *TextView) DeleteSelection() *textbuf.Edit
- func (tv *TextView) Disconnect()
- func (tv *TextView) EditDone()
- func (tv *TextView) EscPressed()
- func (tv *TextView) FindMatches(find string, useCase, lexItems bool) ([]textbuf.Match, bool)
- func (tv *TextView) FindNextLink(pos lex.Pos) (lex.Pos, textbuf.Region, bool)
- func (tv *TextView) FindPrevLink(pos lex.Pos) (lex.Pos, textbuf.Region, bool)
- func (tv *TextView) FirstVisibleLine(stln int) int
- func (tv *TextView) FocusChanged2D(change gi.FocusChanges)
- func (tv *TextView) HasLineNos() bool
- func (tv *TextView) HasSelection() bool
- func (tv *TextView) HiStyle()
- func (tv *TextView) HighlightRegion(reg textbuf.Region)
- func (tv *TextView) ISearchBackspace()
- func (tv *TextView) ISearchCancel()
- func (tv *TextView) ISearchKeyInput(kt *key.ChordEvent)
- func (tv *TextView) ISearchMatches() bool
- func (tv *TextView) ISearchNextMatch(cpos lex.Pos) bool
- func (tv *TextView) ISearchSelectMatch(midx int)
- func (tv *TextView) ISearchSig()
- func (tv *TextView) ISearchStart()
- func (tv *TextView) ISpellKeyInput(kt *key.ChordEvent)
- func (tv *TextView) Init2D()
- func (tv *TextView) InsertAtCursor(txt []byte)
- func (tv *TextView) IsChanged() bool
- func (tv *TextView) IsFocusActive() bool
- func (tv *TextView) IsWordEnd(tp lex.Pos) bool
- func (tv *TextView) IsWordMiddle(tp lex.Pos) bool
- func (tv *TextView) IsWordStart(tp lex.Pos) bool
- func (tv *TextView) JumpToLine(ln int)
- func (tv *TextView) JumpToLinePrompt()
- func (tv *TextView) KeyInput(kt *key.ChordEvent)
- func (tv *TextView) KeyInputInsertBra(kt *key.ChordEvent)
- func (tv *TextView) KeyInputInsertRune(kt *key.ChordEvent)
- func (tv *TextView) LastVisibleLine(stln int) int
- func (tv *TextView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tv *TextView) LayoutAllLines(inLayout bool) bool
- func (tv *TextView) LayoutLines(st, ed int, isDel bool) bool
- func (tv *TextView) LinesDeleted(tbe *textbuf.Edit)
- func (tv *TextView) LinesInserted(tbe *textbuf.Edit)
- func (tv *TextView) LinkAt(pos lex.Pos) (*gi.TextLink, bool)
- func (tv *TextView) Lookup()
- func (tv *TextView) MakeContextMenu(m *gi.Menu)
- func (tv *TextView) MatchFromPos(matches []textbuf.Match, cpos lex.Pos) (int, bool)
- func (tv *TextView) MouseDragEvent()
- func (tv *TextView) MouseEvent(me *mouse.Event)
- func (tv *TextView) MouseFocusEvent()
- func (tv *TextView) MouseMoveEvent()
- func (tv *TextView) NeedsRefresh() bool
- func (tv *TextView) OfferComplete()
- func (tv *TextView) OfferCorrect() bool
- func (tv *TextView) OpenLink(tl *gi.TextLink)
- func (tv *TextView) OpenLinkAt(pos lex.Pos) (*gi.TextLink, bool)
- func (tv *TextView) ParentLayout() *gi.Layout
- func (tv *TextView) Paste()
- func (tv *TextView) PasteHist()
- func (tv *TextView) PasteRect()
- func (tv *TextView) PixelToCursor(pt image.Point) lex.Pos
- func (tv *TextView) QReplaceCancel()
- func (tv *TextView) QReplaceKeyInput(kt *key.ChordEvent)
- func (tv *TextView) QReplaceMatches() bool
- func (tv *TextView) QReplaceNextMatch() bool
- func (tv *TextView) QReplacePrompt()
- func (tv *TextView) QReplaceReplace(midx int)
- func (tv *TextView) QReplaceReplaceAll(midx int)
- func (tv *TextView) QReplaceSelectMatch(midx int)
- func (tv *TextView) QReplaceSig()
- func (tv *TextView) QReplaceStart(find, repl string, lexItems bool)
- func (tv *TextView) ReCaseSelection(c textbuf.Cases) string
- func (tv *TextView) ReMarkup()
- func (tv *TextView) Redo()
- func (tv *TextView) Refresh()
- func (tv *TextView) RefreshIfNeeded() bool
- func (tv *TextView) Render2D()
- func (tv *TextView) RenderAllLines()
- func (tv *TextView) RenderAllLinesInBounds()
- func (tv *TextView) RenderCursor(on bool)
- func (tv *TextView) RenderDepthBg(stln, edln int)
- func (tv *TextView) RenderHighlights(stln, edln int)
- func (tv *TextView) RenderLineNo(ln int, defFill bool, vpUpload bool)
- func (tv *TextView) RenderLineNosBox(st, ed int)
- func (tv *TextView) RenderLineNosBoxAll()
- func (tv *TextView) RenderLines(st, ed int) bool
- func (tv *TextView) RenderRegionBox(reg textbuf.Region, state TextViewStates)
- func (tv *TextView) RenderRegionBoxSty(reg textbuf.Region, sty *gi.Style, bgclr *gi.ColorSpec)
- func (tv *TextView) RenderRegionToEnd(st lex.Pos, sty *gi.Style, bgclr *gi.ColorSpec)
- func (tv *TextView) RenderScopelights(stln, edln int)
- func (tv *TextView) RenderScrolls()
- func (tv *TextView) RenderSelect()
- func (tv *TextView) RenderSelectLines()
- func (tv *TextView) RenderSize() mat32.Vec2
- func (tv *TextView) RenderStartPos() mat32.Vec2
- func (tv *TextView) ResetState()
- func (tv *TextView) ResizeIfNeeded(nwSz image.Point) bool
- func (tv *TextView) SavePosHistory(pos lex.Pos)
- func (tv *TextView) ScrollCursorInView() bool
- func (tv *TextView) ScrollCursorToBottom() bool
- func (tv *TextView) ScrollCursorToCenterIfHidden() bool
- func (tv *TextView) ScrollCursorToHorizCenter() bool
- func (tv *TextView) ScrollCursorToLeft() bool
- func (tv *TextView) ScrollCursorToRight() bool
- func (tv *TextView) ScrollCursorToTop() bool
- func (tv *TextView) ScrollCursorToVertCenter() bool
- func (tv *TextView) ScrollInView(bbox image.Rectangle) bool
- func (tv *TextView) ScrollToBottom(pos int) bool
- func (tv *TextView) ScrollToHorizCenter(pos int) bool
- func (tv *TextView) ScrollToLeft(pos int) bool
- func (tv *TextView) ScrollToRight(pos int) bool
- func (tv *TextView) ScrollToTop(pos int) bool
- func (tv *TextView) ScrollToVertCenter(pos int) bool
- func (tv *TextView) SelectAll()
- func (tv *TextView) SelectModeToggle()
- func (tv *TextView) SelectRegUpdate(pos lex.Pos)
- func (tv *TextView) SelectReset()
- func (tv *TextView) SelectWord() bool
- func (tv *TextView) Selection() *textbuf.Edit
- func (tv *TextView) SetBuf(buf *TextBuf)
- func (tv *TextView) SetCursor(pos lex.Pos)
- func (tv *TextView) SetCursorCol(pos lex.Pos)
- func (tv *TextView) SetCursorFromMouse(pt image.Point, newPos lex.Pos, selMode mouse.SelectModes)
- func (tv *TextView) SetCursorShow(pos lex.Pos)
- func (tv *TextView) SetNeedsRefresh()
- func (tv *TextView) SetSize() bool
- func (tv *TextView) ShiftSelect(kt *key.ChordEvent)
- func (tv *TextView) ShiftSelectExtend(kt *key.ChordEvent)
- func (tv *TextView) Size2D(iter int)
- func (tv *TextView) SpellCheck(reg *textbuf.Edit) bool
- func (tv *TextView) StartCursor()
- func (tv *TextView) StopCursor()
- func (tv *TextView) Style2D()
- func (tv *TextView) StyleTextView()
- func (tv *TextView) TextViewEvents()
- func (tv *TextView) Undo()
- func (tv *TextView) UpdateHighlights(prev []textbuf.Region)
- func (tv *TextView) ValidateCursor()
- func (tv *TextView) VisSizes()
- func (tv *TextView) WordAt() (reg textbuf.Region)
- func (tv *TextView) WordBefore(tp lex.Pos) *textbuf.Edit
- func (tv *TextView) WrappedLineNo(pos lex.Pos) (si, ri int, ok bool)
- func (tv *TextView) WrappedLines(ln int) int
- type TextViewFlags
- type TextViewSignals
- type TextViewStates
- type TimeValueView
- type TreeView
- func (tv *TreeView) BBox2D() image.Rectangle
- func (tv *TreeView) BranchPart() (*gi.CheckBox, bool)
- func (tv *TreeView) ChildrenBBox2D() image.Rectangle
- func (tv *TreeView) Close()
- func (tv *TreeView) CloseAll()
- func (tv *TreeView) ConfigParts()
- func (tv *TreeView) ConfigPartsIfNeeded()
- func (tv *TreeView) ConnectEvents2D()
- func (tv *TreeView) ContextMenuPos() (pos image.Point)
- func (tv *TreeView) Copy(reset bool)
- func (tv *TreeView) Cut()
- func (tv *TreeView) Disconnect()
- func (tv *TreeView) DragNDropExternal(de *dnd.Event)
- func (tv *TreeView) DragNDropFinalize(mod dnd.DropMods)
- func (tv *TreeView) DragNDropFinalizeDefMod()
- func (tv *TreeView) DragNDropStart()
- func (tv *TreeView) DragNDropTarget(de *dnd.Event)
- func (tv *TreeView) Dragged(de *dnd.Event)
- func (tv *TreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) DropAfter(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) DropAssign(md mimedata.Mimes)
- func (tv *TreeView) DropBefore(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) DropCancel()
- func (tv *TreeView) DropChildren(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) DropExternal(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) FocusChanged2D(change gi.FocusChanges)
- func (tv *TreeView) HasClosedParent() bool
- func (tv *TreeView) IconPart() (*gi.Icon, bool)
- func (tv *TreeView) Init2D()
- func (tv *TreeView) IsChanged() bool
- func (tv *TreeView) IsClosed() bool
- func (tv *TreeView) IsRootOrField(op string) bool
- func (tv *TreeView) IsVisible() bool
- func (tv *TreeView) KeyInput(kt *key.ChordEvent)
- func (tv *TreeView) Label() string
- func (tv *TreeView) LabelPart() (*gi.Label, bool)
- func (tv *TreeView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tv *TreeView) Layout2DParts(parBBox image.Rectangle, iter int)
- func (tv *TreeView) MakeContextMenu(m *gi.Menu)
- func (tv *TreeView) MakeDropMenu(m *gi.Menu, data interface{}, mod dnd.DropMods)
- func (tv *TreeView) MakePasteMenu(m *gi.Menu, data interface{})
- func (tv *TreeView) MimeData(md *mimedata.Mimes)
- func (tv *TreeView) MoveDown(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveDownAction(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveDownSibling(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveEndAction(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveHomeAction(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MovePageDownAction(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MovePageUpAction(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveToLastChild(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveUp(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) MoveUpAction(selMode mouse.SelectModes) *TreeView
- func (tv *TreeView) NodesFromMimeData(md mimedata.Mimes) ki.Slice
- func (tv *TreeView) Open()
- func (tv *TreeView) OpenAll()
- func (tv *TreeView) Paste()
- func (tv *TreeView) PasteAfter(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) PasteAssign(md mimedata.Mimes)
- func (tv *TreeView) PasteAt(md mimedata.Mimes, mod dnd.DropMods, rel int, actNm string)
- func (tv *TreeView) PasteBefore(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) PasteChildren(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TreeView) PasteMenu(md mimedata.Mimes)
- func (tv *TreeView) PushBounds() bool
- func (tv *TreeView) Render2D()
- func (tv *TreeView) RootIsInactive() bool
- func (tv *TreeView) RootTreeView() *TreeView
- func (tv *TreeView) Select()
- func (tv *TreeView) SelectAction(mode mouse.SelectModes) bool
- func (tv *TreeView) SelectAll()
- func (tv *TreeView) SelectMode() bool
- func (tv *TreeView) SelectModeToggle()
- func (tv *TreeView) SelectUpdate(mode mouse.SelectModes) bool
- func (tv *TreeView) SelectedSrcNodes() ki.Slice
- func (tv *TreeView) SelectedViews() []*TreeView
- func (tv *TreeView) SetChanged()
- func (tv *TreeView) SetClosed()
- func (tv *TreeView) SetClosedState(closed bool)
- func (tv *TreeView) SetOpen()
- func (tv *TreeView) SetRootNode(sk ki.Ki)
- func (tv *TreeView) SetSelectMode(selMode bool)
- func (tv *TreeView) SetSelectedViews(sl []*TreeView)
- func (tv *TreeView) SetSrcNode(sk ki.Ki, tvIdx *int, init bool, depth int)
- func (tv *TreeView) Size2D(iter int)
- func (tv *TreeView) SrcAddChild()
- func (tv *TreeView) SrcDelete()
- func (tv *TreeView) SrcDuplicate()
- func (tv *TreeView) SrcEdit()
- func (tv *TreeView) SrcGoGiEditor()
- func (tv *TreeView) SrcInsertAfter()
- func (tv *TreeView) SrcInsertAt(rel int, actNm string)
- func (tv *TreeView) SrcInsertBefore()
- func (tv *TreeView) Style2D()
- func (tv *TreeView) StyleTreeView()
- func (tv *TreeView) SyncToSrc(tvIdx *int, init bool, depth int)
- func (tv *TreeView) ToggleClose()
- func (tv *TreeView) TreeViewEvents()
- func (tv *TreeView) TreeViewParent() *TreeView
- func (tv *TreeView) Unselect()
- func (tv *TreeView) UnselectAction()
- func (tv *TreeView) UnselectAll()
- func (tv *TreeView) UpdateInactive() bool
- type TreeViewFlags
- type TreeViewSignals
- type TreeViewStates
- type TwinTextViews
- type TypeValueView
- type VCSLogView
- func (lv *VCSLogView) Config(repo vci.Repo, lg vci.Log, file, since string)
- func (lv *VCSLogView) ConfigToolBar()
- func (lv *VCSLogView) SetRevA(rev string)
- func (lv *VCSLogView) SetRevB(rev string)
- func (lv *VCSLogView) TableView() *TableView
- func (lv *VCSLogView) ToggleRev()
- func (lv *VCSLogView) ToolBar() *gi.ToolBar
- type ValueView
- type ValueViewBase
- func (vv *ValueViewBase) Activate(vp *gi.Viewport2D, recv ki.Ki, fun ki.RecvFunc)
- func (vv *ValueViewBase) AllTags() map[string]string
- func (vv *ValueViewBase) AsValueViewBase() *ValueViewBase
- func (vv *ValueViewBase) ConfigWidget(widg gi.Node2D)
- func (vv *ValueViewBase) CreateTempIfNotPtr() bool
- func (vv *ValueViewBase) Disconnect()
- func (vv *ValueViewBase) HasAction() bool
- func (vv *ValueViewBase) IsInactive() bool
- func (vv *ValueViewBase) Label() (label, newPath string, isZero bool)
- func (vv *ValueViewBase) OwnerKind() reflect.Kind
- func (vv *ValueViewBase) OwnerLabel() string
- func (vv *ValueViewBase) SaveTmp()
- func (vv *ValueViewBase) SetMapKey(key reflect.Value, owner interface{}, tmpSave ValueView)
- func (vv *ValueViewBase) SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, ...)
- func (vv *ValueViewBase) SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView, ...)
- func (vv *ValueViewBase) SetSoloValue(val reflect.Value)
- func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, ...)
- func (vv *ValueViewBase) SetTag(tag, value string)
- func (vv *ValueViewBase) SetTags(tags map[string]string)
- func (vv *ValueViewBase) SetValue(val interface{}) bool
- func (vv *ValueViewBase) StdConfigWidget(widg gi.Node2D)
- func (vv *ValueViewBase) Tag(tag string) (string, bool)
- func (vv *ValueViewBase) UpdateWidget()
- func (vv *ValueViewBase) Val() reflect.Value
- func (vv *ValueViewBase) WidgetType() reflect.Type
- type ValueViewFunc
- type ValueViewer
- type VersCtrlName
- type VersCtrlValueView
- type ViewIFace
- func (vi *ViewIFace) CtxtMenuView(val interface{}, inactive bool, vp *gi.Viewport2D, menu *gi.Menu) bool
- func (vi *ViewIFace) GoGiEditor(obj ki.Ki)
- func (vi *ViewIFace) HiStyleInit()
- func (vi *ViewIFace) HiStylesView(std bool)
- func (vi *ViewIFace) KeyMapsView(maps *gi.KeyMaps)
- func (vi *ViewIFace) PrefsDbgView(prefs *gi.PrefsDebug)
- func (vi *ViewIFace) PrefsDetApply(pf *gi.PrefsDetailed)
- func (vi *ViewIFace) PrefsDetDefaults(pf *gi.PrefsDetailed)
- func (vi *ViewIFace) PrefsDetView(prefs *gi.PrefsDetailed)
- func (vi *ViewIFace) PrefsView(prefs *gi.Preferences)
- func (vi *ViewIFace) SetHiStyleDefault(hsty gi.HiStyleName)
Constants ¶
const ( // EditSignal is used as an arg for edit methods with a signal arg, indicating // that a signal should be emitted. EditSignal = true // EditNoSignal is used as an arg for edit methods with a signal arg, indicating // that a signal should NOT be emitted. EditNoSignal = false // ReplaceMatchCase is used for MatchCase arg in ReplaceText method ReplaceMatchCase = true // ReplaceNoMatchCase is used for MatchCase arg in ReplaceText method ReplaceNoMatchCase = false )
const ( // TreeViewSelProp is a slice of tree views that are currently selected // -- much more efficient to update the list rather than regenerate it, // especially for a large tree TreeViewSelProp = "__SelectedList" // TreeViewSelModeProp is a bool that, if true, automatically selects nodes // when nodes are moved to via keyboard actions TreeViewSelModeProp = "__SelectMode" )
These are special properties established on the RootView for maintaining overall tree state
const (
// FileTreeExtFilesName is the name of the node that represents external files
FileTreeExtFilesName = "[external files]"
)
Variables ¶
var ArgViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "max-width": -1, "max-height": -1, "#title": ki.Props{ "max-width": -1, "text-align": gi.AlignCenter, "vertical-align": gi.AlignTop, }, }
var AvailColorMaps = map[string]*ColorMap{}
AvailColorMaps is the list of all available color maps
var ColorViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, }
var DefaultTimeFormat = "2006-01-02 15:04:05 MST"
var DiffViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "max-width": -1, "max-height": -1, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "CallMethods": ki.PropSlice{ {"SaveFileA", ki.Props{ "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "FileA", }}, }, }}, {"SaveFileB", ki.Props{ "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "FileB", }}, }, }}, }, }
DiffViewProps are style properties for DiffView
var FileInfoProps = ki.Props{ "CtxtMenu": ki.PropSlice{ {"Duplicate", ki.Props{ "updtfunc": ActionUpdateFunc(func(fii interface{}, act *gi.Action) { fi := fii.(*FileInfo) act.SetInactiveState(fi.IsDir()) }), }}, {"Delete", ki.Props{ "desc": "Ok to delete this file? This is not undoable and is not moving to trash / recycle bin", "confirm": true, "updtfunc": ActionUpdateFunc(func(fii interface{}, act *gi.Action) { fi := fii.(*FileInfo) act.SetInactiveState(fi.IsDir()) }), }}, {"Rename", ki.Props{ "desc": "Rename file to new file name", "Args": ki.PropSlice{ {"New Name", ki.Props{ "default-field": "Name", }}, }, }}, }, }
var FileNodeHiStyle = histyle.StyleDefault
FileNodeHiStyle is the default style for syntax highlighting to use for file node buffers
var FileNodeProps = ki.Props{ "EnumType:Flag": KiT_FileNodeFlags, "CallMethods": ki.PropSlice{ {"RenameFile", ki.Props{ "label": "Rename...", "desc": "Rename file to new file name", "Args": ki.PropSlice{ {"New Name", ki.Props{ "width": 60, "default-field": "Nm", }}, }, }}, {"OpenFileWith", ki.Props{ "label": "Open With...", "desc": "Open the file with given command...", "Args": ki.PropSlice{ {"Command", ki.Props{ "width": 60, }}, }, }}, {"NewFile", ki.Props{ "label": "New File...", "desc": "Create a new file in this folder", "Args": ki.PropSlice{ {"File Name", ki.Props{ "width": 60, }}, {"Add To Version Control", ki.Props{}}, }, }}, {"NewFolder", ki.Props{ "label": "New Folder...", "desc": "Create a new folder within this folder", "Args": ki.PropSlice{ {"Folder Name", ki.Props{ "width": 60, }}, }, }}, {"CommitToVcs", ki.Props{ "label": "Commit to Vcs...", "desc": "Commit this file to version control", "Args": ki.PropSlice{ {"Message", ki.Props{ "width": 60, }}, }, }}, }, }
var FileTreeActiveDirFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { act.SetActiveState(fn.IsDir() && !fn.IsExternal()) } })
FileTreeActiveDirFunc is an ActionUpdateFunc that activates action if node is a dir
var FileTreeActiveExternFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { act.SetActiveState(fn.IsExternal() && !fn.IsIrregular()) } })
FileTreeActiveExternFunc is an ActionUpdateFunc that activates action if node is external
var FileTreeActiveInVcsFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { repo, _ := fn.Repo() if repo == nil || fn.IsDir() { act.SetActiveState((false)) return } act.SetActiveState((fn.Info.Vcs >= vci.Stored)) } })
FileTreeActiveInVcsFunc is an ActionUpdateFunc that activates action if node is under version control
var FileTreeActiveInVcsModifiedFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { repo, _ := fn.Repo() if repo == nil || fn.IsDir() { act.SetActiveState((false)) return } act.SetActiveState((fn.Info.Vcs == vci.Modified || fn.Info.Vcs == vci.Added)) } })
FileTreeActiveInVcsModifiedFunc is an ActionUpdateFunc that activates action if node is under version control and the file has been modified
var FileTreeActiveNotInVcsFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { repo, _ := fn.Repo() if repo == nil || fn.IsDir() { act.SetActiveState((false)) return } act.SetActiveState((fn.Info.Vcs == vci.Untracked)) } })
FileTreeActiveNotInVcsFunc is an ActionUpdateFunc that inactivates action if node is not under version control
var FileTreeInactiveDirFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { act.SetInactiveState(fn.IsDir() || fn.IsExternal()) } })
FileTreeInactiveDirFunc is an ActionUpdateFunc that inactivates action if node is a dir
var FileTreeInactiveExternFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() if fn != nil { act.SetInactiveState(fn.IsExternal()) } })
FileTreeInactiveExternFunc is an ActionUpdateFunc that inactivates action if node is external
var FileTreeProps = ki.Props{ "EnumType:Flag": KiT_FileNodeFlags, }
var FileTreeViewProps = ki.Props{ "EnumType:Flag": KiT_TreeViewFlags, "indent": units.NewCh(2), "spacing": units.NewCh(.5), "border-width": units.NewPx(0), "border-radius": units.NewPx(0), "padding": units.NewPx(0), "margin": units.NewPx(1), "text-align": gi.AlignLeft, "vertical-align": gi.AlignTop, "color": &gi.Prefs.Colors.Font, "background-color": "inherit", "no-templates": true, ".exec": ki.Props{ "font-weight": gi.WeightBold, }, ".open": ki.Props{ "font-style": gi.FontItalic, }, ".untracked": ki.Props{ "color": "#808080", }, ".modified": ki.Props{ "color": "#4b7fd1", }, ".added": ki.Props{ "color": "#008800", }, ".deleted": ki.Props{ "color": "#ff4252", }, ".conflicted": ki.Props{ "color": "#ce8020", }, ".updated": ki.Props{ "color": "#008060", }, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &gi.Prefs.Colors.Icon, "stroke": &gi.Prefs.Colors.Font, }, "#branch": ki.Props{ "icon": "wedge-down", "icon-off": "wedge-right", "margin": units.NewPx(0), "padding": units.NewPx(0), "background-color": color.Transparent, "max-width": units.NewEm(.8), "max-height": units.NewEm(.8), }, "#space": ki.Props{ "width": units.NewEm(.5), }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), "min-width": units.NewCh(16), }, "#menu": ki.Props{ "indicator": "none", }, TreeViewSelectors[TreeViewActive]: ki.Props{}, TreeViewSelectors[TreeViewSel]: ki.Props{ "background-color": &gi.Prefs.Colors.Select, }, TreeViewSelectors[TreeViewFocus]: ki.Props{ "background-color": &gi.Prefs.Colors.Control, }, "CtxtMenuActive": ki.PropSlice{ {"ShowFileInfo", ki.Props{ "label": "File Info", }}, {"OpenFileDefault", ki.Props{ "label": "Open (w/default app)", }}, {"sep-act", ki.BlankProp{}}, {"DuplicateFiles", ki.Props{ "label": "Duplicate", "updtfunc": FileTreeInactiveDirFunc, "shortcut": gi.KeyFunDuplicate, }}, {"DeleteFiles", ki.Props{ "label": "Delete", "desc": "Ok to delete file(s)? This is not undoable and is not moving to trash / recycle bin", "updtfunc": FileTreeInactiveExternFunc, "shortcut": gi.KeyFunDelete, }}, {"RenameFiles", ki.Props{ "label": "Rename", "desc": "Rename file to new file name", "updtfunc": FileTreeInactiveExternFunc, }}, {"sep-open", ki.BlankProp{}}, {"OpenAll", ki.Props{ "updtfunc": FileTreeActiveDirFunc, }}, {"CloseAll", ki.Props{ "updtfunc": FileTreeActiveDirFunc, }}, {"SortBy", ki.Props{ "desc": "Choose how to sort files in the directory -- default by Name, optionally can use Modification Time", "updtfunc": FileTreeActiveDirFunc, "Args": ki.PropSlice{ {"Modification Time", ki.Props{}}, }, }}, {"sep-new", ki.BlankProp{}}, {"NewFile", ki.Props{ "label": "New File...", "desc": "make a new file in this folder", "shortcut": gi.KeyFunInsert, "updtfunc": FileTreeActiveDirFunc, "Args": ki.PropSlice{ {"File Name", ki.Props{ "width": 60, }}, {"Add To Version Control", ki.Props{}}, }, }}, {"NewFolder", ki.Props{ "label": "New Folder...", "desc": "make a new folder within this folder", "shortcut": gi.KeyFunInsertAfter, "updtfunc": FileTreeActiveDirFunc, "Args": ki.PropSlice{ {"Folder Name", ki.Props{ "width": 60, }}, }, }}, {"sep-vcs", ki.BlankProp{}}, {"AddToVcs", ki.Props{ "desc": "Add file to version control", "updtfunc": FileTreeActiveNotInVcsFunc, "label-func": VcsLabelFunc, }}, {"DeleteFromVcs", ki.Props{ "desc": "Delete file from version control", "updtfunc": FileTreeActiveInVcsFunc, "label-func": VcsLabelFunc, }}, {"CommitToVcs", ki.Props{ "desc": "Commit file to version control", "updtfunc": FileTreeActiveInVcsModifiedFunc, "label-func": VcsLabelFunc, }}, {"RevertVcs", ki.Props{ "desc": "Revert file to last commit", "updtfunc": FileTreeActiveInVcsModifiedFunc, "label-func": VcsLabelFunc, }}, {"sep-vcs-log", ki.BlankProp{}}, {"DiffVcs", ki.Props{ "desc": "shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions.", "updtfunc": FileTreeActiveInVcsFunc, "label-func": VcsLabelFunc, "Args": ki.PropSlice{ {"Revision A", ki.Props{}}, {"Revision B", ki.Props{}}, }, }}, {"LogVcs", ki.Props{ "desc": "shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc (SVN only supports a max number of entries). If allFiles is true, then the log will show revisions for all files, not just this one.", "updtfunc": FileTreeActiveInVcsFunc, "label-func": VcsLabelFunc, "Args": ki.PropSlice{ {"All Files", ki.Props{}}, {"Since Date", ki.Props{}}, }, }}, {"BlameVcs", ki.Props{ "desc": "shows the VCS blame report for this file, reporting for each line the revision and author of the last change.", "updtfunc": FileTreeActiveInVcsFunc, "label-func": VcsLabelFunc, }}, {"sep-extrn", ki.BlankProp{}}, {"RemoveFromExterns", ki.Props{ "desc": "Remove file from external files listt", "updtfunc": FileTreeActiveExternFunc, "label-func": VcsLabelFunc, }}, }, }
var FileViewKindColorMap = map[string]string{
"folder": "pref(link)",
}
FileViewKindColorMap translates file Kinds into different colors for the file viewer
var FileViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "color": &gi.Prefs.Colors.Font, "background-color": &gi.Prefs.Colors.Background, "max-width": -1, "max-height": -1, }
var FontChooserSize = 18
show fonts in a bigger size so you can actually see the differences
var FontChooserSizeDots = 18
var GiEditorProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "max-width": -1, "max-height": -1, "#title": ki.Props{ "max-width": -1, "horizontal-align": gi.AlignCenter, "vertical-align": gi.AlignTop, }, "ToolBar": ki.PropSlice{ {"Update", ki.Props{ "icon": "update", "updtfunc": ActionUpdateFunc(func(gei interface{}, act *gi.Action) { ge := gei.(*GiEditor) act.SetActiveStateUpdt(ge.Changed) }), }}, {"sep-file", ki.BlankProp{}}, {"Open", ki.Props{ "label": "Open", "icon": "file-open", "desc": "Open a json-formatted Ki tree structure", "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", "ext": ".json", }}, }, }}, {"Save", ki.Props{ "icon": "file-save", "desc": "Save json-formatted Ki tree structure to existing filename", "updtfunc": ActionUpdateFunc(func(gei interface{}, act *gi.Action) { ge := gei.(*GiEditor) act.SetActiveStateUpdt(ge.Changed && ge.Filename != "") }), }}, {"SaveAs", ki.Props{ "label": "Save As...", "icon": "file-save", "desc": "Save as a json-formatted Ki tree structure", "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", "ext": ".json", }}, }, }}, }, "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"Update", ki.Props{ "updtfunc": ActionUpdateFunc(func(gei interface{}, act *gi.Action) { ge := gei.(*GiEditor) act.SetActiveState(ge.Changed) }), }}, {"sep-file", ki.BlankProp{}}, {"Open", ki.Props{ "shortcut": gi.KeyFunMenuOpen, "desc": "Open a json-formatted Ki tree structure", "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", "ext": ".json", }}, }, }}, {"Save", ki.Props{ "shortcut": gi.KeyFunMenuSave, "desc": "Save json-formatted Ki tree structure to existing filename", "updtfunc": ActionUpdateFunc(func(gei interface{}, act *gi.Action) { ge := gei.(*GiEditor) act.SetActiveState(ge.Changed && ge.Filename != "") }), }}, {"SaveAs", ki.Props{ "shortcut": gi.KeyFunMenuSaveAs, "label": "Save As...", "desc": "Save as a json-formatted Ki tree structure", "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", "ext": ".json", }}, }, }}, {"sep-close", ki.BlankProp{}}, {"Close Window", ki.BlankProp{}}, }}, {"Edit", "Copy Cut Paste Dupe"}, {"Window", "Windows"}, }, }
var KeyChordEditProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "padding": units.NewPx(2), "margin": units.NewPx(2), "vertical-align": gi.AlignTop, "color": &gi.Prefs.Colors.Font, "background-color": &gi.Prefs.Colors.Control, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &gi.Prefs.Colors.Border, "border-style": gi.BorderSolid, "height": units.NewEm(1), "width": units.NewCh(20), "max-width": -1, gi.LabelSelectors[gi.LabelActive]: ki.Props{ "background-color": "lighter-0", }, gi.LabelSelectors[gi.LabelInactive]: ki.Props{ "color": "lighter-50", }, gi.LabelSelectors[gi.LabelSelected]: ki.Props{ "background-color": &gi.Prefs.Colors.Select, }, }
var KiT_ArgDataFlags = kit.Enums.AddEnumAltLower(ArgDataFlagsN, kit.BitFlag, nil, "ArgData")
var KiT_ArgView = kit.Types.AddType(&ArgView{}, ArgViewProps)
var KiT_BitFlagView = kit.Types.AddType(&BitFlagView{}, nil)
var KiT_BoolValueView = kit.Types.AddType(&BoolValueView{}, nil)
var KiT_ByteSliceValueView = kit.Types.AddType(&ByteSliceValueView{}, nil)
var KiT_ColorMapValueView = kit.Types.AddType(&ColorMapValueView{}, nil)
var KiT_ColorMapView = kit.Types.AddType(&ColorMapView{}, nil)
var KiT_ColorNameValueView = kit.Types.AddType(&ColorNameValueView{}, nil)
var KiT_ColorValueView = kit.Types.AddType(&ColorValueView{}, nil)
var KiT_ColorView = kit.Types.AddType(&ColorView{}, ColorViewProps)
var KiT_DiffTextView = kit.Types.AddType(&DiffTextView{}, TextViewProps)
var KiT_DiffView = kit.Types.AddType(&DiffView{}, DiffViewProps)
var KiT_EnumValueView = kit.Types.AddType(&EnumValueView{}, nil)
var KiT_FileInfo = kit.Types.AddType(&FileInfo{}, FileInfoProps)
var KiT_FileNode = kit.Types.AddType(&FileNode{}, FileNodeProps)
var KiT_FileNodeFlags = kit.Enums.AddEnumExt(ki.KiT_Flags, FileNodeFlagsN, kit.BitFlag, nil)
var KiT_FileTree = kit.Types.AddType(&FileTree{}, FileTreeProps)
var KiT_FileTreeView = kit.Types.AddType(&FileTreeView{}, nil)
var KiT_FileValueView = kit.Types.AddType(&FileValueView{}, nil)
var KiT_FileView = kit.Types.AddType(&FileView{}, FileViewProps)
var KiT_FloatValueView = kit.Types.AddType(&FloatValueView{}, nil)
var KiT_FontValueView = kit.Types.AddType(&FontValueView{}, nil)
var KiT_GiEditor = kit.Types.AddType(&GiEditor{}, GiEditorProps)
var KiT_HiStyleValueView = kit.Types.AddType(&HiStyleValueView{}, nil)
var KiT_IconValueView = kit.Types.AddType(&IconValueView{}, nil)
var KiT_IntValueView = kit.Types.AddType(&IntValueView{}, nil)
var KiT_KeyChordEdit = kit.Types.AddType(&KeyChordEdit{}, KeyChordEditProps)
var KiT_KeyChordValueView = kit.Types.AddType(&KeyChordValueView{}, nil)
var KiT_KeyMapValueView = kit.Types.AddType(&KeyMapValueView{}, nil)
var KiT_KiPtrValueView = kit.Types.AddType(&KiPtrValueView{}, nil)
var KiT_MapInlineValueView = kit.Types.AddType(&MapInlineValueView{}, nil)
var KiT_MapValueView = kit.Types.AddType(&MapValueView{}, nil)
var KiT_MapView = kit.Types.AddType(&MapView{}, MapViewProps)
var KiT_MapViewInline = kit.Types.AddType(&MapViewInline{}, MapViewInlineProps)
var KiT_MethViewFlags = kit.Enums.AddEnumAltLower(MethViewFlagsN, kit.BitFlag, nil, "MethView")
var KiT_NilValueView = kit.Types.AddType(&NilValueView{}, nil)
var KiT_RuneSliceValueView = kit.Types.AddType(&RuneSliceValueView{}, nil)
var KiT_SliceInlineValueView = kit.Types.AddType(&SliceInlineValueView{}, nil)
var KiT_SliceValueView = kit.Types.AddType(&SliceValueView{}, nil)
var KiT_SliceView = kit.Types.AddType(&SliceView{}, SliceViewProps)
var KiT_SliceViewBase = kit.Types.AddType(&SliceViewBase{}, nil)
var KiT_SliceViewInline = kit.Types.AddType(&SliceViewInline{}, SliceViewInlineProps)
var KiT_StructInlineValueView = kit.Types.AddType(&StructInlineValueView{}, nil)
var KiT_StructValueView = kit.Types.AddType(&StructValueView{}, nil)
var KiT_StructView = kit.Types.AddType(&StructView{}, StructViewProps)
var KiT_StructViewInline = kit.Types.AddType(&StructViewInline{}, StructViewInlineProps)
var KiT_TableView = kit.Types.AddType(&TableView{}, TableViewProps)
var KiT_TextBuf = kit.Types.AddType(&TextBuf{}, TextBufProps)
var KiT_TextBufFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, TextBufFlagsN, kit.BitFlag, nil)
var KiT_TextView = kit.Types.AddType(&TextView{}, TextViewProps)
var KiT_TextViewFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, TextViewFlagsN, kit.BitFlag, nil)
var KiT_TimeValueView = kit.Types.AddType(&TimeValueView{}, nil)
var KiT_TreeView = kit.Types.AddType(&TreeView{}, nil)
var KiT_TreeViewFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, TreeViewFlagsN, kit.BitFlag, nil)
var KiT_TwinTextViews = kit.Types.AddType(&TwinTextViews{}, TwinTextViewsProps)
var KiT_TypeValueView = kit.Types.AddType(&TypeValueView{}, nil)
var KiT_VCSLogView = kit.Types.AddType(&VCSLogView{}, VCSLogViewProps)
var KiT_ValueViewBase = kit.Types.AddType(&ValueViewBase{}, ValueViewBaseProps)
var KiT_VersCtrlValueView = kit.Types.AddType(&VersCtrlValueView{}, nil)
var MapInlineLen = 3
MapInlineLen is the number of map elements at or below which an inline representation of the map will be presented -- more convenient for small #'s of props
var MapViewInlineProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "min-width": units.NewEx(60), }
var MapViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "max-width": -1, "max-height": -1, }
var MethArgHist = map[string]interface{}{}
MethArgHist stores the history of method arg values -- used for setting defaults for next time the method is called. Key is type:method name
var MethodViewCallMethsProp = "__MethViewCallMeths"
This is the name of the property that holds cached map of compiled callable methods
var PrevISearchString string
PrevISearchString is the previous ISearch string
var PrevQReplaceFinds []string
PrevQReplaceFinds are the previous QReplace strings
var PrevQReplaceRepls []string
PrevQReplaceRepls are the previous QReplace strings
var SliceInlineLen = 6
SliceInlineLen is the number of slice elements below which inline will be used
var SliceViewInlineProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "min-width": units.NewCh(20), }
var SliceViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "max-width": -1, "max-height": -1, }
var StdColorMaps = map[string]*ColorMap{ "ColdHot": &ColorMap{"ColdHot", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 255, 255, 255}, {0, 0, 255, 255}, {127, 127, 127, 255}, {255, 0, 0, 255}, {255, 255, 0, 255}}}, "Jet": &ColorMap{"Jet", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 127, 255}, {0, 0, 255, 255}, {0, 127, 255, 255}, {0, 255, 255, 255}, {127, 255, 127, 255}, {255, 255, 0, 255}, {255, 127, 0, 255}, {255, 0, 0, 255}, {127, 0, 0, 255}}}, "JetMuted": &ColorMap{"JetMuted", gi.Color{200, 200, 200, 255}, []gi.Color{{25, 25, 153, 255}, {25, 102, 230, 255}, {0, 230, 230, 255}, {0, 179, 0, 255}, {230, 230, 0, 255}, {230, 102, 25, 255}, {153, 25, 25, 255}}}, "Viridis": &ColorMap{"Viridis", gi.Color{200, 200, 200, 255}, []gi.Color{{72, 33, 114, 255}, {67, 62, 133, 255}, {56, 87, 140, 255}, {45, 111, 142, 255}, {36, 133, 142, 255}, {30, 155, 138, 255}, {42, 176, 127, 255}, {81, 197, 105, 255}, {134, 212, 73, 255}, {194, 223, 35, 255}, {253, 231, 37, 255}}}, "Plasma": &ColorMap{"Plasma", gi.Color{200, 200, 200, 255}, []gi.Color{{61, 4, 155, 255}, {99, 0, 167, 255}, {133, 6, 166, 255}, {166, 32, 152, 255}, {192, 58, 131, 255}, {213, 84, 110, 255}, {231, 111, 90, 255}, {246, 141, 69, 255}, {253, 174, 50, 255}, {252, 210, 36, 255}, {240, 248, 33, 255}}}, "Inferno": &ColorMap{"Inferno", gi.Color{200, 200, 200, 255}, []gi.Color{{37, 12, 3, 255}, {19, 11, 52, 255}, {57, 9, 99, 255}, {95, 19, 110, 255}, {133, 33, 107, 255}, {169, 46, 94, 255}, {203, 65, 73, 255}, {230, 93, 47, 255}, {247, 131, 17, 255}, {252, 174, 19, 255}, {245, 219, 76, 255}, {252, 254, 164, 255}}}, "BlueBlackRed": &ColorMap{"BlueBlackRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {76, 76, 76, 255}, {255, 0, 0, 255}}}, "BlueGreyRed": &ColorMap{"BlueGreyRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {127, 127, 127, 255}, {255, 0, 0, 255}}}, "BlueWhiteRed": &ColorMap{"BlueWhiteRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {230, 230, 230, 255}, {255, 0, 0, 255}}}, "BlueGreenRed": &ColorMap{"BlueGreenRed", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 255, 255}, {0, 230, 0, 255}, {255, 0, 0, 255}}}, "Rainbow": &ColorMap{"Rainbow", gi.Color{200, 200, 200, 255}, []gi.Color{{255, 0, 255, 255}, {0, 0, 255, 255}, {0, 255, 0, 255}, {255, 255, 0, 255}, {255, 0, 0, 255}}}, "ROYGBIV": &ColorMap{"ROYGBIV", gi.Color{200, 200, 200, 255}, []gi.Color{{255, 0, 255, 255}, {0, 0, 127, 255}, {0, 0, 255, 255}, {0, 255, 0, 255}, {255, 255, 0, 255}, {255, 0, 0, 255}}}, "DarkLight": &ColorMap{"DarkLight", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 0, 255}, {250, 250, 250, 255}}}, "DarkLightDark": &ColorMap{"DarkLightDark", gi.Color{200, 200, 200, 255}, []gi.Color{{0, 0, 0, 255}, {250, 250, 250, 255}, {0, 0, 0, 255}}}, "LightDarkLight": &ColorMap{"DarkLightDark", gi.Color{200, 200, 200, 255}, []gi.Color{{250, 250, 250, 255}, {0, 0, 0, 255}, {250, 250, 250, 255}}}, }
StdColorMaps is a list of standard color maps
var StructInlineLen = 6
StructInlineLen is the number of elemental struct fields at or below which an inline representation of the struct will be presented -- more convenient for small structs
var StructViewInlineProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, }
var StructViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "max-width": -1, "max-height": -1, }
var TVBranchProps = ki.Props{ "fill": &gi.Prefs.Colors.Icon, "stroke": &gi.Prefs.Colors.Font, }
var TableViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "max-width": -1, "max-height": -1, }
var TextBufDiffRevertDiffs = 20
TextBufDiffRevertDiffs is max number of difference regions to apply for diff-based revert otherwise just reopens file
var TextBufDiffRevertLines = 10000
TextBufDiffRevertLines is max number of lines to use the diff-based revert, which results in faster reverts but only if the file isn't too big..
var TextBufMarkupDelayMSec = 1000
TextBufMarkupDelayMSec is the number of milliseconds to wait before starting a new background markup process, after text is entered in the line
var TextBufMaxScopeLines = 100
TextBufMaxScopeLines is the maximum lines to search for a scope marker, e.g. '}'
var TextBufProps = ki.Props{ "EnumType:Flag": KiT_TextBufFlags, "CallMethods": ki.PropSlice{ {"SaveAs", ki.Props{ "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", }}, }, }}, }, }
var TextViewBlinkMu sync.Mutex
TextViewBlinkMu is mutex protecting TextViewBlink updating and access
var TextViewBlinker *time.Ticker
TextViewBlinker is the time.Ticker for blinking cursors for text fields, only one of which can be active at at a time
var TextViewClipHistChooseLen = 40
TextViewClipHistChooseLen is the max length of clip history to show in chooser
var TextViewClipHistMax = 100
Maximum amount of clipboard history to retain
var TextViewClipHistory [][]byte
TextViewClipHistory is the text view clipboard history -- everything that has been copied
var TextViewClipRect *textbuf.Edit
TextViewClipRect is the internal clipboard for Rect rectangle-based regions -- the raw text is posted on the system clipboard but the rect information is in a special format.
var TextViewDepthColors = []gi.Color{
{0, 0, 0, 0},
{5, 5, 0, 0},
{15, 15, 0, 0},
{5, 15, 0, 0},
{0, 15, 5, 0},
{0, 15, 15, 0},
{0, 5, 15, 0},
{5, 0, 15, 0},
{5, 0, 5, 0},
}
TextViewDepthOffsets are changes in color values from default background for different depths. For dark mode, these are increments, for light mode they are decrements.
var TextViewMaxFindHighlights = 1000
TextViewMaxFindHighlights is the maximum number of regions to highlight on find
var TextViewProps = ki.Props{ "EnumType:Flag": KiT_TextViewFlags, "white-space": gi.WhiteSpacePreWrap, "border-width": 0, "cursor-width": units.NewPx(3), "border-color": &gi.Prefs.Colors.Border, "border-style": gi.BorderSolid, "padding": units.NewPx(2), "margin": units.NewPx(2), "vertical-align": gi.AlignTop, "text-align": gi.AlignLeft, "tab-size": 4, "color": &gi.Prefs.Colors.Font, "background-color": &gi.Prefs.Colors.Background, TextViewSelectors[TextViewActive]: ki.Props{ "background-color": "highlight-10", }, TextViewSelectors[TextViewFocus]: ki.Props{ "background-color": "lighter-0", }, TextViewSelectors[TextViewInactive]: ki.Props{ "background-color": "highlight-20", }, TextViewSelectors[TextViewSel]: ki.Props{ "background-color": &gi.Prefs.Colors.Select, }, TextViewSelectors[TextViewHighlight]: ki.Props{ "background-color": &gi.Prefs.Colors.Highlight, }, }
var TextViewSelectors = []string{":active", ":focus", ":inactive", ":selected", ":highlight"}
Style selector names for the different states
var TextViewSpriteName = "giv.TextView.Cursor"
TextViewSpriteName is the name of the window sprite used for the cursor
var TreeViewPageSteps = 10
TreeViewPageSteps is the number of steps to take in PageUp / Down events
var TreeViewProps = ki.Props{ "EnumType:Flag": KiT_TreeViewFlags, "indent": units.NewCh(4), "spacing": units.NewCh(.5), "border-width": units.NewPx(0), "border-radius": units.NewPx(0), "padding": units.NewPx(0), "margin": units.NewPx(1), "text-align": gi.AlignLeft, "vertical-align": gi.AlignTop, "color": &gi.Prefs.Colors.Font, "background-color": "inherit", "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &gi.Prefs.Colors.Icon, "stroke": &gi.Prefs.Colors.Font, }, "#branch": ki.Props{ "icon": "wedge-down", "icon-off": "wedge-right", "margin": units.NewPx(0), "padding": units.NewPx(0), "background-color": color.Transparent, "max-width": units.NewEm(.8), "max-height": units.NewEm(.8), }, "#space": ki.Props{ "width": units.NewEm(0.5), }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), "min-width": units.NewCh(16), }, "#menu": ki.Props{ "indicator": "none", }, TreeViewSelectors[TreeViewActive]: ki.Props{}, TreeViewSelectors[TreeViewSel]: ki.Props{ "background-color": &gi.Prefs.Colors.Select, }, TreeViewSelectors[TreeViewFocus]: ki.Props{ "background-color": &gi.Prefs.Colors.Control, }, TreeViewSelectors[TreeViewInactive]: ki.Props{ "background-color": "highlight-10", }, "CtxtMenuActive": ki.PropSlice{ {"SrcAddChild", ki.Props{ "label": "Add Child", }}, {"SrcInsertBefore", ki.Props{ "label": "Insert Before", "shortcut": gi.KeyFunInsert, "updtfunc": ActionUpdateFunc(func(tvi interface{}, act *gi.Action) { tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView) act.SetInactiveState(tv.IsRootOrField("")) }), }}, {"SrcInsertAfter", ki.Props{ "label": "Insert After", "shortcut": gi.KeyFunInsertAfter, "updtfunc": ActionUpdateFunc(func(tvi interface{}, act *gi.Action) { tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView) act.SetInactiveState(tv.IsRootOrField("")) }), }}, {"SrcDuplicate", ki.Props{ "label": "Duplicate", "shortcut": gi.KeyFunDuplicate, "updtfunc": ActionUpdateFunc(func(tvi interface{}, act *gi.Action) { tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView) act.SetInactiveState(tv.IsRootOrField("")) }), }}, {"SrcDelete", ki.Props{ "label": "Delete", "shortcut": gi.KeyFunDelete, "updtfunc": ActionUpdateFunc(func(tvi interface{}, act *gi.Action) { tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView) act.SetInactiveState(tv.IsRootOrField("")) }), }}, {"sep-edit", ki.BlankProp{}}, {"Copy", ki.Props{ "shortcut": gi.KeyFunCopy, "Args": ki.PropSlice{ {"reset", ki.Props{ "value": true, }}, }, }}, {"Cut", ki.Props{ "shortcut": gi.KeyFunCut, "updtfunc": ActionUpdateFunc(func(tvi interface{}, act *gi.Action) { tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView) act.SetInactiveState(tv.IsRootOrField("")) }), }}, {"Paste", ki.Props{ "shortcut": gi.KeyFunPaste, }}, {"sep-win", ki.BlankProp{}}, {"SrcEdit", ki.Props{ "label": "Edit", }}, {"SrcGoGiEditor", ki.Props{ "label": "GoGi Editor", }}, {"sep-open", ki.BlankProp{}}, {"OpenAll", ki.Props{}}, {"CloseAll", ki.Props{}}, }, "CtxtMenuInactive": ki.PropSlice{ {"Copy", ki.Props{ "shortcut": gi.KeyFunCopy, "Args": ki.PropSlice{ {"reset", ki.Props{ "value": true, }}, }, }}, {"SrcEdit", ki.Props{ "label": "Edit", }}, {"SrcGoGiEditor", ki.Props{ "label": "GoGi Editor", }}, }, }
var TreeViewSelectors = []string{":active", ":selected", ":focus", ":inactive"}
TreeViewSelectors are Style selector names for the different states:
var TwinTextViewsProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "max-width": -1, "max-height": -1, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, }
TwinTextViewsProps are style properties for TwinTextViews
var VCSLogViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "max-width": -1, "max-height": -1, }
VCSLogViewProps are style properties for DebugView
var ValueViewBaseProps = ki.Props{ "base-type": true, }
var ValueViewMap map[string]ValueViewFunc
The ValueViewMap is used to connect type names with corresponding ValueView representations of those types -- this can be used when it is not possible to use the ValueViewer interface (e.g., interface methods can only be defined within the package that defines the type -- so we need this for all types in gi which don't know about giv). You must use kit.LongTypeName (full package name + "." . type name) for the type name, as that is how it will be looked up.
var VcsLabelFunc = LabelFunc(func(fni interface{}, act *gi.Action) string { ftv := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ftv.FileNode() label := act.Text if fn != nil { repo, _ := fn.Repo() if repo != nil { label = strings.Replace(label, "Vcs", string(repo.Vcs()), 1) } } return label })
VcsGetRemoveLabelFunc gets the appropriate label for removing from version control
var VersCtrlSystems = []string{"git", "svn", "bzr", "hg"}
VersCtrlSystems is a list of supported Version Control Systems. These must match the VCS Types from goki/pi/vci which in turn is based on masterminds/vcs
Functions ¶
func ActionView ¶
func ActionView(val interface{}, vtyp reflect.Type, vp *gi.Viewport2D, ac *gi.Action, props ki.Props) bool
ActionView configures given action with given props
func ActionViewArgsValidate ¶
func ActionViewArgsValidate(md *MethViewData, vtyp reflect.Type, meth reflect.Method, argprops ki.PropSlice) bool
ActionViewArgsValidate validates the Args properties relative to number of args on type
func ActionsView ¶
func ActionsView(val interface{}, vtyp reflect.Type, vp *gi.Viewport2D, pa *gi.Action, pp interface{}) bool
ActionsView processes properties for parent action pa for overall object val of given type -- could have a sub-menu of further actions or might just be a single action
func ArgViewDialog ¶
func ArgViewDialog(avp *gi.Viewport2D, args []ArgData, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
ArgViewDialog for editing args for a method call in the MethView system
func AvailColorMapsList ¶ added in v0.9.8
func AvailColorMapsList() []string
AvailColorMapsList returns a sorted list of color map names, e.g., for choosers
func CallMethod ¶
func CallMethod(val interface{}, method string, vp *gi.Viewport2D) bool
CallMethod calls given method on given object val, using GUI interface to prompt for args. This only works for methods that have been configured either on the CallMethods list or any of the ToolBar, MainMenu, or CtxtMenu lists (in that order). List of available methods is cached in type properties after first call.
func ColorViewDialog ¶
func ColorViewDialog(avp *gi.Viewport2D, clr gi.Color, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
ColorViewDialog for editing a color using a ColorView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func ColorViewDialogValue ¶
ColorViewDialogValue gets the color from the dialog
func CompleteEditPi ¶ added in v0.9.6
func CompleteEditPi(data interface{}, text string, cursorPos int, comp complete.Completion, seed string) (ed complete.Edit)
CompleteEditPi uses the selected completion to edit the text
func CompletePi ¶ added in v0.9.6
CompletePi uses GoPi symbols and language -- the string is a line of text up to point where user has typed. The data must be the *FileState from which the language type is obtained.
func CompleteText ¶
CompleteText does completion for text files
func CompleteTextEdit ¶
func CompleteTextEdit(data interface{}, text string, cursorPos int, completion complete.Completion, seed string) (ed complete.Edit)
CompleteTextEdit uses the selected completion to edit the text
func CopyFile ¶
CopyFile copies the contents from src to dst atomically. If dst does not exist, CopyFile creates it with permissions perm. If the copy fails, CopyFile aborts and dst is preserved.
func CtxtMenuView ¶
CtxtMenuView configures a popup context menu according to the "CtxtMenu" properties registered on the type for given value element, through the kit.AddType method. See https://github.com/goki/gi/wiki/Views for full details on formats and options for configuring the menu. It looks first for "CtxtMenuActive" or "CtxtMenuInactive" depending on inactive flag (which applies to the gui view), so you can have different menus in those cases, and then falls back on "CtxtMenu". Returns false if there is no context menu defined for this type, or on errors (which are programmer errors sent to log).
func DirAndFile ¶ added in v0.9.11
DirAndFile returns the final dir and file name.
func FileNames ¶ added in v0.9.5
FileNames recursively adds fullpath filenames within the starting directory to the "names" slice. Directory names within the starting directory are not added.
func FileNodeBufSigRecv ¶ added in v0.9.5
FileNodeBufSigRecv receives a signal from the buffer and updates view accordingly
func FileNodeNameCountSort ¶ added in v0.9.15
func FileNodeNameCountSort(ecs []FileNodeNameCount)
func FileViewDialog ¶
func FileViewDialog(avp *gi.Viewport2D, filename, ext string, opts DlgOpts, filterFunc FileViewFilterFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
FileViewDialog is for selecting / manipulating files -- ext is one or more (comma separated) extensions -- files with those will be highlighted (include the . at the start of the extension). recv and dlgFunc connect to the dialog signal: if signal value is gi.DialogAccepted use FileViewDialogValue to get the resulting selected file. The optional filterFunc can filter files shown in the view -- e.g., FileViewDirOnlyFilter (for only showing directories) and FileViewExtOnlyFilter (for only showing directories).
func FileViewDialogValue ¶
FileViewDialogValue gets the full path of selected 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 FileViewStyleFunc ¶
func FontChooserDialog ¶
func FontChooserDialog(avp *gi.Viewport2D, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
FontChooserDialog for choosing a font -- the recv and func signal receivers if non-nil are connected to the selection signal for the struct table view, so they are updated with that
func FontInfoStyleFunc ¶
func HTMLEscapeBytes ¶ added in v0.9.7
HTMLEscapeBytes escapes special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ". It operates on a *copy* of the byte string and does not modify the input! otherwise it causes major problems..
func HTMLEscapeRunes ¶ added in v0.9.11
HTMLEscapeRunes escapes special characters like "<" to become "<". It escapes only five such characters: <, >, &, ' and ". It operates on a *copy* of the byte string and does not modify the input! otherwise it causes major problems..
func HasMainMenuView ¶
func HasMainMenuView(val interface{}) bool
HasMainMenuView returns true if given val has a MainMenu type property registered -- call this to check before then calling MainMenuView
func HasToolBarView ¶
func HasToolBarView(val interface{}) bool
HasToolBarView returns true if given val has a ToolBar type property registered -- call this to check before then calling ToolBarView.
func HiStylesView ¶
HiStylesView opens a view of highlighting styles
func IconChooserDialog ¶
func IconChooserDialog(avp *gi.Viewport2D, curIc gi.IconName, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
IconChooserDialog for choosing an Icon -- the recv and fun signal receivers if non-nil are connected to the selection signal for the slice view, and the dialog signal.
func IconChooserStyleFunc ¶
func LookupPi ¶ added in v0.9.11
LookupPi uses GoPi symbols and language -- the string is a line of text up to point where user has typed. The data must be the *FileState from which the language type is obtained.
func MainMenuView ¶
MainMenuView configures the given MenuBar according to the "MainMenu" properties registered on the type for given value element, through the kit.AddType method. See https://github.com/goki/gi/wiki/Views for full details on formats and options for configuring the menu. Returns false if there is no main menu defined for this type, or on errors (which are programmer errors sent to log).
func MapViewDialog ¶
func MapViewDialog(avp *gi.Viewport2D, mp interface{}, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
connects to given signal receiving object and function for dialog signals (nil to ignore)
func MethViewArgDefaultVal ¶
func MethViewArgDefaultVal(md *MethViewData, ai int) (interface{}, bool)
MethViewArgDefaultVal returns the default value of the given argument index
func MethViewCall ¶
MethViewCall is the receiver func for MethView actions that call a method -- it uses the MethViewData to call the target method.
func MethViewCallMeth ¶
func MethViewCallMeth(md *MethViewData, args []reflect.Value)
MethViewCallMeth calls the method with given args, and processes the results as specified in the MethViewData.
func MethViewCallNoArgPrompt ¶
func MethViewCallNoArgPrompt(ac *gi.Action, md *MethViewData, args []reflect.Value)
MethViewCallNoArgPrompt calls the method in case where there is no prompting otherwise of the user for arg values -- checks for Confirm case or otherwise directly calls method
func MethViewCompileActions ¶
func MethViewCompileActions(cmp ki.Props, val interface{}, vtyp reflect.Type, vp *gi.Viewport2D, pnm string, pp interface{}) bool
MethViewCompileActions processes properties for parent action pa for overall object val of given type -- could have a sub-menu of further actions or might just be a single action
func MethViewCompileMeths ¶
func MethViewCompileMeths(val interface{}, vp *gi.Viewport2D) ki.Props
MethViewCompileMeths gets all methods either on the CallMethods list or any of the ToolBar, MainMenu, or CtxtMenu lists (in that order). Returns property list of them, which are just names -> Actions
func MethViewErr ¶
MethViewErr is error logging function for MethView system, showing the type info
func MethViewFieldValue ¶
MethViewFieldValue returns a reflect.Value for the given field name, checking safely (false if not found)
func MethViewNoUpdateAfterProp ¶
func MethViewNoUpdateAfterProp(val interface{}) bool
MethViewNoUpdateAfterProp returns true if given val has a top-level "MethViewNoUpdateAfter" type property registered -- some types generically want that and it is much easier to just specify once instead of every time..
func MethViewSetActionData ¶
func MethViewSetActionData(ac *gi.Action, val interface{}, vp *gi.Viewport2D)
MethViewSetActionData sets the MethViewData associated with the given action with values updated from the given val and viewport
func MethViewShowValue ¶ added in v0.9.7
func MethViewShowValue(vp *gi.Viewport2D, val reflect.Value, title, prompt string)
MethViewShowValue displays a value in a dialog window (e.g., for MethViewShowReturn)
func MethViewSubMenuFunc ¶
MethViewSubMenuFunc is a MakeMenuFunc for items that have submenus
func MethViewTypeProps ¶
MethViewTypeProps gets props, typ of val, returns false if not found or other err
func MethViewUpdateFunc ¶
MethViewUpdateFunc is general Action.UpdateFunc that then calls any MethViewData.UpdateFunc from its data
func OSOpenCommand ¶ added in v0.9.14
func OSOpenCommand() string
OSOpenCommand returns the generic file 'open' command to open file with default app open on Mac, xdg-open on Linux, and start on Windows
func PrefsDbgView ¶
func PrefsDbgView(pf *gi.PrefsDebug) *gi.Window
PrefsDbgView opens a view of user debugging preferences
func PrefsDetView ¶
func PrefsDetView(pf *gi.PrefsDetailed) *gi.Window
PrefsDetView opens a view of user detailed preferences
func PrefsView ¶
func PrefsView(pf *gi.Preferences) *gi.Window
PrefsView opens a view of user preferences
func QReplaceDialog ¶
func QReplaceDialog(avp *gi.Viewport2D, find string, lexitems bool, opts gi.DlgOpts, recv ki.Ki, fun ki.RecvFunc) *gi.Dialog
QReplaceDialog prompts the user for a query-replace items, with comboboxes with history
func QReplaceDialogValues ¶
QReplaceDialogValues gets the string values
func RelFilePath ¶ added in v0.9.11
RelFilePath returns the file name relative to given root file path, if it is under that root -- otherwise it returns the final dir and file name.
func SliceIdxByValue ¶ added in v0.9.8
SliceIdxByValue searches for first index that contains given value in slice -- returns false if not found
func SliceViewDialog ¶
func SliceViewDialog(avp *gi.Viewport2D, slice interface{}, opts DlgOpts, styleFunc SliceViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Also has an optional styling function for styling elements of the table.
func SliceViewDialogNoStyle ¶ added in v0.9.9
func SliceViewDialogNoStyle(avp *gi.Viewport2D, slice interface{}, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
optionally connects to given signal receiving object and function for dialog signals (nil to ignore). This version does not have the style function.
func SliceViewSelectDialog ¶
func SliceViewSelectDialog(avp *gi.Viewport2D, slice, curVal interface{}, opts DlgOpts, styleFunc SliceViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
functions available for both the widget signal reporting selection events, and the overall dialog signal. Also has an optional styling function for styling elements of the table.
func SliceViewSelectDialogValue ¶
SliceViewSelectDialogValue gets the index of the selected item (-1 if nothing selected)
func SrcNodeSignalFunc ¶ added in v0.9.11
SrcNodeSignalFunc is the function for receiving node signals from our SrcNode
func StructFieldIsDef ¶ added in v0.9.8
StructFieldIsDef processses "def" tag for default value(s) of field defs = default values as strings as either comma-separated list of valid values or low:high value range (only for int or float numeric types) valPtr = pointer to value returns true if value is default, and string to add to tooltip for default values
func StructNonDefFieldsStr ¶ added in v0.9.8
StructNonDefFieldsStr processses "def" tag for default value(s) of fields in given struct, and returns a string of all those not at their default values, in format: Path.Field: val // default value(s) Uses a recursive strategy -- any fields that are themselves structs are expanded, and the field name represented by dots path separators.
func StructSliceIdxByValue ¶ added in v0.9.8
StructSliceIdxByValue searches for first index that contains given value in field of given name.
func StructViewDialog ¶
func StructViewDialog(avp *gi.Viewport2D, stru interface{}, opts DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func StructViewFieldDefTag ¶ added in v0.9.8
StructViewFieldDefTag processes the "def" tag for default values -- can be called multiple times for updating as values change. returns true if value is default, and string to add to tooltip for default vals
func StructViewFieldTags ¶ added in v0.9.8
func StructViewFieldTags(vv ValueView, lbl *gi.Label, widg gi.Node2D, isInact bool) (hasDef, inactTag bool)
StructViewFieldTags processes the tags for a field in a struct view, setting the properties on the label or widget appropriately returns true if there were any "def" default tags -- if so, needs updating
func TableViewDialog ¶
func TableViewDialog(avp *gi.Viewport2D, slcOfStru interface{}, opts DlgOpts, styleFunc TableViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TableView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Also has an optional styling function for styling elements of the table.
func TableViewSelectDialog ¶
func TableViewSelectDialog(avp *gi.Viewport2D, slcOfStru interface{}, opts DlgOpts, initRow int, styleFunc TableViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TableView -- optionally connects to given signal receiving object and functions for signals (nil to ignore): selFunc for the widget signal reporting selection events, and dlgFunc for the overall dialog signals. Also has an optional styling function for styling elements of the table.
func TableViewSelectDialogValue ¶
TableViewSelectDialogValue gets the index of the selected item (-1 if nothing selected)
func TextViewBufSigRecv ¶
TextViewBufSigRecv receives a signal from the buffer and updates view accordingly
func TextViewClipHistAdd ¶
func TextViewClipHistAdd(clip []byte)
TextViewClipHistAdd adds the given clipboard bytes to top of history stack
func TextViewClipHistChooseList ¶
func TextViewClipHistChooseList() []string
TextViewClipHistChooseList returns a string slice of length-limited clip history, for chooser
func ToolBarView ¶
func ToolBarView(val interface{}, vp *gi.Viewport2D, tb *gi.ToolBar) bool
ToolBarView configures ToolBar according to the "ToolBar" properties registered on the type for given value element, through the kit.AddType method. See https://github.com/goki/gi/wiki/Views for full details on formats and options for configuring the menu. Returns false if there is no toolbar defined for this type, or on errors (which are programmer errors sent to log).
func VCSLogViewDialog ¶ added in v0.9.13
VCSLogViewDialog opens a VCS Log View for given repo, log and file (file could be empty)
func ValueViewMapAdd ¶ added in v0.9.8
func ValueViewMapAdd(typeNm string, fun ValueViewFunc)
ValueViewMapAdd adds a ValueViewFunc for a given type name. You must use kit.LongTypeName (full package name + "." . type name) for the type name, as that is how it will be looked up.
Types ¶
type ActionUpdateFunc ¶
ActionUpdateFunc is a function that updates method active / inactive status first argument is the object on which the method is defined (receiver)
type ArgData ¶
type ArgData struct { Val reflect.Value Name string Desc string View ValueView Default interface{} Flags ArgDataFlags }
ArgData contains the relevant data for each arg, including the reflect.Value, name, optional description, and default value
func MethViewArgData ¶
MethViewArgData gets the arg data for the method args, returns false if errors -- nprompt is the number of args that require prompting from the user (minus any cases with value: set directly)
type ArgDataFlags ¶
type ArgDataFlags int32
ArgDataFlags define bitflags for method view action options
const ( // ArgDataHasDef means that there was a Default value set ArgDataHasDef ArgDataFlags = iota // ArgDataValSet means that there is a fixed value for this arg, given in // the config props and set in the Default, so it does not need to be // prompted for ArgDataValSet ArgDataFlagsN )
func (*ArgDataFlags) FromString ¶
func (i *ArgDataFlags) FromString(s string) error
func (ArgDataFlags) String ¶
func (i ArgDataFlags) String() string
type ArgView ¶
type ArgView struct { gi.Frame Args []ArgData `desc:"the args that we are a view onto"` Title string `desc:"title / prompt to show above the editor fields"` ViewSig ki.Signal `` /* 179-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ }
ArgView represents a slice of reflect.Value's and associated names, for the purpose of supplying arguments to methods called via the MethView framework.
func (*ArgView) ArgsGrid ¶
ArgsGrid returns the grid layout widget, which contains all the fields and values, and its index, within frame
func (*ArgView) ConfigArgsGrid ¶
func (av *ArgView) ConfigArgsGrid()
ConfigArgsGrid configures the ArgsGrid for the current struct
func (*ArgView) Disconnect ¶ added in v0.9.8
func (av *ArgView) Disconnect()
func (*ArgView) SetArgs ¶
SetArgs sets the source args that we are viewing -- rebuilds the children to represent
func (*ArgView) TitleWidget ¶
Title returns the title label widget, and its index, within frame
func (*ArgView) UpdateArgs ¶
func (av *ArgView) UpdateArgs()
UpdateArgs updates each of the value-view widgets for the args
type BitFlagView ¶ added in v0.9.9
type BitFlagView struct { ValueViewBase AltType reflect.Type // alternative type, e.g., from EnumType: property }
BitFlagView presents a ButtonBox for bitflags
func (*BitFlagView) ConfigWidget ¶ added in v0.9.9
func (vv *BitFlagView) ConfigWidget(widg gi.Node2D)
func (*BitFlagView) EnumType ¶ added in v0.9.9
func (vv *BitFlagView) EnumType() reflect.Type
func (*BitFlagView) SetEnumValueFromInt ¶ added in v0.9.9
func (vv *BitFlagView) SetEnumValueFromInt(ival int64) bool
func (*BitFlagView) UpdateWidget ¶ added in v0.9.9
func (vv *BitFlagView) UpdateWidget()
func (*BitFlagView) WidgetType ¶ added in v0.9.9
func (vv *BitFlagView) WidgetType() reflect.Type
type BoolValueView ¶
type BoolValueView struct {
ValueViewBase
}
BoolValueView presents a checkbox for a boolean
func (*BoolValueView) ConfigWidget ¶
func (vv *BoolValueView) ConfigWidget(widg gi.Node2D)
func (*BoolValueView) UpdateWidget ¶
func (vv *BoolValueView) UpdateWidget()
func (*BoolValueView) WidgetType ¶
func (vv *BoolValueView) WidgetType() reflect.Type
type ByteSliceValueView ¶
type ByteSliceValueView struct {
ValueViewBase
}
ByteSliceValueView presents a textfield of the bytes
func (*ByteSliceValueView) ConfigWidget ¶
func (vv *ByteSliceValueView) ConfigWidget(widg gi.Node2D)
func (*ByteSliceValueView) UpdateWidget ¶
func (vv *ByteSliceValueView) UpdateWidget()
func (*ByteSliceValueView) WidgetType ¶
func (vv *ByteSliceValueView) WidgetType() reflect.Type
type ColorMap ¶ added in v0.9.8
type ColorMap struct { Name string NoColor gi.Color `desc:"color to display for invalid numbers (e.g., NaN)"` Colors []gi.Color `desc:"list of colors to interpolate between"` }
ColorMap maps a value onto a color by interpolating between a list of colors defining a spectrum
type ColorMapName ¶ added in v0.9.8
type ColorMapName string
ColorMapName provides a gui chooser of maps in AvailColorMaps
func (ColorMapName) ValueView ¶ added in v0.9.8
func (mn ColorMapName) ValueView() ValueView
ValueView registers ColorMapValueView as the viewer of ColorMapName
type ColorMapValueView ¶ added in v0.9.8
type ColorMapValueView struct {
ValueViewBase
}
ColorMapValueView presents an action for displaying a ColorMapName and selecting meshes from a ChooserDialog
func (*ColorMapValueView) Activate ¶ added in v0.9.8
func (vv *ColorMapValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*ColorMapValueView) ConfigWidget ¶ added in v0.9.8
func (vv *ColorMapValueView) ConfigWidget(widg gi.Node2D)
func (*ColorMapValueView) HasAction ¶ added in v0.9.8
func (vv *ColorMapValueView) HasAction() bool
func (*ColorMapValueView) UpdateWidget ¶ added in v0.9.8
func (vv *ColorMapValueView) UpdateWidget()
func (*ColorMapValueView) WidgetType ¶ added in v0.9.8
func (vv *ColorMapValueView) WidgetType() reflect.Type
type ColorMapView ¶ added in v0.9.8
type ColorMapView struct { gi.WidgetBase Orient mat32.Dims `desc:"orientation along which to display the spectrum"` Map *ColorMap `desc:"the colormap that we view"` ColorMapSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for color map -- triggers when new color map is set via chooser"` }
ColorMapView is a widget that displays a ColorMap. Note that this is not a ValueView widget
func AddNewColorMapView ¶ added in v0.9.8
func AddNewColorMapView(parent ki.Ki, name string, cmap *ColorMap) *ColorMapView
AddNewColorMapView adds a new colorview to given parent node, with given name.
func (*ColorMapView) ChooseColorMap ¶ added in v0.9.8
func (cv *ColorMapView) ChooseColorMap()
ChooseColorMap pulls up a chooser to select a color map
func (*ColorMapView) ConnectEvents2D ¶ added in v0.9.8
func (cv *ColorMapView) ConnectEvents2D()
func (*ColorMapView) Disconnect ¶ added in v0.9.8
func (cv *ColorMapView) Disconnect()
func (*ColorMapView) MouseEvent ¶ added in v0.9.8
func (cv *ColorMapView) MouseEvent()
MouseEvent handles button MouseEvent
func (*ColorMapView) Render2D ¶ added in v0.9.8
func (cv *ColorMapView) Render2D()
func (*ColorMapView) RenderColorMap ¶ added in v0.9.8
func (cv *ColorMapView) RenderColorMap()
func (*ColorMapView) SetColorMap ¶ added in v0.9.8
func (cv *ColorMapView) SetColorMap(cmap *ColorMap)
SetColorMap sets the color map and triggers a display update
func (*ColorMapView) SetColorMapAction ¶ added in v0.9.8
func (cv *ColorMapView) SetColorMapAction(cmap *ColorMap)
SetColorMapAction sets the color map and triggers a display update and signals the ColorMapSig signal
type ColorNameValueView ¶ added in v0.9.8
type ColorNameValueView struct {
ValueViewBase
}
ColorNameValueView presents an action for displaying a ColorNameName and selecting meshes from a ChooserDialog
func (*ColorNameValueView) Activate ¶ added in v0.9.8
func (vv *ColorNameValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*ColorNameValueView) ConfigWidget ¶ added in v0.9.8
func (vv *ColorNameValueView) ConfigWidget(widg gi.Node2D)
func (*ColorNameValueView) HasAction ¶ added in v0.9.8
func (vv *ColorNameValueView) HasAction() bool
func (*ColorNameValueView) UpdateWidget ¶ added in v0.9.8
func (vv *ColorNameValueView) UpdateWidget()
func (*ColorNameValueView) WidgetType ¶ added in v0.9.8
func (vv *ColorNameValueView) WidgetType() reflect.Type
type ColorValueView ¶
type ColorValueView struct { ValueViewBase TmpColor gi.Color }
ColorValueView presents a StructViewInline for a struct plus a ColorView button..
func (*ColorValueView) Activate ¶
func (vv *ColorValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*ColorValueView) Color ¶
func (vv *ColorValueView) Color() (*gi.Color, bool)
Color returns a standardized color value from whatever value is represented internally
func (*ColorValueView) ConfigWidget ¶
func (vv *ColorValueView) ConfigWidget(widg gi.Node2D)
func (*ColorValueView) HasAction ¶
func (vv *ColorValueView) HasAction() bool
func (*ColorValueView) SetColor ¶
func (vv *ColorValueView) SetColor(clr gi.Color)
SetColor sets color value from a standard color value -- more robust than plain SetValue
func (*ColorValueView) UpdateWidget ¶
func (vv *ColorValueView) UpdateWidget()
func (*ColorValueView) WidgetType ¶
func (vv *ColorValueView) WidgetType() reflect.Type
type ColorView ¶
type ColorView struct { gi.Frame Color gi.Color `desc:"the color that we view"` NumView ValueView `desc:"inline struct view of the numbers"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ }
ColorView shows a color, using sliders to set values,
func AddNewColorView ¶ added in v0.9.7
AddNewColorView adds a new colorview to given parent node, with given name.
func (*ColorView) Config ¶
func (cv *ColorView) Config()
Config configures a standard setup of entire view
func (*ColorView) ConfigSliderGrid ¶
func (cv *ColorView) ConfigSliderGrid()
ConfigSliderGrid configures the SliderGrid
func (*ColorView) Disconnect ¶ added in v0.9.8
func (cv *ColorView) Disconnect()
func (*ColorView) IsConfiged ¶ added in v0.9.8
IsConfiged returns true if widget is fully configured
func (*ColorView) NumLayConfig ¶
func (cv *ColorView) NumLayConfig()
NumLayConfig configures the numerical layout
func (*ColorView) SetHSLValue ¶
func (*ColorView) SetRGBValue ¶
func (*ColorView) SliderGrid ¶
func (*ColorView) SliderLayConfig ¶
func (cv *ColorView) SliderLayConfig()
SliderLayConfig configures the sliders layout
func (*ColorView) UpdateSliderGrid ¶
func (cv *ColorView) UpdateSliderGrid()
type DiffTextView ¶ added in v0.9.13
type DiffTextView struct {
TextView
}
DiffTextView supports double-click based application of edits from one buffer to the other.
func AddNewDiffTextView ¶ added in v0.9.13
func AddNewDiffTextView(parent ki.Ki, name string) *DiffTextView
AddNewDiffTextView adds a new DiffTextView to given parent node, with given name.
func (*DiffTextView) ConnectEvents2D ¶ added in v0.9.13
func (tv *DiffTextView) ConnectEvents2D()
ConnectEvents2D indirectly sets connections between mouse and key events and actions
func (*DiffTextView) DiffView ¶ added in v0.9.13
func (tv *DiffTextView) DiffView() *DiffView
func (*DiffTextView) MouseEvent ¶ added in v0.9.13
func (tv *DiffTextView) MouseEvent(me *mouse.Event)
MouseEvent handles the mouse.Event to process double-click
func (*DiffTextView) TextViewEvents ¶ added in v0.9.13
func (tv *DiffTextView) TextViewEvents()
TextViewEvents sets connections between mouse and key events and actions
type DiffView ¶ added in v0.9.11
type DiffView struct { gi.Frame FileA string `desc:"first file name being compared"` FileB string `desc:"second file name being compared"` RevA string `desc:"revision for first file, if relevant"` RevB string `desc:"revision for second file, if relevant"` Diffs textbuf.Diffs `json:"-" xml:"-" desc:"the diff records"` BufA *TextBuf `json:"-" xml:"-" desc:"textbuf for A"` BufB *TextBuf `json:"-" xml:"-" desc:"textbuf for B"` AlignD textbuf.Diffs `json:"-" xml:"-" desc:"aligned diffs records diff for aligned lines"` EditA textbuf.Diffs `json:"-" xml:"-" desc:"edit diffs records aligned diffs with edits applied"` EditB textbuf.Diffs `json:"-" xml:"-" desc:"edit diffs records aligned diffs with edits applied"` UndoA textbuf.Diffs `json:"-" xml:"-" desc:"undo diffs records aligned diffs with edits applied"` UndoB textbuf.Diffs `json:"-" xml:"-" desc:"undo diffs records aligned diffs with edits applied"` }
DiffView presents two side-by-side TextView windows showing the differences between two files (represented as lines of strings).
func AddNewDiffView ¶ added in v0.9.11
AddNewDiffView adds a new diffview to given parent node, with given name.
func DiffViewDialog ¶ added in v0.9.11
func DiffViewDialog(avp *gi.Viewport2D, astr, bstr []string, afile, bfile, arev, brev string, opts DlgOpts) *DiffView
DiffViewDialog opens a dialog for displaying diff between two files as line-strings
func DiffViewDialogFromRevs ¶ added in v0.9.13
func DiffViewDialogFromRevs(avp *gi.Viewport2D, repo vci.Repo, file string, fbuf *TextBuf, rev_a, rev_b string) (*DiffView, error)
DiffViewDialogFromRevs opens a dialog for displaying diff between file at two different revisions from given repository if empty, defaults to: A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions.
func (*DiffView) ApplyDiff ¶ added in v0.9.13
ApplyDiff applies change from the other buffer to the buffer for given file name, from diff that includes given line.
func (*DiffView) ConfigTexts ¶ added in v0.9.11
func (dv *DiffView) ConfigTexts()
func (*DiffView) ConfigToolBar ¶ added in v0.9.13
func (dv *DiffView) ConfigToolBar()
func (*DiffView) DiffStrings ¶ added in v0.9.11
DiffStrings computes differences between two lines-of-strings and displays in DiffView.
func (*DiffView) FileModifiedUpdateA ¶ added in v0.9.13
func (*DiffView) FileModifiedUpdateB ¶ added in v0.9.13
func (*DiffView) HasDiffsUpdate ¶ added in v0.9.13
func (*DiffView) IsConfiged ¶ added in v0.9.11
func (*DiffView) RemoveAlignsA ¶ added in v0.9.13
func (dv *DiffView) RemoveAlignsA()
RemoveAlignsA removes extra blank text lines added to align with B
func (*DiffView) RemoveAlignsB ¶ added in v0.9.13
func (dv *DiffView) RemoveAlignsB()
RemoveAlignsB removes extra blank text lines added to align with A
func (*DiffView) ResetDiffs ¶ added in v0.9.13
func (dv *DiffView) ResetDiffs()
ResetDiffs resets all active diff state -- after saving
func (*DiffView) SaveFileA ¶ added in v0.9.13
SaveFileA saves the current state of file A to given filename
func (*DiffView) SaveFileB ¶ added in v0.9.13
SaveFileB saves the current state of file B to given filename
func (*DiffView) SetTextNames ¶ added in v0.9.13
func (dv *DiffView) SetTextNames()
func (*DiffView) TagWordDiffs ¶ added in v0.9.13
func (dv *DiffView) TagWordDiffs()
TagWordDiffs goes through replace diffs and tags differences at the word level between the two regions.
func (*DiffView) TextViewLays ¶ added in v0.9.11
func (*DiffView) TextViews ¶ added in v0.9.11
func (dv *DiffView) TextViews() (*DiffTextView, *DiffTextView)
func (*DiffView) UndoDiff ¶ added in v0.9.13
UndoDiff undoes last applied change, if any -- just does Undo in buffer and updates the list of edits applied.
func (*DiffView) UpdateToolBar ¶ added in v0.9.13
func (dv *DiffView) UpdateToolBar()
type DirFlagMap ¶ added in v0.9.15
DirFlagMap is a map for encoding directories that are open in the file tree. The strings are typically relative paths. The bool value is used to mark active paths and inactive (unmarked) ones can be removed.
func (*DirFlagMap) ClearMarks ¶ added in v0.9.15
func (dm *DirFlagMap) ClearMarks()
ClearMarks clears all the marks -- do this prior to traversing full set of active paths -- can then call DeleteStale to get rid of unused paths.
func (*DirFlagMap) DeleteStale ¶ added in v0.9.15
func (dm *DirFlagMap) DeleteStale()
DeleteStale removes all entries with a bool = false value indicating that they have not been accessed since ClearFlags was called.
func (*DirFlagMap) IsOpen ¶ added in v0.9.15
func (dm *DirFlagMap) IsOpen(path string) bool
IsOpen returns true if path has IsOpen bit flag set
func (*DirFlagMap) SetMark ¶ added in v0.9.15
func (dm *DirFlagMap) SetMark(path string)
SetMark sets the mark flag indicating we visited file
func (*DirFlagMap) SetOpen ¶ added in v0.9.15
func (dm *DirFlagMap) SetOpen(path string, open bool)
SetOpenState sets the given directory's open flag
func (*DirFlagMap) SetSortBy ¶ added in v0.9.15
func (dm *DirFlagMap) SetSortBy(path string, modTime bool)
SetSortBy sets the given directory's sort by option
func (*DirFlagMap) SortByModTime ¶ added in v0.9.15
func (dm *DirFlagMap) SortByModTime(path string) bool
SortByModTime returns true if path is sorted by mod time
func (*DirFlagMap) SortByName ¶ added in v0.9.15
func (dm *DirFlagMap) SortByName(path string) bool
SortByName returns true if path is sorted by name (default if not in map)
type DirFlags ¶ added in v0.9.15
type DirFlags int32
DirFlags are flags on directories: Open, SortBy etc These flags are stored in the DirFlagMap for persistence.
const ( // DirMark means directory is marked -- unmarked entries are deleted post-update DirMark DirFlags = iota // DirIsOpen means directory is open -- else closed DirIsOpen // DirSortByName means sort the directory entries by name. // this is mutex with other sorts -- keeping option open for non-binary sort choices. DirSortByName // DirSortByModTime means sort the directory entries by modification time DirSortByModTime DirFlagsN )
func (*DirFlags) FromString ¶ added in v0.9.15
type DlgOpts ¶
type DlgOpts struct { Title string `desc:"generally should be provided -- used for setting name of dialog and associated window"` Prompt string `` /* 153-byte string literal not displayed */ CSS ki.Props `desc:"optional style properties applied to dialog -- can be used to customize any aspect of existing dialogs"` TmpSave ValueView `` /* 172-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ Ok bool `` /* 320-byte string literal not displayed */ Cancel bool `` /* 324-byte string literal not displayed */ NoAdd bool `desc:"if true, user cannot add elements of the slice"` NoDelete bool `desc:"if true, user cannot delete elements of the slice"` Inactive bool `desc:"if true all fields will be inactive"` Data interface{} `` /* 177-byte string literal not displayed */ Filename string `desc:"filename, e.g., for TextView, to get highlighting"` LineNos bool `desc:"include line numbers for TextView"` }
DlgOpts are the basic dialog options accepted by all giv dialog methods -- provides a named, optional way to specify these args
type EnumValueView ¶
type EnumValueView struct { ValueViewBase AltType reflect.Type // alternative type, e.g., from EnumType: property }
EnumValueView presents a combobox for choosing enums
func (*EnumValueView) ConfigWidget ¶
func (vv *EnumValueView) ConfigWidget(widg gi.Node2D)
func (*EnumValueView) EnumType ¶
func (vv *EnumValueView) EnumType() reflect.Type
func (*EnumValueView) SetEnumValueFromInt ¶
func (vv *EnumValueView) SetEnumValueFromInt(ival int64) bool
func (*EnumValueView) UpdateWidget ¶
func (vv *EnumValueView) UpdateWidget()
func (*EnumValueView) WidgetType ¶
func (vv *EnumValueView) WidgetType() reflect.Type
type FieldValueViewer ¶
FieldValueViewer interface supplies the appropriate type of ValueView for a given field name and current field value on the receiver parent struct -- called on a given receiver struct if defined for that receiver type (tries both pointer and non-pointer receivers) -- if a struct implements this interface, then it is used first for structs -- return nil to fall back on the default ToValueView result
type FileInfo ¶
type FileInfo struct { Ic gi.IconName `tableview:"no-header" desc:"icon for file"` // tableview:"no-header" Name string `width:"40" desc:"name of the file, without any path"` Size FileSize `desc:"size of the file in bytes"` Kind string `` /* 128-byte string literal not displayed */ Mime string `tableview:"-" desc:"full official mime type of the contents"` Cat filecat.Cat `tableview:"-" desc:"functional category of the file, based on mime data etc"` Sup filecat.Supported `tableview:"-" desc:"supported file type"` Mode os.FileMode `desc:"file mode bits"` ModTime FileTime `desc:"time that contents (only) were last modified"` Vcs vci.FileStatus `tableview:"-" desc:"version control system status, when enabled"` Path string `tableview:"-" desc:"full path to file, including name -- for file functions"` }
FileInfo represents the information about a given file / directory, including icon, mimetype, etc
func NewFileInfo ¶
NewFileInfo returns a new FileInfo based on a filename -- directly returns filepath.Abs or os.Stat error on the given file. filename can be anything that works given current directory -- Path will contain the full filepath.Abs path, and Name will be just the filename.
func (*FileInfo) Delete ¶
Delete deletes the file or if a directory the directory and all files and subdirectories
func (*FileInfo) Duplicate ¶
Duplicate creates a copy of given file -- only works for regular files, not directories.
func (*FileInfo) FileNames ¶ added in v0.9.5
FileNames returns a slice of file names from the starting directory and its subdirectories
func (*FileInfo) FindIcon ¶
FindIcon uses file info to find an appropriate icon for this file -- uses Kind string first to find a correspondingly-named icon, and then tries the extension. Returns true on success.
func (*FileInfo) InitFile ¶
InitFile initializes a FileInfo based on a filename -- directly returns filepath.Abs or os.Stat error on the given file. filename can be anything that works given current directory -- Path will contain the full filepath.Abs path, and Name will be just the filename.
func (*FileInfo) IsHidden ¶ added in v0.9.15
IsHidden returns true if file name starts with . or _ which are typically hidden
type FileNode ¶
type FileNode struct { ki.Node FPath gi.FileName `json:"-" xml:"-" copy:"-" desc:"full path to this file"` Info FileInfo `json:"-" xml:"-" copy:"-" desc:"full standard file info about this file"` Buf *TextBuf `json:"-" xml:"-" copy:"-" desc:"file buffer for editing this file"` FRoot *FileTree `json:"-" xml:"-" copy:"-" desc:"root of the tree -- has global state"` DirRepo vci.Repo `` /* 168-byte string literal not displayed */ RepoFiles vci.Files `json:"-" xml:"-" copy:"-" desc:"version control system repository file status -- only valid during ReadDir"` }
FileNode represents a file in the file system -- the name of the node is the name of the file. Folders have children containing further nodes.
func (*FileNode) AddToVcs ¶ added in v0.9.5
func (fn *FileNode) AddToVcs()
AddToVcs adds file to version control
func (*FileNode) BlameVcs ¶ added in v0.9.11
BlameVcs shows the VCS blame report for this file, reporting for each line the revision and author of the last change.
func (*FileNode) CloseAll ¶ added in v0.9.15
func (fn *FileNode) CloseAll()
CloseAll closes all directories under this one, this included
func (*FileNode) CloseBuf ¶
CloseBuf closes the file in its buffer if it is open -- returns true if closed Connect to the fn.Buf.TextBufSig and look for the TextBufClosed signal to be notified when the buffer is closed.
func (*FileNode) CloseDir ¶
func (fn *FileNode) CloseDir()
CloseDir closes given directory node -- updates memory state
func (*FileNode) CommitToVcs ¶ added in v0.9.5
CommitToVcs commits file changes to version control system
func (*FileNode) ConfigOfFiles ¶
func (fn *FileNode) ConfigOfFiles(path string) kit.TypeAndNameList
ConfigOfFiles returns a type-and-name list for configuring nodes based on files immediately within given path
func (*FileNode) CopyFieldsFrom ¶ added in v0.9.11
func (fn *FileNode) CopyFieldsFrom(frm interface{})
func (*FileNode) CopyFileToDir ¶
CopyFileToDir copies given file path into node that is a directory. This does NOT check for overwriting -- that must be done at higher level!
func (*FileNode) DeleteFile ¶
DeleteFile deletes this file
func (*FileNode) DeleteFromVcs ¶ added in v0.9.11
func (fn *FileNode) DeleteFromVcs()
DeleteFromVcs removes file from version control
func (*FileNode) DetectVcsRepo ¶ added in v0.9.13
DetectVcsRepo detects and configures DirRepo if this directory is root of a VCS repository. if updateFiles is true, gets the files in the dir. returns true if a repository was newly found here.
func (*FileNode) DiffVcs ¶ added in v0.9.11
DiffVcs shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffViewDialog.
func (*FileNode) DirsTo ¶ added in v0.9.15
DirsTo opens all the directories above the given filename, and returns the node for element at given path (can be a file or directory itself -- not opened -- just returned)
func (*FileNode) DuplicateFile ¶
Duplicate creates a copy of given file -- only works for regular files, not directories
func (*FileNode) FileExtCounts ¶
func (fn *FileNode) FileExtCounts(cat filecat.Cat) []FileNodeNameCount
FileExtCounts returns a count of all the different file extensions, sorted from highest to lowest. If cat is != filecat.Unknown then it only uses files of that type (e.g., filecat.Code to find any code files)
func (*FileNode) FilesMatching ¶
FilesMatching returns list of all nodes whose file name contains given string (no regexp) -- ignoreCase transforms everything into lowercase
func (*FileNode) FindFile ¶
FindFile finds first node representing given file (false if not found) -- looks for full path names that have the given string as their suffix, so you can include as much of the path (including whole thing) as is relevant to disambiguate. See FilesMatching for a list of files that match a given string.
func (*FileNode) FirstVCS ¶ added in v0.9.15
FirstVCS returns the first VCS repository starting from this node and going down. also returns the node having that repository
func (*FileNode) HasClosedParent ¶ added in v1.0.0
HasClosedParent returns true if node has a parent node with !IsOpen flag set
func (*FileNode) InitFileInfo ¶ added in v0.9.11
InitFileInfo initializes file info
func (*FileNode) IsAutoSave ¶
IsAutoSave returns true if file is an auto-save file (starts and ends with #)
func (*FileNode) IsChanged ¶
IsChanged returns true if the file is open and has been changed (edited) since last save
func (*FileNode) IsExternal ¶ added in v0.9.11
IsExternal returns true if file is external to main file tree
func (*FileNode) IsIrregular ¶ added in v0.9.11
IsIrregular returns true if file is a special "Irregular" node
func (*FileNode) LatestFileMod ¶ added in v0.9.14
LatestFileMod returns the most recent mod time of files in the tree. If cat is != filecat.Unknown then it only uses files of that type (e.g., filecat.Code to find any code files)
func (*FileNode) LogVcs ¶ added in v0.9.11
LogVcs shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.
func (*FileNode) NewFolder ¶
NewFolder makes a new folder (directory) in given selected directory node
func (*FileNode) OpenAll ¶ added in v0.9.15
func (fn *FileNode) OpenAll()
OpenAll opens all directories under this one
func (*FileNode) OpenBuf ¶
OpenBuf opens the file in its buffer if it is not already open. returns true if file is newly opened
func (*FileNode) OpenFileDefault ¶ added in v0.9.14
OpenFileDefault opens file with default app for that file type (os defined) runs open on Mac, xdg-open on Linux, and start on Windows
func (*FileNode) OpenFileWith ¶ added in v0.9.14
OpenFileWith opens file with given command. does not wait for command to finish in this routine (separate routine Waits)
func (*FileNode) ReadDir ¶
ReadDir reads all the files at given directory into this directory node -- uses config children to preserve extra info already stored about files. The root node represents the directory at the given path. Returns os.Stat error if path cannot be accessed.
func (*FileNode) RenameFile ¶
RenameFile renames file to new name
func (*FileNode) Repo ¶ added in v0.9.5
Repo returns the version control repository associated with this file, and the node for the directory where the repo is based. Goes up the tree until a repository is found.
func (*FileNode) SetNodePath ¶
SetNodePath sets the path for given node and updates it based on associated file
func (*FileNode) SortBy ¶ added in v0.9.15
SortBy determines how to sort the files in the directory -- default is alpha by name, optionally can be sorted by modification time.
func (*FileNode) SortConfigByModTime ¶ added in v0.9.15
func (fn *FileNode) SortConfigByModTime(confg kit.TypeAndNameList)
SortConfigByModTime sorts given config list by mod time
func (*FileNode) UpdateAllVcs ¶ added in v0.9.13
func (fn *FileNode) UpdateAllVcs()
UpdateAllVcs does an update on any repositories below this one in file tree
func (*FileNode) UpdateDir ¶ added in v0.9.11
func (fn *FileNode) UpdateDir()
UpdateDir updates the directory and all the nodes under it
func (*FileNode) UpdateNode ¶
UpdateNode updates information in node based on its associated file in FPath. This is intended to be called ad-hoc for individual nodes that might need updating -- use ReadDir for mass updates as it is more efficient.
func (*FileNode) UpdateRepoFiles ¶ added in v0.9.11
func (fn *FileNode) UpdateRepoFiles()
type FileNodeFlags ¶
type FileNodeFlags int64
FileNodeFlags define bitflags for FileNode state -- these extend ki.Flags and storage is an int64
const ( // FileNodeOpen means file is open -- for directories, this means that // sub-files should be / have been loaded -- for files, means that they // have been opened e.g., for editing FileNodeOpen FileNodeFlags = FileNodeFlags(ki.FlagsN) + iota // FileNodeSymLink indicates that file is a symbolic link -- file info is // all for the target of the symlink FileNodeSymLink FileNodeFlagsN )
func StringToFileNodeFlags ¶
func StringToFileNodeFlags(s string) (FileNodeFlags, error)
func (FileNodeFlags) String ¶
func (i FileNodeFlags) String() string
type FileNodeNameCount ¶
FileNodeNameCount is used to report counts of different string-based things in the file tree
type FileSize ¶
type FileTime ¶
FileTime provides a default String format for file modification times, and other useful methods -- will plug into ValueView with date / time editor.
func (FileTime) MarshalBinary ¶
func (FileTime) MarshalJSON ¶
func (FileTime) MarshalText ¶
func (*FileTime) UnmarshalBinary ¶
func (*FileTime) UnmarshalJSON ¶
func (*FileTime) UnmarshalText ¶
type FileTree ¶
type FileTree struct { FileNode ExtFiles []string `` /* 167-byte string literal not displayed */ Dirs DirFlagMap `` /* 185-byte string literal not displayed */ DirsOnTop bool `desc:"if true, then all directories are placed at the top of the tree view -- otherwise everything is mixed"` NodeType reflect.Type `view:"-" json:"-" xml:"-" desc:"type of node to create -- defaults to giv.FileNode but can use custom node types"` InOpenAll bool `desc:"if true, we are in midst of an OpenAll call -- nodes should open all dirs"` }
FileTree is the root of a tree representing files in a given directory (and subdirectories thereof), and has some overall management state for how to view things. The FileTree can be viewed by a TreeView to provide a GUI interface into it.
func (*FileTree) AddExtFile ¶ added in v0.9.11
AddExtFile adds an external file outside of root of file tree and triggers an update, returning the FileNode for it, or error if filepath.Abs fails.
func (*FileTree) CopyFieldsFrom ¶ added in v0.9.11
func (ft *FileTree) CopyFieldsFrom(frm interface{})
func (*FileTree) DirSortByModTime ¶ added in v0.9.15
DirSortByModTime returns true if dir is sorted by mod time
func (*FileTree) DirSortByName ¶ added in v0.9.15
DirSortByName returns true if dir is sorted by name
func (*FileTree) ExtFileNodeByPath ¶ added in v0.9.11
ExtFileNodeByPath returns FileNode for given file path, and true, if it exists in the external files list. Otherwise returns nil, false.
func (*FileTree) HasExtFile ¶ added in v0.9.11
HasExtFile returns true and index if given abs path exists on ExtFiles list. false and -1 if not.
func (*FileTree) IsDirOpen ¶
IsDirOpen returns true if given directory path is open (i.e., has been opened in the view)
func (*FileTree) OpenPath ¶
OpenPath opens a filetree at given directory path -- reads all the files at given path into this tree -- uses config children to preserve extra info already stored about files. Only paths listed in Dirs will be opened.
func (*FileTree) RemoveExtFile ¶ added in v0.9.11
RemoveExtFile removes external file from maintained list, returns true if removed
func (*FileTree) SetDirClosed ¶
SetDirClosed sets the given directory path to be closed
func (*FileTree) SetDirOpen ¶
SetDirOpen sets the given directory path to be open
func (*FileTree) SetDirSortBy ¶ added in v0.9.15
SetDirSortBy sets the given directory path sort by option
func (*FileTree) UpdateAll ¶ added in v1.0.0
func (ft *FileTree) UpdateAll()
UpdateAll does a full update of the tree -- calls ReadDir on current path
func (*FileTree) UpdateExtFiles ¶ added in v0.9.11
UpdateExtFiles returns a type-and-name list for configuring nodes for ExtFiles
func (*FileTree) UpdateNewFile ¶
UpdateNewFile should be called with path to a new file that has just been created -- will update view to show that file, and if that file doesn't exist, it updates the directory containing that file
type FileTreeView ¶
type FileTreeView struct {
TreeView
}
FileTreeView is a TreeView that knows how to operate on FileNode nodes
func AddNewFileTreeView ¶ added in v0.9.7
func AddNewFileTreeView(parent ki.Ki, name string) *FileTreeView
AddNewFileTreeView adds a new filetreeview to given parent node, with given name.
func (*FileTreeView) AddToVcs ¶ added in v0.9.5
func (ftv *FileTreeView) AddToVcs()
AddToVcs adds the file to version control system
func (*FileTreeView) BlameVcs ¶ added in v0.9.11
func (ftv *FileTreeView) BlameVcs()
BlameVcs shows the VCS blame report for this file, reporting for each line the revision and author of the last change.
func (*FileTreeView) CloseAll ¶ added in v0.9.15
func (ftv *FileTreeView) CloseAll()
CloseAll closes all directories under this one
func (*FileTreeView) CommitToVcs ¶ added in v0.9.5
func (ftv *FileTreeView) CommitToVcs()
CommitToVcs commits the file from version control system
func (*FileTreeView) ConnectEvents2D ¶ added in v0.9.5
func (ftv *FileTreeView) ConnectEvents2D()
func (*FileTreeView) Cut ¶
func (ftv *FileTreeView) Cut()
Cut copies to clip.Board and deletes selected items satisfies gi.Clipper interface and can be overridden by subtypes
func (*FileTreeView) DeleteFiles ¶
func (ftv *FileTreeView) DeleteFiles()
DeleteFiles calls DeleteFile on any selected nodes. If any directory is selected all files and subdirectories are also deleted.
func (*FileTreeView) DeleteFilesImpl ¶ added in v0.9.11
func (ftv *FileTreeView) DeleteFilesImpl()
DeleteFilesImpl does the actual deletion, no prompts
func (*FileTreeView) DeleteFromVcs ¶ added in v0.9.11
func (ftv *FileTreeView) DeleteFromVcs()
DeleteFromVcs removes the file from version control system
func (*FileTreeView) DiffVcs ¶ added in v0.9.11
func (ftv *FileTreeView) DiffVcs(rev_a, rev_b string)
DiffVcs shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffViewDialog.
func (*FileTreeView) Dragged ¶
func (ftv *FileTreeView) Dragged(de *dnd.Event)
Dragged is called after target accepts the drop -- we just remove elements that were moved satisfies gi.DragNDropper interface and can be overridden by subtypes
func (*FileTreeView) Drop ¶
func (ftv *FileTreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)
Drop pops up a menu to determine what specifically to do with dropped items satisfies gi.DragNDropper interface and can be overridden by subtypes
func (*FileTreeView) DropExternal ¶ added in v0.9.11
func (ftv *FileTreeView) DropExternal(md mimedata.Mimes, mod dnd.DropMods)
DropExternal is not handled by base case but could be in derived
func (*FileTreeView) DuplicateFiles ¶
func (ftv *FileTreeView) DuplicateFiles()
DuplicateFiles calls DuplicateFile on any selected nodes
func (*FileTreeView) FileNode ¶
func (ftv *FileTreeView) FileNode() *FileNode
FileNode returns the SrcNode as a FileNode
func (*FileTreeView) FileTreeViewEvents ¶ added in v0.9.5
func (ftv *FileTreeView) FileTreeViewEvents()
func (*FileTreeView) KeyInput ¶ added in v0.9.5
func (ftv *FileTreeView) KeyInput(kt *key.ChordEvent)
func (*FileTreeView) LogVcs ¶ added in v0.9.11
func (ftv *FileTreeView) LogVcs(allFiles bool, since string)
LogVcs shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.
func (*FileTreeView) MimeData ¶ added in v0.9.11
func (ftv *FileTreeView) MimeData(md *mimedata.Mimes)
MimeData adds mimedata for this node: a text/plain of the PathUnique, text/plain of filename, and text/
func (*FileTreeView) NewFile ¶
func (ftv *FileTreeView) NewFile(filename string, addToVcs bool)
NewFile makes a new file in given selected directory node
func (*FileTreeView) NewFolder ¶
func (ftv *FileTreeView) NewFolder(foldername string)
NewFolder makes a new file in given selected directory node
func (*FileTreeView) OpenAll ¶ added in v0.9.15
func (ftv *FileTreeView) OpenAll()
OpenAll opens all directories under this one
func (*FileTreeView) OpenDir ¶ added in v0.9.15
func (ftv *FileTreeView) OpenDir()
OpenDir opens given directory
func (*FileTreeView) OpenFileDefault ¶ added in v0.9.14
func (ftv *FileTreeView) OpenFileDefault()
OpenFileDefault opens file with default app for that file type (os defined) runs open on Mac, xdg-open on Linux, and start on Windows
func (*FileTreeView) OpenFileWith ¶ added in v0.9.14
func (ftv *FileTreeView) OpenFileWith()
OpenFileWith opens file with user-specified command.
func (*FileTreeView) Paste ¶
func (ftv *FileTreeView) Paste()
Paste pastes clipboard at given node satisfies gi.Clipper interface and can be overridden by subtypes
func (*FileTreeView) PasteCheckExisting ¶ added in v0.9.11
PasteCheckExisting checks for existing files in target node directory if that is non-nil (otherwise just uses absolute path), and returns list of existing and node for last one if exists.
func (*FileTreeView) PasteCopyFiles ¶ added in v0.9.11
func (ftv *FileTreeView) PasteCopyFiles(tdir *FileNode, md mimedata.Mimes)
PasteCopyFiles copies files in given data into given target directory
func (*FileTreeView) PasteMime ¶
func (ftv *FileTreeView) PasteMime(md mimedata.Mimes)
PasteMime applies a paste / drop of mime data onto this node always does a copy of files into / onto target
func (*FileTreeView) PasteMimeCopyFilesCheck ¶ added in v0.9.14
func (ftv *FileTreeView) PasteMimeCopyFilesCheck(tdir *FileNode, md mimedata.Mimes)
PasteMimeCopyFilesCheck copies files into given directory node, first checking if any already exist -- if they exist, prompts.
func (*FileTreeView) RemoveFromExterns ¶ added in v0.9.11
func (ftv *FileTreeView) RemoveFromExterns()
RemoveFromExterns removes file from list of external files
func (*FileTreeView) RenameFiles ¶
func (ftv *FileTreeView) RenameFiles()
RenameFiles calls RenameFile on any selected nodes
func (*FileTreeView) RevertVcs ¶ added in v0.9.5
func (ftv *FileTreeView) RevertVcs()
RevertVcs removes the file from version control system
func (*FileTreeView) ShowFileInfo ¶ added in v0.9.5
func (ftv *FileTreeView) ShowFileInfo()
ShowFileInfo calls ViewFile on selected files
func (*FileTreeView) SortBy ¶ added in v0.9.15
func (ftv *FileTreeView) SortBy(modTime bool)
SortBy determines how to sort the files in the directory -- default is alpha by name, optionally can be sorted by modification time.
func (*FileTreeView) Style2D ¶
func (ft *FileTreeView) Style2D()
func (*FileTreeView) UpdateAllFiles ¶ added in v0.9.11
func (ftv *FileTreeView) UpdateAllFiles()
type FileValueView ¶
type FileValueView struct {
ValueViewBase
}
FileValueView presents an action for displaying a FileName and selecting icons from FileChooserDialog
func (*FileValueView) Activate ¶
func (vv *FileValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*FileValueView) ConfigWidget ¶
func (vv *FileValueView) ConfigWidget(widg gi.Node2D)
func (*FileValueView) HasAction ¶
func (vv *FileValueView) HasAction() bool
func (*FileValueView) UpdateWidget ¶
func (vv *FileValueView) UpdateWidget()
func (*FileValueView) WidgetType ¶
func (vv *FileValueView) WidgetType() reflect.Type
type FileView ¶
type FileView struct { gi.Frame DirPath string `desc:"path to directory of files to display"` SelFile string `desc:"selected file"` Ext string `desc:"target extension(s) (comma separated if multiple, including initial .), if any"` FilterFunc FileViewFilterFunc `view:"-" json:"-" xml:"-" desc:"optional styling function"` ExtMap map[string]string `` /* 137-byte string literal not displayed */ Files []*FileInfo `desc:"files for current directory"` SelectedIdx int `desc:"index of currently-selected file in Files list (-1 if none)"` FileSig ki.Signal `desc:"signal for file actions"` }
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) ConfigFilesRow ¶
func (fv *FileView) ConfigFilesRow()
func (*FileView) ConfigPathBar ¶ added in v0.9.15
func (fv *FileView) ConfigPathBar()
func (*FileView) ConfigSelRow ¶
func (fv *FileView) ConfigSelRow()
func (*FileView) ConnectEvents2D ¶
func (fv *FileView) ConnectEvents2D()
func (*FileView) DirPathUp ¶
func (fv *FileView) DirPathUp()
DirPathUp moves up one directory in the path
func (*FileView) Disconnect ¶ added in v0.9.8
func (fv *FileView) Disconnect()
func (*FileView) EditPaths ¶ added in v0.9.4
func (fv *FileView) EditPaths()
EditPaths displays a dialog allowing user to delete paths from the path list
func (*FileView) FileComplete ¶
func (fv *FileView) FileComplete(data interface{}, text string, posLn, posCh int) (md complete.Matches)
FileComplete finds the possible completions for the file field
func (*FileView) FileCompleteEdit ¶
func (fv *FileView) FileCompleteEdit(data interface{}, 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) FileViewEvents ¶
func (fv *FileView) FileViewEvents()
func (*FileView) HasFocus2D ¶
func (*FileView) KeyInput ¶
func (fv *FileView) KeyInput(kt *key.ChordEvent)
func (*FileView) NewFolder ¶
func (fv *FileView) NewFolder()
NewFolder creates a new folder in current directory
func (*FileView) PathComplete ¶
func (fv *FileView) PathComplete(data interface{}, path string, posLn, posCh int) (md complete.Matches)
PathComplete finds the possible completions for the path field
func (*FileView) PathCompleteEdit ¶
func (fv *FileView) PathCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, seed string) (ed complete.Edit)
PathCompleteEdit is the editing function called when inserting the completion selection in the path field
func (*FileView) PathFieldHistNext ¶
func (fv *FileView) PathFieldHistNext()
PathFieldHistNext goes to the next path in history
func (*FileView) PathFieldHistPrev ¶
func (fv *FileView) PathFieldHistPrev()
PathFieldHistPrev goes to the previous path in history
func (*FileView) SaveSortPrefs ¶
func (fv *FileView) SaveSortPrefs()
SaveSortPrefs saves current sorting preferences
func (*FileView) SelectFile ¶
func (fv *FileView) SelectFile()
SelectFile selects the current file -- if a directory it opens the directory; if a file it selects the file and closes dialog
func (*FileView) SelectedFile ¶
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) SetFilename ¶
SetFilename sets the initial filename (splitting out path and filename) and initializes the view
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) UpdateFavs ¶
func (fv *FileView) UpdateFavs()
UpdateFavs updates list of files and other views for current path
func (*FileView) UpdateFiles ¶
func (fv *FileView) UpdateFiles()
UpdateFiles updates list of files and other views for current path
func (*FileView) UpdateFilesAction ¶
func (fv *FileView) UpdateFilesAction()
UpdateFilesAction updates list of files and other views for current path, emitting FileSig signals around it -- this is for gui-generated actions only.
func (*FileView) UpdatePath ¶
func (fv *FileView) UpdatePath()
UpdatePath ensures that path is in abs form and ready to be used..
type FileViewFilterFunc ¶
FileViewFilterFunc is a filtering function for files -- returns true if the file should be visible in the view, and false if not
type FileViewSignals ¶
type FileViewSignals int64
FileViewSignals are signals that fileview sends based on user actions.
const ( // FileViewDoubleClicked emitted for double-click on a non-directory file // in table view (data is full selected file name w/ path) -- typically // closes dialog. FileViewDoubleClicked FileViewSignals = iota // FileViewWillUpdate emitted when list of files is about to be updated // based on user action (data is current path) -- current DirPath will be // used -- can intervene here if needed. FileViewWillUpdate // FileViewUpdated emitted after list of files has been updated (data is // current path). FileViewUpdated // FileViewNewFolder emitted when a new folder was created (data is // current path). FileViewNewFolder // FileViewFavAdded emitted when a new favorite was added (data is new // favorite path). FileViewFavAdded FileViewSignalsN )
func (*FileViewSignals) FromString ¶
func (i *FileViewSignals) FromString(s string) error
func (FileViewSignals) String ¶
func (i FileViewSignals) String() string
type FloatValueView ¶
type FloatValueView struct {
ValueViewBase
}
FloatValueView presents a spinbox
func (*FloatValueView) ConfigWidget ¶
func (vv *FloatValueView) ConfigWidget(widg gi.Node2D)
func (*FloatValueView) UpdateWidget ¶
func (vv *FloatValueView) UpdateWidget()
func (*FloatValueView) WidgetType ¶
func (vv *FloatValueView) WidgetType() reflect.Type
type FontValueView ¶
type FontValueView struct {
ValueViewBase
}
FontValueView presents an action for displaying a FontName and selecting fonts from FontChooserDialog
func (*FontValueView) Activate ¶
func (vv *FontValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*FontValueView) ConfigWidget ¶
func (vv *FontValueView) ConfigWidget(widg gi.Node2D)
func (*FontValueView) HasAction ¶
func (vv *FontValueView) HasAction() bool
func (*FontValueView) UpdateWidget ¶
func (vv *FontValueView) UpdateWidget()
func (*FontValueView) WidgetType ¶
func (vv *FontValueView) WidgetType() reflect.Type
type GiEditor ¶
type GiEditor struct { gi.Frame KiRoot ki.Ki `desc:"root of tree being edited"` Changed bool `desc:"has the root changed via gui actions? updated from treeview and structview for changes"` Filename gi.FileName `desc:"current filename for saving / loading"` }
GiEditor represents a struct, creating a property editor of the fields -- constructs Children widgets to show the field names and editor fields for each field, within an overall frame with an optional title, and a button box at the bottom where methods can be invoked
func AddNewGiEditor ¶ added in v0.9.7
AddNewGiEditor adds a new gieditor to given parent node, with given name.
func GoGiEditorDialog ¶
GoGiEditorDialog opens an interactive editor of the given Ki tree, at its root, returns GiEditor and window
func (*GiEditor) ConfigSplitView ¶
func (ge *GiEditor) ConfigSplitView()
ConfigSplitView configures the SplitView.
func (*GiEditor) ConfigToolbar ¶
func (ge *GiEditor) ConfigToolbar()
ConfigToolbar adds a GiEditor toolbar.
func (*GiEditor) Save ¶
func (ge *GiEditor) Save()
Save saves tree to current filename, in a standard JSON-formatted file
func (*GiEditor) SetChanged ¶
func (ge *GiEditor) SetChanged()
func (*GiEditor) StructView ¶
func (ge *GiEditor) StructView() *StructView
StructView returns the main StructView
func (*GiEditor) TitleWidget ¶
Title returns the title label widget, and its index, within frame
type HiMarkup ¶
type HiMarkup struct { Info *FileInfo `desc:"full info about the file including category etc"` Style gi.HiStyleName `desc:"syntax highlighting style"` Lang string `desc:"chroma-based language name for syntax highlighting the code"` Has bool `desc:"true if both lang and style are set"` TabSize int `desc:"tab size, in chars"` CSSProps ki.Props `json:"-" xml:"-" desc:"Commpiled CSS properties for given highlighting style"` PiState *pi.FileStates `desc:"pi parser state info"` PiLang pi.Lang `desc:"if supported, this is the pi Lang support for parsing"` HiStyle *histyle.Style `desc:"current highlighting style"` Off bool `desc:"external toggle to turn off automatic highlighting"` // contains filtered or unexported fields }
HiMarkup manages the syntax highlighting state for TextBuf it uses Pi if available, otherwise falls back on chroma
func (*HiMarkup) ChromaTagsAll ¶ added in v0.9.4
ChromaTagsAll returns all the markup tags according to current syntax highlighting settings
func (*HiMarkup) ChromaTagsForLine ¶ added in v0.9.4
ChromaTagsForLine generates the chroma tags for one line of chroma tokens
func (*HiMarkup) ChromaTagsLine ¶ added in v0.9.4
ChromaTagsLine returns tags for one line according to current syntax highlighting settings
func (*HiMarkup) HasHi ¶
HasHi returns true if there are highlighting parameters set (only valid after Init)
func (*HiMarkup) Init ¶
func (hm *HiMarkup) Init(info *FileInfo, pist *pi.FileStates)
Init initializes the syntax highlighting for current params
func (*HiMarkup) MarkupLine ¶
MarkupLine returns the line with html class tags added for each tag takes both the hi tags and extra tags. Only fully nested tags are supported -- any dangling ends are truncated.
func (*HiMarkup) MarkupTagsAll ¶
MarkupTagsAll returns all the markup tags according to current syntax highlighting settings
func (*HiMarkup) MarkupTagsLine ¶
MarkupTagsLine returns tags for one line according to current syntax highlighting settings
func (*HiMarkup) SetHiStyle ¶ added in v0.9.11
func (hm *HiMarkup) SetHiStyle(style gi.HiStyleName)
SetHiStyle sets the highlighting style and updates corresponding settings
type HiStyleValueView ¶
type HiStyleValueView struct {
ValueViewBase
}
HiStyleValueView presents an action for displaying a mat32.Y and selecting from styles
func (*HiStyleValueView) Activate ¶
func (vv *HiStyleValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*HiStyleValueView) ConfigWidget ¶
func (vv *HiStyleValueView) ConfigWidget(widg gi.Node2D)
func (*HiStyleValueView) HasAction ¶
func (vv *HiStyleValueView) HasAction() bool
func (*HiStyleValueView) UpdateWidget ¶
func (vv *HiStyleValueView) UpdateWidget()
func (*HiStyleValueView) WidgetType ¶
func (vv *HiStyleValueView) WidgetType() reflect.Type
type ISearch ¶
type ISearch struct { On bool `json:"-" xml:"-" desc:"if true, in interactive search mode"` Find string `json:"-" xml:"-" desc:"current interactive search string"` UseCase bool `json:"-" xml:"-" desc:"pay attention to case in isearch -- triggered by typing an upper-case letter"` Matches []textbuf.Match `json:"-" xml:"-" desc:"current search matches"` Pos int `json:"-" xml:"-" desc:"position within isearch matches"` PrevPos int `json:"-" xml:"-" desc:"position in search list from previous search"` StartPos lex.Pos `json:"-" xml:"-" desc:"starting position for search -- returns there after on cancel"` }
ISearch holds all the interactive search data
type IconValueView ¶
type IconValueView struct {
ValueViewBase
}
IconValueView presents an action for displaying an IconName and selecting icons from IconChooserDialog
func (*IconValueView) Activate ¶
func (vv *IconValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*IconValueView) ConfigWidget ¶
func (vv *IconValueView) ConfigWidget(widg gi.Node2D)
func (*IconValueView) HasAction ¶
func (vv *IconValueView) HasAction() bool
func (*IconValueView) UpdateWidget ¶
func (vv *IconValueView) UpdateWidget()
func (*IconValueView) WidgetType ¶
func (vv *IconValueView) WidgetType() reflect.Type
type IntValueView ¶
type IntValueView struct {
ValueViewBase
}
IntValueView presents a spinbox
func (*IntValueView) ConfigWidget ¶
func (vv *IntValueView) ConfigWidget(widg gi.Node2D)
func (*IntValueView) UpdateWidget ¶
func (vv *IntValueView) UpdateWidget()
func (*IntValueView) WidgetType ¶
func (vv *IntValueView) WidgetType() reflect.Type
type KeyChordEdit ¶
type KeyChordEdit struct { gi.Label FocusActive bool `json:"-" xml:"-" desc:"true if the keyboard focus is active or not -- when we lose active focus we apply changes"` KeyChordSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal -- only one event, when chord is updated from key input"` }
KeyChordEdit is a label widget that shows a key chord string, and, when in focus (after being clicked) will update to whatever key chord is typed -- used for representing and editing key chords.
func (*KeyChordEdit) ChordUpdated ¶
func (kc *KeyChordEdit) ChordUpdated()
ChordUpdated emits KeyChordSig when a new chord has been entered
func (*KeyChordEdit) ConnectEvents2D ¶
func (kc *KeyChordEdit) ConnectEvents2D()
func (*KeyChordEdit) Disconnect ¶ added in v0.9.8
func (kc *KeyChordEdit) Disconnect()
func (*KeyChordEdit) FocusChanged2D ¶
func (kc *KeyChordEdit) FocusChanged2D(change gi.FocusChanges)
func (*KeyChordEdit) KeyChordEvent ¶
func (kc *KeyChordEdit) KeyChordEvent()
func (*KeyChordEdit) MakeContextMenu ¶
func (kc *KeyChordEdit) MakeContextMenu(m *gi.Menu)
func (*KeyChordEdit) MouseEvent ¶
func (kc *KeyChordEdit) MouseEvent()
func (*KeyChordEdit) Style2D ¶
func (kc *KeyChordEdit) Style2D()
type KeyChordValueView ¶
type KeyChordValueView struct {
ValueViewBase
}
KeyChordValueView presents an KeyChordEdit for key.Chord
func (*KeyChordValueView) ConfigWidget ¶
func (vv *KeyChordValueView) ConfigWidget(widg gi.Node2D)
func (*KeyChordValueView) HasAction ¶
func (vv *KeyChordValueView) HasAction() bool
func (*KeyChordValueView) UpdateWidget ¶
func (vv *KeyChordValueView) UpdateWidget()
func (*KeyChordValueView) WidgetType ¶
func (vv *KeyChordValueView) WidgetType() reflect.Type
type KeyMapValueView ¶
type KeyMapValueView struct {
ValueViewBase
}
KeyMapValueView presents an action for displaying a KeyMapName and selecting from chooser
func (*KeyMapValueView) Activate ¶
func (vv *KeyMapValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*KeyMapValueView) ConfigWidget ¶
func (vv *KeyMapValueView) ConfigWidget(widg gi.Node2D)
func (*KeyMapValueView) HasAction ¶
func (vv *KeyMapValueView) HasAction() bool
func (*KeyMapValueView) UpdateWidget ¶
func (vv *KeyMapValueView) UpdateWidget()
func (*KeyMapValueView) WidgetType ¶
func (vv *KeyMapValueView) WidgetType() reflect.Type
type KiPtrValueView ¶
type KiPtrValueView struct {
ValueViewBase
}
KiPtrValueView provides a chooser for pointers to Ki objects
func (*KiPtrValueView) Activate ¶
func (vv *KiPtrValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*KiPtrValueView) ConfigWidget ¶
func (vv *KiPtrValueView) ConfigWidget(widg gi.Node2D)
func (*KiPtrValueView) HasAction ¶
func (vv *KiPtrValueView) HasAction() bool
func (*KiPtrValueView) KiStruct ¶
func (vv *KiPtrValueView) KiStruct() ki.Ki
get the Ki struct itself (or nil)
func (*KiPtrValueView) UpdateWidget ¶
func (vv *KiPtrValueView) UpdateWidget()
func (*KiPtrValueView) WidgetType ¶
func (vv *KiPtrValueView) WidgetType() reflect.Type
type LabelFunc ¶ added in v0.9.5
LabelFunc is a function that returns a string to set a label first argument is the object on which the method is defined (receiver)
type MapInlineValueView ¶
type MapInlineValueView struct {
ValueViewBase
}
MapInlineValueView presents a MapViewInline for a map
func (*MapInlineValueView) ConfigWidget ¶
func (vv *MapInlineValueView) ConfigWidget(widg gi.Node2D)
func (*MapInlineValueView) UpdateWidget ¶
func (vv *MapInlineValueView) UpdateWidget()
func (*MapInlineValueView) WidgetType ¶
func (vv *MapInlineValueView) WidgetType() reflect.Type
type MapValueView ¶
type MapValueView struct {
ValueViewBase
}
MapValueView presents a button to edit maps
func (*MapValueView) Activate ¶
func (vv *MapValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*MapValueView) ConfigWidget ¶
func (vv *MapValueView) ConfigWidget(widg gi.Node2D)
func (*MapValueView) HasAction ¶
func (vv *MapValueView) HasAction() bool
func (*MapValueView) UpdateWidget ¶
func (vv *MapValueView) UpdateWidget()
func (*MapValueView) WidgetType ¶
func (vv *MapValueView) WidgetType() reflect.Type
type MapView ¶
type MapView struct { gi.Frame Map interface{} `desc:"the map that we are a view onto"` MapValView ValueView `desc:"ValueView for the map itself, if this was created within value view framework -- otherwise nil"` Changed bool `desc:"has the map been edited?"` Keys []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map keys"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map values"` SortVals bool `desc:"sort by values instead of keys"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ MapViewSig ki.Signal `copy:"-" json:"-" xml:"-" desc:"map view specific signals: add, delete, double-click"` ViewPath string `` /* 134-byte string literal not displayed */ ToolbarMap interface{} `desc:"the map that we successfully set a toolbar for"` }
MapView represents a map, creating a property editor of the values -- constructs Children widgets to show the key / value pairs, within an overall frame.
func AddNewMapView ¶ added in v0.9.7
AddNewMapView adds a new mapview to given parent node, with given name.
func (*MapView) ConfigMapGrid ¶
func (mv *MapView) ConfigMapGrid()
ConfigMapGrid configures the MapGrid for the current map
func (*MapView) ConfigToolbar ¶
func (mv *MapView) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*MapView) Disconnect ¶ added in v0.9.8
func (mv *MapView) Disconnect()
func (*MapView) IsConfiged ¶ added in v0.9.8
IsConfiged returns true if the widget is fully configured
func (*MapView) KiPropTag ¶
KiPropTag returns the PropTag value from Ki owner of this map, if it is..
func (*MapView) MapChangeValueType ¶
MapChangeValueType changes the type of the value for given map element at idx -- for maps with interface{} values
func (*MapView) MapGrid ¶
MapGrid returns the MapGrid grid layout widget, which contains all the fields and values
func (*MapView) SetChanged ¶
func (mv *MapView) SetChanged()
SetChanged sets the Changed flag and emits the ViewSig signal for the MapView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.
func (*MapView) SetMap ¶
func (mv *MapView) SetMap(mp interface{})
SetMap sets the source map that we are viewing -- rebuilds the children to represent this map
func (*MapView) ToggleSort ¶
func (mv *MapView) ToggleSort()
ToggleSort toggles sorting by values vs. keys
func (*MapView) UpdateValues ¶
func (mv *MapView) UpdateValues()
UpdateValues updates the widget display of slice values, assuming same slice config
type MapViewInline ¶
type MapViewInline struct { gi.PartsWidgetBase Map interface{} `desc:"the map that we are a view onto"` MapValView ValueView `desc:"ValueView for the map itself, if this was created within value view framework -- otherwise nil"` Changed bool `desc:"has the map been edited?"` Keys []ValueView `json:"-" xml:"-" desc:"ValueView representations of the map keys"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ }
MapViewInline represents a map as a single line widget, for smaller maps and those explicitly marked inline -- constructs widgets in Parts to show the key names and editor vals for each value.
func (*MapViewInline) ConfigParts ¶
func (mv *MapViewInline) ConfigParts()
ConfigParts configures Parts for the current map
func (*MapViewInline) Disconnect ¶ added in v0.9.8
func (mv *MapViewInline) Disconnect()
func (*MapViewInline) Render2D ¶
func (mv *MapViewInline) Render2D()
func (*MapViewInline) SetChanged ¶
func (mv *MapViewInline) SetChanged()
SetChanged sets the Changed flag and emits the ViewSig signal for the SliceView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.
func (*MapViewInline) SetMap ¶
func (mv *MapViewInline) SetMap(mp interface{})
SetMap sets the source map that we are viewing -- rebuilds the children to represent this map
func (*MapViewInline) Style2D ¶
func (mv *MapViewInline) Style2D()
func (*MapViewInline) UpdateFromMap ¶
func (mv *MapViewInline) UpdateFromMap()
func (*MapViewInline) UpdateValues ¶
func (mv *MapViewInline) UpdateValues()
type MapViewSignals ¶ added in v0.9.14
type MapViewSignals int
MapViewSignals are signals that mapview can send, mostly for editing mode. Selection events are sent on WidgetSig WidgetSelected signals in both modes.
const ( // MapViewDoubleClicked emitted during inactive mode when item // double-clicked -- can be used for accepting dialog. MapViewDoubleClicked MapViewSignals = iota // MapViewAdded emitted when a new blank item is added -- no data is sent. MapViewAdded // MapViewDeleted emitted when an item is deleted -- data is key of item deleted MapViewDeleted MapViewSignalsN )
func (*MapViewSignals) FromString ¶ added in v0.9.15
func (i *MapViewSignals) FromString(s string) error
func (MapViewSignals) String ¶ added in v0.9.14
func (i MapViewSignals) String() string
type MethViewData ¶
type MethViewData struct { Val interface{} ValVal reflect.Value Vp *gi.Viewport2D Method string MethVal reflect.Value MethTyp reflect.Method ArgProps ki.PropSlice `desc:"names and other properties of args, in one-to-one with method args"` SpecProps ki.Props `desc:"props for special action types, e.g., FileView"` Desc string `desc:"prompt shown in arg dialog or confirm prompt dialog"` UpdateFunc ActionUpdateFunc `desc:"update function defined in properties -- called by our wrapper update function"` SubMenuSlice interface{} `desc:"value for submenu generation as a literal slice of items of appropriate type for method being called"` SubMenuField string `desc:"value for submenu generation as name of field on obj"` SubMenuFunc SubMenuFunc `desc:"function that will generate submenu items, as []string slice"` SubMenuVal interface{} `` /* 129-byte string literal not displayed */ KeyFun gi.KeyFuns `desc:"key function that we emit, if MethViewKeyFun type"` Flags MethViewFlags }
MethViewData is set to the Action.Data field for all MethView actions, containing info needed to actually call the Method on value Val.
func (*MethViewData) MethName ¶ added in v0.9.10
func (md *MethViewData) MethName() string
type MethViewFlags ¶
type MethViewFlags int32
MethViewFlags define bitflags for method view action options
const ( // MethViewConfirm confirms action before proceeding MethViewConfirm MethViewFlags = iota // MethViewShowReturn shows the return value from the method MethViewShowReturn // MethViewNoUpdateAfter means do not update window after method runs (default is to do so) MethViewNoUpdateAfter // MethViewHasSubMenu means that this action has a submenu option -- // argument values will be selected from the auto-generated submenu MethViewHasSubMenu // MethViewHasSubMenuVal means that this action was called using a submenu // and the SubMenuVal has the selected value MethViewHasSubMenuVal // MethViewKeyFun means this action's only function is to emit the key fun MethViewKeyFun MethViewFlagsN )
func (*MethViewFlags) FromString ¶
func (i *MethViewFlags) FromString(s string) error
func (MethViewFlags) String ¶
func (i MethViewFlags) String() string
type NilValueView ¶ added in v0.9.10
type NilValueView struct {
ValueViewBase
}
NilValueView presents a label saying 'nil' -- for any nil or otherwise unrepresentable items
func (*NilValueView) ConfigWidget ¶ added in v0.9.10
func (vv *NilValueView) ConfigWidget(widg gi.Node2D)
func (*NilValueView) UpdateWidget ¶ added in v0.9.10
func (vv *NilValueView) UpdateWidget()
func (*NilValueView) WidgetType ¶ added in v0.9.10
func (vv *NilValueView) WidgetType() reflect.Type
type OutBuf ¶ added in v0.9.4
type OutBuf struct { Out io.Reader `desc:"the output that we are reading from, as an io.Reader"` Buf *TextBuf `desc:"the TextBuf that we output to"` BatchMSec int `desc:"default 200: how many milliseconds to wait while batching output"` MarkupFun OutBufMarkupFunc `` /* 172-byte string literal not displayed */ CurOutLns [][]byte `desc:"current buffered output raw lines -- not yet sent to Buf"` CurOutMus [][]byte `desc:"current buffered output markup lines -- not yet sent to Buf"` Mu sync.Mutex `desc:"mutex protecting updating of CurOutLns and Buf, and timer"` LastOut time.Time `desc:"time when last output was sent to buffer"` AfterTimer *time.Timer `` /* 155-byte string literal not displayed */ }
OutBuf is a TextBuf that records the output from an io.Reader using bufio.Scanner -- optimized to combine fast chunks of output into large blocks of updating. Also supports arbitrary markup function that operates on each line of output bytes.
type OutBufMarkupFunc ¶ added in v0.9.4
OutBufMarkupFunc is a function that returns a marked-up version of a given line of output text by adding html tags. It is essential that it ONLY adds tags, and otherwise has the exact same visible bytes as the input
type QReplace ¶
type QReplace struct { On bool `json:"-" xml:"-" desc:"if true, in interactive search mode"` Find string `json:"-" xml:"-" desc:"current interactive search string"` Replace string `json:"-" xml:"-" desc:"current interactive search string"` UseCase bool `json:"-" xml:"-" desc:"pay attention to case in isearch -- triggered by typing an upper-case letter"` LexItems bool `` /* 128-byte string literal not displayed */ Matches []textbuf.Match `json:"-" xml:"-" desc:"current search matches"` Pos int `json:"-" xml:"-" desc:"position within isearch matches"` PrevPos int `json:"-" xml:"-" desc:"position in search list from previous search"` StartPos lex.Pos `json:"-" xml:"-" desc:"starting position for search -- returns there after on cancel"` }
QReplace holds all the query-replace data
type RuneSliceValueView ¶
type RuneSliceValueView struct {
ValueViewBase
}
RuneSliceValueView presents a textfield of the bytes
func (*RuneSliceValueView) ConfigWidget ¶
func (vv *RuneSliceValueView) ConfigWidget(widg gi.Node2D)
func (*RuneSliceValueView) UpdateWidget ¶
func (vv *RuneSliceValueView) UpdateWidget()
func (*RuneSliceValueView) WidgetType ¶
func (vv *RuneSliceValueView) WidgetType() reflect.Type
type ShortcutFunc ¶
ShortcutFunc is a function that returns a key.Chord string for a shortcut used in MethView shortcut-func option first argument is the object on which the method is defined (receiver)
type SliceInlineValueView ¶
type SliceInlineValueView struct {
ValueViewBase
}
SliceInlineValueView presents a SliceViewInline for a map
func (*SliceInlineValueView) ConfigWidget ¶
func (vv *SliceInlineValueView) ConfigWidget(widg gi.Node2D)
func (*SliceInlineValueView) UpdateWidget ¶
func (vv *SliceInlineValueView) UpdateWidget()
func (*SliceInlineValueView) WidgetType ¶
func (vv *SliceInlineValueView) WidgetType() reflect.Type
type SliceValueView ¶
type SliceValueView struct { ValueViewBase IsArray bool // is an array, not a slice ElType reflect.Type // type of element in the slice -- has pointer if slice has pointers ElIsStruct bool // whether non-pointer element type is a struct or not }
SliceValueView presents a button to edit slices
func (*SliceValueView) Activate ¶
func (vv *SliceValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*SliceValueView) ConfigWidget ¶
func (vv *SliceValueView) ConfigWidget(widg gi.Node2D)
func (*SliceValueView) HasAction ¶
func (vv *SliceValueView) HasAction() bool
func (*SliceValueView) UpdateWidget ¶
func (vv *SliceValueView) UpdateWidget()
func (*SliceValueView) WidgetType ¶
func (vv *SliceValueView) WidgetType() reflect.Type
type SliceView ¶
type SliceView struct { SliceViewBase StyleFunc SliceViewStyleFunc `copy:"-" view:"-" json:"-" xml:"-" desc:"optional styling function"` }
SliceView represents a slice, creating an interactive viewer / editor of the elements as rows in a table. Widgets to show the index / value pairs, within an overall frame. Set to Inactive for select-only mode, which emits WidgetSig WidgetSelected signals when selection is updated.
func AddNewSliceView ¶ added in v0.9.7
AddNewSliceView adds a new sliceview to given parent node, with given name.
type SliceViewBase ¶ added in v0.9.8
type SliceViewBase struct { gi.Frame Slice interface{} `copy:"-" view:"-" json:"-" xml:"-" desc:"the slice that we are a view onto -- must be a pointer to that slice"` ViewMu *sync.Mutex `` /* 293-byte string literal not displayed */ SliceNPVal reflect.Value `copy:"-" view:"-" json:"-" xml:"-" desc:"non-ptr reflect.Value of the slice"` SliceValView ValueView `` /* 138-byte string literal not displayed */ NoAdd bool `desc:"if true, user cannot add elements to the slice"` NoDelete bool `desc:"if true, user cannot delete elements from the slice"` ShowViewCtxtMenu bool `` /* 131-byte string literal not displayed */ Changed bool `desc:"has the slice been edited?"` Values []ValueView `copy:"-" view:"-" json:"-" xml:"-" desc:"ValueView representations of the slice values"` ShowIndex bool `xml:"index" desc:"whether to show index or not -- updated from 'index' property (bool)"` SelVal interface{} `copy:"-" view:"-" json:"-" xml:"-" desc:"current selection value -- initially select this value if set"` SelectedIdx int `copy:"-" json:"-" xml:"-" desc:"index of currently-selected item, in Inactive mode only"` SelectMode bool `copy:"-" desc:"editing-mode select rows mode"` SelectedIdxs map[int]struct{} `copy:"-" desc:"list of currently-selected slice indexes"` DraggedIdxs []int `copy:"-" desc:"list of currently-dragged indexes"` SliceViewSig ki.Signal `copy:"-" json:"-" xml:"-" desc:"slice view specific signals: insert, delete, double-click"` ViewSig ki.Signal `` /* 188-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ TmpSave ValueView `` /* 198-byte string literal not displayed */ ToolbarSlice interface{} `copy:"-" view:"-" json:"-" xml:"-" desc:"the slice that we successfully set a toolbar for"` SliceSize int `view:"inactive" copy:"-" json:"-" xml:"-" desc:"size of slice"` DispRows int `view:"inactive" copy:"-" json:"-" xml:"-" desc:"actual number of rows displayed = min(VisRows, SliceSize)"` StartIdx int `view:"inactive" copy:"-" json:"-" xml:"-" desc:"starting slice index of visible rows"` RowHeight float32 `view:"inactive" copy:"-" json:"-" xml:"-" desc:"height of a single row"` VisRows int `view:"inactive" copy:"-" json:"-" xml:"-" desc:"total number of rows visible in allocated display size"` LayoutHeight float32 `copy:"-" view:"-" json:"-" xml:"-" desc:"the height of grid from last layout -- determines when update needed"` RenderedRows int `copy:"-" view:"-" json:"-" xml:"-" desc:"the number of rows rendered -- determines update"` InFocusGrab bool `copy:"-" view:"-" json:"-" xml:"-" desc:"guard for recursive focus grabbing"` InFullRebuild bool `copy:"-" view:"-" json:"-" xml:"-" desc:"guard for recursive rebuild"` CurIdx int `copy:"-" view:"-" json:"-" xml:"-" desc:"temp idx state for e.g., dnd"` // contains filtered or unexported fields }
SliceViewBase is the base for SliceView and TableView and any other viewers of array-like data. It automatically computes the number of rows that fit within its allocated space, and manages the offset view window into the full list of items, and supports row selection, copy / paste, Drag-n-Drop, etc. Set to Inactive for select-only mode, which emits WidgetSig WidgetSelected signals when selection is updated.
func AddNewSliceViewBase ¶ added in v0.9.8
func AddNewSliceViewBase(parent ki.Ki, name string) *SliceViewBase
AddNewSliceViewBase adds a new sliceview to given parent node, with given name.
func (*SliceViewBase) AsSliceViewBase ¶ added in v0.9.8
func (sv *SliceViewBase) AsSliceViewBase() *SliceViewBase
func (*SliceViewBase) AvailHeight ¶ added in v0.9.8
func (sv *SliceViewBase) AvailHeight() float32
func (*SliceViewBase) Config ¶ added in v0.9.8
func (sv *SliceViewBase) Config()
Config configures a standard setup of the overall Frame
func (*SliceViewBase) ConfigScroll ¶ added in v0.9.8
func (sv *SliceViewBase) ConfigScroll()
ConfigScroll configures the scrollbar
func (*SliceViewBase) ConfigSliceGrid ¶ added in v0.9.8
func (sv *SliceViewBase) ConfigSliceGrid()
ConfigSliceGrid configures the SliceGrid for the current slice it is only called once at start, under overall Config
func (*SliceViewBase) ConfigToolbar ¶ added in v0.9.8
func (sv *SliceViewBase) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*SliceViewBase) ConnectEvents2D ¶ added in v0.9.8
func (sv *SliceViewBase) ConnectEvents2D()
func (*SliceViewBase) Copy ¶ added in v0.9.8
func (sv *SliceViewBase) Copy(reset bool)
Copy copies selected rows to clip.Board, optionally resetting the selection satisfies gi.Clipper interface and can be overridden by subtypes
func (*SliceViewBase) CopyIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) CopyIdxs(reset bool)
CopyIdxs copies selected idxs to clip.Board, optionally resetting the selection
func (*SliceViewBase) CopySelToMime ¶ added in v0.9.8
func (sv *SliceViewBase) CopySelToMime() mimedata.Mimes
CopySelToMime copies selected rows to mime data
func (*SliceViewBase) Cut ¶ added in v0.9.8
func (sv *SliceViewBase) Cut()
Cut copies selected indexes to clip.Board and deletes selected indexes satisfies gi.Clipper interface and can be overridden by subtypes
func (*SliceViewBase) CutIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) CutIdxs()
CutIdxs copies selected indexes to clip.Board and deletes selected indexes
func (*SliceViewBase) DeleteIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) DeleteIdxs()
DeleteIdxs deletes all selected indexes
func (*SliceViewBase) Disconnect ¶ added in v0.9.8
func (sv *SliceViewBase) Disconnect()
func (*SliceViewBase) DragNDropFinalize ¶ added in v0.9.8
func (sv *SliceViewBase) DragNDropFinalize(mod dnd.DropMods)
DragNDropFinalize is called to finalize actions on the Source node prior to performing target actions -- mod must indicate actual action taken by the target, including ignore -- ends up calling DragNDropSource if us..
func (*SliceViewBase) DragNDropSource ¶ added in v0.9.8
func (sv *SliceViewBase) DragNDropSource(de *dnd.Event)
DragNDropSource is called after target accepts the drop -- we just remove elements that were moved
func (*SliceViewBase) DragNDropStart ¶ added in v0.9.8
func (sv *SliceViewBase) DragNDropStart()
DragNDropStart starts a drag-n-drop
func (*SliceViewBase) DragNDropTarget ¶ added in v0.9.8
func (sv *SliceViewBase) DragNDropTarget(de *dnd.Event)
DragNDropTarget handles a drag-n-drop drop
func (*SliceViewBase) Drop ¶ added in v0.9.8
func (sv *SliceViewBase) Drop(md mimedata.Mimes, mod dnd.DropMods)
Drop pops up a menu to determine what specifically to do with dropped items this satisfies gi.DragNDropper interface, and can be overwritten in subtypes
func (*SliceViewBase) DropAfter ¶ added in v0.9.8
DropAfter inserts object(s) from mime data after this node
func (*SliceViewBase) DropAssign ¶ added in v0.9.8
func (sv *SliceViewBase) DropAssign(md mimedata.Mimes, idx int)
DropAssign assigns mime data (only the first one!) to this node
func (*SliceViewBase) DropBefore ¶ added in v0.9.8
DropBefore inserts object(s) from mime data before this node
func (*SliceViewBase) DropCancel ¶ added in v0.9.8
func (sv *SliceViewBase) DropCancel()
DropCancel cancels the drop action e.g., preventing deleting of source items in a Move case
func (*SliceViewBase) Duplicate ¶ added in v0.9.8
func (sv *SliceViewBase) Duplicate() int
Duplicate copies selected items and inserts them after current selection -- return idx of start of duplicates if successful, else -1
func (*SliceViewBase) FromMimeData ¶ added in v0.9.8
func (sv *SliceViewBase) FromMimeData(md mimedata.Mimes) []interface{}
FromMimeData creates a slice of structs from mime data
func (*SliceViewBase) GridLayout ¶ added in v0.9.8
func (sv *SliceViewBase) GridLayout() *gi.Layout
GridLayout returns the Layout containing the Grid and the scrollbar
func (*SliceViewBase) HasFocus2D ¶ added in v0.9.8
func (sv *SliceViewBase) HasFocus2D() bool
func (*SliceViewBase) IdxFromPos ¶ added in v0.9.8
func (sv *SliceViewBase) IdxFromPos(posY int) (int, bool)
IdxFromPos returns the idx that contains given vertical position, false if not found
func (*SliceViewBase) IdxGrabFocus ¶ added in v0.9.8
func (sv *SliceViewBase) IdxGrabFocus(idx int) *gi.WidgetBase
IdxGrabFocus grabs the focus for the first focusable widget in given idx -- returns that element or nil if not successful
func (*SliceViewBase) IdxIsSelected ¶ added in v0.9.8
func (sv *SliceViewBase) IdxIsSelected(idx int) bool
IdxIsSelected returns the selected status of given slice index
func (*SliceViewBase) IdxPos ¶ added in v0.9.8
func (sv *SliceViewBase) IdxPos(idx int) image.Point
IdxPos returns center of window position of index label for idx (ContextMenuPos)
func (*SliceViewBase) IsConfiged ¶ added in v0.9.8
func (sv *SliceViewBase) IsConfiged() bool
IsConfiged returns true if the widget is fully configured
func (*SliceViewBase) IsIdxVisible ¶ added in v0.9.8
func (sv *SliceViewBase) IsIdxVisible(idx int) bool
IsIdxVisible returns true if slice index is currently visible
func (*SliceViewBase) IsRowInBounds ¶ added in v0.9.8
func (sv *SliceViewBase) IsRowInBounds(row int) bool
IsRowInBounds returns true if disp row is in bounds
func (*SliceViewBase) ItemCtxtMenu ¶ added in v0.9.8
func (sv *SliceViewBase) ItemCtxtMenu(idx int)
func (*SliceViewBase) KeyInputActive ¶ added in v0.9.8
func (sv *SliceViewBase) KeyInputActive(kt *key.ChordEvent)
func (*SliceViewBase) KeyInputInactive ¶ added in v0.9.8
func (sv *SliceViewBase) KeyInputInactive(kt *key.ChordEvent)
func (*SliceViewBase) LayoutSliceGrid ¶ added in v0.9.8
func (sv *SliceViewBase) LayoutSliceGrid() bool
LayoutSliceGrid does the proper layout of slice grid depending on allocated size returns true if UpdateSliceGrid should be called after this
func (*SliceViewBase) MakeDropMenu ¶ added in v0.9.8
MakeDropMenu makes the menu of options for dropping on a target
func (*SliceViewBase) MakePasteMenu ¶ added in v0.9.8
func (sv *SliceViewBase) MakePasteMenu(m *gi.Menu, data interface{}, idx int)
MakePasteMenu makes the menu of options for paste events
func (*SliceViewBase) MimeDataIdx ¶ added in v0.9.8
func (sv *SliceViewBase) MimeDataIdx(md *mimedata.Mimes, idx int)
MimeDataIdx adds mimedata for given idx: an application/json of the struct
func (*SliceViewBase) MimeDataType ¶ added in v0.9.10
func (sv *SliceViewBase) MimeDataType() string
MimeDataType returns the data type for mime clipboard (copy / paste) data e.g., filecat.DataJson
func (*SliceViewBase) MoveDown ¶ added in v0.9.8
func (sv *SliceViewBase) MoveDown(selMode mouse.SelectModes) int
MoveDown moves the selection down to next row, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*SliceViewBase) MoveDownAction ¶ added in v0.9.8
func (sv *SliceViewBase) MoveDownAction(selMode mouse.SelectModes) int
MoveDownAction moves the selection down to next row, using given select mode (from keyboard modifiers) -- and emits select event for newly selected row
func (*SliceViewBase) MovePageDown ¶ added in v0.9.8
func (sv *SliceViewBase) MovePageDown(selMode mouse.SelectModes) int
MovePageDown moves the selection down to next page, using given select mode (from keyboard modifiers) -- returns newly selected idx or -1 if failed
func (*SliceViewBase) MovePageDownAction ¶ added in v0.9.8
func (sv *SliceViewBase) MovePageDownAction(selMode mouse.SelectModes) int
MovePageDownAction moves the selection down to next page, using given select mode (from keyboard modifiers) -- and emits select event for newly selected idx
func (*SliceViewBase) MovePageUp ¶ added in v0.9.8
func (sv *SliceViewBase) MovePageUp(selMode mouse.SelectModes) int
MovePageUp moves the selection up to previous page, using given select mode (from keyboard modifiers) -- returns newly selected idx or -1 if failed
func (*SliceViewBase) MovePageUpAction ¶ added in v0.9.8
func (sv *SliceViewBase) MovePageUpAction(selMode mouse.SelectModes) int
MovePageUpAction moves the selection up to previous page, using given select mode (from keyboard modifiers) -- and emits select event for newly selected idx
func (*SliceViewBase) MoveUp ¶ added in v0.9.8
func (sv *SliceViewBase) MoveUp(selMode mouse.SelectModes) int
MoveUp moves the selection up to previous idx, using given select mode (from keyboard modifiers) -- returns newly selected idx or -1 if failed
func (*SliceViewBase) MoveUpAction ¶ added in v0.9.8
func (sv *SliceViewBase) MoveUpAction(selMode mouse.SelectModes) int
MoveUpAction moves the selection up to previous idx, using given select mode (from keyboard modifiers) -- and emits select event for newly selected idx
func (*SliceViewBase) Paste ¶ added in v0.9.8
func (sv *SliceViewBase) Paste()
Paste pastes clipboard at CurIdx satisfies gi.Clipper interface and can be overridden by subtypes
func (*SliceViewBase) PasteAssign ¶ added in v0.9.8
func (sv *SliceViewBase) PasteAssign(md mimedata.Mimes, idx int)
PasteAssign assigns mime data (only the first one!) to this idx
func (*SliceViewBase) PasteAtIdx ¶ added in v0.9.8
func (sv *SliceViewBase) PasteAtIdx(md mimedata.Mimes, idx int)
PasteAtIdx inserts object(s) from mime data at (before) given slice index
func (*SliceViewBase) PasteIdx ¶ added in v0.9.8
func (sv *SliceViewBase) PasteIdx(idx int)
PasteIdx pastes clipboard at given idx
func (*SliceViewBase) PasteMenu ¶ added in v0.9.8
func (sv *SliceViewBase) PasteMenu(md mimedata.Mimes, idx int)
PasteMenu performs a paste from the clipboard using given data -- pops up a menu to determine what specifically to do
func (*SliceViewBase) Render2D ¶ added in v0.9.8
func (sv *SliceViewBase) Render2D()
func (*SliceViewBase) ResetSelectedIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) ResetSelectedIdxs()
func (*SliceViewBase) RowFirstWidget ¶ added in v0.9.8
func (sv *SliceViewBase) RowFirstWidget(row int) (*gi.WidgetBase, bool)
RowFirstWidget returns the first widget for given row (could be index or not) -- false if out of range
func (*SliceViewBase) RowFromPos ¶ added in v0.9.8
func (sv *SliceViewBase) RowFromPos(posY int) (int, bool)
RowFromPos returns the row that contains given vertical position, false if not found
func (*SliceViewBase) RowGrabFocus ¶ added in v0.9.8
func (sv *SliceViewBase) RowGrabFocus(row int) *gi.WidgetBase
RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!
func (*SliceViewBase) RowWidgetNs ¶ added in v0.9.8
func (sv *SliceViewBase) RowWidgetNs() (nWidgPerRow, idxOff int)
RowWidgetNs returns number of widgets per row and offset for index label
func (*SliceViewBase) SaveDraggedIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) SaveDraggedIdxs(idx int)
SaveDraggedIdxs saves selectedindexes into dragged indexes taking into account insertion at idx
func (*SliceViewBase) ScrollBar ¶ added in v0.9.8
func (sv *SliceViewBase) ScrollBar() *gi.ScrollBar
ScrollBar returns the SliceGrid scrollbar
func (*SliceViewBase) ScrollToIdx ¶ added in v0.9.8
func (sv *SliceViewBase) ScrollToIdx(idx int) bool
ScrollToIdx ensures that given slice idx is visible by scrolling display as needed
func (*SliceViewBase) SelectAllIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) SelectAllIdxs()
SelectAllIdxs selects all idxs
func (*SliceViewBase) SelectIdx ¶ added in v0.9.8
func (sv *SliceViewBase) SelectIdx(idx int)
SelectIdx selects given idx (if not already selected) -- updates select status of index label
func (*SliceViewBase) SelectIdxAction ¶ added in v0.9.8
func (sv *SliceViewBase) SelectIdxAction(idx int, mode mouse.SelectModes)
SelectIdxAction is called when a select action has been received (e.g., a mouse click) -- translates into selection updates -- gets selection mode from mouse event (ExtendContinuous, ExtendOne)
func (*SliceViewBase) SelectIdxWidgets ¶ added in v0.9.8
func (sv *SliceViewBase) SelectIdxWidgets(idx int, sel bool) bool
SelectIdxWidgets sets the selection state of given slice index returns false if index is not visible
func (*SliceViewBase) SelectRowWidgets ¶ added in v0.9.8
func (sv *SliceViewBase) SelectRowWidgets(row int, sel bool)
SelectRowWidgets sets the selection state of given row of widgets
func (*SliceViewBase) SelectVal ¶ added in v0.9.8
func (sv *SliceViewBase) SelectVal(val string) bool
SelectVal sets SelVal and attempts to find corresponding row, setting SelectedIdx and selecting row if found -- returns true if found, false otherwise.
func (*SliceViewBase) SelectedIdxsList ¶ added in v0.9.8
func (sv *SliceViewBase) SelectedIdxsList(descendingSort bool) []int
SelectedIdxsList returns list of selected indexes, sorted either ascending or descending
func (*SliceViewBase) SetChanged ¶ added in v0.9.8
func (sv *SliceViewBase) SetChanged()
SetChanged sets the Changed flag and emits the ViewSig signal for the SliceViewBase, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.
func (*SliceViewBase) SetSlice ¶ added in v0.9.8
func (sv *SliceViewBase) SetSlice(sl interface{})
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*SliceViewBase) SliceDeleteAt ¶ added in v0.9.8
func (sv *SliceViewBase) SliceDeleteAt(idx int, doupdt bool)
SliceDeleteAt deletes element at given index from slice if updt is true, then update the grid after
func (*SliceViewBase) SliceDeleteAtRow ¶ added in v0.9.8
func (sv *SliceViewBase) SliceDeleteAtRow(row int, updt bool)
SliceDeleteAtRow deletes element at given display row if updt is true, then update the grid after
func (*SliceViewBase) SliceGrid ¶ added in v0.9.8
func (sv *SliceViewBase) SliceGrid() *gi.Frame
SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values
func (*SliceViewBase) SliceGridNeedsLayout ¶ added in v0.9.8
func (sv *SliceViewBase) SliceGridNeedsLayout() bool
func (*SliceViewBase) SliceNewAt ¶ added in v0.9.8
func (sv *SliceViewBase) SliceNewAt(idx int)
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*SliceViewBase) SliceNewAtRow ¶ added in v0.9.8
func (sv *SliceViewBase) SliceNewAtRow(row int)
SliceNewAtRow inserts a new blank element at given display row
func (*SliceViewBase) SliceVal ¶ added in v0.9.8
func (sv *SliceViewBase) SliceVal(idx int) interface{}
SliceVal returns value interface at given slice index must be protected by mutex
func (*SliceViewBase) SliceViewBaseEvents ¶ added in v0.9.8
func (sv *SliceViewBase) SliceViewBaseEvents()
func (*SliceViewBase) StdCtxtMenu ¶ added in v0.9.8
func (sv *SliceViewBase) StdCtxtMenu(m *gi.Menu, idx int)
func (*SliceViewBase) Style2D ¶ added in v0.9.8
func (sv *SliceViewBase) Style2D()
func (*SliceViewBase) ToolBar ¶ added in v0.9.8
func (sv *SliceViewBase) ToolBar() *gi.ToolBar
ToolBar returns the toolbar widget
func (*SliceViewBase) UnselectAllIdxs ¶ added in v0.9.8
func (sv *SliceViewBase) UnselectAllIdxs()
UnselectAllIdxs unselects all selected idxs
func (*SliceViewBase) UnselectIdx ¶ added in v0.9.8
func (sv *SliceViewBase) UnselectIdx(idx int)
UnselectIdx unselects given idx (if selected)
func (*SliceViewBase) UnselectIdxAction ¶ added in v0.9.8
func (sv *SliceViewBase) UnselectIdxAction(idx int)
UnselectIdxAction unselects this idx (if selected) -- and emits a signal
func (*SliceViewBase) Update ¶ added in v0.9.8
func (sv *SliceViewBase) Update()
Update is the high-level update display call -- robust to any changes
func (*SliceViewBase) UpdateScroll ¶ added in v0.9.8
func (sv *SliceViewBase) UpdateScroll()
UpdateScroll updates grid scrollbar based on display
func (*SliceViewBase) UpdateSelectIdx ¶ added in v0.9.8
func (sv *SliceViewBase) UpdateSelectIdx(idx int, sel bool)
UpdateSelectIdx updates the selection for the given index
func (*SliceViewBase) UpdateSelectRow ¶ added in v0.9.8
func (sv *SliceViewBase) UpdateSelectRow(row int, sel bool)
UpdateSelectRow updates the selection for the given row callback from widgetsig select
func (*SliceViewBase) UpdateSliceGrid ¶ added in v0.9.8
func (sv *SliceViewBase) UpdateSliceGrid()
UpdateSliceGrid updates grid display -- robust to any time calling
func (*SliceViewBase) UpdateValues ¶ added in v0.9.8
func (sv *SliceViewBase) UpdateValues()
UpdateValues updates the widget display of slice values, assuming same slice config
func (*SliceViewBase) UpdtSliceSize ¶ added in v0.9.8
func (sv *SliceViewBase) UpdtSliceSize() int
UpdtSliceSize updates and returns the size of the slice and sets SliceSize
func (*SliceViewBase) ViewMuLock ¶ added in v1.0.0
func (sv *SliceViewBase) ViewMuLock()
ViewMuLock locks the ViewMu if non-nil
func (*SliceViewBase) ViewMuUnlock ¶ added in v1.0.0
func (sv *SliceViewBase) ViewMuUnlock()
ViewMuUnlock Unlocks the ViewMu if non-nil
type SliceViewInline ¶
type SliceViewInline struct { gi.PartsWidgetBase Slice interface{} `desc:"the slice that we are a view onto"` SliceValView ValueView `desc:"ValueView for the slice itself, if this was created within value view framework -- otherwise nil"` IsArray bool `desc:"whether the slice is actually an array -- no modifications"` IsFixedLen bool `desc:"whether the slice has a fixed-len flag on it"` Changed bool `desc:"has the slice been edited?"` Values []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ }
SliceViewInline represents a slice as a single line widget, for smaller slices and those explicitly marked inline -- constructs widgets in Parts to show the key names and editor vals for each value.
func (*SliceViewInline) ConfigParts ¶
func (sv *SliceViewInline) ConfigParts()
ConfigParts configures Parts for the current slice
func (*SliceViewInline) Disconnect ¶ added in v0.9.8
func (sv *SliceViewInline) Disconnect()
func (*SliceViewInline) Render2D ¶
func (sv *SliceViewInline) Render2D()
func (*SliceViewInline) SetChanged ¶
func (sv *SliceViewInline) SetChanged()
SetChanged sets the Changed flag and emits the ViewSig signal for the SliceView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.
func (*SliceViewInline) SetSlice ¶
func (sv *SliceViewInline) SetSlice(sl interface{})
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*SliceViewInline) SliceNewAt ¶
func (sv *SliceViewInline) SliceNewAt(idx int, reconfig bool)
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*SliceViewInline) Style2D ¶
func (sv *SliceViewInline) Style2D()
func (*SliceViewInline) UpdateFromSlice ¶
func (sv *SliceViewInline) UpdateFromSlice()
func (*SliceViewInline) UpdateValues ¶
func (sv *SliceViewInline) UpdateValues()
type SliceViewSignals ¶
type SliceViewSignals int
SliceViewSignals are signals that sliceview can send, mostly for editing mode. Selection events are sent on WidgetSig WidgetSelected signals in both modes.
const ( // SliceViewDoubleClicked emitted during inactive mode when item // double-clicked -- can be used for accepting dialog. SliceViewDoubleClicked SliceViewSignals = iota // SliceViewInserted emitted when a new item is inserted -- data is index of new item SliceViewInserted // SliceViewDeleted emitted when an item is deleted -- data is index of item deleted SliceViewDeleted SliceViewSignalsN )
func (*SliceViewSignals) FromString ¶
func (i *SliceViewSignals) FromString(s string) error
func (SliceViewSignals) String ¶
func (i SliceViewSignals) String() string
type SliceViewStyleFunc ¶
type SliceViewStyleFunc func(sv *SliceView, slice interface{}, widg gi.Node2D, row int, vv ValueView)
SliceViewStyleFunc is a styling function for custom styling / configuration of elements in the view. If style properties are set then you must call widg.AsNode2dD().SetFullReRender() to trigger re-styling during re-render
type SliceViewer ¶ added in v0.9.8
type SliceViewer interface { // AsSliceViewBase returns the base for direct access to relevant fields etc AsSliceViewBase() *SliceViewBase // Config configures the view Config() // IsConfiged returns true if is fully configured for display IsConfiged() bool // SliceGrid returns the SliceGrid grid frame widget, which contains all the // fields and values SliceGrid() *gi.Frame // ScrollBar returns the SliceGrid scrollbar ScrollBar() *gi.ScrollBar // RowWidgetNs returns number of widgets per row and offset for index label RowWidgetNs() (nWidgPerRow, idxOff int) // SliceSize returns the current size of the slice and sets SliceSize UpdtSliceSize() int // LayoutSliceGrid does the proper layout of slice grid depending on allocated size // returns true if UpdateSliceGrid should be called after this LayoutSliceGrid() bool // UpdateSliceGrid updates grid display -- robust to any time calling UpdateSliceGrid() // StyleRow calls a custom style function on given row (and field) StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv ValueView) // RowFirstWidget returns the first widget for given row (could be index or // not) -- false if out of range RowFirstWidget(row int) (*gi.WidgetBase, bool) // RowGrabFocus grabs the focus for the first focusable widget in given row -- // returns that element or nil if not successful -- note: grid must have // already rendered for focus to be grabbed! RowGrabFocus(row int) *gi.WidgetBase // SelectRowWidgets sets the selection state of given row of widgets SelectRowWidgets(row int, sel bool) // SliceNewAt inserts a new blank element at given index in the slice -- -1 // means the end SliceNewAt(idx int) // SliceDeleteAt deletes element at given index from slice // if updt is true, then update the grid after SliceDeleteAt(idx int, updt bool) // MimeDataType returns the data type for mime clipboard (copy / paste) data // e.g., filecat.DataJson MimeDataType() string // CopySelToMime copies selected rows to mime data CopySelToMime() mimedata.Mimes // PasteAssign assigns mime data (only the first one!) to this idx PasteAssign(md mimedata.Mimes, idx int) // PasteAtIdx inserts object(s) from mime data at (before) given slice index PasteAtIdx(md mimedata.Mimes, idx int) // ItemCtxtMenu pulls up the context menu for given slice index ItemCtxtMenu(idx int) }
SliceViewer is the interface used by SliceViewBase to support any abstractions needed for different types of slice views.
type StructFieldVals ¶ added in v0.9.8
type StructFieldVals struct { Path string `desc:"path of field.field parent fields to this field"` Field reflect.StructField `desc:"type information for field"` Val reflect.Value `desc:"value of field (as a pointer)"` Defs string `desc:"def tag information for default values"` }
StructFieldVals represents field values in a struct, at multiple levels of depth potentially (represented by the Path field) used for StructNonDefFields for example.
func StructNonDefFields ¶ added in v0.9.8
func StructNonDefFields(structPtr interface{}, path string) []StructFieldVals
StructNonDefFields processses "def" tag for default value(s) of fields in given struct and starting path, and returns all fields not at their default values. See also StructNoDefFieldsStr for a string representation of this information. Uses kit.FlatFieldsValueFunc to get all embedded fields. Uses a recursive strategy -- any fields that are themselves structs are expanded, and the field name represented by dots path separators.
type StructInlineValueView ¶
type StructInlineValueView struct {
ValueViewBase
}
StructInlineValueView presents a StructViewInline for a struct
func (*StructInlineValueView) ConfigWidget ¶
func (vv *StructInlineValueView) ConfigWidget(widg gi.Node2D)
func (*StructInlineValueView) UpdateWidget ¶
func (vv *StructInlineValueView) UpdateWidget()
func (*StructInlineValueView) WidgetType ¶
func (vv *StructInlineValueView) WidgetType() reflect.Type
type StructValueView ¶
type StructValueView struct {
ValueViewBase
}
StructValueView presents a button to edit the struct
func (*StructValueView) Activate ¶
func (vv *StructValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*StructValueView) ConfigWidget ¶
func (vv *StructValueView) ConfigWidget(widg gi.Node2D)
func (*StructValueView) HasAction ¶
func (vv *StructValueView) HasAction() bool
func (*StructValueView) UpdateWidget ¶
func (vv *StructValueView) UpdateWidget()
func (*StructValueView) WidgetType ¶
func (vv *StructValueView) WidgetType() reflect.Type
type StructView ¶
type StructView struct { gi.Frame Struct interface{} `desc:"the struct that we are a view onto"` StructValView ValueView `desc:"ValueView for the struct itself, if this was created within value view framework -- otherwise nil"` Changed bool `desc:"has the value of any field changed? updated by the ViewSig signals from fields"` ChangeFlag *reflect.Value `` /* 169-byte string literal not displayed */ FieldViews []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 179-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ ToolbarStru interface{} `desc:"the struct that we successfully set a toolbar for"` HasDefs bool `json:"-" xml:"-" view:"inactive" desc:"if true, some fields have default values -- update labels when values change"` TypeFieldTags map[string]string `json:"-" xml:"-" view:"inactive" desc:"extra tags by field name -- from type properties"` }
StructView represents a struct, creating a property editor of the fields -- constructs Children widgets to show the field names and editor fields for each field, within an overall frame.
func AddNewStructView ¶ added in v0.9.7
func AddNewStructView(parent ki.Ki, name string) *StructView
AddNewStructView adds a new structview to given parent node, with given name.
func (*StructView) Config ¶ added in v0.9.8
func (sv *StructView) Config()
Config configures the view
func (*StructView) ConfigStructGrid ¶
func (sv *StructView) ConfigStructGrid()
ConfigStructGrid configures the StructGrid for the current struct
func (*StructView) ConfigToolbar ¶
func (sv *StructView) ConfigToolbar()
ConfigToolbar adds a toolbar based on the methview ToolBarView function, if one has been defined for this struct type through its registered type properties.
func (*StructView) Disconnect ¶ added in v0.9.8
func (sv *StructView) Disconnect()
func (*StructView) FieldTags ¶ added in v0.9.11
func (sv *StructView) FieldTags(fld reflect.StructField) reflect.StructTag
FieldTags returns the integrated tags for this field
func (*StructView) IsConfiged ¶ added in v0.9.8
func (sv *StructView) IsConfiged() bool
IsConfiged returns true if the widget is fully configured
func (*StructView) Render2D ¶
func (sv *StructView) Render2D()
func (*StructView) SetStruct ¶
func (sv *StructView) SetStruct(st interface{})
SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct
func (*StructView) StructGrid ¶
func (sv *StructView) StructGrid() *gi.Frame
StructGrid returns the grid layout widget, which contains all the fields and values
func (*StructView) Style2D ¶
func (sv *StructView) Style2D()
func (*StructView) ToolBar ¶
func (sv *StructView) ToolBar() *gi.ToolBar
ToolBar returns the toolbar widget
func (*StructView) UpdateDefaults ¶ added in v0.9.8
func (sv *StructView) UpdateDefaults()
func (*StructView) UpdateField ¶ added in v0.9.9
func (sv *StructView) UpdateField(field string)
UpdateField updates the value-view widget for the named field
func (*StructView) UpdateFields ¶
func (sv *StructView) UpdateFields()
UpdateFields updates each of the value-view widgets for the fields -- called by the ViewSig update
type StructViewInline ¶
type StructViewInline struct { gi.PartsWidgetBase Struct interface{} `desc:"the struct that we are a view onto"` StructValView ValueView `desc:"ValueView for the struct itself, if this was created within value view framework -- otherwise nil"` AddAction bool `` /* 135-byte string literal not displayed */ FieldViews []ValueView `json:"-" xml:"-" desc:"ValueView representations of the fields"` TmpSave ValueView `` /* 189-byte string literal not displayed */ ViewSig ki.Signal `` /* 188-byte string literal not displayed */ ViewPath string `` /* 134-byte string literal not displayed */ HasDefs bool `json:"-" xml:"-" view:"inactive" desc:"if true, some fields have default values -- update labels when values change"` }
StructViewInline represents a struct as a single line widget, for smaller structs and those explicitly marked inline in the kit type registry type properties -- constructs widgets in Parts to show the field names and editor fields for each field
func (*StructViewInline) ConfigParts ¶
func (sv *StructViewInline) ConfigParts()
ConfigParts configures Parts for the current struct
func (*StructViewInline) Disconnect ¶ added in v0.9.8
func (sv *StructViewInline) Disconnect()
func (*StructViewInline) Render2D ¶
func (sv *StructViewInline) Render2D()
func (*StructViewInline) SetStruct ¶
func (sv *StructViewInline) SetStruct(st interface{})
SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct
func (*StructViewInline) UpdateDefaults ¶ added in v0.9.8
func (sv *StructViewInline) UpdateDefaults()
func (*StructViewInline) UpdateFields ¶
func (sv *StructViewInline) UpdateFields()
type SubMenuFunc ¶
type SubMenuFunc func(it interface{}, vp *gi.Viewport2D) []string
SubMenuFunc is a function that returns a string slice of submenu items used in MethView submenu-func option first argument is the object on which the method is defined (receiver)
type TableView ¶
type TableView struct { SliceViewBase StyleFunc TableViewStyleFunc `copy:"-" view:"-" json:"-" xml:"-" desc:"optional styling function"` SelField string `copy:"-" view:"-" json:"-" xml:"-" desc:"current selection field -- initially select value in this field"` SortIdx int `desc:"current sort index"` SortDesc bool `desc:"whether current sort order is descending"` StruType reflect.Type `copy:"-" view:"-" json:"-" xml:"-" desc:"struct type for each row"` VisFields []reflect.StructField `copy:"-" view:"-" json:"-" xml:"-" desc:"the visible fields"` NVisFields int `copy:"-" view:"-" json:"-" xml:"-" desc:"number of visible fields"` }
TableView represents a slice-of-structs as a table, where the fields are the columns, within an overall frame. It has two modes, determined by Inactive flag: if Inactive, it functions as a mutually-exclusive item selector, highlighting the selected row and emitting a WidgetSig WidgetSelected signal, and TableViewDoubleClick for double clicks (can be used for closing dialogs). If !Inactive, it is a full-featured editor with multiple-selection, cut-and-paste, and drag-and-drop, reporting each action taken using the TableViewSig signals
func AddNewTableView ¶ added in v0.9.7
AddNewTableView adds a new tableview to given parent node, with given name.
func (*TableView) CacheVisFields ¶
func (tv *TableView) CacheVisFields()
CacheVisFields computes the number of visible fields in nVisFields and caches those to skip in fieldSkip
func (*TableView) ConfigSliceGrid ¶
func (tv *TableView) ConfigSliceGrid()
ConfigSliceGrid configures the SliceGrid for the current slice this is only called by global Config and updates are guarded by that
func (*TableView) ConfigToolbar ¶
func (tv *TableView) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*TableView) GridLayout ¶ added in v0.9.8
GridLayout returns the SliceGrid grid-layout widget, with grid and scrollbar
func (*TableView) IsConfiged ¶ added in v0.9.8
IsConfiged returns true if the widget is fully configured
func (*TableView) LayoutHeader ¶ added in v0.9.8
func (tv *TableView) LayoutHeader()
LayoutHeader updates the header layout based on field widths
func (*TableView) LayoutSliceGrid ¶ added in v0.9.8
LayoutSliceGrid does the proper layout of slice grid depending on allocated size returns true if UpdateSliceGrid should be called after this
func (*TableView) RowFirstVisWidget ¶
func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
RowFirstVisWidget returns the first visible widget for given row (could be index or not) -- false if out of range
func (*TableView) RowGrabFocus ¶
func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase
RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!
func (*TableView) RowWidgetNs ¶
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 SelectedIdx and selecting row if found -- returns true if found, false otherwise
func (*TableView) SelectRowWidgets ¶
SelectRowWidgets sets the selection state of given row of widgets
func (*TableView) SetSlice ¶
func (tv *TableView) SetSlice(sl interface{})
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice (does Update if already viewing).
func (*TableView) SetSortFieldName ¶
SetSortField sets sorting to happen on given field and direction -- see SortFieldName for details
func (*TableView) SliceDeleteAt ¶ added in v0.9.8
SliceDeleteAt deletes element at given index from slice -- doupdt means call UpdateSliceGrid to update display
func (*TableView) SliceFrame ¶
SliceFrame returns the outer frame widget, which contains all the header, fields and values
func (*TableView) SliceGrid ¶
SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values, within SliceFrame
func (*TableView) SliceHeader ¶
SliceHeader returns the Toolbar 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 ¶ added in v0.9.9
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) UpdateSliceGrid ¶ added in v0.9.8
func (tv *TableView) UpdateSliceGrid()
UpdateSliceGrid updates grid display -- robust to any time calling
type TableViewStyleFunc ¶
type TableViewStyleFunc func(tv *TableView, slice interface{}, widg gi.Node2D, row, col int, vv ValueView)
TableViewStyleFunc is a styling function for custom styling / configuration of elements in the view. If style properties are set then you must call widg.AsNode2dD().SetFullReRender() to trigger re-styling during re-render
type TextBuf ¶
type TextBuf struct { ki.Node Txt []byte `json:"-" xml:"text" desc:"the current value of the entire text being edited -- using []byte slice for greater efficiency"` Autosave bool `desc:"if true, auto-save file after changes (in a separate routine)"` Opts textbuf.Opts `desc:"options for how text editing / viewing works"` Filename gi.FileName `json:"-" xml:"-" desc:"filename of file last loaded or saved"` Info FileInfo `desc:"full info about file"` PiState pi.FileStates `desc:"Pi parsing state info for file"` Hi HiMarkup `desc:"syntax highlighting markup parameters (language, style, etc)"` NLines int `json:"-" xml:"-" desc:"number of lines"` LineIcons map[int]string `desc:"icons for given lines -- use SetLineIcon and DeleteLineIcon"` LineColors map[int]gi.Color `desc:"special line number colors given lines -- use SetLineColor and DeleteLineColor"` Icons map[string]*gi.Icon `json:"-" xml:"-" desc:"icons for each LineIcons being used"` Lines [][]rune `` /* 258-byte string literal not displayed */ LineBytes [][]byte `` /* 267-byte string literal not displayed */ Tags []lex.Line `json:"extra custom tagged regions for each line"` HiTags []lex.Line `json:"syntax highlighting tags -- auto-generated"` Markup [][]byte `` /* 162-byte string literal not displayed */ MarkupEdits []*textbuf.Edit `json:"-" xml:"-" desc:"edits that have been made since last full markup"` ByteOffs []int `` /* 241-byte string literal not displayed */ TotalBytes int `json:"-" xml:"-" desc:"total bytes in document -- see ByteOffs for when it is updated"` LinesMu sync.RWMutex `json:"-" xml:"-" desc:"mutex for updating lines"` MarkupMu sync.RWMutex `json:"-" xml:"-" desc:"mutex for updating markup"` MarkupDelayTimer *time.Timer `json:"-" xml:"-" desc:"markup delay timer"` MarkupDelayMu sync.Mutex `json:"-" xml:"-" desc:"mutex for updating markup delay timer"` TextBufSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for buffer -- see TextBufSignals for the types"` Views []*TextView `json:"-" xml:"-" desc:"the TextViews that are currently viewing this buffer"` Undos textbuf.Undo `json:"-" xml:"-" desc:"undo manager"` PosHistory []lex.Pos `json:"-" xml:"-" desc:"history of cursor positions -- can move back through them"` Complete *gi.Complete `json:"-" xml:"-" desc:"functions and data for text completion"` Spell *gi.Spell `json:"-" xml:"-" desc:"functions and data for spelling correction"` CurView *TextView `` /* 177-byte string literal not displayed */ }
TextBuf is a buffer of text, which can be viewed by TextView(s). It holds the raw text lines (in original string and rune formats, and marked-up from syntax highlighting), and sends signals for making edits to the text and coordinating those edits across multiple views. Views always only view a single buffer, so they directly call methods on the buffer to drive updates, which are then broadcast. It also has methods for loading and saving buffers to files. Unlike GUI Widgets, its methods are generally signaling, without an explicit Action suffix. Internally, the buffer represents new lines using \n = LF, but saving and loading can deal with Windows/DOS CRLF format.
func NewTextBuf ¶
func NewTextBuf() *TextBuf
func (*TextBuf) AddFileNode ¶ added in v0.9.5
AddFileNode adds the FileNode to the list or receivers of changes to buffer
func (*TextBuf) AddTagEdit ¶
AddTagEdit adds a new custom tag for given line, using textbuf.Edit for location
func (*TextBuf) AddView ¶
AddView adds a viewer of this buffer -- connects our signals to the viewer
func (*TextBuf) AdjustPos ¶
AdjustPos adjusts given text position, which was recorded at given time for any edits that have taken place since that time (using the Undo stack). del determines what to do with positions within a deleted region -- either move to start or end of the region, or return an error
func (*TextBuf) AdjustReg ¶
AdjustReg adjusts given text region for any edits that have taken place since time stamp on region (using the Undo stack). If region was wholly within a deleted region, then RegionNil will be returned -- otherwise it is clipped appropriately as function of deletes.
func (*TextBuf) AdjustedTags ¶
AdjustedTags updates tag positions for edits must be called under MarkupMu lock
func (*TextBuf) AdjustedTagsImpl ¶ added in v0.9.14
AdjustedTagsImpl updates tag positions for edits, for given list of tags
func (*TextBuf) AppendText ¶
AppendText appends new text to end of buffer, using insert, returns edit
func (*TextBuf) AppendTextLine ¶
AppendTextLine appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. Returns the edit region.
func (*TextBuf) AppendTextLineMarkup ¶
AppendTextLineMarkup appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. user-supplied markup is used. Returns the edit region.
func (*TextBuf) AppendTextMarkup ¶
AppendTextMarkup appends new text to end of buffer, using insert, returns edit, and uses supplied markup to render it
func (*TextBuf) AutoIndent ¶
AutoIndent indents given line to the level of the prior line, adjusted appropriately if the current line starts with one of the given un-indent strings, or the prior line ends with one of the given indent strings. Returns any edit that took place (could be nil), along with the auto-indented level and character position for the indent of the current line.
func (*TextBuf) AutoIndentRegion ¶
AutoIndentRegion does auto-indent over given region -- end is *exclusive*
func (*TextBuf) AutoSaveCheck ¶
AutoSaveCheck checks if an autosave file exists -- logic for dealing with it is left to larger app -- call this before opening a file
func (*TextBuf) AutoSaveDelete ¶
func (tb *TextBuf) AutoSaveDelete()
AutoSaveDelete deletes any existing autosave file
func (*TextBuf) AutoSaveFilename ¶
AutoSaveFilename returns the autosave filename
func (*TextBuf) AutoSaveOff ¶
AutoSaveOff turns off autosave and returns the prior state of Autosave flag -- call AutoSaveRestore with rval when done -- good idea to turn autosave off for anything that does a block of updates
func (*TextBuf) AutoSaveRestore ¶
AutoSaveRestore restores prior Autosave setting, from AutoSaveOff()
func (*TextBuf) AutoScrollViews ¶
func (tb *TextBuf) AutoScrollViews()
AutoscrollViews ensures that views are always viewing the end of the buffer
func (*TextBuf) BatchUpdateEnd ¶
BatchUpdateEnd call to complete BatchUpdateStart
func (*TextBuf) BatchUpdateStart ¶
BatchUpdateStart call this when starting a batch of updates to the buffer -- it blocks the window updates for views until all the updates are done, and calls AutoSaveOff. Calls UpdateStart on Buf too. Returns buf updt, win updt and autosave restore state. Must call BatchUpdateEnd at end with the result of this call.
func (*TextBuf) BraceMatch ¶ added in v0.9.11
BraceMatch finds the brace, bracket, or parens that is the partner of the one passed to function.
func (*TextBuf) BytesToLines ¶
func (tb *TextBuf) BytesToLines()
BytesToLines converts current Txt bytes into lines, and initializes markup with raw text
func (*TextBuf) ClearChanged ¶
func (tb *TextBuf) ClearChanged()
ClearChanged marks buffer as un-changed
func (*TextBuf) Close ¶
Close closes the buffer -- prompts to save if changes, and disconnects from views if afterFun is non-nil, then it is called with the status of the user action
func (*TextBuf) CommentRegion ¶
CommentRegion inserts comment marker on given lines -- end is *exclusive*
func (*TextBuf) CommentStart ¶ added in v0.9.4
CommentStart returns the char index where the comment starts on given line, -1 if no comment
func (*TextBuf) CompleteExtend ¶
CompleteExtend inserts the extended seed at the current cursor position
func (*TextBuf) CompleteText ¶
CompleteText edits the text using the string chosen from the completion menu
func (*TextBuf) ConfigSupported ¶ added in v0.9.4
ConfigSupported configures options based on the supported language info in GoPi returns true if supported
func (*TextBuf) CorrectClear ¶
CorrectClear clears the TextSpellErr tag for given word
func (*TextBuf) CorrectText ¶
CorrectText edits the text using the string chosen from the correction menu
func (*TextBuf) Defaults ¶
func (tb *TextBuf) Defaults()
Defaults sets default parameters if they haven't been yet -- if Hi.Style is empty, then it considers it to not have been set
func (*TextBuf) DeleteCompleter ¶ added in v0.9.14
func (tb *TextBuf) DeleteCompleter()
func (*TextBuf) DeleteLineColor ¶ added in v0.9.11
HasLineColor
func (*TextBuf) DeleteLineIcon ¶ added in v0.9.11
DeleteLineIcon deletes any icon at given line (0 starting) if ln = -1 then delete all line icons.
func (*TextBuf) DeleteSpell ¶ added in v0.9.14
func (tb *TextBuf) DeleteSpell()
DeleteSpell deletes any existing spell object
func (*TextBuf) DeleteText ¶
DeleteText is the primary method for deleting text from the buffer. It deletes region of text between start and end positions, optionally signaling views after text lines have been updated. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
func (*TextBuf) DeleteTextImpl ¶ added in v0.9.11
DeleteTextImpl deletes region of text between start and end positions. Sets the timestamp on resulting textbuf.Edit to now. Must be called under LinesMu.Lock.
func (*TextBuf) DeleteTextRect ¶ added in v0.9.15
DeleteTextRect deletes rectangular region of text between start, end defining the upper-left and lower-right corners of a rectangle. Fails if st.Ch >= ed.Ch. Sets the timestamp on resulting textbuf.Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
func (*TextBuf) DeleteTextRectImpl ¶ added in v0.9.15
DeleteTextRectImpl deletes rectangular region of text between start, end defining the upper-left and lower-right corners of a rectangle. Fails if st.Ch >= ed.Ch. Sets the timestamp on resulting textbuf.Edit to now. Must be called under LinesMu.Lock.
func (*TextBuf) DeleteView ¶
DeleteView removes given viewer from our buffer
func (*TextBuf) DiffBufs ¶
DiffBufs computes the diff between this buffer and the other buffer, reporting a sequence of operations that would convert this buffer (a) into the other buffer (b). Each operation is either an 'r' (replace), 'd' (delete), 'i' (insert) or 'e' (equal). Everything is line-based (0, offset).
func (*TextBuf) DiffBufsUnified ¶
DiffBufsUnified computes the diff between this buffer and the other buffer, returning a unified diff with given amount of context (default of 3 will be used if -1)
func (*TextBuf) Disconnect ¶ added in v0.9.8
func (tb *TextBuf) Disconnect()
func (*TextBuf) EditDone ¶
func (tb *TextBuf) EditDone()
EditDone finalizes any current editing, sends signal
func (*TextBuf) EmacsUndoSave ¶
func (tb *TextBuf) EmacsUndoSave()
EmacsUndoSave is called by TextView at end of latest set of undo commands. If EmacsUndo mode is active, saves the current UndoStack to the regular Undo stack at the end, and moves undo to the very end -- undo is a constant stream.
func (*TextBuf) FileModCheck ¶
FileModCheck checks if the underlying file has been modified since last Stat (open, save) -- if haven't yet prompted, user is prompted to ensure that this is OK. returns true if file was modified
func (*TextBuf) HasLineColor ¶ added in v0.9.14
HasLineColor checks if given line has a line color set
func (*TextBuf) HiTagAtPos ¶ added in v0.9.13
HiTagAtPos returns the highlighting (markup) lexical tag at given position using current Markup tags, and index, -- could be nil if none or out of range
func (*TextBuf) InComment ¶ added in v0.9.4
InComment returns true if the given text position is within a commented region
func (*TextBuf) InLitString ¶ added in v0.9.13
InLitString returns true if position is in a string literal
func (*TextBuf) InTokenCode ¶ added in v0.9.14
InTokenCode returns true if position is in a Keyword, Name, Operator, or Punctuation. This is useful for turning off spell checking in docs
func (*TextBuf) InTokenSubCat ¶ added in v0.9.13
InTokenSubCat returns true if the given text position is marked with lexical type in given SubCat sub-category
func (*TextBuf) IndentLine ¶
IndentLine indents line by given number of tab stops, using tabs or spaces, for given tab size (if using spaces) -- either inserts or deletes to reach target. Returns edit record for any change.
func (*TextBuf) InitialMarkup ¶ added in v0.9.11
func (tb *TextBuf) InitialMarkup()
InitialMarkup does the first-pass markup on the file
func (*TextBuf) InsertText ¶
InsertText is the primary method for inserting text into the buffer. It inserts new text at given starting position, optionally signaling views after text has been inserted. Sets the timestamp on resulting Edit to now. An Undo record is automatically saved depending on Undo.Off setting.
func (*TextBuf) InsertTextImpl ¶ added in v0.9.11
InsertTextImpl does the raw insert of new text at given starting position, returning a new Edit with timestamp of Now. LinesMu must be locked surrounding this call.
func (*TextBuf) InsertTextRect ¶ added in v0.9.15
InsertTextRect inserts a rectangle of text defined in given textbuf.Edit record, (e.g., from RegionRect or DeleteRect), optionally signaling views after text has been inserted. Returns a copy of the Edit record with an updated timestamp. An Undo record is automatically saved depending on Undo.Off setting.
func (*TextBuf) InsertTextRectImpl ¶ added in v0.9.15
InsertTextRectImpl does the raw insert of new text at given starting position, using a Rect textbuf.Edit (e.g., from RegionRect or DeleteRect). Returns a copy of the Edit record with an updated timestamp.
func (*TextBuf) IsChanged ¶
IsChanged indicates if the text has been changed (edited) relative to the original, since last save
func (*TextBuf) IsMarkingUp ¶
IsMarkingUp is true if the MarkupAllLines process is currently running
func (*TextBuf) IsSpellEnabled ¶ added in v0.9.14
IsSpellEnabled returns true if spelling correction is enabled, taking into account given position in text if it is relevant for cases where it is only conditionally enabled
func (*TextBuf) IsValidLine ¶
IsValidLine returns true if given line is in range
func (*TextBuf) JoinParaLines ¶ added in v1.0.0
JoinParaLines merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, within the given line regions -- edLn is *inclusive*
func (*TextBuf) LexObjPathString ¶ added in v0.9.15
LexObjPathString returns the string at given lex, and including prior lex-tagged regions that include sequences of PunctSepPeriod and NameTag which are used for object paths -- used for e.g., debugger to pull out variable expressions that can be evaluated.
func (*TextBuf) LexString ¶ added in v0.9.14
LexString returns the string associated with given Lex (Tag) at given line
func (*TextBuf) LineCommented ¶ added in v0.9.4
LineCommented returns true if the given line is a full-comment line (i.e., starts with a comment)
func (*TextBuf) LineLen ¶
LineLen is the concurrent-safe accessor to length of specific Line of Lines runes
func (*TextBuf) LinesDeleted ¶
LinesDeleted deletes lines in Markup corresponding to lines deleted in Lines text. Locks and unlocks the Markup mutex, and must be called under lines mutex.
func (*TextBuf) LinesEdited ¶
LinesEdited re-marks-up lines in edit (typically only 1). Locks and unlocks the Markup mutex. Must be called under Lines mutex lock.
func (*TextBuf) LinesInserted ¶
LinesInserted inserts new lines in Markup corresponding to lines inserted in Lines text. Locks and unlocks the Markup mutex, and must be called under lines mutex
func (*TextBuf) LinesToBytes ¶
func (tb *TextBuf) LinesToBytes()
LinesToBytes converts current Lines back to the Txt slice of bytes.
func (*TextBuf) LinesToBytesCopy ¶
LinesToBytesCopy converts current Lines into a separate text byte copy -- e.g., for autosave or other "offline" uses of the text -- doesn't affect byte offsets etc
func (*TextBuf) MarkupAllLines ¶
MarkupAllLines does syntax highlighting markup for all lines in buffer, calling MarkupMu mutex when setting the marked-up lines with the result -- designed to be called in a separate goroutine. if maxLines > 0 then it specifies a maximum number of lines (for InitialMarkup)
func (*TextBuf) MarkupFromTags ¶ added in v0.9.4
func (tb *TextBuf) MarkupFromTags()
MarkupFromTags does syntax highlighting markup using existing HiTags without running new tagging -- for special case where tagging is under external control
func (*TextBuf) MarkupLine ¶ added in v0.9.11
MarkupLine does markup on a single line
func (*TextBuf) MarkupLines ¶
MarkupLines generates markup of given range of lines. end is *inclusive* line. returns true if all lines were marked up successfully. This does NOT lock the MarkupMu mutex (done at outer loop)
func (*TextBuf) MarkupLinesLock ¶ added in v0.9.5
MarkupLinesLock does MarkupLines and gets the mutex lock first
func (*TextBuf) OpenFile ¶
OpenFile just loads a file into the buffer -- doesn't do any markup or notification -- for temp bufs
func (*TextBuf) PatchFromBuf ¶
PatchFromBuf patches (edits) this buffer using content from other buffer, according to diff operations (e.g., as generated from DiffBufs). signal determines whether each patch is signaled -- if an overall signal will be sent at the end, then that would not be necessary (typical)
func (*TextBuf) ReMarkup ¶
func (tb *TextBuf) ReMarkup()
ReMarkup runs re-markup on text in background
func (*TextBuf) Redo ¶
Redo redoes next group of items on the undo stack, and returns the last record, nil if no more
func (*TextBuf) RefreshViews ¶
func (tb *TextBuf) RefreshViews()
RefreshViews does a refresh draw on all views
func (*TextBuf) Region ¶
Region returns a textbuf.Edit representation of text between start and end positions returns nil if not a valid region. sets the timestamp on the textbuf.Edit to now
func (*TextBuf) RegionImpl ¶ added in v0.9.11
RegionImpl returns a textbuf.Edit representation of text between start and end positions. Returns nil if not a valid region. Sets the timestamp on the textbuf.Edit to now. Impl version must be called under LinesMu.RLock or Lock
func (*TextBuf) RegionRect ¶ added in v0.9.15
RegionRect returns a textbuf.Edit representation of text between start and end positions as a rectangle, returns nil if not a valid region. sets the timestamp on the textbuf.Edit to now
func (*TextBuf) RegionRectImpl ¶ added in v0.9.15
RegionRectImpl returns a textbuf.Edit representation of rectangle of text between start (upper left) and end (bottom right) positions. Returns nil if not a valid region. All lines in Text are guaranteed to be of the same size, even if line had fewer chars. Sets the timestamp on the textbuf.Edit to now. Impl version must be called under LinesMu.RLock or Lock
func (*TextBuf) RemoveTag ¶
RemoveTag removes tag (optionally only given tag if non-zero) at given position if it exists -- returns tag
func (*TextBuf) ReplaceText ¶ added in v0.9.14
func (tb *TextBuf) ReplaceText(delSt, delEd, insPos lex.Pos, insTxt string, signal, matchCase bool) *textbuf.Edit
ReplaceText does DeleteText for given region, and then InsertText at given position (typically same as delSt but not necessarily), optionally emitting a signal after the insert. if matchCase is true, then the lex.MatchCase function is called to match the case (upper / lower) of the new inserted text to that of the text being replaced. returns the textbuf.Edit for the inserted text.
func (*TextBuf) Revert ¶
Revert re-opens text from current file, if filename set -- returns false if not -- uses an optimized diff-based update to preserve existing formatting -- very fast if not very different
func (*TextBuf) Save ¶
Save saves the current text into current Filename associated with this buffer
func (*TextBuf) SaveAs ¶
SaveAs saves the current text into given file -- does an EditDone first to save edits and checks for an existing file -- if it does exist then prompts to overwrite or not.
func (*TextBuf) SaveAsFunc ¶ added in v0.9.4
SaveAsFunc saves the current text into given file -- does an EditDone first to save edits and checks for an existing file -- if it does exist then prompts to overwrite or not. If afterFunc is non-nil, then it is called with the status of the user action.
func (*TextBuf) SavePosHistory ¶
SavePosHistory saves the cursor position in history stack of cursor positions -- tracks across views -- returns false if position was on same line as last one saved
func (*TextBuf) Search ¶
Search looks for a string (no regexp) within buffer, with given case-sensitivity, returning number of occurrences and specific match position list. column positions are in runes.
func (*TextBuf) SearchRegexp ¶ added in v1.0.2
SearchRegexp looks for a string (regexp) within buffer, returning number of occurrences and specific match position list. Column positions are in runes.
func (*TextBuf) SetByteOffs ¶
func (tb *TextBuf) SetByteOffs()
SetByteOffs sets the byte offsets for each line into the raw text
func (*TextBuf) SetCompleter ¶
func (tb *TextBuf) SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc, lookupFun complete.LookupFunc)
SetCompleter sets completion functions so that completions will automatically be offered as the user types
func (*TextBuf) SetHiStyle ¶
func (tb *TextBuf) SetHiStyle(style gi.HiStyleName)
SetHiStyle sets the highlighting style -- needs to be protected by mutex
func (*TextBuf) SetInactive ¶ added in v0.9.11
SetInactive sets the buffer in an inactive state if inactive = true otherwise is in active state. Inactive = don't save Undos.
func (*TextBuf) SetLineColor ¶ added in v0.9.11
SetLineColor sets given color (name or hex string) at given line (0 starting)
func (*TextBuf) SetLineIcon ¶ added in v0.9.11
SetLineIcon sets given icon at given line (0 starting)
func (*TextBuf) SetSpell ¶ added in v0.9.14
func (tb *TextBuf) SetSpell()
SetSpell sets spell correct functions so that spell correct will automatically be offered as the user types
func (*TextBuf) SetTextLines ¶ added in v0.9.11
SetTextLines sets the text to given lines of bytes if cpy is true, make a copy of bytes -- otherwise use
func (*TextBuf) SpellCheckLineErrs ¶ added in v0.9.14
SpellCheckLineErrs runs spell check on given line, and returns Lex tags with token.TextSpellErr for any misspelled words
func (*TextBuf) SpellCheckLineTag ¶ added in v0.9.14
SpellCheckLineTag runs spell check on given line, and sets Tags for any misspelled words and updates markup for that line.
func (*TextBuf) StartDelayedReMarkup ¶ added in v0.9.11
func (tb *TextBuf) StartDelayedReMarkup()
StartDelayedReMarkup starts a timer for doing markup after an interval
func (*TextBuf) StopDelayedReMarkup ¶ added in v0.9.11
func (tb *TextBuf) StopDelayedReMarkup()
StopDelayedReMarkup stops timer for doing markup after an interval
func (*TextBuf) Strings ¶ added in v0.9.11
Strings returns the current text as []string array. If addNewLn is true, each string line has a \n appended at end.
func (*TextBuf) TagAt ¶
TagAt returns tag at given text position, if one exists -- returns false if not
func (*TextBuf) Text ¶
Text returns the current text as a []byte array, applying all current changes -- calls EditDone and will generate that signal if there have been changes
func (*TextBuf) ViewportFromView ¶
func (tb *TextBuf) ViewportFromView() *gi.Viewport2D
ViewportFromView returns Viewport from textview, if avail
type TextBufFlags ¶ added in v0.9.9
type TextBufFlags int
TextBufFlags extend NodeBase NodeFlags to hold TextBuf state
const ( // TextBufAutoSaving is used in atomically safe way to protect autosaving TextBufAutoSaving TextBufFlags = TextBufFlags(gi.NodeFlagsN) + iota // TextBufMarkingUp indicates current markup operation in progress -- don't redo TextBufMarkingUp // TextBufChanged indicates if the text has been changed (edited) relative to the // original, since last save TextBufChanged // TextBufFileModOk have already asked about fact that file has changed since being // opened, user is ok TextBufFileModOk TextBufFlagsN )
func StringToTextBufFlags ¶ added in v0.9.9
func StringToTextBufFlags(s string) (TextBufFlags, error)
func (TextBufFlags) String ¶ added in v0.9.9
func (i TextBufFlags) String() string
type TextBufList ¶
TextBufList is a list of text buffers, as a ki.Node, with buffers as children
var TextBufs TextBufList
TextBufs is the default list of TextBuf buffers for open texts
type TextBufSignals ¶
type TextBufSignals int64
TextBufSignals are signals that text buffer can send
const ( // TextBufDone means that editing was completed and applied to Txt field // -- data is Txt bytes TextBufDone TextBufSignals = iota // TextBufNew signals that entirely new text is present -- all views // update -- data is Txt bytes. TextBufNew // TextBufInsert signals that some text was inserted -- data is // textbuf.Edit describing change -- the TextBuf always reflects the // current state *after* the edit. TextBufInsert // TextBufDelete signals that some text was deleted -- data is // textbuf.Edit describing change -- the TextBuf always reflects the // current state *after* the edit. TextBufDelete // TextBufMarkUpdt signals that the Markup text has been updated -- this // signal is typically sent from a separate goroutine so should be used // with a mutex TextBufMarkUpdt // TextBufClosed signals that the textbuf was closed TextBufClosed TextBufSignalsN )
func (*TextBufSignals) FromString ¶
func (i *TextBufSignals) FromString(s string) error
func (TextBufSignals) String ¶
func (i TextBufSignals) String() string
type TextView ¶
type TextView struct { gi.WidgetBase Buf *TextBuf `json:"-" xml:"-" desc:"the text buffer that we're editing"` Placeholder string `json:"-" xml:"placeholder" desc:"text that is displayed when the field is empty, in a lower-contrast manner"` CursorWidth units.Value `xml:"cursor-width" desc:"width of cursor -- set from cursor-width property (inherited)"` NLines int `` /* 135-byte string literal not displayed */ Renders []gi.TextRender `` /* 160-byte string literal not displayed */ Offs []float32 `json:"-" xml:"-" desc:"starting offsets for top of each line"` LineNoDigs int `json:"-" xml:"-" desc:"number of line number digits needed"` LineNoOff float32 `json:"-" xml:"-" desc:"horizontal offset for start of text after line numbers"` LineNoRender gi.TextRender `json:"-" xml:"-" desc:"render for line numbers"` LinesSize image.Point `json:"-" xml:"-" desc:"total size of all lines as rendered"` RenderSz mat32.Vec2 `json:"-" xml:"-" desc:"size params to use in render call"` CursorPos lex.Pos `json:"-" xml:"-" desc:"current cursor position"` CursorCol int `` /* 179-byte string literal not displayed */ ScrollToCursorOnRender bool `json:"-" xml:"-" desc:"if true, scroll screen to cursor on next render"` PosHistIdx int `json:"-" xml:"-" desc:"current index within PosHistory"` SelectStart lex.Pos `` /* 141-byte string literal not displayed */ SelectReg textbuf.Region `json:"-" xml:"-" desc:"current selection region"` PrevSelectReg textbuf.Region `json:"-" xml:"-" desc:"previous selection region, that was actually rendered -- needed to update render"` Highlights []textbuf.Region `json:"-" xml:"-" desc:"highlighted regions, e.g., for search results"` Scopelights []textbuf.Region `json:"-" xml:"-" desc:"highlighted regions, specific to scope markers"` SelectMode bool `json:"-" xml:"-" desc:"if true, select text as cursor moves"` ForceComplete bool `json:"-" xml:"-" desc:"if true, complete regardless of any disqualifying reasons"` ISearch ISearch `json:"-" xml:"-" desc:"interactive search data"` QReplace QReplace `json:"-" xml:"-" desc:"query replace data"` TextViewSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for text view -- see TextViewSignals for the types"` LinkSig ki.Signal `` /* 167-byte string literal not displayed */ StateStyles [TextViewStatesN]gi.Style `json:"-" xml:"-" desc:"normal style and focus style"` FontHeight float32 `json:"-" xml:"-" desc:"font height, cached during styling"` LineHeight float32 `json:"-" xml:"-" desc:"line height, cached during styling"` VisSize image.Point `json:"-" xml:"-" desc:"height in lines and width in chars of the visible area"` BlinkOn bool `json:"-" xml:"-" desc:"oscillates between on and off for blinking"` CursorMu sync.Mutex `json:"-" xml:"-" view:"-" desc:"mutex protecting cursor rendering -- shared between blink and main code"` HasLinks bool `json:"-" xml:"-" desc:"at least one of the renders has links -- determines if we set the cursor for hand movements"` // contains filtered or unexported fields }
TextView is a widget for editing multiple lines of text (as compared to TextField for a single line). The View is driven by a TextBuf buffer which contains all the text, and manages all the edits, sending update signals out to the views -- multiple views can be attached to a given buffer. All updating in the TextView should be within a single goroutine -- it would require extensive protections throughout code otherwise.
var BlinkingTextView *TextView
BlinkingTextView is the text field that is blinking
func AddNewTextView ¶ added in v0.9.7
AddNewTextView adds a new textview to given parent node, with given name.
func TextViewDialog ¶ added in v0.9.8
func TextViewDialog(avp *gi.Viewport2D, text []byte, opts DlgOpts) *TextView
TextViewDialog opens a dialog for displaying multi-line text in a non-editable TextView -- user can copy contents to clipboard etc. there is no input from the user.
func TextViewDialogTextView ¶ added in v0.9.14
TextViewDialogTextView returns the text view from a TextViewDialog
func (*TextView) AutoScroll ¶
AutoScroll tells any parent scroll layout to scroll to do its autoscroll based on given location -- for dragging
func (*TextView) CancelComplete ¶
func (tv *TextView) CancelComplete()
CancelComplete cancels any pending completion -- call this when new events have moved beyond any prior completion scenario
func (*TextView) CancelCorrect ¶
func (tv *TextView) CancelCorrect()
CancelCorrect cancels any pending spell correction -- call this when new events have moved beyond any prior correction scenario
func (*TextView) CharEndPos ¶
CharEndPos returns the ending (bottom right) render coords for the given position -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too)
func (*TextView) CharStartPos ¶
CharStartPos returns the starting (top left) render coords for the given position -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too)
func (*TextView) Clear ¶ added in v0.9.4
func (tv *TextView) Clear()
Clear resets all the text in the buffer for this view
func (*TextView) ClearHighlights ¶
func (tv *TextView) ClearHighlights()
ClearHighlights clears the Highlights slice of all regions
func (*TextView) ClearNeedsRefresh ¶
func (tv *TextView) ClearNeedsRefresh()
ClearNeedsRefresh clears needs refresh flag -- atomically safe
func (*TextView) ClearScopelights ¶ added in v0.9.4
func (tv *TextView) ClearScopelights()
ClearScopelights clears the Highlights slice of all regions
func (*TextView) ClearSelected ¶
func (tv *TextView) ClearSelected()
ClearSelected resets both the global selected flag and any current selection
func (*TextView) ConnectEvents2D ¶
func (tv *TextView) ConnectEvents2D()
ConnectEvents2D indirectly sets connections between mouse and key events and actions
func (*TextView) ContextMenu ¶
func (tv *TextView) ContextMenu()
ContextMenu displays the context menu with options dependent on situation
func (*TextView) ContextMenuPos ¶
ContextMenuPos returns the position of the context menu
func (*TextView) Copy ¶
Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection
func (*TextView) CopyRect ¶ added in v0.9.15
CopyRect copies any selected text to the clipboard, and returns that text, optionally resetting the current selection
func (*TextView) CursorBBox ¶
CursorBBox returns a bounding-box for a cursor at given position
func (*TextView) CursorBackspace ¶
CursorBackspace deletes character(s) immediately before cursor
func (*TextView) CursorBackspaceWord ¶
CursorBackspaceWord deletes words(s) immediately before cursor
func (*TextView) CursorBackward ¶
CursorBackward moves the cursor backward
func (*TextView) CursorBackwardWord ¶
CursorBackwardWord moves the cursor backward by words
func (*TextView) CursorDelete ¶
CursorDelete deletes character(s) immediately after the cursor
func (*TextView) CursorDeleteWord ¶
CursorDeleteWord deletes word(s) immediately after the cursor
func (*TextView) CursorDown ¶
CursorDown moves the cursor down line(s)
func (*TextView) CursorEndDoc ¶
func (tv *TextView) CursorEndDoc()
CursorEndDoc moves the cursor to the end of the text, updating selection if select mode is active
func (*TextView) CursorEndLine ¶
func (tv *TextView) CursorEndLine()
CursorEndLine moves the cursor to the end of the text
func (*TextView) CursorForward ¶
CursorForward moves the cursor forward
func (*TextView) CursorForwardWord ¶
CursorForwardWord moves the cursor forward by words
func (*TextView) CursorKill ¶
func (tv *TextView) CursorKill()
CursorKill deletes text from cursor to end of text
func (*TextView) CursorMovedSig ¶
func (tv *TextView) CursorMovedSig()
CursorMovedSig sends the signal that cursor has moved
func (*TextView) CursorNextLink ¶
CursorNextLink moves cursor to next link. wraparound wraps around to top of buffer if none found -- returns true if found
func (*TextView) CursorPageDown ¶
CursorPageDown moves the cursor down page(s), where a page is defined abcdef dynamically as just moving the cursor off the screen
func (*TextView) CursorPageUp ¶
CursorPageUp moves the cursor up page(s), where a page is defined dynamically as just moving the cursor off the screen
func (*TextView) CursorPrevLink ¶
CursorPrevLink moves cursor to previous link. wraparound wraps around to bottom of buffer if none found. returns true if found
func (*TextView) CursorRecenter ¶
func (tv *TextView) CursorRecenter()
CursorRecenter re-centers the view around the cursor position, toggling between putting cursor in middle, top, and bottom of view
func (*TextView) CursorSelect ¶
CursorSelect updates selection based on cursor movements, given starting cursor position and tv.CursorPos is current
func (*TextView) CursorSprite ¶
CursorSprite returns the sprite for the cursor, which is only rendered once with a vertical bar, and just activated and inactivated depending on render status.
func (*TextView) CursorSpriteName ¶ added in v0.9.11
CursorSpriteName returns the name of the cursor sprite
func (*TextView) CursorStartDoc ¶
func (tv *TextView) CursorStartDoc()
CursorStartDoc moves the cursor to the start of the text, updating selection if select mode is active
func (*TextView) CursorStartLine ¶
func (tv *TextView) CursorStartLine()
CursorStartLine moves the cursor to the start of the line, updating selection if select mode is active
func (*TextView) CursorToHistNext ¶
CursorToHistNext moves cursor to previous position on history list -- returns true if moved
func (*TextView) CursorToHistPrev ¶
CursorToHistPrev moves cursor to previous position on history list -- returns true if moved
func (*TextView) CursorTranspose ¶ added in v0.9.15
func (tv *TextView) CursorTranspose()
CursorTranspose swaps the character at the cursor with the one before it
func (*TextView) CursorTransposeWord ¶ added in v0.9.15
func (tv *TextView) CursorTransposeWord()
CursorTranspose swaps the word at the cursor with the one before it
func (*TextView) Cut ¶
Cut cuts any selected text and adds it to the clipboard, also returns cut text
func (*TextView) CutRect ¶ added in v0.9.15
CutRect cuts rectangle defined by selected text (upper left to lower right) and adds it to the clipboard, also returns cut text.
func (*TextView) DeleteSelection ¶
DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted as textbuf.Edit (nil if none)
func (*TextView) Disconnect ¶ added in v0.9.8
func (tv *TextView) Disconnect()
func (*TextView) EditDone ¶
func (tv *TextView) EditDone()
EditDone completes editing and copies the active edited text to the text -- called when the return key is pressed or goes out of focus
func (*TextView) EscPressed ¶
func (tv *TextView) EscPressed()
EscPressed emitted for KeyFunAbort or KeyFunCancelSelect -- effect depends on state..
func (*TextView) FindMatches ¶
FindMatches finds the matches with given search string (literal, not regex) and case sensitivity, updates highlights for all. returns false if none found
func (*TextView) FindNextLink ¶
FindNextLink finds next link after given position, returns false if no such links
func (*TextView) FindPrevLink ¶
FindPrevLink finds previous link before given position, returns false if no such links
func (*TextView) FirstVisibleLine ¶
FirstVisibleLine finds the first visible line, starting at given line (typically cursor -- if zero, a visible line is first found) -- returns stln if nothing found above it.
func (*TextView) FocusChanged2D ¶
func (tv *TextView) FocusChanged2D(change gi.FocusChanges)
FocusChanged2D appropriate actions for various types of focus changes
func (*TextView) HasLineNos ¶
HasLineNos returns true if view is showing line numbers (per textbuf option, cached here)
func (*TextView) HasSelection ¶
HasSelection returns whether there is a selected region of text
func (*TextView) HiStyle ¶
func (tv *TextView) HiStyle()
HiStyle applies the highlighting styles from buffer markup style
func (*TextView) HighlightRegion ¶
HighlightRegion creates a new highlighted region, and renders it, un-drawing any prior highlights
func (*TextView) ISearchBackspace ¶
func (tv *TextView) ISearchBackspace()
ISearchBackspace gets rid of one item in search string
func (*TextView) ISearchCancel ¶
func (tv *TextView) ISearchCancel()
ISearchCancel cancels ISearch mode
func (*TextView) ISearchKeyInput ¶
func (tv *TextView) ISearchKeyInput(kt *key.ChordEvent)
ISearchKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode
func (*TextView) ISearchMatches ¶
ISearchMatches finds ISearch matches -- returns true if there are any
func (*TextView) ISearchNextMatch ¶
ISearchNextMatch finds next match after given cursor position, and highlights it, etc
func (*TextView) ISearchSelectMatch ¶
ISearchSelectMatch selects match at given match index (e.g., tv.ISearch.Pos)
func (*TextView) ISearchSig ¶
func (tv *TextView) ISearchSig()
ISearchSig sends the signal that ISearch is updated
func (*TextView) ISearchStart ¶
func (tv *TextView) ISearchStart()
ISearchStart is an emacs-style interactive search mode -- this is called when the search command itself is entered
func (*TextView) ISpellKeyInput ¶ added in v0.9.4
func (tv *TextView) ISpellKeyInput(kt *key.ChordEvent)
ISpellKeyInput locates the word to spell check based on cursor position and the key input, then passes the text region to SpellCheck
func (*TextView) InsertAtCursor ¶
InsertAtCursor inserts given text at current cursor position
func (*TextView) IsFocusActive ¶
IsFocusActive returns true if we have active focus for keyboard input
func (*TextView) IsWordEnd ¶
IsWordEnd returns true if the cursor is just past the last letter of a word word is a string of characters none of which are classified as a word break
func (*TextView) IsWordMiddle ¶
IsWordMiddle - returns true if the cursor is anywhere inside a word, i.e. the character before the cursor and the one after the cursor are not classified as word break characters
func (*TextView) IsWordStart ¶
IsWordStart returns true if the cursor is just before the start of a word word is a string of characters none of which are classified as a word break
func (*TextView) JumpToLine ¶
JumpToLine jumps to given line number (minus 1)
func (*TextView) JumpToLinePrompt ¶
func (tv *TextView) JumpToLinePrompt()
JumpToLinePrompt jumps to given line number (minus 1) from prompt
func (*TextView) KeyInput ¶
func (tv *TextView) KeyInput(kt *key.ChordEvent)
KeyInput handles keyboard input into the text field and from the completion menu
func (*TextView) KeyInputInsertBra ¶ added in v0.9.15
func (tv *TextView) KeyInputInsertBra(kt *key.ChordEvent)
KeyInputInsertBra handle input of opening bracket-like entity (paren, brace, bracket)
func (*TextView) KeyInputInsertRune ¶ added in v0.9.4
func (tv *TextView) KeyInputInsertRune(kt *key.ChordEvent)
KeyInputInsertRune handles the insertion of a typed character
func (*TextView) LastVisibleLine ¶
LastVisibleLine finds the last visible line, starting at given line (typically cursor) -- returns stln if nothing found beyond it.
func (*TextView) LayoutAllLines ¶
LayoutAllLines generates TextRenders of lines from our TextBuf, from the Markup version of the source, and returns whether the current rendered size is different from what it was previously
func (*TextView) LayoutLines ¶
LayoutLines generates render of given range of lines (including highlighting). end is *inclusive* line. isDel means this is a delete and thus offsets for all higher lines need to be recomputed. returns true if overall number of effective lines (e.g., from word-wrap) is now different than before, and thus a full re-render is needed.
func (*TextView) LinesDeleted ¶
LinesDeleted deletes lines of text and reformats remaining one
func (*TextView) LinesInserted ¶
LinesInserted inserts new lines of text and reformats them
func (*TextView) LinkAt ¶
LinkAt returns link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise
func (*TextView) Lookup ¶ added in v0.9.11
func (tv *TextView) Lookup()
Lookup attempts to lookup symbol at current location, popping up a window if something is found
func (*TextView) MakeContextMenu ¶
MakeContextMenu builds the textview context menu
func (*TextView) MatchFromPos ¶
MatchFromPos finds the match at or after the given text position -- returns 0, false if none
func (*TextView) MouseDragEvent ¶ added in v0.9.11
func (tv *TextView) MouseDragEvent()
func (*TextView) MouseEvent ¶
MouseEvent handles the mouse.Event
func (*TextView) MouseFocusEvent ¶ added in v0.9.11
func (tv *TextView) MouseFocusEvent()
func (*TextView) NeedsRefresh ¶
NeedsRefresh checks if a refresh is required -- atomically safe for other routines to set the NeedsRefresh flag
func (*TextView) OfferComplete ¶
func (tv *TextView) OfferComplete()
OfferComplete pops up a menu of possible completions
func (*TextView) OfferCorrect ¶
OfferCorrect pops up a menu of possible spelling corrections for word at current CursorPos -- if no misspelling there or not in spellcorrect mode returns false
func (*TextView) OpenLink ¶
OpenLink opens given link, either by sending LinkSig signal if there are receivers, or by calling the TextLinkHandler if non-nil, or URLHandler if non-nil (which by default opens user's default browser via oswin/App.OpenURL())
func (*TextView) OpenLinkAt ¶
OpenLinkAt opens a link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise -- highlights selected link
func (*TextView) ParentLayout ¶
ParentLayout returns our parent layout -- we ensure this is our immediate parent which is necessary for textview
func (*TextView) Paste ¶
func (tv *TextView) Paste()
Paste inserts text from the clipboard at current cursor position
func (*TextView) PasteHist ¶
func (tv *TextView) PasteHist()
PasteHist presents a chooser of clip history items, pastes into text if selected
func (*TextView) PasteRect ¶ added in v0.9.15
func (tv *TextView) PasteRect()
PasteRect inserts text from the clipboard at current cursor position
func (*TextView) PixelToCursor ¶
PixelToCursor finds the cursor position that corresponds to the given pixel location (e.g., from mouse click) which has had WinBBox.Min subtracted from it (i.e, relative to upper left of text area)
func (*TextView) QReplaceCancel ¶
func (tv *TextView) QReplaceCancel()
QReplaceCancel cancels QReplace mode
func (*TextView) QReplaceKeyInput ¶
func (tv *TextView) QReplaceKeyInput(kt *key.ChordEvent)
QReplaceKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode
func (*TextView) QReplaceMatches ¶
QReplaceMatches finds QReplace matches -- returns true if there are any
func (*TextView) QReplaceNextMatch ¶
QReplaceNextMatch finds next match using, QReplace.Pos and highlights it, etc
func (*TextView) QReplacePrompt ¶
func (tv *TextView) QReplacePrompt()
QReplacePrompt is an emacs-style query-replace mode -- this starts the process, prompting user for items to search etc
func (*TextView) QReplaceReplace ¶
QReplaceReplace replaces at given match index (e.g., tv.QReplace.Pos)
func (*TextView) QReplaceReplaceAll ¶
QReplaceReplaceAll replaces all remaining from index
func (*TextView) QReplaceSelectMatch ¶
QReplaceSelectMatch selects match at given match index (e.g., tv.QReplace.Pos)
func (*TextView) QReplaceSig ¶
func (tv *TextView) QReplaceSig()
QReplaceSig sends the signal that QReplace is updated
func (*TextView) QReplaceStart ¶
QReplaceStart starts query-replace using given find, replace strings
func (*TextView) ReCaseSelection ¶ added in v0.9.15
ReCaseSelection changes the case of the currently-selected text. Returns the new text -- empty if nothing selected.
func (*TextView) ReMarkup ¶
func (tv *TextView) ReMarkup()
Remarkup triggers a complete re-markup of the entire text -- can do this when needed if the markup gets off due to multi-line formatting issues -- via Recenter key
func (*TextView) Refresh ¶
func (tv *TextView) Refresh()
Refresh re-displays everything anew from the buffer
func (*TextView) RefreshIfNeeded ¶
RefreshIfNeeded re-displays everything if SetNeedsRefresh was called -- returns true if refreshed
func (*TextView) Render2D ¶
func (tv *TextView) Render2D()
Render2D does some preliminary work and then calls render on children
func (*TextView) RenderAllLines ¶
func (tv *TextView) RenderAllLines()
RenderAllLines displays all the visible lines on the screen -- this is called outside of update process and has its own bounds check and updating
func (*TextView) RenderAllLinesInBounds ¶
func (tv *TextView) RenderAllLinesInBounds()
RenderAllLinesInBounds displays all the visible lines on the screen -- after PushBounds has already been called
func (*TextView) RenderCursor ¶
RenderCursor renders the cursor on or off, as a sprite that is either on or off
func (*TextView) RenderDepthBg ¶ added in v0.9.4
RenderDepthBg renders the depth background color
func (*TextView) RenderHighlights ¶
RenderHighlights renders the highlight regions as a highlighted background color -- always called within context of outer RenderLines or RenderAllLines
func (*TextView) RenderLineNo ¶
RenderLineNo renders given line number -- called within context of other render if defFill is true, it fills box color for default background color (use false for batch mode) and if vpUpload is true it uploads the rendered region to viewport directly (only if totally separate from other updates)
func (*TextView) RenderLineNosBox ¶
RenderLineNosBox renders the background for the line numbers in given range, in a darker shade
func (*TextView) RenderLineNosBoxAll ¶
func (tv *TextView) RenderLineNosBoxAll()
RenderLineNosBoxAll renders the background for the line numbers in a darker shade
func (*TextView) RenderLines ¶
RenderLines displays a specific range of lines on the screen, also painting selection. end is *inclusive* line. returns false if nothing visible.
func (*TextView) RenderRegionBox ¶
func (tv *TextView) RenderRegionBox(reg textbuf.Region, state TextViewStates)
RenderRegionBox renders a region in background color according to given state style
func (*TextView) RenderRegionBoxSty ¶ added in v0.9.4
RenderRegionBoxSty renders a region in given style and background color
func (*TextView) RenderRegionToEnd ¶ added in v0.9.4
RenderRegionToEnd renders a region in given style and background color, to end of line from start
func (*TextView) RenderScopelights ¶ added in v0.9.4
RenderScopelights renders a highlight background color for regions in the Scopelights list -- always called within context of outer RenderLines or RenderAllLines
func (*TextView) RenderScrolls ¶
func (tv *TextView) RenderScrolls()
RenderScrolls renders scrollbars if needed
func (*TextView) RenderSelect ¶
func (tv *TextView) RenderSelect()
RenderSelect renders the selection region as a selected background color -- always called within context of outer RenderLines or RenderAllLines
func (*TextView) RenderSelectLines ¶
func (tv *TextView) RenderSelectLines()
RenderSelectLines renders the lines within the current selection region
func (*TextView) RenderSize ¶
RenderSize is the size we should pass to text rendering, based on alloc
func (*TextView) RenderStartPos ¶
RenderStartPos is absolute rendering start position from our allocpos
func (*TextView) ResetState ¶
func (tv *TextView) ResetState()
ResetState resets all the random state variables, when opening a new buffer etc
func (*TextView) ResizeIfNeeded ¶
ResizeIfNeeded resizes the edit area if different from current setting -- returns true if resizing was performed
func (*TextView) SavePosHistory ¶
SavePosHistory saves the cursor position in history stack of cursor positions
func (*TextView) ScrollCursorInView ¶
ScrollCursorInView tells any parent scroll layout to scroll to get cursor in view -- returns true if scrolled
func (*TextView) ScrollCursorToBottom ¶
ScrollCursorToBottom tells any parent scroll layout to scroll to get cursor at bottom of view to extent possible -- returns true if scrolled.
func (*TextView) ScrollCursorToCenterIfHidden ¶
ScrollCursorToCenterIfHidden checks if the cursor is not visible, and if so, scrolls to the center, along both dimensions.
func (*TextView) ScrollCursorToHorizCenter ¶
ScrollCursorToHorizCenter tells any parent scroll layout to scroll to get cursor at horiz center of view to extent possible -- returns true if scrolled.
func (*TextView) ScrollCursorToLeft ¶
ScrollCursorToLeft tells any parent scroll layout to scroll to get cursor at left of view to extent possible -- returns true if scrolled.
func (*TextView) ScrollCursorToRight ¶
ScrollCursorToRight tells any parent scroll layout to scroll to get cursor at right of view to extent possible -- returns true if scrolled.
func (*TextView) ScrollCursorToTop ¶
ScrollCursorToTop tells any parent scroll layout to scroll to get cursor at top of view to extent possible -- returns true if scrolled.
func (*TextView) ScrollCursorToVertCenter ¶
ScrollCursorToVertCenter tells any parent scroll layout to scroll to get cursor at vert center of view to extent possible -- returns true if scrolled.
func (*TextView) ScrollInView ¶
ScrollInView tells any parent scroll layout to scroll to get given box (e.g., cursor BBox) in view -- returns true if scrolled
func (*TextView) ScrollToBottom ¶
ScrollToBottom tells any parent scroll layout to scroll to get given vertical coordinate at bottom of view to extent possible -- returns true if scrolled
func (*TextView) ScrollToHorizCenter ¶
ScrollToHorizCenter tells any parent scroll layout to scroll to get given horizontal coordinate to center of view to extent possible -- returns true if scrolled
func (*TextView) ScrollToLeft ¶
ScrollToLeft tells any parent scroll layout to scroll to get given horizontal coordinate at left of view to extent possible -- returns true if scrolled
func (*TextView) ScrollToRight ¶
ScrollToRight tells any parent scroll layout to scroll to get given horizontal coordinate at right of view to extent possible -- returns true if scrolled
func (*TextView) ScrollToTop ¶
ScrollToTop tells any parent scroll layout to scroll to get given vertical coordinate at top of view to extent possible -- returns true if scrolled
func (*TextView) ScrollToVertCenter ¶
ScrollToVertCenter tells any parent scroll layout to scroll to get given vertical coordinate to center of view to extent possible -- returns true if scrolled
func (*TextView) SelectModeToggle ¶
func (tv *TextView) SelectModeToggle()
SelectModeToggle toggles the SelectMode, updating selection with cursor movement
func (*TextView) SelectRegUpdate ¶
SelectRegUpdate updates current select region based on given cursor position relative to SelectStart position
func (*TextView) SelectWord ¶
SelectWord selects the word (whitespace, punctuation delimited) that the cursor is on returns true if word selected
func (*TextView) Selection ¶
Selection returns the currently selected text as a textbuf.Edit, which captures start, end, and full lines in between -- nil if no selection
func (*TextView) SetBuf ¶
SetBuf sets the TextBuf that this is a view of, and interconnects their signals
func (*TextView) SetCursorCol ¶
SetCursorCol sets the current target cursor column (CursorCol) to that of the given position
func (*TextView) SetCursorFromMouse ¶
SetCursorFromMouse sets cursor position from mouse mouse action -- handles the selection updating etc.
func (*TextView) SetCursorShow ¶
SetCursorShow sets a new cursor position, enforcing it in range, and shows the cursor (scroll to if hidden, render)
func (*TextView) SetNeedsRefresh ¶
func (tv *TextView) SetNeedsRefresh()
SetNeedsRefresh flags that a refresh is required -- atomically safe for other routines to call this
func (*TextView) ShiftSelect ¶
func (tv *TextView) ShiftSelect(kt *key.ChordEvent)
ShiftSelect sets the selection start if the shift key is down but wasn't on the last key move. If the shift key has been released the select region is set to textbuf.RegionNil
func (*TextView) ShiftSelectExtend ¶ added in v0.9.4
func (tv *TextView) ShiftSelectExtend(kt *key.ChordEvent)
ShiftSelectExtend updates the select region if the shift key is down and renders the selected text. If the shift key is not down the previously selected text is rerendered to clear the highlight
func (*TextView) SpellCheck ¶
SpellCheck offers spelling corrections if we are at a word break or other word termination and the word before the break is unknown -- returns true if misspelled word found
func (*TextView) StartCursor ¶
func (tv *TextView) StartCursor()
StartCursor starts the cursor blinking and renders it
func (*TextView) StopCursor ¶
func (tv *TextView) StopCursor()
StopCursor stops the cursor from blinking
func (*TextView) Style2D ¶
func (tv *TextView) Style2D()
Style2D calls StyleTextView and sets the style
func (*TextView) StyleTextView ¶
func (tv *TextView) StyleTextView()
StyleTextView sets the style of widget
func (*TextView) TextViewEvents ¶
func (tv *TextView) TextViewEvents()
TextViewEvents sets connections between mouse and key events and actions
func (*TextView) UpdateHighlights ¶
UpdateHighlights re-renders lines from previous highlights and current highlights -- assumed to be within a window update block
func (*TextView) ValidateCursor ¶
func (tv *TextView) ValidateCursor()
ValidateCursor sets current cursor to a valid cursor position
func (*TextView) VisSizes ¶
func (tv *TextView) VisSizes()
VisSizes computes the visible size of view given current parameters
func (*TextView) WordAt ¶ added in v0.9.4
WordAt finds the region of the word at the current cursor position
func (*TextView) WordBefore ¶
WordBefore returns the word before the lex.Pos uses IsWordBreak to determine the bounds of the word
func (*TextView) WrappedLineNo ¶
WrappedLineNo returns the wrapped line number (span index) and rune index within that span of the given character position within line in position, and false if out of range (last valid position returned in that case -- still usable).
func (*TextView) WrappedLines ¶
WrappedLines returns the number of wrapped lines (spans) for given line number
type TextViewFlags ¶ added in v0.9.9
type TextViewFlags int
TextViewFlags extend NodeBase NodeFlags to hold TextView state
const ( // TextViewNeedsRefresh indicates when refresh is required TextViewNeedsRefresh TextViewFlags = TextViewFlags(gi.NodeFlagsN) + iota // TextViewInReLayout indicates that we are currently resizing ourselves via parent layout TextViewInReLayout // TextViewRenderScrolls indicates that parent layout scrollbars need to be re-rendered at next rerender TextViewRenderScrolls // TextViewFocusActive is set if the keyboard focus is active -- when we lose active focus we apply changes TextViewFocusActive // TextViewHasLineNos indicates that this view has line numbers (per TextBuf option) TextViewHasLineNos // TextViewLastWasTabAI indicates that last key was a Tab auto-indent TextViewLastWasTabAI // TextViewLastWasUndo indicates that last key was an undo TextViewLastWasUndo TextViewFlagsN )
func StringToTextViewFlags ¶ added in v0.9.9
func StringToTextViewFlags(s string) (TextViewFlags, error)
func (TextViewFlags) String ¶ added in v0.9.9
func (i TextViewFlags) String() string
type TextViewSignals ¶
type TextViewSignals int64
TextViewSignals are signals that text view can send
const ( // TextViewDone signal indicates return was pressed and an edit was completed -- data is the text TextViewDone TextViewSignals = iota // TextViewSelected signal indicates some text was selected (for Inactive state, selection is via WidgetSig) TextViewSelected // TextViewCursorMoved signal indicates cursor moved emitted for every cursor movement -- e.g., for displaying cursor pos TextViewCursorMoved // TextViewISearch is emitted for every update of interactive search process -- see // ISearch.* members for current state TextViewISearch // TextViewQReplace is emitted for every update of query-replace process -- see // QReplace.* members for current state TextViewQReplace // TextViewSignalsN is the number of TextViewSignals TextViewSignalsN )
func (*TextViewSignals) FromString ¶
func (i *TextViewSignals) FromString(s string) error
func (TextViewSignals) String ¶
func (i TextViewSignals) String() string
type TextViewStates ¶
type TextViewStates int32
TextViewStates are mutually-exclusive textfield states -- determines appearance
const ( // TextViewActive is the normal state -- there but not being interacted with TextViewActive TextViewStates = iota // TextViewFocus states means textvieww is the focus -- will respond to keyboard input TextViewFocus // TextViewInactive means the textview is inactive -- not editable TextViewInactive // TextViewSel means the text region is selected TextViewSel // TextViewHighlight means the text region is highlighted TextViewHighlight // TextViewStatesN is the number of textview states TextViewStatesN )
func (*TextViewStates) FromString ¶
func (i *TextViewStates) FromString(s string) error
func (TextViewStates) String ¶
func (i TextViewStates) String() string
type TimeValueView ¶ added in v1.0.4
type TimeValueView struct {
ValueViewBase
}
TimeValueView presents a checkbox for a boolean
func (*TimeValueView) ConfigWidget ¶ added in v1.0.4
func (vv *TimeValueView) ConfigWidget(widg gi.Node2D)
func (*TimeValueView) TimeVal ¶ added in v1.0.5
func (vv *TimeValueView) TimeVal() *time.Time
TimeVal decodes Value into a *time.Time value -- also handles FileTime case
func (*TimeValueView) UpdateWidget ¶ added in v1.0.4
func (vv *TimeValueView) UpdateWidget()
func (*TimeValueView) WidgetType ¶ added in v1.0.4
func (vv *TimeValueView) WidgetType() reflect.Type
type TreeView ¶
type TreeView struct { gi.PartsWidgetBase SrcNode ki.Ki `copy:"-" json:"-" xml:"-" desc:"Ki Node that this widget is viewing in the tree -- the source"` ShowViewCtxtMenu bool `` /* 128-byte string literal not displayed */ ViewIdx int `` /* 144-byte string literal not displayed */ Indent units.Value `xml:"indent" desc:"styled amount to indent children relative to this node"` OpenDepth int `` /* 150-byte string literal not displayed */ TreeViewSig ki.Signal `` /* 157-byte string literal not displayed */ StateStyles [TreeViewStatesN]gi.Style `` /* 217-byte string literal not displayed */ WidgetSize mat32.Vec2 `desc:"just the size of our widget -- our alloc includes all of our children, but we only draw us"` Icon gi.IconName `json:"-" xml:"icon" view:"show-name" desc:"optional icon, displayed to the the left of the text label"` RootView *TreeView `json:"-" xml:"-" desc:"cached root of the view"` }
TreeView provides a graphical representation of source tree structure (which can be any type of Ki nodes), providing full manipulation abilities of that source tree (move, cut, add, etc) through drag-n-drop and cut/copy/paste and menu actions.
There are special style Props interpreted by these nodes:
- no-templates -- if present (assumed to be true) then style templates are not used to optimize rendering speed. Set this for nodes that have styling applied differentially to individual nodes (e.g., FileNode).
func AddNewTreeView ¶ added in v0.9.7
AddNewTreeView adds a new treeview to given parent node, with given name.
func (*TreeView) BranchPart ¶
BranchPart returns the branch in parts, if it exists
func (*TreeView) ChildrenBBox2D ¶
func (*TreeView) Close ¶
func (tv *TreeView) Close()
Close closes the given node and updates the view accordingly (if it is not already closed)
func (*TreeView) CloseAll ¶ added in v0.9.4
func (tv *TreeView) CloseAll()
CloseAll closes the given node and all of its sub-nodes
func (*TreeView) ConfigParts ¶
func (tv *TreeView) ConfigParts()
func (*TreeView) ConfigPartsIfNeeded ¶
func (tv *TreeView) ConfigPartsIfNeeded()
func (*TreeView) ConnectEvents2D ¶
func (tv *TreeView) ConnectEvents2D()
func (*TreeView) ContextMenuPos ¶
func (*TreeView) Copy ¶
Copy copies to clip.Board, optionally resetting the selection satisfies gi.Clipper interface and can be overridden by subtypes
func (*TreeView) Cut ¶
func (tv *TreeView) Cut()
Cut copies to clip.Board and deletes selected items satisfies gi.Clipper interface and can be overridden by subtypes
func (*TreeView) Disconnect ¶ added in v0.9.8
func (tv *TreeView) Disconnect()
func (*TreeView) DragNDropExternal ¶ added in v0.9.11
DragNDropExternal handles a drag-n-drop external drop onto this node
func (*TreeView) DragNDropFinalize ¶
DragNDropFinalize is called to finalize actions on the Source node prior to performing target actions -- mod must indicate actual action taken by the target, including ignore
func (*TreeView) DragNDropFinalizeDefMod ¶ added in v0.9.11
func (tv *TreeView) DragNDropFinalizeDefMod()
DragNDropFinalizeDefMod is called to finalize actions on the Source node prior to performing target actions -- uses default drop mod in place when event was dropped.
func (*TreeView) DragNDropStart ¶
func (tv *TreeView) DragNDropStart()
DragNDropStart starts a drag-n-drop on this node -- it includes any other selected nodes as well, each as additional records in mimedata
func (*TreeView) DragNDropTarget ¶
DragNDropTarget handles a drag-n-drop onto this node
func (*TreeView) Dragged ¶
Dragged is called after target accepts the drop -- we just remove elements that were moved satisfies gi.DragNDropper interface and can be overridden by subtypes
func (*TreeView) Drop ¶
Drop pops up a menu to determine what specifically to do with dropped items satisfies gi.DragNDropper interface and can be overridden by subtypes
func (*TreeView) DropAssign ¶
DropAssign assigns mime data (only the first one!) to this node
func (*TreeView) DropBefore ¶
DropBefore inserts object(s) from mime data before this node
func (*TreeView) DropCancel ¶
func (tv *TreeView) DropCancel()
DropCancel cancels the drop action e.g., preventing deleting of source items in a Move case
func (*TreeView) DropChildren ¶
DropChildren inserts object(s) from mime data at end of children of this node
func (*TreeView) DropExternal ¶ added in v0.9.11
DropExternal is not handled by base case but could be in derived
func (*TreeView) FocusChanged2D ¶
func (tv *TreeView) FocusChanged2D(change gi.FocusChanges)
func (*TreeView) HasClosedParent ¶
HasClosedParent returns whether this node have a closed parent? if so, don't render!
func (*TreeView) IsChanged ¶
IsChanged returns whether this node has the changed flag set? Only updated on the root note by GUI actions.
func (*TreeView) IsRootOrField ¶
IsRootOrField returns true if given node is either the root of the tree or a field -- various operations can not be performed on these -- if string is passed, then a prompt dialog is presented with that as the name of the operation being attempted -- otherwise it silently returns (suitable for context menu UpdateFunc).
func (*TreeView) KeyInput ¶
func (tv *TreeView) KeyInput(kt *key.ChordEvent)
func (*TreeView) Label ¶
Label returns the display label for this node, satisfying the Labeler interface
func (*TreeView) Layout2DParts ¶
func (*TreeView) MakeContextMenu ¶
func (*TreeView) MakeDropMenu ¶
MakeDropMenu makes the menu of options for dropping on a target
func (*TreeView) MakePasteMenu ¶
MakePasteMenu makes the menu of options for paste events
func (*TreeView) MimeData ¶
MimeData adds mimedata for this node: a text/plain of the PathUnique, and an application/json of the source node. satisfies Clipper.MimeData interface
func (*TreeView) MoveDown ¶
func (tv *TreeView) MoveDown(selMode mouse.SelectModes) *TreeView
MoveDown moves the selection down to next element in the tree, using given select mode (from keyboard modifiers) -- returns newly selected node
func (*TreeView) MoveDownAction ¶
func (tv *TreeView) MoveDownAction(selMode mouse.SelectModes) *TreeView
MoveDownAction moves the selection down to next element in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item
func (*TreeView) MoveDownSibling ¶
func (tv *TreeView) MoveDownSibling(selMode mouse.SelectModes) *TreeView
MoveDownSibling moves down only to siblings, not down into children, using given select mode (from keyboard modifiers)
func (*TreeView) MoveEndAction ¶ added in v0.9.4
func (tv *TreeView) MoveEndAction(selMode mouse.SelectModes) *TreeView
MoveEndAction moves the selection to the very last node in the tree using given select mode (from keyboard modifiers) -- and emits select event for newly selected item
func (*TreeView) MoveHomeAction ¶ added in v0.9.4
func (tv *TreeView) MoveHomeAction(selMode mouse.SelectModes) *TreeView
MoveHomeAction moves the selection up to top of the tree, using given select mode (from keyboard modifiers) and emits select event for newly selected item
func (*TreeView) MovePageDownAction ¶
func (tv *TreeView) MovePageDownAction(selMode mouse.SelectModes) *TreeView
MovePageDownAction moves the selection up to previous TreeViewPageSteps elements in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item
func (*TreeView) MovePageUpAction ¶
func (tv *TreeView) MovePageUpAction(selMode mouse.SelectModes) *TreeView
MovePageUpAction moves the selection up to previous TreeViewPageSteps elements in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item
func (*TreeView) MoveToLastChild ¶
func (tv *TreeView) MoveToLastChild(selMode mouse.SelectModes) *TreeView
MoveToLastChild moves to the last child under me, using given select mode (from keyboard modifiers)
func (*TreeView) MoveUp ¶
func (tv *TreeView) MoveUp(selMode mouse.SelectModes) *TreeView
MoveUp moves selection up to previous element in the tree, using given select mode (from keyboard modifiers) -- returns newly selected node
func (*TreeView) MoveUpAction ¶
func (tv *TreeView) MoveUpAction(selMode mouse.SelectModes) *TreeView
MoveUpAction moves the selection up to previous element in the tree, using given select mode (from keyboard modifiers) -- and emits select event for newly selected item
func (*TreeView) NodesFromMimeData ¶
NodesFromMimeData creates a slice of Ki node(s) from given mime data
func (*TreeView) Open ¶
func (tv *TreeView) Open()
Open opens the given node and updates the view accordingly (if it is not already opened)
func (*TreeView) OpenAll ¶ added in v0.9.4
func (tv *TreeView) OpenAll()
OpenAll opens the given node and all of its sub-nodes
func (*TreeView) Paste ¶
func (tv *TreeView) Paste()
Paste pastes clipboard at given node satisfies gi.Clipper interface and can be overridden by subtypes
func (*TreeView) 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) PasteAt ¶ added in v0.9.4
PasteAt inserts object(s) from mime data at rel position to this node. If another item with the same name already exists, it will append _Copy on the name of the inserted objects
func (*TreeView) PasteBefore ¶
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) PasteMenu ¶
PasteMenu performs a paste from the clipboard using given data -- pops up a menu to determine what specifically to do
func (*TreeView) PushBounds ¶ added in v0.9.11
func (*TreeView) RootIsInactive ¶ added in v0.9.5
RootIsInactive returns the inactive status of the root node, which is what controls the functional inactivity of the tree -- if individual nodes are inactive that only affects display typically.
func (*TreeView) RootTreeView ¶
RootTreeView returns the root node of TreeView tree -- typically cached in RootView on each node, but this can be used if that cached value needs to be updated for any reason.
func (*TreeView) Select ¶
func (tv *TreeView) Select()
Select selects this node (if not already selected) -- must use this method to update global selection list
func (*TreeView) SelectAction ¶
func (tv *TreeView) SelectAction(mode mouse.SelectModes) bool
SelectAction updates selection to include this node, using selectmode from mouse event (ExtendContinuous, ExtendOne), and emits selection signal returns true if signal emitted
func (*TreeView) 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 mouse.SelectModes) bool
SelectUpdate updates selection to include this node, using selectmode from mouse event (ExtendContinuous, ExtendOne). Returns true if this node selected
func (*TreeView) SelectedSrcNodes ¶
SelectedSrcNodes returns a slice of the currently-selected source nodes in the entire tree view
func (*TreeView) SelectedViews ¶
SelectedViews returns a slice of the currently-selected TreeViews within the entire tree, using a list maintained by the root node
func (*TreeView) SetChanged ¶
func (tv *TreeView) SetChanged()
SetChanged is called whenever a gui action updates the tree -- sets Changed flag on root node and emits signal
func (*TreeView) SetClosed ¶
func (tv *TreeView) SetClosed()
SetClosed sets the closed flag for this node -- call Close() method to close a node and update view
func (*TreeView) SetClosedState ¶
SetClosedState sets the closed state based on arg
func (*TreeView) SetOpen ¶
func (tv *TreeView) SetOpen()
SetOpen clears the closed flag for this node -- call Open() method to open a node and update view
func (*TreeView) SetRootNode ¶
SetRootNode sets the root view to the root of the source node that we are viewing, and builds-out the view of its tree
func (*TreeView) SetSelectMode ¶
SetSelectMode updates the select mode
func (*TreeView) SetSelectedViews ¶
SetSelectedViews updates the selected views to given list
func (*TreeView) SetSrcNode ¶
SetSrcNode sets the source node that we are viewing, and builds-out the view of its tree. It is called routinely via SyncToSrc during tree updating.
func (*TreeView) SrcAddChild ¶
func (tv *TreeView) SrcAddChild()
SrcAddChild adds a new child node to this one in the source tree, prompting the user for the type of node to add
func (*TreeView) SrcDelete ¶
func (tv *TreeView) SrcDelete()
SrcDelete deletes the source node corresponding to this view node in the source tree
func (*TreeView) SrcDuplicate ¶
func (tv *TreeView) SrcDuplicate()
SrcDuplicate duplicates the source node corresponding to this view node in the source tree, and inserts the duplicate after this node (as a new sibling)
func (*TreeView) SrcEdit ¶
func (tv *TreeView) SrcEdit()
SrcEdit pulls up a StructViewDialog window on the source object viewed by this node
func (*TreeView) SrcGoGiEditor ¶
func (tv *TreeView) SrcGoGiEditor()
SrcGoGiEditor pulls up a new GoGiEditor window on the source object viewed by this node
func (*TreeView) SrcInsertAfter ¶
func (tv *TreeView) SrcInsertAfter()
SrcInsertAfter inserts a new node in the source tree after this node, at the same (sibling) level, prompting for the type of node to insert
func (*TreeView) SrcInsertAt ¶ added in v0.9.4
SrcInsertAt inserts a new node in the source tree at given relative offset from this node, at the same (sibling) level, prompting for the type of node to insert
func (*TreeView) SrcInsertBefore ¶
func (tv *TreeView) SrcInsertBefore()
SrcInsertBefore inserts a new node in the source tree before this node, at the same (sibling) level, prompting for the type of node to insert
func (*TreeView) StyleTreeView ¶
func (tv *TreeView) StyleTreeView()
func (*TreeView) SyncToSrc ¶
SyncToSrc updates the view tree to match the source tree, using ConfigChildren to maximally preserve existing tree elements. init means we are doing initial build, and depth tracks depth (only during init).
func (*TreeView) ToggleClose ¶
func (tv *TreeView) ToggleClose()
ToggleClose toggles the close / open status: if closed, opens, and vice-versa
func (*TreeView) TreeViewEvents ¶
func (tv *TreeView) TreeViewEvents()
func (*TreeView) TreeViewParent ¶
func (*TreeView) Unselect ¶
func (tv *TreeView) Unselect()
Unselect unselects this node (if selected) -- must use this method to update global selection list
func (*TreeView) UnselectAction ¶
func (tv *TreeView) UnselectAction()
UnselectAction unselects this node (if selected) -- and emits a signal
func (*TreeView) UnselectAll ¶
func (tv *TreeView) UnselectAll()
UnselectAll unselects all selected items in the view
func (*TreeView) UpdateInactive ¶ added in v0.9.4
UpdateInactive updates the Inactive state based on SrcNode -- returns true if inactive. The inactivity of individual nodes only affects display properties typically, and not overall functional behavior, which is controlled by inactivity of the root node (i.e, make the root inactive to make entire tree read-only and non-modifiable)
type TreeViewFlags ¶ added in v0.9.9
type TreeViewFlags int
TreeViewFlags extend NodeBase NodeFlags to hold TreeView state
const ( // TreeViewFlagClosed means node is toggled closed (children not visible) TreeViewFlagClosed TreeViewFlags = TreeViewFlags(gi.NodeFlagsN) + iota // TreeViewFlagChanged is updated on the root node whenever a gui edit is // made through the tree view on the tree -- this does not track any other // changes that might have occurred in the tree itself. // Also emits a TreeViewChanged signal on the root node. TreeViewFlagChanged // TreeViewFlagNoTemplate -- this node is not using a style template -- should // be restyled on any full re-render change TreeViewFlagNoTemplate TreeViewFlagsN )
func StringToTreeViewFlags ¶ added in v0.9.9
func StringToTreeViewFlags(s string) (TreeViewFlags, error)
func (TreeViewFlags) String ¶ added in v0.9.9
func (i TreeViewFlags) String() string
type TreeViewSignals ¶
type TreeViewSignals int64
TreeViewSignals are signals that treeview can send -- these are all sent from the root tree view widget node, with data being the relevant node widget
const ( // node was selected TreeViewSelected TreeViewSignals = iota // TreeView unselected TreeViewUnselected // TreeView all items were selected TreeViewAllSelected // TreeView all items were unselected TreeViewAllUnselected // closed TreeView was opened TreeViewOpened // open TreeView was closed -- children not visible TreeViewClosed // TreeViewChanged means that some kind of edit operation has taken place // by the user via the gui -- we don't track the details, just that // changes have happened TreeViewChanged TreeViewSignalsN )
func (*TreeViewSignals) FromString ¶
func (i *TreeViewSignals) FromString(s string) error
func (TreeViewSignals) String ¶
func (i TreeViewSignals) String() string
type TreeViewStates ¶
type TreeViewStates int32
TreeViewStates are mutually-exclusive tree view states -- determines appearance
const ( // TreeViewActive is normal state -- there but not being interacted with TreeViewActive TreeViewStates = iota // TreeViewSel is selected TreeViewSel // TreeViewFocus is in focus -- will respond to keyboard input TreeViewFocus // TreeViewInactive is inactive -- if SrcNode is nil, or source has "inactive" property // set, or treeview node has inactive property set directly TreeViewInactive TreeViewStatesN )
func (*TreeViewStates) FromString ¶
func (i *TreeViewStates) FromString(s string) error
func (TreeViewStates) String ¶
func (i TreeViewStates) String() string
type TwinTextViews ¶ added in v0.9.13
type TwinTextViews struct { gi.SplitView BufA *TextBuf `json:"-" xml:"-" desc:"textbuf for A"` BufB *TextBuf `json:"-" xml:"-" desc:"textbuf for B"` }
TwinTextViews presents two side-by-side TextView windows in SplitView that scroll in sync with each other.
func AddNewTwinTextViews ¶ added in v0.9.13
func AddNewTwinTextViews(parent ki.Ki, name string) *TwinTextViews
AddNewTwinTextViews adds a new diffview to given parent node, with given name.
func BlameDialog ¶ added in v0.9.13
func BlameDialog(avp *gi.Viewport2D, fname string, blame, fbytes []byte) *TwinTextViews
BlameDialog opens a dialog for displaying VCS blame data using TwinTextViews. blame is the annotated blame code, while fbytes is the original file contents.
func (*TwinTextViews) ConfigTexts ¶ added in v0.9.13
func (tv *TwinTextViews) ConfigTexts()
func (*TwinTextViews) MakeBufs ¶ added in v0.9.13
func (tv *TwinTextViews) MakeBufs()
MakeBufs ensures that the TextBufs are made, if nil
func (*TwinTextViews) SetFiles ¶ added in v0.9.13
func (tv *TwinTextViews) SetFiles(fileA, fileB string, lineNos bool)
SetFiles sets files for each text buf
func (*TwinTextViews) TextViewLays ¶ added in v0.9.13
func (tv *TwinTextViews) TextViewLays() (*gi.Layout, *gi.Layout)
TextViewLays returns the two layouts that control the two textviews
func (*TwinTextViews) TextViews ¶ added in v0.9.13
func (tv *TwinTextViews) TextViews() (*TextView, *TextView)
TextViews returns the two textviews
type TypeValueView ¶
type TypeValueView struct {
ValueViewBase
}
TypeValueView presents a combobox for choosing types
func (*TypeValueView) ConfigWidget ¶
func (vv *TypeValueView) ConfigWidget(widg gi.Node2D)
func (*TypeValueView) UpdateWidget ¶
func (vv *TypeValueView) UpdateWidget()
func (*TypeValueView) WidgetType ¶
func (vv *TypeValueView) WidgetType() reflect.Type
type VCSLogView ¶ added in v0.9.13
type VCSLogView struct { gi.Layout Log vci.Log `desc:"current log"` File string `desc:"file that this is a log of -- if blank then it is entire repository"` Since string `desc:"date expression for how long ago to include log entries from"` Repo vci.Repo `json:"-" xml:"-" copy:"-" desc:"version control system repository"` RevA string `desc:"revision A -- defaults to HEAD"` RevB string `desc:"revision B -- blank means current working copy"` SetA bool `desc:"double-click will set the A revision -- else B"` }
VCSLogView is a view of the variables
func (*VCSLogView) Config ¶ added in v0.9.13
Config configures to given repo, log and file (file could be empty)
func (*VCSLogView) ConfigToolBar ¶ added in v0.9.13
func (lv *VCSLogView) ConfigToolBar()
ConfigToolBar
func (*VCSLogView) SetRevA ¶ added in v0.9.13
func (lv *VCSLogView) SetRevA(rev string)
SetRevA sets the RevA to use
func (*VCSLogView) SetRevB ¶ added in v0.9.13
func (lv *VCSLogView) SetRevB(rev string)
SetRevB sets the RevB to use
func (*VCSLogView) TableView ¶ added in v0.9.13
func (lv *VCSLogView) TableView() *TableView
TableView returns the tableview
func (*VCSLogView) ToggleRev ¶ added in v0.9.14
func (lv *VCSLogView) ToggleRev()
ToggleRev switches the active revision to set
func (*VCSLogView) ToolBar ¶ added in v0.9.13
func (lv *VCSLogView) ToolBar() *gi.ToolBar
ToolBar returns the toolbar
type ValueView ¶
type ValueView interface { ki.Ki // AsValueViewBase gives access to the basic data fields so that the // interface doesn't need to provide accessors for them. AsValueViewBase() *ValueViewBase // SetStructValue sets the value, owner and field information for a struct field. SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, tmpSave ValueView, viewPath string) // SetMapKey sets the key value and owner for a map key. SetMapKey(val reflect.Value, owner interface{}, tmpSave ValueView) // SetMapValue sets the value, owner and map key information for a map // element -- needs pointer to ValueView representation of key to track // current key value. SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, tmpSave ValueView, viewPath string) // SetSliceValue sets the value, owner and index information for a slice element. SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView, viewPath string) // SetSoloValue sets the value for a singleton standalone value // (e.g., for arg values). SetSoloValue(val reflect.Value) // OwnerKind returns the reflect.Kind of the owner: Struct, Map, or Slice // (or Invalid for standalone values such as args). OwnerKind() reflect.Kind // IsInactive returns whether the value is inactive -- e.g., Map owners // have Inactive values, and some fields can be marked as Inactive using a // struct tag. IsInactive() bool // WidgetType returns an appropriate type of widget to represent the // current value. WidgetType() reflect.Type // UpdateWidget updates the widget representation to reflect the current // value. Must first check for a nil widget -- can be called in a // no-widget context (e.g., for single-argument values with actions). UpdateWidget() // ConfigWidget configures a widget of WidgetType for representing the // value, including setting up the signal connections to set the value // when the user edits it (values are always set immediately when the // widget is updated). ConfigWidget(widg gi.Node2D) // HasAction returns true if this value has an associated action, such as // pulling up a dialog or chooser for this value. Activate method will // trigger this action. HasAction() bool // Activate triggers any action associated with this value, such as // pulling up a dialog or chooser for this value. This is called by // default for single-argument methods that have value representations // with actions. The viewport provides a context for opening other // windows, and the receiver and dlgFunc should receive the DialogSig for // the relevant dialog, or a pass-on call thereof, including the // DialogAccepted or Canceled signal, so that the caller can execute its // own actions based on the user hitting Ok or Cancel. Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc) // Val returns the reflect.Value representation for this item. Val() reflect.Value // SetValue assigns given value to this item (if not Inactive), using // Ki.SetField for Ki types and kit.SetRobust otherwise -- emits a ViewSig // signal when set. SetValue(val interface{}) bool // SetTags sets tags for this valueview, for non-struct values, to // influence interface for this value -- see // https://github.com/goki/gi/wiki/Tags for valid options. Adds to // existing tags if some are already set. SetTags(tags map[string]string) // SetTag sets given tag to given value for this valueview, for non-struct // values, to influence interface for this value -- see // https://github.com/goki/gi/wiki/Tags for valid options. SetTag(tag, value string) // Tag returns value for given tag -- looks first at tags set by // SetTag(s) methods, and then at field tags if this is a field in a // struct -- returns false if tag was not set. Tag(tag string) (string, bool) // AllTags returns all the tags for this value view, from structfield or set // specifically using SetTag* methods AllTags() map[string]string // SaveTmp saves a temporary copy of a struct to a map -- map values must // be explicitly re-saved and cannot be directly written to by the value // elements -- each ValueView has a pointer to any parent ValueView that // might need to be saved after SetValue -- SaveTmp called automatically // in SetValue but other cases that use something different need to call // it explicitly. SaveTmp() }
ValueView is an interface for managing the GUI representation of values (e.g., fields, map values, slice values) in Views (StructView, MapView, etc). The different types of ValueView are for different Kinds of values (bool, float, etc) -- which can have different Kinds of owners. The ValueViewBase class supports all the basic fields for managing the owner kinds.
func FieldToValueView ¶
FieldToValueView returns the appropriate ValueView for given field on a struct -- attempts to get the FieldValueViewer interface, and falls back on ToValueView otherwise, using field value (fval)
func ToValueView ¶
ToValueView returns the appropriate ValueView for given item, based only on its type -- attempts to get the ValueViewer interface and failing that, falls back on default Kind-based options. tags are optional tags, e.g., from the field in a struct, that control the view properties -- see the gi wiki for details on supported tags -- these are NOT set for the view element, only used for options that affect what kind of view to create. See FieldToValueView for version that takes into account the properties of the owner.
type ValueViewBase ¶
type ValueViewBase struct { ki.Node ViewSig ki.Signal `` /* 213-byte string literal not displayed */ Value reflect.Value `desc:"the reflect.Value representation of the value"` OwnKind reflect.Kind `desc:"kind of owner that we have -- reflect.Struct, .Map, .Slice are supported"` IsMapKey bool `desc:"for OwnKind = Map, this value represents the Key -- otherwise the Value"` ViewPath string `` /* 134-byte string literal not displayed */ Owner interface{} `` /* 162-byte string literal not displayed */ Field *reflect.StructField `desc:"if Owner is a struct, this is the reflect.StructField associated with the value"` Tags map[string]string `` /* 129-byte string literal not displayed */ Key interface{} `desc:"if Owner is a map, and this is a value, this is the key for this value in the map"` KeyView ValueView `` /* 159-byte string literal not displayed */ Idx int `desc:"if Owner is a slice, this is the index for the value in the slice"` WidgetTyp reflect.Type `` /* 156-byte string literal not displayed */ Widget gi.Node2D `` /* 142-byte string literal not displayed */ TmpSave ValueView `` /* 172-byte string literal not displayed */ }
ValueViewBase provides the basis for implementations of the ValueView interface, representing values in the interface -- it implements a generic TextField representation of the string value, and provides the generic fallback for everything that doesn't provide a specific ValueViewer type.
func (*ValueViewBase) Activate ¶
func (vv *ValueViewBase) Activate(vp *gi.Viewport2D, recv ki.Ki, fun ki.RecvFunc)
func (*ValueViewBase) AllTags ¶
func (vv *ValueViewBase) AllTags() map[string]string
func (*ValueViewBase) AsValueViewBase ¶
func (vv *ValueViewBase) AsValueViewBase() *ValueViewBase
func (*ValueViewBase) ConfigWidget ¶
func (vv *ValueViewBase) ConfigWidget(widg gi.Node2D)
func (*ValueViewBase) CreateTempIfNotPtr ¶
func (vv *ValueViewBase) CreateTempIfNotPtr() bool
func (*ValueViewBase) Disconnect ¶ added in v0.9.8
func (vv *ValueViewBase) Disconnect()
func (*ValueViewBase) HasAction ¶
func (vv *ValueViewBase) HasAction() bool
func (*ValueViewBase) IsInactive ¶
func (vv *ValueViewBase) IsInactive() bool
func (*ValueViewBase) Label ¶ added in v0.9.8
func (vv *ValueViewBase) Label() (label, newPath string, isZero bool)
Label returns a label for this item suitable for a window title etc. Based on the underlying value type name, owner label, and ViewPath. newPath returns just what should be added to a ViewPath also includes zero value check reported in the isZero bool, which can be used for not proceeding in case of non-value-based types.
func (*ValueViewBase) OwnerKind ¶
func (vv *ValueViewBase) OwnerKind() reflect.Kind
we have this one accessor b/c it is more useful for outside consumers vs. internal usage
func (*ValueViewBase) OwnerLabel ¶
func (vv *ValueViewBase) OwnerLabel() string
OwnerLabel returns some extra info about the owner of this value view which is useful to put in title of our object
func (*ValueViewBase) SaveTmp ¶
func (vv *ValueViewBase) SaveTmp()
func (*ValueViewBase) SetMapKey ¶
func (vv *ValueViewBase) SetMapKey(key reflect.Value, owner interface{}, tmpSave ValueView)
func (*ValueViewBase) SetMapValue ¶
func (*ValueViewBase) SetSliceValue ¶
func (*ValueViewBase) SetSoloValue ¶ added in v0.9.10
func (vv *ValueViewBase) SetSoloValue(val reflect.Value)
func (*ValueViewBase) SetStructValue ¶
func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, tmpSave ValueView, viewPath string)
func (*ValueViewBase) SetTag ¶
func (vv *ValueViewBase) SetTag(tag, value string)
func (*ValueViewBase) SetTags ¶
func (vv *ValueViewBase) SetTags(tags map[string]string)
func (*ValueViewBase) SetValue ¶
func (vv *ValueViewBase) SetValue(val interface{}) bool
func (*ValueViewBase) StdConfigWidget ¶ added in v0.9.10
func (vv *ValueViewBase) StdConfigWidget(widg gi.Node2D)
StdConfigWidget does all of the standard widget configuration tag options
func (*ValueViewBase) UpdateWidget ¶
func (vv *ValueViewBase) UpdateWidget()
func (*ValueViewBase) Val ¶
func (vv *ValueViewBase) Val() reflect.Value
func (*ValueViewBase) WidgetType ¶
func (vv *ValueViewBase) WidgetType() reflect.Type
type ValueViewFunc ¶ added in v0.9.8
type ValueViewFunc func() ValueView
ValueViewFunc is a function that returns a new initialized ValueView of an appropriate type as registered in the ValueViewMap
type ValueViewer ¶
type ValueViewer interface {
ValueView() ValueView
}
ValueViewer interface supplies the appropriate type of ValueView -- called on a given receiver item if defined for that receiver type (tries both pointer and non-pointer receivers) -- can use this for custom types to provide alternative custom interfaces -- must call Init on ValueView before returning it
type VersCtrlName ¶ added in v0.9.5
type VersCtrlName string
VersCtrlName is the name of a version control system
func VersCtrlNameProper ¶ added in v0.9.5
func VersCtrlNameProper(vc string) VersCtrlName
func (VersCtrlName) ValueView ¶ added in v0.9.5
func (kn VersCtrlName) ValueView() ValueView
ValueView registers VersCtrlValueView as the viewer of VersCtrlName
type VersCtrlValueView ¶ added in v0.9.5
type VersCtrlValueView struct {
ValueViewBase
}
VersCtrlValueView presents an action for displaying an VersCtrlName and selecting from StringPopup
func (*VersCtrlValueView) Activate ¶ added in v0.9.5
func (vv *VersCtrlValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*VersCtrlValueView) ConfigWidget ¶ added in v0.9.5
func (vv *VersCtrlValueView) ConfigWidget(widg gi.Node2D)
func (*VersCtrlValueView) HasAction ¶ added in v0.9.5
func (vv *VersCtrlValueView) HasAction() bool
func (*VersCtrlValueView) UpdateWidget ¶ added in v0.9.5
func (vv *VersCtrlValueView) UpdateWidget()
func (*VersCtrlValueView) WidgetType ¶ added in v0.9.5
func (vv *VersCtrlValueView) WidgetType() reflect.Type
type ViewIFace ¶
type ViewIFace struct { }
giv.ViewIFace is THE implementation of the gi.ViewIFace interface
func (*ViewIFace) CtxtMenuView ¶
func (*ViewIFace) GoGiEditor ¶
func (*ViewIFace) HiStyleInit ¶ added in v0.9.11
func (vi *ViewIFace) HiStyleInit()
func (*ViewIFace) HiStylesView ¶
func (*ViewIFace) KeyMapsView ¶
func (*ViewIFace) PrefsDbgView ¶
func (vi *ViewIFace) PrefsDbgView(prefs *gi.PrefsDebug)
func (*ViewIFace) PrefsDetApply ¶
func (vi *ViewIFace) PrefsDetApply(pf *gi.PrefsDetailed)
func (*ViewIFace) PrefsDetDefaults ¶
func (vi *ViewIFace) PrefsDetDefaults(pf *gi.PrefsDetailed)
func (*ViewIFace) PrefsDetView ¶
func (vi *ViewIFace) PrefsDetView(prefs *gi.PrefsDetailed)
func (*ViewIFace) PrefsView ¶
func (vi *ViewIFace) PrefsView(prefs *gi.Preferences)
func (*ViewIFace) SetHiStyleDefault ¶ added in v0.9.11
func (vi *ViewIFace) SetHiStyleDefault(hsty gi.HiStyleName)
Source Files ¶
- argdataflags_string.go
- argview.go
- basicviews.go
- colormap.go
- colorview.go
- complete.go
- dialogs.go
- diffview.go
- dirflags_string.go
- doc.go
- fileinfo.go
- filenodeflags_string.go
- filetree.go
- filevalueview.go
- fileview.go
- fileviewsignals_string.go
- fontvalueview.go
- gieditor.go
- himarkup.go
- histyleview.go
- iconvalueview.go
- keychordview.go
- keymapview.go
- mapview.go
- mapviewinline.go
- mapviewsignals_string.go
- methview.go
- methviewflags_string.go
- outbuf.go
- prefsview.go
- sliceview.go
- sliceviewbase.go
- sliceviewinline.go
- sliceviewsignals_string.go
- structview.go
- structviewinline.go
- tableview.go
- textbuf.go
- textbufflags_string.go
- textbufsignals_string.go
- textview.go
- textviewflags_string.go
- textviewsignals_string.go
- textviewstates_string.go
- treeview.go
- treeviewflags_string.go
- treeviewsignals_string.go
- treeviewstates_string.go
- twintextview.go
- valueview.go
- vcslogview.go