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 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 CompleteGo(data interface{}, text string, pos token.Position) (md complete.MatchData)
- func CompleteGoEdit(data interface{}, text string, cursorPos int, completion complete.Completion, ...) (ed complete.EditData)
- func CompleteText(data interface{}, text string, pos token.Position) (md complete.MatchData)
- func CompleteTextEdit(data interface{}, text string, cursorPos int, completion complete.Completion, ...) (ed complete.EditData)
- func CopyFile(dst, src string, perm os.FileMode) error
- func CtxtMenuView(val interface{}, inactive bool, vp *gi.Viewport2D, menu *gi.Menu) bool
- 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 HasMainMenuView(val interface{}) bool
- func HasToolBarView(val interface{}) bool
- func HasUpperCase(str string) 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 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 MethViewSubMenuFunc(aki ki.Ki, m *gi.Menu)
- func MethViewTypeProps(val interface{}) (ki.Props, reflect.Type, bool)
- func MethViewUpdateFunc(act *gi.Action)
- func PrintDiffs(diffs TextDiffs)
- func PunctGpMatch(r rune) (match rune, right bool)
- func QReplaceDialog(avp *gi.Viewport2D, find string, opts gi.DlgOpts, recv ki.Ki, fun ki.RecvFunc) *gi.Dialog
- func QReplaceDialogValues(dlg *gi.Dialog) (find, repl string)
- func SliceRowByValue(struSlice interface{}, fldVal interface{}) (int, bool)
- func SliceViewDialog(avp *gi.Viewport2D, slice interface{}, opts DlgOpts, ...) *gi.Dialog
- func SliceViewSelectDialog(avp *gi.Viewport2D, slice, curVal interface{}, opts DlgOpts, ...) *gi.Dialog
- func SliceViewSelectDialogValue(dlg *gi.Dialog) int
- func SpellCorrectEdit(data interface{}, new string, old string) (ed spell.EditData)
- func SrcNodeSignal(tvki, send ki.Ki, sig int64, data interface{})
- func StructSliceRowByValue(struSlice interface{}, fldName string, fldVal interface{}) (int, error)
- func StructViewDialog(avp *gi.Viewport2D, stru interface{}, opts DlgOpts, recv ki.Ki, ...) *gi.Dialog
- 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, 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
- type ActionUpdateFunc
- type AdjustPosDel
- type ArgData
- type ArgDataFlags
- type ArgView
- func (av *ArgView) ArgsGrid() (*gi.Frame, int)
- func (av *ArgView) ConfigArgsGrid()
- func (av *ArgView) SetArgs(arg []ArgData)
- func (av *ArgView) SetTitle(title string)
- func (av *ArgView) StdConfig() (mods, updt bool)
- func (av *ArgView) StdFrameConfig() kit.TypeAndNameList
- func (av *ArgView) TitleWidget() (*gi.Label, int)
- func (av *ArgView) UpdateArgs()
- func (av *ArgView) UpdateFromArgs()
- type BoolValueView
- type ByteSliceValueView
- 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) NumLay() (*gi.Layout, int)
- func (cv *ColorView) NumLayConfig()
- func (cv *ColorView) Render2D()
- func (cv *ColorView) SetColor(clr color.Color, tmpSave ValueView)
- func (cv *ColorView) SetHSLValue(val float32, hsl int)
- func (cv *ColorView) SetRGBValue(val float32, rgb int)
- func (cv *ColorView) SliderGrid() (*gi.Layout, int)
- func (cv *ColorView) SliderLay() (*gi.Layout, int)
- func (cv *ColorView) SliderLayConfig()
- func (cv *ColorView) StdFrameConfig() kit.TypeAndNameList
- func (cv *ColorView) StdSliderConfig() kit.TypeAndNameList
- func (cv *ColorView) StdSliderLayConfig() kit.TypeAndNameList
- 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, int)
- type DlgOpts
- type EnumValueView
- type FieldValueViewer
- type FileInfo
- func (fi *FileInfo) Delete() error
- func (fi *FileInfo) Duplicate() 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) IsSymlink() bool
- func (fi *FileInfo) Rename(newpath string) error
- func (fi *FileInfo) Stat() error
- type FileNode
- func (fn *FileNode) CloseBuf() bool
- func (fn *FileNode) CloseDir()
- func (fn *FileNode) ConfigOfFiles(path string) kit.TypeAndNameList
- func (fn *FileNode) CopyFileToDir(filename string, perm os.FileMode)
- func (fn *FileNode) CopyFileToFile(filename string, perm os.FileMode)
- func (fn *FileNode) DeleteFile() error
- func (fn *FileNode) DuplicateFile() error
- func (fn *FileNode) FileExtCounts() []FileNodeNameCount
- func (fn *FileNode) FilesMatching(match string, ignoreCase bool) []*FileNode
- func (fn *FileNode) FindFile(fnm string) (*FileNode, bool)
- func (fn *FileNode) IsAutoSave() bool
- func (fn *FileNode) IsChanged() bool
- func (fn *FileNode) IsDir() bool
- func (fn *FileNode) IsExec() bool
- func (fn *FileNode) IsOpen() bool
- func (fn *FileNode) IsSymLink() bool
- func (fn *FileNode) MyRelPath() string
- func (fn *FileNode) NewFile(filename string)
- func (fn *FileNode) NewFolder(foldername string)
- func (fn *FileNode) OpenBuf() (bool, error)
- func (fn *FileNode) OpenDir()
- func (fn *FileNode) OpenDirsTo(path string) (*FileNode, error)
- func (fn *FileNode) ReadDir(path string) error
- func (fn *FileNode) RelPath(fpath gi.FileName) string
- func (fn *FileNode) RenameFile(newpath string) error
- func (fn *FileNode) SetClosed()
- func (fn *FileNode) SetNodePath(path string) error
- func (fn *FileNode) SetOpen()
- func (fn *FileNode) UpdateNode() error
- type FileNodeFlags
- type FileNodeNameCount
- type FileSearchMatch
- 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
- type FileTreeView
- func (ft *FileTreeView) Cut()
- func (ft *FileTreeView) DeleteFiles()
- func (ft *FileTreeView) Dragged(de *dnd.Event)
- func (ft *FileTreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)
- func (ft *FileTreeView) DuplicateFiles()
- func (ft *FileTreeView) FileNode() *FileNode
- func (ft *FileTreeView) NewFile(filename string)
- func (ft *FileTreeView) NewFolder(foldername string)
- func (ft *FileTreeView) OpenDirs()
- func (ft *FileTreeView) Paste()
- func (ft *FileTreeView) PasteMime(md mimedata.Mimes)
- func (ft *FileTreeView) RenameFiles()
- func (ft *FileTreeView) Style2D()
- type FileValueView
- type FileView
- func (fv *FileView) AddPathToFavs()
- func (fv *FileView) ConfigFilesRow()
- func (fv *FileView) ConfigPathRow()
- func (fv *FileView) ConfigSelRow()
- func (fv *FileView) ConnectEvents2D()
- func (fv *FileView) DirPathUp()
- func (fv *FileView) DoStdConfig()
- 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, pos token.Position) (md complete.MatchData)
- func (fv *FileView) FileCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, ...) (ed complete.EditData)
- func (fv *FileView) FileSelectAction(idx int)
- func (fv *FileView) FileViewEvents()
- 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, pos token.Position) (md complete.MatchData)
- func (fv *FileView) PathCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, ...) (ed complete.EditData)
- 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) 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) StdConfig() (mods, updt bool)
- func (fv *FileView) StdFrameConfig() kit.TypeAndNameList
- func (fv *FileView) Style2D()
- func (fv *FileView) UpdateFavs()
- func (fv *FileView) UpdateFiles()
- func (fv *FileView) UpdateFilesAction()
- func (fv *FileView) UpdateFromPath()
- func (fv *FileView) UpdatePath()
- type FileViewFilterFunc
- type FileViewSignals
- type FloatValueView
- type FontValueView
- type GiEditor
- 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, int)
- func (ge *GiEditor) StdConfig() (mods, updt bool)
- func (ge *GiEditor) StdFrameConfig() kit.TypeAndNameList
- func (ge *GiEditor) StructView() *StructView
- func (ge *GiEditor) TitleWidget() (*gi.Label, int)
- func (ge *GiEditor) ToolBar() *gi.ToolBar
- func (ge *GiEditor) TreeView() *TreeView
- func (ge *GiEditor) Update()
- func (ge *GiEditor) UpdateFromRoot()
- 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 []byte) (lex.Line, error)
- func (hm *HiMarkup) HasHi() bool
- func (hm *HiMarkup) Init(info *FileInfo, pist *pi.FileState)
- func (hm *HiMarkup) MarkupLine(txt []byte, hitags, tags lex.Line) []byte
- func (hm *HiMarkup) MarkupTagsAll(txt []byte) ([]lex.Line, error)
- func (hm *HiMarkup) MarkupTagsLine(ln int, txt []byte) (lex.Line, error)
- func (hm *HiMarkup) SetParser(pr *pi.Parser)
- 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) 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 MapInlineValueView
- type MapValueView
- type MapView
- func (mv *MapView) ConfigMapGrid()
- func (mv *MapView) ConfigToolbar()
- 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, int)
- func (mv *MapView) Render2D()
- func (mv *MapView) SetChanged()
- func (mv *MapView) SetMap(mp interface{}, tmpSave ValueView)
- func (mv *MapView) StdConfig() (mods, updt bool)
- func (mv *MapView) StdFrameConfig() kit.TypeAndNameList
- func (mv *MapView) Style2D()
- func (mv *MapView) ToggleSort()
- func (mv *MapView) ToolBar() *gi.ToolBar
- func (mv *MapView) UpdateFromMap()
- func (mv *MapView) UpdateValues()
- type MapViewInline
- func (mv *MapViewInline) ConfigParts()
- func (mv *MapViewInline) MapAdd()
- func (mv *MapViewInline) Render2D()
- func (mv *MapViewInline) SetChanged()
- func (mv *MapViewInline) SetMap(mp interface{}, tmpSave ValueView)
- func (mv *MapViewInline) Style2D()
- func (mv *MapViewInline) UpdateFromMap()
- func (mv *MapViewInline) UpdateValues()
- type MethViewData
- type MethViewFlags
- type OpenDirMap
- type OutBuf
- type OutBufMarkupFunc
- type QReplace
- type RuneSliceValueView
- type ShortcutFunc
- type SliceInlineValueView
- type SliceValueView
- type SliceView
- func (sv *SliceView) ConfigSliceGrid(forceUpdt bool)
- func (sv *SliceView) ConfigSliceGridRows()
- func (sv *SliceView) ConfigToolbar()
- func (sv *SliceView) ConnectEvents2D()
- func (sv *SliceView) Copy(reset bool)
- func (sv *SliceView) CopyRows(reset bool)
- func (sv *SliceView) Cut()
- func (sv *SliceView) CutRows()
- func (sv *SliceView) DeleteRows()
- func (sv *SliceView) DragNDropFinalize(mod dnd.DropMods)
- func (sv *SliceView) DragNDropSource(de *dnd.Event)
- func (sv *SliceView) DragNDropStart()
- func (sv *SliceView) DragNDropTarget(de *dnd.Event)
- func (sv *SliceView) Drop(md mimedata.Mimes, mod dnd.DropMods)
- func (sv *SliceView) DropAfter(md mimedata.Mimes, mod dnd.DropMods, row int)
- func (sv *SliceView) DropAssign(md mimedata.Mimes, row int)
- func (sv *SliceView) DropBefore(md mimedata.Mimes, mod dnd.DropMods, row int)
- func (sv *SliceView) DropCancel()
- func (sv *SliceView) Duplicate() int
- func (sv *SliceView) HasFocus2D() bool
- func (sv *SliceView) ItemCtxtMenu(row int)
- func (sv *SliceView) KeyInputActive(kt *key.ChordEvent)
- func (sv *SliceView) KeyInputInactive(kt *key.ChordEvent)
- func (sv *SliceView) MakeDropMenu(m *gi.Menu, data interface{}, mod dnd.DropMods, row int)
- func (sv *SliceView) MakePasteMenu(m *gi.Menu, data interface{}, row int)
- func (sv *SliceView) MimeDataRow(md *mimedata.Mimes, row int)
- func (sv *SliceView) MoveDown(selMode mouse.SelectModes) int
- func (sv *SliceView) MoveDownAction(selMode mouse.SelectModes) int
- func (sv *SliceView) MovePageDown(selMode mouse.SelectModes) int
- func (sv *SliceView) MovePageDownAction(selMode mouse.SelectModes) int
- func (sv *SliceView) MovePageUp(selMode mouse.SelectModes) int
- func (sv *SliceView) MovePageUpAction(selMode mouse.SelectModes) int
- func (sv *SliceView) MoveUp(selMode mouse.SelectModes) int
- func (sv *SliceView) MoveUpAction(selMode mouse.SelectModes) int
- func (sv *SliceView) Paste()
- func (sv *SliceView) PasteAssign(md mimedata.Mimes, row int)
- func (sv *SliceView) PasteAtRow(md mimedata.Mimes, row int)
- func (sv *SliceView) PasteMenu(md mimedata.Mimes, row int)
- func (sv *SliceView) PasteRow(row int)
- func (sv *SliceView) Render2D()
- func (sv *SliceView) RowFirstWidget(row int) (*gi.WidgetBase, bool)
- func (sv *SliceView) RowFromPos(posY int) (int, bool)
- func (sv *SliceView) RowGrabFocus(row int) *gi.WidgetBase
- func (sv *SliceView) RowIsSelected(row int) bool
- func (sv *SliceView) RowPos(row int) image.Point
- func (sv *SliceView) RowVal(row int) interface{}
- func (sv *SliceView) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (sv *SliceView) RowsFromMimeData(md mimedata.Mimes) []interface{}
- func (sv *SliceView) SaveDraggedRows(row int)
- func (sv *SliceView) ScrollToRow(row int) bool
- func (sv *SliceView) SelectAllRows()
- func (sv *SliceView) SelectRow(row int)
- func (sv *SliceView) SelectRowAction(row int, mode mouse.SelectModes)
- func (sv *SliceView) SelectRowWidgets(idx int, sel bool)
- func (sv *SliceView) SelectVal(val string) bool
- func (sv *SliceView) SelectedRowsList(descendingSort bool) []int
- func (sv *SliceView) SetChanged()
- func (sv *SliceView) SetSlice(sl interface{}, tmpSave ValueView)
- func (sv *SliceView) SliceDeleteAt(idx int, reconfig bool)
- func (sv *SliceView) SliceGrid() (*gi.Frame, int)
- func (sv *SliceView) SliceNewAt(idx int, reconfig bool)
- func (sv *SliceView) SliceViewEvents()
- func (sv *SliceView) StdConfig() (mods, updt bool)
- func (sv *SliceView) StdCtxtMenu(m *gi.Menu, row int)
- func (sv *SliceView) StdFrameConfig() kit.TypeAndNameList
- func (sv *SliceView) Style2D()
- func (sv *SliceView) ToolBar() *gi.ToolBar
- func (sv *SliceView) UnselectAllRows()
- func (sv *SliceView) UnselectRow(row int)
- func (sv *SliceView) UnselectRowAction(row int)
- func (sv *SliceView) UpdateFromSlice()
- func (sv *SliceView) UpdateSelect(idx int, sel bool)
- func (sv *SliceView) UpdateValues()
- type SliceViewInline
- func (sv *SliceViewInline) ConfigParts()
- func (sv *SliceViewInline) Render2D()
- func (sv *SliceViewInline) SetChanged()
- func (sv *SliceViewInline) SetSlice(sl interface{}, tmpSave ValueView)
- 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 StructInlineValueView
- type StructValueView
- type StructView
- func (sv *StructView) ConfigStructGrid()
- func (sv *StructView) ConfigToolbar()
- func (sv *StructView) Render2D()
- func (sv *StructView) SetStruct(st interface{}, tmpSave ValueView)
- func (sv *StructView) StdConfig() (mods, updt bool)
- func (sv *StructView) StdFrameConfig() kit.TypeAndNameList
- func (sv *StructView) StructGrid() (*gi.Frame, int)
- func (sv *StructView) Style2D()
- func (sv *StructView) ToolBar() *gi.ToolBar
- func (sv *StructView) UpdateFields()
- func (sv *StructView) UpdateFromStruct()
- type StructViewInline
- type SubMenuFunc
- type TableView
- func (tv *TableView) CacheVisFields()
- func (tv *TableView) ConfigSliceGrid(forceUpdt bool)
- func (tv *TableView) ConfigSliceGridRows()
- func (tv *TableView) ConfigToolbar()
- func (tv *TableView) ConnectEvents2D()
- func (tv *TableView) Copy(reset bool)
- func (tv *TableView) CopyRows(reset bool)
- func (tv *TableView) Cut()
- func (tv *TableView) CutRows()
- func (tv *TableView) DeleteRows()
- func (tv *TableView) DragNDropFinalize(mod dnd.DropMods)
- func (tv *TableView) DragNDropSource(de *dnd.Event)
- func (tv *TableView) DragNDropStart()
- func (tv *TableView) DragNDropTarget(de *dnd.Event)
- func (tv *TableView) Drop(md mimedata.Mimes, mod dnd.DropMods)
- func (tv *TableView) DropAfter(md mimedata.Mimes, mod dnd.DropMods, row int)
- func (tv *TableView) DropAssign(md mimedata.Mimes, row int)
- func (tv *TableView) DropBefore(md mimedata.Mimes, mod dnd.DropMods, row int)
- func (tv *TableView) DropCancel()
- func (tv *TableView) Duplicate() int
- func (tv *TableView) HasFocus2D() bool
- func (tv *TableView) ItemCtxtMenu(row int)
- func (tv *TableView) KeyInputActive(kt *key.ChordEvent)
- func (tv *TableView) KeyInputInactive(kt *key.ChordEvent)
- func (tv *TableView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tv *TableView) MakeDropMenu(m *gi.Menu, data interface{}, mod dnd.DropMods, row int)
- func (tv *TableView) MakePasteMenu(m *gi.Menu, data interface{}, row int)
- func (tv *TableView) MimeDataRow(md *mimedata.Mimes, row int)
- func (tv *TableView) MoveDown(selMode mouse.SelectModes) int
- func (tv *TableView) MoveDownAction(selMode mouse.SelectModes) int
- func (tv *TableView) MovePageDown(selMode mouse.SelectModes) int
- func (tv *TableView) MovePageDownAction(selMode mouse.SelectModes) int
- func (tv *TableView) MovePageUp(selMode mouse.SelectModes) int
- func (tv *TableView) MovePageUpAction(selMode mouse.SelectModes) int
- func (tv *TableView) MoveUp(selMode mouse.SelectModes) int
- func (tv *TableView) MoveUpAction(selMode mouse.SelectModes) int
- func (tv *TableView) Paste()
- func (tv *TableView) PasteAssign(md mimedata.Mimes, row int)
- func (tv *TableView) PasteAtRow(md mimedata.Mimes, row int)
- func (tv *TableView) PasteMenu(md mimedata.Mimes, row int)
- func (tv *TableView) PasteRow(row int)
- func (tv *TableView) Render2D()
- func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
- func (tv *TableView) RowFirstWidget(row int) (*gi.WidgetBase, bool)
- func (tv *TableView) RowFromPos(posY int) (int, bool)
- func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase
- func (tv *TableView) RowIsSelected(row int) bool
- func (tv *TableView) RowPos(row int) image.Point
- func (tv *TableView) RowStruct(row int) interface{}
- func (tv *TableView) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (tv *TableView) RowsFromMimeData(md mimedata.Mimes) []interface{}
- func (tv *TableView) SaveDraggedRows(row int)
- func (tv *TableView) ScrollToRow(row int) bool
- func (tv *TableView) SelectAllRows()
- func (tv *TableView) SelectFieldVal(fld, val string) bool
- func (tv *TableView) SelectRow(row int)
- func (tv *TableView) SelectRowAction(row int, mode mouse.SelectModes)
- func (tv *TableView) SelectRowWidgets(idx int, sel bool)
- func (tv *TableView) SelectedRowsList(descendingSort bool) []int
- func (tv *TableView) SetChanged()
- func (tv *TableView) SetSlice(sl interface{}, tmpSave ValueView)
- func (tv *TableView) SetSortFieldName(nm string)
- func (tv *TableView) SliceDelete(idx int, reconfig bool)
- func (tv *TableView) SliceFrame() (*gi.Frame, int)
- func (tv *TableView) SliceGrid() *gi.Frame
- func (tv *TableView) SliceHeader() *gi.ToolBar
- func (tv *TableView) SliceNewAt(idx int, reconfig bool)
- func (tv *TableView) SortFieldName() string
- func (tv *TableView) SortSliceAction(fldIdx int)
- func (tv *TableView) StdConfig() (mods, updt bool)
- func (tv *TableView) StdCtxtMenu(m *gi.Menu, row int)
- func (tv *TableView) StdFrameConfig() kit.TypeAndNameList
- func (tv *TableView) StdSliceFrameConfig() kit.TypeAndNameList
- func (tv *TableView) StructType() reflect.Type
- func (tv *TableView) Style2D()
- func (tv *TableView) TableViewEvents()
- func (tv *TableView) ToolBar() *gi.ToolBar
- func (tv *TableView) UnselectAllRows()
- func (tv *TableView) UnselectRow(row int)
- func (tv *TableView) UnselectRowAction(row int)
- func (tv *TableView) UpdateFromSlice()
- func (tv *TableView) UpdateSelect(idx int, sel bool)
- func (tv *TableView) UpdateValues()
- type TableViewSignals
- type TableViewStyleFunc
- type TextBuf
- func (tb *TextBuf) AddTag(ln, st, ed int, tag token.Tokens)
- func (tb *TextBuf) AddTagEdit(tbe *TextBufEdit, tag token.Tokens)
- func (tb *TextBuf) AddView(vw *TextView)
- func (tb *TextBuf) AdjustPos(pos TextPos, t time.Time, del AdjustPosDel) TextPos
- func (tb *TextBuf) AdjustReg(reg TextRegion) TextRegion
- func (tb *TextBuf) AdjustedTags(ln int) lex.Line
- func (tb *TextBuf) AppendText(text []byte, saveUndo, signal bool) *TextBufEdit
- func (tb *TextBuf) AppendTextLine(text []byte, saveUndo, signal bool) *TextBufEdit
- func (tb *TextBuf) AppendTextLineMarkup(text []byte, markup []byte, saveUndo, signal bool) *TextBufEdit
- func (tb *TextBuf) AppendTextMarkup(text []byte, markup []byte, saveUndo, signal bool) *TextBufEdit
- func (tb *TextBuf) AutoIndent(ln int, indents, unindents []string) (tbe *TextBufEdit, indLev, chPos int)
- func (tb *TextBuf) AutoIndentRegion(st, ed int, indents, unindents []string)
- 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) 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) DeleteText(st, ed TextPos, saveUndo, signal bool) *TextBufEdit
- func (tb *TextBuf) DeleteView(vw *TextView)
- func (tb *TextBuf) DiffBufs(ob *TextBuf) TextDiffs
- func (tb *TextBuf) DiffBufsUnified(ob *TextBuf, context int) []byte
- func (tb *TextBuf) EditDone()
- func (tb *TextBuf) EmacsUndoSave()
- func (tb *TextBuf) EndPos() TextPos
- func (tb *TextBuf) FileModCheck() bool
- func (tb *TextBuf) FindScopeMatch(r rune, st TextPos) (en TextPos, found bool)
- func (tb *TextBuf) InComment(pos TextPos) bool
- func (tb *TextBuf) IndentLine(ln, n int) *TextBufEdit
- func (tb *TextBuf) InsertText(st TextPos, text []byte, saveUndo, signal bool) *TextBufEdit
- func (tb *TextBuf) IsChanged() bool
- func (tb *TextBuf) IsMarkingUp() bool
- func (tb *TextBuf) IsSpellCorrectEnabled(pos TextPos) bool
- func (tb *TextBuf) IsValidLine(ln int) bool
- func (tb *TextBuf) Line(ln int) []rune
- func (tb *TextBuf) LineCommented(ln int) bool
- func (tb *TextBuf) LineIndent(ln int, tabSz int) (n int, ichr indent.Char)
- func (tb *TextBuf) LineLen(ln int) int
- func (tb *TextBuf) LinesDeleted(tbe *TextBufEdit)
- func (tb *TextBuf) LinesEdited(tbe *TextBufEdit)
- func (tb *TextBuf) LinesInserted(tbe *TextBufEdit)
- func (tb *TextBuf) LinesToBytes()
- func (tb *TextBuf) LinesToBytesCopy() []byte
- func (tb *TextBuf) MarkupAllLines()
- func (tb *TextBuf) MarkupFromTags()
- func (tb *TextBuf) MarkupLines(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 TextDiffs, signal bool) bool
- func (tb *TextBuf) PrevLineIndent(ln int) (n int, ichr indent.Char, txt string)
- func (tb *TextBuf) ReMarkup()
- func (tb *TextBuf) Redo() *TextBufEdit
- func (tb *TextBuf) Refresh()
- func (tb *TextBuf) RefreshViews()
- func (tb *TextBuf) Region(st, ed TextPos) *TextBufEdit
- func (tb *TextBuf) RemoveTag(pos TextPos, tag token.Tokens) (reg lex.Lex, ok bool)
- 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 TextPos) bool
- func (tb *TextBuf) SaveUndo(tbe *TextBufEdit)
- func (tb *TextBuf) Search(find []byte, ignoreCase bool) (int, []FileSearchMatch)
- 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 histyle.StyleName)
- func (tb *TextBuf) SetSpellCorrect(data interface{}, editFun spell.EditFunc)
- func (tb *TextBuf) SetText(txt []byte)
- func (tb *TextBuf) Stat() error
- func (tb *TextBuf) TagAt(pos TextPos) (reg lex.Lex, ok bool)
- func (tb *TextBuf) Text() []byte
- func (tb *TextBuf) Undo() *TextBufEdit
- func (tb *TextBuf) ValidPos(pos TextPos) TextPos
- func (tb *TextBuf) ViewportFromView() *gi.Viewport2D
- type TextBufEdit
- type TextBufList
- type TextBufOpts
- type TextBufSignals
- type TextDiffs
- type TextPos
- type TextRegion
- type TextView
- func (tv *TextView) AutoScroll(pos image.Point) bool
- func (tv *TextView) CancelComplete()
- func (tv *TextView) CancelCorrect()
- func (tv *TextView) CharEndPos(pos TextPos) gi.Vec2D
- func (tv *TextView) CharStartPos(pos TextPos) gi.Vec2D
- 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) *TextBufEdit
- func (tv *TextView) CursorBBox(pos TextPos) 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 TextPos)
- func (tv *TextView) CursorSprite() *gi.Viewport2D
- func (tv *TextView) CursorStartDoc()
- func (tv *TextView) CursorStartLine()
- func (tv *TextView) CursorToHistNext() bool
- func (tv *TextView) CursorToHistPrev() bool
- func (tv *TextView) CursorUp(steps int)
- func (tv *TextView) Cut() *TextBufEdit
- func (tv *TextView) DeleteSelection() *TextBufEdit
- func (tv *TextView) EditDone()
- func (tv *TextView) EscPressed()
- func (tv *TextView) FindMatches(find string, useCase bool) ([]FileSearchMatch, bool)
- func (tv *TextView) FindNextLink(pos TextPos) (TextPos, TextRegion, bool)
- func (tv *TextView) FindPrevLink(pos TextPos) (TextPos, TextRegion, 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 TextRegion)
- 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 TextPos) 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) IsWordBreak(r1, r2 rune) bool
- func (tv *TextView) IsWordEnd(tp TextPos) bool
- func (tv *TextView) IsWordMiddle(tp TextPos) bool
- func (tv *TextView) IsWordStart(tp TextPos) bool
- func (tv *TextView) JumpToLine(ln int)
- func (tv *TextView) JumpToLinePrompt()
- func (tv *TextView) KeyInput(kt *key.ChordEvent)
- func (tv *TextView) KeyInputInsertRune(kt *key.ChordEvent)
- func (tv *TextView) Label() string
- 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 *TextBufEdit)
- func (tv *TextView) LinesInserted(tbe *TextBufEdit)
- func (tv *TextView) LinkAt(pos TextPos) (*gi.TextLink, bool)
- func (tv *TextView) MakeContextMenu(m *gi.Menu)
- func (tv *TextView) MatchFromPos(matches []FileSearchMatch, cpos TextPos) (int, bool)
- func (tv *TextView) MouseEvent(me *mouse.Event)
- 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 TextPos) (*gi.TextLink, bool)
- func (tv *TextView) ParentLayout() *gi.Layout
- func (tv *TextView) Paste()
- func (tv *TextView) PasteHist()
- func (tv *TextView) PixelToCursor(pt image.Point) TextPos
- 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)
- 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)
- func (tv *TextView) RenderLineNosBox(st, ed int)
- func (tv *TextView) RenderLineNosBoxAll()
- func (tv *TextView) RenderLines(st, ed int) bool
- func (tv *TextView) RenderRegionBox(reg TextRegion, state TextViewStates)
- func (tv *TextView) RenderRegionBoxSty(reg TextRegion, sty *gi.Style, bgclr *gi.ColorSpec)
- func (tv *TextView) RenderRegionToEnd(st TextPos, 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() gi.Vec2D
- func (tv *TextView) RenderStartPos() gi.Vec2D
- func (tv *TextView) ResetState()
- func (tv *TextView) ResizeIfNeeded(nwSz image.Point) bool
- func (tv *TextView) SavePosHistory(pos TextPos)
- 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 TextPos)
- func (tv *TextView) SelectReset()
- func (tv *TextView) SelectWord() bool
- func (tv *TextView) Selection() *TextBufEdit
- func (tv *TextView) SetBuf(buf *TextBuf)
- func (tv *TextView) SetCursor(pos TextPos)
- func (tv *TextView) SetCursorCol(pos TextPos)
- func (tv *TextView) SetCursorFromMouse(pt image.Point, newPos TextPos, selMode mouse.SelectModes)
- func (tv *TextView) SetCursorShow(pos TextPos)
- 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(region *TextBufEdit) 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 []TextRegion)
- func (tv *TextView) ValidateCursor()
- func (tv *TextView) VisSizes()
- func (tv *TextView) WordAt() (region TextRegion)
- func (tv *TextView) WordBefore(tp TextPos) *TextBufEdit
- func (tv *TextView) WrappedLineNo(pos TextPos) (si, ri int, ok bool)
- func (tv *TextView) WrappedLines(ln int) int
- type TextViewSignals
- type TextViewStates
- 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) CopyAction(reset bool)
- func (tv *TreeView) Cut()
- func (tv *TreeView) CutAction()
- func (tv *TreeView) DragNDropFinalize(mod dnd.DropMods)
- func (tv *TreeView) DragNDropSource(de *dnd.Event)
- 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) 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) PasteAction()
- 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) Render2D()
- 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)
- 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)
- 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 TreeViewSignals
- type TreeViewStates
- type TypeValueView
- 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) HasAction() bool
- func (vv *ValueViewBase) IsInactive() 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) SetStandaloneValue(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) Tag(tag string) (string, bool)
- func (vv *ValueViewBase) UpdateWidget()
- func (vv *ValueViewBase) Val() reflect.Value
- func (vv *ValueViewBase) WidgetType() reflect.Type
- type ValueViewer
- 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) HiStylesView(styles interface{})
- 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)
Constants ¶
const ( // TextBufAutoSaving is used in atomically safe way to protect autosaving TextBufAutoSaving gi.NodeFlags = 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 )
these extend NodeBase NodeFlags to hold TextBuf state
const ( // TextViewNeedsRefresh indicates when refresh is required TextViewNeedsRefresh gi.NodeFlags = 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 )
these extend NodeBase NodeFlags to hold TextView state
const ( // TreeViewFlagClosed means node is toggled closed (children not visible) TreeViewFlagClosed gi.NodeFlags = gi.NodeFlagsN + iota // TreeViewFlagChanged is updated on the root node whenever a gui edit is // made through the tree view on the tree -- this does not track any other // changes that might have occurred in the tree itself. Also emits a TreeVi TreeViewFlagChanged )
these extend NodeBase NodeFlags to hold TreeView state
const ( // TreeViewSelProp is a slice of tree views that are currently selected // -- much more efficient to update the list rather than regenerate it, // especially for a large tree TreeViewSelProp = "__SelectedList" // TreeViewSelModeProp is a bool that, if true, automatically selects nodes // when nodes are moved to via keyboard actions TreeViewSelModeProp = "__SelectMode" )
These are special properties established on the RootView for maintaining overall tree state
Variables ¶
var ArgViewProps = ki.Props{ "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 ColorViewProps = ki.Props{ "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, }
var DefaultIndentStrings = []string{"{"}
var DefaultUnindentStrings = []string{"}"}
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{ "CallMethods": ki.PropSlice{ {"RenameFile", ki.Props{ "label": "Rename...", "desc": "Rename file to new file name", "Args": ki.PropSlice{ {"New Name", ki.Props{ "width": 60, "default-field": "Nm", }}, }, }}, {"NewFile", ki.Props{ "label": "New File...", "desc": "Create a new file in this folder", "Args": ki.PropSlice{ {"File Name", ki.Props{ "width": 60, }}, }, }}, {"NewFolder", ki.Props{ "label": "New Folder...", "desc": "Create a new folder within this folder", "Args": ki.PropSlice{ {"Folder Name", ki.Props{ "width": 60, }}, }, }}, }, }
var FileSearchContext = 30
FileSearchContext is how much text to include on either side of the search match
var FileTreeActiveDirFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ft := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ft.FileNode() if fn != nil { act.SetActiveState(fn.IsDir()) } })
FileTreeActiveDirFunc is an ActionUpdateFunc that activates action if node is a dir
var FileTreeInactiveDirFunc = ActionUpdateFunc(func(fni interface{}, act *gi.Action) { ft := fni.(ki.Ki).Embed(KiT_FileTreeView).(*FileTreeView) fn := ft.FileNode() if fn != nil { act.SetInactiveState(fn.IsDir()) } })
FileTreeInactiveDirFunc is an ActionUpdateFunc that inactivates action if node is a dir
var FileTreeProps = ki.Props{}
var FileTreeViewProps = ki.Props{ "indent": units.NewValue(2, units.Ch), "spacing": units.NewValue(.5, units.Ch), "border-width": units.NewValue(0, units.Px), "border-radius": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "margin": units.NewValue(1, units.Px), "text-align": gi.AlignLeft, "vertical-align": gi.AlignTop, "color": &gi.Prefs.Colors.Font, "background-color": "inherit", ".exec": ki.Props{ "font-weight": gi.WeightBold, }, ".open": ki.Props{ "font-style": gi.FontItalic, }, "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &gi.Prefs.Colors.Icon, "stroke": &gi.Prefs.Colors.Font, }, "#branch": ki.Props{ "icon": "widget-wedge-down", "icon-off": "widget-wedge-right", "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "background-color": color.Transparent, "max-width": units.NewValue(.8, units.Em), "max-height": units.NewValue(.8, units.Em), }, "#space": ki.Props{ "width": units.NewValue(.5, units.Em), }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "min-width": units.NewValue(16, units.Ch), }, "#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{ {"DuplicateFiles", ki.Props{ "label": "Duplicate", "updtfunc": FileTreeInactiveDirFunc, }}, {"DeleteFiles", ki.Props{ "label": "Delete", "desc": "Ok to delete file(s)? This is not undoable and is not moving to trash / recycle bin", "confirm": true, "updtfunc": FileTreeInactiveDirFunc, }}, {"RenameFiles", ki.Props{ "label": "Rename", "desc": "Rename file to new file name", }}, {"sep-open", ki.BlankProp{}}, {"OpenDirs", ki.Props{ "label": "Open Dir", "desc": "open given folder to see files within", "updtfunc": FileTreeActiveDirFunc, }}, {"NewFile", ki.Props{ "label": "New File...", "desc": "make a new file in this folder", "updtfunc": FileTreeActiveDirFunc, "Args": ki.PropSlice{ {"File Name", ki.Props{ "width": 60, }}, }, }}, {"NewFolder", ki.Props{ "label": "New Folder...", "desc": "make a new folder within this folder", "updtfunc": FileTreeActiveDirFunc, "Args": ki.PropSlice{ {"Folder Name", ki.Props{ "width": 60, }}, }, }}, }, }
var FileViewKindColorMap = map[string]string{
"folder": "pref(link)",
}
FileViewKindColorMap translates file Kinds into different colors for the file viewer
var FileViewProps = ki.Props{ "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{ "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{ "padding": units.NewValue(2, units.Px), "margin": units.NewValue(2, units.Px), "vertical-align": gi.AlignTop, "color": &gi.Prefs.Colors.Font, "background-color": &gi.Prefs.Colors.Control, "border-width": units.NewValue(1, units.Px), "border-radius": units.NewValue(4, units.Px), "border-color": &gi.Prefs.Colors.Border, "border-style": gi.BorderSolid, "height": units.NewValue(1, units.Em), "width": units.NewValue(20, units.Ch), "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, true, nil, "ArgData") // true = bitflags
var KiT_ArgView = kit.Types.AddType(&ArgView{}, ArgViewProps)
var KiT_BoolValueView = kit.Types.AddType(&BoolValueView{}, nil)
var KiT_ByteSliceValueView = kit.Types.AddType(&ByteSliceValueView{}, nil)
var KiT_ColorValueView = kit.Types.AddType(&ColorValueView{}, nil)
var KiT_ColorView = kit.Types.AddType(&ColorView{}, ColorViewProps)
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.AddEnum(FileNodeFlagsN, true, nil) // true = bitflags
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, true, nil, "MethView") // true = bitflags
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_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_TextView = kit.Types.AddType(&TextView{}, TextViewProps)
var KiT_TreeView = kit.Types.AddType(&TreeView{}, nil)
var KiT_TypeValueView = kit.Types.AddType(&TypeValueView{}, nil)
var KiT_ValueViewBase = kit.Types.AddType(&ValueViewBase{}, ValueViewBaseProps)
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 MapViewProps = ki.Props{ "background-color": &gi.Prefs.Colors.Background, "max-width": -1, "max-height": -1, }
var MaxScopeLines = 100
MaxScopeLines is the maximum lines to search for a scope marker, e.g. '}'
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 SliceViewProps = ki.Props{ "background-color": &gi.Prefs.Colors.Background, "max-width": -1, "max-height": -1, }
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{}
var StructViewProps = ki.Props{ "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{ "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "max-width": -1, "max-height": -1, }
var TableViewWaitCursorSize = 5000
TableViewWaitCursorSize is the length of the slice above which a wait cursor will be displayed while updating the table
var TextBufProps = ki.Props{ "CallMethods": ki.PropSlice{ {"SaveAs", ki.Props{ "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", }}, }, }}, }, }
var TextPosErr = TextPos{-1, -1}
TextPosErr represents an error text position (-1 for both line and char) used as a return value for cases where error positions are possible
var TextPosZero = TextPos{}
TextPosZero is the uninitialized zero text position (which is still a valid position)
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 TextViewDepthColors = []gi.Color{
{255, 255, 255, 255},
{250, 250, 255, 255},
{240, 240, 255, 255},
{250, 240, 255, 255},
{255, 240, 255, 255},
{255, 240, 240, 255},
{255, 240, 240, 255},
{255, 250, 240, 255},
{255, 255, 240, 255},
}
var TextViewMaxFindHighlights = 1000
TextViewMaxFindHighlights is the maximum number of regions to highlight on find
var TextViewProps = ki.Props{ "white-space": gi.WhiteSpacePreWrap, "font-family": "Go Mono", "border-width": 0, "cursor-width": units.NewValue(3, units.Px), "border-color": &gi.Prefs.Colors.Border, "border-style": gi.BorderSolid, "padding": units.NewValue(2, units.Px), "margin": units.NewValue(2, units.Px), "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{ "indent": units.NewValue(4, units.Ch), "spacing": units.NewValue(.5, units.Ch), "border-width": units.NewValue(0, units.Px), "border-radius": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "margin": units.NewValue(1, units.Px), "text-align": gi.AlignLeft, "vertical-align": gi.AlignTop, "color": &gi.Prefs.Colors.Font, "background-color": "inherit", "#icon": ki.Props{ "width": units.NewValue(1, units.Em), "height": units.NewValue(1, units.Em), "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "fill": &gi.Prefs.Colors.Icon, "stroke": &gi.Prefs.Colors.Font, }, "#branch": ki.Props{ "icon": "widget-wedge-down", "icon-off": "widget-wedge-right", "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "background-color": color.Transparent, "max-width": units.NewValue(.8, units.Em), "max-height": units.NewValue(.8, units.Em), }, "#space": ki.Props{ "width": units.NewValue(.5, units.Em), }, "#label": ki.Props{ "margin": units.NewValue(0, units.Px), "padding": units.NewValue(0, units.Px), "min-width": units.NewValue(16, units.Ch), }, "#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 ValueViewBaseProps = ki.Props{ "base-type": true, }
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 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 CompleteGo ¶
CompleteGo uses github.com/mdempsky/gocode to do code completion gocode requires the entire file and the position of the cursor within the file
func CompleteGoEdit ¶
func CompleteGoEdit(data interface{}, text string, cursorPos int, completion complete.Completion, seed string) (ed complete.EditData)
CompleteGoEdit uses the selected completion to edit the text
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.EditData)
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 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 HasMainMenuView ¶
func HasMainMenuView(val interface{}) bool
HasMainMenuView returns true if given val has a MainMenu type property registered -- call this to check before then calling MainMenuView
func HasToolBarView ¶
func HasToolBarView(val interface{}) bool
HasToolBarView returns true if given val has a ToolBar type property registered -- call this to check before then calling ToolBarView.
func HasUpperCase ¶
HasUpperCase returns true if string has an upper-case letter
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 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
MapViewDialog is for editing elements of a map using a MapView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
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 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 PunctGpMatch ¶ added in v0.9.4
PunctGpMatch returns the matching grouping punctuation for given rune, which must be a left or right brace {}, bracket [] or paren () -- also returns true if it is *right*
func QReplaceDialog ¶
func QReplaceDialog(avp *gi.Viewport2D, find string, opts gi.DlgOpts, recv ki.Ki, fun ki.RecvFunc) *gi.Dialog
QReplaceDialog prompts the user for a query-replace items, with comboboxes with history
func QReplaceDialogValues ¶
QReplaceDialogValues gets the string values
func SliceRowByValue ¶
SliceRowByValue searches for first row 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
SliceViewDialog for editing elements of a slice using a SliceView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Also has an optional styling function for styling elements of the table.
func SliceViewSelectDialog ¶
func SliceViewSelectDialog(avp *gi.Viewport2D, slice, curVal interface{}, opts DlgOpts, styleFunc SliceViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
SliceViewSelectDialog for selecting one row from given slice -- connections functions available for both the widget signal reporting selection events, and the overall dialog signal. Also has an optional styling function for styling elements of the table.
func SliceViewSelectDialogValue ¶
SliceViewSelectDialogValue gets the index of the selected item (-1 if nothing selected)
func SpellCorrectEdit ¶
SpellCorrectEdit uses the selected correction to edit the text
func SrcNodeSignal ¶
SrcNodeSignal is the function for receiving node signals from our SrcNode
func StructSliceRowByValue ¶
StructSliceRowByValue searches for first row 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
StructViewDialog is for editing fields of a structure using a StructView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore)
func TableViewDialog ¶
func TableViewDialog(avp *gi.Viewport2D, slcOfStru interface{}, opts DlgOpts, styleFunc TableViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TableViewDialog is for editing fields of a slice-of-struct using a TableView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Also has an optional styling function for styling elements of the table.
func TableViewSelectDialog ¶
func TableViewSelectDialog(avp *gi.Viewport2D, slcOfStru interface{}, opts DlgOpts, initRow int, styleFunc TableViewStyleFunc, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TableViewSelectDialog is for selecting a row from a slice-of-struct using a TableView -- optionally connects to given signal receiving object and functions for signals (nil to ignore): selFunc for the widget signal reporting selection events, and dlgFunc for the overall dialog signals. Also has an optional styling function for styling elements of the table.
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).
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 AdjustPosDel ¶
type AdjustPosDel int
AdjustPosDel determines what to do with positions within deleted region
const ( // AdjustPosDelErr means return a TextPosErr when in deleted region AdjustPosDelErr AdjustPosDel = iota // AdjustPosDelStart means return start of deleted region AdjustPosDelStart // AdjustPosDelEnd means return end of deleted region AdjustPosDelEnd )
these are options for what to do with positions within deleted region for the AdjustPos function
type ArgData ¶
type ArgData struct { Val reflect.Value Name string Desc string View ValueView Default interface{} Flags ArgDataFlags }
ArgData contains the relevant data for each arg, including the reflect.Value, name, optional description, and default value
func MethViewArgData ¶
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 */ }
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 -- nil, -1 if not found
func (*ArgView) ConfigArgsGrid ¶
func (av *ArgView) ConfigArgsGrid()
ConfigArgsGrid configures the ArgsGrid for the current struct
func (*ArgView) SetArgs ¶
SetArgs sets the source args that we are viewing -- rebuilds the children to represent
func (*ArgView) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*ArgView) StdFrameConfig ¶
func (av *ArgView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*ArgView) TitleWidget ¶
Title returns the title label widget, and its index, within frame -- nil, -1 if not found
func (*ArgView) UpdateArgs ¶
func (av *ArgView) UpdateArgs()
UpdateArgs updates each of the value-view widgets for the args
func (*ArgView) UpdateFromArgs ¶
func (av *ArgView) UpdateFromArgs()
UpdateFromArgs updates full widget layout from structure
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 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 */ }
ColorView shows a color, using sliders to set values,
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) NumLayConfig ¶
func (cv *ColorView) NumLayConfig()
NumLayConfig configures the numerical layout
func (*ColorView) SetHSLValue ¶
func (*ColorView) SetRGBValue ¶
func (*ColorView) SliderLayConfig ¶
func (cv *ColorView) SliderLayConfig()
SliderLayConfig configures the sliders layout
func (*ColorView) StdFrameConfig ¶
func (cv *ColorView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*ColorView) StdSliderConfig ¶
func (cv *ColorView) StdSliderConfig() kit.TypeAndNameList
StdSliderConfig returns a TypeAndNameList for configuring a standard sliders
func (*ColorView) StdSliderLayConfig ¶
func (cv *ColorView) StdSliderLayConfig() kit.TypeAndNameList
func (*ColorView) UpdateSliderGrid ¶
func (cv *ColorView) UpdateSliderGrid()
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 */ Ok bool `` /* 320-byte string literal not displayed */ Cancel bool `` /* 324-byte string literal not displayed */ AddOnly bool `desc:"can the user delete elements of the slice"` DeleteOnly bool `desc:"can the user add elements to the slice"` }
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
}
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"` Path string `view:"-" tableview:"-" desc:"full path to file, including name -- for file functions"` }
FileInfo represents the information about a given file / directory, including icon, mimetype, etc
func NewFileInfo ¶
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) Duplicate ¶
Duplicate creates a copy of given file -- only works for regular files, not directories.
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.
type FileNode ¶
type FileNode struct { ki.Node FPath gi.FileName `desc:"full path to this file"` Info FileInfo `desc:"full standard file info about this file"` Buf *TextBuf `json:"-" xml:"-" desc:"file buffer for editing this file"` FRoot *FileTree `json:"-" xml:"-" desc:"root of the tree -- has global state"` }
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) CloseBuf ¶
CloseBuf closes the file in its buffer if it is open -- returns true if closed
func (*FileNode) CloseDir ¶
func (fn *FileNode) CloseDir()
CloseDir closes given directory node -- updates memory state
func (*FileNode) ConfigOfFiles ¶
func (fn *FileNode) ConfigOfFiles(path string) kit.TypeAndNameList
ConfigOfFiles returns a type-and-name list for configuring nodes based on files immediately within given path
func (*FileNode) CopyFileToDir ¶
CopyFileToDir copies given file path into node that is a directory prompts before overwriting any existing
func (*FileNode) CopyFileToFile ¶
CopyFileToFile copies given file path into node that is an existing file prompts before doing so
func (*FileNode) DuplicateFile ¶
Duplicate creates a copy of given file -- only works for regular files, not directories
func (*FileNode) FileExtCounts ¶
func (fn *FileNode) FileExtCounts() []FileNodeNameCount
FileExtCounts returns a count of all the different file extensions, sorted from highest to lowest
func (*FileNode) FilesMatching ¶
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) 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) NewFolder ¶
NewFolder makes a new folder (directory) in given selected directory node
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) OpenDirsTo ¶
OpenDirsTo opens all the directories above the given filename, and returns the node for element at given path (can be a file or directory itself -- not opened -- just returned)
func (*FileNode) ReadDir ¶
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) SetNodePath ¶
SetNodePath sets the path for given node and updates it based on associated file
func (*FileNode) UpdateNode ¶
UpdateNode updates information in node based on its associated file in FPath
type FileNodeFlags ¶
type FileNodeFlags int64
FileNodeFlags define bitflags for FileNode state -- these extend ki.Flags and storage is an int64
const ( // FileNodeOpen means file is open -- for directories, this means that // sub-files should be / have been loaded -- for files, means that they // have been opened e.g., for editing FileNodeOpen FileNodeFlags = FileNodeFlags(ki.FlagsN) + iota // FileNodeSymLink indicates that file is a symbolic link -- file info is // all for the target of the symlink FileNodeSymLink FileNodeFlagsN )
func StringToFileNodeFlags ¶
func StringToFileNodeFlags(s string) (FileNodeFlags, error)
func (FileNodeFlags) String ¶
func (i FileNodeFlags) String() string
type FileNodeNameCount ¶
FileNodeNameCount is used to report counts of different string-based things in the file tree
type FileSearchMatch ¶
type FileSearchMatch struct { Reg TextRegion `desc:"region surrounding the match"` Text []byte `desc:"text surrounding the match, at most FileSearchContext on either side (within a single line)"` }
FileSearchMatch records one match for search within file
func ByteBufSearch ¶
ByteBufSearch looks for a string (no regexp) within a byte buffer, with given case-sensitivity, returning number of occurrences and specific match position list -- column positions are in runes
func FileSearch ¶
func FileSearch(filename string, find []byte, ignoreCase bool) (int, []FileSearchMatch)
FileSearch looks for a string (no regexp) within a file, in a case-sensitive way, returning number of occurrences and specific match position list -- column positions are in bytes, not runes.
func NewFileSearchMatch ¶ added in v0.9.4
func NewFileSearchMatch(rn []rune, st, ed, ln int) FileSearchMatch
NewFileSearchMatch returns a new FileSearchMatch entry for given rune line with match starting at st and ending before ed, on given line
type FileSize ¶
type 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 OpenDirs OpenDirMap `` /* 185-byte string literal not displayed */ DirsOnTop bool `desc:"if true, then all directories are placed at the top of the tree view -- otherwise everything is alpha sorted"` NodeType reflect.Type `desc:"type of node to create -- defaults to giv.FileNode but can use custom node types"` }
FileTree is the root of a tree representing files in a given directory (and subdirectories thereof), and has some overall management state for how to view things. The FileTree can be viewed by a TreeView to provide a GUI interface into it.
func (*FileTree) IsDirOpen ¶
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 OpenDirs will be opened.
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) 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 (*FileTreeView) Cut ¶
func (ft *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 (ft *FileTreeView) DeleteFiles()
DeleteFiles calls DeleteFile on any selected nodes
func (*FileTreeView) Dragged ¶
func (ft *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 (ft *FileTreeView) Drop(md mimedata.Mimes, mod dnd.DropMods)
Drop pops up a menu to determine what specifically to do with dropped items satisfies gi.DragNDropper interface and can be overridden by subtypes
func (*FileTreeView) DuplicateFiles ¶
func (ft *FileTreeView) DuplicateFiles()
DuplicateFiles calls DuplicateFile on any selected nodes
func (*FileTreeView) FileNode ¶
func (ft *FileTreeView) FileNode() *FileNode
FileNode returns the SrcNode as a FileNode
func (*FileTreeView) NewFile ¶
func (ft *FileTreeView) NewFile(filename string)
NewFile makes a new file in given selected directory node
func (*FileTreeView) NewFolder ¶
func (ft *FileTreeView) NewFolder(foldername string)
NewFolder makes a new file in given selected directory node
func (*FileTreeView) Paste ¶
func (ft *FileTreeView) Paste()
Paste pastes clipboard at given node satisfies gi.Clipper interface and can be overridden by subtypes
func (*FileTreeView) PasteMime ¶
func (ft *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) RenameFiles ¶
func (ft *FileTreeView) RenameFiles()
RenameFiles calls RenameFile on any selected nodes
func (*FileTreeView) Style2D ¶
func (ft *FileTreeView) Style2D()
type FileValueView ¶
type FileValueView struct {
ValueViewBase
}
FileValueView presents an action for displaying an 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) ConfigPathRow ¶
func (fv *FileView) ConfigPathRow()
func (*FileView) ConfigSelRow ¶
func (fv *FileView) ConfigSelRow()
func (*FileView) ConnectEvents2D ¶
func (fv *FileView) ConnectEvents2D()
func (*FileView) DirPathUp ¶
func (fv *FileView) DirPathUp()
DirPathUp moves up one directory in the path
func (*FileView) DoStdConfig ¶
func (fv *FileView) DoStdConfig()
DoStdConfig does the standard configuration, but does not update files
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, pos token.Position) (md complete.MatchData)
FileComplete finds the possible completions for the file field
func (*FileView) FileCompleteEdit ¶
func (fv *FileView) FileCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, seed string) (ed complete.EditData)
FileCompleteEdit is the editing function called when inserting the completion selection in the file field
func (*FileView) FileSelectAction ¶
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, pos token.Position) (md complete.MatchData)
PathComplete finds the possible completions for the path field
func (*FileView) PathCompleteEdit ¶
func (fv *FileView) PathCompleteEdit(data interface{}, text string, cursorPos int, c complete.Completion, seed string) (ed complete.EditData)
PathCompleteEdit is the editing function called when inserting the completion selection in the path field
func (*FileView) 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) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*FileView) StdFrameConfig ¶
func (fv *FileView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
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) UpdateFromPath ¶
func (fv *FileView) UpdateFromPath()
UpdateFromPath will update view based on current DirPath
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 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) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*GiEditor) StdFrameConfig ¶
func (ge *GiEditor) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
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 -- nil, -1 if not found
func (*GiEditor) Update ¶
func (ge *GiEditor) Update()
Update updates the objects being edited (e.g., updating display changes)
func (*GiEditor) UpdateFromRoot ¶
func (ge *GiEditor) UpdateFromRoot()
UpdateFromRoot updates full widget layout
type HiMarkup ¶
type HiMarkup struct { Info *FileInfo `desc:"full info about the file including category etc"` Style histyle.StyleName `desc:"syntax highlighting style"` Lang string `desc:"chroma-based language name for syntax highlighting the code"` Has bool `desc:"true if both lang and style are set"` TabSize int `desc:"tab size, in chars"` CSSProps ki.Props `json:"-" xml:"-" desc:"Commpiled CSS properties for given highlighting style"` PiState *pi.FileState `desc:"pi parser state info"` PiParser *pi.Parser `desc:"if supported, this is the pi parser"` 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) 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
type HiStyleValueView ¶
type HiStyleValueView struct {
ValueViewBase
}
HiStyleValueView presents an action for displaying an KeyMapName and selecting icons from KeyMapChooserDialog
func (*HiStyleValueView) Activate ¶
func (vv *HiStyleValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*HiStyleValueView) ConfigWidget ¶
func (vv *HiStyleValueView) ConfigWidget(widg gi.Node2D)
func (*HiStyleValueView) HasAction ¶
func (vv *HiStyleValueView) HasAction() bool
func (*HiStyleValueView) UpdateWidget ¶
func (vv *HiStyleValueView) UpdateWidget()
func (*HiStyleValueView) WidgetType ¶
func (vv *HiStyleValueView) WidgetType() reflect.Type
type ISearch ¶
type ISearch struct { On bool `json:"-" xml:"-" desc:"if true, in interactive search mode"` Find string `json:"-" xml:"-" desc:"current interactive search string"` UseCase bool `json:"-" xml:"-" desc:"pay attention to case in isearch -- triggered by typing an upper-case letter"` Matches []FileSearchMatch `json:"-" xml:"-" desc:"current search matches"` Pos int `json:"-" xml:"-" desc:"position within isearch matches"` PrevPos int `json:"-" xml:"-" desc:"position in search list from previous search"` StartPos TextPos `json:"-" xml:"-" desc:"starting position for search -- returns there after on cancel"` }
ISearch holds all the interactive search data
type IconValueView ¶
type IconValueView struct {
ValueViewBase
}
IconValueView presents an action for displaying an IconName and selecting icons from IconChooserDialog
func (*IconValueView) Activate ¶
func (vv *IconValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)
func (*IconValueView) ConfigWidget ¶
func (vv *IconValueView) ConfigWidget(widg gi.Node2D)
func (*IconValueView) HasAction ¶
func (vv *IconValueView) HasAction() bool
func (*IconValueView) UpdateWidget ¶
func (vv *IconValueView) UpdateWidget()
func (*IconValueView) WidgetType ¶
func (vv *IconValueView) WidgetType() reflect.Type
type IntValueView ¶
type IntValueView struct {
ValueViewBase
}
IntValueView presents a spinbox
func (*IntValueView) ConfigWidget ¶
func (vv *IntValueView) ConfigWidget(widg gi.Node2D)
func (*IntValueView) UpdateWidget ¶
func (vv *IntValueView) UpdateWidget()
func (*IntValueView) WidgetType ¶
func (vv *IntValueView) WidgetType() reflect.Type
type KeyChordEdit ¶
type KeyChordEdit struct { gi.Label FocusActive bool `json:"-" xml:"-" desc:"true if the keyboard focus is active or not -- when we lose active focus we apply changes"` KeyChordSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal -- only one event, when chord is updated from key input"` }
KeyChordEdit is a label widget that shows a key chord string, and, when in focus (after being clicked) will update to whatever key chord is typed -- used for representing and editing key chords.
func (*KeyChordEdit) ChordUpdated ¶
func (kc *KeyChordEdit) ChordUpdated()
ChordUpdated emits KeyChordSig when a new chord has been entered
func (*KeyChordEdit) ConnectEvents2D ¶
func (kc *KeyChordEdit) ConnectEvents2D()
func (*KeyChordEdit) 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 an KeyMapName and selecting icons from KeyMapChooserDialog
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 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 */ 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 (*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) 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, and its index, within frame -- nil, -1 if not found
func (*MapView) SetChanged ¶
func (mv *MapView) SetChanged()
SetChanged sets the Changed flag and emits the ViewSig signal for the SliceView, indicating that some kind of edit / change has taken place to the table data. It isn't really practical to record all the different types of changes, so this is just generic.
func (*MapView) SetMap ¶
SetMap sets the source map that we are viewing -- rebuilds the children to represent this map
func (*MapView) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*MapView) StdFrameConfig ¶
func (mv *MapView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*MapView) ToggleSort ¶
func (mv *MapView) ToggleSort()
ToggleSort toggles sorting by values vs. keys
func (*MapView) UpdateFromMap ¶
func (mv *MapView) UpdateFromMap()
UpdateFromMap does full updating from map
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 */ }
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) 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{}, tmpSave ValueView)
SetMap sets the source map that we are viewing -- rebuilds the children to represent this map
func (*MapViewInline) Style2D ¶
func (mv *MapViewInline) Style2D()
func (*MapViewInline) UpdateFromMap ¶
func (mv *MapViewInline) UpdateFromMap()
func (*MapViewInline) UpdateValues ¶
func (mv *MapViewInline) UpdateValues()
type MethViewData ¶
type MethViewData struct { Val interface{} ValVal reflect.Value Vp *gi.Viewport2D Method string MethVal reflect.Value MethTyp reflect.Method ArgProps ki.PropSlice `desc:"names and other properties of args, in one-to-one with method args"` SpecProps ki.Props `desc:"props for special action types, e.g., FileView"` Desc string `desc:"prompt shown in arg dialog or confirm prompt dialog"` UpdateFunc ActionUpdateFunc `desc:"update function defined in properties -- called by our wrapper update function"` SubMenuSlice interface{} `desc:"value for submenu generation as a literal slice of items of appropriate type for method being called"` SubMenuField string `desc:"value for submenu generation as name of field on obj"` SubMenuFunc SubMenuFunc `desc:"function that will generate submenu items, as []string slice"` SubMenuVal interface{} `` /* 129-byte string literal not displayed */ KeyFun gi.KeyFuns `desc:"key function that we emit, if MethViewKeyFun type"` Flags MethViewFlags }
MethViewData is set to the Action.Data field for all MethView actions, containing info needed to actually call the Method on value Val.
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 OpenDirMap ¶
OpenDirMap is a map for encoding directories that are open in the file tree. The strings are typically relative paths. The bool value is used to mark active paths and inactive (unmarked) ones can be removed.
func (*OpenDirMap) ClearFlags ¶
func (dm *OpenDirMap) ClearFlags()
ClearFlags sets all the bool flags to false -- do this prior to traversing full set of active paths -- can then call RemoveStale to get rid of unused paths
func (*OpenDirMap) IsOpen ¶
func (dm *OpenDirMap) IsOpen(path string) bool
IsOpen returns true if path is listed on the open map
func (*OpenDirMap) RemoveStale ¶
func (dm *OpenDirMap) RemoveStale()
RemoveStale removes all entries with a bool = false value indicating that they have not been accessed since ClearFlags was called.
func (*OpenDirMap) SetClosed ¶
func (dm *OpenDirMap) SetClosed(path string)
SetClosed removes given path from the open map
func (*OpenDirMap) SetOpen ¶
func (dm *OpenDirMap) SetOpen(path string)
SetOpen adds the given path to the open map
type OutBuf ¶ added in v0.9.4
type OutBuf struct { Out io.Reader `desc:"the output that we are reading from, as an io.Reader"` Buf *TextBuf `desc:"the TextBuf that we output to"` BatchMSec int `desc:"default 200: how many milliseconds to wait while batching output"` MarkupFun OutBufMarkupFunc `` /* 172-byte string literal not displayed */ CurOutLns [][]byte `desc:"current buffered output raw lines -- not yet sent to Buf"` CurOutMus [][]byte `desc:"current buffered output markup lines -- not yet sent to Buf"` Mu sync.Mutex `desc:"mutex protecting updating of CurOutLns and Buf, and timer"` LastOut time.Time `desc:"time when last output was sent to buffer"` AfterTimer *time.Timer `` /* 155-byte string literal not displayed */ }
OutBuf is a TextBuf that records the output from an io.Reader using bufio.Scanner -- optimized to combine fast chunks of output into large blocks of updating. Also supports arbitrary markup function that operates on each line of output bytes.
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"` Matches []FileSearchMatch `json:"-" xml:"-" desc:"current search matches"` Pos int `json:"-" xml:"-" desc:"position within isearch matches"` PrevPos int `json:"-" xml:"-" desc:"position in search list from previous search"` StartPos TextPos `json:"-" xml:"-" desc:"starting position for search -- returns there after on cancel"` }
QReplace holds all the query-replace data
type RuneSliceValueView ¶
type RuneSliceValueView struct {
ValueViewBase
}
RuneSliceValueView presents a textfield of the bytes
func (*RuneSliceValueView) ConfigWidget ¶
func (vv *RuneSliceValueView) ConfigWidget(widg gi.Node2D)
func (*RuneSliceValueView) UpdateWidget ¶
func (vv *RuneSliceValueView) UpdateWidget()
func (*RuneSliceValueView) WidgetType ¶
func (vv *RuneSliceValueView) WidgetType() reflect.Type
type ShortcutFunc ¶
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 { gi.Frame Slice interface{} `desc:"the slice that we are a view onto -- must be a pointer to that slice"` SliceValView ValueView `desc:"ValueView for the slice itself, if this was created within value view framework -- otherwise nil"` AddOnly bool `desc:"can the user delete elements of the slice"` DeleteOnly bool `desc:"can the user add elements to the slice"` StyleFunc SliceViewStyleFunc `view:"-" json:"-" xml:"-" desc:"optional styling function"` ShowViewCtxtMenu bool `` /* 131-byte string literal not displayed */ Changed bool `desc:"has the slice been edited?"` Values []ValueView `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)"` VisRows int `desc:"number of rows visible in display"` SelVal interface{} `view:"-" json:"-" xml:"-" desc:"current selection value -- initially select this value if set"` SelectedIdx int `json:"-" xml:"-" desc:"index of currently-selected item, in Inactive mode only"` SelectMode bool `desc:"editing-mode select rows mode"` SelectedRows map[int]struct{} `desc:"list of currently-selected rows"` DraggedRows []int `desc:"list of currently-dragged rows"` SliceViewSig ki.Signal `json:"-" xml:"-" desc:"slice view interactive editing signals"` ViewSig ki.Signal `` /* 179-byte string literal not displayed */ TmpSave ValueView `` /* 189-byte string literal not displayed */ BuiltSlice interface{} `view:"-" json:"-" xml:"-" desc:"the built slice"` BuiltSize int ToolbarSlice interface{} `desc:"the slice that we successfully set a toolbar for"` // contains filtered or unexported fields }
SliceView represents a slice, creating a property editor of the values -- constructs Children 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 (*SliceView) ConfigSliceGrid ¶
ConfigSliceGrid configures the SliceGrid for the current slice
func (*SliceView) ConfigSliceGridRows ¶
func (sv *SliceView) ConfigSliceGridRows()
ConfigSliceGridRows configures the SliceGrid rows for the current slice -- assumes .Kids is created at the right size -- only call this for a direct re-render e.g., after sorting
func (*SliceView) ConfigToolbar ¶
func (sv *SliceView) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*SliceView) ConnectEvents2D ¶
func (sv *SliceView) ConnectEvents2D()
func (*SliceView) Copy ¶
Copy copies selected rows to clip.Board, optionally resetting the selection satisfies gi.Clipper interface and can be overridden by subtypes
func (*SliceView) CopyRows ¶
CopyRows copies selected rows to clip.Board, optionally resetting the selection
func (*SliceView) Cut ¶
func (sv *SliceView) Cut()
Cut copies selected rows to clip.Board and deletes selected rows satisfies gi.Clipper interface and can be overridden by subtypes
func (*SliceView) CutRows ¶
func (sv *SliceView) CutRows()
CutRows copies selected rows to clip.Board and deletes selected rows
func (*SliceView) DeleteRows ¶
func (sv *SliceView) DeleteRows()
DeleteRows deletes all selected rows
func (*SliceView) 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 -- ends up calling DragNDropSource if us..
func (*SliceView) DragNDropSource ¶
DragNDropSource is called after target accepts the drop -- we just remove elements that were moved
func (*SliceView) DragNDropStart ¶
func (sv *SliceView) DragNDropStart()
DragNDropStart starts a drag-n-drop
func (*SliceView) DragNDropTarget ¶
DragNDropTarget handles a drag-n-drop drop
func (*SliceView) Drop ¶
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 (*SliceView) DropAssign ¶
DropAssign assigns mime data (only the first one!) to this node
func (*SliceView) DropBefore ¶
DropBefore inserts object(s) from mime data before this node
func (*SliceView) DropCancel ¶
func (sv *SliceView) DropCancel()
DropCancel cancels the drop action e.g., preventing deleting of source items in a Move case
func (*SliceView) Duplicate ¶
Duplicate copies selected items and inserts them after current selection -- return row of start of duplicates if successful, else -1
func (*SliceView) HasFocus2D ¶
func (*SliceView) ItemCtxtMenu ¶
func (*SliceView) KeyInputActive ¶
func (sv *SliceView) KeyInputActive(kt *key.ChordEvent)
func (*SliceView) KeyInputInactive ¶
func (sv *SliceView) KeyInputInactive(kt *key.ChordEvent)
func (*SliceView) MakeDropMenu ¶
MakeDropMenu makes the menu of options for dropping on a target
func (*SliceView) MakePasteMenu ¶
MakePasteMenu makes the menu of options for paste events
func (*SliceView) MimeDataRow ¶
MimeDataRow adds mimedata for given row: an application/json of the struct
func (*SliceView) MoveDown ¶
func (sv *SliceView) 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 (*SliceView) MoveDownAction ¶
func (sv *SliceView) 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 (*SliceView) MovePageDown ¶ added in v0.9.4
func (sv *SliceView) MovePageDown(selMode mouse.SelectModes) int
MovePageDown moves the selection down to next page, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*SliceView) MovePageDownAction ¶ added in v0.9.4
func (sv *SliceView) 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 row
func (*SliceView) MovePageUp ¶ added in v0.9.4
func (sv *SliceView) MovePageUp(selMode mouse.SelectModes) int
MovePageUp moves the selection up to previous page, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*SliceView) MovePageUpAction ¶ added in v0.9.4
func (sv *SliceView) 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 row
func (*SliceView) MoveUp ¶
func (sv *SliceView) MoveUp(selMode mouse.SelectModes) int
MoveUp moves the selection up to previous row, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*SliceView) MoveUpAction ¶
func (sv *SliceView) MoveUpAction(selMode mouse.SelectModes) int
MoveUpAction moves the selection up to previous row, using given select mode (from keyboard modifiers) -- and emits select event for newly selected row
func (*SliceView) Paste ¶
func (sv *SliceView) Paste()
Paste pastes clipboard at given row satisfies gi.Clipper interface and can be overridden by subtypes
func (*SliceView) PasteAssign ¶
PasteAssign assigns mime data (only the first one!) to this row
func (*SliceView) PasteAtRow ¶
PasteAtRow inserts object(s) from mime data at (before) given row
func (*SliceView) PasteMenu ¶
PasteMenu performs a paste from the clipboard using given data -- pops up a menu to determine what specifically to do
func (*SliceView) RowFirstWidget ¶
func (sv *SliceView) 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 (*SliceView) RowFromPos ¶
RowFromPos returns the row that contains given vertical position, false if not found
func (*SliceView) RowGrabFocus ¶
func (sv *SliceView) 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 (*SliceView) RowIsSelected ¶
RowIsSelected returns the selected status of given row index
func (*SliceView) RowPos ¶
RowPos returns center of window position of index label for row (ContextMenuPos)
func (*SliceView) RowWidgetNs ¶
RowWidgetNs returns number of widgets per row and offset for index label
func (*SliceView) RowsFromMimeData ¶
RowsFromMimeData creates a slice of structs from mime data
func (*SliceView) SaveDraggedRows ¶
SaveDraggedRows saves selectedrows into dragged rows taking into account insertion at rows
func (*SliceView) ScrollToRow ¶
ScrollToRow ensures that given row is visible by scrolling layout as needed -- returns true if any scrolling was performed
func (*SliceView) SelectAllRows ¶
func (sv *SliceView) SelectAllRows()
SelectAllRows selects all rows
func (*SliceView) SelectRow ¶
SelectRow selects given row (if not already selected) -- updates select status of index label
func (*SliceView) SelectRowAction ¶
func (sv *SliceView) SelectRowAction(row int, mode mouse.SelectModes)
SelectRowAction 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 (*SliceView) SelectRowWidgets ¶
SelectRowWidgets sets the selection state of given row of widgets
func (*SliceView) SelectVal ¶
SelectVal sets SelVal and attempts to find corresponding row, setting SelectedIdx and selecting row if found -- returns true if found, false otherwise.
func (*SliceView) SelectedRowsList ¶
SelectedRowsList returns list of selected rows, sorted either ascending or descending
func (*SliceView) SetChanged ¶
func (sv *SliceView) 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 (*SliceView) SetSlice ¶
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*SliceView) SliceDeleteAt ¶
SliceDeleteAt deletes element at given index from slice
func (*SliceView) SliceGrid ¶
SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values, and its index, within frame -- nil, -1 if not found
func (*SliceView) SliceNewAt ¶
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*SliceView) SliceViewEvents ¶
func (sv *SliceView) SliceViewEvents()
func (*SliceView) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*SliceView) StdFrameConfig ¶
func (sv *SliceView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*SliceView) UnselectAllRows ¶
func (sv *SliceView) UnselectAllRows()
UnselectAllRows unselects all selected rows
func (*SliceView) UnselectRow ¶
UnselectRow unselects given row (if selected)
func (*SliceView) UnselectRowAction ¶
UnselectRowAction unselects this row (if selected) -- and emits a signal
func (*SliceView) UpdateFromSlice ¶
func (sv *SliceView) UpdateFromSlice()
UpdateFromSlice performs overall configuration for given slice
func (*SliceView) UpdateSelect ¶
UpdateSelect updates the selection for the given index -- callback from widgetsig select
func (*SliceView) UpdateValues ¶
func (sv *SliceView) UpdateValues()
UpdateValues updates the widget display of slice values, assuming same slice config
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 */ }
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) 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{}, tmpSave ValueView)
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*SliceViewInline) SliceNewAt ¶
func (sv *SliceViewInline) SliceNewAt(idx int, reconfig bool)
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*SliceViewInline) Style2D ¶
func (sv *SliceViewInline) Style2D()
func (*SliceViewInline) UpdateFromSlice ¶
func (sv *SliceViewInline) UpdateFromSlice()
func (*SliceViewInline) UpdateValues ¶
func (sv *SliceViewInline) UpdateValues()
type SliceViewSignals ¶
type SliceViewSignals int64
SliceViewSignals are signals that sliceview can send, mostly for editing mode. Selection events are sent on WidgetSig WidgetSelected signals in both modes.
const ( // SliceViewDoubleClicked emitted during inactive mode when item // double-clicked -- can be used for accepting dialog. SliceViewDoubleClicked SliceViewSignals = iota SliceViewSignalsN )
func (*SliceViewSignals) FromString ¶
func (i *SliceViewSignals) FromString(s string) error
func (SliceViewSignals) String ¶
func (i SliceViewSignals) String() string
type SliceViewStyleFunc ¶
type SliceViewStyleFunc func(sv *SliceView, slice interface{}, widg gi.Node2D, row int, vv ValueView)
SliceViewStyleFunc is a styling function for custom styling / configuration of elements in the view
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 */ ToolbarStru interface{} `desc:"the struct that we successfully set a toolbar for"` }
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 PrefsDbgView ¶
func PrefsDbgView(pf *gi.PrefsDebug) (*StructView, *gi.Window)
PrefsDbgView opens a view of user debugging preferences
func PrefsDetView ¶
func PrefsDetView(pf *gi.PrefsDetailed) (*StructView, *gi.Window)
PrefsDetView opens a view of user detailed preferences
func PrefsView ¶
func PrefsView(pf *gi.Preferences) (*StructView, *gi.Window)
PrefsView opens a view of user preferences
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) Render2D ¶
func (sv *StructView) Render2D()
func (*StructView) SetStruct ¶
func (sv *StructView) SetStruct(st interface{}, tmpSave ValueView)
SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct
func (*StructView) StdConfig ¶
func (sv *StructView) StdConfig() (mods, updt bool)
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*StructView) StdFrameConfig ¶
func (sv *StructView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*StructView) StructGrid ¶
func (sv *StructView) StructGrid() (*gi.Frame, int)
StructGrid returns the grid layout widget, which contains all the fields and values, and its index, within frame -- nil, -1 if not found
func (*StructView) Style2D ¶
func (sv *StructView) Style2D()
func (*StructView) ToolBar ¶
func (sv *StructView) ToolBar() *gi.ToolBar
ToolBar returns the toolbar widget
func (*StructView) UpdateFields ¶
func (sv *StructView) UpdateFields()
UpdateFields updates each of the value-view widgets for the fields -- called by the ViewSig update
func (*StructView) UpdateFromStruct ¶
func (sv *StructView) UpdateFromStruct()
UpdateFromStruct updates full widget layout from structure
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 `` /* 179-byte string literal not displayed */ }
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) Render2D ¶
func (sv *StructViewInline) Render2D()
func (*StructViewInline) SetStruct ¶
func (sv *StructViewInline) SetStruct(st interface{}, tmpSave ValueView)
SetStruct sets the source struct that we are viewing -- rebuilds the children to represent this struct
func (*StructViewInline) UpdateFields ¶
func (sv *StructViewInline) UpdateFields()
func (*StructViewInline) UpdateFromStruct ¶
func (sv *StructViewInline) UpdateFromStruct()
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 { gi.Frame Slice interface{} `view:"-" json:"-" xml:"-" desc:"the slice that we are a view onto -- must be a pointer to that slice"` SliceValView ValueView `desc:"ValueView for the slice itself, if this was created within value view framework -- otherwise nil"` StyleFunc TableViewStyleFunc `view:"-" json:"-" xml:"-" desc:"optional styling function"` ShowViewCtxtMenu bool `` /* 133-byte string literal not displayed */ Changed bool `desc:"has the table been edited?"` Values [][]ValueView `` /* 199-byte string literal not displayed */ ShowIndex bool `xml:"index" desc:"whether to show index or not (default true) -- updated from 'index' property (bool)"` VisRows int `desc:"number of rows visible in display"` SelField string `view:"-" json:"-" xml:"-" desc:"current selection field -- initially select value in this field"` SelVal interface{} `view:"-" json:"-" xml:"-" desc:"current selection value -- initially select this value in SelField"` SelectedIdx int `` /* 148-byte string literal not displayed */ SortIdx int `desc:"current sort index"` SortDesc bool `desc:"whether current sort order is descending"` SelectMode bool `desc:"editing-mode select rows mode"` SelectedRows map[int]bool `desc:"list of currently-selected rows"` DraggedRows []int `desc:"list of currently-dragged rows"` TableViewSig ki.Signal `json:"-" xml:"-" desc:"table view interactive editing signals"` ViewSig ki.Signal `` /* 179-byte string literal not displayed */ TmpSave ValueView `` /* 189-byte string literal not displayed */ BuiltSlice interface{} `view:"-" json:"-" xml:"-" desc:"the built slice"` BuiltSize int ToolbarSlice interface{} `desc:"the slice that we successfully set a toolbar for"` StruType reflect.Type NVisFields int VisFields []reflect.StructField `view:"-" json:"-" xml:"-" desc:"the visible fields"` // contains filtered or unexported 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 (*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 ¶
ConfigSliceGrid configures the SliceGrid for the current slice
func (*TableView) ConfigSliceGridRows ¶
func (tv *TableView) ConfigSliceGridRows()
ConfigSliceGridRows configures the SliceGrid rows for the current slice -- assumes .Kids is created at the right size -- only call this for a direct re-render e.g., after sorting
func (*TableView) ConfigToolbar ¶
func (tv *TableView) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*TableView) ConnectEvents2D ¶
func (tv *TableView) ConnectEvents2D()
func (*TableView) Copy ¶
Copy copies selected rows to clip.Board, optionally resetting the selection satisfies gi.Clipper interface and can be overridden by subtypes
func (*TableView) CopyRows ¶
CopyRows copies selected rows to clip.Board, optionally resetting the selection
func (*TableView) Cut ¶
func (tv *TableView) Cut()
Cut copies selected rows to clip.Board and deletes selected rows satisfies gi.Clipper interface and can be overridden by subtypes
func (*TableView) CutRows ¶
func (tv *TableView) CutRows()
CutRows copies selected rows to clip.Board and deletes selected rows
func (*TableView) DeleteRows ¶
func (tv *TableView) DeleteRows()
DeleteRows deletes all selected rows
func (*TableView) 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 -- ends up calling DragNDropSource if us..
func (*TableView) DragNDropSource ¶
DragNDropSource is called after target accepts the drop -- we just remove elements that were moved
func (*TableView) DragNDropStart ¶
func (tv *TableView) DragNDropStart()
DragNDropStart starts a drag-n-drop
func (*TableView) DragNDropTarget ¶
DragNDropTarget handles a drag-n-drop drop
func (*TableView) Drop ¶
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 (*TableView) DropAssign ¶
DropAssign assigns mime data (only the first one!) to this node
func (*TableView) DropBefore ¶
DropBefore inserts object(s) from mime data before this node
func (*TableView) DropCancel ¶
func (tv *TableView) DropCancel()
DropCancel cancels the drop action e.g., preventing deleting of source items in a Move case
func (*TableView) Duplicate ¶
Duplicate copies selected items and inserts them after current selection -- return row of start of duplicates if successful, else -1
func (*TableView) HasFocus2D ¶
func (*TableView) ItemCtxtMenu ¶
func (*TableView) KeyInputActive ¶
func (tv *TableView) KeyInputActive(kt *key.ChordEvent)
func (*TableView) KeyInputInactive ¶
func (tv *TableView) KeyInputInactive(kt *key.ChordEvent)
func (*TableView) MakeDropMenu ¶
MakeDropMenu makes the menu of options for dropping on a target
func (*TableView) MakePasteMenu ¶
MakePasteMenu makes the menu of options for paste events
func (*TableView) MimeDataRow ¶
MimeDataRow adds mimedata for given row: an application/json of the struct
func (*TableView) MoveDown ¶
func (tv *TableView) 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 (*TableView) MoveDownAction ¶
func (tv *TableView) 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 (*TableView) MovePageDown ¶
func (tv *TableView) MovePageDown(selMode mouse.SelectModes) int
MovePageDown moves the selection down to next page, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*TableView) MovePageDownAction ¶
func (tv *TableView) 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 row
func (*TableView) MovePageUp ¶
func (tv *TableView) MovePageUp(selMode mouse.SelectModes) int
MovePageUp moves the selection up to previous page, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*TableView) MovePageUpAction ¶
func (tv *TableView) 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 row
func (*TableView) MoveUp ¶
func (tv *TableView) MoveUp(selMode mouse.SelectModes) int
MoveUp moves the selection up to previous row, using given select mode (from keyboard modifiers) -- returns newly selected row or -1 if failed
func (*TableView) MoveUpAction ¶
func (tv *TableView) MoveUpAction(selMode mouse.SelectModes) int
MoveUpAction moves the selection up to previous row, using given select mode (from keyboard modifiers) -- and emits select event for newly selected row
func (*TableView) Paste ¶
func (tv *TableView) Paste()
Paste pastes clipboard at given row satisfies gi.Clipper interface and can be overridden by subtypes
func (*TableView) PasteAssign ¶
PasteAssign assigns mime data (only the first one!) to this row
func (*TableView) PasteAtRow ¶
PasteAtRow inserts object(s) from mime data at (before) given row
func (*TableView) PasteMenu ¶
PasteMenu performs a paste from the clipboard using given data -- pops up a menu to determine what specifically to do
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) RowFirstWidget ¶
func (tv *TableView) 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 (*TableView) RowFromPos ¶
RowFromPos returns the row that contains given vertical position, false if not found
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) RowIsSelected ¶
RowIsSelected returns the selected status of given row index
func (*TableView) RowPos ¶
RowPos returns center of window position of index label for row (ContextMenuPos)
func (*TableView) RowWidgetNs ¶
RowWidgetNs returns number of widgets per row and offset for index label
func (*TableView) RowsFromMimeData ¶
RowsFromMimeData creates a slice of structs from mime data
func (*TableView) SaveDraggedRows ¶
SaveDraggedRows saves selectedrows into dragged rows taking into account insertion at rows
func (*TableView) ScrollToRow ¶
ScrollToRow ensures that given row is visible by scrolling layout as needed -- returns true if any scrolling was performed
func (*TableView) SelectAllRows ¶
func (tv *TableView) SelectAllRows()
SelectAllRows selects all rows
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) SelectRow ¶
SelectRow selects given row (if not already selected) -- updates select status of index label
func (*TableView) SelectRowAction ¶
func (tv *TableView) SelectRowAction(row int, mode mouse.SelectModes)
SelectRowAction 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 (*TableView) SelectRowWidgets ¶
SelectRowWidgets sets the selection state of given row of widgets
func (*TableView) SelectedRowsList ¶
SelectedRowsList returns list of selected rows, sorted either ascending or descending
func (*TableView) SetChanged ¶
func (tv *TableView) SetChanged()
SetChanged sets the Changed flag and emits the ViewSig signal for the TableView, 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 (*TableView) SetSlice ¶
SetSlice sets the source slice that we are viewing -- rebuilds the children to represent this slice
func (*TableView) SetSortFieldName ¶
SetSortField sets sorting to happen on given field and direction -- see SortFieldName for details
func (*TableView) SliceDelete ¶
SliceDelete deletes element at given index from slice -- reconfig means call ConfigSliceGrid to update display
func (*TableView) SliceFrame ¶
SliceFrame returns the outer frame widget, which contains all the header, fields and values, and its index, within frame -- nil, -1 if not found
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 -- reconfig means call ConfigSliceGrid to update display
func (*TableView) SortFieldName ¶
SortFieldName returns the name of the field being sorted, along with :up or :down depending on descending
func (*TableView) SortSliceAction ¶
SortSliceAction sorts the slice for given field index -- toggles ascending vs. descending if already sorting on this dimension
func (*TableView) StdConfig ¶
StdConfig configures a standard setup of the overall Frame -- returns mods, updt from ConfigChildren and does NOT call UpdateEnd
func (*TableView) StdFrameConfig ¶
func (tv *TableView) StdFrameConfig() kit.TypeAndNameList
StdFrameConfig returns a TypeAndNameList for configuring a standard Frame -- can modify as desired before calling ConfigChildren on Frame using this
func (*TableView) StdSliceFrameConfig ¶
func (tv *TableView) StdSliceFrameConfig() kit.TypeAndNameList
StdSliceFrameConfig returns a TypeAndNameList for configuring the slice-frame
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) TableViewEvents ¶
func (tv *TableView) TableViewEvents()
func (*TableView) UnselectAllRows ¶
func (tv *TableView) UnselectAllRows()
UnselectAllRows unselects all selected rows
func (*TableView) UnselectRow ¶
UnselectRow unselects given row (if selected)
func (*TableView) UnselectRowAction ¶
UnselectRowAction unselects this row (if selected) -- and emits a signal
func (*TableView) UpdateFromSlice ¶
func (tv *TableView) UpdateFromSlice()
UpdateFromSlice does full update from current slice
func (*TableView) UpdateSelect ¶
UpdateSelect updates the selection for the given index -- callback from widgetsig select
func (*TableView) UpdateValues ¶
func (tv *TableView) UpdateValues()
UpdateValues just updates rendered values
type TableViewSignals ¶
type TableViewSignals int64
TableViewSignals are signals that tableview can send, mostly for editing mode. Selection events are sent on WidgetSig WidgetSelected signals in both modes.
const ( // TableViewDoubleClicked emitted during inactive mode when item // double-clicked -- can be used for accepting dialog. TableViewDoubleClicked TableViewSignals = iota TableViewSignalsN )
func (*TableViewSignals) FromString ¶
func (i *TableViewSignals) FromString(s string) error
func (TableViewSignals) String ¶
func (i TableViewSignals) String() string
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
type TextBuf ¶
type TextBuf struct { ki.Node Txt []byte `json:"-" xml:"text" desc:"the current value of the entire text being edited -- using []byte slice for greater efficiency"` Autosave bool `desc:"if true, auto-save file after changes (in a separate routine)"` Opts TextBufOpts `desc:"options for how text editing / viewing works"` Filename gi.FileName `json:"-" xml:"-" desc:"filename of file last loaded or saved"` Info FileInfo `desc:"full info about file"` PiState pi.FileState `desc:"Pi parsing state info for file"` Hi HiMarkup `desc:"syntax highlighting markup parameters (language, style, etc)"` NLines int `json:"-" xml:"-" desc:"number of lines"` Lines [][]rune `` /* 258-byte string literal not displayed */ LineBytes [][]byte `` /* 267-byte string literal not displayed */ Tags []lex.Line `json:"extra custom tagged regions for each line"` HiTags []lex.Line `json:"syntax highlighting tags -- auto-generated"` Markup [][]byte `` /* 162-byte string literal not displayed */ ByteOffs []int `` /* 241-byte string literal not displayed */ TotalBytes int `json:"-" xml:"-" desc:"total bytes in document -- see ByteOffs for when it is updated"` LinesMu sync.RWMutex `json:"-" xml:"-" desc:"mutex for updating lines"` MarkupMu sync.RWMutex `json:"-" xml:"-" desc:"mutex for updating markup"` TextBufSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for buffer -- see TextBufSignals for the types"` Views []*TextView `json:"-" xml:"-" desc:"the TextViews that are currently viewing this buffer"` Undos []*TextBufEdit `json:"-" xml:"-" desc:"undo stack of edits"` UndoUndos []*TextBufEdit `json:"-" xml:"-" desc:"undo stack of *undo* edits -- added to "` UndoPos int `json:"-" xml:"-" desc:"undo position"` PosHistory []TextPos `json:"-" xml:"-" desc:"history of cursor positions -- can move back through them"` Complete *gi.Complete `json:"-" xml:"-" desc:"functions and data for text completion"` SpellCorrect *gi.SpellCorrect `json:"-" xml:"-" desc:"functions and data for spelling correction"` CurView *TextView `` /* 177-byte string literal not displayed */ }
TextBuf is a buffer of text, which can be viewed by TextView(s). It holds the raw text lines (in original string and rune formats, and marked-up from syntax highlighting), and sends signals for making edits to the text and coordinating those edits across multiple views. Views always only view a single buffer, so they directly call methods on the buffer to drive updates, which are then broadcast. It also has methods for loading and saving buffers to files. Unlike GUI Widgets, its methods are generally signaling, without an explicit Action suffix. Internally, the buffer represents new lines using \n = LF, but saving and loading can deal with Windows/DOS CRLF format.
func NewTextBuf ¶
func NewTextBuf() *TextBuf
func (*TextBuf) AddTagEdit ¶
func (tb *TextBuf) AddTagEdit(tbe *TextBufEdit, tag token.Tokens)
AddTagEdit adds a new custom tag for given line, using TextBufEdit for location
func (*TextBuf) AddView ¶
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 ¶
func (tb *TextBuf) AdjustReg(reg TextRegion) TextRegion
AdjustReg adjusts given text region for any edits that have taken place since time stamp on region (using the Undo stack) If region was wholly within a deleted region, then TextRegionNil will be returned -- otherwise it is clipped appropriately as function of deletes.
func (*TextBuf) AdjustedTags ¶
AdjustedTags updates tag positions for edits
func (*TextBuf) AppendText ¶
func (tb *TextBuf) AppendText(text []byte, saveUndo, signal bool) *TextBufEdit
AppendText appends new text to end of buffer, using insert, returns edit
func (*TextBuf) AppendTextLine ¶
func (tb *TextBuf) AppendTextLine(text []byte, saveUndo, signal bool) *TextBufEdit
AppendTextLine appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. Returns the edit region.
func (*TextBuf) AppendTextLineMarkup ¶
func (tb *TextBuf) AppendTextLineMarkup(text []byte, markup []byte, saveUndo, signal bool) *TextBufEdit
AppendTextLineMarkup appends one line of new text to end of buffer, using insert, and appending a LF at the end of the line if it doesn't already have one. user-supplied markup is used. Returns the edit region.
func (*TextBuf) AppendTextMarkup ¶
func (tb *TextBuf) AppendTextMarkup(text []byte, markup []byte, saveUndo, signal bool) *TextBufEdit
AppendTextMarkup appends new text to end of buffer, using insert, returns edit, and uses supplied markup to render it
func (*TextBuf) AutoIndent ¶
func (tb *TextBuf) AutoIndent(ln int, indents, unindents []string) (tbe *TextBufEdit, indLev, chPos int)
AutoIndent indents given line to the level of the prior line, adjusted appropriately if the current line starts with one of the given un-indent strings, or the prior line ends with one of the given indent strings. Will have to be replaced with a smarter parsing-based mechanism for indent / unindent but this will do for now. Returns any edit that took place (could be nil), along with the auto-indented level and character position for the indent of the current line.
func (*TextBuf) AutoIndentRegion ¶
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) 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 ¶
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) DeleteText ¶
func (tb *TextBuf) DeleteText(st, ed TextPos, saveUndo, signal bool) *TextBufEdit
DeleteText deletes region of text between start and end positions, signaling views after text lines have been updated. Sets the timestamp on resulting TextBufEdit to now
func (*TextBuf) DeleteView ¶
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) EditDone ¶
func (tb *TextBuf) EditDone()
EditDone finalizes any current editing, sends signal
func (*TextBuf) EmacsUndoSave ¶
func (tb *TextBuf) EmacsUndoSave()
EmacsUndoSave if EmacsUndo mode is active, saves the UndoUndos to the regular Undo stack at the end, and moves undo to the very end -- undo is a constant stream..
func (*TextBuf) 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) FindScopeMatch ¶ added in v0.9.4
FindScopeMatch finds the brace or parenthesis that is the partner of the one passed to function
func (*TextBuf) InComment ¶ added in v0.9.4
InComment returns true if the given text position is within a commented region
func (*TextBuf) IndentLine ¶
func (tb *TextBuf) IndentLine(ln, n int) *TextBufEdit
IndentLine indents line by given number of tab stops, using tabs or spaces, for given tab size (if using spaces) -- either inserts or deletes to reach target
func (*TextBuf) InsertText ¶
func (tb *TextBuf) InsertText(st TextPos, text []byte, saveUndo, signal bool) *TextBufEdit
Insert inserts new text at given starting position, signaling views after text has been inserted. Sets the timestamp on resulting TextBufEdit to now
func (*TextBuf) IsChanged ¶
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) IsSpellCorrectEnabled ¶ added in v0.9.4
IsSpellCorrectEnabled returns true if spelling correction is enabled, taking into account given position in text if it is relevant for cases where it is only conditionally enabled
func (*TextBuf) IsValidLine ¶
IsValidLine returns true if given line is in range
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) LineIndent ¶
LineIndent returns the number of tabs or spaces at start of given line -- if line starts with tabs, then those are counted, else spaces -- combinations of tabs and spaces won't produce sensible results
func (*TextBuf) LineLen ¶
LineLen is the concurrent-safe accessor to length of specific Line of Lines runes
func (*TextBuf) LinesDeleted ¶
func (tb *TextBuf) LinesDeleted(tbe *TextBufEdit)
LinesDeleted deletes lines in Markup corresponding to lines deleted in Lines text. Locks and unlocks the Markup mutex.
func (*TextBuf) LinesEdited ¶
func (tb *TextBuf) LinesEdited(tbe *TextBufEdit)
LinesEdited re-marks-up lines in edit (typically only 1). Locks and unlocks the Markup mutex.
func (*TextBuf) LinesInserted ¶
func (tb *TextBuf) LinesInserted(tbe *TextBufEdit)
LinesInserted inserts new lines in Markup corresponding to lines inserted in Lines text. Locks and unlocks the Markup mutex
func (*TextBuf) LinesToBytes ¶
func (tb *TextBuf) LinesToBytes()
LinesToBytes converts current Lines back to the Txt slice of bytes.
func (*TextBuf) LinesToBytesCopy ¶
LinesToBytesCopy converts current Lines into a separate text byte copy -- e.g., for autosave or other "offline" uses of the text -- doesn't affect byte offsets etc
func (*TextBuf) MarkupAllLines ¶
func (tb *TextBuf) MarkupAllLines()
MarkupAllLines does syntax highlighting markup for all lines in buffer, calling MarkupMu mutex when setting the marked-up lines with the result -- designed to be called in a separate goroutine
func (*TextBuf) MarkupFromTags ¶ added in v0.9.4
func (tb *TextBuf) MarkupFromTags()
MarkupFromTags does syntax highlighting markup using existing HiTags without running new tagging -- for special case where tagging is under external control
func (*TextBuf) MarkupLines ¶
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) 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) PrevLineIndent ¶
PrevLineIndent returns previous line from given line that has indentation -- skips blank lines
func (*TextBuf) ReMarkup ¶
func (tb *TextBuf) ReMarkup()
ReMarkup runs re-markup on text in background
func (*TextBuf) Redo ¶
func (tb *TextBuf) Redo() *TextBufEdit
Redo redoes next item on the undo stack, and returns that record, nil if no more
func (*TextBuf) RefreshViews ¶
func (tb *TextBuf) RefreshViews()
RefreshViews does a refresh draw on all views
func (*TextBuf) Region ¶
func (tb *TextBuf) Region(st, ed TextPos) *TextBufEdit
Region returns a TextBufEdit representation of text between start and end positions returns nil if not a valid region. sets the timestamp on the TextBufEdit to now
func (*TextBuf) RemoveTag ¶
RemoveTag removes tag (optionally only given tag if non-zero) at given position if it exists -- returns tag
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) SaveUndo ¶
func (tb *TextBuf) SaveUndo(tbe *TextBufEdit)
SaveUndo saves given edit to undo stack
func (*TextBuf) Search ¶
func (tb *TextBuf) Search(find []byte, ignoreCase bool) (int, []FileSearchMatch)
Search looks for a string (no regexp) within buffer, with given case-sensitivity returning number of occurrences and specific match position list. column positions are in runes
func (*TextBuf) SetByteOffs ¶
func (tb *TextBuf) SetByteOffs()
SetByteOffs sets the byte offsets for each line into the raw text
func (*TextBuf) SetCompleter ¶
func (tb *TextBuf) SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc)
SetCompleter sets completion functions so that completions will automatically be offered as the user types
func (*TextBuf) SetHiStyle ¶
SetHiStyle sets the highlighting style -- needs to be protected by mutex
func (*TextBuf) SetSpellCorrect ¶
SetSpellCorrect sets spell correct functions so that spell correct will automatically be offered as the user types
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) Undo ¶
func (tb *TextBuf) Undo() *TextBufEdit
Undo undoes next item on the undo stack, and returns that record -- nil if no more
func (*TextBuf) ViewportFromView ¶
func (tb *TextBuf) ViewportFromView() *gi.Viewport2D
ViewportFromView returns Viewport from textview, if avail
type TextBufEdit ¶
type TextBufEdit struct { Reg TextRegion `` /* 198-byte string literal not displayed */ Delete bool `desc:"action is either a deletion or an insertion"` Text [][]rune `desc:"text to be inserted"` }
TextBufEdit describes an edit action to a buffer -- this is the data passed via signals to viewers of the buffer. Actions are only deletions and insertions (a change is a sequence of those, given normal editing processes). The TextBuf always reflects the current state *after* the edit.
func (*TextBufEdit) AdjustPos ¶
func (te *TextBufEdit) AdjustPos(pos TextPos, del AdjustPosDel) TextPos
AdjustPos adjusts the given text position as a function of the edit. if the position was within a deleted region of text, del determines what is returned
func (*TextBufEdit) AdjustPosIfAfterTime ¶
func (te *TextBufEdit) AdjustPosIfAfterTime(pos TextPos, t time.Time, del AdjustPosDel) TextPos
AdjustPosIfAfterTime checks the time stamp and IfAfterTime, it adjusts the given text position as a function of the edit del determines what to do with positions within a deleted region either move to start or end of the region, or return an error.
func (*TextBufEdit) AdjustReg ¶
func (te *TextBufEdit) AdjustReg(reg TextRegion) TextRegion
AdjustReg adjusts the given text region as a function of the edit, including checking that the timestamp on the region is after the edit time, if the region has a valid Time stamp (otherwise always does adjustment). If the starting position is within a deleted region, it is moved to the end of the deleted region, and if the ending position was within a deleted region, it is moved to the start. If the region becomes empty, TextRegionNil will be returned.
func (*TextBufEdit) ToBytes ¶
func (te *TextBufEdit) ToBytes() []byte
ToBytes returns the Text of this edit record to a byte string, with newlines at end of each line -- nil if Text is empty
type 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 TextBufOpts ¶
type TextBufOpts struct { SpaceIndent bool `` /* 127-byte string literal not displayed */ TabSize int `desc:"size of a tab, in chars -- also determines indent level for space indent"` AutoIndent bool `desc:"auto-indent on newline (enter) or tab"` LineNos bool `desc:"show line numbers at left end of editor"` Completion bool `desc:"use the completion system to suggest options while typing"` SpellCorrect bool `desc:"use spell checking to suggest corrections while typing"` EmacsUndo bool `` /* 165-byte string literal not displayed */ DepthColor bool `desc:"colorize the background according to nesting depth"` CommentLn string `desc:"character(s) that start a single-line comment -- if empty then multi-line comment syntax will be used"` CommentSt string `desc:"character(s) that start a multi-line comment or one that requires both start and end"` CommentEd string `desc:"character(s) that end a multi-line comment or one that requires both start and end"` }
TextBufOpts contains options for TextBufs -- contains everything necessary to conditionalize editing of a given text file
func (*TextBufOpts) CommentStrs ¶ added in v0.9.4
func (tb *TextBufOpts) CommentStrs() (comst, comed string)
CommentStrs returns the comment start and end strings, using line-based CommentLn first if set and falling back on multi-line / general purpose start / end syntax
func (*TextBufOpts) ConfigSupported ¶ added in v0.9.4
func (tb *TextBufOpts) ConfigSupported(sup filecat.Supported) bool
ConfigSupported configures options based on the supported language info in GoPi returns true if supported
func (*TextBufOpts) IndentChar ¶ added in v0.9.4
func (tb *TextBufOpts) IndentChar() indent.Char
IndentChar returns the indent character based on SpaceIndent option
type TextBufSignals ¶
type TextBufSignals int64
TextBufSignals are signals that text buffer can send
const ( // TextBufDone means that editing was completed and applied to Txt field // -- data is Txt bytes TextBufDone TextBufSignals = iota // TextBufNew signals that entirely new text is present -- all views // update -- data is Txt bytes. TextBufNew // TextBufInsert signals that some text was inserted -- data is // TextBufEdit describing change -- the TextBuf always reflects the // current state *after* the edit. TextBufInsert // TextBufDelete signals that some text was deleted -- data is // TextBufEdit describing change -- the TextBuf always reflects the // current state *after* the edit. TextBufDelete // TextBufMarkUpdt signals that the Markup text has been updated -- this // signal is typically sent from a separate goroutine so should be used // with a mutex TextBufMarkUpdt TextBufSignalsN )
func (*TextBufSignals) FromString ¶
func (i *TextBufSignals) FromString(s string) error
func (TextBufSignals) String ¶
func (i TextBufSignals) String() string
type TextDiffs ¶
TextDiffs are raw differences between text, in terms of lines, reporting a sequence of operations that would convert one buffer (a) into the other buffer (b). Each operation is either an 'r' (replace), 'd' (delete), 'i' (insert) or 'e' (equal).
type TextPos ¶
type TextPos struct {
Ln, Ch int
}
TextPos represents line, character positions within the TextBuf and TextView the Ch character position is in *runes* not bytes!
func (*TextPos) FromString ¶
FromString decodes text position from a string representation of form: [#]LxxCxx -- used in e.g., URL links -- returns true if successful
type TextRegion ¶
type TextRegion struct { Start TextPos End TextPos Time nptime.Time `` /* 131-byte string literal not displayed */ }
TextRegion represents a text region as a start / end position, and includes a Time stamp for when the region was created as valid positions into the TextBuf. The character end position is an *exclusive* position (i.e., the region ends at the character just prior to that character) but the lines are always *inclusive* (i.e., it is the actual line, not the next line).
var TextRegionNil TextRegion
TextRegionNil is the empty (zero) text region -- all zeros
func NewTextRegion ¶
func NewTextRegion(stLn, stCh, edLn, edCh int) TextRegion
NewTextRegion creates a new text region using separate line and char values for start and end, and also sets the time stamp to now
func NewTextRegionLen ¶
func NewTextRegionLen(start TextPos, len int) TextRegion
NewTextRegionLen makes a new TextRegion from a starting point and a length along same line
func NewTextRegionPos ¶
func NewTextRegionPos(st, ed TextPos) TextRegion
NewTextRegionPos creates a new text region using position values and also sets the time stamp to now
func (*TextRegion) FromString ¶
func (tr *TextRegion) FromString(link string) bool
FromString decodes text region from a string representation of form: [#]LxxCxx-LxxCxx -- used in e.g., URL links -- returns true if successful
func (*TextRegion) IsAfterTime ¶
func (tr *TextRegion) IsAfterTime(t time.Time) bool
IsAfterTime reports if this region's time stamp is after given time value if region Time stamp has not been set, it always returns true
func (*TextRegion) IsNil ¶
func (tr *TextRegion) IsNil() bool
IsNil checks if the region is empty, because the start is after or equal to the end
func (*TextRegion) TimeNow ¶
func (tr *TextRegion) TimeNow()
TimeNow grabs the current time as the edit time
type TextView ¶
type TextView struct { gi.WidgetBase Buf *TextBuf `json:"-" xml:"-" desc:"the text buffer that we're editing"` Placeholder string `json:"-" xml:"placeholder" desc:"text that is displayed when the field is empty, in a lower-contrast manner"` CursorWidth units.Value `xml:"cursor-width" desc:"width of cursor -- set from cursor-width property (inherited)"` LineIcons map[int]gi.IconName `desc:"icons for each line -- use SetLineIcon and DeleteLineIcon"` NLines int `` /* 135-byte string literal not displayed */ Renders []gi.TextRender `` /* 160-byte string literal not displayed */ Offs []float32 `json:"-" xml:"-" desc:"starting offsets for top of each line"` LineNoDigs int `json:"-" xml:"-" desc:"number of line number digits needed"` LineNoOff float32 `json:"-" xml:"-" desc:"horizontal offset for start of text after line numbers"` LineNoRender gi.TextRender `json:"-" xml:"-" desc:"render for line numbers"` LinesSize image.Point `json:"-" xml:"-" desc:"total size of all lines as rendered"` RenderSz gi.Vec2D `json:"-" xml:"-" desc:"size params to use in render call"` CursorPos TextPos `json:"-" xml:"-" desc:"current cursor position"` CursorCol int `` /* 179-byte string literal not displayed */ CorrectPos TextPos `` /* 153-byte string literal not displayed */ PosHistIdx int `json:"-" xml:"-" desc:"current index within PosHistory"` SelectStart TextPos `` /* 141-byte string literal not displayed */ SelectReg TextRegion `json:"-" xml:"-" desc:"current selection region"` PrevSelectReg TextRegion `json:"-" xml:"-" desc:"previous selection region, that was actually rendered -- needed to update render"` Highlights []TextRegion `json:"-" xml:"-" desc:"highlighted regions, e.g., for search results"` Scopelights []TextRegion `json:"-" xml:"-" desc:"highlighted regions, specific to scope markers"` SelectMode bool `json:"-" xml:"-" desc:"if true, select text as cursor moves"` ForceComplete bool `json:"-" xml:"-" desc:"if true, complete regardless of any disqualifying reasons"` ISearch ISearch `json:"-" xml:"-" desc:"interactive search data"` QReplace QReplace `json:"-" xml:"-" desc:"query replace data"` TextViewSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for text view -- see TextViewSignals for the types"` LinkSig ki.Signal `` /* 167-byte string literal not displayed */ StateStyles [TextViewStatesN]gi.Style `json:"-" xml:"-" desc:"normal style and focus style"` FontHeight float32 `json:"-" xml:"-" desc:"font height, cached during styling"` LineHeight float32 `json:"-" xml:"-" desc:"line height, cached during styling"` VisSize image.Point `json:"-" xml:"-" desc:"height in lines and width in chars of the visible area"` BlinkOn bool `json:"-" xml:"-" desc:"oscillates between on and off for blinking"` CursorMu sync.Mutex `json:"-" xml:"-" view:"-" desc:"mutex protecting cursor rendering -- shared between blink and main code"` HasLinks bool `json:"-" xml:"-" desc:"at least one of the renders has links -- determines if we set the cursor for hand movements"` // contains filtered or unexported fields }
TextView is a widget for editing multiple lines of text (as compared to TextField for a single line). The View is driven by a TextBuf buffer which contains all the text, and manages all the edits, sending update signals out to the views -- multiple views can be attached to a given buffer. All updating in the TextView should be within a single goroutine -- it would require extensive protections throughout code otherwise.
var BlinkingTextView *TextView
BlinkingTextView is the text field that is blinking
func (*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 ¶
func (tv *TextView) Copy(reset bool) *TextBufEdit
Copy copies any selected text to the clipboard, and returns that text, optionally resetting the current selection
func (*TextView) CursorBBox ¶
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 ¶
func (tv *TextView) CursorSprite() *gi.Viewport2D
CursorSprite returns the sprite Viewport2D that holds the cursor (which is only rendered once with a vertical bar, and just activated and inactivated depending on render status)
func (*TextView) CursorStartDoc ¶
func (tv *TextView) CursorStartDoc()
CursorStartDoc moves the cursor to the start of the text, updating selection if select mode is active
func (*TextView) CursorStartLine ¶
func (tv *TextView) CursorStartLine()
CursorStartLine moves the cursor to the start of the line, updating selection if select mode is active
func (*TextView) CursorToHistNext ¶
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) Cut ¶
func (tv *TextView) Cut() *TextBufEdit
Cut cuts any selected text and adds it to the clipboard, also returns cut text
func (*TextView) DeleteSelection ¶
func (tv *TextView) DeleteSelection() *TextBufEdit
DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted as TextBufEdit (nil if none)
func (*TextView) EditDone ¶
func (tv *TextView) EditDone()
EditDone completes editing and copies the active edited text to the text -- called when the return key is pressed or goes out of focus
func (*TextView) EscPressed ¶
func (tv *TextView) EscPressed()
EscPressed emitted for KeyFunAbort or KeyFunCancelSelect -- effect depends on state..
func (*TextView) FindMatches ¶
func (tv *TextView) FindMatches(find string, useCase bool) ([]FileSearchMatch, bool)
FindMatches finds the matches with given search string (literal, not regex) and case sensitivity, updates highlights for all. returns false if none found
func (*TextView) FindNextLink ¶
func (tv *TextView) FindNextLink(pos TextPos) (TextPos, TextRegion, bool)
FindNextLink finds next link after given position, returns false if no such links
func (*TextView) FindPrevLink ¶
func (tv *TextView) FindPrevLink(pos TextPos) (TextPos, TextRegion, bool)
FindPrevLink finds previous link before given position, returns false if no such links
func (*TextView) FirstVisibleLine ¶
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 ¶
func (tv *TextView) HighlightRegion(reg TextRegion)
HighlightRegion creates a new highlighted region, and renders it, un-drawing any prior highlights
func (*TextView) ISearchBackspace ¶
func (tv *TextView) ISearchBackspace()
ISearchBackspace gets rid of one item in search string
func (*TextView) ISearchCancel ¶
func (tv *TextView) ISearchCancel()
ISearchCancel cancels ISearch mode
func (*TextView) ISearchKeyInput ¶
func (tv *TextView) ISearchKeyInput(kt *key.ChordEvent)
ISearchKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode
func (*TextView) ISearchMatches ¶
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) IsWordBreak ¶
IsWordBreak defines what counts as a word break for the purposes of selecting words r1 is the rune in question, r2 is the rune past r1 in the direction you are moving Pass rune(-1) for r2 if there is no rune past r1
func (*TextView) IsWordEnd ¶
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) KeyInputInsertRune ¶ added in v0.9.4
func (tv *TextView) KeyInputInsertRune(kt *key.ChordEvent)
KeyInputInsertRune handles the insertion of a typed character
func (*TextView) Label ¶
Label returns the display label for this node, satisfying the Labeler interface
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 ¶
func (tv *TextView) LinesDeleted(tbe *TextBufEdit)
LinesDeleted deletes lines of text and reformats remaining one
func (*TextView) LinesInserted ¶
func (tv *TextView) LinesInserted(tbe *TextBufEdit)
LinesInserted inserts new lines of text and reformats them
func (*TextView) LinkAt ¶
LinkAt returns link at given cursor position, if one exists there -- returns true and the link if there is a link, and false otherwise
func (*TextView) MakeContextMenu ¶
MakeContextMenu builds the textview context menu
func (*TextView) MatchFromPos ¶
func (tv *TextView) MatchFromPos(matches []FileSearchMatch, cpos TextPos) (int, bool)
MatchFromPos finds the match at or after the given text position -- returns 0, false if none
func (*TextView) MouseEvent ¶
MouseEvent handles the mouse.Event
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) 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) 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
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 TextRegion, 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 ¶
func (tv *TextView) Selection() *TextBufEdit
Selection returns the currently selected text as a TextBufEdit, which captures start, end, and full lines in between -- nil if no selection
func (*TextView) SetBuf ¶
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 TextRegionNil
func (*TextView) ShiftSelectExtend ¶ added in v0.9.4
func (tv *TextView) ShiftSelectExtend(kt *key.ChordEvent)
ShiftSelectExtend updates the select region if the shift key is down and renders the selected text. If the shift key is not down the previously selected text is rerendered to clear the highlight
func (*TextView) SpellCheck ¶
func (tv *TextView) SpellCheck(region *TextBufEdit) bool
SpellCheck offers spelling corrections if we are at a word break or other word termination and the word before the break is unknown -- returns true if misspelled word found
func (*TextView) StartCursor ¶
func (tv *TextView) StartCursor()
StartCursor starts the cursor blinking and renders it
func (*TextView) StopCursor ¶
func (tv *TextView) StopCursor()
StopCursor stops the cursor from blinking
func (*TextView) Style2D ¶
func (tv *TextView) Style2D()
Style2D calls StyleTextView and sets the style
func (*TextView) StyleTextView ¶
func (tv *TextView) StyleTextView()
StyleTextView sets the style of widget
func (*TextView) TextViewEvents ¶
func (tv *TextView) TextViewEvents()
TextViewEvents sets connections between mouse and key events and actions
func (*TextView) UpdateHighlights ¶
func (tv *TextView) UpdateHighlights(prev []TextRegion)
UpdateHighlights re-renders lines from previous highlights and current highlights -- assumed to be within a window update block
func (*TextView) ValidateCursor ¶
func (tv *TextView) ValidateCursor()
ValidateCursor sets current cursor to a valid cursor position
func (*TextView) VisSizes ¶
func (tv *TextView) VisSizes()
VisSizes computes the visible size of view given current parameters
func (*TextView) WordAt ¶ added in v0.9.4
func (tv *TextView) WordAt() (region TextRegion)
WordAt finds the region of the word at the current cursor position
func (*TextView) WordBefore ¶
func (tv *TextView) WordBefore(tp TextPos) *TextBufEdit
WordBefore returns the word before the TextPos uses IsWordBreak to determine the bounds of the word
func (*TextView) WrappedLineNo ¶
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 TextViewSignals ¶
type TextViewSignals int64
TextViewSignals are signals that text view can send
const ( // TextViewDone signal indicates return was pressed and an edit was completed -- data is the text TextViewDone TextViewSignals = iota // TextViewSelected signal indicates some text was selected (for Inactive state, selection is via WidgetSig) TextViewSelected // TextViewCursorMoved signal indicates cursor moved emitted for every cursor movement -- e.g., for displaying cursor pos TextViewCursorMoved // TextViewISearch is emitted for every update of interactive search process -- see // ISearch.* members for current state TextViewISearch // TextViewQReplace is emitted for every update of query-replace process -- see // QReplace.* members for current state TextViewQReplace // TextViewSignalsN is the number of TextViewSignals TextViewSignalsN )
func (*TextViewSignals) FromString ¶
func (i *TextViewSignals) FromString(s string) error
func (TextViewSignals) String ¶
func (i TextViewSignals) String() string
type TextViewStates ¶
type TextViewStates int32
TextViewStates are mutually-exclusive textfield states -- determines appearance
const ( // TextViewActive is the normal state -- there but not being interacted with TextViewActive TextViewStates = iota // TextViewFocus states means textvieww is the focus -- will respond to keyboard input TextViewFocus // TextViewInactive means the textview is inactive -- not editable TextViewInactive // TextViewSel means the text region is selected TextViewSel // TextViewHighlight means the text region is highlighted TextViewHighlight // TextViewStatesN is the number of textview states TextViewStatesN )
func (*TextViewStates) FromString ¶
func (i *TextViewStates) FromString(s string) error
func (TextViewStates) String ¶
func (i TextViewStates) String() string
type TreeView ¶
type TreeView struct { gi.PartsWidgetBase SrcNode ki.Ptr `desc:"Ki Node that this widget is viewing in the tree -- the source"` ShowViewCtxtMenu bool `` /* 128-byte string literal not displayed */ ViewIdx int `` /* 144-byte string literal not displayed */ Indent units.Value `xml:"indent" desc:"styled amount to indent children relative to this node"` TreeViewSig ki.Signal `` /* 157-byte string literal not displayed */ StateStyles [TreeViewStatesN]gi.Style `` /* 217-byte string literal not displayed */ WidgetSize gi.Vec2D `desc:"just the size of our widget -- our alloc includes all of our children, but we only draw us"` Icon gi.IconName `json:"-" xml:"icon" view:"show-name" desc:"optional icon, displayed to the the left of the text label"` RootView *TreeView `json:"-" xml:"-" desc:"cached root of the view"` }
TreeView provides a graphical representation of source tree structure (which can be any type of Ki nodes), providing full manipulation abilities of that source tree (move, cut, add, etc) through drag-n-drop and cut/copy/paste and menu actions.
func (*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) CopyAction ¶
CopyAction copies to clip.Board, optionally resetting the selection-- calls Clipper copy
func (*TreeView) Cut ¶
func (tv *TreeView) Cut()
Cut copies to clip.Board and deletes selected items satisfies gi.Clipper interface and can be overridden by subtypes
func (*TreeView) CutAction ¶
func (tv *TreeView) CutAction()
CutAction copies to clip.Board and deletes selected items -- calls Clipper cut
func (*TreeView) 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) DragNDropSource ¶
DragNDropSource is called after target accepts the drop -- we just remove elements that were moved
func (*TreeView) DragNDropStart ¶
func (tv *TreeView) DragNDropStart()
DragNDropStart starts a drag-n-drop on this node -- it includes any other selected nodes as well, each as additional records in mimedata
func (*TreeView) DragNDropTarget ¶
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) 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
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) PasteAction ¶
func (tv *TreeView) PasteAction()
PasteAction pastes clipboard at given node -- calls Clipper paste
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) RootTreeView ¶
RootTreeView returns the root node of TreeView tree -- several properties for the overall view are stored there -- cached..
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
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
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
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.Ptr is nil, or source has "inactive" property // set, or treeview node has inactive property set directly TreeViewInactive TreeViewStatesN )
func (*TreeViewStates) FromString ¶
func (i *TreeViewStates) FromString(s string) error
func (TreeViewStates) String ¶
func (i TreeViewStates) String() string
type TypeValueView ¶
type TypeValueView struct {
ValueViewBase
}
TypeValueView presents a combobox for choosing types
func (*TypeValueView) ConfigWidget ¶
func (vv *TypeValueView) ConfigWidget(widg gi.Node2D)
func (*TypeValueView) UpdateWidget ¶
func (vv *TypeValueView) UpdateWidget()
func (*TypeValueView) WidgetType ¶
func (vv *TypeValueView) WidgetType() reflect.Type
type ValueView ¶
type ValueView interface { ki.Ki // AsValueViewBase gives access to the basic data fields so that the // interface doesn't need to provide accessors for them. AsValueViewBase() *ValueViewBase // SetStructValue sets the value, owner and field information for a struct field. SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, tmpSave ValueView) // 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) // SetSliceValue sets the value, owner and index information for a slice element. SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView) // SetStandaloneValue sets the value for a singleton standalone value // (e.g., for arg values). SetStandaloneValue(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"` 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) HasAction ¶
func (vv *ValueViewBase) HasAction() bool
func (*ValueViewBase) IsInactive ¶
func (vv *ValueViewBase) IsInactive() bool
func (*ValueViewBase) OwnerKind ¶
func (vv *ValueViewBase) OwnerKind() reflect.Kind
we have this one accessor b/c it is more useful for outside consumers vs. internal usage
func (*ValueViewBase) OwnerLabel ¶
func (vv *ValueViewBase) OwnerLabel() string
OwnerLabel returns some extra info about the owner of this value view which is useful to put in title of our object
func (*ValueViewBase) SaveTmp ¶
func (vv *ValueViewBase) SaveTmp()
func (*ValueViewBase) SetMapKey ¶
func (vv *ValueViewBase) SetMapKey(key reflect.Value, owner interface{}, tmpSave ValueView)
func (*ValueViewBase) SetMapValue ¶
func (vv *ValueViewBase) SetMapValue(val reflect.Value, owner interface{}, key interface{}, keyView ValueView, tmpSave ValueView)
func (*ValueViewBase) SetSliceValue ¶
func (vv *ValueViewBase) SetSliceValue(val reflect.Value, owner interface{}, idx int, tmpSave ValueView)
func (*ValueViewBase) SetStandaloneValue ¶
func (vv *ValueViewBase) SetStandaloneValue(val reflect.Value)
func (*ValueViewBase) SetStructValue ¶
func (vv *ValueViewBase) SetStructValue(val reflect.Value, owner interface{}, field *reflect.StructField, tmpSave ValueView)
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) UpdateWidget ¶
func (vv *ValueViewBase) UpdateWidget()
func (*ValueViewBase) Val ¶
func (vv *ValueViewBase) Val() reflect.Value
func (*ValueViewBase) WidgetType ¶
func (vv *ValueViewBase) WidgetType() reflect.Type
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 ViewIFace ¶
type ViewIFace struct { }
giv.ViewIFace is THE implementation of the gi.ViewIFace interface
func (*ViewIFace) CtxtMenuView ¶
func (*ViewIFace) GoGiEditor ¶
func (*ViewIFace) HiStylesView ¶
func (vi *ViewIFace) HiStylesView(styles interface{})
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)
Source Files
¶
- argdataflags_string.go
- argview.go
- basicviews.go
- colorview.go
- complete.go
- dialogs.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
- methview.go
- methviewflags_string.go
- outbuf.go
- prefsview.go
- sliceview.go
- sliceviewinline.go
- sliceviewsignals_string.go
- spell.go
- structview.go
- structviewinline.go
- tableview.go
- tableviewsignals_string.go
- textbuf.go
- textbufsignals_string.go
- textview.go
- textviewsignals_string.go
- textviewstates_string.go
- treeview.go
- treeviewsignals_string.go
- treeviewstates_string.go
- valueview.go