Documentation ¶
Overview ¶
Package Gi (GoGi) provides a Graphical Interface based on GoKi Tree Node structs
2D and 3D (in gi3d) scenegraphs supported, each rendering to respective Viewport or Scene. Scene is a 2D element that embeds the 3D scene, and a 2D Viewport can in turn be embedded within the 3D scene.
The 2D scenegraph supports:
- Widget nodes for GUI actions (Buttons, Menus etc) -- render directly via GiRl
- Layouts for placing widgets, which are also container nodes
- CSS-based styling, directly on Node Props (properties), and CSS StyleSheet
- svg sub-package with SVG Viewport and shapes, paths, etc -- full SVG support
- Icon is a wrapper around an SVG -- any SVG icon can be used
Layout Logic ¶
All 2D scenegraphs are controlled by the Layout, which provides the logic for organizing widgets / elements within the constraints of the display. Typically start with a vertical LayoutVert in the viewport, with LayoutHoriz's within that, or a LayoutGrid for more complex layouts:
win := gi.NewMainWindow("test-window", "Test Window", width, height) vp := win.WinViewport2D() updt := vp.UpdateStart() vlay := win.SetMainVLay() // or SetMainFrame row1 := gi.AddNewLayout(vlay, "row1", gi.LayoutHoriz) ... vp.UpdateEnd(updt)
Controlling the layout involves the following style properties:
width / height: sets the preferred size of item -- layout tries to give this amount of space unless it can't in which case it falls back on:
min-width / min-height: minimum size -- will not scale below this size. if not specified, it defaults to 1 em (the size of 1 character)
max-width / max-height: maximum size -- will not exceed this size if specified, otherwise if 0 it is ignored and preferred size is used. If a negative number is specified, then the item stretches to take up available room. The Stretch node is a builtin type that has this property set automatically, and can be added to any layout to fill up any available space. The preferred size of the item is used to determine how much of the space is used by each stretchable element, so you can set that to achieve different proportional spacing. By default the Stretch is just the minimum 1em in preferred size.
horizontal-align / vertical-align: for the other dimension in a Layout (e.g., for LayoutHoriz, the vertical dimension) this specifies how the items are aligned within the available space (e.g., tops, bottoms, centers). In the dimension of the Layout (horiz for LayoutHoriz) it determines how extra space is allocated (only if there aren't any infinitely stretchy elements), e.g., right / left / center or justified.
SetFixedWidth / Height method can be used to set all size params to the same value, causing that item to be definitively sized. This is convenient for sizing the Space node which adds a fixed amount of space (1em by default).
See the wiki for more detailed documentation.
Signals ¶
All widgets send appropriate signals about user actions -- Connect to those and check the signal type to determine the type of event. Only one connection per receiver -- handle all the different signal types in one function.
Views ¶
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.
Views provide 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 giv sub-package for all the View elements ¶
SVG for Icons, Displays, etc ¶
SVG (Structured Vector Graphics) is used icons, and for rendering any kind of graphical output (drawing a graph, dial, etc). See svg sub-package, and examples/svg for an svg viewer, and examples/marbles for an svg animation.
Overlays and Sprites ¶
The gi.Window can render Sprite images to an OverTex overlay texture, which is cleared to be transparent prior to rendering any active sprites. This is used for cursors (e.g., TextField, giv.TextView cursors), Drag-n-Drop, etc.
Index ¶
- Constants
- Variables
- func AddToSpellModel(filepath string) error
- func AggCSS(agg *ki.Props, css ki.Props)
- func AppName() string
- func ApplyCSS(node Node2D, vp *Viewport2D, st *gist.Style, css ki.Props, ...) bool
- func Base64SplitLines(b []byte) []byte
- func ChildByLabelStartsCanFocus(ly *Layout, name string, after ki.Ki) (ki.Ki, bool)
- func ChoiceDialog(avp *Viewport2D, opts DlgOpts, choices []string, recv ki.Ki, fun ki.RecvFunc)
- func CompleteEditText(text string, cp int, completion string, seed string) (ed complete.Edit)
- func CompleteText(s string) []string
- func DNDModCursor(dmod dnd.DropMods) cursor.Shapes
- func DefaultColorSchemes() map[string]*ColorPrefs
- func DefaultStyle2DWidget(wb *WidgetBase, selector string, part *WidgetBase) *gist.Style
- func EndCPUMemProfile()
- func EndTargProfile()
- func GatherSizes(ly *Layout)
- func GatherSizesFlow(ly *Layout, iter int)
- func GatherSizesGrid(ly *Layout)
- func GatherSizesSumMax(ly *Layout) (sumPref, sumNeed, maxPref, maxNeed mat32.Vec2)
- func GrabRenderFrom(nii Node2D) *image.RGBA
- func ImageClearer(im *image.RGBA, pct float32)
- func ImageFmBase64(fmt string, eb []byte) (image.Image, error)
- func ImageFmBase64JPG(eb []byte) (image.Image, error)
- func ImageFmBase64PNG(eb []byte) (image.Image, error)
- func ImageResize(img image.Image, szX, szY int) image.Image
- func ImageResizeMax(img image.Image, maxSz int) image.Image
- func ImageSizeMax(sz image.Point, maxSz int) image.Point
- func ImageToBase64JPG(img image.Image) ([]byte, string)
- func ImageToBase64PNG(img image.Image) ([]byte, string)
- func ImageToRGBA(img image.Image) *image.RGBA
- func Init()
- func InitSpell() error
- func KiToNode2D(k ki.Ki) (Node2D, *Node2DBase)
- func LayAllocFromParent(ly *Layout)
- func LaySumDim(ly Layouts, d mat32.Dims) bool
- func LaySummedDim(ly Layouts) mat32.Dims
- func LayoutAlongDim(ly *Layout, dim mat32.Dims)
- func LayoutFlow(ly *Layout, dim mat32.Dims, iter int) bool
- func LayoutGridDim(ly *Layout, rowcol RowCol, dim mat32.Dims)
- func LayoutGridLay(ly *Layout)
- func LayoutSharedDim(ly *Layout, dim mat32.Dims)
- func LayoutSharedDimImpl(ly *Layout, avail, need, pref, max, spc float32, al gist.Align) (pos, size float32)
- func MainMenuFunc(owin oswin.Window, title string, tag int)
- func NewKiDialogValues(dlg *Dialog) (int, reflect.Type)
- func NewSpellModelFromText() error
- func OpenImage(path string) (image.Image, error)
- func OpenPNG(path string) (image.Image, error)
- func OpenPaths()
- func OpenSpellModel() error
- func OpenURL(url string)
- func PollEvents()
- func PopupIsCompleter(pop ki.Ki) bool
- func PopupIsCorrector(pop ki.Ki) bool
- func PopupIsMenu(pop ki.Ki) bool
- func PopupIsTooltip(pop ki.Ki) bool
- func ProfileToggle()
- func ProgressDefaultInc(max int) int
- func PromptDialog(avp *Viewport2D, opts DlgOpts, ok, cancel bool, recv ki.Ki, fun ki.RecvFunc)
- func Quit()
- func SaveImage(path string, im image.Image) error
- func SavePNG(path string, im image.Image) error
- func SavePaths()
- func SaveSpellModel() error
- func SetActiveKeyMap(km *KeyMap, kmName KeyMapName)
- func SetActiveKeyMapName(mapnm KeyMapName)
- func SetAppAbout(about string)
- func SetAppName(name string)
- func SetQuitCleanFunc(fun func())
- func SetQuitReqFunc(fun func())
- func SetStdXMLAttr(ni Node, name, val string) bool
- func SetUnitContext(st *gist.Style, vp *Viewport2D, el mat32.Vec2)
- func ShortcutForFun(kf KeyFuns) key.Chord
- func SignalViewport2D(vpki, send ki.Ki, sig int64, data interface{})
- func SignalWindowPublish(winki, node ki.Ki, sig int64, data interface{})
- func StartCPUMemProfile()
- func StartTargProfile()
- func StringPromptDialogValue(dlg *Dialog) string
- func StringsAddExtras(items *[]string, extras []string)
- func StringsAppendIfUnique(strs *[]string, str string, max int)
- func StringsDelete(strs *[]string, str string)
- func StringsInsertFirst(strs *[]string, str string, max int)
- func StringsInsertFirstUnique(strs *[]string, str string, max int)
- func StringsRemoveExtras(items *[]string, extras []string)
- func StyleCSS(node Node2D, vp *Viewport2D, st *gist.Style, css ki.Props, selector string)
- func TextFieldBlink()
- func ToLabel(it interface{}) string
- func ToLabeler(it interface{}) (string, bool)
- func WinNewCloseStamp()
- type ActOpts
- type Action
- func (ac *Action) ButtonRelease()
- func (ac *Action) ConfigParts()
- func (ac *Action) ConfigPartsAddShortcut(config *kit.TypeAndNameList) int
- func (ac *Action) ConfigPartsButton()
- func (ac *Action) ConfigPartsMenuItem()
- func (ac *Action) ConfigPartsShortcut(scIdx int)
- func (ac *Action) CopyFieldsFrom(frm interface{})
- func (ac *Action) Disconnect()
- func (ac *Action) Init2D()
- func (ac *Action) Trigger()
- func (ac *Action) UpdateActions()
- type Bitmap
- func (bm *Bitmap) CopyFieldsFrom(frm interface{})
- func (bm *Bitmap) DrawIntoViewport(parVp *Viewport2D)
- func (bm *Bitmap) GrabRenderFrom(nii Node2D)
- func (bm *Bitmap) LayoutToImgSize()
- func (bm *Bitmap) OpenImage(filename FileName, width, height float32) error
- func (bm *Bitmap) Render2D()
- func (bm *Bitmap) SetImage(img image.Image, width, height float32)
- func (bm *Bitmap) SetSize(nwsz image.Point)
- type Button
- type ButtonBase
- func (bb *ButtonBase) AsButtonBase() *ButtonBase
- func (bb *ButtonBase) BaseButtonRelease()
- func (bb *ButtonBase) ButtonEnterHover()
- func (bb *ButtonBase) ButtonEvents()
- func (bb *ButtonBase) ButtonExitHover()
- func (bb *ButtonBase) ButtonPress()
- func (bb *ButtonBase) ButtonRelease()
- func (bb *ButtonBase) ConfigParts()
- func (bb *ButtonBase) ConfigPartsAddIndicator(config *kit.TypeAndNameList, defOn bool) int
- func (bb *ButtonBase) ConfigPartsAddIndicatorSpace(config *kit.TypeAndNameList, defOn bool) int
- func (bb *ButtonBase) ConfigPartsIfNeeded()
- func (bb *ButtonBase) ConfigPartsIndicator(indIdx int)
- func (bb *ButtonBase) ConnectEvents2D()
- func (bb *ButtonBase) CopyFieldsFrom(frm interface{})
- func (bb *ButtonBase) Destroy()
- func (bb *ButtonBase) Disconnect()
- func (bb *ButtonBase) FocusChanged2D(change FocusChanges)
- func (bb *ButtonBase) HasMenu() bool
- func (bb *ButtonBase) HoverTooltipEvent()
- func (bb *ButtonBase) Init2D()
- func (bb *ButtonBase) IsCheckable() bool
- func (bb *ButtonBase) IsChecked() bool
- func (bb *ButtonBase) IsMenu() bool
- func (bb *ButtonBase) KeyChordEvent()
- func (bb *ButtonBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (bb *ButtonBase) MouseEvent()
- func (bb *ButtonBase) MouseFocusEvent()
- func (bb *ButtonBase) OnClicked(fun func())
- func (bb *ButtonBase) OpenMenu() bool
- func (bb *ButtonBase) Render2D()
- func (bb *ButtonBase) RenderButton()
- func (bb *ButtonBase) ResetMenu()
- func (bb *ButtonBase) SetAsButton()
- func (bb *ButtonBase) SetAsMenu()
- func (bb *ButtonBase) SetButtonState(state ButtonStates) bool
- func (bb *ButtonBase) SetCheckable(checkable bool)
- func (bb *ButtonBase) SetChecked(chk bool)
- func (bb *ButtonBase) SetIcon(iconName string)
- func (bb *ButtonBase) SetText(txt string)
- func (bb *ButtonBase) Style2D()
- func (bb *ButtonBase) StyleButton()
- func (bb *ButtonBase) StyleParts()
- func (bb *ButtonBase) ToggleChecked()
- func (bb *ButtonBase) UpdateButtonStyle() bool
- type ButtonBox
- func (bb *ButtonBox) BitFlagsValue(enumtyp reflect.Type) int64
- func (bb *ButtonBox) ConfigItems()
- func (bb *ButtonBox) ConfigParts()
- func (bb *ButtonBox) ConfigPartsIfNeeded()
- func (bb *ButtonBox) CopyFieldsFrom(frm interface{})
- func (bb *ButtonBox) Disconnect()
- func (bb *ButtonBox) Init2D()
- func (bb *ButtonBox) ItemsFromEnum(enumtyp reflect.Type)
- func (bb *ButtonBox) ItemsFromEnumList(el []kit.EnumValue)
- func (bb *ButtonBox) ItemsFromStringList(el []string)
- func (bb *ButtonBox) Layout2D(parBBox image.Rectangle, iter int) bool
- func (bb *ButtonBox) Render2D()
- func (bb *ButtonBox) RenderButtonBox()
- func (bb *ButtonBox) SelectItem(idx int) error
- func (bb *ButtonBox) SelectItemAction(idx int) error
- func (bb *ButtonBox) Style2D()
- func (bb *ButtonBox) UnCheckAll()
- func (bb *ButtonBox) UnCheckAllBut(idx int)
- func (bb *ButtonBox) UpdateFromBitFlags(enumtyp reflect.Type, val int64)
- type ButtonFlags
- type ButtonSignals
- type ButtonStates
- type ButtonWidget
- type CheckBox
- func (cb *CheckBox) AsButtonBase() *ButtonBase
- func (cb *CheckBox) ButtonRelease()
- func (cb *CheckBox) ConfigParts()
- func (cb *CheckBox) ConfigPartsIfNeeded()
- func (cb *CheckBox) CopyFieldsFrom(frm interface{})
- func (cb *CheckBox) Init2D()
- func (cb *CheckBox) OnClicked(fun func())
- func (cb *CheckBox) SetIconProps(props ki.Props)
- func (cb *CheckBox) SetIcons(icOn, icOff string)
- func (cb *CheckBox) StyleParts()
- type Clipper
- type ColorName
- type ColorPrefs
- type ComboBox
- func (cb *ComboBox) ButtonRelease()
- func (cb *ComboBox) ConfigParts()
- func (cb *ComboBox) ConfigPartsIconText(config *kit.TypeAndNameList, icnm string) (icIdx, txIdx int)
- func (cb *ComboBox) ConfigPartsIfNeeded()
- func (cb *ComboBox) ConfigPartsSetText(txt string, txIdx, icIdx, indIdx int)
- func (cb *ComboBox) CopyFieldsFrom(frm interface{})
- func (cb *ComboBox) Disconnect()
- func (cb *ComboBox) FindItem(it interface{}) int
- func (cb *ComboBox) ItemsFromEnum(enumtyp reflect.Type, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromEnumList(el []kit.EnumValue, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromIconList(el []IconName, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromStringList(el []string, setFirst bool, maxLen int)
- func (cb *ComboBox) ItemsFromTypes(tl []reflect.Type, setFirst, sort bool, maxLen int)
- func (cb *ComboBox) MakeItems(reset bool, capacity int)
- func (cb *ComboBox) MakeItemsMenu()
- func (cb *ComboBox) SelectItem(idx int)
- func (cb *ComboBox) SelectItemAction(idx int)
- func (cb *ComboBox) SetCurIndex(idx int) interface{}
- func (cb *ComboBox) SetCurVal(it interface{}) int
- func (cb *ComboBox) SetToMaxLength(maxLen int)
- func (cb *ComboBox) ShowCurVal()
- func (cb *ComboBox) SortItems(ascending bool)
- func (cb *ComboBox) TextField() (*TextField, bool)
- type Complete
- func (c *Complete) Abort() bool
- func (c *Complete) Cancel() bool
- func (c *Complete) Complete(s string)
- func (cm *Complete) Disconnect()
- func (c *Complete) GetCompletion(s string) complete.Completion
- func (c *Complete) IsAboutToShow() bool
- func (c *Complete) KeyInput(kf KeyFuns) bool
- func (c *Complete) Lookup(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
- func (c *Complete) Show(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
- func (c *Complete) ShowNow(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
- type CompleteSignals
- type Completer
- type CtxtMenuFunc
- type DNDStages
- type Dialog
- func NewKiDialog(avp *Viewport2D, iface reflect.Type, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog
- func NewStdDialog(opts DlgOpts, ok, cancel bool) *Dialog
- func RecycleStdDialog(data interface{}, opts DlgOpts, ok, cancel bool) (*Dialog, bool)
- func StringPromptDialog(avp *Viewport2D, strval, placeholder string, opts DlgOpts, recv ki.Ki, ...) *Dialog
- func (dlg *Dialog) Accept()
- func (dlg *Dialog) AddButtonBox(frame *Frame) *Layout
- func (dlg *Dialog) ButtonBox(frame *Frame) (*Layout, int)
- func (dlg *Dialog) Cancel()
- func (dlg *Dialog) Close()
- func (dlg *Dialog) Disconnect()
- func (dlg *Dialog) Frame() *Frame
- func (dlg *Dialog) HasFocus2D() bool
- func (dlg *Dialog) Init2D()
- func (dlg *Dialog) Open(x, y int, avp *Viewport2D, cfgFunc func()) bool
- func (dlg *Dialog) PromptWidget(frame *Frame) (*Label, int)
- func (dlg *Dialog) PromptWidgetIdx(frame *Frame) int
- func (dlg *Dialog) SetFrame() *Frame
- func (dlg *Dialog) SetPrompt(prompt string, frame *Frame) *Label
- func (dlg *Dialog) SetTitle(title string, frame *Frame) *Label
- func (dlg *Dialog) StdButtonConfig(stretch, ok, cancel bool) kit.TypeAndNameList
- func (dlg *Dialog) StdButtonConnect(ok, cancel bool, bb *Layout)
- func (dlg *Dialog) StdDialog(title, prompt string, ok, cancel bool)
- func (dlg *Dialog) TitleWidget(frame *Frame) (*Label, int)
- type DialogState
- type DlgOpts
- type DragNDropper
- type EditorPrefs
- type EventMaster
- type EventMgr
- func (em *EventMgr) ActivateStartFocus() bool
- func (em *EventMgr) ClearDND()
- func (em *EventMgr) ClearNonFocus(foc ki.Ki)
- func (em *EventMgr) ConnectEvent(recv ki.Ki, et oswin.EventType, pri EventPris, fun ki.RecvFunc)
- func (em *EventMgr) CurFocus() ki.Ki
- func (em *EventMgr) DNDIsInternalSrc() bool
- func (em *EventMgr) DNDStart(src ki.Ki, data mimedata.Mimes)
- func (em *EventMgr) DNDStartEvent(e *mouse.DragEvent)
- func (em *EventMgr) DisconnectAllEvents(recv ki.Ki, pri EventPris)
- func (em *EventMgr) DisconnectEvent(recv ki.Ki, et oswin.EventType, pri EventPris)
- func (em *EventMgr) DoInstaDrag(me *mouse.DragEvent, popup bool) bool
- func (em *EventMgr) FilterLaggyEvents(evi oswin.Event) bool
- func (em *EventMgr) FocusLast() bool
- func (em *EventMgr) FocusNext(foc ki.Ki) bool
- func (em *EventMgr) FocusOnOrNext(foc ki.Ki) bool
- func (em *EventMgr) FocusOnOrPrev(foc ki.Ki) bool
- func (em *EventMgr) FocusPrev(foc ki.Ki) bool
- func (em *EventMgr) GenDNDFocusEvents(mev *dnd.MoveEvent, popup bool) bool
- func (em *EventMgr) GenMouseFocusEvents(mev *mouse.MoveEvent, popup bool) bool
- func (em *EventMgr) InitialFocus()
- func (em *EventMgr) ManagerKeyChordEvents(e *key.ChordEvent)
- func (em *EventMgr) MouseDragEvents(evi oswin.Event)
- func (em *EventMgr) MouseEventReset(evi oswin.Event)
- func (em *EventMgr) MouseEvents(evi oswin.Event)
- func (em *EventMgr) MouseMoveEvents(evi oswin.Event)
- func (em *EventMgr) PopFocus()
- func (em *EventMgr) PushFocus(p ki.Ki)
- func (em *EventMgr) ResetMouseDrag()
- func (em *EventMgr) ResetMouseMove()
- func (em *EventMgr) SendDNDDropEvent(e *mouse.Event) bool
- func (em *EventMgr) SendDNDHoverEvent(e *mouse.DragEvent)
- func (em *EventMgr) SendDNDMoveEvent(e *mouse.DragEvent) *dnd.MoveEvent
- func (em *EventMgr) SendEventSignal(evi oswin.Event, popup bool)
- func (em *EventMgr) SendEventSignalFunc(evi oswin.Event, popup bool, rvs *WinEventRecvList, recv ki.Ki, ...) bool
- func (em *EventMgr) SendHoverEvent(he *mouse.HoverEvent)
- func (em *EventMgr) SendKeyChordEvent(popup bool, r rune, mods ...key.Modifiers)
- func (em *EventMgr) SendKeyFunEvent(kf KeyFuns, popup bool)
- func (em *EventMgr) SendSig(recv, sender ki.Ki, evi oswin.Event)
- func (em *EventMgr) SetFocus(k ki.Ki) bool
- func (em *EventMgr) SetStartFocus(k ki.Ki)
- type EventPris
- type FavPathItem
- type FavPaths
- type FileName
- type FilePaths
- type FocusChanges
- type FontName
- type Frame
- type Geom2DInt
- type Gradient
- type GridData
- type HiStyleName
- type Icon
- type IconMgr
- type IconName
- type KeyFuns
- type KeyMap
- type KeyMapItem
- type KeyMapName
- type KeyMaps
- func (km *KeyMaps) CopyFrom(cp KeyMaps)
- func (km *KeyMaps) MapByName(name KeyMapName) (*KeyMap, int, bool)
- func (km *KeyMaps) OpenJSON(filename FileName) error
- func (km *KeyMaps) OpenPrefs() error
- func (km *KeyMaps) RevertToStd()
- func (km *KeyMaps) SaveJSON(filename FileName) error
- func (km *KeyMaps) SavePrefs() error
- func (km *KeyMaps) ViewStd()
- type KeyMapsItem
- type Label
- func (lb *Label) ConnectEvents2D()
- func (lb *Label) CopyFieldsFrom(frm interface{})
- func (lb *Label) Disconnect()
- func (lb *Label) GrabCurBgColor()
- func (lb *Label) HoverEvent()
- func (lb *Label) LabelEvents()
- func (lb *Label) Layout2D(parBBox image.Rectangle, iter int) bool
- func (lb *Label) LayoutLabel()
- func (lb *Label) MouseEvent()
- func (lb *Label) MouseMoveEvent()
- func (lb *Label) OpenLink(tl *girl.TextLink)
- func (lb *Label) Render2D()
- func (lb *Label) RenderLabel()
- func (lb *Label) SetStateStyle()
- func (lb *Label) SetText(txt string)
- func (lb *Label) Size2D(iter int)
- func (lb *Label) Style2D()
- func (lb *Label) StyleLabel()
- func (lb *Label) TextPos() mat32.Vec2
- type LabelStates
- type Labeler
- type Layout
- func (ly *Layout) AsLayout2D() *Layout
- func (ly *Layout) AutoScroll(pos image.Point) bool
- func (ly *Layout) AutoScrollDim(dim mat32.Dims, st, pos int) bool
- func (ly *Layout) AvailSize() mat32.Vec2
- func (ly *Layout) BBox2D() image.Rectangle
- func (ly *Layout) ChildWithFocus() (ki.Ki, int)
- func (ly *Layout) ChildrenBBox2D() image.Rectangle
- func (ly *Layout) ChildrenUpdateSizes()
- func (ly *Layout) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (ly *Layout) ConnectEvents2D()
- func (ly *Layout) CopyFieldsFrom(frm interface{})
- func (ly *Layout) DeactivateScroll(sc *ScrollBar)
- func (ly *Layout) DeleteScroll(d mat32.Dims)
- func (ly *Layout) FinalizeLayout()
- func (ly *Layout) FocusNextChild(updn bool) bool
- func (ly *Layout) FocusOnName(kt *key.ChordEvent) bool
- func (ly *Layout) FocusPrevChild(updn bool) bool
- func (ly *Layout) HasAnyScroll() bool
- func (ly *Layout) HasFocus2D() bool
- func (ly *Layout) Init2D()
- func (ly *Layout) KeyChordEvent()
- func (ly *Layout) Layout2D(parBBox image.Rectangle, iter int) bool
- func (ly *Layout) Layout2DChildren(iter int) bool
- func (ly *Layout) LayoutKeys(kt *key.ChordEvent)
- func (ly *Layout) LayoutScrollEvents()
- func (ly *Layout) LayoutScrolls()
- func (ly *Layout) ManageOverflow()
- func (ly *Layout) Move2D(delta image.Point, parBBox image.Rectangle)
- func (ly *Layout) Move2DChildren(delta image.Point)
- func (ly *Layout) Move2DDelta(delta image.Point) image.Point
- func (ly *Layout) Move2DScrolls(delta image.Point, parBBox image.Rectangle)
- func (ly *Layout) ReRenderScrolls()
- func (ly *Layout) Render2D()
- func (ly *Layout) Render2DChildren()
- func (ly *Layout) RenderScrolls()
- func (ly *Layout) ScrollActionDelta(dim mat32.Dims, delta float32)
- func (ly *Layout) ScrollActionPos(dim mat32.Dims, pos float32)
- func (ly *Layout) ScrollDelta(me *mouse.ScrollEvent)
- func (ly *Layout) ScrollDimToCenter(dim mat32.Dims, pos int) bool
- func (ly *Layout) ScrollDimToEnd(dim mat32.Dims, pos int) bool
- func (ly *Layout) ScrollDimToStart(dim mat32.Dims, pos int) bool
- func (ly *Layout) ScrollToBox(box image.Rectangle) bool
- func (ly *Layout) ScrollToBoxDim(dim mat32.Dims, minBox, maxBox int) bool
- func (ly *Layout) ScrollToItem(ni Node2D) bool
- func (ly *Layout) ScrollToPos(dim mat32.Dims, pos float32)
- func (ly *Layout) SetScroll(d mat32.Dims)
- func (ly *Layout) SetScrollsOff()
- func (ly *Layout) Size2D(iter int)
- func (ly *Layout) Style2D()
- func (ly *Layout) StyleFromProps(props ki.Props, vp *Viewport2D)
- func (ly *Layout) StyleLayout()
- func (ly *Layout) StyleToDots(uc *units.Context)
- type LayoutAllocs
- type LayoutState
- type Layouts
- type MakeMenuFunc
- type Menu
- func (m *Menu) AddAction(opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (m *Menu) AddAppMenu(win *Window)
- func (m *Menu) AddCopyCutPaste(win *Window)
- func (m *Menu) AddCopyCutPasteDupe(win *Window)
- func (m *Menu) AddLabel(lbl string) *Label
- func (m *Menu) AddSeparator(name string) *Separator
- func (m *Menu) AddStdAppMenu(win *Window)
- func (m *Menu) AddWindowsMenu(win *Window)
- func (m *Menu) CopyFrom(men *Menu)
- func (m *Menu) DeleteShortcuts(win *Window)
- func (m *Menu) FindActionByName(name string) (*Action, bool)
- func (m *Menu) InsertActionAfter(after string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (m *Menu) InsertActionBefore(before string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (m Menu) MarshalJSON() ([]byte, error)
- func (m *Menu) SetAction(ac *Action, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc)
- func (m *Menu) SetShortcuts(win *Window)
- func (m *Menu) UnmarshalJSON(b []byte) error
- func (m *Menu) UpdateActions()
- type MenuBar
- func (mb *MenuBar) ConfigMenus(menus []string)
- func (mb *MenuBar) CopyFieldsFrom(frm interface{})
- func (mb *MenuBar) DeleteShortcuts()
- func (mb *MenuBar) Destroy()
- func (m *MenuBar) FindActionByName(name string) (*Action, bool)
- func (mb *MenuBar) Layout2D(parBBox image.Rectangle, iter int) bool
- func (mb *MenuBar) MainMenuUpdateActives(win *Window)
- func (mb *MenuBar) MenuBarStdRender()
- func (mb *MenuBar) Render2D()
- func (mb *MenuBar) SetMainMenu(win *Window)
- func (mb *MenuBar) SetMainMenuSub(osmm oswin.MainMenu, subm oswin.Menu, am *Action)
- func (mb *MenuBar) SetShortcuts()
- func (mb *MenuBar) ShowMenuBar() bool
- func (mb *MenuBar) Size2D(iter int)
- func (mb *MenuBar) UpdateActions()
- func (mb *MenuBar) UpdateMainMenu(win *Window)
- type MenuButton
- type MetaData2D
- type Node
- type Node2D
- type Node2DBase
- func (nb *Node2DBase) AsLayout2D() *Layout
- func (nb *Node2DBase) AsNode2D() *Node2DBase
- func (nb *Node2DBase) AsViewport2D() *Viewport2D
- func (nb *Node2DBase) AsWidget() *WidgetBase
- func (nb *Node2DBase) BBox2D() image.Rectangle
- func (nb *Node2DBase) BBoxReport() string
- func (n *Node2DBase) BaseIface() reflect.Type
- func (nb *Node2DBase) ChildrenBBox2D() image.Rectangle
- func (nb *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (nb *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point)
- func (nb *Node2DBase) ConnectEvent(et oswin.EventType, pri EventPris, fun ki.RecvFunc)
- func (nb *Node2DBase) ConnectEvents2D()
- func (nb *Node2DBase) ConnectToViewport()
- func (nb *Node2DBase) ContainsFocus() bool
- func (nb *Node2DBase) ContextMenu()
- func (nb *Node2DBase) ContextMenuPos() (pos image.Point)
- func (nb *Node2DBase) CopyFieldsFrom(frm interface{})
- func (nb *Node2DBase) DirectWinUpload()
- func (nb *Node2DBase) DisconnectAllEvents(pri EventPris)
- func (nb *Node2DBase) DisconnectEvent(et oswin.EventType, pri EventPris)
- func (nb *Node2DBase) DisconnectViewport()
- func (nb *Node2DBase) EventMgr2D() *EventMgr
- func (nb *Node2DBase) FindNamedElement(name string) Node2D
- func (nb *Node2DBase) FocusChanged2D(change FocusChanges)
- func (nb *Node2DBase) FocusNext()
- func (nb *Node2DBase) FocusPrev()
- func (nb *Node2DBase) FullInit2DTree()
- func (nb *Node2DBase) FullRender2DTree()
- func (nb *Node2DBase) GrabFocus()
- func (nb *Node2DBase) HasFocus2D() bool
- func (nb *Node2DBase) Init2D()
- func (nb *Node2DBase) Init2DTree()
- func (nb *Node2DBase) IsDirectWinUpload() bool
- func (nb *Node2DBase) IsVisible() bool
- func (nb *Node2DBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (nb *Node2DBase) Layout2DChildren(iter int) bool
- func (nb *Node2DBase) Layout2DTree()
- func (nb *Node2DBase) MakeContextMenu(m *Menu)
- func (nb *Node2DBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (nb *Node2DBase) Move2DChildren(delta image.Point)
- func (nb *Node2DBase) NeedsFullReRender2DTree() bool
- func (nb *Node2DBase) ParentLayout() *Layout
- func (nb *Node2DBase) ParentPaint() *gist.Paint
- func (nb *Node2DBase) ParentReRenderAnchor() Node2D
- func (nb *Node2DBase) ParentScrollLayout() *Layout
- func (nb *Node2DBase) ParentStyle() *gist.Style
- func (nb *Node2DBase) ParentStyleRUnlock()
- func (nb *Node2DBase) ParentViewport() *Viewport2D
- func (nb *Node2DBase) ParentWindow() *Window
- func (nb *Node2DBase) PropTag() string
- func (nb *Node2DBase) Render() *girl.State
- func (nb *Node2DBase) Render2D()
- func (nb *Node2DBase) Render2DChildren()
- func (nb *Node2DBase) Render2DTree()
- func (nb *Node2DBase) ScrollToMe() bool
- func (nb *Node2DBase) SetFixedHeight(val units.Value)
- func (nb *Node2DBase) SetFixedWidth(val units.Value)
- func (nb *Node2DBase) SetMinPrefHeight(val units.Value)
- func (nb *Node2DBase) SetMinPrefWidth(val units.Value)
- func (nb *Node2DBase) SetStretchMax()
- func (nb *Node2DBase) SetStretchMaxHeight()
- func (nb *Node2DBase) SetStretchMaxWidth()
- func (nb *Node2DBase) SetWinBBox()
- func (nb *Node2DBase) Size2D(iter int)
- func (nb *Node2DBase) Size2DTree(iter int)
- func (nb *Node2DBase) StartFocus()
- func (nb *Node2DBase) Style2D()
- func (nb *Node2DBase) Style2DTree()
- func (nb *Node2DBase) TopNode2D() Node
- func (nb *Node2DBase) TopUpdateEnd(updt bool)
- func (nb *Node2DBase) TopUpdateStart() bool
- func (nb *Node2DBase) ViewportSafe() *Viewport2D
- type NodeBase
- func (nb *NodeBase) AddClass(cls string)
- func (nb *NodeBase) AllWithinBBox(bbox image.Rectangle, leavesOnly bool) ki.Slice
- func (nb *NodeBase) AsGiNode() *NodeBase
- func (nb *NodeBase) CanFocus() bool
- func (nb *NodeBase) ClearFullReRender()
- func (nb *NodeBase) ClearInactive()
- func (nb *NodeBase) ClearInvisible()
- func (nb *NodeBase) ClearSelected()
- func (nb *NodeBase) CopyFieldsFrom(frm interface{})
- func (nb *NodeBase) FirstContainingPoint(pt image.Point, leavesOnly bool) ki.Ki
- func (nb *NodeBase) HasFocus() bool
- func (nb *NodeBase) HasNoLayout() bool
- func (nb *NodeBase) IsActive() bool
- func (nb *NodeBase) IsDragging() bool
- func (nb *NodeBase) IsInactive() bool
- func (nb *NodeBase) IsInstaDrag() bool
- func (nb *NodeBase) IsInvisible() bool
- func (nb *NodeBase) IsReRenderAnchor() bool
- func (nb *NodeBase) IsSelected() bool
- func (nb *NodeBase) NeedsFullReRender() bool
- func (nb *NodeBase) ParentCSSAgg() *ki.Props
- func (nb *NodeBase) PointToRelPos(pt image.Point) image.Point
- func (nb *NodeBase) PosInWinBBox(pos image.Point) bool
- func (nb *NodeBase) SetActiveState(act bool)
- func (nb *NodeBase) SetActiveStateUpdt(act bool)
- func (nb *NodeBase) SetCanFocus()
- func (nb *NodeBase) SetCanFocusIfActive()
- func (nb *NodeBase) SetFocusState(focus bool)
- func (nb *NodeBase) SetFullReRender()
- func (nb *NodeBase) SetInactive()
- func (nb *NodeBase) SetInactiveState(inact bool)
- func (nb *NodeBase) SetInactiveStateUpdt(inact bool)
- func (nb *NodeBase) SetInvisible()
- func (nb *NodeBase) SetInvisibleState(invis bool)
- func (nb *NodeBase) SetReRenderAnchor()
- func (nb *NodeBase) SetSelected()
- func (nb *NodeBase) SetSelectedState(sel bool)
- func (nb *NodeBase) StyleProps(selector string) ki.Props
- func (nb *NodeBase) WinBBoxInBBox(bbox image.Rectangle) bool
- type NodeFlags
- type ParamPrefs
- type PartsWidgetBase
- func (wb *PartsWidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (wb *PartsWidgetBase) ComputeBBox2DParts(parBBox image.Rectangle, delta image.Point)
- func (wb *PartsWidgetBase) ConfigPartsIconLabel(config *kit.TypeAndNameList, icnm string, txt string) (icIdx, lbIdx int)
- func (wb *PartsWidgetBase) ConfigPartsSetIconLabel(icnm string, txt string, icIdx, lbIdx int)
- func (wb *PartsWidgetBase) CopyFieldsFrom(frm interface{})
- func (wb *PartsWidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (wb *PartsWidgetBase) Layout2DParts(parBBox image.Rectangle, iter int)
- func (wb *PartsWidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (wb *PartsWidgetBase) PartsNeedUpdateIconLabel(icnm string, txt string) bool
- func (wb *PartsWidgetBase) Render2DParts()
- func (wb *PartsWidgetBase) SetFullReRenderIconLabel()
- func (wb *PartsWidgetBase) Size2D(iter int)
- func (wb *PartsWidgetBase) Size2DParts(iter int)
- func (wb *PartsWidgetBase) SizeFromParts(iter int)
- type Preferences
- func (pf *Preferences) Apply()
- func (pf *Preferences) ApplyDPI()
- func (pf *Preferences) DarkMode()
- func (pf *Preferences) Defaults()
- func (pf *Preferences) DeleteSavedWindowGeoms()
- func (pf *Preferences) EditDebug()
- func (pf *Preferences) EditDetailed()
- func (pf *Preferences) EditHiStyles()
- func (pf *Preferences) EditKeyMaps()
- func (pf *Preferences) IsDarkMode() bool
- func (pf *Preferences) LightMode()
- func (pf *Preferences) Open() error
- func (pf *Preferences) OpenColors(filename FileName) error
- func (pf *Preferences) PrefColor(clrName string) *gist.Color
- func (pf *Preferences) PrefFontFamily() string
- func (pf *Preferences) Save() error
- func (pf *Preferences) SaveColors(filename FileName) error
- func (pf *Preferences) SaveZoom(forCurrentScreen bool)
- func (pf *Preferences) ScreenInfo() string
- func (pf *Preferences) UpdateAll()
- func (pf *Preferences) UpdateUser()
- func (pf *Preferences) VersionInfo() string
- type PrefsDebug
- type PrefsDetailed
- type ProgressBar
- type Region2D
- type RegionMap2D
- type RowCol
- type ScreenPrefs
- type ScrollBar
- func (sb *ScrollBar) ConnectEvents2D()
- func (sb *ScrollBar) CopyFieldsFrom(frm interface{})
- func (sb *ScrollBar) Defaults()
- func (sb *ScrollBar) FocusChanged2D(change FocusChanges)
- func (sb *ScrollBar) Init2D()
- func (sb *ScrollBar) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sb *ScrollBar) Move2D(delta image.Point, parBBox image.Rectangle)
- func (sb *ScrollBar) Render2D()
- func (sb *ScrollBar) Render2DDefaultStyle()
- func (sb *ScrollBar) Size2D(iter int)
- func (sb *ScrollBar) Style2D()
- type Separator
- type Shortcuts
- type SliceLabeler
- type Slider
- func (sr *Slider) ConnectEvents2D()
- func (sr *Slider) CopyFieldsFrom(frm interface{})
- func (sr *Slider) Defaults()
- func (sr *Slider) FocusChanged2D(change FocusChanges)
- func (sr *Slider) Init2D()
- func (sr *Slider) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sr *Slider) Move2D(delta image.Point, parBBox image.Rectangle)
- func (sr *Slider) Render2D()
- func (sr *Slider) Render2DDefaultStyle()
- func (sr *Slider) Size2D(iter int)
- func (sr *Slider) Style2D()
- type SliderBase
- func (sb *SliderBase) ConfigParts()
- func (sb *SliderBase) ConfigPartsIfNeeded(render bool)
- func (sb *SliderBase) CopyFieldsFrom(frm interface{})
- func (sb *SliderBase) Defaults()
- func (sb *SliderBase) Disconnect()
- func (sb *SliderBase) EmitNewValue() bool
- func (sb *SliderBase) Init2DSlider()
- func (sb *SliderBase) KeyChordEvent()
- func (sb *SliderBase) KeyInput(kt *key.ChordEvent)
- func (sb *SliderBase) MouseDragEvent()
- func (sb *SliderBase) MouseEvent()
- func (sb *SliderBase) MouseFocusEvent()
- func (sb *SliderBase) MouseScrollEvent()
- func (sb *SliderBase) PointToRelPos(pt image.Point) image.Point
- func (sb *SliderBase) SetSliderPos(pos float32)
- func (sb *SliderBase) SetSliderState(state SliderStates)
- func (sb *SliderBase) SetThumbValue(val float32)
- func (sb *SliderBase) SetValue(val float32)
- func (sb *SliderBase) SetValueAction(val float32)
- func (sb *SliderBase) SizeFromAlloc()
- func (sb *SliderBase) SliderEnterHover()
- func (sb *SliderBase) SliderEvents()
- func (sb *SliderBase) SliderExitHover()
- func (sb *SliderBase) SliderMove(start, end float32)
- func (sb *SliderBase) SliderPress(pos float32)
- func (sb *SliderBase) SliderRelease()
- func (sb *SliderBase) SnapValue()
- func (sr *SliderBase) StyleFromProps(props ki.Props, vp *Viewport2D)
- func (sr *SliderBase) StyleSlider()
- func (sr *SliderBase) StyleToDots(uc *units.Context)
- func (sb *SliderBase) UpdatePosFromValue()
- func (sb *SliderBase) UpdateThumbValSize()
- type SliderPositioner
- type SliderSignals
- type SliderStates
- type Space
- type Spell
- func (sc *Spell) Cancel() bool
- func (sc *Spell) CheckWord(word string) ([]string, bool)
- func (sc *Spell) Disconnect()
- func (sc *Spell) IgnoreWord()
- func (sc *Spell) IsLastLearned(wrd string) bool
- func (sc *Spell) KeyInput(kf KeyFuns) bool
- func (sc *Spell) LearnWord()
- func (sc *Spell) SetWord(word string, sugs []string, srcLn, srcCh int)
- func (sc *Spell) Show(text string, vp *Viewport2D, pt image.Point)
- func (sc *Spell) ShowNow(word string, vp *Viewport2D, pt image.Point)
- func (sc *Spell) Spell(s string)
- func (sc *Spell) UnLearnLast()
- type SpellSignals
- type SpinBox
- func (sb *SpinBox) ConfigParts()
- func (sb *SpinBox) ConfigPartsIfNeeded()
- func (sb *SpinBox) ConnectEvents2D()
- func (sb *SpinBox) CopyFieldsFrom(frm interface{})
- func (sb *SpinBox) Defaults()
- func (sb *SpinBox) Disconnect()
- func (sb *SpinBox) FormatIsInt() bool
- func (sb *SpinBox) HasFocus2D() bool
- func (sb *SpinBox) IncrValue(steps float32)
- func (sb *SpinBox) Init2D()
- func (sb *SpinBox) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sb *SpinBox) MouseScrollEvent()
- func (sb *SpinBox) Render2D()
- func (sb *SpinBox) SetMax(max float32)
- func (sb *SpinBox) SetMin(min float32)
- func (sb *SpinBox) SetMinMax(hasMin bool, min float32, hasMax bool, max float32)
- func (sb *SpinBox) SetValue(val float32)
- func (sb *SpinBox) SetValueAction(val float32)
- func (sb *SpinBox) Size2D(iter int)
- func (sb *SpinBox) SpinBoxEvents()
- func (sb *SpinBox) StringToVal(str string) (float32, error)
- func (sb *SpinBox) Style2D()
- func (sb *SpinBox) StyleFromProps(props ki.Props, vp *Viewport2D)
- func (sb *SpinBox) StyleSpinBox()
- func (sb *SpinBox) TextFieldEvent()
- func (sb *SpinBox) ValToString(val float32) string
- type SplitView
- func (sv *SplitView) CollapseChild(save bool, idxs ...int)
- func (sv *SplitView) ConfigSplitters()
- func (sv *SplitView) ConnectEvents2D()
- func (sv *SplitView) CopyFieldsFrom(frm interface{})
- func (sv *SplitView) EvenSplits()
- func (sv *SplitView) HasFocus2D() bool
- func (sv *SplitView) Init2D()
- func (sv *SplitView) IsCollapsed(idx int) bool
- func (sv *SplitView) KeyChordEvent()
- func (sv *SplitView) KeyInput(kt *key.ChordEvent)
- func (sv *SplitView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sv *SplitView) Render2D()
- func (sv *SplitView) RestoreChild(idxs ...int)
- func (sv *SplitView) RestoreSplits()
- func (sv *SplitView) SaveSplits()
- func (sv *SplitView) SetSplitAction(idx int, nwval float32)
- func (sv *SplitView) SetSplits(splits ...float32)
- func (sv *SplitView) SetSplitsAction(splits ...float32)
- func (sv *SplitView) SetSplitsList(splits []float32)
- func (sv *SplitView) SplitViewEvents()
- func (sv *SplitView) Style2D()
- func (sv *SplitView) StyleSplitView()
- func (sv *SplitView) UpdateSplits()
- type Splitter
- func (sr *Splitter) ConfigPartsIfNeeded(render bool)
- func (sr *Splitter) ConnectEvents2D()
- func (sr *Splitter) Defaults()
- func (sr *Splitter) FocusChanged2D(change FocusChanges)
- func (sr *Splitter) Init2D()
- func (sr *Splitter) Layout2D(parBBox image.Rectangle, iter int) bool
- func (sr *Splitter) MouseEvent()
- func (sr *Splitter) MouseScrollEvent()
- func (sr *Splitter) PointToRelPos(pt image.Point) image.Point
- func (sr *Splitter) Render2D()
- func (sr *Splitter) RenderSplitter()
- func (sr *Splitter) Size2D(iter int)
- func (sr *Splitter) SplitView() *SplitView
- func (sr *Splitter) SplitterEvents()
- func (sr *Splitter) Style2D()
- func (sr *Splitter) UpdateSplitterPos()
- type Sprite
- func (sp *Sprite) ConnectEvent(recv ki.Ki, et oswin.EventType, fun ki.RecvFunc)
- func (sp *Sprite) DisconnectAllEvents()
- func (sp *Sprite) DisconnectEvent(recv ki.Ki, et oswin.EventType, fun ki.RecvFunc)
- func (sp *Sprite) GrabRenderFrom(nii Node2D)
- func (sp *Sprite) SetBottomPos(pos image.Point)
- func (sp *Sprite) SetSize(nwsz image.Point) bool
- type Sprites
- type Stretch
- type Stripes
- type StyleSheet
- type TabButton
- type TabView
- func (tv *TabView) AddNewTab(typ reflect.Type, label string) Node2D
- func (tv *TabView) AddNewTabAction(typ reflect.Type, label string) Node2D
- func (tv *TabView) AddNewTabFrame(typ reflect.Type, label string) (Node2D, *Frame)
- func (tv *TabView) AddNewTabLayout(typ reflect.Type, label string) (Node2D, *Layout)
- func (tv *TabView) AddTab(widg Node2D, label string) int
- func (tv *TabView) Config()
- func (tv *TabView) ConfigNewTabButton() bool
- func (tv *TabView) CopyFieldsFrom(frm interface{})
- func (tv *TabView) CurTab() (Node2D, int, bool)
- func (tv *TabView) DeleteTabIndex(idx int, destroy bool) (Node2D, string, bool)
- func (tv *TabView) DeleteTabIndexAction(idx int)
- func (tv *TabView) Disconnect()
- func (tv *TabView) Frame() *Frame
- func (tv *TabView) InsertNewTab(typ reflect.Type, label string, idx int) Node2D
- func (tv *TabView) InsertTab(widg Node2D, label string, idx int)
- func (tv *TabView) InsertTabOnlyAt(widg Node2D, label string, idx int)
- func (tv *TabView) NTabs() int
- func (tv *TabView) RecycleTab(label string, typ reflect.Type, sel bool) Node2D
- func (tv *TabView) Render2D()
- func (tv *TabView) RenderTabSeps()
- func (tv *TabView) RenumberTabs()
- func (tv *TabView) SelectTabByName(label string) Node2D
- func (tv *TabView) SelectTabByNameTry(label string) (Node2D, error)
- func (tv *TabView) SelectTabIndex(idx int) (Node2D, bool)
- func (tv *TabView) SelectTabIndexAction(idx int)
- func (tv *TabView) Style2D()
- func (tv *TabView) TabAtIndex(idx int) (Node2D, *TabButton, bool)
- func (tv *TabView) TabByName(label string) Node2D
- func (tv *TabView) TabByNameTry(label string) (Node2D, error)
- func (tv *TabView) TabIndexByName(label string) (int, error)
- func (tv *TabView) TabName(idx int) string
- func (tv *TabView) Tabs() *Frame
- func (tv *TabView) UnselectOtherTabs(idx int)
- type TabViewSignals
- type TextField
- func (tf *TextField) AutoScroll()
- func (tf *TextField) CancelComplete()
- func (tf *TextField) CharStartPos(charidx int, wincoords bool) mat32.Vec2
- func (tf *TextField) Clear()
- func (tf *TextField) ClearCursor()
- func (tf *TextField) ClearSelected()
- func (tf *TextField) CompleteExtend(s string)
- func (tf *TextField) CompleteText(s string)
- func (tf *TextField) ConfigParts()
- func (tf *TextField) ConnectEvents2D()
- func (tf *TextField) Copy(reset bool)
- func (tf *TextField) CopyFieldsFrom(frm interface{})
- func (tf *TextField) CursorBackspace(steps int)
- func (tf *TextField) CursorBackward(steps int)
- func (tf *TextField) CursorDelete(steps int)
- func (tf *TextField) CursorEnd()
- func (tf *TextField) CursorForward(steps int)
- func (tf *TextField) CursorKill()
- func (tf *TextField) CursorSprite() *Sprite
- func (tf *TextField) CursorStart()
- func (tf *TextField) Cut()
- func (tf *TextField) DeleteSelection() string
- func (tf *TextField) Disconnect()
- func (tf *TextField) EditDeFocused()
- func (tf *TextField) EditDone()
- func (tf *TextField) FocusChanged2D(change FocusChanges)
- func (tf *TextField) HandleMouseEvent(me *mouse.Event)
- func (tf *TextField) HasSelection() bool
- func (tf *TextField) Init2D()
- func (tf *TextField) InsertAtCursor(str string)
- func (tf *TextField) IsFocusActive() bool
- func (tf *TextField) IsWordBreak(r rune) bool
- func (tf *TextField) KeyChordEvent()
- func (tf *TextField) KeyInput(kt *key.ChordEvent)
- func (tf *TextField) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tf *TextField) MakeContextMenu(m *Menu)
- func (tf *TextField) MimeData(md *mimedata.Mimes)
- func (tf *TextField) MouseDragEvent()
- func (tf *TextField) MouseEvent()
- func (tf *TextField) MouseFocusEvent()
- func (tf *TextField) OfferComplete(forceComplete bool)
- func (tf *TextField) Paste()
- func (tf *TextField) PixelToCursor(pixOff float32) int
- func (tf *TextField) Render2D()
- func (tf *TextField) RenderCursor(on bool)
- func (tf *TextField) RenderSelect()
- func (tf *TextField) RenderTextField()
- func (tf *TextField) Revert()
- func (tf *TextField) ScrollLayoutToCursor() bool
- func (tf *TextField) SelectAll()
- func (tf *TextField) SelectModeToggle()
- func (tf *TextField) SelectRegUpdate(pos int)
- func (tf *TextField) SelectReset()
- func (tf *TextField) SelectUpdate()
- func (tf *TextField) SelectWord()
- func (tf *TextField) Selection() string
- func (tf *TextField) SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc)
- func (tf *TextField) SetCursorFromPixel(pixOff float32, selMode mouse.SelectModes)
- func (tf *TextField) SetText(txt string)
- func (tf *TextField) Size2D(iter int)
- func (tf *TextField) StartCharPos(idx int) float32
- func (tf *TextField) StartCursor()
- func (tf *TextField) StopCursor()
- func (tf *TextField) Style2D()
- func (tf *TextField) StyleTextField()
- func (tf *TextField) Text() string
- func (tf *TextField) TextFieldEvents()
- func (tf *TextField) TextWidth(st, ed int) float32
- func (tf *TextField) UpdateRenderAll() bool
- type TextFieldSignals
- type TextFieldStates
- type ToolBar
- func (tb *ToolBar) AddAction(opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
- func (tb *ToolBar) AddSeparator(sepnm string) *Separator
- func (tb *ToolBar) ConnectEvents2D()
- func (tb *ToolBar) CopyFieldsFrom(frm interface{})
- func (tb *ToolBar) DeleteShortcuts()
- func (tb *ToolBar) Destroy()
- func (tb *ToolBar) FindActionByName(name string) (*Action, bool)
- func (tb *ToolBar) MouseFocusEvent()
- func (tb *ToolBar) Render2D()
- func (tb *ToolBar) SetShortcuts()
- func (tb *ToolBar) ToolBarStdRender()
- func (tb *ToolBar) UpdateActions()
- type Transform3D
- type Updater
- type User
- type ViewIFace
- type Viewport
- type Viewport2D
- func NewViewport2D(width, height int) *Viewport2D
- func PopupMenu(menu Menu, x, y int, parVp *Viewport2D, name string) *Viewport2D
- func PopupTooltip(tooltip string, x, y int, parVp *Viewport2D, name string) *Viewport2D
- func StringsChooserPopup(strs []string, curSel string, recv Node2D, fun ki.RecvFunc) *Viewport2D
- func ValidViewport(avp *Viewport2D) *Viewport2D
- func (vp *Viewport2D) AsViewport2D() *Viewport2D
- func (vp *Viewport2D) BBox2D() image.Rectangle
- func (vp *Viewport2D) BlockUpdates()
- func (vp *Viewport2D) ChildrenBBox2D() image.Rectangle
- func (vp *Viewport2D) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (vp *Viewport2D) ContextColor() gist.Color
- func (vp *Viewport2D) ContextColorSpecByURL(url string) *gist.ColorSpec
- func (vp *Viewport2D) CopyFieldsFrom(frm interface{})
- func (vp *Viewport2D) DeletePopup()
- func (vp *Viewport2D) DrawIntoParent(parVp *Viewport2D)
- func (vp *Viewport2D) EncodePNG(w io.Writer) error
- func (vp *Viewport2D) FillViewport()
- func (vp *Viewport2D) FullReRenderIfNeeded() bool
- func (vp *Viewport2D) FullRender2DTree()
- func (vp *Viewport2D) Init2D()
- func (vp *Viewport2D) IsCompleter() bool
- func (vp *Viewport2D) IsCorrector() bool
- func (vp *Viewport2D) IsDoingFullRender() bool
- func (vp *Viewport2D) IsMenu() bool
- func (vp *Viewport2D) IsPopup() bool
- func (vp *Viewport2D) IsSVG() bool
- func (vp *Viewport2D) IsTooltip() bool
- func (vp *Viewport2D) IsUpdatingNode() bool
- func (vp *Viewport2D) IsVisible() bool
- func (vp *Viewport2D) Layout2D(parBBox image.Rectangle, iter int) bool
- func (vp *Viewport2D) Move2D(delta image.Point, parBBox image.Rectangle)
- func (vp *Viewport2D) NeedsFullRender() bool
- func (vp *Viewport2D) NodeUpdated(nii Node2D, sig int64, data interface{})
- func (vp *Viewport2D) PopBounds()
- func (vp *Viewport2D) PrefSize(initSz image.Point) image.Point
- func (vp *Viewport2D) PushBounds() bool
- func (vp *Viewport2D) ReRender2DAnchor(gni Node2D)
- func (vp *Viewport2D) ReRender2DNode(gni Node2D)
- func (vp *Viewport2D) Render2D()
- func (vp *Viewport2D) RenderViewport2D()
- func (vp *Viewport2D) Resize(nwsz image.Point)
- func (vp *Viewport2D) SavePNG(path string) error
- func (vp *Viewport2D) SetCurStyleNode(node Node2D)
- func (vp *Viewport2D) SetCurWin()
- func (vp *Viewport2D) SetCurrentColor(clr gist.Color)
- func (vp *Viewport2D) SetNeedsFullRender()
- func (vp *Viewport2D) Size2D(iter int)
- func (vp *Viewport2D) Style2D()
- func (vp *Viewport2D) UnblockUpdates()
- func (vp *Viewport2D) UpdateLevel(nii Node2D, sig int64, data interface{}) (anchor Node2D, full bool)
- func (vp *Viewport2D) UpdateNode(nii Node2D)
- func (vp *Viewport2D) UpdateNodes()
- func (vp *Viewport2D) VpEventMgr() *EventMgr
- func (vp *Viewport2D) VpIsVisible() bool
- func (vp *Viewport2D) VpTop() Viewport
- func (vp *Viewport2D) VpTopNode() Node
- func (vp *Viewport2D) VpTopUpdateEnd(updt bool)
- func (vp *Viewport2D) VpTopUpdateStart() bool
- func (vp *Viewport2D) VpUploadAll()
- func (vp *Viewport2D) VpUploadRegion(vpBBox, winBBox image.Rectangle)
- func (vp *Viewport2D) VpUploadVp()
- type VpFlags
- type WidgetBase
- func (wb *WidgetBase) AddParentPos() mat32.Vec2
- func (wb *WidgetBase) AsWidget() *WidgetBase
- func (wb *WidgetBase) BBox2D() image.Rectangle
- func (wb *WidgetBase) BBoxFromAlloc() image.Rectangle
- func (wb *WidgetBase) BoxSpace() float32
- func (wb *WidgetBase) ChildrenBBox2D() image.Rectangle
- func (wb *WidgetBase) ChildrenBBox2DWidget() image.Rectangle
- func (wb *WidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
- func (wb *WidgetBase) CopyFieldsFrom(frm interface{})
- func (wb *WidgetBase) Disconnect()
- func (wb *WidgetBase) EmitContextMenuSignal()
- func (wb *WidgetBase) EmitFocusedSignal()
- func (wb *WidgetBase) EmitSelectedSignal()
- func (wb *WidgetBase) FullReRenderIfNeeded() bool
- func (wb *WidgetBase) HoverTooltipEvent()
- func (wb *WidgetBase) Init2D()
- func (wb *WidgetBase) Init2DWidget()
- func (wb *WidgetBase) InitLayout2D() bool
- func (wb *WidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
- func (wb *WidgetBase) Layout2DBase(parBBox image.Rectangle, initStyle bool, iter int)
- func (wb *WidgetBase) MakeContextMenu(m *Menu)
- func (wb *WidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
- func (wb *WidgetBase) Move2DBase(delta image.Point, parBBox image.Rectangle)
- func (wb *WidgetBase) Move2DTree()
- func (wb *WidgetBase) ParentLayout() *Layout
- func (wb *WidgetBase) PopBounds()
- func (wb *WidgetBase) PushBounds() bool
- func (wb *WidgetBase) ReRender2DTree()
- func (wb *WidgetBase) Render2D()
- func (wb *WidgetBase) RenderBoxImpl(pos mat32.Vec2, sz mat32.Vec2, rad float32)
- func (wb *WidgetBase) RenderLock() (*girl.State, *girl.Paint, *gist.Style)
- func (wb *WidgetBase) RenderStdBox(st *gist.Style)
- func (wb *WidgetBase) RenderUnlock(rs *girl.State)
- func (wb *WidgetBase) Size2D(iter int)
- func (wb *WidgetBase) Size2DAddSpace()
- func (wb *WidgetBase) Size2DBase(iter int)
- func (wb *WidgetBase) Size2DFromWH(w, h float32)
- func (wb *WidgetBase) Size2DSubSpace() mat32.Vec2
- func (wb *WidgetBase) Style() *gist.Style
- func (wb *WidgetBase) Style2D()
- func (wb *WidgetBase) Style2DWidget()
- func (wb *WidgetBase) StylePart(pk Node2D)
- func (wb *WidgetBase) StyleRLock()
- func (wb *WidgetBase) StyleRUnlock()
- func (wb *WidgetBase) WidgetMouseEvents(sel, ctxtMenu bool)
- type WidgetSignals
- type WinEventRecv
- type WinEventRecvList
- type WinFlags
- type Window
- func NewDialogWin(name, title string, width, height int, modal bool) *Window
- func NewMainWindow(name, title string, width, height int) *Window
- func NewWindow(name, title string, opts *oswin.NewWindowOptions) *Window
- func RecycleDialogWin(data interface{}, name, title string, width, height int, modal bool) (*Window, bool)
- func RecycleMainWindow(data interface{}, name, title string, width, height int) (*Window, bool)
- func WindowInFocus() *Window
- func (w *Window) ActivateSprite(nm string)
- func (w *Window) AddDirectUploader(node Node2D) int
- func (w *Window) AddMainMenu() *MenuBar
- func (w *Window) AddShortcut(chord key.Chord, act *Action)
- func (w *Window) AddSprite(sp *Sprite)
- func (w *Window) BenchmarkFullRender()
- func (w *Window) BenchmarkReRender()
- func (w *Window) ClearDragNDrop()
- func (w *Window) ClearWinUpdating()
- func (w *Window) Close()
- func (w *Window) ClosePopup(pop ki.Ki) bool
- func (w *Window) CloseReq()
- func (w *Window) Closed()
- func (w *Window) ConfigSprites()
- func (w *Window) ConfigVLay()
- func (w *Window) CurPopup() ki.Ki
- func (w *Window) CurPopupIsTooltip() bool
- func (w *Window) DNDClearCursor()
- func (w *Window) DNDDropEvent(e *mouse.Event)
- func (w *Window) DNDMoveEvent(e *mouse.DragEvent)
- func (w *Window) DNDNotCursor()
- func (w *Window) DNDSetCursor(dmod dnd.DropMods)
- func (w *Window) DNDUpdateCursor(dmod dnd.DropMods) bool
- func (w *Window) DeleteDirectUploader(node Node2D)
- func (w *Window) DeleteShortcut(chord key.Chord, act *Action)
- func (w *Window) DeleteSprite(nm string) bool
- func (w *Window) DeleteTooltip()
- func (w *Window) DisconnectPopup(pop ki.Ki)
- func (w *Window) DrawSprites()
- func (w *Window) EventLoop()
- func (w *Window) EventTopNode() ki.Ki
- func (w *Window) EventTopUpdateEnd(updt bool)
- func (w *Window) EventTopUpdateStart() bool
- func (w *Window) FilterEvent(evi oswin.Event) bool
- func (w *Window) FinalizeDragNDrop(action dnd.DropMods)
- func (w *Window) FocusActiveClick(e *mouse.Event)
- func (w *Window) FocusInactivate()
- func (w *Window) FocusTopNode() ki.Ki
- func (w *Window) FullReRender()
- func (w *Window) GoStartEventLoop()
- func (w *Window) HasGeomPrefs() bool
- func (w *Window) HiPriorityEvents(evi oswin.Event) bool
- func (w *Window) InactivateAllSprites()
- func (w *Window) InactivateSprite(nm string)
- func (w *Window) InitialFocus()
- func (w *Window) IsClosed() bool
- func (w *Window) IsClosing() bool
- func (w *Window) IsFocusActive() bool
- func (w *Window) IsInScope(k ki.Ki, popup bool) bool
- func (w *Window) IsResizing() bool
- func (w *Window) IsVisible() bool
- func (w *Window) IsWinUpdating() bool
- func (w *Window) IsWindowInFocus() bool
- func (w *Window) KeyChordEventHiPri(e *key.ChordEvent) bool
- func (w *Window) KeyChordEventLowPri(e *key.ChordEvent) bool
- func (w *Window) LogicalDPI() float32
- func (w *Window) MainFrame() (*Frame, error)
- func (w *Window) MainMenuSet()
- func (w *Window) MainMenuUpdateActives()
- func (w *Window) MainMenuUpdateWindows()
- func (w *Window) MainMenuUpdated()
- func (w *Window) MainWidget() (ki.Ki, error)
- func (w *Window) Minimize()
- func (w *Window) NeedWinMenuUpdate() bool
- func (w *Window) PollEvents()
- func (w *Window) PopPopup(pop ki.Ki) bool
- func (w *Window) ProcessEvent(evi oswin.Event)
- func (w *Window) Publish()
- func (w *Window) PushPopup(pop ki.Ki)
- func (w *Window) Raise()
- func (w *Window) ReportWinNodes()
- func (w *Window) ResetUpdateRegions()
- func (w *Window) ResetUpdateRegionsImpl()
- func (w *Window) Resized(sz image.Point)
- func (w *Window) SelSpriteEvent(evi oswin.Event)
- func (w *Window) SendCustomEvent(data interface{})
- func (w *Window) SendShowEvent()
- func (w *Window) SendWinFocusEvent(act window.Actions)
- func (w *Window) SetCloseCleanFunc(fun func(win *Window))
- func (w *Window) SetCloseReqFunc(fun func(win *Window))
- func (w *Window) SetDelPopup(pop ki.Ki)
- func (w *Window) SetFocusActiveState(active bool)
- func (w *Window) SetMainFrame() *Frame
- func (w *Window) SetMainLayout() *Layout
- func (w *Window) SetMainWidget(mw ki.Ki)
- func (w *Window) SetMainWidgetType(typ reflect.Type, name string) ki.Ki
- func (w *Window) SetName(name string)
- func (w *Window) SetNextPopup(pop, focus ki.Ki)
- func (w *Window) SetPixSize(sz image.Point)
- func (w *Window) SetSize(sz image.Point)
- func (w *Window) SetTitle(name string)
- func (w *Window) SetWinUpdating()
- func (w *Window) ShouldDeletePopupMenu(pop ki.Ki, me *mouse.Event) bool
- func (w *Window) SpriteByName(nm string) (*Sprite, bool)
- func (w *Window) StartDragNDrop(src ki.Ki, data mimedata.Mimes, sp *Sprite)
- func (w *Window) StartEventLoop()
- func (w *Window) StopEventLoop()
- func (w *Window) TriggerShortcut(chord key.Chord) bool
- func (w *Window) UploadAllViewports()
- func (w *Window) UploadVp(vp *Viewport2D, offset image.Point)
- func (w *Window) UploadVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
- func (w *Window) WinViewport2D() *Viewport2D
- func (w *Window) ZoomDPI(steps int)
- type WindowDrawers
- func (wu *WindowDrawers) Add(node Node, winBBox image.Rectangle) (int, bool)
- func (wu *WindowDrawers) Delete(node Node)
- func (wu *WindowDrawers) DrawImages(drw *vdraw.Drawer)
- func (wu *WindowDrawers) Idx(idx int) int
- func (wu *WindowDrawers) Init()
- func (wu *WindowDrawers) Reset()
- func (wu *WindowDrawers) SetIdxRange(st, n int)
- func (wu *WindowDrawers) SetWinBBox(idx int, bbox image.Rectangle)
- type WindowGeom
- func (wg *WindowGeom) FitInSize(sz image.Point)
- func (wg *WindowGeom) Pos() image.Point
- func (wg *WindowGeom) ScalePos(fact float32)
- func (wg *WindowGeom) ScaleSize(fact float32)
- func (wg *WindowGeom) SetPos(ps image.Point)
- func (wg *WindowGeom) SetSize(sz image.Point)
- func (wg *WindowGeom) Size() image.Point
- type WindowGeomPrefs
- func (wg *WindowGeomPrefs) DeleteAll()
- func (wg *WindowGeomPrefs) LockFile() error
- func (wg *WindowGeomPrefs) NeedToReload() bool
- func (wg *WindowGeomPrefs) Open() error
- func (wg *WindowGeomPrefs) Pref(winName string, scrn *oswin.Screen) *WindowGeom
- func (wg *WindowGeomPrefs) RecordPref(win *Window)
- func (wg *WindowGeomPrefs) Save() error
- func (wg *WindowGeomPrefs) SaveLastSave()
- func (wg *WindowGeomPrefs) UnlockFile()
- type WindowList
- func (wl *WindowList) Add(w *Window)
- func (wl *WindowList) Delete(w *Window) bool
- func (wl *WindowList) FindData(data interface{}) (*Window, bool)
- func (wl *WindowList) FindName(name string) (*Window, bool)
- func (wl *WindowList) FindOSWin(osw oswin.Window) (*Window, bool)
- func (wl *WindowList) FocusNext() (*Window, int)
- func (wl *WindowList) Focused() (*Window, int)
- func (wl *WindowList) Len() int
- func (wl *WindowList) Win(idx int) *Window
- type WindowUpdates
- func (wu *WindowUpdates) Add(winBBox image.Rectangle, vp *Viewport2D) (int, bool)
- func (wu *WindowUpdates) DrawImages(drw *vdraw.Drawer, beforeDir bool)
- func (wu *WindowUpdates) Idx(idx int) int
- func (wu *WindowUpdates) Init()
- func (wu *WindowUpdates) MoveIdxToBeforeDir(idx int)
- func (wu *WindowUpdates) MoveIdxToTop(idx int)
- func (wu *WindowUpdates) Reset()
- func (wu *WindowUpdates) SetIdxRange(st, n int)
Constants ¶
const ( AddOk = true NoOk = false AddCancel = true NoCancel = false )
Dialog Ok, Cancel options
const ( // Popups means include popups Popups = true // NoPopups means exclude popups NoPopups = false )
const ( X = mat32.X Y = mat32.Y )
const ( Version = "v1.3.1" GitCommit = "a5f83fdd" // the commit JUST BEFORE the release VersionDate = "2022-06-05 11:38" // UTC )
const ( // MaxDirectUploads are direct GPU texture transfer sources MaxDirectUploads = 7 // MaxPopups is the maximum number of viewport regions // updated directly from popups MaxPopups = 8 // Where region updates start (start of Set 1) -- 16 RegionUpdateStart = 1 + MaxDirectUploads + MaxPopups // Full set of region updates in set = 1 MaxRegionUpdates = 16 // Sprites are stored as arrays of same-sized textures, // allocated by size in Set 2, starting at 32 SpriteStart = RegionUpdateStart + MaxRegionUpdates // Full set of sprite textures in set = 2 MaxSpriteTextures = 16 // Allocate 128 layers within each sprite size MaxSpritesPerTexture = 128 )
These constants define use of Texture images in vdraw.Drawer for updating the window efficiently. They are allocated in sets of 16: Set 0: 0 = main viewport, DirectUploads, Popups Set 1: 16 region update images Set 2: 16 sprite arrays with 128 allocated per size
const DNDSpriteName = "gi.Window:DNDSprite"
Variables ¶
var ( // EventSkipLagMSec is the number of milliseconds of lag between the time the // event was sent to the time it is being processed, above which a repeated // event type (scroll, drag, resize) is skipped EventSkipLagMSec = 50 // FilterLaggyKeyEvents -- set to true to apply laggy filter to KeyEvents // (normally excluded) FilterLaggyKeyEvents = false // DragStartMSec is the number of milliseconds to wait before initiating a // regular mouse drag event (as opposed to a basic mouse.Press) DragStartMSec = 50 // DragStartPix is the number of pixels that must be moved before // initiating a regular mouse drag event (as opposed to a basic mouse.Press) DragStartPix = 4 // DNDStartMSec is the number of milliseconds to wait before initiating a // drag-n-drop event -- gotta drag it like you mean it DNDStartMSec = 200 // DNDStartPix is the number of pixels that must be moved before // initiating a drag-n-drop event -- gotta drag it like you mean it DNDStartPix = 20 // HoverStartMSec is the number of milliseconds to wait before initiating a // hover event (e.g., for opening a tooltip) HoverStartMSec = 1000 // HoverMaxPix is the maximum number of pixels that mouse can move and still // register a Hover event HoverMaxPix = 5 // LocalMainMenu controls whether the main menu is displayed locally at top of // each window, in addition to the global menu at the top of the screen. Mac // native apps do not do this, but OTOH it makes things more consistent with // other platforms, and with larger screens, it can be convenient to have // access to all the menu items right there. Controlled by Prefs.Params // variable. LocalMainMenu = false // WinEventTrace reports a trace of window events to stdout // can be set in PrefsDebug from prefs gui // excludes mouse move events WinEventTrace = false // WinPublishTrace reports the stack trace leading up to win publish events // which are expensive -- wrap multiple updates in UpdateStart / End // to prevent // can be set in PrefsDebug from prefs gui WinPublishTrace = false // WinDrawTrace highlights the window regions that are drawn to update // the window, using filled colored rectangles WinDrawTrace = false // KeyEventTrace reports a trace of keyboard events to stdout // can be set in PrefsDebug from prefs gui KeyEventTrace = false // EventTrace reports a trace of event handing to stdout. // can be set in PrefsDebug from prefs gui EventTrace = false // WinNewCloseTime records last time a new window was opened or another // closed -- used to trigger updating of Window menus on each window. WinNewCloseTime time.Time // WindowGlobalMu is a mutex for any global state associated with windows WindowGlobalMu sync.Mutex // WindowOpenTimer is used for profiling the open time of windows // if doing profiling, it will report the time elapsed in msec // to point of establishing initial focus in the window. WindowOpenTimer time.Time )
var ActionProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(0), "border-radius": units.NewPx(0), "border-color": &Prefs.Colors.Border, "text-align": gist.AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "padding": units.NewPx(2), "margin": units.NewPx(2), "min-width": units.NewEm(1), "min-height": units.NewEm(1), "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#space": ki.Props{ "width": units.NewCh(.5), "min-width": units.NewCh(.5), }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, "#shortcut": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#sc-stretch": ki.Props{ "min-width": units.NewCh(2), }, ".menu-action": ki.Props{ "padding": units.NewPx(2), "margin": units.NewPx(0), "max-width": -1, "indicator": "wedge-right", ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "lighter-0", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "highlight-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "highlight-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }, ".menubar-action": ki.Props{ "padding": units.NewPx(4), "margin": units.NewPx(0), "indicator": "none", "border-width": units.NewPx(0), ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }, ".toolbar-action": ki.Props{ "padding": units.NewPx(4), "margin": units.NewPx(0), "indicator": "none", "border-width": units.NewPx(0.5), ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }, ".": ki.Props{ ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }, }
var AutoScrollRate = float32(1.0)
AutoScrollRate determines the rate of auto-scrolling of layouts
var AvailKeyMapsChanged = false
AvailKeyMapsChanged is used to update giv.KeyMapsView toolbars via following menu, toolbar props update methods -- not accurate if editing any other map but works for now..
var BitmapProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "background-color": &Prefs.Colors.Background, "ToolBar": ki.PropSlice{ {"OpenImage", ki.Props{ "desc": "Open an image for this bitmap. if width and/or height is > 0, then image is rescaled to that dimension, preserving aspect ratio if other one is not set", "icon": "file-open", "Args": ki.PropSlice{ {"File Name", ki.Props{ "default-field": "Filename", "ext": ".png,.jpg", }}, {"Width", ki.Props{ "desc": "width in raw display dots -- use image size if 0", }}, {"Height", ki.Props{ "desc": "height in raw display dots -- use image size if 0", }}, }, }}, }, }
var ButtonBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_ButtonFlags, }
var ButtonBoxProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(2), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(2), "margin": units.NewPx(2), "text-align": gist.AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, }
var ButtonProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(4), "margin": units.NewPx(2), "min-width": units.NewEm(1), "min-height": units.NewEm(1), "text-align": gist.AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#space": ki.Props{ "width": units.NewCh(.5), "min-width": units.NewCh(.5), }, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }
var ButtonSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":selected"}
Style selector names for the different states: https://www.w3schools.com/cssref/css_selectors.asp
var CheckBoxProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "icon": "checked-box", "icon-off": "unchecked-box", "text-align": gist.AlignLeft, "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Control, "margin": units.NewPx(1), "padding": units.NewPx(1), "border-width": units.NewPx(0), "#icon0": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "background-color": color.Transparent, "fill": &Prefs.Colors.Control, "stroke": &Prefs.Colors.Font, }, "#icon1": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "background-color": color.Transparent, "fill": &Prefs.Colors.Control, "stroke": &Prefs.Colors.Font, }, "#space": ki.Props{ "width": units.NewCh(0.1), }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "lighter-0", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "highlight-10", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "highlight-30", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }
var ColorPrefsProps = ki.Props{ "ToolBar": ki.PropSlice{ {"OpenJSON", ki.Props{ "label": "Open...", "icon": "file-open", "desc": "open set of colors from a json-formatted file", "Args": ki.PropSlice{ {"Color File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SaveJSON", ki.Props{ "label": "Save As...", "desc": "Saves colors to JSON formatted file.", "icon": "file-save", "Args": ki.PropSlice{ {"Color File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SetToPrefs", ki.Props{ "desc": "Sets this color scheme as the current active color scheme in Prefs.", "icon": "reset", }}, }, }
ColorPrefsProps defines the ToolBar
var ComboBoxProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(4), "margin": units.NewPx(4), "text-align": gist.AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#text": ki.Props{ "margin": units.NewPx(1), "padding": units.NewPx(1), "max-width": -1, "width": units.NewCh(12), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", "color": "highlight-90", }, }
var CompleteMaxItems = 25
CompleteMaxItems is the max number of items to display in completer popup
var CompleteWaitMSec = 500
CompleteWaitMSec is the number of milliseconds to wait before showing the completion menu
var CurIconList []IconName
CurIconList holds the current icon list, alpha sorted -- set at startup
var CursorBlinkMSec = 500
CursorBlinkMSec is number of milliseconds that cursor blinks on and off -- set to 0 to disable blinking
var CustomAppMenuFunc = (func(m *Menu, win *Window))(nil)
CustomAppMenuFunc is a function called by AddAppMenu after the AddStdAppMenu is called -- apps can set this function to add / modify / etc the menu
var DNDTrace = false
DNDTrace can be set to true to get a trace of the DND process
var DefaultKeyMap = KeyMapName("MacEmacs")
DefaultKeyMap is the overall default keymap -- reinitialized in gimain init() depending on platform
var DefaultPaths = FavPaths{
{"home", "home", "~"},
{"desktop", "Desktop", "~/Desktop"},
{"documents", "Documents", "~/Documents"},
{"folder-download", "Downloads", "~/Downloads"},
{"computer", "root", "/"},
}
DefaultPaths are default favorite paths
var DialogProps = ki.Props{ "EnumType:Flag": KiT_VpFlags, "color": &Prefs.Colors.Font, "#frame": ki.Props{ "border-width": units.NewPx(2), "margin": units.NewPx(8), "padding": units.NewPx(4), "box-shadow.h-offset": units.NewPx(4), "box-shadow.v-offset": units.NewPx(4), "box-shadow.blur": units.NewPx(4), "box-shadow.color": &Prefs.Colors.Shadow, }, "#title": ki.Props{ "max-width": units.NewPx(-1), "horizontal-align": gist.AlignCenter, "vertical-align": gist.AlignTop, "background-color": "none", "font-size": "large", }, "#prompt": ki.Props{ "white-space": gist.WhiteSpaceNormal, "max-width": -1, "width": units.NewCh(30), "text-align": gist.AlignLeft, "vertical-align": gist.AlignTop, "background-color": "none", }, }
var DialogsSepWindow = true
DialogsSepWindow determines if dialog windows open in a separate OS-level window, or do they open within the same parent window. If only within parent window, then they are always effectively modal.
var FileViewEditPaths = "<i>Edit Paths...</i>"
FileViewEditPaths defines a string that is added as an item to the recents menu
var FileViewResetPaths = "<i>Reset Paths</i>"
FileViewResetPaths defines a string that is added as an item to the recents menu
var FocusWindows []string
FocusWindows is a "recents" stack of window names that have focus when a window gets focus, it pops to the top of this list when a window is closed, it is removed from the list, and the top item on the list gets focused.
var FrameProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(2), "border-radius": units.NewPx(0), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(2), "margin": units.NewPx(2), "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Background, }
var IconProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "background-color": color.Transparent, }
var KeyMapsProps = ki.Props{ "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"OpenPrefs", ki.Props{}}, {"SavePrefs", ki.Props{ "shortcut": KeyFunMenuSave, "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveState(AvailKeyMapsChanged && kmi.(*KeyMaps) == &AvailKeyMaps) }, }}, {"sep-file", ki.BlankProp{}}, {"OpenJSON", ki.Props{ "label": "Open from file", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "shortcut": KeyFunMenuOpen, "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SaveJSON", ki.Props{ "label": "Save to file", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "shortcut": KeyFunMenuSaveAs, "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"RevertToStd", ki.Props{ "desc": "This reverts the keymaps to using the StdKeyMaps that are compiled into the program and have all the lastest key functions defined. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. <b>Your current map edits will be lost if you proceed!</b> Continue?", "confirm": true, }}, }}, {"Edit", "Copy Cut Paste Dupe"}, {"Window", "Windows"}, }, "ToolBar": ki.PropSlice{ {"SavePrefs", ki.Props{ "desc": "saves KeyMaps to GoGi standard prefs directory, in file key_maps_prefs.json, which will be loaded automatically at startup if prefs SaveKeyMaps is checked (should be if you're using custom keymaps)", "icon": "file-save", "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveState(AvailKeyMapsChanged && kmi.(*KeyMaps) == &AvailKeyMaps) }, }}, {"sep-file", ki.BlankProp{}}, {"OpenJSON", ki.Props{ "label": "Open from file", "icon": "file-open", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"SaveJSON", ki.Props{ "label": "Save to file", "icon": "file-save", "desc": "You can save and open key maps to / from files to share, experiment, transfer, etc", "Args": ki.PropSlice{ {"File Name", ki.Props{ "ext": ".json", }}, }, }}, {"sep-std", ki.BlankProp{}}, {"ViewStd", ki.Props{ "desc": "Shows the standard maps that are compiled into the program and have all the lastest key functions bound to standard key chords. Useful for comparing against custom maps.", "confirm": true, "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveStateUpdt(kmi.(*KeyMaps) != &StdKeyMaps) }, }}, {"RevertToStd", ki.Props{ "icon": "update", "desc": "This reverts the keymaps to using the StdKeyMaps that are compiled into the program and have all the lastest key functions bound to standard key chords. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. <b>Your current map edits will be lost if you proceed!</b> Continue?", "confirm": true, "updtfunc": func(kmi interface{}, act *Action) { act.SetActiveStateUpdt(kmi.(*KeyMaps) != &StdKeyMaps) }, }}, }, }
KeyMapsProps define the ToolBar and MenuBar for TableView of KeyMaps, e.g., giv.KeyMapsView
var KiT_Action = kit.Types.AddType(&Action{}, ActionProps)
var KiT_Bitmap = kit.Types.AddType(&Bitmap{}, BitmapProps)
var KiT_Button = kit.Types.AddType(&Button{}, ButtonProps)
var KiT_ButtonBase = kit.Types.AddType(&ButtonBase{}, ButtonBaseProps)
var KiT_ButtonBox = kit.Types.AddType(&ButtonBox{}, ButtonBoxProps)
var KiT_ButtonFlags = kit.Enums.AddEnumExt(KiT_NodeFlags, ButtonFlagsN, kit.BitFlag, nil)
var KiT_ButtonStates = kit.Enums.AddEnumAltLower(ButtonStatesN, kit.NotBitFlag, gist.StylePropProps, "Button")
var KiT_CheckBox = kit.Types.AddType(&CheckBox{}, CheckBoxProps)
var KiT_ColorPrefs = kit.Types.AddType(&ColorPrefs{}, ColorPrefsProps)
var KiT_ComboBox = kit.Types.AddType(&ComboBox{}, ComboBoxProps)
var KiT_Complete = kit.Types.AddType(&Complete{}, nil)
var KiT_Dialog = kit.Types.AddType(&Dialog{}, DialogProps)
var KiT_Frame = kit.Types.AddType(&Frame{}, FrameProps)
var KiT_Gradient = kit.Types.AddType(&Gradient{}, nil)
var KiT_Icon = kit.Types.AddType(&Icon{}, IconProps)
var KiT_KeyFuns = kit.Enums.AddEnumAltLower(KeyFunsN, kit.NotBitFlag, gist.StylePropProps, "KeyFun")
var KiT_KeyMaps = kit.Types.AddType(&KeyMaps{}, KeyMapsProps)
var KiT_Label = kit.Types.AddType(&Label{}, LabelProps)
var KiT_LabelStates = kit.Enums.AddEnumAltLower(LabelStatesN, kit.NotBitFlag, gist.StylePropProps, "Label")
var KiT_Layout = kit.Types.AddType(&Layout{}, LayoutProps)
var KiT_Layouts = kit.Enums.AddEnumAltLower(LayoutsN, kit.NotBitFlag, gist.StylePropProps, "Layout")
var KiT_MenuBar = kit.Types.AddType(&MenuBar{}, MenuBarProps)
var KiT_MenuButton = kit.Types.AddType(&MenuButton{}, MenuButtonProps)
var KiT_MetaData2D = kit.Types.AddType(&MetaData2D{}, nil)
var KiT_Node2DBase = kit.Types.AddType(&Node2DBase{}, Node2DBaseProps)
var KiT_NodeBase = kit.Types.AddType(&NodeBase{}, NodeBaseProps)
var KiT_NodeFlags = kit.Enums.AddEnumExt(ki.KiT_Flags, NodeFlagsN, kit.BitFlag, nil)
var KiT_PartsWidgetBase = kit.Types.AddType(&PartsWidgetBase{}, PartsWidgetBaseProps)
var KiT_Preferences = kit.Types.AddType(&Preferences{}, PreferencesProps)
var KiT_PrefsDebug = kit.Types.AddType(&PrefsDebug{}, PrefsDebugProps)
var KiT_PrefsDetailed = kit.Types.AddType(&PrefsDetailed{}, PrefsDetailedProps)
var KiT_ProgressBar = kit.Types.AddType(&ProgressBar{}, ProgressBarProps)
var KiT_RowCol = kit.Enums.AddEnumAltLower(RowColN, kit.NotBitFlag, gist.StylePropProps, "")
var KiT_ScrollBar = kit.Types.AddType(&ScrollBar{}, ScrollBarProps)
var KiT_Separator = kit.Types.AddType(&Separator{}, SeparatorProps)
var KiT_Slider = kit.Types.AddType(&Slider{}, SliderProps)
var KiT_SliderBase = kit.Types.AddType(&SliderBase{}, SliderBaseProps)
var KiT_Space = kit.Types.AddType(&Space{}, SpaceProps)
var KiT_Spell = kit.Types.AddType(&Spell{}, nil)
var KiT_SpinBox = kit.Types.AddType(&SpinBox{}, SpinBoxProps)
var KiT_SplitView = kit.Types.AddType(&SplitView{}, SplitViewProps)
var KiT_Splitter = kit.Types.AddType(&Splitter{}, SplitterProps)
var KiT_Stretch = kit.Types.AddType(&Stretch{}, StretchProps)
var KiT_Stripes = kit.Enums.AddEnumAltLower(StripesN, kit.NotBitFlag, gist.StylePropProps, "Stripes")
var KiT_StyleSheet = kit.Types.AddType(&StyleSheet{}, nil)
var KiT_TabButton = kit.Types.AddType(&TabButton{}, TabButtonProps)
var KiT_TabView = kit.Types.AddType(&TabView{}, TabViewProps)
var KiT_TextField = kit.Types.AddType(&TextField{}, TextFieldProps)
var KiT_ToolBar = kit.Types.AddType(&ToolBar{}, ToolBarProps)
var KiT_Viewport2D = kit.Types.AddType(&Viewport2D{}, Viewport2DProps)
var KiT_VpFlags = kit.Enums.AddEnumExt(KiT_NodeFlags, VpFlagsN, kit.BitFlag, nil)
var KiT_WidgetBase = kit.Types.AddType(&WidgetBase{}, WidgetBaseProps)
var KiT_WinFlags = kit.Enums.AddEnumExt(KiT_NodeFlags, WinFlagsN, kit.BitFlag, nil)
var KiT_Window = kit.Types.AddType(&Window{}, WindowProps)
var LabelProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "white-space": gist.WhiteSpacePre, "padding": units.NewPx(2), "margin": units.NewPx(2), "vertical-align": gist.AlignTop, "color": &Prefs.Colors.Font, "background-color": color.Transparent, LabelSelectors[LabelActive]: ki.Props{ "background-color": color.Transparent, }, LabelSelectors[LabelInactive]: ki.Props{ "color": "lighter-50", }, LabelSelectors[LabelSelected]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }
var LabelSelectors = []string{":active", ":inactive", ":selected"}
LabelSelectors are Style selector names for the different states:
var Layout2DTrace bool = false
Layout2DTrace reports a trace of all layouts (just printfs to stdout) -- can be set in PrefsDebug from prefs gui
var LayoutAutoScrollDelayMSec = 25
LayoutAutoScrollDelayMSec is amount of time to wait (in Milliseconds) before trying to autoscroll again
var LayoutFocusNameTabMSec = 2000
LayoutFocusNameTabMSec is the number of milliseconds since last focus name event to allow tab to focus on next element with same name.
var LayoutFocusNameTimeoutMSec = 500
LayoutFocusNameTimeoutMSec is the number of milliseconds between keypresses to combine characters into name to search for within layout -- starts over after this delay.
var LayoutLastAutoScroll time.Time
var LayoutPageSteps = 10
LayoutPageSteps is the number of steps to take in PageUp / Down events in terms of number of items.
var LayoutPrefMaxCols = 20
LayoutPrefMaxCols is maximum number of columns to use in a grid layout when computing the preferred size (VpFlagPrefSizing)
var LayoutPrefMaxRows = 20
LayoutPrefMaxRows is maximum number of rows to use in a grid layout when computing the preferred size (VpFlagPrefSizing)
var LayoutProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, }
var MenuBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(2), "margin": units.NewPx(0), "spacing": units.NewPx(4), "color": &Prefs.Colors.Font, "background-color": "linear-gradient(pref(Control), highlight-10)", }
var MenuButtonProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "border-style": gist.BorderSolid, "padding": units.NewPx(4), "margin": units.NewPx(4), "box-shadow.color": &Prefs.Colors.Shadow, "text-align": gist.AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#indicator": ki.Props{ "width": units.NewEx(1.5), "height": units.NewEx(1.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignBottom, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#ind-stretch": ki.Props{ "width": units.NewEm(1), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "highlight-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }
var MenuFrameProps = ki.Props{ "border-width": units.NewPx(0), "border-color": "none", "margin": units.NewPx(4), "padding": units.NewPx(2), "box-shadow.h-offset": units.NewPx(2), "box-shadow.v-offset": units.NewPx(2), "box-shadow.blur": units.NewPx(2), "box-shadow.color": &Prefs.Colors.Shadow, }
var MenuMaxHeight = 30
MenuMaxHeight is the maximum height of any menu popup panel in units of font height scroll bars are enforced beyond that size.
var MenuTextSeparator = "-------------"
Separator defines a string to indicate a menu separator item
var Node2DBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var NodeBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var PartsWidgetBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var PreferencesProps = ki.Props{ "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"UpdateAll", ki.Props{}}, {"Open", ki.Props{ "shortcut": KeyFunMenuOpen, }}, {"Save", ki.Props{ "shortcut": KeyFunMenuSave, "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*Preferences) act.SetActiveState(pf.Changed) }, }}, {"sep-color", ki.BlankProp{}}, {"LightMode", ki.Props{}}, {"DarkMode", ki.Props{}}, {"sep-misc", ki.BlankProp{}}, {"SaveZoom", ki.Props{ "desc": "Save current zoom magnification factor, either for all screens or for the current screen only", "Args": ki.PropSlice{ {"For Current Screen Only?", ki.Props{ "desc": "click this to save zoom specifically for current screen", }}, }, }}, {"DeleteSavedWindowGeoms", ki.Props{ "confirm": true, "desc": "Are you <i>sure</i>? This deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't generally need to do this but sometimes it is useful for testing or windows are showing up in bad places that you can't recover from.", }}, {"sep-close", ki.BlankProp{}}, {"Close Window", ki.BlankProp{}}, }}, {"Edit", "Copy Cut Paste"}, {"Window", "Windows"}, }, "ToolBar": ki.PropSlice{ {"UpdateAll", ki.Props{ "desc": "Updates all open windows with current preferences -- triggers rebuild of default styles.", "icon": "update", }}, {"sep-file", ki.BlankProp{}}, {"Save", ki.Props{ "desc": "Saves current preferences to standard prefs.json file, which is auto-loaded at startup.", "icon": "file-save", "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*Preferences) act.SetActiveStateUpdt(pf.Changed) }, }}, {"sep-color", ki.BlankProp{}}, {"LightMode", ki.Props{ "desc": "Set color mode to Light mode as defined in ColorSchemes -- automatically does Save and UpdateAll ", "icon": "color", }}, {"DarkMode", ki.Props{ "desc": "Set color mode to Dark mode as defined in ColorSchemes -- automatically does Save and UpdateAll", "icon": "color", }}, {"sep-scrn", ki.BlankProp{}}, {"SaveZoom", ki.Props{ "icon": "zoom-in", "desc": "Save current zoom magnification factor, either for all screens or for the current screen only", "Args": ki.PropSlice{ {"For Current Screen Only?", ki.Props{ "desc": "click this to save zoom specifically for current screen", }}, }, }}, {"ScreenInfo", ki.Props{ "desc": "shows parameters about all the active screens", "icon": "info", "show-return": true, }}, {"VersionInfo", ki.Props{ "desc": "shows current GoGi version information", "icon": "info", "show-return": true, }}, {"sep-key", ki.BlankProp{}}, {"EditKeyMaps", ki.Props{ "icon": "keyboard", "desc": "opens the KeyMapsView editor to create new keymaps / save / load from other files, etc. Current keymaps are saved and loaded with preferences automatically if SaveKeyMaps is clicked (will be turned on automatically if you open this editor).", }}, {"EditHiStyles", ki.Props{ "icon": "file-binary", "desc": "opens the HiStylesView editor of highlighting styles.", }}, {"EditDetailed", ki.Props{ "icon": "file-binary", "desc": "opens the PrefsDetView editor to edit detailed params that are not typically user-modified, but can be if you really care.. Turns on the SaveDetailed flag so these will be saved and loaded automatically -- can toggle that back off if you don't actually want to.", }}, {"EditDebug", ki.Props{ "icon": "file-binary", "desc": "Opens the PrefsDbgView editor to control debugging parameters. These are not saved -- only set dynamically during running.", }}, }, }
PreferencesProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsView
var Prefs = Preferences{}
Prefs are the overall preferences
var PrefsDbg = PrefsDebug{}
PrefsDbg are the overall debugging preferences
var PrefsDebugProps = ki.Props{ "ToolBar": ki.PropSlice{ {"Profile", ki.Props{ "desc": "Toggle profiling of program on or off -- does both targeted and global CPU and Memory profiling.", "icon": "update", }}, }, }
PrefsDebugProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsDbgView
var PrefsDet = PrefsDetailed{}
PrefsDet are the overall detailed preferences
var PrefsDetailedFileName = "prefs_det.json"
PrefsDetailedFileName is the name of the detailed preferences file in GoGi prefs directory
var PrefsDetailedProps = ki.Props{ "MainMenu": ki.PropSlice{ {"AppMenu", ki.BlankProp{}}, {"File", ki.PropSlice{ {"Apply", ki.Props{}}, {"Open", ki.Props{ "shortcut": KeyFunMenuOpen, }}, {"Save", ki.Props{ "shortcut": KeyFunMenuSave, "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*PrefsDetailed) act.SetActiveState(pf.Changed) }, }}, {"Close Window", ki.BlankProp{}}, }}, {"Edit", "Copy Cut Paste"}, {"Window", "Windows"}, }, "ToolBar": ki.PropSlice{ {"Apply", ki.Props{ "desc": "Apply parameters to affect actual behavior.", "icon": "update", }}, {"sep-file", ki.BlankProp{}}, {"Save", ki.Props{ "desc": "Saves current preferences to standard prefs_det.json file, which is auto-loaded at startup.", "icon": "file-save", "updtfunc": func(pfi interface{}, act *Action) { pf := pfi.(*PrefsDetailed) act.SetActiveStateUpdt(pf.Changed) }, }}, }, }
PrefsDetailedProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsDetView
var PrefsFileName = "prefs.json"
PrefsFileName is the name of the preferences file in GoGi prefs directory
var PrefsKeyMapsFileName = "key_maps_prefs.json"
PrefsKeyMapsFileName is the name of the preferences file in GoGi prefs directory for saving / loading the default AvailKeyMaps key maps list
var ProgressBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(0), "margin": units.NewPx(2), "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, SliderSelectors[SliderActive]: ki.Props{ "background-color": "lighter-0", }, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "highlight-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var Render2DTrace bool = false
Render2DTrace reports a trace of the nodes rendering (just printfs to stdout) -- can be set in PrefsDebug from prefs gui
var SavedPathsExtras = []string{MenuTextSeparator, FileViewResetPaths, FileViewEditPaths}
SavedPathsExtras are the reset and edit items we add to the recents menu
var SavedPathsFileName = "saved_paths.json"
SavedPathsFileName is the name of the saved file paths file in GoGi prefs directory
var ScrollBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(0), "margin": units.NewPx(2), "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, SliderSelectors[SliderActive]: ki.Props{ "background-color": "lighter-0", }, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "highlight-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var SeparatorProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(0), "margin": units.NewPx(0), "vertical-align": gist.AlignCenter, "horizontal-align": gist.AlignCenter, "border-color": &Prefs.Colors.Border, "border-width": units.NewPx(2), "background-color": &Prefs.Colors.Control, }
var SliderBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var SliderMinThumbSize = float32(8)
SliderMinThumbSize is the minimum thumb size, even if computed value would make it smaller
var SliderProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "border-radius": units.NewPx(4), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(6), "margin": units.NewPx(4), "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, SliderSelectors[SliderActive]: ki.Props{ "background-color": "lighter-0", }, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{ "background-color": "highlight-20", }, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var SliderSelectors = []string{":active", ":inactive", ":hover", ":focus", ":down", ":value", ":box"}
SliderSelectors are Style selector names for the different states
var SpaceProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "width": units.NewCh(1), "height": units.NewEm(1), }
var SpinBoxProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "#buttons": ki.Props{ "vertical-align": gist.AlignMiddle, }, "#up": ki.Props{ "max-width": units.NewEx(1.5), "max-height": units.NewEx(1.5), "margin": units.NewPx(1), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#down": ki.Props{ "max-width": units.NewEx(1.5), "max-height": units.NewEx(1.5), "margin": units.NewPx(1), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#space": ki.Props{ "width": units.NewCh(.1), }, "#text-field": ki.Props{ "min-width": units.NewCh(4), "width": units.NewCh(8), "margin": units.NewPx(2), "padding": units.NewPx(2), "clear-act": false, }, }
var SplitViewProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "handle-size": units.NewPx(10), "max-width": -1.0, "max-height": -1.0, "margin": 0, "padding": 0, }
var SplitterProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(6), "margin": units.NewPx(0), "background-color": &Prefs.Colors.Background, "color": &Prefs.Colors.Font, "#icon": ki.Props{ "max-width": units.NewEm(1), "max-height": units.NewEm(5), "min-width": units.NewEm(1), "min-height": units.NewEm(5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignMiddle, "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, SliderSelectors[SliderActive]: ki.Props{}, SliderSelectors[SliderInactive]: ki.Props{ "border-color": "highlight-50", "color": "highlight-50", }, SliderSelectors[SliderHover]: ki.Props{ "background-color": "highlight-10", }, SliderSelectors[SliderFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-50", }, SliderSelectors[SliderDown]: ki.Props{}, SliderSelectors[SliderValue]: ki.Props{ "border-color": &Prefs.Colors.Icon, "background-color": &Prefs.Colors.Icon, }, SliderSelectors[SliderBox]: ki.Props{ "border-color": &Prefs.Colors.Background, "background-color": &Prefs.Colors.Background, }, }
var StdDialogVSpace = float32(1)
standard vertical space between elements in a dialog, in Ex units
var StdDialogVSpaceUnits = units.Value{Val: StdDialogVSpace, Un: units.Ex, Dots: 0}
var StdKeyMaps = KeyMaps{ {"MacStd", "Standard Mac KeyMap", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "Meta+UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "Shift+Control+P": KeyFunMoveUp, "Meta+Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "Meta+DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "Shift+Control+N": KeyFunMoveDown, "Meta+Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "Meta+RightArrow": KeyFunEnd, "Control+F": KeyFunMoveRight, "Shift+Control+F": KeyFunMoveRight, "Meta+Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "Meta+LeftArrow": KeyFunHome, "Control+B": KeyFunMoveLeft, "Shift+Control+B": KeyFunMoveLeft, "Meta+Control+B": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Shift+Control+V": KeyFunPageDown, "Alt+√": KeyFunPageDown, "Meta+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Meta+H": KeyFunDocHome, "Meta+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Meta+L": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunWordRight, "Shift+Alt+RightArrow": KeyFunWordRight, "Alt+LeftArrow": KeyFunWordLeft, "Shift+Alt+LeftArrow": KeyFunWordLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Shift+Control+A": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Shift+Control+E": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Meta+A": KeyFunSelectAll, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "Alt+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+D": KeyFunDelete, "Control+K": KeyFunKill, "Alt+∑": KeyFunCopy, "Meta+C": KeyFunCopy, "Control+W": KeyFunCut, "Meta+X": KeyFunCut, "Control+Y": KeyFunPaste, "Control+V": KeyFunPaste, "Meta+V": KeyFunPaste, "Shift+Meta+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Meta+Z": KeyFunUndo, "Shift+Control+Z": KeyFunRedo, "Shift+Meta+Z": KeyFunRedo, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Shift+Meta+=": KeyFunZoomIn, "Meta+=": KeyFunZoomIn, "Meta+-": KeyFunZoomOut, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Shift+Meta+-": KeyFunZoomOut, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Control+S": KeyFunSearch, "Meta+F": KeyFunFind, "Meta+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "Meta+[": KeyFunHistPrev, "Meta+]": KeyFunHistNext, "F10": KeyFunMenu, "Meta+`": KeyFunWinFocusNext, "Meta+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Control+Alt+I": KeyFunGoGiEditor, "Shift+Control+I": KeyFunGoGiEditor, "Meta+N": KeyFunMenuNew, "Shift+Meta+N": KeyFunMenuNewAlt1, "Alt+Meta+N": KeyFunMenuNewAlt2, "Meta+O": KeyFunMenuOpen, "Shift+Meta+O": KeyFunMenuOpenAlt1, "Alt+Meta+O": KeyFunMenuOpenAlt2, "Meta+S": KeyFunMenuSave, "Shift+Meta+S": KeyFunMenuSaveAs, "Alt+Meta+S": KeyFunMenuSaveAlt, "Shift+Meta+W": KeyFunMenuCloseAlt1, "Alt+Meta+W": KeyFunMenuCloseAlt2, }}, {"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "Meta+UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "Shift+Control+P": KeyFunMoveUp, "Meta+Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "Meta+DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "Shift+Control+N": KeyFunMoveDown, "Meta+Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "Meta+RightArrow": KeyFunEnd, "Control+F": KeyFunMoveRight, "Shift+Control+F": KeyFunMoveRight, "Meta+Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "Meta+LeftArrow": KeyFunHome, "Control+B": KeyFunMoveLeft, "Shift+Control+B": KeyFunMoveLeft, "Meta+Control+B": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Shift+Control+V": KeyFunPageDown, "Alt+√": KeyFunPageDown, "Control+V": KeyFunPageDown, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunWordRight, "Shift+Alt+RightArrow": KeyFunWordRight, "Alt+LeftArrow": KeyFunWordLeft, "Shift+Alt+LeftArrow": KeyFunWordLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Shift+Control+A": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Shift+Control+E": KeyFunEnd, "Meta+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Meta+H": KeyFunDocHome, "Control+H": KeyFunDocHome, "Control+Alt+A": KeyFunDocHome, "Meta+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Meta+L": KeyFunDocEnd, "Control+Alt+E": KeyFunDocEnd, "Alt+Ƒ": KeyFunWordRight, "Alt+∫": KeyFunWordLeft, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Meta+A": KeyFunSelectAll, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "Alt+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+D": KeyFunDelete, "Control+K": KeyFunKill, "Alt+∑": KeyFunCopy, "Meta+C": KeyFunCopy, "Control+W": KeyFunCut, "Meta+X": KeyFunCut, "Control+Y": KeyFunPaste, "Meta+V": KeyFunPaste, "Shift+Meta+V": KeyFunPasteHist, "Shift+Control+Y": KeyFunPasteHist, "Alt+∂": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Meta+Z": KeyFunUndo, "Control+/": KeyFunUndo, "Shift+Control+Z": KeyFunRedo, "Shift+Meta+Z": KeyFunRedo, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Shift+Meta+=": KeyFunZoomIn, "Meta+=": KeyFunZoomIn, "Meta+-": KeyFunZoomOut, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Shift+Meta+-": KeyFunZoomOut, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Control+S": KeyFunSearch, "Meta+F": KeyFunFind, "Meta+R": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "Meta+[": KeyFunHistPrev, "Meta+]": KeyFunHistNext, "F10": KeyFunMenu, "Meta+`": KeyFunWinFocusNext, "Meta+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Control+Alt+I": KeyFunGoGiEditor, "Shift+Control+I": KeyFunGoGiEditor, "Meta+N": KeyFunMenuNew, "Shift+Meta+N": KeyFunMenuNewAlt1, "Alt+Meta+N": KeyFunMenuNewAlt2, "Meta+O": KeyFunMenuOpen, "Shift+Meta+O": KeyFunMenuOpenAlt1, "Alt+Meta+O": KeyFunMenuOpenAlt2, "Meta+S": KeyFunMenuSave, "Shift+Meta+S": KeyFunMenuSaveAs, "Alt+Meta+S": KeyFunMenuSaveAlt, "Shift+Meta+W": KeyFunMenuCloseAlt1, "Alt+Meta+W": KeyFunMenuCloseAlt2, }}, {"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "Alt+UpArrow": KeyFunMoveUp, "Control+P": KeyFunMoveUp, "Shift+Control+P": KeyFunMoveUp, "Alt+Control+P": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "Alt+DownArrow": KeyFunMoveDown, "Control+N": KeyFunMoveDown, "Shift+Control+N": KeyFunMoveDown, "Alt+Control+N": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "Alt+RightArrow": KeyFunEnd, "Control+F": KeyFunMoveRight, "Shift+Control+F": KeyFunMoveRight, "Alt+Control+F": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "Alt+LeftArrow": KeyFunHome, "Control+B": KeyFunMoveLeft, "Shift+Control+B": KeyFunMoveLeft, "Alt+Control+B": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "Control+U": KeyFunPageUp, "Shift+Control+U": KeyFunPageUp, "Alt+Control+U": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Control+V": KeyFunPageDown, "Shift+Control+V": KeyFunPageDown, "Alt+Control+V": KeyFunPageDown, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+H": KeyFunDocHome, "Control+Alt+A": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Alt+L": KeyFunDocEnd, "Control+Alt+E": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Home": KeyFunHome, "Control+A": KeyFunHome, "Shift+Control+A": KeyFunHome, "End": KeyFunEnd, "Control+E": KeyFunEnd, "Shift+Control+E": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Alt+A": KeyFunSelectAll, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+D": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Alt+W": KeyFunCopy, "Alt+C": KeyFunCopy, "Control+W": KeyFunCut, "Alt+X": KeyFunCut, "Control+Y": KeyFunPaste, "Alt+V": KeyFunPaste, "Shift+Alt+V": KeyFunPasteHist, "Shift+Control+Y": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+/": KeyFunUndo, "Shift+Control+Z": KeyFunRedo, "Control+I": KeyFunInsert, "Control+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Control+S": KeyFunSearch, "Alt+F": KeyFunFind, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Shift+Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Control+Alt+I": KeyFunGoGiEditor, "Shift+Control+I": KeyFunGoGiEditor, "Alt+N": KeyFunMenuNew, "Shift+Alt+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Alt+O": KeyFunMenuOpen, "Shift+Alt+O": KeyFunMenuOpenAlt1, "Control+Alt+O": KeyFunMenuOpenAlt2, "Alt+S": KeyFunMenuSave, "Shift+Alt+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Alt+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, {"LinuxStd", "Standard Linux KeyMap", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Home": KeyFunHome, "Alt+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Control+A": KeyFunSelectAll, "Shift+Control+A": KeyFunCancelSelect, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Control+C": KeyFunCopy, "Control+X": KeyFunCut, "Control+V": KeyFunPaste, "Shift+Control+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+Y": KeyFunRedo, "Shift+Control+Z": KeyFunRedo, "Control+Alt+I": KeyFunInsert, "Control+Alt+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Shift+Control+P": KeyFunPrefs, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Alt+S": KeyFunSearch, "Control+F": KeyFunFind, "Control+H": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "Control+N": KeyFunMenuNew, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Shift+Control+I": KeyFunGoGiEditor, "Shift+Control+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Control+O": KeyFunMenuOpen, "Shift+Control+O": KeyFunMenuOpenAlt1, "Shift+Alt+O": KeyFunMenuOpenAlt2, "Control+S": KeyFunMenuSave, "Shift+Control+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Control+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, {"WindowsStd", "Standard Windows KeyMap", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Home": KeyFunHome, "Alt+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Alt+RightArrow": KeyFunEnd, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Control+A": KeyFunSelectAll, "Shift+Control+A": KeyFunCancelSelect, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Control+C": KeyFunCopy, "Control+X": KeyFunCut, "Control+V": KeyFunPaste, "Shift+Control+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+Y": KeyFunRedo, "Shift+Control+Z": KeyFunRedo, "Control+Alt+I": KeyFunInsert, "Control+Alt+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Shift+Control+P": KeyFunPrefs, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Alt+S": KeyFunSearch, "Control+F": KeyFunFind, "Control+H": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Shift+Control+I": KeyFunGoGiEditor, "Control+N": KeyFunMenuNew, "Shift+Control+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Control+O": KeyFunMenuOpen, "Shift+Control+O": KeyFunMenuOpenAlt1, "Shift+Alt+O": KeyFunMenuOpenAlt2, "Control+S": KeyFunMenuSave, "Shift+Control+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Control+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, {"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", KeyMap{ "UpArrow": KeyFunMoveUp, "Shift+UpArrow": KeyFunMoveUp, "DownArrow": KeyFunMoveDown, "Shift+DownArrow": KeyFunMoveDown, "RightArrow": KeyFunMoveRight, "Shift+RightArrow": KeyFunMoveRight, "LeftArrow": KeyFunMoveLeft, "Shift+LeftArrow": KeyFunMoveLeft, "PageUp": KeyFunPageUp, "Shift+PageUp": KeyFunPageUp, "Control+UpArrow": KeyFunPageUp, "PageDown": KeyFunPageDown, "Shift+PageDown": KeyFunPageDown, "Control+DownArrow": KeyFunPageDown, "Home": KeyFunHome, "Alt+LeftArrow": KeyFunHome, "End": KeyFunEnd, "Alt+Home": KeyFunDocHome, "Shift+Home": KeyFunDocHome, "Alt+End": KeyFunDocEnd, "Shift+End": KeyFunDocEnd, "Control+RightArrow": KeyFunWordRight, "Control+LeftArrow": KeyFunWordLeft, "Alt+RightArrow": KeyFunEnd, "Tab": KeyFunFocusNext, "Shift+Tab": KeyFunFocusPrev, "ReturnEnter": KeyFunEnter, "KeypadEnter": KeyFunEnter, "Control+A": KeyFunSelectAll, "Shift+Control+A": KeyFunCancelSelect, "Control+G": KeyFunCancelSelect, "Control+Spacebar": KeyFunSelectMode, "Control+ReturnEnter": KeyFunAccept, "Escape": KeyFunAbort, "DeleteBackspace": KeyFunBackspace, "Control+DeleteBackspace": KeyFunBackspaceWord, "DeleteForward": KeyFunDelete, "Control+DeleteForward": KeyFunDeleteWord, "Alt+DeleteForward": KeyFunDeleteWord, "Control+K": KeyFunKill, "Control+C": KeyFunCopy, "Control+X": KeyFunCut, "Control+V": KeyFunPaste, "Shift+Control+V": KeyFunPasteHist, "Alt+D": KeyFunDuplicate, "Control+T": KeyFunTranspose, "Alt+T": KeyFunTransposeWord, "Control+Z": KeyFunUndo, "Control+Y": KeyFunRedo, "Shift+Control+Z": KeyFunRedo, "Control+Alt+I": KeyFunInsert, "Control+Alt+O": KeyFunInsertAfter, "Control+=": KeyFunZoomIn, "Shift+Control++": KeyFunZoomIn, "Control+-": KeyFunZoomOut, "Shift+Control+_": KeyFunZoomOut, "Shift+Control+P": KeyFunPrefs, "Control+Alt+P": KeyFunPrefs, "F5": KeyFunRefresh, "Control+L": KeyFunRecenter, "Control+.": KeyFunComplete, "Control+,": KeyFunLookup, "Alt+S": KeyFunSearch, "Control+F": KeyFunFind, "Control+H": KeyFunReplace, "Control+R": KeyFunReplace, "Control+J": KeyFunJump, "Control+[": KeyFunHistPrev, "Control+]": KeyFunHistNext, "F10": KeyFunMenu, "Alt+F6": KeyFunWinFocusNext, "Control+W": KeyFunWinClose, "Control+Alt+G": KeyFunWinSnapshot, "Shift+Control+G": KeyFunWinSnapshot, "Shift+Control+I": KeyFunGoGiEditor, "Control+N": KeyFunMenuNew, "Shift+Control+N": KeyFunMenuNewAlt1, "Control+Alt+N": KeyFunMenuNewAlt2, "Control+O": KeyFunMenuOpen, "Shift+Control+O": KeyFunMenuOpenAlt1, "Shift+Alt+O": KeyFunMenuOpenAlt2, "Control+S": KeyFunMenuSave, "Shift+Control+S": KeyFunMenuSaveAs, "Control+Alt+S": KeyFunMenuSaveAlt, "Shift+Control+W": KeyFunMenuCloseAlt1, "Control+Alt+W": KeyFunMenuCloseAlt2, }}, }
StdKeyMaps is the original compiled-in set of standard keymaps that have the lastest key functions bound to standard key chords.
var StretchProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "max-width": -1.0, "max-height": -1.0, }
var TabButtonMinWidth = float32(8)
TabButtonMinWidth is the minimum width of the tab button, in Ch units
var TabButtonProps = ki.Props{ "EnumType:Flag": KiT_ButtonFlags, "min-width": units.NewCh(TabButtonMinWidth), "min-height": units.NewEm(1.6), "border-width": units.NewPx(0), "border-radius": units.NewPx(0), "border-color": &Prefs.Colors.Border, "text-align": gist.AlignCenter, "background-color": &Prefs.Colors.Control, "color": &Prefs.Colors.Font, "padding": units.NewPx(4), "margin": units.NewPx(0), "indicator": "close", "#icon": ki.Props{ "width": units.NewEm(1), "height": units.NewEm(1), "margin": units.NewPx(0), "padding": units.NewPx(0), "fill": &Prefs.Colors.Icon, "stroke": &Prefs.Colors.Font, }, "#label": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#close-stretch": ki.Props{ "width": units.NewCh(1), }, "#close": ki.Props{ "width": units.NewEx(0.5), "height": units.NewEx(0.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignBottom, }, "#shortcut": ki.Props{ "margin": units.NewPx(0), "padding": units.NewPx(0), }, "#sc-stretch": ki.Props{ "min-width": units.NewCh(2), }, ButtonSelectors[ButtonActive]: ki.Props{ "background-color": "linear-gradient(lighter-0, highlight-10)", }, ButtonSelectors[ButtonInactive]: ki.Props{ "border-color": "lighter-50", "color": "lighter-50", }, ButtonSelectors[ButtonHover]: ki.Props{ "background-color": "linear-gradient(highlight-10, highlight-10)", }, ButtonSelectors[ButtonFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "linear-gradient(samelight-50, highlight-10)", }, ButtonSelectors[ButtonDown]: ki.Props{ "color": "lighter-90", "background-color": "linear-gradient(highlight-30, highlight-10)", }, ButtonSelectors[ButtonSelected]: ki.Props{ "background-color": "linear-gradient(pref(Select), highlight-10)", }, }
var TabViewProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-color": &Prefs.Colors.Border, "border-width": units.NewPx(2), "background-color": &Prefs.Colors.Background, "color": &Prefs.Colors.Font, "max-width": -1, "max-height": -1, }
var TextFieldBlinkMu sync.Mutex
TextFieldBlinkMu is mutex protecting TextFieldBlink updating and access
var TextFieldBlinker *time.Ticker
TextFieldBlinker is the time.Ticker for blinking cursors for text fields, only one of which can be active at at a time
var TextFieldProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "border-width": units.NewPx(1), "cursor-width": units.NewPx(3), "border-color": &Prefs.Colors.Border, "padding": units.NewPx(4), "margin": units.NewPx(1), "text-align": gist.AlignLeft, "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Control, "clear-act": true, "#clear": ki.Props{ "width": units.NewEx(0.5), "height": units.NewEx(0.5), "margin": units.NewPx(0), "padding": units.NewPx(0), "vertical-align": gist.AlignMiddle, }, TextFieldSelectors[TextFieldActive]: ki.Props{ "background-color": "lighter-0", }, TextFieldSelectors[TextFieldFocus]: ki.Props{ "border-width": units.NewPx(2), "background-color": "samelight-80", }, TextFieldSelectors[TextFieldInactive]: ki.Props{ "background-color": "highlight-10", }, TextFieldSelectors[TextFieldSel]: ki.Props{ "background-color": &Prefs.Colors.Select, }, }
var TextFieldSelectors = []string{":active", ":focus", ":inactive", ":selected"}
Style selector names for the different states
var TextFieldSpriteName = "gi.TextField.Cursor"
TextFieldSpriteName is the name of the window sprite used for the cursor
var ToolBarProps = ki.Props{ "EnumType:Flag": KiT_NodeFlags, "padding": units.NewPx(2), "margin": units.NewPx(0), "spacing": units.NewPx(4), "color": &Prefs.Colors.Font, "background-color": "linear-gradient(pref(Control), highlight-10)", }
var TooltipFrameProps = ki.Props{ "background-color": &Prefs.Colors.Highlight, "border-width": units.NewPx(0), "border-color": "none", "margin": units.NewPx(0), "padding": units.NewPx(2), "box-shadow.h-offset": units.NewPx(0), "box-shadow.v-offset": units.NewPx(0), "box-shadow.blur": units.NewPx(0), "box-shadow.color": &Prefs.Colors.Shadow, }
var Update2DTrace bool = false
Update2DTrace reports a trace of updates that trigger re-rendering -- can be set in PrefsDebug from prefs gui
var Viewport2DProps = ki.Props{ "EnumType:Flag": KiT_VpFlags, "color": &Prefs.Colors.Font, "background-color": &Prefs.Colors.Background, }
var WidgetBaseProps = ki.Props{ "base-type": true, "EnumType:Flag": KiT_NodeFlags, }
var WidgetDefPropsKey = "__DefProps"
WidgetDefPropsKey is the key for accessing the default style properties stored in the type-properties for a given type -- also ones with sub-selectors for parts in there with selector appended to this key
var WidgetDefStyleKey = "__DefStyle"
WidgetDefStyleKey is the key for accessing the default style stored in the type-properties for a given type -- also ones with sub-selectors for parts in there with selector appended to this key
var WinGeomNoLockErr = errors.New("WinGeom could not lock lock file")
var WinGeomPrefs = WindowGeomPrefs{}
var WinGeomPrefsFileName = "win_geom_prefs"
WinGeomPrefsFileName is the base name of the preferences file in GoGi prefs directory
var WinGeomPrefsLastSave time.Time
WinGeomPrefsLastSave is when prefs were last saved -- if we weren't the last to save then we need to re-open before modifying
var WinGeomPrefsLockSleep = 100 * time.Millisecond
var WinGeomPrefsMu sync.RWMutex
WinGeomPrefsMu is read-write mutex that protects updating of WinGeomPrefs
var WinGeomTrace = false
var WinWait sync.WaitGroup
WinWait is a wait group for waiting for all the open window event loops to finish -- this can be used for cases where the initial main run uses a GoStartEventLoop for example. It is incremented by GoStartEventLoop and decremented when the event loop terminates.
var WindowProps = ki.Props{ "EnumType:Flag": KiT_WinFlags, }
var ZoomFactor = float32(1.0)
ZoomFactor is a temporary multiplier on LogicalDPI used for per-session display zooming without changing prefs -- see SaveZoom to save prefs with this current factor.
Functions ¶
func AddToSpellModel ¶
AddToSpellModel trains on additional text - extends model
func AppName ¶ added in v0.9.7
func AppName() string
AppName returns the application name -- see SetAppName to set
func ApplyCSS ¶ added in v1.1.0
ApplyCSS applies css styles for given node, using key to select sub-props from overall properties list, and optional selector to select a further :name selector within that key
func Base64SplitLines ¶ added in v1.2.0
Base64SplitLines splits the encoded Base64 bytes into standard lines of 76 chars each. The last line also ends in a newline
func ChildByLabelStartsCanFocus ¶ added in v1.2.0
ChildByLabelStartsCanFocus uses breadth-first search to find first element within layout whose Label (from Labeler interface) starts with given string (case insensitive) and can focus. If after is non-nil, only finds after given element.
func ChoiceDialog ¶
ChoiceDialog presents any number of buttons with labels as given, for the user to choose among -- the clicked button number (starting at 0) will be sent to the receiving object and function for dialog signals. Viewport is optional to properly contextualize dialog to given master window.
func CompleteEditText ¶ added in v0.9.6
CompleteEditText is a chance to modify the completion selection before it is inserted
func CompleteText ¶ added in v0.9.6
CompleteText is the function for completing text files
func DNDModCursor ¶
DNDModCursor gets the appropriate cursor based on the DND event mod.
func DefaultColorSchemes ¶ added in v0.9.11
func DefaultColorSchemes() map[string]*ColorPrefs
func DefaultStyle2DWidget ¶ added in v1.2.0
func DefaultStyle2DWidget(wb *WidgetBase, selector string, part *WidgetBase) *gist.Style
DefaultStyle2DWidget retrieves default style object for the type, from type properties -- selector is optional selector for state etc. Property key is "__DefStyle" + selector -- if part != nil, then use that obj for getting the default style starting point when creating a new style. Also stores a "__DefProps"+selector type property of the props used for styling here, for accessing properties that are not compiled into standard Style object.
func EndCPUMemProfile ¶
func EndCPUMemProfile()
EndCPUMemProfile ends the standard Go cpu and memory profiling.
func EndTargProfile ¶
func EndTargProfile()
EndTargProfile ends targeted profiling and prints report.
func GatherSizes ¶ added in v1.2.0
func GatherSizes(ly *Layout)
GatherSizes is size first pass: gather the size information from the children
func GatherSizesFlow ¶ added in v1.2.0
GatherSizesFlow is size first pass: gather the size information from the children
func GatherSizesGrid ¶ added in v1.2.0
func GatherSizesGrid(ly *Layout)
GatherSizesGrid is size first pass: gather the size information from the children, grid version
func GatherSizesSumMax ¶ added in v1.2.0
GatherSizesSumMax gets basic sum and max data across all kiddos
func GrabRenderFrom ¶ added in v0.9.8
GrabRenderFrom grabs the rendered image from given node if nil, then image could not be grabbed
func ImageClearer ¶
ImageClearer makes an image more transparent -- pct is amount to alter alpha transparency factor by -- 100 = fully transparent, 0 = no change -- affects the image itself -- make a copy if you want to keep the original or see bild/blend/multiply -- this is specifically used for gi DND etc
func ImageFmBase64 ¶ added in v1.2.0
ImageFmBase64 returns image from Base64-encoded bytes in either PNG or JPEG format based on fmt which must end in either png or jpeg
func ImageFmBase64JPG ¶ added in v1.2.0
ImageFmBase64PNG returns image from Base64-encoded bytes in PNG format
func ImageFmBase64PNG ¶ added in v1.2.0
ImageFmBase64PNG returns image from Base64-encoded bytes in PNG format
func ImageResize ¶ added in v1.0.17
ImageResize returns new image that has been resized to given size uses sensible default level of smoothing (Linear interpolation)
func ImageResizeMax ¶ added in v1.0.4
ImageResizeMax resizes image so that the largest size (X or Y) is set to maxSz
func ImageSizeMax ¶ added in v1.0.4
ImageSizeMax computes the size of image where the largest size (X or Y) is set to maxSz
func ImageToBase64JPG ¶ added in v1.2.0
ImageToBase64JPG returns bytes image encoded as a JPG in Base64 format with "image/jpeg" mimetype returned
func ImageToBase64PNG ¶ added in v1.2.0
ImageToBase64PNG returns bytes of image encoded as a PNG in Base64 format with "image/png" mimetype returned
func ImageToRGBA ¶ added in v1.0.17
ImageToRGBA returns given image as an image.RGBA (no conversion if it is already)
func Init ¶
func Init()
Init performs overall initialization of the gogi system: loading prefs, etc -- automatically called when new window opened, but can be called before then if pref info needed.
func InitSpell ¶
func InitSpell() error
InitSpell tries to load the saved fuzzy.spell model. If unsuccessful tries to create a new model from a text file used as input
func KiToNode2D ¶
func KiToNode2D(k ki.Ki) (Node2D, *Node2DBase)
KiToNode2D converts Ki to a Node2D interface and a Node2DBase obj -- nil if not.
func LayAllocFromParent ¶ added in v1.2.0
func LayAllocFromParent(ly *Layout)
LayAllocFromParent: if we are not a child of a layout, then get allocation from a parent obj that has a layout size
func LaySumDim ¶ added in v1.2.0
LaySumDim returns whether we sum up elements along given dimension? else use max for shared dimension.
func LaySummedDim ¶ added in v1.2.0
LaySummedDim returns the dimension along which layout is summing.
func LayoutAlongDim ¶ added in v1.2.0
LayoutAlongDim lays out all children along given dim -- only affects that dim -- e.g., use LayoutSharedDim for other dim.
func LayoutFlow ¶ added in v1.2.0
LayoutFlow manages the flow layout along given dimension returns true if needs another iteration (only if iter == 0)
func LayoutGridDim ¶ added in v1.2.0
LayoutGridDim lays out grid data along each dimension (row, Y; col, X), same as LayoutAlongDim. For cols, X has width prefs of each -- turn that into an actual allocated width for each column, and likewise for rows.
func LayoutGridLay ¶ added in v1.2.0
func LayoutGridLay(ly *Layout)
LayoutGridLay manages overall grid layout of children
func LayoutSharedDim ¶ added in v1.2.0
LayoutSharedDim lays out items along a shared dimension, where all elements share the same space, e.g., Horiz for a Vert layout, and vice-versa.
func LayoutSharedDimImpl ¶ added in v1.2.0
func LayoutSharedDimImpl(ly *Layout, avail, need, pref, max, spc float32, al gist.Align) (pos, size float32)
LayoutSharedDim implements calculations to layout for the shared dimension (i.e., Vertical for Horizontal layout). Returns pos and size.
func MainMenuFunc ¶
MainMenuFunc is the callback function for OS-generated menu actions.
func NewKiDialogValues ¶
NewKiDialogValues gets the user-set values from a NewKiDialog.
func NewSpellModelFromText ¶
func NewSpellModelFromText() error
NewSpellModelFromText builds a NEW spelling model from text
func OpenImage ¶
OpenImage opens an image from given path filename -- format is inferred automatically.
func OpenSpellModel ¶ added in v0.9.14
func OpenSpellModel() error
OpenSpellModel loads a saved spelling model
func OpenURL ¶ added in v0.9.9
func OpenURL(url string)
OpenURL opens the given URL in the user's default browser. On Linux this requires that xdg-utils package has been installed -- uses xdg-open command.
func PollEvents ¶ added in v0.9.9
func PollEvents()
PollEvents tells the main event loop to check for any gui events right now. Call this periodically from longer-running functions to ensure GUI responsiveness.
func PopupIsCompleter ¶
PopupIsCompleter returns true if the given popup item is a menu and a completer
func PopupIsCorrector ¶
PopupIsCorrector returns true if the given popup item is a menu and a spell corrector
func PopupIsMenu ¶
PopupIsMenu returns true if the given popup item is a menu
func PopupIsTooltip ¶
PopupIsTooltip returns true if the given popup item is a menu
func ProgressDefaultInc ¶ added in v1.2.0
func PromptDialog ¶
PromptDialog opens a basic standard dialog with a title, prompt, and ok / cancel buttons -- any empty text will not be added -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Viewport is optional to properly contextualize dialog to given master window.
func SaveImage ¶ added in v0.9.8
SaveImage saves image to file, with format inferred from filename -- JPEG and PNG supported by default.
func SaveSpellModel ¶
func SaveSpellModel() error
SaveSpellModel saves the spelling model which includes the data and parameters
func SetActiveKeyMap ¶
func SetActiveKeyMap(km *KeyMap, kmName KeyMapName)
SetActiveKeyMap sets the current ActiveKeyMap, calling Update on the map prior to setting it to ensure that it is a valid, complete map
func SetActiveKeyMapName ¶
func SetActiveKeyMapName(mapnm KeyMapName)
SetActiveKeyMapName sets the current ActiveKeyMap by name from those defined in AvailKeyMaps, calling Update on the map prior to setting it to ensure that it is a valid, complete map
func SetAppAbout ¶ added in v0.9.7
func SetAppAbout(about string)
SetAppAbout sets the 'about' info for the app -- appears as a menu option in the default app menu
func SetAppName ¶ added in v0.9.7
func SetAppName(name string)
SetAppName sets the application name -- defaults to GoGi if not otherwise set Name appears in the first app menu, and specifies the default application-specific preferences directory, etc
func SetQuitCleanFunc ¶ added in v0.9.7
func SetQuitCleanFunc(fun func())
SetQuitCleanFunc sets the function that is called whenever app is actually about to quit (irrevocably) -- can do any necessary last-minute cleanup here.
func SetQuitReqFunc ¶ added in v0.9.7
func SetQuitReqFunc(fun func())
SetQuitReqFunc sets the function that is called whenever there is a request to quit the app (via a OS or a call to QuitReq() method). That function can then adjudicate whether and when to actually call Quit.
func SetStdXMLAttr ¶ added in v1.2.0
SetStdXMLAttr sets standard attributes of node given XML-style name / attribute values (e.g., from parsing XML / SVG files) -- returns true if handled
func SetUnitContext ¶ added in v1.1.0
func SetUnitContext(st *gist.Style, vp *Viewport2D, el mat32.Vec2)
SetUnitContext sets the unit context based on size of viewport and parent element (from bbox) and then cache everything out in terms of raw pixel dots for rendering -- call at start of render
func ShortcutForFun ¶
ShortcutForFun returns OS-specific formatted shortcut for first key chord trigger for given KeyFun in the current active map
func SignalViewport2D ¶
SignalViewport2D is called by each node in scenegraph through its NodeSig signal to notify its parent viewport whenever it changes, causing a re-render.
func SignalWindowPublish ¶
SignalWindowPublish is the signal receiver function that publishes the window updates when the window update signal (UpdateEnd) occurs
func StartCPUMemProfile ¶
func StartCPUMemProfile()
StartCPUMemProfile starts the standard Go cpu and memory profiling.
func StartTargProfile ¶
func StartTargProfile()
StartTargProfile starts targeted profiling using goki prof package.
func StringPromptDialogValue ¶
StringPromptDialogValue gets the string value the user set.
func StringsAddExtras ¶ added in v0.9.4
StringsAddExtras is a generic function for appending a slice to a slice used to add items to menus
func StringsAppendIfUnique ¶ added in v0.9.4
StringsAppendIfUnique append str to strs if not already in slice
func StringsDelete ¶ added in v0.9.8
StringsDelete deletes item from strings list
func StringsInsertFirst ¶
StringsInsertFirst inserts the given string at start of a string slice, while keeping overall length to given max value useful for a "recents" kind of string list
func StringsInsertFirstUnique ¶
StringsInsertFirstUnique inserts the given string at start of a string slice, while keeping overall length to given max value. if item is already on the list, then it is moved to the top and not re-added (unique items only) useful for a "recents" kind of string list
func StringsRemoveExtras ¶ added in v0.9.4
StringsRemoveExtras is a generic function for removing items of a slice from another slice
func StyleCSS ¶ added in v1.1.0
StyleCSS applies css style properties to given Widget node, parsing out type, .class, and #name selectors, along with optional sub-selector (:hover, :active etc)
func TextFieldBlink ¶
func TextFieldBlink()
TextFieldBlink is function that blinks text field cursor
func ToLabel ¶
func ToLabel(it interface{}) string
ToLabel returns the gui-appropriate label for an item, using the Labeler interface if it is defined, and falling back on kit.ToString converter otherwise -- also contains label impls for basic interface types for which we cannot easily define the Labeler interface
func WinNewCloseStamp ¶
func WinNewCloseStamp()
WinNewCloseStamp updates the global WinNewCloseTime timestamp for updating windows menus
Types ¶
type ActOpts ¶
type ActOpts struct { Name string Label string Icon string Tooltip string Shortcut key.Chord ShortcutKey KeyFuns Data interface{} UpdateFunc func(act *Action) }
ActOpts provides named and partial parameters for AddAction method
type Action ¶
type Action struct { ButtonBase Data interface{} `json:"-" xml:"-" view:"-" desc:"optional data that is sent with the ActionSig when it is emitted"` ActionSig ki.Signal `` /* 157-byte string literal not displayed */ UpdateFunc func(act *Action) `` /* 176-byte string literal not displayed */ }
Action is a button widget that can display a text label and / or an icon and / or a keyboard shortcut -- this is what is put in menus, menubars, and toolbars, and also for any standalone simple action. The default styling differs depending on whether it is in a Menu versus a MenuBar or ToolBar -- this is controlled by the Class which is automatically set to menu, menubar, or toolbar
func AddNewAction ¶ added in v0.9.7
AddNewAction adds a new action to given parent node, with given name.
func (*Action) ButtonRelease ¶
func (ac *Action) ButtonRelease()
ButtonRelease triggers action signal
func (*Action) ConfigParts ¶
func (ac *Action) ConfigParts()
ConfigParts switches on part type on calls specific config
func (*Action) ConfigPartsAddShortcut ¶
func (ac *Action) ConfigPartsAddShortcut(config *kit.TypeAndNameList) int
ConfigPartsAddShortcut adds a menu shortcut, with a stretch space -- only called when needed
func (*Action) ConfigPartsButton ¶
func (ac *Action) ConfigPartsButton()
ConfigPartsButton sets the label, icon etc for the button
func (*Action) ConfigPartsMenuItem ¶
func (ac *Action) ConfigPartsMenuItem()
ConfigPartsMenuItem sets the label, icon, etc for action menu item
func (*Action) ConfigPartsShortcut ¶
ConfigPartsShortcut sets the shortcut
func (*Action) CopyFieldsFrom ¶ added in v0.9.8
func (ac *Action) CopyFieldsFrom(frm interface{})
func (*Action) Disconnect ¶ added in v0.9.8
func (ac *Action) Disconnect()
func (*Action) Init2D ¶
func (ac *Action) Init2D()
Init2D calls functions to initialize widget and parts
func (*Action) Trigger ¶
func (ac *Action) Trigger()
Trigger triggers the action signal -- for external activation of action -- only works if action is not inactive
func (*Action) UpdateActions ¶
func (ac *Action) UpdateActions()
UpdateActions calls UpdateFunc on me and any of my menu items
type Bitmap ¶
type Bitmap struct { WidgetBase Filename FileName `desc:"file name of image loaded -- set by OpenImage"` Size image.Point `desc:"size of the image"` Pixels *image.RGBA `copy:"-" view:"-" xml:"-" json:"-" desc:"the bitmap image"` }
Bitmap is a Widget that is optimized to render a static bitmap image -- it expects to be a terminal node and does NOT call rendering etc on its children. It is particularly useful for overlays in drag-n-drop uses -- can grab the image of another vp and show that
func AddNewBitmap ¶ added in v0.9.7
AddNewBitmap adds a new bitmap to given parent node, with given name.
func (*Bitmap) CopyFieldsFrom ¶ added in v0.9.8
func (bm *Bitmap) CopyFieldsFrom(frm interface{})
func (*Bitmap) DrawIntoViewport ¶ added in v0.9.8
func (bm *Bitmap) DrawIntoViewport(parVp *Viewport2D)
func (*Bitmap) GrabRenderFrom ¶
GrabRenderFrom grabs the rendered image from given node
func (*Bitmap) LayoutToImgSize ¶ added in v0.9.9
func (bm *Bitmap) LayoutToImgSize()
LayoutToImgSize sets the width, height properties to the current Size so it will request that size during layout
func (*Bitmap) OpenImage ¶
OpenImage opens an image for the bitmap, and resizes to the size of the image or the specified size -- pass 0 for width and/or height to use the actual image size for that dimension
type Button ¶
type Button struct {
ButtonBase
}
Button is a standard command button -- PushButton in Qt Widgets, and Button in Qt Quick -- by default it puts the icon to the left and the text to the right
func AddNewButton ¶ added in v0.9.7
AddNewButton adds a new button to given parent node, with given name.
func (*Button) CopyFieldsFrom ¶ added in v0.9.8
func (bt *Button) CopyFieldsFrom(frm interface{})
type ButtonBase ¶
type ButtonBase struct { PartsWidgetBase Text string `xml:"text" desc:"label for the button -- if blank then no label is presented"` Icon IconName `` /* 162-byte string literal not displayed */ Indicator IconName `` /* 192-byte string literal not displayed */ Shortcut key.Chord `` /* 489-byte string literal not displayed */ StateStyles [ButtonStatesN]gist.Style `` /* 246-byte string literal not displayed */ State ButtonStates `copy:"-" json:"-" xml:"-" desc:"current state of the button based on gui interaction"` ButtonSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for button -- see ButtonSignals for the types"` Menu Menu `desc:"the menu items for this menu -- typically add Action elements for menus, along with separators"` MakeMenuFunc MakeMenuFunc `` /* 126-byte string literal not displayed */ ButStateMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"button state mutex"` }
ButtonBase has common button functionality for all buttons, including Button, Action, MenuButton, CheckBox, etc
func (*ButtonBase) AsButtonBase ¶ added in v0.9.8
func (bb *ButtonBase) AsButtonBase() *ButtonBase
func (*ButtonBase) BaseButtonRelease ¶ added in v0.9.11
func (bb *ButtonBase) BaseButtonRelease()
BaseButtonRelease action: the button has just been released -- sends a released signal and returns state to normal, and emits clicked signal if if it was previously in pressed state
func (*ButtonBase) ButtonEnterHover ¶
func (bb *ButtonBase) ButtonEnterHover()
ButtonEnterHover called when button starting hover
func (*ButtonBase) ButtonEvents ¶
func (bb *ButtonBase) ButtonEvents()
func (*ButtonBase) ButtonExitHover ¶
func (bb *ButtonBase) ButtonExitHover()
ButtonExitHover called when button exiting hover
func (*ButtonBase) ButtonPress ¶ added in v0.9.11
func (bb *ButtonBase) ButtonPress()
ButtonPress sets the button in the down state -- mouse clicked down but not yet up -- emits ButtonPressed signal AND WidgetSig Selected signal -- ButtonClicked is down and up
func (*ButtonBase) ButtonRelease ¶
func (bb *ButtonBase) ButtonRelease()
func (*ButtonBase) ConfigParts ¶
func (bb *ButtonBase) ConfigParts()
func (*ButtonBase) ConfigPartsAddIndicator ¶
func (bb *ButtonBase) ConfigPartsAddIndicator(config *kit.TypeAndNameList, defOn bool) int
ConfigPartsAddIndicator adds a menu indicator if there is a menu present, and the Indicator field is not "none" -- defOn = true means default to adding the indicator even if no menu is yet present -- returns the index in Parts of the indicator object, which is named "indicator" -- an "ind-stretch" is added as well to put on the right by default.
func (*ButtonBase) ConfigPartsAddIndicatorSpace ¶
func (bb *ButtonBase) ConfigPartsAddIndicatorSpace(config *kit.TypeAndNameList, defOn bool) int
ConfigPartsAddIndicatorSpace adds indicator with a space instead of a stretch for editable combobox, where textfield then takes up the rest of the space
func (*ButtonBase) ConfigPartsIfNeeded ¶
func (bb *ButtonBase) ConfigPartsIfNeeded()
func (*ButtonBase) ConfigPartsIndicator ¶
func (bb *ButtonBase) ConfigPartsIndicator(indIdx int)
func (*ButtonBase) ConnectEvents2D ¶
func (bb *ButtonBase) ConnectEvents2D()
func (*ButtonBase) CopyFieldsFrom ¶ added in v0.9.8
func (bb *ButtonBase) CopyFieldsFrom(frm interface{})
func (*ButtonBase) Destroy ¶ added in v0.9.14
func (bb *ButtonBase) Destroy()
func (*ButtonBase) Disconnect ¶ added in v0.9.8
func (bb *ButtonBase) Disconnect()
func (*ButtonBase) FocusChanged2D ¶
func (bb *ButtonBase) FocusChanged2D(change FocusChanges)
func (*ButtonBase) HasMenu ¶
func (bb *ButtonBase) HasMenu() bool
HasMenu returns true if there is a menu or menu-making function set, or the explicit ButtonFlagMenu has been set
func (*ButtonBase) HoverTooltipEvent ¶
func (bb *ButtonBase) HoverTooltipEvent()
func (*ButtonBase) Init2D ¶
func (bb *ButtonBase) Init2D()
func (*ButtonBase) IsCheckable ¶
func (bb *ButtonBase) IsCheckable() bool
IsCheckable returns if is this button checkable -- the Checked state is independent of the generic widget selection state
func (*ButtonBase) IsChecked ¶
func (bb *ButtonBase) IsChecked() bool
IsChecked checks if button is checked
func (*ButtonBase) IsMenu ¶
func (bb *ButtonBase) IsMenu() bool
IsMenu returns true this button is on a menu -- it is a menu item
func (*ButtonBase) KeyChordEvent ¶
func (bb *ButtonBase) KeyChordEvent()
KeyChordEvent handles button KeyChord events
func (*ButtonBase) Layout2D ¶
func (bb *ButtonBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*ButtonBase) MouseEvent ¶
func (bb *ButtonBase) MouseEvent()
MouseEvents handles button MouseEvent
func (*ButtonBase) MouseFocusEvent ¶
func (bb *ButtonBase) MouseFocusEvent()
MouseFocusEvents handles button MouseFocusEvent
func (*ButtonBase) OnClicked ¶ added in v1.2.14
func (bb *ButtonBase) OnClicked(fun func())
OnClicked calls the given function when the button is clicked, which is the default / standard way of activating the button
func (*ButtonBase) OpenMenu ¶
func (bb *ButtonBase) OpenMenu() bool
OpenMenu will open any menu associated with this element -- returns true if menu opened, false if not
func (*ButtonBase) Render2D ¶
func (bb *ButtonBase) Render2D()
func (*ButtonBase) RenderButton ¶ added in v1.0.5
func (bb *ButtonBase) RenderButton()
func (*ButtonBase) ResetMenu ¶
func (bb *ButtonBase) ResetMenu()
ResetMenu removes all items in the menu
func (*ButtonBase) SetAsButton ¶
func (bb *ButtonBase) SetAsButton()
SetAsButton clears the explicit ButtonFlagMenu -- if there are menu items or a menu function then it will still behave as a menu
func (*ButtonBase) SetAsMenu ¶
func (bb *ButtonBase) SetAsMenu()
SetAsMenu ensures that this functions as a menu even before menu items are added
func (*ButtonBase) SetButtonState ¶
func (bb *ButtonBase) SetButtonState(state ButtonStates) bool
SetButtonState sets the button state -- returns true if state changed
func (*ButtonBase) SetCheckable ¶
func (bb *ButtonBase) SetCheckable(checkable bool)
SetCheckable sets whether this button is checkable -- emits ButtonToggled signals if so -- the Checked state is independent of the generic widget selection state
func (*ButtonBase) SetChecked ¶
func (bb *ButtonBase) SetChecked(chk bool)
SetChecked sets the checked state of this button -- does not emit signal or update
func (*ButtonBase) SetIcon ¶
func (bb *ButtonBase) SetIcon(iconName string)
SetIcon sets the Icon to given icon name (could be empty or 'none') and updates the button
func (*ButtonBase) SetText ¶
func (bb *ButtonBase) SetText(txt string)
SetText sets the text and updates the button
func (*ButtonBase) Style2D ¶
func (bb *ButtonBase) Style2D()
func (*ButtonBase) StyleButton ¶
func (bb *ButtonBase) StyleButton()
StyleButton does button styling -- it sets the StyMu Lock
func (*ButtonBase) StyleParts ¶
func (bb *ButtonBase) StyleParts()
func (*ButtonBase) ToggleChecked ¶
func (bb *ButtonBase) ToggleChecked()
ToggleChecked toggles the checked state of this button -- does not emit signal or update
func (*ButtonBase) UpdateButtonStyle ¶
func (bb *ButtonBase) UpdateButtonStyle() bool
UpdateButtonStyle sets the button style based on current state info -- returns true if changed -- restyles parts if so
type ButtonBox ¶ added in v0.9.9
type ButtonBox struct { PartsWidgetBase Items []string `desc:"the list of items (checbox button labels)"` Mutex bool `desc:"make the items mutually exclusive -- checking one turns off all the others"` ButtonSig ki.Signal `` /* 171-byte string literal not displayed */ }
ButtonBox is a widget for containing a set of CheckBox buttons. It can optionally enforce mutual excusivity (i.e., Radio Buttons). The buttons are all in the Parts of the widget and the Parts layout determines how they are displayed.
func AddNewButtonBox ¶ added in v0.9.9
AddNewButtonBox adds a new button to given parent node, with given name.
func (*ButtonBox) BitFlagsValue ¶ added in v0.9.9
BitFlagsValue returns the int64 value for all checkboxes from given BitFlag Enum type (see kit.EnumRegistry) with given value
func (*ButtonBox) ConfigItems ¶ added in v0.9.9
func (bb *ButtonBox) ConfigItems()
func (*ButtonBox) ConfigParts ¶ added in v0.9.9
func (bb *ButtonBox) ConfigParts()
func (*ButtonBox) ConfigPartsIfNeeded ¶ added in v0.9.9
func (bb *ButtonBox) ConfigPartsIfNeeded()
func (*ButtonBox) CopyFieldsFrom ¶ added in v0.9.9
func (bb *ButtonBox) CopyFieldsFrom(frm interface{})
func (*ButtonBox) Disconnect ¶ added in v0.9.9
func (bb *ButtonBox) Disconnect()
func (*ButtonBox) ItemsFromEnum ¶ added in v0.9.9
ItemsFromEnum sets the Items list from an enum type, which must be registered on kit.EnumRegistry.
func (*ButtonBox) ItemsFromEnumList ¶ added in v0.9.9
ItemsFromEnumList sets the Items list from a list of enum values (see kit.EnumRegistry)
func (*ButtonBox) ItemsFromStringList ¶ added in v0.9.9
ItemsFromStringList sets the Items list from a list of string values -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ButtonBox) RenderButtonBox ¶ added in v1.0.5
func (bb *ButtonBox) RenderButtonBox()
func (*ButtonBox) SelectItem ¶ added in v0.9.9
SelectItem activates a given item but does NOT emit the ButtonSig signal. See SelectItemAction for signal emitting version. returns error if index is out of range.
func (*ButtonBox) SelectItemAction ¶ added in v1.2.3
SelectItemAction activates a given item and emits the ButtonSig signal. This is mainly for Mutex use. returns error if index is out of range.
func (*ButtonBox) UnCheckAll ¶ added in v0.9.9
func (bb *ButtonBox) UnCheckAll()
UnCheckAll unchecks all buttons
func (*ButtonBox) UnCheckAllBut ¶ added in v1.2.3
UnCheckAllBut unchecks all buttons except given one
type ButtonFlags ¶ added in v0.9.9
type ButtonFlags int
ButtonFlags extend NodeBase NodeFlags to hold button state
const ( // button is checkable -- enables display of check control ButtonFlagCheckable ButtonFlags = ButtonFlags(NodeFlagsN) + iota // button is checked ButtonFlagChecked // Menu flag means that the button is a menu item ButtonFlagMenu ButtonFlagsN )
func StringToButtonFlags ¶ added in v0.9.9
func StringToButtonFlags(s string) (ButtonFlags, error)
func (ButtonFlags) String ¶ added in v0.9.9
func (i ButtonFlags) String() string
type ButtonSignals ¶
type ButtonSignals int64
ButtonSignals are signals that buttons can send
const ( // ButtonClicked is the main signal to check for normal button activation // -- button pressed down and up ButtonClicked ButtonSignals = iota // Pressed means button pushed down but not yet up ButtonPressed // Released means mouse button was released - typically look at // ButtonClicked instead of this one ButtonReleased // Toggled means the checked / unchecked state was toggled -- only sent // for buttons with Checkable flag set ButtonToggled ButtonSignalsN )
func (*ButtonSignals) FromString ¶
func (i *ButtonSignals) FromString(s string) error
func (ButtonSignals) String ¶
func (i ButtonSignals) String() string
type ButtonStates ¶
type ButtonStates int32
mutually-exclusive button states -- determines appearance
const ( // normal active state -- there but not being interacted with ButtonActive ButtonStates = iota // inactive -- not pressable -- no events ButtonInactive // mouse is hovering over the button ButtonHover // button is the focus -- will respond to keyboard input ButtonFocus // button is currently being pressed down ButtonDown // button has been selected -- selection is a general widget property used // by views and other complex widgets -- checked state is independent of this ButtonSelected // total number of button states ButtonStatesN )
func (*ButtonStates) FromString ¶
func (i *ButtonStates) FromString(s string) error
func (ButtonStates) MarshalJSON ¶
func (ev ButtonStates) MarshalJSON() ([]byte, error)
func (ButtonStates) String ¶
func (i ButtonStates) String() string
func (*ButtonStates) UnmarshalJSON ¶
func (ev *ButtonStates) UnmarshalJSON(b []byte) error
type ButtonWidget ¶
type ButtonWidget interface { // AsButtonBase gets the button base for most basic functions -- reduces // interface size. AsButtonBase() *ButtonBase // ButtonRelease is called for release of button -- this is where buttons // actually differ in functionality. ButtonRelease() // StyleParts is called during Style2D to handle styling associated with // parts -- icons mainly. StyleParts() // ConfigParts configures the parts of the button -- called during init // and style. ConfigParts() // ConfigPartsIfNeeded configures the parts of the button, only if needed // -- called during layout and render ConfigPartsIfNeeded() }
ButtonWidget is an interface for button widgets allowing ButtonBase defaults to handle most cases.
type CheckBox ¶
type CheckBox struct { ButtonBase IconOff IconName `` /* 161-byte string literal not displayed */ }
CheckBox toggles between a checked and unchecked state
func AddNewCheckBox ¶ added in v0.9.7
AddNewCheckBox adds a new button to given parent node, with given name.
func (*CheckBox) AsButtonBase ¶ added in v0.9.8
func (cb *CheckBox) AsButtonBase() *ButtonBase
func (*CheckBox) ButtonRelease ¶
func (cb *CheckBox) ButtonRelease()
func (*CheckBox) ConfigParts ¶
func (cb *CheckBox) ConfigParts()
func (*CheckBox) ConfigPartsIfNeeded ¶
func (cb *CheckBox) ConfigPartsIfNeeded()
func (*CheckBox) CopyFieldsFrom ¶ added in v0.9.8
func (cb *CheckBox) CopyFieldsFrom(frm interface{})
func (*CheckBox) OnClicked ¶ added in v1.2.14
func (cb *CheckBox) OnClicked(fun func())
OnClicked calls the given function when the button is clicked, which is the default / standard way of activating the button
func (*CheckBox) SetIconProps ¶
SetIconProps sets the icon properties from given property list -- parent types can use this to set different icon properties
func (*CheckBox) SetIcons ¶
SetIcons sets the Icons (by name) for the On (checked) and Off (unchecked) states, and updates button
func (*CheckBox) StyleParts ¶
func (cb *CheckBox) StyleParts()
type Clipper ¶
type Clipper interface { // MimeData adds mimedata to given record to represent item on clipboard MimeData(md *mimedata.Mimes) // Copy copies item to the clipboard // e.g., use oswin.TheApp.ClipBoard(tv.ParentWindow().OSWin).Write(md) // where md is mime-encoded data for the object Copy(reset bool) // Cut cuts item to the clipboard, typically calls Copy and then deletes // itself Cut() // Paste pastes from clipboard to item, e.g., // md := oswin.TheApp.ClipBoard(tv.ParentWindow().OSWin).Read([]string{filecat.DataJson}) // reads mime-encoded data from the clipboard, in this case in the JSON format Paste() }
Clipper is the interface for standard clipboard operations Types can use this interface to support extensible clip functionality used in all relevant valueview types in giv package (e.g., TreeView)
type ColorName ¶ added in v0.9.8
type ColorName string
ColorName provides a value-view GUI lookup of valid color names
type ColorPrefs ¶
type ColorPrefs struct { HiStyle HiStyleName `desc:"text highilighting style / theme"` Font gist.Color `desc:"default font / pen color"` Background gist.Color `desc:"default background color"` Shadow gist.Color `desc:"color for shadows -- should generally be a darker shade of the background color"` Border gist.Color `desc:"default border color, for button, frame borders, etc"` Control gist.Color `desc:"default main color for controls: buttons, etc"` Icon gist.Color `desc:"color for icons or other solidly-colored, small elements"` Select gist.Color `desc:"color for selected elements"` Highlight gist.Color `desc:"color for highlight background"` Link gist.Color `desc:"color for links in text etc"` }
ColorPrefs specify colors for all major categories of GUI elements, and are used in the default styles.
func (*ColorPrefs) DarkDefaults ¶ added in v0.9.11
func (pf *ColorPrefs) DarkDefaults()
func (*ColorPrefs) Defaults ¶
func (pf *ColorPrefs) Defaults()
func (*ColorPrefs) OpenJSON ¶
func (pf *ColorPrefs) OpenJSON(filename FileName) error
OpenJSON opens colors from a JSON-formatted file.
func (*ColorPrefs) PrefColor ¶
func (pf *ColorPrefs) PrefColor(clrName string) *gist.Color
PrefColor returns preference color of given name (case insensitive) std names are: font, background, shadow, border, control, icon, select, highlight, link
func (*ColorPrefs) SaveJSON ¶
func (pf *ColorPrefs) SaveJSON(filename FileName) error
SaveJSON saves colors to a JSON-formatted file.
func (*ColorPrefs) SetToPrefs ¶ added in v0.9.11
func (pf *ColorPrefs) SetToPrefs()
SetToPrefs sets this color scheme as the current active setting in overall default prefs.
type ComboBox ¶
type ComboBox struct { ButtonBase Editable bool `` /* 130-byte string literal not displayed */ CurVal interface{} `json:"-" xml:"-" desc:"current selected value"` CurIndex int `json:"-" xml:"-" desc:"current index in list of possible items"` Items []interface{} `json:"-" xml:"-" desc:"items available for selection"` ItemsMenu Menu `json:"-" xml:"-" desc:"the menu of actions for selecting items -- automatically generated from Items"` ComboSig ki.Signal `` /* 178-byte string literal not displayed */ MaxLength int `desc:"maximum label length (in runes)"` }
ComboBox is for selecting items from a dropdown list, with an optional edit TextField for typing directly. The items can be of any type, including enum values -- they are converted to strings for the display. If the items are IconName type, then they are displayed using icons instead.
func AddNewComboBox ¶ added in v0.9.7
AddNewComboBox adds a new button to given parent node, with given name.
func (*ComboBox) ButtonRelease ¶
func (cb *ComboBox) ButtonRelease()
func (*ComboBox) ConfigParts ¶
func (cb *ComboBox) ConfigParts()
func (*ComboBox) ConfigPartsIconText ¶
func (cb *ComboBox) ConfigPartsIconText(config *kit.TypeAndNameList, icnm string) (icIdx, txIdx int)
ConfigPartsIconText returns a standard config for creating parts, of icon and text left-to right in a row -- always makes text
func (*ComboBox) ConfigPartsIfNeeded ¶
func (cb *ComboBox) ConfigPartsIfNeeded()
func (*ComboBox) ConfigPartsSetText ¶
ConfigPartsSetText sets part style props, using given props if not set in object props
func (*ComboBox) CopyFieldsFrom ¶ added in v0.9.8
func (cb *ComboBox) CopyFieldsFrom(frm interface{})
func (*ComboBox) Disconnect ¶ added in v0.9.8
func (cb *ComboBox) Disconnect()
func (*ComboBox) ItemsFromEnum ¶
ItemsFromEnum sets the Items list from an enum type, which must be registered on kit.EnumRegistry -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit -- see kit.EnumRegistry, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromEnumList ¶
ItemsFromEnumList sets the Items list from a list of enum values (see kit.EnumRegistry) -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromIconList ¶ added in v1.2.3
ItemsFromIconList sets the Items list from a list of IconName values -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromStringList ¶
ItemsFromStringList sets the Items list from a list of string values -- if setFirst then set current item to the first item in the list, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) ItemsFromTypes ¶
ItemsFromTypes sets the Items list from a list of types -- see e.g., AllImplementersOf or AllEmbedsOf in kit.TypeRegistry -- if setFirst then set current item to the first item in the list, sort sorts the list in ascending order, and maxLen if > 0 auto-sets the width of the button to the contents, with the given upper limit
func (*ComboBox) MakeItems ¶
MakeItems makes sure the Items list is made, and if not, or reset is true, creates one with the given capacity
func (*ComboBox) MakeItemsMenu ¶
func (cb *ComboBox) MakeItemsMenu()
MakeItemsMenu makes menu of all the items
func (*ComboBox) SelectItem ¶
SelectItem selects a given item and updates the display to it
func (*ComboBox) SelectItemAction ¶ added in v1.2.3
SelectItemAction selects a given item and emits the index as the ComboSig signal and the selected item as the data.
func (*ComboBox) SetCurIndex ¶
SetCurIndex sets the current index (CurIndex) and the corresponding CurVal for that item on the current Items list (-1 if not found) -- returns value -- and sets the text to the string value of that value (using standard Stringer string conversion)
func (*ComboBox) SetCurVal ¶
SetCurVal sets the current value (CurVal) and the corresponding CurIndex for that item on the current Items list (adds to items list if not found) -- returns that index -- and sets the text to the string value of that value (using standard Stringer string conversion)
func (*ComboBox) SetToMaxLength ¶
SetToMaxLength gets the maximum label length so that the width of the button label is automatically set according to the max length of all items in the list -- if maxLen > 0 then it is used as an upper do-not-exceed length
func (*ComboBox) ShowCurVal ¶ added in v1.2.3
func (cb *ComboBox) ShowCurVal()
ShowCurVal updates the display to present the currently-selected value (CurVal)
type Complete ¶
type Complete struct { ki.Node MatchFunc complete.MatchFunc `desc:"function to get the list of possible completions"` LookupFunc complete.LookupFunc `desc:"function to get the text to show for lookup"` EditFunc complete.EditFunc `desc:"function to edit text using the selected completion"` Context interface{} `desc:"the object that implements complete.Func"` SrcLn int `desc:"line number in source that completion is operating on, if relevant"` SrcCh int `desc:"character position in source that completion is operating on"` Completions complete.Completions `desc:"the list of potential completions"` Seed string `desc:"current completion seed"` CompleteSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for complete -- see CompleteSignals for the types"` Completion string `desc:"the user's completion selection'"` Vp *Viewport2D `desc:"the viewport where the current popup menu is presented"` DelayTimer *time.Timer DelayMu sync.Mutex ShowMu sync.Mutex }
Complete holds the current completion data and functions to call for building the list of possible completions and for editing text after a completion is selected
func (*Complete) Abort ¶ added in v0.9.11
Abort aborts *only* pending completions, but does not close existing window. Returns true if aborted.
func (*Complete) Cancel ¶
Cancel cancels any existing *or* pending completion. Call when new events nullify prior completions. Returns true if canceled.
func (*Complete) Complete ¶
Complete emits a signal to let subscribers know that the user has made a selection from the list of possible completions
func (*Complete) Disconnect ¶ added in v0.9.8
func (cm *Complete) Disconnect()
func (*Complete) GetCompletion ¶
func (c *Complete) GetCompletion(s string) complete.Completion
func (*Complete) IsAboutToShow ¶ added in v0.9.11
IsAboutToShow returns true if the DelayTimer is started for preparing to show a completion. note: don't really need to lock
func (*Complete) KeyInput ¶
KeyInput is the opportunity for completion to act on specific key inputs
func (*Complete) Lookup ¶ added in v0.9.11
func (c *Complete) Lookup(text string, posLn, posCh int, vp *Viewport2D, pt image.Point, force bool)
Lookup is the main call for doing lookups
type CompleteSignals ¶
type CompleteSignals int64
CompleteSignals are signals that are sent by Complete
const ( // CompleteSelect means the user chose one of the possible completions CompleteSelect CompleteSignals = iota // CompleteExtend means user has requested that the seed extend if all // completions have a common prefix longer than current seed CompleteExtend )
func (*CompleteSignals) FromString ¶
func (i *CompleteSignals) FromString(s string) error
func (CompleteSignals) String ¶
func (i CompleteSignals) String() string
type Completer ¶ added in v0.9.8
type Completer interface { // SetCompleter sets completion functions so that completions will // automatically be offered as the user types. data provides context where being used. SetCompleter(data interface{}, matchFun complete.MatchFunc, editFun complete.EditFunc) }
Completer interface supports the SetCompleter method for setting completer parameters This is defined e.g., on TextField and TextBuf
type CtxtMenuFunc ¶
CtxtMenuFunc is a function for creating a context menu for given node
type DNDStages ¶ added in v0.9.11
type DNDStages int32
DNDStages indicates stage of DND process
const ( // DNDNotStarted = nothing happening DNDNotStarted DNDStages = iota // DNDStartSent means that the Start event was sent out, but receiver has // not yet started the DND on its end by calling StartDragNDrop DNDStartSent // DNDStarted means that a node called StartDragNDrop DNDStarted // DNDDropped means that drop event has been sent DNDDropped DNDStagesN )
func (*DNDStages) FromString ¶ added in v0.9.11
type Dialog ¶
type Dialog struct { Viewport2D Title string `desc:"title text displayed as the window title for the dialog"` Prompt string `desc:"a prompt string displayed below the title"` Modal bool `desc:"open the dialog in a modal state, blocking all other input"` DefSize image.Point `` /* 200-byte string literal not displayed */ State DialogState `desc:"state of the dialog"` SigVal int64 `` /* 139-byte string literal not displayed */ DialogSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for dialog -- sends a signal when opened, accepted, or canceled"` Data interface{} `` /* 188-byte string literal not displayed */ }
Dialog supports dialog functionality -- based on a viewport that can either be rendered in a separate window or on top of an existing one.
func NewKiDialog ¶
func NewKiDialog(avp *Viewport2D, iface reflect.Type, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog
NewKiDialog prompts for creating new item(s) of a given type, showing types that implement given interface. Use construct of form: reflect.TypeOf((*gi.Node2D)(nil)).Elem() Optionally connects to given signal receiving object and function for dialog signals (nil to ignore).
func NewStdDialog ¶
NewStdDialog returns a basic standard dialog with given options (title, prompt, CSS styling) and whether ok, cancel buttons should be shown -- any empty text will not be added -- returns with UpdateStart started but NOT ended -- must call UpdateEnd(true) once done configuring! Use AddOk / NoOk, AddCancel / NoCancel for bool args.
func RecycleStdDialog ¶ added in v0.9.10
RecycleStdDialog looks for existing dialog window with same Data -- if found brings that to the front, returns it, and true bool. else (and if data is nil) calls NewStdDialog, returns false.
func StringPromptDialog ¶
func StringPromptDialog(avp *Viewport2D, strval, placeholder string, opts DlgOpts, recv ki.Ki, fun ki.RecvFunc) *Dialog
StringPromptDialog prompts the user for a string value -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore). Viewport is optional to properly contextualize dialog to given master window.
func (*Dialog) Accept ¶
func (dlg *Dialog) Accept()
Accept accepts the dialog, activated by the default Ok button
func (*Dialog) AddButtonBox ¶
AddButtonBox adds a button box (Row Layout) named "buttons" to given frame, with an extra space above it
func (*Dialog) ButtonBox ¶
ButtonBox returns the ButtonBox layout widget, and its index, within frame -- nil, -1 if not found
func (*Dialog) Cancel ¶
func (dlg *Dialog) Cancel()
Cancel cancels the dialog, activated by the default Cancel button
func (*Dialog) Close ¶
func (dlg *Dialog) Close()
Close requests that the dialog be closed -- it does not alter any state or send any signals
func (*Dialog) Disconnect ¶ added in v0.9.8
func (dlg *Dialog) Disconnect()
func (*Dialog) Frame ¶
Frame returns the main frame for the dialog, assumed to be the first element in the dialog
func (*Dialog) HasFocus2D ¶
func (*Dialog) Open ¶
func (dlg *Dialog) Open(x, y int, avp *Viewport2D, cfgFunc func()) bool
Open this dialog, in given location (0 = middle of window), finding window from given viewport -- returns false if it fails for any reason. optional cvgFunc can perform additional configuration after the dialog window has been created and dialog added to it -- some configs require the window.
func (*Dialog) PromptWidget ¶
PromptWidget returns the prompt label widget, and its index, within frame -- if nil returns the title widget (flexible if prompt is nil)
func (*Dialog) PromptWidgetIdx ¶ added in v1.0.16
PromptWidgetIdx returns the prompt label widget index only for use in Python with only one return value.
func (*Dialog) SetFrame ¶
SetFrame creates a standard vertical column frame layout as first element of the dialog, named "frame"
func (*Dialog) SetPrompt ¶
SetPrompt sets the prompt and adds a Label named "prompt" to the given frame layout if passed
func (*Dialog) SetTitle ¶
SetTitle sets the title and adds a Label named "title" to the given frame layout if passed
func (*Dialog) StdButtonConfig ¶
func (dlg *Dialog) StdButtonConfig(stretch, ok, cancel bool) kit.TypeAndNameList
StdButtonConfig returns a kit.TypeAndNameList for calling on ConfigChildren of a button box, to create standard Ok, Cancel buttons (if true), optionally starting with a Stretch element that will cause the buttons to be arranged on the right -- a space element is added between buttons if more than one
func (*Dialog) StdButtonConnect ¶
StdButtonConnect connects standard buttons in given button box layout to Accept / Cancel actions
type DialogState ¶
type DialogState int64
DialogState indicates the state of the dialog.
const ( // DialogExists is the existential state -- struct exists and is likely // being constructed. DialogExists DialogState = iota // DialogOpenModal means dialog is open in a modal state, blocking all other input. DialogOpenModal // DialogOpenModeless means dialog is open in a modeless state, allowing other input. DialogOpenModeless // DialogAccepted means Ok was pressed -- dialog accepted. DialogAccepted // DialogCanceled means Cancel was pressed -- button canceled. DialogCanceled DialogStateN )
func (*DialogState) FromString ¶
func (i *DialogState) FromString(s string) error
func (DialogState) String ¶
func (i DialogState) String() string
type DlgOpts ¶
type DlgOpts struct { Title string `desc:"generally should be provided -- will also be 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"` }
DlgOpts are the basic dialog options accepted by all dialog methods -- provides a named, optional way to specify these args
type DragNDropper ¶
type DragNDropper interface { // Drop is called when something is dropped on this item // the mod is either dnd.DropCopy for a copy-like operation (the default) // or dnd.Move for a move-like operation (with Shift key held down) // drop must call Window.FinalizeDragNDrop with the mod actually used // to have the source update itself Drop(md mimedata.Mimes, mod dnd.DropMods) // Dragged is called on source of drag-n-drop after the drop is finalized Dragged(de *dnd.Event) // DropExternal is called when something is dropped on this item from // an external source (not within same app). // the mod is either dnd.DropCopy for a copy-like operation (the default) // or dnd.Move for a move-like operation (with Shift key held down) // drop DOES NOT need to call Window.FinalizeDragNDrop with the mod actually used // to have the source update itself -- no harm if it does however, as the source // will be nil. DropExternal(md mimedata.Mimes, mod dnd.DropMods) }
DragNDropper is the interface for standard drag-n-drop actions Types can use this interface to support extensible DND functionality used in all relevant valueview types in giv package (e.g., TreeView)
type EditorPrefs ¶ added in v0.9.11
type EditorPrefs struct { TabSize int `xml:"tab-size" desc:"size of a tab, in chars -- also determines indent level for space indent"` SpaceIndent bool `xml:"space-indent" desc:"use spaces for indentation, otherwise tabs"` WordWrap bool `xml:"word-wrap" desc:"wrap lines at word boundaries -- otherwise long lines scroll off the end"` LineNos bool `xml:"line-nos" desc:"show line numbers"` Completion bool `xml:"completion" desc:"use the completion system to suggest options while typing"` SpellCorrect bool `xml:"spell-correct" desc:"suggest corrections for unknown words while typing"` AutoIndent bool `xml:"auto-indent" desc:"automatically indent lines when enter, tab, }, etc pressed"` EmacsUndo bool `` /* 182-byte string literal not displayed */ DepthColor bool `xml:"depth-color" desc:"colorize the background according to nesting depth"` }
EditorPrefs contains editor preferences. It can also be set from ki.Props style properties.
func (*EditorPrefs) Defaults ¶ added in v0.9.11
func (pf *EditorPrefs) Defaults()
Defaults are the defaults for EditorPrefs
func (*EditorPrefs) StyleFromProps ¶ added in v0.9.11
func (pf *EditorPrefs) StyleFromProps(props ki.Props)
StyleFromProps styles Slider-specific fields from ki.Prop properties doesn't support inherit or default
type EventMaster ¶ added in v0.9.11
type EventMaster interface { // EventTopNode returns the top-level node for this event scope. // This is also the node that serves as the event sender. // By default it is the Window. EventTopNode() ki.Ki // FocusTopNode returns the top-level node for key event focusing. FocusTopNode() ki.Ki // EventTopUpdateStart does an UpdateStart on top-level node, for batch updates. // This may not be identical to EventTopNode().UpdateStart() for // embedded case where Viewport is the EventTopNode. EventTopUpdateStart() bool // EventTopUpdateEnd does an UpdateEnd on top-level node, for batch updates. // This may not be identical to EventTopNode().UpdateEnd() for // embedded case where Viewport is the EventTopNode. EventTopUpdateEnd(updt bool) // IsInScope returns whether given node is in scope for receiving events IsInScope(node ki.Ki, popup bool) bool // CurPopupIsTooltip returns true if current popup is a tooltip CurPopupIsTooltip() bool // DeleteTooltip deletes any tooltip popup (called when hover ends) DeleteTooltip() // IsFocusActive returns true if focus is active in this master IsFocusActive() bool // SetFocusActiveState sets focus active state SetFocusActiveState(active bool) }
EventMaster provides additional control methods for the event manager, for things beyond its immediate scope
type EventMgr ¶ added in v0.9.11
type EventMgr struct { Master EventMaster `desc:"master of this event mangager -- handles broader scope issues"` EventSigs [oswin.EventTypeN][EventPrisN]ki.Signal `desc:"signals for communicating each type of event, organized by priority"` EventMu sync.Mutex `desc:"mutex that protects event sending"` TimerMu sync.Mutex `desc:"mutex that protects timer variable updates (e.g., hover AfterFunc's)"` Dragging ki.Ki `desc:"node receiving mouse dragging events -- not for DND but things like sliders -- anchor to same"` Scrolling ki.Ki `desc:"node receiving mouse scrolling events -- anchor to same"` DNDStage DNDStages `desc:"stage of DND process"` DNDData mimedata.Mimes `desc:"drag-n-drop data -- if non-nil, then DND is taking place"` DNDSource ki.Ki `desc:"drag-n-drop source node"` DNDFinalEvent *dnd.Event `desc:"final event for DND which is sent if a finalize is received"` DNDDropMod dnd.DropMods `desc:"modifier in place at time of drop event (DropMove or DropCopy)"` Focus ki.Ki `desc:"node receiving keyboard events -- use SetFocus, CurFocus"` FocusMu sync.RWMutex `desc:"mutex that protects focus updating"` FocusStack []ki.Ki `desc:"stack of focus"` StartFocus ki.Ki `desc:"node to focus on at start when no other focus has been set yet -- use SetStartFocus"` LastModBits int32 `desc:"Last modifier key bits from most recent Mouse, Keyboard events"` LastSelMode mouse.SelectModes `desc:"Last Select Mode from most recent Mouse, Keyboard events"` LastMousePos image.Point `desc:"Last mouse position from most recent Mouse events"` LagSkipDeltaPos image.Point `desc:"change in position accumulated from skipped-over laggy mouse move events"` LagLastSkipped bool `desc:"true if last event was skipped due to lag"` // contains filtered or unexported fields }
EventMgr is an event manager that handles distributing events to nodes. It relies on the EventMaster for a few things outside of its scope.
func (*EventMgr) ActivateStartFocus ¶ added in v0.9.11
ActivateStartFocus activates start focus if there is no current focus and StartFocus is set -- returns true if activated
func (*EventMgr) ClearDND ¶ added in v0.9.11
func (em *EventMgr) ClearDND()
ClearDND clears DND state
func (*EventMgr) ClearNonFocus ¶ added in v0.9.11
ClearNonFocus clears the focus of any non-w.Focus item.
func (*EventMgr) ConnectEvent ¶ added in v0.9.11
ConnectEvent adds a Signal connection for given event type and priority to given receiver
func (*EventMgr) CurFocus ¶ added in v0.9.11
CurFocus gets the current focus node under mutex protection
func (*EventMgr) DNDIsInternalSrc ¶ added in v0.9.11
DNDIsInternalSrc returns true if the source of the DND operation is internal to GoGi system -- otherwise it originated from external OS source.
func (*EventMgr) DNDStart ¶ added in v0.9.11
DNDStart is driven by node responding to start event, actually starts DND
func (*EventMgr) DNDStartEvent ¶ added in v0.9.11
DNDStartEvent handles drag-n-drop start events.
func (*EventMgr) DisconnectAllEvents ¶ added in v0.9.11
DisconnectAllEvents disconnect node from all event signals -- pri is priority -- pass AllPris for all priorities
func (*EventMgr) DisconnectEvent ¶ added in v0.9.11
DisconnectEvent removes Signal connection for given event type to given receiver -- pri is priority -- pass AllPris for all priorities
func (*EventMgr) DoInstaDrag ¶ added in v0.9.11
DoInstaDrag tests whether the given mouse DragEvent is on a widget marked with InstaDrag
func (*EventMgr) FilterLaggyEvents ¶ added in v0.9.11
FilterLaggyEvents filters repeated laggy events -- key for responsive resize, scroll, etc returns false if event should not be processed further, and true if it should. Should only be called when the current event is the same type as last time. Accumulates mouse deltas in LagSkipDeltaPos.
func (*EventMgr) FocusLast ¶ added in v0.9.11
FocusLast sets the focus on the last item in the tree -- returns true if a focusable item was found
func (*EventMgr) FocusNext ¶ added in v0.9.11
FocusNext sets the focus on the next item that can accept focus after the
given item (can be nil) -- returns true if a focus item found.
func (*EventMgr) FocusOnOrNext ¶ added in v0.9.11
FocusOnOrNext sets the focus on the given item, or the next one that can accept focus -- returns true if a new focus item found.
func (*EventMgr) FocusOnOrPrev ¶ added in v0.9.11
FocusOnOrPrev sets the focus on the given item, or the previous one that can accept focus -- returns true if a new focus item found.
func (*EventMgr) FocusPrev ¶ added in v0.9.11
FocusPrev sets the focus on the previous item before the given item (can be nil)
func (*EventMgr) GenDNDFocusEvents ¶ added in v0.9.11
GenDNDFocusEvents processes mouse.MoveEvent to generate dnd.FocusEvent events -- returns true if any such events were sent. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope). Extra work is done to ensure that Exit from prior widget is always sent before Enter to next one.
func (*EventMgr) GenMouseFocusEvents ¶ added in v0.9.11
GenMouseFocusEvents processes mouse.MoveEvent to generate mouse.FocusEvent events -- returns true if any such events were sent. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) InitialFocus ¶ added in v0.9.11
func (em *EventMgr) InitialFocus()
InitialFocus establishes the initial focus for the window if no focus is set -- uses ActivateStartFocus or FocusNext as backup.
func (*EventMgr) ManagerKeyChordEvents ¶ added in v0.9.11
func (em *EventMgr) ManagerKeyChordEvents(e *key.ChordEvent)
MangerKeyChordEvents handles lower-priority manager-level key events. Mainly tab, shift-tab, and GoGiEditor and Prefs. event will be marked as processed if handled here.
func (*EventMgr) MouseDragEvents ¶ added in v0.9.11
MouseDragEvents processes MouseDragEvent to Detect start of drag and DND. These require timing and delays, e.g., due to minor wiggles when pressing the mouse button
func (*EventMgr) MouseEventReset ¶ added in v0.9.11
MouseEventReset resets state for "catch" events (Dragging, Scrolling)
func (*EventMgr) MouseEvents ¶ added in v0.9.11
MouseEvents processes mouse drag and move events
func (*EventMgr) MouseMoveEvents ¶ added in v0.9.11
MouseMoveEvents processes MouseMoveEvent to detect start of hover events. These require timing and delays
func (*EventMgr) PopFocus ¶ added in v0.9.11
func (em *EventMgr) PopFocus()
PopFocus pops off the focus stack and sets prev to current focus.
func (*EventMgr) PushFocus ¶ added in v0.9.11
PushFocus pushes current focus onto stack and sets new focus.
func (*EventMgr) ResetMouseDrag ¶ added in v0.9.11
func (em *EventMgr) ResetMouseDrag()
ResetMouseDrag resets all the mouse dragging variables after last drag
func (*EventMgr) ResetMouseMove ¶ added in v0.9.11
func (em *EventMgr) ResetMouseMove()
ResetMouseMove resets all the mouse moving variables after last move
func (*EventMgr) SendDNDDropEvent ¶ added in v0.9.11
SendDNDDropEvent sends DND drop event -- returns false if drop event was not processed in which case the event should be cleared (by the Window)
func (*EventMgr) SendDNDHoverEvent ¶ added in v0.9.11
SendDNDHoverEvent sends DND hover event, based on last mouse move event
func (*EventMgr) SendDNDMoveEvent ¶ added in v0.9.11
SendDNDMoveEvent sends DND move event
func (*EventMgr) SendEventSignal ¶ added in v0.9.11
SendEventSignal sends given event signal to all receivers that want it -- note that because there is a different EventSig for each event type, we are ONLY looking at nodes that have registered to receive that type of event -- the further filtering is just to ensure that they are in the right position to receive the event (focus, popup filtering, etc). If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) SendEventSignalFunc ¶ added in v0.9.11
func (em *EventMgr) SendEventSignalFunc(evi oswin.Event, popup bool, rvs *WinEventRecvList, recv ki.Ki, fun ki.RecvFunc) bool
SendEventSignalFunc is the inner loop of the SendEventSignal -- needed to deal with map iterator locking logic in a cleaner way. Returns true to continue, false to break
func (*EventMgr) SendHoverEvent ¶ added in v0.9.11
func (em *EventMgr) SendHoverEvent(he *mouse.HoverEvent)
SendHoverEvent sends mouse hover event, based on last mouse move event
func (*EventMgr) SendKeyChordEvent ¶ added in v0.9.11
SendKeyChordEvent sends a KeyChord event with given values. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) SendKeyFunEvent ¶ added in v0.9.11
SendKeyFunEvent sends a KeyChord event with params from the given KeyFun. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*EventMgr) SendSig ¶ added in v0.9.11
SendSig directly calls SendSig from given recv, sender for given event across all priorities.
func (*EventMgr) SetFocus ¶ added in v0.9.11
SetFocus sets focus to given item -- returns true if focus changed. If item is nil, then nothing has focus.
func (*EventMgr) SetStartFocus ¶ added in v0.9.11
SetStartFocus sets the given item to be first focus when window opens.
type EventPris ¶
type EventPris int32
EventPris for different queues of event signals, processed in priority order
const ( // HiPri = high priority -- event receivers processed first -- can be used // to override default behavior HiPri EventPris = iota // RegPri = default regular priority -- most should be here RegPri // LowPri = low priority -- processed last -- typically for containers / // dialogs etc LowPri // LowRawPri = unfiltered (raw) low priority -- ignores whether the event // was already processed. LowRawPri EventPrisN // AllPris = -1 = all priorities (for delete cases only) AllPris EventPris = -1 )
func StringToEventPris ¶
type FavPathItem ¶
type FavPathItem struct { Ic IconName `desc:"icon for item"` Name string `width:"20" desc:"name of the favorite item"` Path string `tableview:"-select"` }
FavPathItem represents one item in a favorite path list, for display of favorites. Is an ordered list instead of a map because user can organize in order
func (FavPathItem) Label ¶
func (fi FavPathItem) Label() string
Label satisfies the Labeler interface
type FavPaths ¶
type FavPaths []FavPathItem
FavPaths is a list (slice) of favorite path items
func (*FavPaths) SetToDefaults ¶
func (pf *FavPaths) SetToDefaults()
SetToDefaults sets the paths to default values
type FileName ¶
type FileName string
FileName is used to specify an filename (including path) -- automatically opens the FileView dialog using ValueView system. Use this for any method args that are filenames to trigger use of FileViewDialog under MethView automatic method calling.
type FilePaths ¶
type FilePaths []string
var SavedPaths FilePaths
func (*FilePaths) AddPath ¶
AddPath inserts a path to the file paths (at the start), subject to max length -- if path is already on the list then it is moved to the start.
type FocusChanges ¶
type FocusChanges int32
FocusChanges are the kinds of changes that can be reported via FocusChanged2D method
const ( // FocusLost means that keyboard focus is on a different widget // (typically) and this one lost focus FocusLost FocusChanges = iota // FocusGot means that this widget just got keyboard focus FocusGot // FocusInactive means that although this widget retains keyboard focus // (nobody else has it), the user has clicked on something else and // therefore the focus should be considered inactive (distracted), and any // changes should be applied as this other action could result in closing // of a dialog etc. Keyboard events will still be sent to the focus // widget, but it is up to the widget if or how to process them (e.g., it // could reactivate on its own). FocusInactive // FocusActive means that the user has moved the mouse back into the // focused widget to resume active keyboard focus. FocusActive FocusChangesN )
func (*FocusChanges) FromString ¶
func (i *FocusChanges) FromString(s string) error
func (FocusChanges) String ¶
func (i FocusChanges) String() string
type FontName ¶
type FontName string
FontName is used to specify a font, as the unique name of the font family. This automatically provides a chooser menu for fonts using giv ValueView.
type Frame ¶
type Frame struct { Layout Stripes Stripes `desc:"options for striped backgrounds -- rendered as darker bands relative to background color"` }
Frame is a Layout that renders a background according to the background-color style setting, and optional striping for grid layouts
func AddNewFrame ¶ added in v0.9.7
AddNewFrame adds a new frame to given parent node, with given name and layout
func (*Frame) CopyFieldsFrom ¶ added in v0.9.8
func (fr *Frame) CopyFieldsFrom(frm interface{})
func (*Frame) FrameStdRender ¶
func (fr *Frame) FrameStdRender()
FrameStdRender does the standard rendering of the frame itself
func (*Frame) RenderStripes ¶
func (fr *Frame) RenderStripes()
type Geom2DInt ¶
Geom2DInt defines a geometry in 2D dots units (int) -- this is just a more convenient format than image.Rectangle for cases where the size and position are independently updated (e.g., Viewport)
type Gradient ¶
type Gradient struct { Node2DBase Grad gist.ColorSpec `desc:"the color gradient"` StopsName string `desc:"name of another gradient to get stops from"` }
Gradient is used for holding a specified color gradient (ColorSpec) name is id for lookup in url
func AddNewGradient ¶ added in v0.9.7
AddNewGradient adds a new gradient to given parent node, with given name.
func (*Gradient) CopyFieldsFrom ¶ added in v0.9.8
func (gr *Gradient) CopyFieldsFrom(frm interface{})
func (*Gradient) GradientType ¶ added in v1.2.0
GradientType returns the SVG-style type name of gradient: linearGradient or radialGradient
type GridData ¶
type GridData struct { SizeNeed float32 SizePref float32 SizeMax float32 AllocSize float32 AllocPosRel float32 }
GridData contains data for grid layout -- only one value needed for relevant dim
type HiStyleName ¶ added in v0.9.11
type HiStyleName string
HiStyleName is a highlighting style name
type Icon ¶
type Icon struct { WidgetBase IconNm string `desc:"icon name that has been set -- optimizes to prevent reloading of icon"` Filename string `desc:"file name for the loaded icon, if loaded"` }
Icon is a wrapper around a child svg.Icon SVG element. SVG should contain no color information -- it should just be a filled shape where the fill and stroke colors come from the surrounding context / paint settings. The rendered version is cached for a given size. Icons are always copied from an original source icon and then can be customized from there.
func AddNewIcon ¶ added in v0.9.7
AddNewIcon adds a new icon to given parent node, with given name, and icon name.
func (*Icon) CopyFieldsFrom ¶ added in v0.9.8
func (ic *Icon) CopyFieldsFrom(frm interface{})
func (*Icon) SVGIcon ¶
func (ic *Icon) SVGIcon() *Viewport2D
SVGIcon returns the child svg icon, or nil
func (*Icon) SetIcon ¶
SetIcon sets the icon by name into given Icon wrapper, returning error message if not found etc, and returning true if a new icon was actually set -- does nothing if IconNm is already == icon name and has children, and deletes children if name is nil / none (both cases return false for new icon)
type IconMgr ¶
type IconMgr interface { // IsValid checks if given icon name is a valid name for an available icon // (also checks that the icon manager is non-nil and issues appropriate error) IsValid(iconName string) bool // SetIcon sets the icon by name into given Icon wrapper, returning error // message if not found etc. This is how gi.Icon is initialized from // underlying svg.Icon items. SetIcon(ic *Icon, iconName string) error // IconByName is main function to get icon by name -- looks in CurIconSet and // falls back to DefaultIconSet if not found there -- returns error // message if not found. cast result to *svg.Icon IconByName(name string) (ki.Ki, error) // IconList returns the list of available icon names, optionally sorted // alphabetically (otherwise in map-random order) IconList(alphaSort bool) []IconName }
IconMgr is the manager of all things Icon -- needed to allow svg to be a separate package, and implemented by svg.IconMgr
var TheIconMgr IconMgr
TheIconMgr is set by loading the gi/svg package -- all final users must import github/goki/gi/svg to get its init function
type IconName ¶
type IconName string
IconName is used to specify an icon -- currently just the unique name of the icon -- automatically provides a chooser menu for icons using ValueView system
func (IconName) IsNil ¶
IsNil tests whether the icon name is empty, 'none' or 'nil' -- indicates to not use a icon
func (IconName) IsValid ¶
IsValid tests whether the icon name is valid -- represents a non-nil icon available in the current or default icon set
func (IconName) SetIcon ¶
SetIcon sets the icon by name into given Icon wrapper, returning error message if not found etc, and returning true if a new icon was actually set -- does nothing if IconNm is already == icon name and has children, and deletes children if name is nil / none (both cases return false for new icon)
type KeyFuns ¶
type KeyFuns int32
KeyFuns are functions that keyboard events can perform in the GUI -- seems possible to keep this flat and consistent across different contexts, as long as the functions can be appropriately reinterpreted for each context.
const ( KeyFunNil KeyFuns = iota KeyFunMoveUp KeyFunMoveDown KeyFunMoveRight KeyFunMoveLeft KeyFunPageUp KeyFunPageDown // KeyFunPageRight // KeyFunPageLeft KeyFunHome // start-of-line KeyFunEnd // end-of-line KeyFunDocHome // start-of-doc -- Control / Alt / Shift +Home KeyFunDocEnd // end-of-doc Control / Alt / Shift +End KeyFunWordRight KeyFunWordLeft KeyFunFocusNext // Tab KeyFunFocusPrev // Shift-Tab KeyFunEnter // Enter / return key -- has various special functions KeyFunAccept // Ctrl+Enter = accept any changes and close dialog / move to next KeyFunCancelSelect KeyFunSelectMode KeyFunSelectAll KeyFunAbort // KeyFunEditItem KeyFunCopy KeyFunCut KeyFunPaste KeyFunPasteHist // from history KeyFunBackspace KeyFunBackspaceWord KeyFunDelete KeyFunDeleteWord KeyFunKill KeyFunDuplicate KeyFunTranspose KeyFunTransposeWord KeyFunUndo KeyFunRedo KeyFunInsert KeyFunInsertAfter KeyFunZoomOut KeyFunZoomIn KeyFunPrefs KeyFunRefresh KeyFunRecenter // Ctrl+L in emacs KeyFunComplete KeyFunLookup KeyFunSearch // Ctrl+S in emacs -- more interactive type of search KeyFunFind // Command+F full-dialog find KeyFunReplace KeyFunJump // jump to line KeyFunHistPrev KeyFunHistNext KeyFunMenu // put focus on menu KeyFunWinFocusNext KeyFunWinClose KeyFunWinSnapshot KeyFunGoGiEditor // Below are menu specific functions -- use these as shortcuts for menu actions // allows uniqueness of mapping and easy customization of all key actions KeyFunMenuNew KeyFunMenuNewAlt1 // alternative version (e.g., shift) KeyFunMenuNewAlt2 // alternative version (e.g., alt) KeyFunMenuOpen KeyFunMenuOpenAlt1 // alternative version (e.g., shift) KeyFunMenuOpenAlt2 // alternative version (e.g., alt) KeyFunMenuSave KeyFunMenuSaveAs KeyFunMenuSaveAlt // another alt (e.g., alt) KeyFunMenuCloseAlt1 // alternative version (e.g., shift) KeyFunMenuCloseAlt2 // alternative version (e.g., alt) KeyFunsN )
func (*KeyFuns) FromString ¶
func (KeyFuns) MarshalJSON ¶
func (*KeyFuns) UnmarshalJSON ¶
type KeyMap ¶
KeyMap is a map between a key sequence (chord) and a specific KeyFun function. This mapping must be unique, in that each chord has unique KeyFun, but multiple chords can trigger the same function.
var ActiveKeyMap *KeyMap
ActiveKeyMap points to the active map -- users can set this to an alternative map in Prefs
func (*KeyMap) ChordForFun ¶
ChordForFun returns first key chord trigger for given KeyFun in map
func (*KeyMap) ShortcutForFun ¶
ShortcutForFun returns OS-specific formatted shortcut for first key chord trigger for given KeyFun in map
func (*KeyMap) ToSlice ¶
func (km *KeyMap) ToSlice() []KeyMapItem
ToSlice copies this keymap to a slice of KeyMapItem's
func (*KeyMap) Update ¶
func (km *KeyMap) Update(kmName KeyMapName)
Update ensures that the given keymap has at least one entry for every defined KeyFun, grabbing ones from the default map if not, and also eliminates any Nil entries which might reflect out-of-date functions
type KeyMapItem ¶
type KeyMapItem struct { Key key.Chord `desc:"the key chord that activates a function"` Fun KeyFuns `desc:"the function of that key"` }
KeyMapItem records one element of the key map -- used for organizing the map.
type KeyMapName ¶
type KeyMapName string
KeyMapName has an associated ValueView for selecting from the list of available key map names, for use in preferences etc.
var ActiveKeyMapName KeyMapName
ActiveKeyMapName is the name of the active keymap
type KeyMaps ¶
type KeyMaps []KeyMapsItem
KeyMaps is a list of KeyMap's -- users can edit these in Prefs -- to create a custom one, just duplicate an existing map, rename, and customize
var AvailKeyMaps KeyMaps
AvailKeyMaps is the current list of available keymaps for use -- can be loaded / saved / edited with preferences. This is set to StdKeyMaps at startup.
func (*KeyMaps) MapByName ¶
func (km *KeyMaps) MapByName(name KeyMapName) (*KeyMap, int, bool)
MapByName returns a keymap and index by name -- returns false and emits a message to stdout if not found
func (*KeyMaps) OpenPrefs ¶
OpenPrefs opens KeyMaps from GoGi standard prefs directory, using PrefsKeyMapsFileName
func (*KeyMaps) RevertToStd ¶
func (km *KeyMaps) RevertToStd()
RevertToStd reverts this map to using the StdKeyMaps that are compiled into the program and have all the lastest key functions bound to standard values.
type KeyMapsItem ¶
type KeyMapsItem struct { Name string `width:"20" desc:"name of keymap"` Desc string `desc:"description of keymap -- good idea to include source it was derived from"` Map KeyMap `` /* 127-byte string literal not displayed */ }
KeyMapsItem is an entry in a KeyMaps list
func (KeyMapsItem) Label ¶
func (km KeyMapsItem) Label() string
Label satisfies the Labeler interface
type Label ¶
type Label struct { WidgetBase Text string `xml:"text" desc:"label to display"` Selectable bool `` /* 146-byte string literal not displayed */ Redrawable bool `` /* 317-byte string literal not displayed */ LinkSig ki.Signal `` /* 176-byte string literal not displayed */ StateStyles [LabelStatesN]gist.Style `copy:"-" json:"-" xml:"-" desc:"styles for different states of label"` Render girl.Text `copy:"-" xml:"-" json:"-" desc:"render data for text label"` RenderPos mat32.Vec2 `` /* 151-byte string literal not displayed */ CurBgColor gist.Color `` /* 178-byte string literal not displayed */ }
Label is a widget for rendering text labels -- supports full widget model including box rendering, and full HTML styling, including links -- LinkSig emits link with data of URL -- opens default browser if nobody receiving signal. The default white-space option is 'pre' -- set to 'normal' or other options to get word-wrapping etc.
func AddNewLabel ¶ added in v0.9.7
AddNewLabel adds a new label to given parent node, with given name and text.
func (*Label) ConnectEvents2D ¶
func (lb *Label) ConnectEvents2D()
func (*Label) CopyFieldsFrom ¶ added in v0.9.8
func (lb *Label) CopyFieldsFrom(frm interface{})
func (*Label) Disconnect ¶ added in v0.9.8
func (lb *Label) Disconnect()
func (*Label) GrabCurBgColor ¶
func (lb *Label) GrabCurBgColor()
func (*Label) HoverEvent ¶
func (lb *Label) HoverEvent()
func (*Label) LabelEvents ¶
func (lb *Label) LabelEvents()
func (*Label) LayoutLabel ¶
func (lb *Label) LayoutLabel()
func (*Label) MouseEvent ¶
func (lb *Label) MouseEvent()
func (*Label) MouseMoveEvent ¶
func (lb *Label) MouseMoveEvent()
func (*Label) 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 (*Label) RenderLabel ¶ added in v1.0.5
func (lb *Label) RenderLabel()
func (*Label) SetStateStyle ¶
func (lb *Label) SetStateStyle()
SetStateStyle sets the style based on the inactive, selected flags
func (*Label) SetText ¶
SetText sets the text and updates the rendered version. Note: if there is already a label set, and no other larger updates are taking place, the new label may just illegibly overlay on top of the old one. Set Redrawable = true to fix this issue (it will redraw the background -- sampling from actual if none is set).
func (*Label) StyleLabel ¶
func (lb *Label) StyleLabel()
StyleLabel does label styling -- it sets the StyMu Lock
type LabelStates ¶
type LabelStates int32
LabelStates are mutually-exclusive label states -- determines appearance
const ( // normal active state LabelActive LabelStates = iota // inactive -- font is dimmed LabelInactive // selected -- background is selected color LabelSelected // total number of button states LabelStatesN )
func (*LabelStates) FromString ¶
func (i *LabelStates) FromString(s string) error
func (LabelStates) MarshalJSON ¶
func (ev LabelStates) MarshalJSON() ([]byte, error)
func (LabelStates) String ¶
func (i LabelStates) String() string
func (*LabelStates) UnmarshalJSON ¶
func (ev *LabelStates) UnmarshalJSON(b []byte) error
type Labeler ¶
type Labeler interface { // Label returns a GUI-appropriate label for item Label() string }
Labeler interface provides a GUI-appropriate label for an item, via a Label() string method. Use ToLabel converter to attempt to use this interface and then fall back on Stringer via kit.ToString conversion function.
type Layout ¶
type Layout struct { WidgetBase Lay Layouts `xml:"lay" desc:"type of layout to use"` Spacing units.Value `xml:"spacing" desc:"extra space to add between elements in the layout"` StackTop int `` /* 155-byte string literal not displayed */ StackTopOnly bool `` /* 183-byte string literal not displayed */ ChildSize mat32.Vec2 `copy:"-" json:"-" xml:"-" desc:"total max size of children as laid out"` ExtraSize mat32.Vec2 `copy:"-" json:"-" xml:"-" desc:"extra size in each dim due to scrollbars we add"` HasScroll [2]bool `copy:"-" json:"-" xml:"-" desc:"whether scrollbar is used for given dim"` Scrolls [2]*ScrollBar `copy:"-" json:"-" xml:"-" desc:"scroll bars -- we fully manage them as needed"` GridSize image.Point `copy:"-" json:"-" xml:"-" desc:"computed size of a grid layout based on all the constraints -- computed during Size2D pass"` GridData [RowColN][]GridData `copy:"-" json:"-" xml:"-" desc:"grid data for rows in [0] and cols in [1]"` FlowBreaks []int `copy:"-" json:"-" xml:"-" desc:"line breaks for flow layout"` NeedsRedo bool `` /* 157-byte string literal not displayed */ FocusName string `copy:"-" json:"-" xml:"-" desc:"accumulated name to search for when keys are typed"` FocusNameTime time.Time `copy:"-" json:"-" xml:"-" desc:"time of last focus name event -- for timeout"` FocusNameLast ki.Ki `copy:"-" json:"-" xml:"-" desc:"last element focused on -- used as a starting point if name is the same"` ScrollsOff bool `` /* 142-byte string literal not displayed */ ScrollSig ki.Signal `` /* 211-byte string literal not displayed */ }
Layout is the primary node type responsible for organizing the sizes and positions of child widgets. All arbitrary collections of widgets should generally be contained within a layout -- otherwise the parent widget must take over responsibility for positioning. The alignment is NOT inherited by default so must be specified per child, except that the parent alignment is used within the relevant dimension (e.g., horizontal-align for a LayoutHoriz layout, to determine left, right, center, justified). Layouts can automatically add scrollbars depending on the Overflow layout style. For a Grid layout, the 'columns' property should generally be set to the desired number of columns, from which the number of rows is computed -- otherwise it uses the square root of number of elements.
var LayoutDefault Layout
LayoutDefault is default obj that can be used when property specifies "default"
func AddNewLayout ¶ added in v0.9.7
AddNewLayout adds a new layout to given parent node, with given name and layout
func (*Layout) AsLayout2D ¶
func (*Layout) AutoScroll ¶
AutoScroll scrolls the layout based on mouse position, when appropriate (DND, menus)
func (*Layout) AutoScrollDim ¶
AutoScrollDim auto-scrolls along one dimension
func (*Layout) AvailSize ¶
AvailSize returns the total size avail to this layout -- typically AllocSize except for top-level layout which uses VpBBox in case less is avail
func (*Layout) ChildWithFocus ¶
ChildWithFocus returns a direct child of this layout that either is the current window focus item, or contains that focus item (along with its index) -- nil, -1 if none.
func (*Layout) ChildrenBBox2D ¶
func (*Layout) ChildrenUpdateSizes ¶ added in v0.9.15
func (ly *Layout) ChildrenUpdateSizes()
ChildrenUpdateSizes calls UpdateSizes on all children -- layout must at least call this
func (*Layout) ComputeBBox2D ¶
func (*Layout) ConnectEvents2D ¶
func (ly *Layout) ConnectEvents2D()
func (*Layout) CopyFieldsFrom ¶ added in v0.9.8
func (ly *Layout) CopyFieldsFrom(frm interface{})
func (*Layout) DeactivateScroll ¶
DeactivateScroll turns off given scrollbar, without deleting, so it can be easily re-used
func (*Layout) DeleteScroll ¶
DeleteScroll deletes scrollbar along given dimesion. todo: we are leaking the scrollbars -- move into a container Field
func (*Layout) FinalizeLayout ¶
func (ly *Layout) FinalizeLayout()
FinalizeLayout is final pass through children to finalize the layout, computing summary size stats
func (*Layout) FocusNextChild ¶
FocusNextChild attempts to move the focus into the next layout child (with wraparound to start) -- returns true if successful
func (*Layout) FocusOnName ¶
func (ly *Layout) FocusOnName(kt *key.ChordEvent) bool
FocusOnName processes key events to look for an element starting with given name
func (*Layout) FocusPrevChild ¶
FocusPrevChild attempts to move the focus into the previous layout child (with wraparound to end) -- returns true if successful
func (*Layout) HasAnyScroll ¶
HasAnyScroll returns true if layout has
func (*Layout) HasFocus2D ¶
func (*Layout) KeyChordEvent ¶
func (ly *Layout) KeyChordEvent()
KeyChordEvent processes (lowpri) layout key events
func (*Layout) Layout2DChildren ¶ added in v1.2.14
func (*Layout) LayoutKeys ¶
func (ly *Layout) LayoutKeys(kt *key.ChordEvent)
LayoutKeys is key processing for layouts -- focus name and arrow keys
func (*Layout) LayoutScrollEvents ¶
func (ly *Layout) LayoutScrollEvents()
LayoutScrollEvents registers scrolling-related mouse events processed by Layout -- most subclasses of Layout will want these..
func (*Layout) ManageOverflow ¶
func (ly *Layout) ManageOverflow()
ManageOverflow processes any overflow according to overflow settings.
func (*Layout) Move2DChildren ¶
func (*Layout) Move2DDelta ¶
we add our own offset here
func (*Layout) Move2DScrolls ¶
Move2DScrolls moves scrollbars based on scrolling taking place in parent layouts -- critical to call this BEFORE we add our own delta, which is generated from these very same scrollbars.
func (*Layout) ReRenderScrolls ¶
func (ly *Layout) ReRenderScrolls()
ReRenderScrolls re-draws the scrollbars de-novo -- can be called ad-hoc by others
func (*Layout) ScrollActionDelta ¶ added in v0.9.11
ScrollActionDelta moves the scrollbar in given dimension by given delta and emits a ScrollSig signal.
func (*Layout) ScrollActionPos ¶ added in v0.9.11
ScrollActionPos moves the scrollbar in given dimension to given position and emits a ScrollSig signal.
func (*Layout) ScrollDelta ¶
func (ly *Layout) ScrollDelta(me *mouse.ScrollEvent)
ScrollDelta processes a scroll event. If only one dimension is processed, and there is a non-zero in other, then the consumed dimension is reset to 0 and the event is left unprocessed, so a higher level can consume the remainder.
func (*Layout) ScrollDimToCenter ¶
ScrollDimToCenter scrolls to put the given child coordinate position (eg., middle of a view box) at the center of our scroll area, to the extent possible -- returns true if scrolling was needed.
func (*Layout) ScrollDimToEnd ¶
ScrollDimToEnd scrolls to put the given child coordinate position (eg., bottom / right of a view box) at the end (bottom / right) of our scroll area, to the extent possible -- returns true if scrolling was needed.
func (*Layout) ScrollDimToStart ¶
ScrollDimToStart scrolls to put the given child coordinate position (eg., top / left of a view box) at the start (top / left) of our scroll area, to the extent possible -- returns true if scrolling was needed.
func (*Layout) ScrollToBox ¶
ScrollToBox scrolls the layout to ensure that given rect box is in view -- returns true if scrolling was needed
func (*Layout) ScrollToBoxDim ¶
ScrollToBoxDim scrolls to ensure that given rect box along one dimension is in view -- returns true if scrolling was needed
func (*Layout) ScrollToItem ¶
ScrollToItem scrolls the layout to ensure that given item is in view -- returns true if scrolling was needed
func (*Layout) ScrollToPos ¶ added in v0.9.11
ScrollToPos moves the scrollbar in given dimension to given position and DOES NOT emit a ScrollSig signal.
func (*Layout) SetScrollsOff ¶
func (ly *Layout) SetScrollsOff()
SetScrollsOff turns off the scrolls -- e.g., when layout is not visible
func (*Layout) StyleFromProps ¶ added in v0.9.8
func (ly *Layout) StyleFromProps(props ki.Props, vp *Viewport2D)
StyleFromProps styles Layout-specific fields from ki.Prop properties doesn't support inherit or default
func (*Layout) StyleLayout ¶
func (ly *Layout) StyleLayout()
StyleLayout does layout styling -- it sets the StyMu Lock
func (*Layout) StyleToDots ¶ added in v0.9.8
ToDots runs ToDots on unit values, to compile down to raw pixels
type LayoutAllocs ¶ added in v0.9.16
type LayoutAllocs struct { Size mat32.Vec2 `` /* 170-byte string literal not displayed */ Pos mat32.Vec2 `desc:"position of this item, computed by adding in the PosRel to parent position"` PosRel mat32.Vec2 `desc:"allocated relative position of this item, computed by the parent layout"` SizeOrig mat32.Vec2 `` /* 209-byte string literal not displayed */ PosOrig mat32.Vec2 `` /* 134-byte string literal not displayed */ }
LayoutAllocs contains all the the layout allocations: size, position. These are set by the parent Layout during the Layout process.
func (*LayoutAllocs) Reset ¶ added in v0.9.16
func (la *LayoutAllocs) Reset()
Reset is called at start of layout process -- resets all values back to 0
type LayoutState ¶ added in v0.9.16
type LayoutState struct { Size gist.SizePrefs `` /* 151-byte string literal not displayed */ Alloc LayoutAllocs `desc:"allocated size and position -- set by parent Layout"` }
LayoutState contains all the state needed to specify the layout of an item within a Layout. Is initialized with computed values of style prefs.
func (*LayoutState) Defaults ¶ added in v0.9.16
func (ld *LayoutState) Defaults()
func (*LayoutState) Reset ¶ added in v0.9.16
func (ld *LayoutState) Reset()
Reset is called at start of layout process -- resets all values back to 0
func (*LayoutState) SetFromStyle ¶ added in v0.9.16
func (ld *LayoutState) SetFromStyle(ls *gist.Layout)
func (*LayoutState) SizePrefOrMax ¶ added in v0.9.16
func (ld *LayoutState) SizePrefOrMax() mat32.Vec2
SizePrefOrMax returns the pref size if non-zero, else the max-size -- use for style-based constraints during initial sizing (e.g., word wrapping)
func (*LayoutState) UpdateSizes ¶ added in v0.9.16
func (ld *LayoutState) UpdateSizes()
UpdateSizes updates our sizes based on AllocSize and Max constraints, etc
type Layouts ¶
type Layouts int32
Layouts are the different types of layouts
const ( // LayoutHoriz arranges items horizontally across a row LayoutHoriz Layouts = iota // LayoutVert arranges items vertically in a column LayoutVert // LayoutGrid arranges items according to a regular grid LayoutGrid // LayoutHorizFlow arranges items horizontally across a row, overflowing // vertically as needed. Ballpark target width or height props should be set // to generate initial first-pass sizing estimates. LayoutHorizFlow // LayoutVertFlow arranges items vertically within a column, overflowing // horizontally as needed. Ballpark target width or height props should be set // to generate initial first-pass sizing estimates. LayoutVertFlow // LayoutStacked arranges items stacked on top of each other -- Top index // indicates which to show -- overall size accommodates largest in each // dimension LayoutStacked // LayoutNil is a nil layout -- doesn't do anything -- for cases when a // parent wants to take over the job of the layout LayoutNil LayoutsN )
func (*Layouts) FromString ¶
func (Layouts) MarshalJSON ¶
func (*Layouts) UnmarshalJSON ¶
type MakeMenuFunc ¶
MakeMenuFunc is a callback for making a menu on demand, receives the object calling this function (typically an Action or Button) and the menu
type Menu ¶
Menu is a slice list of Node2D actions, which can contain sub-actions (though it can contain anything -- it is just added to a column layout and displayed in a popup) -- don't use stretchy sizes in general for these items!
func (*Menu) AddAction ¶
AddAction adds an action to the menu using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically).
func (*Menu) AddAppMenu ¶
AddAppMenu adds an "app" menu to the menu -- calls AddStdAppMenu and then CustomAppMenuFunc if non-nil
func (*Menu) AddCopyCutPaste ¶
AddCopyCutPaste adds a Copy, Cut, Paste actions that just emit the corresponding keyboard shortcut. Paste is automatically enabled by clipboard having something in it.
func (*Menu) AddCopyCutPasteDupe ¶
AddCopyCutPasteDupe adds a Copy, Cut, Paste, and Duplicate actions that just emit the corresponding keyboard shortcut. Paste is automatically enabled by clipboard having something in it.
func (*Menu) AddSeparator ¶
AddSeparator adds a separator at the next point in the menu (name is just internal label of element, defaults to 'sep' if empty)
func (*Menu) AddStdAppMenu ¶
AddStdAppMenu adds a standard set of menu items for application-level control.
func (*Menu) AddWindowsMenu ¶
AddWindowsMenu adds menu items for current main and dialog windows. must be called under WindowGlobalMu mutex lock!
func (*Menu) DeleteShortcuts ¶ added in v0.9.14
DeleteShortcuts deletes the shortcuts in given window
func (*Menu) FindActionByName ¶
FindActionByName finds an action on the menu, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found
func (*Menu) InsertActionAfter ¶
InsertActionAfter adds an action to the menu after existing item of given name, using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically). If name not found, adds to end of list..
func (*Menu) InsertActionBefore ¶
func (m *Menu) InsertActionBefore(before string, opts ActOpts, sigTo ki.Ki, fun ki.RecvFunc) *Action
InsertActionBefore adds an action to the menu before existing item of given name, using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically). If name not found, adds to end of list..
func (Menu) MarshalJSON ¶
func (*Menu) SetShortcuts ¶
SetShortcuts sets the shortcuts to given window -- call when the menu has been attached to a window
func (*Menu) UnmarshalJSON ¶
func (*Menu) UpdateActions ¶
func (m *Menu) UpdateActions()
UpdateActions calls update function on all the actions in the menu, and any of their sub-actions
type MenuBar ¶
type MenuBar struct { Layout MainMenu bool `desc:"is this the main menu bar for a window? controls whether displayed on macOS"` OSMainMenus map[string]*Action `json:"-" xml:"-" desc:"map of main menu items for callback from OS main menu (MacOS specific)"` }
MenuBar is a Layout (typically LayoutHoriz) that renders a gradient background and has convenience methods for adding menus.
func AddNewMenuBar ¶ added in v0.9.7
AddNewMenuBar adds a new menubar to given parent node, with given name.
func (*MenuBar) ConfigMenus ¶
ConfigMenus configures Action items as children of MenuBar with the given names, which function as the main menu panels for the menu bar (File, Edit, etc). Access the resulting menus as .ChildByName("name").(*Action).
func (*MenuBar) CopyFieldsFrom ¶ added in v0.9.8
func (mb *MenuBar) CopyFieldsFrom(frm interface{})
func (*MenuBar) DeleteShortcuts ¶ added in v0.9.14
func (mb *MenuBar) DeleteShortcuts()
DeleteShortcuts deletes the shortcuts -- called when destroyed
func (*MenuBar) FindActionByName ¶
FindActionByName finds an action on the menu, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found
func (*MenuBar) MainMenuUpdateActives ¶
MainMenuUpdateActives updates the active state of all menu items, based on active state of corresponding Actions (action self-update functions are called via UpdateActions) -- can be called by method of same name on Window.
func (*MenuBar) MenuBarStdRender ¶
func (mb *MenuBar) MenuBarStdRender()
MenuBarStdRender does the standard rendering of the bar
func (*MenuBar) SetMainMenu ¶
SetMainMenu sets this menu as the current OS-specific, separate main menu for given window -- only should be called in window.Focus event. Does nothing if menu is empty.
func (*MenuBar) SetMainMenuSub ¶
SetMainMenuSub iterates over sub-menus, adding items to overall main menu.
func (*MenuBar) SetShortcuts ¶ added in v0.9.14
func (mb *MenuBar) SetShortcuts()
SetShortcuts sets the shortcuts to window associated with Toolbar Called in ConnectEvents2D()
func (*MenuBar) ShowMenuBar ¶
func (*MenuBar) UpdateActions ¶
func (mb *MenuBar) UpdateActions()
UpdateActions calls UpdateFunc on all actions in menu -- individual menus are automatically updated just prior to menu popup
func (*MenuBar) UpdateMainMenu ¶
UpdateMainMenu updates the OS-specific, separate main menu of given window based on this MenuBar -- called by Window.MainMenuUpdated.
type MenuButton ¶
type MenuButton struct {
ButtonBase
}
func AddNewMenuButton ¶ added in v0.9.7
func AddNewMenuButton(parent ki.Ki, name string) *MenuButton
AddNewMenuButton adds a new button to given parent node, with given name.
func (*MenuButton) ConfigParts ¶
func (mb *MenuButton) ConfigParts()
func (*MenuButton) CopyFieldsFrom ¶ added in v0.9.8
func (mb *MenuButton) CopyFieldsFrom(frm interface{})
type MetaData2D ¶
type MetaData2D struct { Node2DBase MetaData string }
MetaData2D is used for holding meta data info
func (*MetaData2D) CopyFieldsFrom ¶ added in v0.9.8
func (g *MetaData2D) CopyFieldsFrom(frm interface{})
type Node ¶ added in v0.9.9
type Node interface { // nodes are Ki elements -- this comes for free by embedding ki.Node in NodeBase ki.Ki // AsGiNode returns a generic gi.NodeBase for our node -- gives generic // access to all the base-level data structures without requiring // interface methods. AsGiNode() *NodeBase }
Node is the interface for all GoGi nodes (2D and 3D), for accessing as NodeBase
type Node2D ¶
type Node2D interface { Node // AsNode2D returns a generic Node2DBase for our node -- gives generic // access to all the base-level data structures without requiring // interface methods. AsNode2D() *Node2DBase // AsViewport2D returns Viewport2D if this node is one (has its own // bitmap, used for menus, dialogs, icons, etc), else nil. AsViewport2D() *Viewport2D // AsLayout2D returns Layout if this is a Layout-derived node, else nil AsLayout2D() *Layout // AsWidget returns WidgetBase if this is a WidgetBase-derived node, else nil. AsWidget() *WidgetBase // Init2D initializes a node -- grabs active Viewport etc -- must call // InitNodeBase as first step set basic inits including setting Viewport // -- all code here must be robust to being called repeatedly. Init2D() // Style2D: In a MeFirst downward pass, all properties are cached out in // an inherited manner, and incorporating any css styles, into either the // Paint or Style object for each Node, depending on the type of node (SVG // does Paint, Widget does Style). Only done once after structural // changes -- styles are not for dynamic changes. Style2D() // Size2D: MeLast downward pass, each node first calls // g.Layout.Reset(), then sets their LayoutSize according to their own // intrinsic size parameters, and/or those of its children if it is a // Layout. Size2D(iter int) // Layout2D: MeFirst downward pass (each node calls on its children at // appropriate point) with relevant parent BBox that the children are // constrained to render within -- they then intersect this BBox with // their own BBox (from BBox2D) -- typically just call Layout2DBase for // default behavior -- and add parent position to AllocPos, and then // return call to Layout2DChildren. Layout does all its sizing and // positioning of children in this pass, based on the Size2D data gathered // bottom-up and constraints applied top-down from higher levels. // Typically only a single iteration is required (iter = 0) but multiple // are supported (needed for word-wrapped text or flow layouts) -- return // = true indicates another iteration required (pass this up the chain). Layout2D(parBBox image.Rectangle, iter int) bool // Move2D: optional MeFirst downward pass to move all elements by given // delta -- used for scrolling -- the layout pass assigns canonical // positions, saved in AllocPosOrig and BBox, and this adds the given // delta to that AllocPosOrig -- each node must call ComputeBBox2D to // update its bounding box information given the new position. Move2D(delta image.Point, parBBox image.Rectangle) // BBox2D: compute the raw bounding box of this node relative to its // parent viewport -- called during Layout2D to set node BBox field, which // is then used in setting WinBBox and VpBBox. BBox2D() image.Rectangle // Compute VpBBox and WinBBox from BBox, given parent VpBBox -- most nodes // call ComputeBBox2DBase but viewports require special code -- called // during Layout and Move. ComputeBBox2D(parBBox image.Rectangle, delta image.Point) // ChildrenBBox2D: compute the bbox available to my children (content), // adjusting for margins, border, padding (BoxSpace) taken up by me -- // operates on the existing VpBBox for this node -- this is what is passed // down as parBBox do the children's Layout2D. ChildrenBBox2D() image.Rectangle // Render2D: Final rendering pass, each node is fully responsible for // calling Render2D on its own children, to provide maximum flexibility // (see Render2DChildren for default impl) -- bracket the render calls in // PushBounds / PopBounds and a false from PushBounds indicates that // VpBBox is empty and no rendering should occur. Typically call // ConnectEvents2D to set up connections to receive window events if // visible, and disconnect if not. Render2D() // ConnectEvents2D: setup connections to window events -- called in // Render2D if in bounds. It can be useful to create modular methods for // different event types that can then be mix-and-matched in any more // specialized types. ConnectEvents2D() // FocusChanged2D is called on node for changes in focus -- see the // FocusChanges values. FocusChanged2D(change FocusChanges) // HasFocus2D returns true if this node has keyboard focus and should // receive keyboard events -- typically this just returns HasFocus based // on the Window-managed HasFocus flag, but some types may want to monitor // all keyboard activity for certain key keys.. HasFocus2D() bool // FindNamedElement searches for given named element in this node or in // parent nodes. Used for url(#name) references. FindNamedElement(name string) Node2D // MakeContextMenu creates the context menu items (typically Action // elements, but it can be anything) for a given widget, typically // activated by the right mouse button or equivalent. Widget has a // function parameter that can be set to add context items (e.g., by Views // or other complex widgets) to extend functionality. MakeContextMenu(menu *Menu) // ContextMenuPos returns the default position for popup menus -- // by default in the middle of the WinBBox, but can be adapted as // appropriate for different widgets. ContextMenuPos() image.Point // ContextMenu displays the context menu of various actions to perform on // a node -- returns immediately, and actions are all executed directly // (later) via the action signals. Calls MakeContextMenu and // ContextMenuPos. ContextMenu() // IsVisible provides the definitive answer as to whether a given node // is currently visible. It is only entirely valid after a render pass // for widgets in a visible window, but it checks the window and viewport // for their visibility status as well, which is available always. // This does *not* check for VpBBox level visibility, which is a further check. // Non-visible nodes are automatically not rendered and not connected to // window events. The Invisible flag is one key element of the IsVisible // calculus -- it is set by e.g., TabView for invisible tabs, and is also // set if a widget is entirely out of render range. But again, use // IsVisible as the main end-user method. // For robustness, it recursively calls the parent -- this is typically // a short path -- propagating the Invisible flag properly can be // very challenging without mistakenly overwriting invisibility at various // levels. IsVisible() bool // IsDirectWinUpload returns true if this is a node that does a direct window upload // e.g., for gi3d.Scene which renders directly to the window texture for maximum efficiency IsDirectWinUpload() bool // DirectWinUpload does a direct upload of contents to a window // Drawer compositing image, which will then be used for drawing // the window during a Publish() event (triggered by the window Update // event). This is called by the viewport in its Update signal processing // routine on nodes that respond true to IsDirectWinUpload(). // The node is also free to update itself of its own accord at any point. DirectWinUpload() }
Node2D is the interface for all 2D nodes -- defines the stages of building and rendering the 2D scenegraph
type Node2DBase ¶
type Node2DBase struct { NodeBase Viewport *Viewport2D `` /* 170-byte string literal not displayed */ }
Base struct node for 2D rendering tree -- renders to a bitmap using Paint rendering functions operating on the girl.State in the parent Viewport
For Widget / Layout nodes, rendering is done in 5 separate passes:
Init2D: In a MeFirst downward pass, Viewport pointer is set, styles are initialized, and any other widget-specific init is done.
Style2D: In a MeFirst downward pass, all properties are cached out in an inherited manner, and incorporating any css styles, into either the Paint (SVG) or Style (Widget) object for each Node. Only done once after structural changes -- styles are not for dynamic changes.
Size2D: MeLast downward pass, each node first calls g.Layout.Reset(), then sets their LayoutSize according to their own intrinsic size parameters, and/or those of its children if it is a Layout.
Layout2D: MeFirst downward pass (each node calls on its children at appropriate point) with relevant parent BBox that the children are constrained to render within -- they then intersect this BBox with their own BBox (from BBox2D) -- typically just call Layout2DBase for default behavior -- and add parent position to AllocPos. Layout does all its sizing and positioning of children in this pass, based on the Size2D data gathered bottom-up and constraints applied top-down from higher levels. Typically only a single iteration is required but multiple are supported (needed for word-wrapped text or flow layouts).
Render2D: Final rendering pass, each node is fully responsible for rendering its own children, to provide maximum flexibility (see Render2DChildren) -- bracket the render calls in PushBounds / PopBounds and a false from PushBounds indicates that VpBBox is empty and no rendering should occur. Nodes typically connect / disconnect to receive events from the window based on this visibility here.
* Move2D: optional pass invoked by scrollbars to move elements relative to their previously-assigned positions.
* SVG nodes skip the Size and Layout passes, and render directly into parent SVG viewport
func KiToNode2DBase ¶
func KiToNode2DBase(k ki.Ki) *Node2DBase
KiToNode2DBase converts Ki to a *Node2DBase -- use when known to be at least of this type, not-nil, etc
func (*Node2DBase) AsLayout2D ¶
func (nb *Node2DBase) AsLayout2D() *Layout
func (*Node2DBase) AsNode2D ¶
func (nb *Node2DBase) AsNode2D() *Node2DBase
func (*Node2DBase) AsViewport2D ¶
func (nb *Node2DBase) AsViewport2D() *Viewport2D
func (*Node2DBase) AsWidget ¶
func (nb *Node2DBase) AsWidget() *WidgetBase
func (*Node2DBase) BBox2D ¶
func (nb *Node2DBase) BBox2D() image.Rectangle
func (*Node2DBase) BBoxReport ¶
func (nb *Node2DBase) BBoxReport() string
BBoxReport reports on all the bboxes for everything in the tree
func (*Node2DBase) BaseIface ¶ added in v0.9.4
func (n *Node2DBase) BaseIface() reflect.Type
func (*Node2DBase) ChildrenBBox2D ¶
func (nb *Node2DBase) ChildrenBBox2D() image.Rectangle
func (*Node2DBase) ComputeBBox2D ¶
func (nb *Node2DBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*Node2DBase) ComputeBBox2DBase ¶
func (nb *Node2DBase) ComputeBBox2DBase(parBBox image.Rectangle, delta image.Point)
ComputeBBox2DBase -- computes the VpBBox and WinBBox from BBox, with whatever delta may be in effect
func (*Node2DBase) ConnectEvent ¶
ConnectEvent connects this node to receive a given type of GUI event signal from the parent window -- typically connect only visible nodes, and disconnect when not visible
func (*Node2DBase) ConnectEvents2D ¶
func (nb *Node2DBase) ConnectEvents2D()
func (*Node2DBase) ConnectToViewport ¶
func (nb *Node2DBase) ConnectToViewport()
ConnectToViewport connects the node's update signal to the viewport as a receiver, so that when the node is updated, it triggers the viewport to re-render it -- this is automatically called in PushBounds, and disconnected with DisconnectAllEvents, so it only occurs for rendered nodes.
func (*Node2DBase) ContainsFocus ¶
func (nb *Node2DBase) ContainsFocus() bool
ContainsFocus returns true if this widget contains the current focus widget as maintained in the Window
func (*Node2DBase) ContextMenu ¶
func (nb *Node2DBase) ContextMenu()
func (*Node2DBase) ContextMenuPos ¶
func (nb *Node2DBase) ContextMenuPos() (pos image.Point)
func (*Node2DBase) CopyFieldsFrom ¶ added in v0.9.8
func (nb *Node2DBase) CopyFieldsFrom(frm interface{})
func (*Node2DBase) DirectWinUpload ¶ added in v0.9.8
func (nb *Node2DBase) DirectWinUpload()
func (*Node2DBase) DisconnectAllEvents ¶
func (nb *Node2DBase) DisconnectAllEvents(pri EventPris)
DisconnectAllEvents disconnects node from all window events -- typically disconnect when not visible -- pri is priority -- pass AllPris for all priorities. This goes down the entire tree from this node on down, as typically everything under will not get an explicit disconnect call because no further updating will happen
func (*Node2DBase) DisconnectEvent ¶
func (nb *Node2DBase) DisconnectEvent(et oswin.EventType, pri EventPris)
DisconnectEvent disconnects this receiver from receiving given event type -- pri is priority -- pass AllPris for all priorities -- see also DisconnectAllEvents
func (*Node2DBase) DisconnectViewport ¶ added in v0.9.8
func (nb *Node2DBase) DisconnectViewport()
DisconnectViewport disconnects the node's update signal to the viewport as a receiver
func (*Node2DBase) EventMgr2D ¶ added in v0.9.11
func (nb *Node2DBase) EventMgr2D() *EventMgr
EventMgr2D() returns the event manager for this node. Can be nil.
func (*Node2DBase) FindNamedElement ¶
func (nb *Node2DBase) FindNamedElement(name string) Node2D
func (*Node2DBase) FocusChanged2D ¶
func (nb *Node2DBase) FocusChanged2D(change FocusChanges)
func (*Node2DBase) FocusNext ¶
func (nb *Node2DBase) FocusNext()
FocusNext moves the focus onto the next item
func (*Node2DBase) FocusPrev ¶
func (nb *Node2DBase) FocusPrev()
FocusPrev moves the focus onto the previous item
func (*Node2DBase) FullInit2DTree ¶ added in v0.9.8
func (nb *Node2DBase) FullInit2DTree()
FullInit2DTree does a full reinitialization of the tree *below this node* this should be called whenever the tree is dynamically updated and new nodes are added below a given node -- e.g., loading a new SVG graph etc. prepares everything to be rendered as usual.
func (*Node2DBase) FullRender2DTree ¶
func (nb *Node2DBase) FullRender2DTree()
FullRender2DTree does a full render of the tree
func (*Node2DBase) GrabFocus ¶
func (nb *Node2DBase) GrabFocus()
GrabFocus grabs the keyboard input focus on this item or the first item within it that can be focused (if none, then goes ahead and sets focus to this object)
func (*Node2DBase) HasFocus2D ¶
func (nb *Node2DBase) HasFocus2D() bool
func (*Node2DBase) Init2D ¶
func (nb *Node2DBase) Init2D()
func (*Node2DBase) Init2DTree ¶
func (nb *Node2DBase) Init2DTree()
Init2DTree initializes scene graph tree from node it is called on -- only needs to be done once but must be robust to repeated calls -- use a flag if necessary -- needed after structural updates to ensure all nodes are updated
func (*Node2DBase) IsDirectWinUpload ¶ added in v0.9.8
func (nb *Node2DBase) IsDirectWinUpload() bool
func (*Node2DBase) IsVisible ¶
func (nb *Node2DBase) IsVisible() bool
func (*Node2DBase) Layout2D ¶
func (nb *Node2DBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*Node2DBase) Layout2DChildren ¶
func (nb *Node2DBase) Layout2DChildren(iter int) bool
Layout2DChildren does layout on all of node's children, giving them the ChildrenBBox2D -- default call at end of Layout2D. Passes along whether any of the children need a re-layout -- typically Layout2D just returns this.
func (*Node2DBase) Layout2DTree ¶
func (nb *Node2DBase) Layout2DTree()
Layout2DTree does layout pass -- each node iterates over children for maximum control -- this starts with parent VpBBox -- can be called de novo. Handles multiple iterations if needed.
func (*Node2DBase) MakeContextMenu ¶
func (nb *Node2DBase) MakeContextMenu(m *Menu)
func (*Node2DBase) Move2D ¶
func (nb *Node2DBase) Move2D(delta image.Point, parBBox image.Rectangle)
func (*Node2DBase) Move2DChildren ¶
func (nb *Node2DBase) Move2DChildren(delta image.Point)
Move2DChildren moves all of node's children, giving them the ChildrenBBox2D -- default call at end of Move2D
func (*Node2DBase) NeedsFullReRender2DTree ¶ added in v0.9.15
func (nb *Node2DBase) NeedsFullReRender2DTree() bool
NeedsFullReRender2DTree checks the entire tree below this node for any that have NeedsFullReRender flag set.
func (*Node2DBase) ParentLayout ¶
func (nb *Node2DBase) ParentLayout() *Layout
ParentLayout returns the parent layout
func (*Node2DBase) ParentPaint ¶
func (nb *Node2DBase) ParentPaint() *gist.Paint
ParentPaint returns the Paint from parent, if available
func (*Node2DBase) ParentReRenderAnchor ¶
func (nb *Node2DBase) ParentReRenderAnchor() Node2D
ParentReRenderAnchor returns parent (including this node) that is a ReRenderAnchor -- for optimized re-rendering
func (*Node2DBase) ParentScrollLayout ¶
func (nb *Node2DBase) ParentScrollLayout() *Layout
ParentScrollLayout returns the parent layout that has active scrollbars
func (*Node2DBase) ParentStyle ¶
func (nb *Node2DBase) ParentStyle() *gist.Style
ParentStyle returns parent's style or nil if not avail. Calls StyleRLock so must call ParentStyleRUnlock when done.
func (*Node2DBase) ParentStyleRUnlock ¶ added in v1.0.5
func (nb *Node2DBase) ParentStyleRUnlock()
ParentStyleRUnlock unlocks the parent's style
func (*Node2DBase) ParentViewport ¶
func (nb *Node2DBase) ParentViewport() *Viewport2D
ParentViewport returns the parent viewport -- uses AsViewport2D() method on Node2D interface
func (*Node2DBase) ParentWindow ¶
func (nb *Node2DBase) ParentWindow() *Window
ParentWindow returns the parent window for this node
func (*Node2DBase) PropTag ¶
func (nb *Node2DBase) PropTag() string
func (*Node2DBase) Render ¶ added in v1.0.5
func (nb *Node2DBase) Render() *girl.State
Render returns the girl.State from this node's Viewport, using safe lock access
func (*Node2DBase) Render2D ¶
func (nb *Node2DBase) Render2D()
func (*Node2DBase) Render2DChildren ¶
func (nb *Node2DBase) Render2DChildren()
Render2DChildren renders all of node's children -- default call at end of Render2D()
func (*Node2DBase) Render2DTree ¶
func (nb *Node2DBase) Render2DTree()
Render2DTree just calls on parent node and it takes full responsibility for managing the children -- this allows maximum flexibility for order etc of rendering
func (*Node2DBase) ScrollToMe ¶
func (nb *Node2DBase) ScrollToMe() bool
ScrollToMe tells my parent layout (that has scroll bars) to scroll to keep this widget in view -- returns true if scrolled
func (*Node2DBase) SetFixedHeight ¶ added in v0.9.10
func (nb *Node2DBase) SetFixedHeight(val units.Value)
SetFixedHeight sets all height options (height, min-height, max-height) to a fixed height value
func (*Node2DBase) SetFixedWidth ¶ added in v0.9.10
func (nb *Node2DBase) SetFixedWidth(val units.Value)
SetFixedWidth sets all width options (width, min-width, max-width) to a fixed width value
func (*Node2DBase) SetMinPrefHeight ¶ added in v0.9.10
func (nb *Node2DBase) SetMinPrefHeight(val units.Value)
SetMinPrefHeight sets minimum and preferred height -- will get at least this amount -- max unspecified
func (*Node2DBase) SetMinPrefWidth ¶ added in v0.9.10
func (nb *Node2DBase) SetMinPrefWidth(val units.Value)
SetMinPrefWidth sets minimum and preferred width -- will get at least this amount -- max unspecified
func (*Node2DBase) SetStretchMax ¶ added in v0.9.10
func (nb *Node2DBase) SetStretchMax()
SetStretchMax sets stretchy max width and height (-1) -- can grow to take up avail room
func (*Node2DBase) SetStretchMaxHeight ¶ added in v0.9.10
func (nb *Node2DBase) SetStretchMaxHeight()
SetStretchMaxHeight sets stretchy max height (-1) -- can grow to take up avail room
func (*Node2DBase) SetStretchMaxWidth ¶ added in v0.9.10
func (nb *Node2DBase) SetStretchMaxWidth()
SetStretchMaxWidth sets stretchy max width (-1) -- can grow to take up avail room
func (*Node2DBase) SetWinBBox ¶
func (nb *Node2DBase) SetWinBBox()
set our window-level BBox from vp and our bbox
func (*Node2DBase) Size2D ¶
func (nb *Node2DBase) Size2D(iter int)
func (*Node2DBase) Size2DTree ¶
func (nb *Node2DBase) Size2DTree(iter int)
Size2DTree does the sizing as a depth-first pass
func (*Node2DBase) StartFocus ¶
func (nb *Node2DBase) StartFocus()
StartFocus specifies this widget to give focus to when the window opens
func (*Node2DBase) Style2D ¶
func (nb *Node2DBase) Style2D()
func (*Node2DBase) Style2DTree ¶
func (nb *Node2DBase) Style2DTree()
Style2DTree styles scene graph tree from node it is called on -- only needs to be done after a structural update in case inherited options changed
func (*Node2DBase) TopNode2D ¶ added in v0.9.11
func (nb *Node2DBase) TopNode2D() Node
TopNode2D() returns the top-level node of the 2D tree, which can be either a Window or a Viewport typically. This is used for UpdateStart / End around multiple dispersed updates to properly batch everything and prevent redundant updates.
func (*Node2DBase) TopUpdateEnd ¶ added in v0.9.11
func (nb *Node2DBase) TopUpdateEnd(updt bool)
TopUpdateEnd calls UpdateEnd on TopNode2D(). Use this for TopUpdateStart / End around multiple dispersed updates to properly batch everything and prevent redundant updates.
func (*Node2DBase) TopUpdateStart ¶ added in v0.9.11
func (nb *Node2DBase) TopUpdateStart() bool
TopUpdateStart calls UpdateStart on TopNode2D(). Use this for TopUpdateStart / End around multiple dispersed updates to properly batch everything and prevent redundant updates.
func (*Node2DBase) ViewportSafe ¶ added in v1.0.5
func (nb *Node2DBase) ViewportSafe() *Viewport2D
ViewportSafe returns the viewport under BBoxMu read lock -- use this for random access to Viewport field when not otherwise protected.
type NodeBase ¶
type NodeBase struct { ki.Node Class string `` /* 202-byte string literal not displayed */ CSS ki.Props `` /* 228-byte string literal not displayed */ CSSAgg ki.Props `copy:"-" json:"-" xml:"-" view:"no-inline" desc:"aggregated css properties from all higher nodes down to me"` BBox image.Rectangle `` /* 201-byte string literal not displayed */ ObjBBox image.Rectangle `` /* 208-byte string literal not displayed */ VpBBox image.Rectangle `` /* 240-byte string literal not displayed */ WinBBox image.Rectangle `` /* 207-byte string literal not displayed */ BBoxMu sync.RWMutex `` /* 160-byte string literal not displayed */ }
NodeBase is the base struct type for GoGi graphical interface system, containing infrastructure for both 2D and 3D scene graph nodes
func (*NodeBase) AddClass ¶ added in v0.9.5
AddClass adds a CSS class name -- does proper space separation
func (*NodeBase) AllWithinBBox ¶ added in v1.2.3
AllWithinBBox returns a list of all nodes whose WinBBox is fully contained within the given BBox. If leavesOnly is set then only nodes that have no nodes (leaves, terminal nodes) will be considered.
func (*NodeBase) ClearFullReRender ¶
func (nb *NodeBase) ClearFullReRender()
ClearFullReRender clears node as needing a full ReRender
func (*NodeBase) ClearInactive ¶
func (nb *NodeBase) ClearInactive()
ClearInactive clears the node as inactive
func (*NodeBase) ClearInvisible ¶
func (nb *NodeBase) ClearInvisible()
ClearInvisible clears the node as invisible
func (*NodeBase) ClearSelected ¶
func (nb *NodeBase) ClearSelected()
ClearSelected sets the node as not selected
func (*NodeBase) CopyFieldsFrom ¶ added in v0.9.8
func (nb *NodeBase) CopyFieldsFrom(frm interface{})
func (*NodeBase) FirstContainingPoint ¶
FirstContainingPoint finds the first node whose WinBBox contains the given point -- nil if none. If leavesOnly is set then only nodes that have no nodes (leaves, terminal nodes) will be considered
func (*NodeBase) HasNoLayout ¶
HasNoLayout checks if the current node is flagged as not needing layout
func (*NodeBase) IsDragging ¶
IsDragging tests if the current node is currently flagged as receiving dragging events -- flag set by window
func (*NodeBase) IsInactive ¶
IsInactive tests if this node is flagged as Inactive. if so, behave (e.g., ignore events except select, context menu) and style appropriately
func (*NodeBase) IsInstaDrag ¶
IsInstaDrag tests if the current node has InstaDrag property set
func (*NodeBase) IsInvisible ¶
IsInvisible tests if this node is flagged as Invisible. if so, do not render, update, interact.
func (*NodeBase) IsReRenderAnchor ¶
IsReRenderAnchor returns whethers the current node is a ReRenderAnchor
func (*NodeBase) IsSelected ¶
IsSelected tests if this node is flagged as Selected
func (*NodeBase) NeedsFullReRender ¶
NeedsFullReRender checks if node has said it needs full re-render
func (*NodeBase) ParentCSSAgg ¶
ParentCSSAgg returns parent's CSSAgg styles or nil if not avail
func (*NodeBase) PointToRelPos ¶
PointToRelPos translates a point in global pixel coords into relative position within node
func (*NodeBase) PosInWinBBox ¶ added in v1.0.5
PosInWinBBox returns true if given position is within this node's win bbox (under read lock)
func (*NodeBase) SetActiveState ¶
SetActiveState sets flag as active or not based on act arg -- positive logic is easier to understand.
func (*NodeBase) SetActiveStateUpdt ¶
SetActiveStateUpdt sets flag as active or not based on act arg -- positive logic is easier to understand -- does UpdateSig if state changed.
func (*NodeBase) SetCanFocus ¶ added in v0.9.8
func (nb *NodeBase) SetCanFocus()
SetCanFocus sets CanFocus flag to true
func (*NodeBase) SetCanFocusIfActive ¶
func (nb *NodeBase) SetCanFocusIfActive()
SetCanFocusIfActive sets CanFocus flag only if node is active (inactive nodes don't need focus typically)
func (*NodeBase) SetFocusState ¶ added in v0.9.11
SetFocusState sets current HasFocus state
func (*NodeBase) SetFullReRender ¶
func (nb *NodeBase) SetFullReRender()
SetFullReRender sets node as needing a full ReRender
func (*NodeBase) SetInactive ¶
func (nb *NodeBase) SetInactive()
SetInactive sets the node as inactive
func (*NodeBase) SetInactiveState ¶
SetInactiveState sets flag as inactive or not based on inact arg
func (*NodeBase) SetInactiveStateUpdt ¶
SetInactiveStateUpdt sets flag as inactive or not based on inact arg, and does UpdateSig if state changed.
func (*NodeBase) SetInvisible ¶
func (nb *NodeBase) SetInvisible()
SetInvisible sets the node as invisible
func (*NodeBase) SetInvisibleState ¶
SetInvisibleState sets flag as invisible or not based on invis arg
func (*NodeBase) SetReRenderAnchor ¶
func (nb *NodeBase) SetReRenderAnchor()
SetReRenderAnchor sets node as a ReRenderAnchor
func (*NodeBase) SetSelected ¶
func (nb *NodeBase) SetSelected()
SetSelected sets the node as selected
func (*NodeBase) SetSelectedState ¶
SetSelectedState set flag as selected or not based on sel arg
func (*NodeBase) StyleProps ¶
StyleProps returns a property that contains another map of properties for a given styling selector, such as :normal :active :hover etc -- the convention is to prefix this selector with a : and use lower-case names, so we follow that.
type NodeFlags ¶
type NodeFlags int
NodeFlags define gi node bitflags for tracking common high-frequency GUI state, mostly having to do with event processing -- use properties map for less frequently used information -- uses ki Flags field (64 bit capacity)
const ( // NoLayout means that this node does not participate in the layout // process (Size, Layout, Move) -- set by e.g., SVG nodes NoLayout NodeFlags = NodeFlags(ki.FlagsN) + iota // EventsConnected: this node has been connected to receive events from // the window -- to optimize event processing, connections are typically // only established for visible nodes during render, and disconnected when // not visible EventsConnected // CanFocus: can this node accept focus to receive keyboard input events // -- set by default for typical nodes that do so, but can be overridden, // including by the style 'can-focus' property CanFocus // HasFocus: does this node currently have the focus for keyboard input // events? use tab / alt tab and clicking events to update focus -- see // interface on Window HasFocus // FullReRender indicates that a full re-render is required due to nature // of update event -- otherwise default is local re-render -- used // internally for nodes to determine what to do on the ReRender step FullReRender // ReRenderAnchor: this node has a static size, and repaints its // background -- any children under it that need to dynamically resize on // a ReRender (Update) can refer the update up to rerendering this node, // instead of going further up the tree -- e.g., true of Frame's within a // SplitView ReRenderAnchor // Invisible means that the node has been marked as invisible by a parent // that has switch-like powers (e.g., layout stacked / tabview or splitter // panel that has been collapsed). This flag is propagated down to all // child nodes, and rendering or other interaction / update routines // should not run when this flag is set (PushBounds does this for most // cases). However, it IS a good idea to have styling, layout etc all // take place as normal, so that when the flag is cleared, rendering can // proceed directly. Invisible // Inactive disables interaction with widgets or other nodes (i.e., they // are read-only) -- they should indicate this inactive state in an // appropriate way, and each node should interpret events appropriately // based on this state (select and context menu events should still be // generated) Inactive // Selected indicates that this node has been selected by the user -- // widely supported across different nodes Selected // MouseHasEntered indicates that the MouseFocusEvent Enter was previously // registered on this node MouseHasEntered // DNDHasEntered indicates that the DNDFocusEvent Enter was previously // registered on this node DNDHasEntered // NodeDragging indicates this node is currently dragging -- win.Dragging // set to this node NodeDragging // InstaDrag indicates this node should start dragging immediately when // clicked -- otherwise there is a time-and-distance threshold to the // start of dragging -- use this for controls that are small and are // primarily about dragging (e.g., the Splitter handle) InstaDrag // can extend node flags from here NodeFlagsN )
const ( // TextFieldFocusActive indicates that the focus is active in this field TextFieldFocusActive NodeFlags = NodeFlagsN + iota )
these extend NodeBase NodeFlags to hold TextField state
func StringToNodeFlags ¶
type ParamPrefs ¶
type ParamPrefs struct { DoubleClickMSec int `min:"100" step:"50" desc:"the maximum time interval in msec between button press events to count as a double-click"` ScrollWheelSpeed float32 `` /* 290-byte string literal not displayed */ LocalMainMenu bool `` /* 326-byte string literal not displayed */ BigFileSize int `def:"10000000" desc:"the limit of file size, above which user will be prompted before opening / copying, etc."` SavedPathsMax int `desc:"maximum number of saved paths to save in FileView"` Smooth3D bool `` /* 175-byte string literal not displayed */ }
ParamPrefs contains misc parameters controlling GUI behavior.
func (*ParamPrefs) Defaults ¶
func (pf *ParamPrefs) Defaults()
type PartsWidgetBase ¶
type PartsWidgetBase struct { WidgetBase Parts Layout `` /* 214-byte string literal not displayed */ }
PartsWidgetBase is the base type for all Widget Node2D elements that manage a set of constituent parts
func (*PartsWidgetBase) ComputeBBox2D ¶
func (wb *PartsWidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*PartsWidgetBase) ComputeBBox2DParts ¶
func (wb *PartsWidgetBase) ComputeBBox2DParts(parBBox image.Rectangle, delta image.Point)
func (*PartsWidgetBase) ConfigPartsIconLabel ¶
func (wb *PartsWidgetBase) ConfigPartsIconLabel(config *kit.TypeAndNameList, icnm string, txt string) (icIdx, lbIdx int)
ConfigPartsIconLabel adds to config to create parts, of icon and label left-to right in a row, based on whether items are nil or empty
func (*PartsWidgetBase) ConfigPartsSetIconLabel ¶
func (wb *PartsWidgetBase) ConfigPartsSetIconLabel(icnm string, txt string, icIdx, lbIdx int)
ConfigPartsSetIconLabel sets the icon and text values in parts, and get part style props, using given props if not set in object props
func (*PartsWidgetBase) CopyFieldsFrom ¶ added in v0.9.8
func (wb *PartsWidgetBase) CopyFieldsFrom(frm interface{})
func (*PartsWidgetBase) Layout2D ¶
func (wb *PartsWidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*PartsWidgetBase) Layout2DParts ¶
func (wb *PartsWidgetBase) Layout2DParts(parBBox image.Rectangle, iter int)
func (*PartsWidgetBase) Move2D ¶
func (wb *PartsWidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
func (*PartsWidgetBase) PartsNeedUpdateIconLabel ¶
func (wb *PartsWidgetBase) PartsNeedUpdateIconLabel(icnm string, txt string) bool
PartsNeedUpdateIconLabel check if parts need to be updated -- for ConfigPartsIfNeeded
func (*PartsWidgetBase) Render2DParts ¶
func (wb *PartsWidgetBase) Render2DParts()
func (*PartsWidgetBase) SetFullReRenderIconLabel ¶
func (wb *PartsWidgetBase) SetFullReRenderIconLabel()
SetFullReRenderIconLabel sets the icon and label to be re-rendered, needed when styles change
func (*PartsWidgetBase) Size2D ¶
func (wb *PartsWidgetBase) Size2D(iter int)
func (*PartsWidgetBase) Size2DParts ¶
func (wb *PartsWidgetBase) Size2DParts(iter int)
func (*PartsWidgetBase) SizeFromParts ¶
func (wb *PartsWidgetBase) SizeFromParts(iter int)
SizeFromParts sets our size from those of our parts -- default..
type Preferences ¶
type Preferences struct { LogicalDPIScale float32 `` /* 148-byte string literal not displayed */ ScreenPrefs map[string]ScreenPrefs `desc:"screen-specific preferences -- will override overall defaults if set"` Colors ColorPrefs `desc:"active color preferences"` ColorSchemes map[string]*ColorPrefs `desc:"named color schemes -- has Light and Dark schemes by default"` Params ParamPrefs `view:"inline" desc:"parameters controlling GUI behavior"` Editor EditorPrefs `view:"inline" desc:"editor preferences -- for TextView etc"` KeyMap KeyMapName `desc:"select the active keymap from list of available keymaps -- see Edit KeyMaps for editing / saving / loading that list"` SaveKeyMaps bool `` /* 403-byte string literal not displayed */ SaveDetailed bool `desc:"if set, the detailed preferences are saved and loaded at startup -- only "` CustomStyles ki.Props `` /* 189-byte string literal not displayed */ CustomStylesOverride bool `` /* 208-byte string literal not displayed */ FontFamily FontName `desc:"default font family when otherwise not specified"` MonoFont FontName `desc:"default mono-spaced font family"` FontPaths []string `desc:"extra font paths, beyond system defaults -- searched first"` User User `desc:"user info -- partially filled-out automatically if empty / when prefs first created"` FavPaths FavPaths `desc:"favorite paths, shown in FileViewer and also editable there"` FileViewSort string `view:"-" desc:"column to sort by in FileView, and :up or :down for direction -- updated automatically via FileView"` ColorFilename FileName `view:"-" ext:".json" desc:"filename for saving / loading colors"` Changed bool `` /* 164-byte string literal not displayed */ }
Preferences are the overall user preferences for GoGi, providing some basic customization -- in addition, most gui settings can be styled using CSS-style sheets under CustomStyle. These prefs are saved and loaded from the GoGi user preferences directory -- see oswin/App for further info.
func (*Preferences) Apply ¶
func (pf *Preferences) Apply()
Apply preferences to all the relevant settings.
func (*Preferences) ApplyDPI ¶
func (pf *Preferences) ApplyDPI()
ApplyDPI updates the screen LogicalDPI values according to current preferences and zoom factor, and then updates all open windows as well.
func (*Preferences) DarkMode ¶ added in v0.9.11
func (pf *Preferences) DarkMode()
DarkMode sets colors to dark mode
func (*Preferences) Defaults ¶
func (pf *Preferences) Defaults()
func (*Preferences) DeleteSavedWindowGeoms ¶
func (pf *Preferences) DeleteSavedWindowGeoms()
DeleteSavedWindowGeoms deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't need to use this but sometimes useful for testing.
func (*Preferences) EditDebug ¶
func (pf *Preferences) EditDebug()
EditDebug opens the PrefsDbgView editor to edit debugging params
func (*Preferences) EditDetailed ¶
func (pf *Preferences) EditDetailed()
EditDetailed opens the PrefsDetView editor to edit detailed params
func (*Preferences) EditHiStyles ¶ added in v0.9.11
func (pf *Preferences) EditHiStyles()
EditHiStyles opens the HiStyleView editor to customize highlighting styles
func (*Preferences) EditKeyMaps ¶
func (pf *Preferences) EditKeyMaps()
EditKeyMaps opens the KeyMapsView editor to create new keymaps / save / load from other files, etc. Current avail keymaps are saved and loaded with preferences automatically.
func (*Preferences) IsDarkMode ¶ added in v0.9.11
func (pf *Preferences) IsDarkMode() bool
IsDarkMode returns true if the current background color preference is dark
func (*Preferences) LightMode ¶ added in v0.9.11
func (pf *Preferences) LightMode()
LightMode sets colors to light mode
func (*Preferences) Open ¶
func (pf *Preferences) Open() error
Open preferences from GoGi standard prefs directory
func (*Preferences) OpenColors ¶
func (pf *Preferences) OpenColors(filename FileName) error
OpenColors colors from a JSON-formatted file.
func (*Preferences) PrefColor ¶ added in v1.1.0
func (pf *Preferences) PrefColor(clrName string) *gist.Color
PrefColor returns preference color of given name (case insensitive) std names are: font, background, shadow, border, control, icon, select, highlight, link
func (*Preferences) PrefFontFamily ¶ added in v1.1.0
func (pf *Preferences) PrefFontFamily() string
PrefFontFamily returns the default FontFamily
func (*Preferences) Save ¶
func (pf *Preferences) Save() error
Save Preferences to GoGi standard prefs directory
func (*Preferences) SaveColors ¶
func (pf *Preferences) SaveColors(filename FileName) error
Save colors to a JSON-formatted file, for easy sharing of your favorite palettes.
func (*Preferences) SaveZoom ¶
func (pf *Preferences) SaveZoom(forCurrentScreen bool)
SaveZoom saves the current LogicalDPI scaling, either as the overall default or specific to the current screen.
func (*Preferences) ScreenInfo ¶
func (pf *Preferences) ScreenInfo() string
ScreenInfo returns screen info for all screens on the console.
func (*Preferences) UpdateAll ¶ added in v0.9.11
func (pf *Preferences) UpdateAll()
UpdateAll updates all open windows with current preferences -- triggers rebuild of default styles.
func (*Preferences) UpdateUser ¶
func (pf *Preferences) UpdateUser()
UpdateUser gets the user info from the OS
func (*Preferences) VersionInfo ¶ added in v0.9.1
func (pf *Preferences) VersionInfo() string
VersionInfo returns GoGi version information
type PrefsDebug ¶
type PrefsDebug struct { Update2DTrace *bool `desc:"reports trace of updates that trigger re-rendering (printfs to stdout)"` Render2DTrace *bool `desc:"reports trace of the nodes rendering (printfs to stdout)"` Layout2DTrace *bool `desc:"reports trace of all layouts (printfs to stdout)"` WinEventTrace *bool `desc:"reports trace of window events (printfs to stdout)"` WinPublishTrace *bool `` /* 140-byte string literal not displayed */ WinDrawTrace *bool `desc:"WinDrawTrace highlights the window regions that are drawn to update the window, using filled colored rectangles"` KeyEventTrace *bool `desc:"reports trace of keyboard events (printfs to stdout)"` EventTrace *bool `desc:"reports trace of event handling (printfs to stdout)"` DNDTrace *bool `desc:"reports trace of DND events handling"` GoCompleteTrace *bool `desc:"reports trace of Go language completion & lookup process"` GoTypeTrace *bool `desc:"reports trace of Go language type parsing and inference process"` Changed bool `` /* 164-byte string literal not displayed */ }
PrefsDebug are debugging params
func (*PrefsDebug) Connect ¶
func (pf *PrefsDebug) Connect()
Connect connects debug fields with actual variables controlling debugging
type PrefsDetailed ¶
type PrefsDetailed struct { MenuMaxHeight int `` /* 145-byte string literal not displayed */ EventSkipLagMSec int `` /* 216-byte string literal not displayed */ FilterLaggyKeyEvents bool `def:"false" desc:"set to true to apply laggy filter to KeyEvents (normally excluded)"` DragStartMSec int `` /* 159-byte string literal not displayed */ DragStartPix int `` /* 162-byte string literal not displayed */ DNDStartMSec int `` /* 151-byte string literal not displayed */ DNDStartPix int `` /* 154-byte string literal not displayed */ HoverStartMSec int `` /* 145-byte string literal not displayed */ HoverMaxPix int `def:"5" min:"0" max:"1000" step:"1" desc:"the maximum number of pixels that mouse can move and still register a Hover event"` CompleteWaitMSec int `def:"500" min:"10" max:"10000" step:"10" desc:"the number of milliseconds to wait before offering completions"` CompleteMaxItems int `def:"25" min:"5" step:"1" desc:"the maximum number of completions offered in popup"` CursorBlinkMSec int `` /* 129-byte string literal not displayed */ LayoutAutoScrollDelayMSec int `def:"25" min:"1" step:"5" desc:"is amount of time to wait (in Milliseconds) before trying to autoscroll again"` LayoutPageSteps int `def:"10" min:"1" step:"1" desc:"number of steps to take in PageUp / Down events in terms of number of items"` LayoutFocusNameTimeoutMSec int `` /* 183-byte string literal not displayed */ LayoutFocusNameTabMSec int `` /* 158-byte string literal not displayed */ DialogsSepWindow bool `def:"true" desc:"open dialogs in separate windows -- else do as popups in main window"` TextViewClipHistMax int `def:"100" min:"0" max:"1000" step:"5" desc:"Maximum amount of clipboard history to retain"` TextBufMaxScopeLines int `def:"100" min:"10" step:"10" desc:"maximum number of lines to look for matching scope syntax (parens, brackets)"` TextBufDiffRevertLines int `` /* 146-byte string literal not displayed */ TextBufDiffRevertDiffs int `` /* 180-byte string literal not displayed */ TextBufMarkupDelayMSec int `` /* 204-byte string literal not displayed */ MapInlineLen int `` /* 172-byte string literal not displayed */ StructInlineLen int `` /* 181-byte string literal not displayed */ SliceInlineLen int `def:"6" min:"2" step:"1" desc:"the number of slice elements below which inline will be used"` Changed bool `` /* 164-byte string literal not displayed */ }
PrefsDetailed are more detailed params not usually customized, but available for those who really care..
func (*PrefsDetailed) Apply ¶
func (pf *PrefsDetailed) Apply()
Apply detailed preferences to all the relevant settings.
func (*PrefsDetailed) Defaults ¶
func (pf *PrefsDetailed) Defaults()
Defaults gets current values of parameters, which are effectively defaults
func (*PrefsDetailed) Open ¶
func (pf *PrefsDetailed) Open() error
Open detailed preferences from GoGi standard prefs directory
func (*PrefsDetailed) Save ¶
func (pf *PrefsDetailed) Save() error
Save detailed prefs to GoGi standard prefs directory
type ProgressBar ¶ added in v1.2.0
type ProgressBar struct { ScrollBar ProgMax int `desc:"maximum amount of progress to be achieved"` ProgInc int `desc:"progress increment when display is updated -- automatically computed from ProgMax at Start but can be overwritten"` ProgCur int `desc:"current progress level"` ProgMu sync.Mutex `desc:"mutex for updating progress"` }
ProgressBar is a progress bar that fills up bar as progress continues. Call Start with a maximum value to work toward, and ProgStep each time a progress step has been accomplished -- increments the ProgCur by one and display is updated every ProgInc such steps.
func AddNewProgressBar ¶ added in v1.2.0
func AddNewProgressBar(parent ki.Ki, name string) *ProgressBar
AddNewProgressBar adds a new progress bar to given parent node, with given name.
func (*ProgressBar) CopyFieldsFrom ¶ added in v1.2.0
func (pb *ProgressBar) CopyFieldsFrom(frm interface{})
func (*ProgressBar) Defaults ¶ added in v1.2.0
func (pb *ProgressBar) Defaults()
func (*ProgressBar) ProgStep ¶ added in v1.2.0
func (pb *ProgressBar) ProgStep()
ProgStep is called every time there is an increment of progress. This is threadsafe to call from different routines.
func (*ProgressBar) Start ¶ added in v1.2.0
func (pb *ProgressBar) Start(max int)
func (*ProgressBar) UpdtBar ¶ added in v1.2.0
func (pb *ProgressBar) UpdtBar()
type RegionMap2D ¶
type RegionMap2D struct { Target Region2D `desc:"target region to render into (e.g., in RenderPlane)"` Rescale mgl32.Vec2 `` /* 165-byte string literal not displayed */ Size mgl32.Vec2 `desc:"Our overall size: Target.Size * Rescale"` }
defines how a region in 2D space is mapped
type RowCol ¶
type RowCol int32
row / col for grid data
func (*RowCol) FromString ¶
func (RowCol) MarshalJSON ¶
func (*RowCol) UnmarshalJSON ¶
type ScreenPrefs ¶
type ScreenPrefs struct {
LogicalDPIScale float32 `` /* 295-byte string literal not displayed */
}
ScreenPrefs are the per-screen preferences -- see oswin/App/Screen() for info on the different screens -- these prefs are indexed by the Screen.Name -- settings here override those in the global preferences.
type ScrollBar ¶
type ScrollBar struct {
SliderBase
}
ScrollBar has a proportional thumb size reflecting amount of content visible
func AddNewScrollBar ¶ added in v0.9.7
AddNewScrollBar adds a new scrollbar to given parent node, with given name.
func (*ScrollBar) ConnectEvents2D ¶
func (sb *ScrollBar) ConnectEvents2D()
func (*ScrollBar) CopyFieldsFrom ¶ added in v0.9.8
func (sb *ScrollBar) CopyFieldsFrom(frm interface{})
func (*ScrollBar) FocusChanged2D ¶
func (sb *ScrollBar) FocusChanged2D(change FocusChanges)
func (*ScrollBar) Render2DDefaultStyle ¶
func (sb *ScrollBar) Render2DDefaultStyle()
render using a default style if not otherwise styled
type Separator ¶
type Separator struct { WidgetBase Horiz bool `xml:"horiz" desc:"is this a horizontal separator -- otherwise vertical"` }
Separator draws a vertical or horizontal line
func AddNewSeparator ¶ added in v0.9.7
AddNewSeparator adds a new separator to given parent node, with given name and Horiz (else Vert).
func (*Separator) CopyFieldsFrom ¶ added in v0.9.9
func (sp *Separator) CopyFieldsFrom(frm interface{})
func (*Separator) RenderSeparator ¶ added in v1.0.5
func (sp *Separator) RenderSeparator()
type Shortcuts ¶
Shortcuts is a map between a key chord and a specific Action that can be triggered. This mapping must be unique, in that each chord has unique Action, and generally each Action only has a single chord as well, though this is not strictly enforced. Shortcuts are evaluated *after* the standard KeyMap event processing, so any conflicts are resolved in favor of the local widget's key event processing, with the shortcut only operating when no conflicting widgets are in focus. Shortcuts are always window-wide and are intended for global window / toolbar actions. Widget-specific key functions should be handled directly within widget key event processing.
type SliceLabeler ¶ added in v0.9.8
type SliceLabeler interface { // ElemLabel returns a GUI-appropriate label for slice element at given index ElemLabel(idx int) string }
SliceLabeler interface provides a GUI-appropriate label for a slice item, given an index into the slice.
type Slider ¶
type Slider struct {
SliderBase
}
Slider is a standard value slider with a fixed-sized thumb knob -- if an Icon is set, it is used for the knob of the slider
func AddNewSlider ¶ added in v0.9.7
AddNewSlider adds a new slider to given parent node, with given name.
func (*Slider) ConnectEvents2D ¶
func (sr *Slider) ConnectEvents2D()
func (*Slider) CopyFieldsFrom ¶ added in v0.9.8
func (sr *Slider) CopyFieldsFrom(frm interface{})
func (*Slider) FocusChanged2D ¶
func (sr *Slider) FocusChanged2D(change FocusChanges)
func (*Slider) Render2DDefaultStyle ¶
func (sr *Slider) Render2DDefaultStyle()
render using a default style if not otherwise styled
type SliderBase ¶
type SliderBase struct { PartsWidgetBase Value float32 `xml:"value" desc:"current value"` EmitValue float32 `copy:"-" xml:"-" json:"-" desc:"previous emitted value - don't re-emit if it is the same"` Min float32 `xml:"min" desc:"minimum value in range"` Max float32 `xml:"max" desc:"maximum value in range"` Step float32 `xml:"step" desc:"smallest step size to increment"` PageStep float32 `xml:"pagestep" desc:"larger PageUp / Dn step size"` Size float32 `xml:"size" desc:"size of the slide box in the relevant dimension -- range of motion -- exclusive of spacing"` ThSize float32 `` /* 211-byte string literal not displayed */ ThSizeReal float32 `` /* 141-byte string literal not displayed */ ThumbSize units.Value `xml:"thumb-size" desc:"styled fixed size of the thumb"` Prec int `` /* 212-byte string literal not displayed */ Icon IconName `view:"show-name" desc:"optional icon for the dragging knob"` ValThumb bool `` /* 268-byte string literal not displayed */ ThumbVal float32 `xml:"thumb-val" desc:"value that the thumb represents, in the same units"` Pos float32 `xml:"-" desc:"logical position of the slider relative to Size"` DragPos float32 `xml:"-" desc:"underlying drag position of slider -- not subject to snapping"` Dim mat32.Dims `desc:"dimension along which the slider slides"` Tracking bool `` /* 182-byte string literal not displayed */ TrackThr float32 `xml:"track-thr" desc:"threshold for amount of change in scroll value before emitting a signal in Tracking mode"` Snap bool `xml:"snap" desc:"snap the values to Step size increments"` Off bool `desc:"can turn off e.g., scrollbar rendering with this flag -- just prevents rendering"` State SliderStates `json:"-" xml:"-" desc:"state of slider"` StateStyles [SliderStatesN]gist.Style `` /* 246-byte string literal not displayed */ SliderSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for slider -- see SliderSignals for the types"` }
SliderBase has common slider functionality -- two major modes: ValThumb = false is a slider with a fixed-size thumb knob, while = true has a thumb that represents a value, as in a scrollbar, and the scrolling range is size - thumbsize
func (*SliderBase) ConfigParts ¶
func (sb *SliderBase) ConfigParts()
func (*SliderBase) ConfigPartsIfNeeded ¶
func (sb *SliderBase) ConfigPartsIfNeeded(render bool)
func (*SliderBase) CopyFieldsFrom ¶ added in v0.9.8
func (sb *SliderBase) CopyFieldsFrom(frm interface{})
func (*SliderBase) Defaults ¶
func (sb *SliderBase) Defaults()
func (*SliderBase) Disconnect ¶ added in v0.9.8
func (sb *SliderBase) Disconnect()
func (*SliderBase) EmitNewValue ¶ added in v1.0.7
func (sb *SliderBase) EmitNewValue() bool
EmitNewValue emits new Value, if it has not already been emitted. Compares Value to EmitValue and only emits if different, sets EmitValue. Returns true if value emitted, false otherwise.
func (*SliderBase) Init2DSlider ¶
func (sb *SliderBase) Init2DSlider()
func (*SliderBase) KeyChordEvent ¶
func (sb *SliderBase) KeyChordEvent()
func (*SliderBase) KeyInput ¶
func (sb *SliderBase) KeyInput(kt *key.ChordEvent)
func (*SliderBase) MouseDragEvent ¶
func (sb *SliderBase) MouseDragEvent()
func (*SliderBase) MouseEvent ¶
func (sb *SliderBase) MouseEvent()
func (*SliderBase) MouseFocusEvent ¶
func (sb *SliderBase) MouseFocusEvent()
func (*SliderBase) MouseScrollEvent ¶
func (sb *SliderBase) MouseScrollEvent()
func (*SliderBase) PointToRelPos ¶
func (sb *SliderBase) PointToRelPos(pt image.Point) image.Point
PointToRelPos translates a point in global pixel coords into relative position within node. This satisfies the SliderPositioner interface.
func (*SliderBase) SetSliderPos ¶
func (sb *SliderBase) SetSliderPos(pos float32)
SetSliderPos sets the position of the slider at the given position in pixels, and updates the corresponding Value based on that position.
func (*SliderBase) SetSliderState ¶
func (sb *SliderBase) SetSliderState(state SliderStates)
SetSliderState sets the slider state to given state, updates style
func (*SliderBase) SetThumbValue ¶
func (sb *SliderBase) SetThumbValue(val float32)
SetThumbValue sets the thumb value to given value and updates the thumb size -- for scrollbar-style sliders where the thumb size represents visible range
func (*SliderBase) SetValue ¶
func (sb *SliderBase) SetValue(val float32)
SetValue sets the value and updates the slider position, but does not emit an updated signal (see SetValueAction)
func (*SliderBase) SetValueAction ¶
func (sb *SliderBase) SetValueAction(val float32)
SetValueAction sets the value and updates the slider representation, and emits a changed signal
func (*SliderBase) SizeFromAlloc ¶
func (sb *SliderBase) SizeFromAlloc()
SizeFromAlloc gets size from allocation
func (*SliderBase) SliderEnterHover ¶
func (sb *SliderBase) SliderEnterHover()
SliderEnterHover slider starting hover
func (*SliderBase) SliderEvents ¶
func (sb *SliderBase) SliderEvents()
func (*SliderBase) SliderExitHover ¶
func (sb *SliderBase) SliderExitHover()
SliderExitHover called when slider exiting hover
func (*SliderBase) SliderMove ¶ added in v0.9.11
func (sb *SliderBase) SliderMove(start, end float32)
SliderMove called when slider moved along relevant axis
func (*SliderBase) SliderPress ¶ added in v0.9.11
func (sb *SliderBase) SliderPress(pos float32)
SliderPress sets the slider in the down state -- mouse clicked down but not yet up -- emits SliderPress signal
func (*SliderBase) SliderRelease ¶ added in v0.9.11
func (sb *SliderBase) SliderRelease()
SliderRelease called when the slider has just been released -- sends a released signal and returns state to normal, and emits clicked signal if if it was previously in pressed state
func (*SliderBase) SnapValue ¶
func (sb *SliderBase) SnapValue()
SnapValue snaps the value to step sizes if snap option is set
func (*SliderBase) StyleFromProps ¶ added in v0.9.11
func (sr *SliderBase) StyleFromProps(props ki.Props, vp *Viewport2D)
StyleFromProps styles Slider-specific fields from ki.Prop properties doesn't support inherit or default
func (*SliderBase) StyleSlider ¶ added in v0.9.11
func (sr *SliderBase) StyleSlider()
func (*SliderBase) StyleToDots ¶ added in v0.9.11
func (sr *SliderBase) StyleToDots(uc *units.Context)
ToDots runs ToDots on unit values, to compile down to raw pixels
func (*SliderBase) UpdatePosFromValue ¶
func (sb *SliderBase) UpdatePosFromValue()
UpdatePosFromValue updates the slider position based on the current Value
func (*SliderBase) UpdateThumbValSize ¶
func (sb *SliderBase) UpdateThumbValSize()
UpdateThumbValSize sets thumb size as proportion of min / max (e.sb., amount visible in scrollbar) -- max's out to full size
type SliderPositioner ¶ added in v0.9.11
type SliderPositioner interface { // PointToRelPos translates a point in global pixel coords into relative // position within node PointToRelPos(pt image.Point) image.Point }
SliderPositioner is a minor interface for functions related to computing slider positions. Needed for more complex sliders such as Splitters that do this computation in a different way.
type SliderSignals ¶
type SliderSignals int64
SliderSignals are signals that sliders can send
const ( // SliderValueChanged indicates that the value has changed -- if tracking // is enabled, then this tracks online changes -- otherwise only at the // end. The data on the signal is the float32 Value. SliderValueChanged SliderSignals = iota // SliderPressed means slider was pushed down but not yet up. SliderPressed // SliderReleased means the slider has been released after being pressed. SliderReleased // SliderMoved means the slider position has moved (low level move event). SliderMoved SliderSignalsN )
func (*SliderSignals) FromString ¶
func (i *SliderSignals) FromString(s string) error
func (SliderSignals) String ¶
func (i SliderSignals) String() string
type SliderStates ¶
type SliderStates int32
SliderStates are mutually-exclusive slider states -- determines appearance
const ( // normal state -- there but not being interacted with SliderActive SliderStates = iota // inactive -- not responsive SliderInactive // mouse is hovering over the slider SliderHover // slider is the focus -- will respond to keyboard input SliderFocus // slider is currently being pressed down SliderDown // use background-color here to fill in selected value of slider SliderValue // these styles define the overall box around slider -- typically no border and a white background -- needs a background to allow local re-rendering SliderBox // total number of slider states SliderStatesN )
func (*SliderStates) FromString ¶
func (i *SliderStates) FromString(s string) error
func (SliderStates) String ¶
func (i SliderStates) String() string
type Space ¶
type Space struct {
WidgetBase
}
Space adds a fixed sized (1 ch x 1 em by default) blank space to a layout -- set width / height property to change
func AddNewSpace ¶ added in v0.9.7
AddNewSpace adds a new space to given parent node, with given name.
func (*Space) CopyFieldsFrom ¶ added in v0.9.8
func (sp *Space) CopyFieldsFrom(frm interface{})
type Spell ¶ added in v0.9.14
type Spell struct { ki.Node SrcLn int `desc:"line number in source that spelling is operating on, if relevant"` SrcCh int `desc:"character position in source that spelling is operating on (start of word to be corrected)"` Suggest []string `desc:"list of suggested corrections"` Word string `desc:"word being checked"` LastLearned string `desc:"last word learned -- can be undone -- stored in lowercase format"` SpellSig ki.Signal `json:"-" xml:"-" view:"-" desc:"signal for Spell -- see SpellSignals for the types"` Correction string `desc:"the user's correction selection'"` Vp *Viewport2D `desc:"the viewport where the current popup menu is presented"` }
Spell
func (*Spell) Cancel ¶ added in v0.9.14
Cancel cancels any pending spell correction -- call when new events nullify prior correction returns true if canceled
func (*Spell) CheckWord ¶ added in v1.1.3
CheckWord checks the model to determine if the word is known. automatically checks the Ignore list first.
func (*Spell) Disconnect ¶ added in v0.9.14
func (sc *Spell) Disconnect()
func (*Spell) IgnoreWord ¶ added in v1.1.3
func (sc *Spell) IgnoreWord()
IgnoreWord adds the word to the ignore list
func (*Spell) IsLastLearned ¶ added in v1.1.3
IsLastLearned returns true if given word was the last one learned
func (*Spell) KeyInput ¶ added in v0.9.14
KeyInput is the opportunity for the spelling correction popup to act on specific key inputs
func (*Spell) LearnWord ¶ added in v1.1.3
func (sc *Spell) LearnWord()
LearnWord gets the misspelled/unknown word and passes to LearnWord
func (*Spell) Show ¶ added in v0.9.14
func (sc *Spell) Show(text string, vp *Viewport2D, pt image.Point)
Show is the main call for listing spelling corrections. Calls ShowNow which builds the correction popup menu Similar to completion.Show but does not use a timer Displays popup immediately for any unknown word
func (*Spell) ShowNow ¶ added in v0.9.14
func (sc *Spell) ShowNow(word string, vp *Viewport2D, pt image.Point)
ShowNow actually builds the correction popup menu
func (*Spell) Spell ¶ added in v0.9.14
Spell emits a signal to let subscribers know that the user has made a selection from the list of possible corrections
func (*Spell) UnLearnLast ¶ added in v1.1.3
func (sc *Spell) UnLearnLast()
UnLearnLast unlearns the last learned word -- in case accidental
type SpellSignals ¶
type SpellSignals int64
SpellSignals are signals that are sent by Spell
const ( // SpellSelect means the user chose one of the possible corrections SpellSelect SpellSignals = iota // SpellIgnore signals the user chose ignore so clear the tag SpellIgnore )
func (*SpellSignals) FromString ¶
func (i *SpellSignals) FromString(s string) error
func (SpellSignals) String ¶
func (i SpellSignals) String() string
type SpinBox ¶
type SpinBox struct { PartsWidgetBase Value float32 `xml:"value" desc:"current value"` HasMin bool `xml:"has-min" desc:"is there a minimum value to enforce"` Min float32 `xml:"min" desc:"minimum value in range"` HasMax bool `xml:"has-max" desc:"is there a maximumvalue to enforce"` Max float32 `xml:"max" desc:"maximum value in range"` Step float32 `xml:"step" desc:"smallest step size to increment"` PageStep float32 `xml:"pagestep" desc:"larger PageUp / Dn step size"` Prec int `` /* 201-byte string literal not displayed */ Format string `` /* 208-byte string literal not displayed */ UpIcon IconName `view:"show-name" desc:"icon to use for up button -- defaults to wedge-up"` DownIcon IconName `view:"show-name" desc:"icon to use for down button -- defaults to wedge-down"` SpinBoxSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for spin box -- has no signal types, just emitted when the value changes"` }
SpinBox combines a TextField with up / down buttons for incrementing / decrementing values -- all configured within the Parts of the widget
func AddNewSpinBox ¶ added in v0.9.7
AddNewSpinBox adds a new spinbox to given parent node, with given name.
func (*SpinBox) ConfigParts ¶
func (sb *SpinBox) ConfigParts()
func (*SpinBox) ConfigPartsIfNeeded ¶
func (sb *SpinBox) ConfigPartsIfNeeded()
func (*SpinBox) ConnectEvents2D ¶
func (sb *SpinBox) ConnectEvents2D()
func (*SpinBox) CopyFieldsFrom ¶ added in v0.9.8
func (sb *SpinBox) CopyFieldsFrom(frm interface{})
func (*SpinBox) Disconnect ¶ added in v0.9.8
func (sb *SpinBox) Disconnect()
func (*SpinBox) FormatIsInt ¶ added in v0.9.11
FormatIsInt returns true if the format string requires an integer value
func (*SpinBox) HasFocus2D ¶
func (*SpinBox) IncrValue ¶
IncrValue increments the value by given number of steps (+ or -), and enforces it to be an even multiple of the step size (snap-to-value), and emits the signal
func (*SpinBox) MouseScrollEvent ¶
func (sb *SpinBox) MouseScrollEvent()
func (*SpinBox) SetValueAction ¶
SetValueAction calls SetValue and also emits the signal
func (*SpinBox) SpinBoxEvents ¶
func (sb *SpinBox) SpinBoxEvents()
func (*SpinBox) StringToVal ¶ added in v0.9.11
StringToVal converts the string field back to float value
func (*SpinBox) StyleFromProps ¶ added in v0.9.11
func (sb *SpinBox) StyleFromProps(props ki.Props, vp *Viewport2D)
StyleFromProps styles SpinBox-specific fields from ki.Prop properties doesn't support inherit or default
func (*SpinBox) StyleSpinBox ¶
func (sb *SpinBox) StyleSpinBox()
StyleSpinBox does spinbox styling -- sets StyMu Lock
func (*SpinBox) TextFieldEvent ¶
func (sb *SpinBox) TextFieldEvent()
func (*SpinBox) ValToString ¶ added in v0.9.11
ValToString converts the value to the string representation thereof
type SplitView ¶
type SplitView struct { PartsWidgetBase HandleSize units.Value `` /* 158-byte string literal not displayed */ Splits []float32 `desc:"proportion (0-1 normalized, enforced) of space allocated to each element -- can enter 0 to collapse a given element"` SavedSplits []float32 `desc:"A saved version of the splits which can be restored -- for dynamic collapse / expand operations"` Dim mat32.Dims `desc:"dimension along which to split the space"` }
SplitView allocates a fixed proportion of space to each child, along given dimension, always using only the available space given to it by its parent (i.e., it will force its children, which should be layouts (typically Frame's), to have their own scroll bars as necessary). It should generally be used as a main outer-level structure within a window, providing a framework for inner elements -- it allows individual child elements to update independently and thus is important for speeding update performance. It uses the Widget Parts to hold the splitter widgets separately from the children that contain the rest of the scenegraph to be displayed within each region.
func AddNewSplitView ¶ added in v0.9.7
AddNewSplitView adds a new splitview to given parent node, with given name.
func (*SplitView) CollapseChild ¶
CollapseChild collapses given child(ren) (sets split proportion to 0), optionally saving the prior splits for later Restore function -- does an Update -- triggered by double-click of splitter
func (*SplitView) ConfigSplitters ¶
func (sv *SplitView) ConfigSplitters()
func (*SplitView) ConnectEvents2D ¶
func (sv *SplitView) ConnectEvents2D()
func (*SplitView) CopyFieldsFrom ¶ added in v0.9.8
func (sv *SplitView) CopyFieldsFrom(frm interface{})
func (*SplitView) EvenSplits ¶
func (sv *SplitView) EvenSplits()
EvenSplits splits space evenly across all panels
func (*SplitView) HasFocus2D ¶
func (*SplitView) IsCollapsed ¶ added in v0.9.11
IsCollapsed returns true if given split number is collapsed
func (*SplitView) KeyChordEvent ¶
func (sv *SplitView) KeyChordEvent()
func (*SplitView) KeyInput ¶
func (sv *SplitView) KeyInput(kt *key.ChordEvent)
func (*SplitView) RestoreChild ¶
RestoreChild restores given child(ren) -- does an Update
func (*SplitView) RestoreSplits ¶
func (sv *SplitView) RestoreSplits()
RestoreSplits restores a previously-saved set of splits (if it exists), does an update
func (*SplitView) SaveSplits ¶
func (sv *SplitView) SaveSplits()
SaveSplits saves the current set of splits in SavedSplits, for a later RestoreSplits
func (*SplitView) SetSplitAction ¶
SetSplitAction sets the new splitter value, for given splitter -- new value is 0..1 value of position of that splitter -- it is a sum of all the positions up to that point. Splitters are updated to ensure that selected position is achieved, while dividing remainder appropriately.
func (*SplitView) SetSplits ¶
SetSplits sets the split proportions -- can use 0 to hide / collapse a child entirely -- just does the basic local update start / end use SetSplitsAction to trigger full rebuild which is typically required
func (*SplitView) SetSplitsAction ¶
SetSplitsAction sets the split proportions -- can use 0 to hide / collapse a child entirely -- does full rebuild at level of viewport
func (*SplitView) SetSplitsList ¶ added in v0.9.7
SetSplitsList sets the split proportions using a list (slice) argument, instead of variable args -- e.g., for Python or other external users. can use 0 to hide / collapse a child entirely -- just does the basic local update start / end -- use SetSplitsAction to trigger full rebuild which is typically required
func (*SplitView) SplitViewEvents ¶
func (sv *SplitView) SplitViewEvents()
func (*SplitView) StyleSplitView ¶
func (sv *SplitView) StyleSplitView()
func (*SplitView) UpdateSplits ¶
func (sv *SplitView) UpdateSplits()
UpdateSplits updates the splits to be same length as number of children, and normalized
type Splitter ¶
type Splitter struct { SliderBase SplitterNo int `desc:"splitter number this one is"` OrigWinBBox image.Rectangle `` /* 137-byte string literal not displayed */ }
Splitter provides the splitter handle and line separating two elements in a SplitView, with draggable resizing of the splitter -- parent is Parts layout of the SplitView -- based on SliderBase
func (*Splitter) ConfigPartsIfNeeded ¶
func (*Splitter) ConnectEvents2D ¶
func (sr *Splitter) ConnectEvents2D()
func (*Splitter) FocusChanged2D ¶
func (sr *Splitter) FocusChanged2D(change FocusChanges)
func (*Splitter) MouseEvent ¶ added in v0.9.11
func (sr *Splitter) MouseEvent()
func (*Splitter) MouseScrollEvent ¶ added in v1.0.0
func (sr *Splitter) MouseScrollEvent()
func (*Splitter) PointToRelPos ¶ added in v0.9.11
func (*Splitter) RenderSplitter ¶ added in v1.0.5
func (sr *Splitter) RenderSplitter()
RenderSplitter does the default splitter rendering
func (*Splitter) SplitterEvents ¶ added in v0.9.11
func (sr *Splitter) SplitterEvents()
func (*Splitter) UpdateSplitterPos ¶
func (sr *Splitter) UpdateSplitterPos()
type Sprite ¶ added in v0.9.8
type Sprite struct { On bool `desc:"whether this sprite is active now or not"` Name string `desc:"unique name of sprite"` Props ki.Props `desc:"properties for sprite -- allows user-extensible data"` Geom Geom2DInt `desc:"position and size of the image within the overlay window texture"` Pixels *image.RGBA `desc:"pixels to render -- should be same size as Geom.Size"` Events map[oswin.EventType]*ki.Signal `desc:"optional event signals for given event type"` }
A Sprite is just an image (with optional background) that can be drawn onto the OverTex overlay texture of a window. Sprites are used for cursors and for dynamic editing / interactive GUI elements (e.g., drag-n-drop elments)
func NewSprite ¶ added in v1.3.0
NewSprite returns a new sprite with given name, which must remain invariant and unique among all sprites in use, and is used for all access -- prefix with package and type name to ensure uniqueness. Starts out in inactive state -- must call ActivateSprite. If size is 0, no image is made.
func (*Sprite) ConnectEvent ¶ added in v1.2.0
ConnectEvent adds a Signal connection for given event type to given receiver. only mouse events are supported. Sprite events are always top priority -- if mouse is inside sprite geom, then it is sent if event function does not mark event as processed, it will continue to propagate
func (*Sprite) DisconnectAllEvents ¶ added in v1.2.0
func (sp *Sprite) DisconnectAllEvents()
DisconnectAllEvents removes all event connections for this sprite
func (*Sprite) DisconnectEvent ¶ added in v1.2.0
DisconnectEvent removes Signal connection for given event type to given receiver.
func (*Sprite) GrabRenderFrom ¶ added in v0.9.8
GrabRenderFrom grabs the rendered image from given node
func (*Sprite) SetBottomPos ¶ added in v0.9.8
SetBottomPos sets the sprite's bottom position to given point the Geom.Pos represents its top position
type Sprites ¶ added in v0.9.8
type Sprites struct { Names ordmap.Map[string, *Sprite] `desc:"map of uniquely named sprites"` SzAlloc szalloc.SzAlloc `desc:"allocation of sprites by size for rendering"` Modified bool `desc:"set to true if sprites have been modified since last config"` Active int `desc:"number of active sprites"` }
Sprites manages a collection of sprites organized by size and name
func (*Sprites) Add ¶ added in v1.3.0
Add adds sprite to list, and returns the image index and layer index within that for given sprite. If name already exists on list, then it is returned, with size allocation updated as needed.
func (*Sprites) AllocSizes ¶ added in v1.3.0
func (ss *Sprites) AllocSizes()
AllocSizes allocates the sprites by size to fixed set of images and layers
func (*Sprites) Delete ¶ added in v1.3.0
Delete deletes sprite by name, returning indexes where it was located. All sprite images must be updated when this occurs, as indexes may have shifted.
func (*Sprites) HasSizeChanged ¶ added in v1.3.0
HasSizeChanged returns true if a sprite's size has changed relative to its last allocated value, in SzAlloc. Returns true and sets Modified flag to true if so.
type Stretch ¶
type Stretch struct {
WidgetBase
}
Stretch adds an infinitely stretchy element for spacing out layouts (max-size = -1) set the width / height property to determine how much it takes relative to other stretchy elements
func AddNewStretch ¶ added in v0.9.7
AddNewStretch adds a new stretch to given parent node, with given name.
func (*Stretch) CopyFieldsFrom ¶ added in v0.9.8
func (st *Stretch) CopyFieldsFrom(frm interface{})
type Stripes ¶
type Stripes int32
Stripes defines stripes options for elements that can render striped backgrounds
func (*Stripes) FromString ¶
func (Stripes) MarshalJSON ¶
func (*Stripes) UnmarshalJSON ¶
type StyleSheet ¶
type StyleSheet struct { Node2DBase Sheet *css.Stylesheet }
StyleSheet is a Node2D node that contains a stylesheet -- property values contained in this sheet can be transformed into ki.Props and set in CSS field of appropriate node
func AddNewStyleSheet ¶ added in v0.9.7
func AddNewStyleSheet(parent ki.Ki, name string) *StyleSheet
AddNewStyleSheet adds a new CSS stylesheet to given parent node, with given name.
func (*StyleSheet) CSSProps ¶
func (ss *StyleSheet) CSSProps() ki.Props
CSSProps returns the properties for each of the rules in this style sheet, suitable for setting the CSS value of a node -- returns nil if empty sheet
func (*StyleSheet) CopyFieldsFrom ¶ added in v1.2.3
func (ss *StyleSheet) CopyFieldsFrom(frm interface{})
func (*StyleSheet) ParseString ¶
func (ss *StyleSheet) ParseString(str string) error
ParseString parses the string into a StyleSheet of rules, which can then be used for extracting properties
type TabButton ¶
type TabButton struct { Action NoDelete bool `desc:"if true, this tab does not have the delete button avail"` }
TabButton is a larger select action and a small close action. Indicator icon is used for close icon.
func (*TabButton) ConfigParts ¶
func (tb *TabButton) ConfigParts()
func (*TabButton) ConfigPartsDeleteButton ¶ added in v0.9.11
func (tb *TabButton) ConfigPartsDeleteButton()
type TabView ¶
type TabView struct { Layout MaxChars int `desc:"maximum number of characters to include in tab label -- elides labels that are longer than that"` TabViewSig ki.Signal `copy:"-" json:"-" xml:"-" desc:"signal for tab widget -- see TabViewSignals for the types"` NewTabButton bool `desc:"show a new tab button at right of list of tabs"` NoDeleteTabs bool `desc:"if true, tabs are not user-deleteable"` NewTabType reflect.Type `desc:"type of widget to create in a new tab via new tab button -- Frame by default"` Mu sync.Mutex `` /* 157-byte string literal not displayed */ }
TabView switches among child widgets via tabs. The selected widget gets the full allocated space avail after the tabs are accounted for. The TabView is just a Vertical layout that manages two child widgets: a HorizFlow Layout for the tabs (which can flow across multiple rows as needed) and a Stacked Frame that actually contains all the children, and provides scrollbars as needed to any content within. Typically should have max stretch and a set preferred size, so it expands.
func AddNewTabView ¶ added in v0.9.7
AddNewTabView adds a new tabview to given parent node, with given name.
func (*TabView) AddNewTab ¶
AddNewTab adds a new widget as a new tab of given widget type, with given tab label, and returns the new widget
func (*TabView) AddNewTabAction ¶
AddNewTabAction adds a new widget as a new tab of given widget type, with given tab label, and returns the new widget -- emits TabAdded signal
func (*TabView) AddNewTabFrame ¶ added in v1.2.8
AddNewTabFrame adds a new widget as a new tab of given widget type, with given tab label, and returns the new widget. A Frame is added first and the widget is added to that Frame. The Frame has "-frame" suffix added to name.
func (*TabView) AddNewTabLayout ¶ added in v1.2.8
AddNewTabLayout adds a new widget as a new tab of given widget type, with given tab label, and returns the new widget. A Layout is added first and the widget is added to that layout. The Layout has "-lay" suffix added to name.
func (*TabView) AddTab ¶
AddTab adds a widget as a new tab, with given tab label, and returns the index of that tab
func (*TabView) Config ¶ added in v1.2.3
func (tv *TabView) Config()
Config initializes the tab widget children if it hasn't been done yet
func (*TabView) ConfigNewTabButton ¶
ConfigNewTabButton configures the new tab + button at end of list of tabs
func (*TabView) CopyFieldsFrom ¶ added in v0.9.8
func (tv *TabView) CopyFieldsFrom(frm interface{})
func (*TabView) DeleteTabIndex ¶
DeleteTabIndex deletes tab at given index, optionally calling destroy on tab contents -- returns widget if destroy == false, tab name, and bool success
func (*TabView) DeleteTabIndexAction ¶
DeleteTabIndexAction deletes tab at given index using destroy flag, and emits TabDeleted signal with name of deleted tab this is called by the delete button on the tab
func (*TabView) Disconnect ¶ added in v0.9.8
func (tv *TabView) Disconnect()
func (*TabView) InsertNewTab ¶
InsertNewTab inserts a new widget of given type into given index position within list of tabs, and returns that new widget
func (*TabView) InsertTab ¶
InsertTab inserts a widget into given index position within list of tabs
func (*TabView) InsertTabOnlyAt ¶
InsertTabOnlyAt inserts just the tab at given index -- after panel has already been added to frame -- assumed to be wrapped in update. Generally for internal use.
func (*TabView) RecycleTab ¶ added in v0.9.11
RecycleTab returns a tab with given name, first by looking for an existing one, and if not found, making a new one with widget of given type. If sel, then select it. returns widget for tab.
func (*TabView) RenderTabSeps ¶
func (tv *TabView) RenderTabSeps()
RenderTabSeps renders the separators between tabs
func (*TabView) RenumberTabs ¶
func (tv *TabView) RenumberTabs()
RenumberTabs assigns proper index numbers to each tab
func (*TabView) SelectTabByName ¶
SelectTabByName selects tab by name, returning it.
func (*TabView) SelectTabByNameTry ¶ added in v0.9.7
SelectTabByNameTry selects tab by name, returning it. Returns error if not found.
func (*TabView) SelectTabIndex ¶
SelectTabIndex selects tab at given index, returning it -- returns false if index is invalid
func (*TabView) SelectTabIndexAction ¶
SelectTabIndexAction selects tab at given index and emits selected signal, with the index of the selected tab -- this is what is called when a tab is clicked
func (*TabView) TabAtIndex ¶
TabAtIndex returns content widget and tab button at given index, false if index out of range (emits log message)
func (*TabView) TabByName ¶
TabByName returns tab with given name (nil if not found -- see TabByNameTry)
func (*TabView) TabByNameTry ¶ added in v0.9.7
TabByNameTry returns tab with given name, and an error if not found.
func (*TabView) TabIndexByName ¶ added in v0.9.7
TabIndexByName returns tab index for given tab name, and an error if not found.
func (*TabView) UnselectOtherTabs ¶
UnselectOtherTabs turns off all the tabs except given one
type TabViewSignals ¶
type TabViewSignals int64
TabViewSignals are signals that the TabView can send
const ( // TabSelected indicates tab was selected -- data is the tab index TabSelected TabViewSignals = iota // TabAdded indicates tab was added -- data is the tab index TabAdded // TabDeleted indicates tab was deleted -- data is the tab name TabDeleted TabViewSignalsN )
func (*TabViewSignals) FromString ¶
func (i *TabViewSignals) FromString(s string) error
func (TabViewSignals) String ¶
func (i TabViewSignals) String() string
type TextField ¶
type TextField struct { PartsWidgetBase Txt string `json:"-" xml:"text" desc:"the last saved value of the text string being edited"` Placeholder string `json:"-" xml:"placeholder" desc:"text that is displayed when the field is empty, in a lower-contrast manner"` ClearAct bool `xml:"clear-act" desc:"add a clear action x at right side of edit, set from clear-act property (inherited) -- on by default"` CursorWidth units.Value `xml:"cursor-width" desc:"width of cursor -- set from cursor-width property (inherited)"` Edited bool `json:"-" xml:"-" desc:"true if the text has been edited relative to the original"` EditTxt []rune `json:"-" xml:"-" desc:"the live text string being edited, with latest modifications -- encoded as runes"` MaxWidthReq int `` /* 199-byte string literal not displayed */ EffSize mat32.Vec2 `copy:"-" json:"-" xml:"-" desc:"effective size, subtracting the close widget"` StartPos int `copy:"-" json:"-" xml:"-" desc:"starting display position in the string"` EndPos int `copy:"-" json:"-" xml:"-" desc:"ending display position in the string"` CursorPos int `copy:"-" json:"-" xml:"-" desc:"current cursor position"` CharWidth int `copy:"-" json:"-" xml:"-" desc:"approximate number of chars that can be displayed at any time -- computed from font size etc"` SelectStart int `copy:"-" json:"-" xml:"-" desc:"starting position of selection in the string"` SelectEnd int `copy:"-" json:"-" xml:"-" desc:"ending position of selection in the string"` SelectInit int `copy:"-" json:"-" xml:"-" desc:"initial selection position -- where it started"` SelectMode bool `copy:"-" json:"-" xml:"-" desc:"if true, select text as cursor moves"` TextFieldSig ki.Signal `copy:"-" json:"-" xml:"-" view:"-" desc:"signal for line edit -- see TextFieldSignals for the types"` RenderAll girl.Text `copy:"-" json:"-" xml:"-" desc:"render version of entire text, for sizing"` RenderVis girl.Text `copy:"-" json:"-" xml:"-" desc:"render version of just visible text"` StateStyles [TextFieldStatesN]gist.Style `copy:"-" json:"-" xml:"-" desc:"normal style and focus style"` FontHeight float32 `copy:"-" json:"-" xml:"-" desc:"font height, cached during styling"` BlinkOn bool `copy:"-" json:"-" xml:"-" desc:"oscillates between on and off for blinking"` CursorMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"mutex for updating cursor between blinker and field"` Complete *Complete `copy:"-" json:"-" xml:"-" desc:"functions and data for textfield completion"` NoEcho bool `copy:"-" json:"-" xml:"-" desc:"replace displayed characters with bullets to conceal text"` }
TextField is a widget for editing a line of text
var BlinkingTextField *TextField
BlinkingTextField is the text field that is blinking
func AddNewTextField ¶ added in v0.9.7
AddNewTextField adds a new textfield to given parent node, with given name.
func (*TextField) AutoScroll ¶
func (tf *TextField) AutoScroll()
AutoScroll scrolls the starting position to keep the cursor visible
func (*TextField) CancelComplete ¶
func (tf *TextField) CancelComplete()
CancelComplete cancels any pending completion -- call this when new events have moved beyond any prior completion scenario
func (*TextField) CharStartPos ¶
CharStartPos returns the starting render coords for the given character position in string -- makes no attempt to rationalize that pos (i.e., if not in visible range, position will be out of range too). if wincoords is true, then adds window box offset -- for cursor, popups
func (*TextField) ClearCursor ¶
func (tf *TextField) ClearCursor()
ClearCursor turns off cursor and stops it from blinking
func (*TextField) ClearSelected ¶
func (tf *TextField) ClearSelected()
ClearSelected resets both the global selected flag and any current selection
func (*TextField) CompleteExtend ¶
CompleteExtend inserts the extended seed at the current cursor position
func (*TextField) CompleteText ¶
CompleteText edits the text field using the string chosen from the completion menu
func (*TextField) ConfigParts ¶
func (tf *TextField) ConfigParts()
func (*TextField) ConnectEvents2D ¶
func (tf *TextField) ConnectEvents2D()
func (*TextField) Copy ¶
Copy copies any selected text to the clipboard. Satisfies Clipper interface -- can be extended in subtypes. optionally resetting the current selection
func (*TextField) CopyFieldsFrom ¶ added in v0.9.8
func (tf *TextField) CopyFieldsFrom(frm interface{})
func (*TextField) CursorBackspace ¶
CursorBackspace deletes character(s) immediately before cursor
func (*TextField) CursorBackward ¶
CursorBackward moves the cursor backward
func (*TextField) CursorDelete ¶
CursorDelete deletes character(s) immediately after the cursor
func (*TextField) CursorEnd ¶
func (tf *TextField) CursorEnd()
CursorEnd moves the cursor to the end of the text
func (*TextField) CursorForward ¶
CursorForward moves the cursor forward
func (*TextField) CursorKill ¶
func (tf *TextField) CursorKill()
CursorKill deletes text from cursor to end of text
func (*TextField) CursorSprite ¶
CursorSprite returns the Sprite for the cursor (which is only rendered once with a vertical bar, and just activated and inactivated depending on render status)
func (*TextField) CursorStart ¶
func (tf *TextField) CursorStart()
CursorStart moves the cursor to the start of the text, updating selection if select mode is active
func (*TextField) Cut ¶
func (tf *TextField) Cut()
Cut cuts any selected text and adds it to the clipboard
func (*TextField) DeleteSelection ¶
DeleteSelection deletes any selected text, without adding to clipboard -- returns text deleted
func (*TextField) Disconnect ¶ added in v0.9.8
func (tf *TextField) Disconnect()
func (*TextField) EditDeFocused ¶
func (tf *TextField) EditDeFocused()
EditDeFocused completes editing and copies the active edited text to the text -- called when field is made inactive due to interactions elsewhere.
func (*TextField) EditDone ¶
func (tf *TextField) 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 (*TextField) FocusChanged2D ¶
func (tf *TextField) FocusChanged2D(change FocusChanges)
func (*TextField) HandleMouseEvent ¶
HandleMouseEvent handles the mouse.Event
func (*TextField) HasSelection ¶
HasSelection returns whether there is a selected region of text
func (*TextField) InsertAtCursor ¶
InsertAtCursor inserts given text at current cursor position
func (*TextField) IsFocusActive ¶
IsFocusActive returns true if we have active focus for keyboard input
func (*TextField) IsWordBreak ¶
IsWordBreak defines what counts as a word break for the purposes of selecting words
func (*TextField) KeyChordEvent ¶
func (tf *TextField) KeyChordEvent()
func (*TextField) KeyInput ¶
func (tf *TextField) KeyInput(kt *key.ChordEvent)
KeyInput handles keyboard input into the text field and from the completion menu
func (*TextField) MakeContextMenu ¶
func (*TextField) MimeData ¶ added in v0.9.11
MimeData adds selection to mimedata. Satisfies Clipper interface -- can be extended in subtypes.
func (*TextField) MouseDragEvent ¶
func (tf *TextField) MouseDragEvent()
func (*TextField) MouseEvent ¶
func (tf *TextField) MouseEvent()
func (*TextField) MouseFocusEvent ¶
func (tf *TextField) MouseFocusEvent()
func (*TextField) OfferComplete ¶
OfferComplete pops up a menu of possible completions
func (*TextField) Paste ¶
func (tf *TextField) Paste()
Paste inserts text from the clipboard at current cursor position -- if cursor is within a current selection, that selection is replaced. Satisfies Clipper interface -- can be extended in subtypes.
func (*TextField) PixelToCursor ¶
PixelToCursor finds the cursor position that corresponds to the given pixel location
func (*TextField) RenderCursor ¶
RenderCursor renders the cursor on or off, as a sprite that is either on or off
func (*TextField) RenderSelect ¶
func (tf *TextField) RenderSelect()
RenderSelect renders the selected region, if any, underneath the text
func (*TextField) RenderTextField ¶ added in v1.0.5
func (tf *TextField) RenderTextField()
func (*TextField) Revert ¶
func (tf *TextField) Revert()
Revert aborts editing and reverts to last saved text
func (*TextField) ScrollLayoutToCursor ¶
ScrollLayoutToCursor scrolls any scrolling layout above us so that the cursor is in view
func (*TextField) SelectModeToggle ¶
func (tf *TextField) SelectModeToggle()
SelectModeToggle toggles the SelectMode, updating selection with cursor movement
func (*TextField) SelectRegUpdate ¶
SelectRegUpdate updates current select region based on given cursor position relative to SelectStart position
func (*TextField) SelectUpdate ¶
func (tf *TextField) SelectUpdate()
SelectUpdate updates the select region after any change to the text, to keep it in range
func (*TextField) SelectWord ¶
func (tf *TextField) SelectWord()
SelectWord selects the word (whitespace delimited) that the cursor is on
func (*TextField) SetCompleter ¶
func (tf *TextField) 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 (*TextField) SetCursorFromPixel ¶
func (tf *TextField) SetCursorFromPixel(pixOff float32, selMode mouse.SelectModes)
SetCursorFromPixel finds cursor location from pixel offset relative to WinBBox of text field, and sets current cursor to it, updating selection as well
func (*TextField) SetText ¶
SetText sets the text to be edited and reverts any current edit to reflect this new text
func (*TextField) StartCharPos ¶
StartCharPos returns the starting position of the given rune
func (*TextField) StartCursor ¶
func (tf *TextField) StartCursor()
StartCursor starts the cursor blinking and renders it
func (*TextField) StopCursor ¶
func (tf *TextField) StopCursor()
StopCursor stops the cursor from blinking
func (*TextField) StyleTextField ¶
func (tf *TextField) StyleTextField()
StyleTextField does text field styling -- sets StyMu Lock
func (*TextField) Text ¶
Text returns the current text -- applies any unapplied changes first, and sends a signal if so -- this is the end-user method to get the current value of the field.
func (*TextField) TextFieldEvents ¶
func (tf *TextField) TextFieldEvents()
func (*TextField) TextWidth ¶
TextWidth returns the text width in dots between the two text string positions (ed is exclusive -- +1 beyond actual char)
func (*TextField) UpdateRenderAll ¶
type TextFieldSignals ¶
type TextFieldSignals int64
TextFieldSignals are signals that that textfield can send
const ( // TextFieldDone is main signal -- return or tab was pressed and the edit was // intentionally completed. data is the text. TextFieldDone TextFieldSignals = iota // TextFieldDeFocused means that the user has transitioned focus away from // the text field due to interactions elsewhere, and any ongoing changes have been // applied and the editor is no longer active. data is the text. // If you have a button that performs the same action as pressing enter in a textfield, // then pressing that button will trigger a TextFieldDeFocused event, for any active // edits. Otherwise, you probably want to respond to both TextFieldDone and // TextFieldDeFocused as "apply" events that trigger actions associated with the field. TextFieldDeFocused // TextFieldSelected means that some text was selected (for Inactive state, // selection is via WidgetSig) TextFieldSelected // TextFieldCleared means the clear button was clicked TextFieldCleared // TextFieldInsert is emitted when a character is inserted into the textfield TextFieldInsert // TextFieldBackspace is emitted when a character before cursor is deleted TextFieldBackspace // TextFieldDelete is emitted when a character after cursor is deleted TextFieldDelete TextFieldSignalsN )
func (*TextFieldSignals) FromString ¶
func (i *TextFieldSignals) FromString(s string) error
func (TextFieldSignals) String ¶
func (i TextFieldSignals) String() string
type TextFieldStates ¶
type TextFieldStates int32
TextFieldStates are mutually-exclusive textfield states -- determines appearance
const ( // normal state -- there but not being interacted with TextFieldActive TextFieldStates = iota // textfield is the focus -- will respond to keyboard input TextFieldFocus // inactive -- not editable TextFieldInactive // selected -- for inactive state, can select entire element TextFieldSel TextFieldStatesN )
func (*TextFieldStates) FromString ¶
func (i *TextFieldStates) FromString(s string) error
func (TextFieldStates) String ¶
func (i TextFieldStates) String() string
type ToolBar ¶
type ToolBar struct {
Layout
}
ToolBar is a Layout (typically LayoutHoriz) that renders a gradient background and is useful for holding Actions that do things
func AddNewToolBar ¶ added in v0.9.7
AddNewToolBar adds a new toolbar to given parent node, with given name.
func (*ToolBar) AddAction ¶
AddAction adds an action to the toolbar using given options, and connects the action signal to given receiver object and function, along with given data which is stored on the action and then passed in the action signal. Optional updateFunc is a function called prior to showing the menu to update the actions (enabled or not typically).
func (*ToolBar) AddSeparator ¶ added in v0.9.7
AddSeparator adds a new separator to the toolbar -- automatically sets orientation depending on layout. All nodes need a name identifier.
func (*ToolBar) ConnectEvents2D ¶
func (tb *ToolBar) ConnectEvents2D()
func (*ToolBar) CopyFieldsFrom ¶ added in v0.9.8
func (tb *ToolBar) CopyFieldsFrom(frm interface{})
func (*ToolBar) DeleteShortcuts ¶ added in v0.9.14
func (tb *ToolBar) DeleteShortcuts()
DeleteShortcuts deletes the shortcuts -- called when destroyed
func (*ToolBar) FindActionByName ¶
FindActionByName finds an action on the toolbar, or any sub-menu, with given name (exact match) -- this is not the Text label but the Name of the element (for AddAction items, this is the same as Label or Icon (if Label is empty)) -- returns false if not found
func (*ToolBar) MouseFocusEvent ¶
func (tb *ToolBar) MouseFocusEvent()
func (*ToolBar) SetShortcuts ¶ added in v0.9.14
func (tb *ToolBar) SetShortcuts()
SetShortcuts sets the shortcuts to window associated with Toolbar Called in ConnectEvents2D()
func (*ToolBar) ToolBarStdRender ¶
func (tb *ToolBar) ToolBarStdRender()
ToolBarStdRender does the standard rendering of the bar
func (*ToolBar) UpdateActions ¶
func (tb *ToolBar) UpdateActions()
UpdateActions calls UpdateFunc on all actions in toolbar -- individual menus are automatically updated just prior to menu popup
type Transform3D ¶
type Transform3D struct { Transform mgl32.Mat4 // overall compiled transform Scale mgl32.Vec3 Translation mgl32.Vec3 Orientation mgl32.Quat }
3D transform
type Updater ¶ added in v0.9.8
type Updater interface { // Update updates anything in this type that might depend on other state // which could have just been changed. It is the responsibility of the // type to determine what might have changed, or just generically update // everything assuming anything could have changed. Update() }
Updater defines an interface for something that has an Update() method this will be called by GUI actions that update values of a type including struct, slice, and map views in giv
type User ¶
type User struct { user.User Email string `desc:"default email address -- e.g., for recording changes in a version control system"` }
User basic user information that might be needed for different apps
type ViewIFace ¶
type ViewIFace interface { // 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). CtxtMenuView(val interface{}, inactive bool, vp *Viewport2D, menu *Menu) bool // GoGiEditor opens an interactive editor of given Ki tree, at its root GoGiEditor(obj ki.Ki) // PrefsView opens an interactive view of given preferences object PrefsView(prefs *Preferences) // KeyMapsView opens an interactive view of KeyMaps object KeyMapsView(maps *KeyMaps) // PrefsDetView opens an interactive view of given detailed preferences object PrefsDetView(prefs *PrefsDetailed) // HiStylesView opens an interactive view of custom or std highlighting styles. HiStylesView(std bool) // SetHiStyleDefault sets the current default histyle.StyleDefault SetHiStyleDefault(hsty HiStyleName) // HiStyleInit initializes the histyle package -- called during overall gi init. HiStyleInit() // PrefsDetDefaults gets current detailed prefs values as defaults PrefsDetDefaults(prefs *PrefsDetailed) // PrefsDetApply applies detailed preferences within giv scope PrefsDetApply(prefs *PrefsDetailed) // PrefsDbgView opens an interactive view of given debugging preferences object PrefsDbgView(prefs *PrefsDebug) }
ViewIFace is an interface into the View GUI types in giv subpackage, allowing it to be a sub-package with just this narrow set of dependencies of gi on giv. The one impl is in giv/valueview.go.
var TheViewIFace ViewIFace
TheViewIFace is the implementation of the interface, defined in giv package
type Viewport ¶ added in v0.9.11
type Viewport interface { // VpTop returns the top-level Viewport, which could be this one // or a higher one. VpTopNode and VpEventMgr should be called on // on the Viewport returned by this method. For popups // this *not* the popup viewport but rather the window top viewport. VpTop() Viewport // VpTopNode returns the top node for this viewport. // must be called on VpTop() VpTopNode() Node // VpTopUpdateStart calls UpdateStart on VpTopNode2D(). Use this // for TopUpdateStart / End around multiple dispersed updates to // properly batch everything and prevent redundant updates. VpTopUpdateStart() bool // VpTopUpdateEnd calls UpdateEnd on VpTopNode2D(). Use this // for TopUpdateStart / End around multiple dispersed updates to // properly batch everything and prevent redundant updates. VpTopUpdateEnd(updt bool) // VpEventMgr returns the event manager for this viewport. // Must be called on VpTop(). Can be nil. VpEventMgr() *EventMgr // VpIsVisible returns true if this viewport is visible. // If false, rendering is aborted VpIsVisible() bool // VpUploadAll is the update call for the main viewport for a window -- // calls UploadAllViewports in parent window, which uploads the main viewport // and any active popups etc over the top of that VpUploadAll() // VpUploadVp uploads our viewport image into the parent window -- e.g., called // by popups when updating separately VpUploadVp() // VpUploadRegion uploads node region of our viewport image VpUploadRegion(vpBBox, winBBox image.Rectangle) }
Viewport provides an interface for viewports, supporting overall management functions that can be provided by more embedded viewports for example.
type Viewport2D ¶
type Viewport2D struct { WidgetBase Fill bool `desc:"fill the viewport with background-color from style"` Geom Geom2DInt `desc:"Viewport-level viewbox within any parent Viewport2D"` Render girl.State `copy:"-" json:"-" xml:"-" view:"-" desc:"render state for rendering"` Pixels *image.RGBA `copy:"-" json:"-" xml:"-" view:"-" desc:"live pixels that we render into"` Win *Window `copy:"-" json:"-" xml:"-" desc:"our parent window that we render into"` CurStyleNode Node2D `` /* 178-byte string literal not displayed */ CurColor gist.Color `` /* 224-byte string literal not displayed */ UpdtMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"UpdtMu is mutex for viewport updates"` UpdtStack []Node2D `copy:"-" json:"-" xml:"-" view:"-" desc:"stack of nodes requring basic updating"` ReStack []Node2D `copy:"-" json:"-" xml:"-" view:"-" desc:"stack of nodes requiring a ReRender (i.e., anchors)"` StackMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"StackMu is mutex for adding to UpdtStack"` StyleMu sync.RWMutex `copy:"-" json:"-" xml:"-" view:"-" desc:"StyleMu is RW mutex protecting access to Style-related global vars"` }
Viewport2D provides an image and a stack of Paint contexts for drawing onto the image with a convenience forwarding of the Paint methods operating on the current Paint
func NewViewport2D ¶
func NewViewport2D(width, height int) *Viewport2D
NewViewport2D creates a new Pixels Image with the specified width and height, and initializes the renderer etc
func PopupMenu ¶
func PopupMenu(menu Menu, x, y int, parVp *Viewport2D, name string) *Viewport2D
PopupMenu pops up a viewport with a layout that draws the supplied actions positions are relative to given viewport -- name is relevant base name to which Menu is appended
func PopupTooltip ¶
func PopupTooltip(tooltip string, x, y int, parVp *Viewport2D, name string) *Viewport2D
PopupTooltip pops up a viewport displaying the tooltip text
func StringsChooserPopup ¶
StringsChooserPopup creates a menu of the strings in the given string slice, and calls the given function on receiver when the user selects -- this is the ActionSig signal, coming from the Action for the given menu item -- the name of the Action is the string value, and the data will be the index in the slice. A string equal to curSel will be marked as selected. Location is from the ContextMenuPos of recv node.
func ValidViewport ¶
func ValidViewport(avp *Viewport2D) *Viewport2D
ValidViewport finds a non-nil viewport, either using the provided one, or using the first main window's viewport
func (*Viewport2D) AsViewport2D ¶
func (vp *Viewport2D) AsViewport2D() *Viewport2D
func (*Viewport2D) BBox2D ¶
func (vp *Viewport2D) BBox2D() image.Rectangle
func (*Viewport2D) BlockUpdates ¶ added in v0.9.8
func (vp *Viewport2D) BlockUpdates()
BlockUpdates uses the UpdtMu lock to block all updates to this viewport. This is *ONLY* needed when structural updates to the scenegraph are being made from a different goroutine outside of the one this window's event loop is running on. This prevents an update from happening in the middle of the construction process and thus attempting to render garbage. Must call UnblockUpdates after construction is done.
func (*Viewport2D) ChildrenBBox2D ¶
func (vp *Viewport2D) ChildrenBBox2D() image.Rectangle
func (*Viewport2D) ComputeBBox2D ¶
func (vp *Viewport2D) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*Viewport2D) ContextColor ¶ added in v1.1.0
func (vp *Viewport2D) ContextColor() gist.Color
ContextColor gets the current color in concurrent-safe way. Implements the gist.Context interface
func (*Viewport2D) ContextColorSpecByURL ¶ added in v1.1.0
func (vp *Viewport2D) ContextColorSpecByURL(url string) *gist.ColorSpec
ContextColorSpecByURL finds a Node by an element name (URL-like path), and attempts to convert it to a Gradient -- if successful, returns ColorSpec on that. Used for colorspec styling based on url() value.
func (*Viewport2D) CopyFieldsFrom ¶ added in v0.9.8
func (vp *Viewport2D) CopyFieldsFrom(frm interface{})
func (*Viewport2D) DeletePopup ¶
func (vp *Viewport2D) DeletePopup()
Delete this popup viewport -- has already been disconnected from window events and parent is nil -- called by window when a popup is deleted -- it destroys the vp and its main layout, see VpFlagPopupDestroyAll for whether children are destroyed
func (*Viewport2D) DrawIntoParent ¶
func (vp *Viewport2D) DrawIntoParent(parVp *Viewport2D)
DrawIntoParent draws our viewport image into parent's image -- this is the typical way that a sub-viewport renders (e.g., svg boxes, icons, etc -- not popups)
func (*Viewport2D) EncodePNG ¶
func (vp *Viewport2D) EncodePNG(w io.Writer) error
EncodePNG encodes the image as a PNG and writes it to the provided io.Writer.
func (*Viewport2D) FillViewport ¶
func (vp *Viewport2D) FillViewport()
func (*Viewport2D) FullReRenderIfNeeded ¶ added in v0.9.11
func (vp *Viewport2D) FullReRenderIfNeeded() bool
func (*Viewport2D) FullRender2DTree ¶
func (vp *Viewport2D) FullRender2DTree()
FullRender2DTree is called by window and other places to completely re-render -- we set our flag when doing this so valueview elements (and anyone else) can do a deep re-build that is typically not otherwise needed (e.g., after non-signaling structs have updated)
func (*Viewport2D) Init2D ¶
func (vp *Viewport2D) Init2D()
func (*Viewport2D) IsCompleter ¶
func (vp *Viewport2D) IsCompleter() bool
func (*Viewport2D) IsCorrector ¶
func (vp *Viewport2D) IsCorrector() bool
func (*Viewport2D) IsDoingFullRender ¶
func (vp *Viewport2D) IsDoingFullRender() bool
func (*Viewport2D) IsMenu ¶
func (vp *Viewport2D) IsMenu() bool
func (*Viewport2D) IsPopup ¶
func (vp *Viewport2D) IsPopup() bool
func (*Viewport2D) IsSVG ¶
func (vp *Viewport2D) IsSVG() bool
func (*Viewport2D) IsTooltip ¶
func (vp *Viewport2D) IsTooltip() bool
func (*Viewport2D) IsUpdatingNode ¶ added in v0.9.8
func (vp *Viewport2D) IsUpdatingNode() bool
func (*Viewport2D) IsVisible ¶
func (vp *Viewport2D) IsVisible() bool
func (*Viewport2D) Layout2D ¶
func (vp *Viewport2D) Layout2D(parBBox image.Rectangle, iter int) bool
func (*Viewport2D) Move2D ¶
func (vp *Viewport2D) Move2D(delta image.Point, parBBox image.Rectangle)
func (*Viewport2D) NeedsFullRender ¶ added in v0.9.8
func (vp *Viewport2D) NeedsFullRender() bool
func (*Viewport2D) NodeUpdated ¶ added in v0.9.8
func (vp *Viewport2D) NodeUpdated(nii Node2D, sig int64, data interface{})
NodeUpdated is called from SignalViewport2D when a valid node's NodeSig sent a signal usually after UpdateEnd.
func (*Viewport2D) PopBounds ¶
func (vp *Viewport2D) PopBounds()
func (*Viewport2D) PrefSize ¶ added in v0.9.15
func (vp *Viewport2D) PrefSize(initSz image.Point) image.Point
PrefSize computes the preferred size of the viewport based on current contents. initSz is the initial size -- e.g., size of screen. Used for auto-sizing windows.
func (*Viewport2D) PushBounds ¶
func (vp *Viewport2D) PushBounds() bool
we use our own render for these -- Viewport member is our parent!
func (*Viewport2D) ReRender2DAnchor ¶
func (vp *Viewport2D) ReRender2DAnchor(gni Node2D)
ReRender2DAnchor re-renders an anchor node -- the KEY diff from ReRender2DNode is that it calls ReRender2DTree and not just Render2DTree! uploads updated bits to the window texture using Window.UploadVpRegion call. This should be covered by an outer UpdateStart / End bracket on Window to drive publishing changes, with suitable grouping if multiple updates
func (*Viewport2D) ReRender2DNode ¶
func (vp *Viewport2D) ReRender2DNode(gni Node2D)
ReRender2DNode re-renders a specific node, including uploading updated bits to the window texture using Window.UploadVpRegion call. This should be covered by an outer UpdateStart / End bracket on Window to drive publishing changes, with suitable grouping if multiple updates
func (*Viewport2D) Render2D ¶
func (vp *Viewport2D) Render2D()
func (*Viewport2D) RenderViewport2D ¶
func (vp *Viewport2D) RenderViewport2D()
RenderViewport2D is the render action for the viewport itself -- either uploads image to window or draws into parent viewport
func (*Viewport2D) Resize ¶
func (vp *Viewport2D) Resize(nwsz image.Point)
Resize resizes the viewport, creating a new image -- updates Geom Size
func (*Viewport2D) SavePNG ¶
func (vp *Viewport2D) SavePNG(path string) error
SavePNG encodes the image as a PNG and writes it to disk.
func (*Viewport2D) SetCurStyleNode ¶
func (vp *Viewport2D) SetCurStyleNode(node Node2D)
SetCurStyleNode sets the current styling node to given node, and nil to clear
func (*Viewport2D) SetCurWin ¶
func (vp *Viewport2D) SetCurWin()
set our window pointer to point to the current window we are under
func (*Viewport2D) SetCurrentColor ¶
func (vp *Viewport2D) SetCurrentColor(clr gist.Color)
SetCurrentColor sets the current color in concurrent-safe way
func (*Viewport2D) SetNeedsFullRender ¶ added in v0.9.8
func (vp *Viewport2D) SetNeedsFullRender()
SetNeedsFullRender sets the flag indicating that a full render of the viewport is needed it will do this immediately pending acquisition of the lock and through the standard updating channels, unless already updating.
func (*Viewport2D) Size2D ¶
func (vp *Viewport2D) Size2D(iter int)
func (*Viewport2D) Style2D ¶
func (vp *Viewport2D) Style2D()
func (*Viewport2D) UnblockUpdates ¶ added in v0.9.8
func (vp *Viewport2D) UnblockUpdates()
UnblockUpdates unblocks updating of this viewport -- see BlockUpdates()
func (*Viewport2D) UpdateLevel ¶ added in v0.9.8
func (vp *Viewport2D) UpdateLevel(nii Node2D, sig int64, data interface{}) (anchor Node2D, full bool)
UpdateLevel deteremines what level of updating a node requires
func (*Viewport2D) UpdateNode ¶ added in v0.9.8
func (vp *Viewport2D) UpdateNode(nii Node2D)
UpdateNode is called under UpdtMu lock and does the actual steps to update a given node
func (*Viewport2D) UpdateNodes ¶ added in v0.9.8
func (vp *Viewport2D) UpdateNodes()
UpdateNodes processes the current update signals and actually does the relevant updating
func (*Viewport2D) VpEventMgr ¶ added in v0.9.11
func (vp *Viewport2D) VpEventMgr() *EventMgr
func (*Viewport2D) VpIsVisible ¶ added in v0.9.11
func (vp *Viewport2D) VpIsVisible() bool
func (*Viewport2D) VpTop ¶ added in v0.9.11
func (vp *Viewport2D) VpTop() Viewport
func (*Viewport2D) VpTopNode ¶ added in v0.9.11
func (vp *Viewport2D) VpTopNode() Node
func (*Viewport2D) VpTopUpdateEnd ¶ added in v0.9.11
func (vp *Viewport2D) VpTopUpdateEnd(updt bool)
func (*Viewport2D) VpTopUpdateStart ¶ added in v0.9.11
func (vp *Viewport2D) VpTopUpdateStart() bool
func (*Viewport2D) VpUploadAll ¶ added in v0.9.11
func (vp *Viewport2D) VpUploadAll()
VpUploadAll is the update call for the main viewport for a window -- calls UploadAllViewports in parent window, which uploads the main viewport and any active popups etc over the top of that
func (*Viewport2D) VpUploadRegion ¶ added in v0.9.11
func (vp *Viewport2D) VpUploadRegion(vpBBox, winBBox image.Rectangle)
VpUploadRegion uploads node region of our viewport image
func (*Viewport2D) VpUploadVp ¶ added in v0.9.11
func (vp *Viewport2D) VpUploadVp()
VpUploadVp uploads our viewport image into the parent window -- e.g., called by popups when updating separately
type VpFlags ¶ added in v0.9.9
type VpFlags int
VpFlags extend NodeBase NodeFlags to hold viewport state
const ( // VpFlagPopup means viewport is a popup (menu or dialog) -- does not obey // parent bounds (otherwise does) VpFlagPopup VpFlags = VpFlags(NodeFlagsN) + iota // VpFlagMenu means viewport is serving as a popup menu -- affects how window // processes clicks VpFlagMenu // VpFlagCompleter means viewport is serving as a popup menu for code completion -- // only applies if the VpFlagMenu is also set VpFlagCompleter // VpFlagCorrector means viewport is serving as a popup menu for spelling correction -- // only applies if the VpFlagMenu is also set VpFlagCorrector // VpFlagTooltip means viewport is serving as a tooltip VpFlagTooltip // VpFlagPopupDestroyAll means that if this is a popup, then destroy all // the children when it is deleted -- otherwise children below the main // layout under the vp will not be destroyed -- it is up to the caller to // manage those (typically these are reusable assets) VpFlagPopupDestroyAll // VpFlagSVG means that this viewport is an SVG viewport -- SVG elements // look for this for re-rendering VpFlagSVG // VpFlagUpdatingNode means that this viewport is currently handling the // update of a node, and is under the UpdtMu mutex lock. // This can be checked to see about whether to add another update or not. VpFlagUpdatingNode // VpFlagNeedsFullRender means that this viewport needs to do a full // render -- this is set during signal processing and will preempt // other lower-level updates etc. VpFlagNeedsFullRender // VpFlagDoingFullRender means that this viewport is currently doing a // full render -- can be used by elements to drive deep rebuild in case // underlying data has changed. VpFlagDoingFullRender // VpFlagPrefSizing means that this viewport is currently doing a // PrefSize computation to compute the size of the viewport // (for sizing window for example) -- affects layout size computation // only for Over VpFlagPrefSizing VpFlagsN )
func StringToVpFlags ¶ added in v0.9.9
type WidgetBase ¶
type WidgetBase struct { Node2DBase Tooltip string `desc:"text for tooltip for this widget -- can use HTML formatting"` Sty gist.Style `` /* 139-byte string literal not displayed */ DefStyle *gist.Style `` /* 216-byte string literal not displayed */ LayState LayoutState `copy:"-" json:"-" xml:"-" desc:"all the layout state information for this item"` WidgetSig ki.Signal `` /* 215-byte string literal not displayed */ CtxtMenuFunc CtxtMenuFunc `` /* 233-byte string literal not displayed */ StyMu sync.RWMutex `copy:"-" view:"-" json:"-" xml:"-" desc:"mutex protecting updates to the style"` }
WidgetBase is the base type for all Widget Node2D elements, which are managed by a containing Layout, and use all 5 rendering passes. All elemental widgets must support the Node Inactive and Selected states in a reasonable way (Selected only essential when also Inactive), so they can function appropriately in a chooser (e.g., SliceView or TableView) -- this includes toggling selection on left mouse press.
func (*WidgetBase) AddParentPos ¶
func (wb *WidgetBase) AddParentPos() mat32.Vec2
AddParentPos adds the position of our parent to our layout position -- layout computations are all relative to parent position, so they are finally cached out at this stage also returns the size of the parent for setting units context relative to parent objects
func (*WidgetBase) AsWidget ¶
func (wb *WidgetBase) AsWidget() *WidgetBase
func (*WidgetBase) BBox2D ¶
func (wb *WidgetBase) BBox2D() image.Rectangle
func (*WidgetBase) BBoxFromAlloc ¶
func (wb *WidgetBase) BBoxFromAlloc() image.Rectangle
BBoxFromAlloc gets our bbox from Layout allocation.
func (*WidgetBase) BoxSpace ¶ added in v1.0.5
func (wb *WidgetBase) BoxSpace() float32
BoxSpace returns the style BoxSpace value under read lock
func (*WidgetBase) ChildrenBBox2D ¶
func (wb *WidgetBase) ChildrenBBox2D() image.Rectangle
func (*WidgetBase) ChildrenBBox2DWidget ¶
func (wb *WidgetBase) ChildrenBBox2DWidget() image.Rectangle
ChildrenBBox2DWidget provides a basic widget box-model subtraction of margin and padding to children -- call in ChildrenBBox2D for most widgets
func (*WidgetBase) ComputeBBox2D ¶
func (wb *WidgetBase) ComputeBBox2D(parBBox image.Rectangle, delta image.Point)
func (*WidgetBase) CopyFieldsFrom ¶ added in v0.9.8
func (wb *WidgetBase) CopyFieldsFrom(frm interface{})
func (*WidgetBase) Disconnect ¶ added in v0.9.8
func (wb *WidgetBase) Disconnect()
func (*WidgetBase) EmitContextMenuSignal ¶
func (wb *WidgetBase) EmitContextMenuSignal()
EmitContextMenuSignal emits the WidgetContextMenu signal for this widget
func (*WidgetBase) EmitFocusedSignal ¶
func (wb *WidgetBase) EmitFocusedSignal()
EmitFocusedSignal emits the WidgetFocused signal for this widget
func (*WidgetBase) EmitSelectedSignal ¶
func (wb *WidgetBase) EmitSelectedSignal()
EmitSelectedSignal emits the WidgetSelected signal for this widget
func (*WidgetBase) FullReRenderIfNeeded ¶
func (wb *WidgetBase) FullReRenderIfNeeded() bool
FullReRenderIfNeeded tests if the FullReRender flag has been set, and if so, calls ReRender2DTree and returns true -- call this at start of each Render2D
func (*WidgetBase) HoverTooltipEvent ¶
func (wb *WidgetBase) HoverTooltipEvent()
HoverTooltipEvent connects to HoverEvent and pops up a tooltip -- most widgets should call this as part of their event connection method
func (*WidgetBase) Init2D ¶
func (wb *WidgetBase) Init2D()
func (*WidgetBase) Init2DWidget ¶
func (wb *WidgetBase) Init2DWidget()
Init2DWidget handles basic node initialization -- Init2D can then do special things
func (*WidgetBase) InitLayout2D ¶
func (wb *WidgetBase) InitLayout2D() bool
func (*WidgetBase) Layout2D ¶
func (wb *WidgetBase) Layout2D(parBBox image.Rectangle, iter int) bool
func (*WidgetBase) Layout2DBase ¶
func (wb *WidgetBase) Layout2DBase(parBBox image.Rectangle, initStyle bool, iter int)
Layout2DBase provides basic Layout2D functions -- good for most cases
func (*WidgetBase) MakeContextMenu ¶
func (wb *WidgetBase) MakeContextMenu(m *Menu)
func (*WidgetBase) Move2D ¶
func (wb *WidgetBase) Move2D(delta image.Point, parBBox image.Rectangle)
func (*WidgetBase) Move2DBase ¶
func (wb *WidgetBase) Move2DBase(delta image.Point, parBBox image.Rectangle)
Move2DBase does the basic move on this node
func (*WidgetBase) Move2DTree ¶
func (wb *WidgetBase) Move2DTree()
Move2DTree does move2d pass -- each node iterates over children for maximum control -- this starts with parent ChildrenBBox and current delta -- can be called de novo
func (*WidgetBase) ParentLayout ¶
func (wb *WidgetBase) ParentLayout() *Layout
ParentLayout returns the parent layout
func (*WidgetBase) PopBounds ¶
func (wb *WidgetBase) PopBounds()
PopBounds pops our bounding-box bounds -- last step in Render2D after rendering children
func (*WidgetBase) PushBounds ¶
func (wb *WidgetBase) PushBounds() bool
PushBounds pushes our bounding-box bounds onto the bounds stack if non-empty -- this limits our drawing to our own bounding box, automatically -- must be called as first step in Render2D returns whether the new bounds are empty or not -- if empty then don't render!
func (*WidgetBase) ReRender2DTree ¶
func (wb *WidgetBase) ReRender2DTree()
ReRender2DTree does a re-render of the tree -- after it has already been initialized and styled -- redoes the full stack
func (*WidgetBase) Render2D ¶
func (wb *WidgetBase) Render2D()
func (*WidgetBase) RenderBoxImpl ¶
RenderBoxImpl implements the standard box model rendering -- assumes all paint params have already been set
func (*WidgetBase) RenderLock ¶ added in v1.0.5
RenderLock returns the locked girl.State, Paint, and Style with StyMu locked. This should be called at start of widget-level rendering.
func (*WidgetBase) RenderStdBox ¶
func (wb *WidgetBase) RenderStdBox(st *gist.Style)
RenderStdBox draws standard box using given style. girl.State and Style must already be locked at this point (RenderLock)
func (*WidgetBase) RenderUnlock ¶ added in v1.0.5
func (wb *WidgetBase) RenderUnlock(rs *girl.State)
RenderUnlock unlocks girl.State and style
func (*WidgetBase) Size2D ¶
func (wb *WidgetBase) Size2D(iter int)
func (*WidgetBase) Size2DAddSpace ¶
func (wb *WidgetBase) Size2DAddSpace()
Size2DAddSpace adds space to existing AllocSize
func (*WidgetBase) Size2DBase ¶
func (wb *WidgetBase) Size2DBase(iter int)
func (*WidgetBase) Size2DFromWH ¶
func (wb *WidgetBase) Size2DFromWH(w, h float32)
set our LayState.Alloc.Size from constraints
func (*WidgetBase) Size2DSubSpace ¶
func (wb *WidgetBase) Size2DSubSpace() mat32.Vec2
Size2DSubSpace returns AllocSize minus 2 * BoxSpace -- the amount avail to the internal elements
func (*WidgetBase) Style ¶
func (wb *WidgetBase) Style() *gist.Style
Style satisfies the Styler interface
func (*WidgetBase) Style2D ¶
func (wb *WidgetBase) Style2D()
func (*WidgetBase) Style2DWidget ¶
func (wb *WidgetBase) Style2DWidget()
Style2DWidget styles the Style values from node properties and optional base-level defaults -- for Widget-style nodes. must be called under a StyMu Lock
func (*WidgetBase) StylePart ¶
func (wb *WidgetBase) StylePart(pk Node2D)
StylePart sets the style properties for a child in parts (or any other child) based on its name -- only call this when new parts were created -- name of properties is #partname (lower cased) and it should contain a ki.Props which is then added to the part's props -- this provides built-in defaults for parts, so it is separate from the CSS process
func (*WidgetBase) StyleRLock ¶ added in v1.0.5
func (wb *WidgetBase) StyleRLock()
StyleRLock does a read-lock for reading the style
func (*WidgetBase) StyleRUnlock ¶ added in v1.0.5
func (wb *WidgetBase) StyleRUnlock()
StyleRUnlock unlocks the read-lock
func (*WidgetBase) WidgetMouseEvents ¶
func (wb *WidgetBase) WidgetMouseEvents(sel, ctxtMenu bool)
WidgetMouseEvents connects to either or both mouse events -- IMPORTANT: if you need to also connect to other mouse events, you must copy this code -- all processing of a mouse event must happen within one function b/c there can only be one registered per receiver and event type. sel = Left button mouse.Press event, toggles the selected state, and emits a SelectedEvent. ctxtMenu = connects to Right button mouse.Press event, and sends a WidgetSig WidgetContextMenu signal, followed by calling ContextMenu method -- signal can be used to change state prior to generating context menu, including setting a CtxtMenuFunc that removes all items and thus negates the presentation of any menu
type WidgetSignals ¶
type WidgetSignals int64
WidgetSignals are general signals that all widgets can send, via WidgetSig signal
const ( // WidgetSelected is triggered when a widget is selected, typically via // left mouse button click (see EmitSelectedSignal) -- is NOT contingent // on actual IsSelected status -- just reports the click event. // The data is the index of the selected item for multi-item widgets // (-1 = none / unselected) WidgetSelected WidgetSignals = iota // WidgetFocused is triggered when a widget receives keyboard focus (see // EmitFocusedSignal -- call in FocusChanged2D for gotFocus WidgetFocused // WidgetContextMenu is triggered when a widget receives a // right-mouse-button press, BEFORE generating and displaying the context // menu, so that relevant state can be updated etc (see // EmitContextMenuSignal) WidgetContextMenu WidgetSignalsN )
func (*WidgetSignals) FromString ¶
func (i *WidgetSignals) FromString(s string) error
func (WidgetSignals) String ¶
func (i WidgetSignals) String() string
type WinEventRecv ¶
WinEventRecv is used to hold info about widgets receiving event signals to given function, used for sorting and delayed sending.
type WinFlags ¶ added in v0.9.9
type WinFlags int
WinFlags extend NodeBase NodeFlags to hold Window state
const ( // WinFlagHasGeomPrefs indicates if this window has WinGeomPrefs setting that // sized it -- affects whether other default geom should be applied. WinFlagHasGeomPrefs WinFlags = WinFlags(NodeFlagsN) + iota // WinFlagUpdating is atomic flag around global updating -- routines can check IsWinUpdating and bail WinFlagUpdating // WinFlagIsClosing is atomic flag indicating window is closing WinFlagIsClosing // WinFlagIsResizing is atomic flag indicating window is resizing WinFlagIsResizing // WinFlagGotPaint have we received our first paint event yet? // ignore other window events before this point WinFlagGotPaint // WinFlagGotFocus indicates that have we received OSWin focus WinFlagGotFocus // WinFlagSentShow have we sent the show event yet? Only ever sent ONCE WinFlagSentShow // WinFlagGoLoop true if we are running from GoStartEventLoop -- requires a WinWait.Done at end WinFlagGoLoop // WinFlagStopEventLoop is set when event loop stop is requested WinFlagStopEventLoop // WinFlagDoFullRender is set at event loop startup to trigger a full render once the window // is properly shown WinFlagDoFullRender // WinFlagFocusActive indicates if widget focus is currently in an active state or not WinFlagFocusActive WinFlagsN )
func StringToWinFlags ¶ added in v0.9.9
type Window ¶
type Window struct { NodeBase Title string `` /* 143-byte string literal not displayed */ Data interface{} `` /* 188-byte string literal not displayed */ OSWin oswin.Window `` /* 126-byte string literal not displayed */ EventMgr EventMgr `json:"-" xml:"-" desc:"event manager that handles dispersing events to nodes"` Viewport *Viewport2D `json:"-" xml:"-" desc:"convenience pointer to window's master viewport child that handles the rendering"` MasterVLay *Layout `` /* 126-byte string literal not displayed */ MainMenu *MenuBar `` /* 144-byte string literal not displayed */ Sprites Sprites `json:"-" xml:"-" desc:"sprites are named images that are rendered last overlaying everything else."` SpriteDragging string `json:"-" xml:"-" desc:"name of sprite that is being dragged -- sprite event function is responsible for setting this."` UpMu sync.Mutex `json:"-" xml:"-" view:"-" desc:"mutex that protects all updating / uploading of Textures"` Shortcuts Shortcuts `` /* 165-byte string literal not displayed */ Popup ki.Ki `json:"-" xml:"-" desc:"Current popup viewport that gets all events"` PopupStack []ki.Ki `json:"-" xml:"-" desc:"stack of popups"` NextPopup ki.Ki `json:"-" xml:"-" desc:"this popup will be pushed at the end of the current event cycle -- use SetNextPopup"` PopupFocus ki.Ki `json:"-" xml:"-" desc:"node to focus on when next popup is activated -- use SetNextPopup"` DelPopup ki.Ki `json:"-" xml:"-" desc:"this popup will be popped at the end of the current event cycle -- use SetDelPopup"` PopMu sync.RWMutex `json:"-" xml:"-" view:"-" desc:"read-write mutex that protects popup updating and access"` DirDraws WindowDrawers `desc:"dir draws are direct upload regions -- direct uploaders upload their images directly to an image here"` PopDraws WindowDrawers // popup regions UpdtRegs WindowUpdates // misc vp update regions Phongs []*vphong.Phong `view:"-" json:"-" xml:"-" desc:"this popup will be popped at the end of the current event cycle -- use SetDelPopup"` Frames []*vgpu.RenderFrame `view:"-" json:"-" xml:"-" desc:"this popup will be popped at the end of the current event cycle -- use SetDelPopup"` // contains filtered or unexported fields }
Window provides an OS-specific window and all the associated event handling. Widgets connect to event signals to receive relevant GUI events. There is a master Viewport that contains the full bitmap image of the window, onto which most widgets render. For main windows (not dialogs or other popups), there is a master vertical layout under the Viewport (MasterVLay), whose first element is the MainMenu for the window (which can be empty, in which case it is not displayed). On MacOS, this main menu updates the overall menubar, and also can show the local menu (on by default).
Widgets should always use methods to access / set state, and generally should not do much directly with the window. Almost everything here needs to be guarded by various mutexes. Leaving everything accessible so expert outside access is still possible in a pinch, but again don't use it unless you know what you're doing (and it might change over time too..)
Rendering logic:
- vdraw.Drawer manages all rendering to the window surface, provided via the OSWin window, using vulkan stored images (16 max)
- Order is: Base Viewport2D (image 0), then direct uploads, popups, and sprites.
- DirectUps (e.g., gi3d.Scene) directly upload their own texture to a Draw image (note: cannot upload directly to window as this prevents popups and overlays)
- Popups (which have their own Viewports)
- Sprites are managed as layered textures of the same size, to enable unlimited number packed into a few descriptors for standard sizes.
func NewDialogWin ¶
NewDialogWin creates a new dialog window with given internal handle name, display name, and sizing (assumed to be in raw dots), without setting its main viewport -- user should do win.AddChild(vp); win.Viewport = vp to set their own viewport.
func NewMainWindow ¶ added in v0.9.10
NewMainWindow creates a new standard main window with given internal handle name, display name, and sizing, with default positioning, and initializes a viewport within it. The width and height are in standardized "pixel" units (96 per inch), not the actual underlying raw display dot pixels
func NewWindow ¶
func NewWindow(name, title string, opts *oswin.NewWindowOptions) *Window
NewWindow creates a new window with given internal name handle, display name, and options.
func RecycleDialogWin ¶ added in v0.9.10
func RecycleDialogWin(data interface{}, name, title string, width, height int, modal bool) (*Window, bool)
RecycleDialogWin looks for existing window with same Data -- if found brings that to the front, returns true for bool. else (and if data is nil) calls NewDialogWin, and returns false.
func RecycleMainWindow ¶ added in v0.9.10
RecycleMainWindow looks for existing window with same Data -- if found brings that to the front, returns true for bool. else (and if data is nil) calls NewDialogWin, and returns false.
func WindowInFocus ¶ added in v0.9.11
func WindowInFocus() *Window
WindowInFocus returns the window in focus according to oswin. There is a small chance it could be nil.
func (*Window) ActivateSprite ¶
ActivateSprite flags the sprite as active, and increments number of Active Sprites, so that it will actually be rendered. it is assumed that the image has not changed.
func (*Window) AddDirectUploader ¶ added in v0.9.8
AddDirectUploader adds given node to those that have a DirectWinUpload method and directly render to the Drawer Texture via their own method. This is for gi3d.Scene for example. Returns the index of the image to upload to.
func (*Window) AddMainMenu ¶
AddMainMenu installs MainMenu as first element of main layout used for dialogs that don't always have a main menu -- returns menubar -- safe to call even if there is a menubar
func (*Window) AddShortcut ¶
AddShortcut adds given shortcut to given action.
func (*Window) AddSprite ¶
AddSprite adds an existing sprite to list of sprites, using the sprite.Name as the unique name key.
func (*Window) BenchmarkFullRender ¶
func (w *Window) BenchmarkFullRender()
BenchmarkFullRender runs benchmark of 50 full re-renders (full restyling, layout, and everything), reporting targeted profile results and generating standard Go cpu.prof and mem.prof outputs.
func (*Window) BenchmarkReRender ¶
func (w *Window) BenchmarkReRender()
BenchmarkReRender runs benchmark of 50 re-render-only updates of display (just the raw rendering, no styling or layout), reporting targeted profile results and generating standard Go cpu.prof and mem.prof outputs.
func (*Window) ClearDragNDrop ¶
func (w *Window) ClearDragNDrop()
ClearDragNDrop clears any existing DND values.
func (*Window) ClearWinUpdating ¶
func (w *Window) ClearWinUpdating()
ClearWinUpdating sets the window updating state to false if not already updating
func (*Window) Close ¶
func (w *Window) Close()
Close closes the window -- this is not a request -- it means: definitely close it -- flags window as such -- check IsClosing()
func (*Window) ClosePopup ¶
ClosePopup close given popup -- must be the current one -- returns false if not.
func (*Window) CloseReq ¶
func (w *Window) CloseReq()
CloseReq requests that the window be closed -- could be rejected
func (*Window) Closed ¶
func (w *Window) Closed()
Closed frees any resources after the window has been closed.
func (*Window) ConfigSprites ¶ added in v1.3.0
func (w *Window) ConfigSprites()
ConfigSprites updates the Drawer configuration of sprites. Does a new SzAlloc, and sets corresponding images.
func (*Window) ConfigVLay ¶
func (w *Window) ConfigVLay()
ConfigVLay creates and configures the vertical layout as first child of Viewport, and installs MainMenu as first element of layout.
func (*Window) CurPopupIsTooltip ¶
CurPopupIsTooltip returns true if current popup is a tooltip
func (*Window) DNDClearCursor ¶
func (w *Window) DNDClearCursor()
DNDClearCursor clears any existing DND cursor that might have been set.
func (*Window) DNDDropEvent ¶
DNDDropEvent handles drag-n-drop drop event (action = release).
func (*Window) DNDMoveEvent ¶
DNDMoveEvent handles drag-n-drop move events.
func (*Window) DNDNotCursor ¶
func (w *Window) DNDNotCursor()
DNDNotCursor sets the cursor to Not = can't accept a drop
func (*Window) DNDSetCursor ¶
DNDSetCursor sets the cursor based on the DND event mod -- does a "PushIfNot" so safe for multiple calls.
func (*Window) DNDUpdateCursor ¶
DNDUpdateCursor updates the cursor based on the current DND event mod if different from current (but no update if Not)
func (*Window) DeleteDirectUploader ¶ added in v0.9.8
DeleteDirectUploader removes given node to those that have a DirectWinUpload method.
func (*Window) DeleteShortcut ¶ added in v0.9.14
DeleteShortcut deletes given shortcut
func (*Window) DeleteSprite ¶ added in v0.9.8
DeleteSprite deletes given sprite, returns true if actually deleted. requires updating other sprites of same size -- use Inactivate if any chance of re-use.
func (*Window) DeleteTooltip ¶ added in v0.9.11
func (w *Window) DeleteTooltip()
DeleteTooltip deletes any tooltip popup (called when hover ends)
func (*Window) DisconnectPopup ¶
DisconnectPopup disconnects given popup -- typically the current one.
func (*Window) DrawSprites ¶ added in v1.3.0
func (w *Window) DrawSprites()
DrawSprites draws sprites
func (*Window) EventLoop ¶
func (w *Window) EventLoop()
EventLoop runs the event processing loop for the Window -- grabs oswin events for the window and dispatches them to receiving nodes, and manages other state etc (popups, etc).
func (*Window) EventTopNode ¶ added in v0.9.11
func (*Window) EventTopUpdateEnd ¶ added in v0.9.11
func (*Window) EventTopUpdateStart ¶ added in v0.9.11
func (*Window) FilterEvent ¶ added in v0.9.9
FilterEvent filters repeated laggy events -- key for responsive resize, scroll, etc returns false if event should not be processed further, and true if it should.
func (*Window) FinalizeDragNDrop ¶
FinalizeDragNDrop is called by a node to finalize the drag-n-drop operation, after given action has been performed on the target -- allows target to cancel, by sending dnd.DropIgnore.
func (*Window) FocusActiveClick ¶
FocusActiveClick updates the FocusActive status based on mouse clicks in or out of the focused item
func (*Window) FocusInactivate ¶
func (w *Window) FocusInactivate()
FocusInactivate inactivates the current focus element
func (*Window) FocusTopNode ¶ added in v0.9.11
func (*Window) FullReRender ¶
func (w *Window) FullReRender()
FullReRender performs a full re-render of the window -- each node renders into its viewport, aggregating into the main window viewport, which will drive an UploadAllViewports call after all the rendering is done, and signal the publishing of the window after that
func (*Window) GoStartEventLoop ¶
func (w *Window) GoStartEventLoop()
GoStartEventLoop starts the event processing loop for this window in a new goroutine, and returns immediately. Adds to WinWait waitgroup so a main thread can wait on that for all windows to close.
func (*Window) HasGeomPrefs ¶
HasGeomPrefs returns true if geometry prefs were set already
func (*Window) HiPriorityEvents ¶ added in v0.9.9
HiProrityEvents processes High-priority events for Window. Window gets first crack at these events, and handles window-specific ones returns true if processing should continue and false if was handled
func (*Window) InactivateAllSprites ¶
func (w *Window) InactivateAllSprites()
InactivateAllSprites inactivates all sprites
func (*Window) InactivateSprite ¶
InactivateSprite flags the sprite as inactive, and decrements number of Active Sprites, so that it will not be rendered.
func (*Window) InitialFocus ¶ added in v0.9.8
func (w *Window) InitialFocus()
InitialFocus establishes the initial focus for the window if no focus is set -- uses ActivateStartFocus or FocusNext as backup.
func (*Window) IsClosing ¶
IsClosing returns true if window has requested to close -- don't attempt to update it any further
func (*Window) IsFocusActive ¶ added in v0.9.11
IsFocusActive returns true if window has focus active flag set
func (*Window) IsInScope ¶
IsInScope returns true if the given object is in scope for receiving events. If popup is true, then only items on popup are in scope, otherwise items NOT on popup are in scope (if no popup, everything is in scope).
func (*Window) IsResizing ¶
IsResizing means the window is actively being resized by user -- don't try to update otherwise
func (*Window) IsVisible ¶
IsVisible is the main visibility check -- don't do any window updates if not visible!
func (*Window) IsWinUpdating ¶
IsWinUpdating checks if we are already updating window
func (*Window) IsWindowInFocus ¶
IsWindowInFocus returns true if this window is the one currently in focus
func (*Window) KeyChordEventHiPri ¶
func (w *Window) KeyChordEventHiPri(e *key.ChordEvent) bool
KeyChordEventHiPri handles all the high-priority window-specific key events, returning its input on whether any existing popup should be deleted
func (*Window) KeyChordEventLowPri ¶
func (w *Window) KeyChordEventLowPri(e *key.ChordEvent) bool
KeyChordEventLowPri handles all the lower-priority window-specific key events, returning its input on whether any existing popup should be deleted
func (*Window) LogicalDPI ¶
LogicalDPI returns the current logical dots-per-inch resolution of the window, which should be used for most conversion of standard units -- physical DPI can be found in the Screen
func (*Window) MainFrame ¶ added in v0.9.10
MainFrame returns the main widget for this window as a Frame returns error if not there, or not a frame.
func (*Window) MainMenuSet ¶
func (w *Window) MainMenuSet()
MainMenuSet sets the main menu for the window, after window.Focus event
func (*Window) MainMenuUpdateActives ¶
func (w *Window) MainMenuUpdateActives()
MainMenuUpdateActives needs to be called whenever items on the main menu for this window have their IsActive status updated.
func (*Window) MainMenuUpdateWindows ¶
func (w *Window) MainMenuUpdateWindows()
MainMenuUpdateWindows updates a Window menu with a list of active menus.
func (*Window) MainMenuUpdated ¶
func (w *Window) MainMenuUpdated()
MainMenuUpdated needs to be called whenever the main menu for this window is updated in terms of items added or removed.
func (*Window) MainWidget ¶
MainWidget returns the main widget for this window -- 2nd element in MasterVLay -- returns error if not yet set.
func (*Window) Minimize ¶ added in v1.0.16
func (w *Window) Minimize()
Minimize requests that the window be iconified, making it no longer visible or active -- rendering should not occur for minimized windows.
func (*Window) NeedWinMenuUpdate ¶
NeedWinMenuUpdate returns true if our lastWinMenuUpdate is != WinNewCloseTime
func (*Window) PollEvents ¶ added in v0.9.9
func (w *Window) PollEvents()
PollEvents first tells the main event loop to check for any gui events now and then it runs the event processing loop for the Window as long as there are events to be processed, and then returns.
func (*Window) PopPopup ¶
PopPopup pops current popup off the popup stack and set to current popup. returns true if was actually popped. MUST be called within PopMu.Lock scope!
func (*Window) ProcessEvent ¶ added in v0.9.9
ProcessEvent processes given oswin.Event
func (*Window) Publish ¶
func (w *Window) Publish()
Publish does the final step of updating of the window based on the current texture (and overlay texture if active)
func (*Window) Raise ¶ added in v1.0.16
func (w *Window) Raise()
Raise requests that the window be at the top of the stack of windows, and receive focus. If it is iconified, it will be de-iconified. This is the only supported mechanism for de-iconifying.
func (*Window) ReportWinNodes ¶
func (w *Window) ReportWinNodes()
ReportWinNodes reports the number of nodes in this window
func (*Window) ResetUpdateRegions ¶ added in v1.3.0
func (w *Window) ResetUpdateRegions()
ResetUpdateRegions resets any existing window update regions and grabs the current state of the window viewport for subsequent rendering. This is protected by update mutex and suitable for random calls eg., when a window is scrolling and positions are then invalid.
func (*Window) ResetUpdateRegionsImpl ¶ added in v1.3.0
func (w *Window) ResetUpdateRegionsImpl()
ResetUpdateRegionsImpl resets any existing window update regions and grabs the current state of the window and popup viewports for subsequent rendering.
func (*Window) SelSpriteEvent ¶ added in v1.2.3
SpriteEvent processes given event for any active sprites
func (*Window) SendCustomEvent ¶
func (w *Window) SendCustomEvent(data interface{})
SendCustomEvent sends a custom event with given data to this window -- widgets can connect to receive CustomEventType events to receive them. Sometimes it is useful to send a custom event just to trigger a pass through the event loop, even if nobody is listening (e.g., if a popup is posted without a surrounding event, as in Complete.ShowCompletions
func (*Window) SendShowEvent ¶
func (w *Window) SendShowEvent()
SendShowEvent sends the WindowShowEvent to anyone listening -- only sent once..
func (*Window) SendWinFocusEvent ¶
SendWinFocusEvent sends the WindowFocusEvent to widgets
func (*Window) SetCloseCleanFunc ¶ added in v0.9.7
SetCloseCleanFunc sets the function that is called whenever window is actually about to close (irrevocably) -- can do any necessary last-minute cleanup here.
func (*Window) SetCloseReqFunc ¶ added in v0.9.7
SetCloseReqFunc sets the function that is called whenever there is a request to close the window (via a OS or a call to CloseReq() method). That function can then adjudicate whether and when to actually call Close.
func (*Window) SetDelPopup ¶
SetDelPopup sets the popup to delete next time through event loop
func (*Window) SetFocusActiveState ¶ added in v0.9.11
SetFocusActiveState sets focus active flag to given state
func (*Window) SetMainFrame ¶
SetMainFrame sets the main widget of this window as a Frame, with a default column-wise vertical layout and max stretch sizing, and returns that frame.
func (*Window) SetMainLayout ¶
SetMainLayout sets the main widget of this window as a Layout, with a default column-wise vertical layout and max stretch sizing, and returns it.
func (*Window) SetMainWidget ¶
SetMainWidget sets given widget as the main widget for the window -- adds into MasterVLay after main menu -- if a main widget has already been set then it is deleted and this one replaces it. Use this method to ensure future compatibility.
func (*Window) SetMainWidgetType ¶
SetMainWidgetType sets the main widget of this window to given type (typically a Layout or Frame), and returns it. Adds into MasterVLay after main menu -- if a main widget has already been set then it is deleted and this one replaces it. Use this method to ensure future compatibility.
func (*Window) SetName ¶
SetName sets name of this window and also the OSWin, and applies any window geometry settings associated with the new name if it is different from before
func (*Window) SetNextPopup ¶
SetNextPopup sets the next popup, and what to focus on in that popup if non-nil
func (*Window) SetPixSize ¶ added in v0.9.10
SetPixSize requests that the window be resized to the given size in underlying pixel coordinates, which means that the requested size is divided by the screen's DevicePixelRatio
func (*Window) SetSize ¶
SetSize requests that the window be resized to the given size in OS window manager specific coordinates, which may be different from the underlying pixel-level resolution of the window. This will trigger a resize event and be processed that way when it occurs.
func (*Window) SetWinUpdating ¶
func (w *Window) SetWinUpdating()
SetWinUpdating sets the window updating state to true if not already updating
func (*Window) ShouldDeletePopupMenu ¶
ShouldDeletePopupMenu returns true if the given popup item should be deleted
func (*Window) SpriteByName ¶ added in v0.9.5
SpriteByName returns a sprite by name -- false if not created yet
func (*Window) StartDragNDrop ¶
StartDragNDrop is called by a node to start a drag-n-drop operation on given source node, which is responsible for providing the data and Sprite representation of the node.
func (*Window) StartEventLoop ¶
func (w *Window) StartEventLoop()
StartEventLoop is the main startup method to call after the initial window configuration is setup -- does any necessary final initialization and then starts the event loop in this same goroutine, and does not return until the window is closed -- see GoStartEventLoop for a version that starts in a separate goroutine and returns immediately.
func (*Window) StopEventLoop ¶
func (w *Window) StopEventLoop()
StopEventLoop tells the event loop to stop running when the next event arrives.
func (*Window) TriggerShortcut ¶
TriggerShortcut attempts to trigger a shortcut, returning true if one was triggered, and false otherwise. Also eliminates any shortcuts with deleted actions, and does not trigger for Inactive actions.
func (*Window) UploadAllViewports ¶
func (w *Window) UploadAllViewports()
UploadAllViewports does a complete upload of all active viewports, in the proper order, so as to completely refresh the window texture based on everything rendered
func (*Window) UploadVp ¶
func (w *Window) UploadVp(vp *Viewport2D, offset image.Point)
UploadVp uploads entire viewport image for given viewport -- e.g., for popups etc updating separately
func (*Window) UploadVpRegion ¶
func (w *Window) UploadVpRegion(vp *Viewport2D, vpBBox, winBBox image.Rectangle)
UploadVpRegion uploads image for one viewport region on the screen, using vpBBox bounding box for the viewport, and winBBox bounding box for the window -- called after re-rendering specific nodes to update only the relevant part of the overall viewport image
func (*Window) WinViewport2D ¶
func (w *Window) WinViewport2D() *Viewport2D
WinViewport2D returns the viewport directly under this window that serves as the master viewport for the entire window.
type WindowDrawers ¶ added in v1.3.0
type WindowDrawers struct { StartIdx int `desc:"starting index for this set of Nodes"` MaxIdx int `desc:"max index (exclusive) for this set of Nodes"` FlipY bool `desc:"set to true to flip Y axis in drawing these images"` Nodes *ordmap.Map[*NodeBase, image.Rectangle] `desc:"ordered map of nodes with window bounding box"` }
WindowDrawers are a list of gi.Node objects that draw directly to the window. This list manages the index for the vdraw image index holding this image.
func (*WindowDrawers) Add ¶ added in v1.3.0
Add adds a new node, returning index to store for given winBBox (could be existing), and bool = true if new index exceeds max range
func (*WindowDrawers) Delete ¶ added in v1.3.0
func (wu *WindowDrawers) Delete(node Node)
Delete removes given node from list of drawers
func (*WindowDrawers) DrawImages ¶ added in v1.3.0
func (wu *WindowDrawers) DrawImages(drw *vdraw.Drawer)
DrawImages iterates over regions and calls Copy on given vdraw.Drawer for each region
func (*WindowDrawers) Idx ¶ added in v1.3.0
func (wu *WindowDrawers) Idx(idx int) int
Idx returns the given 0-based index plus StartIdx
func (*WindowDrawers) Init ¶ added in v1.3.0
func (wu *WindowDrawers) Init()
Init checks if ordered map needs to be allocated
func (*WindowDrawers) Reset ¶ added in v1.3.0
func (wu *WindowDrawers) Reset()
Reset resets the ordered map
func (*WindowDrawers) SetIdxRange ¶ added in v1.3.0
func (wu *WindowDrawers) SetIdxRange(st, n int)
SetIdxRange sets the index range based on starting index and n
func (*WindowDrawers) SetWinBBox ¶ added in v1.3.0
func (wu *WindowDrawers) SetWinBBox(idx int, bbox image.Rectangle)
SetWinBBox sets the window BBox for given element, indexed by its allocated index relative to StartIdx
type WindowGeom ¶
WindowGeom records the geometry settings used for a given window
func (*WindowGeom) FitInSize ¶ added in v0.9.10
func (wg *WindowGeom) FitInSize(sz image.Point)
func (*WindowGeom) Pos ¶
func (wg *WindowGeom) Pos() image.Point
func (*WindowGeom) ScalePos ¶ added in v0.9.10
func (wg *WindowGeom) ScalePos(fact float32)
func (*WindowGeom) ScaleSize ¶ added in v0.9.10
func (wg *WindowGeom) ScaleSize(fact float32)
func (*WindowGeom) SetPos ¶ added in v0.9.10
func (wg *WindowGeom) SetPos(ps image.Point)
func (*WindowGeom) SetSize ¶ added in v0.9.10
func (wg *WindowGeom) SetSize(sz image.Point)
func (*WindowGeom) Size ¶
func (wg *WindowGeom) Size() image.Point
type WindowGeomPrefs ¶
type WindowGeomPrefs map[string]map[string]WindowGeom
WindowGeomPrefs records the window geometry by window name, screen name -- looks up the info automatically for new windows and saves persistently
func (*WindowGeomPrefs) DeleteAll ¶
func (wg *WindowGeomPrefs) DeleteAll()
DeleteAll deletes the file that saves the position and size of each window, by screen, and clear current in-memory cache. You shouldn't need to use this but sometimes useful for testing.
func (*WindowGeomPrefs) LockFile ¶
func (wg *WindowGeomPrefs) LockFile() error
LockFile attempts to create the win_geom_prefs lock file
func (*WindowGeomPrefs) NeedToReload ¶
func (wg *WindowGeomPrefs) NeedToReload() bool
NeedToReload returns true if the last save time of prefs file is more recent than when we last saved
func (*WindowGeomPrefs) Open ¶
func (wg *WindowGeomPrefs) Open() error
Open Window Geom preferences from GoGi standard prefs directory called under mutex or at start
func (*WindowGeomPrefs) Pref ¶
func (wg *WindowGeomPrefs) Pref(winName string, scrn *oswin.Screen) *WindowGeom
Pref returns an existing preference for given window name, or one adapted to given screen if only records are on a different screen -- if scrn is nil then default (first) screen is used from oswin.TheApp if the window name has a colon, only the part prior to the colon is used
func (*WindowGeomPrefs) RecordPref ¶
func (wg *WindowGeomPrefs) RecordPref(win *Window)
RecordPref records current state of window as preference
func (*WindowGeomPrefs) Save ¶
func (wg *WindowGeomPrefs) Save() error
Save Window Geom Preferences to GoGi standard prefs directory assumed to be under mutex and lock still
func (*WindowGeomPrefs) SaveLastSave ¶
func (wg *WindowGeomPrefs) SaveLastSave()
SaveLastSave saves timestamp (now) of last save to win geom
func (*WindowGeomPrefs) UnlockFile ¶
func (wg *WindowGeomPrefs) UnlockFile()
UnLockFile unlocks the win_geom_prefs lock file (just removes it)
type WindowList ¶
type WindowList []*Window
WindowList is a list of windows.
var AllWindows WindowList
AllWindows is the list of all windows that have been created (dialogs, main windows, etc).
var DialogWindows WindowList
DialogWindows is the list of only dialog windows that have been created.
var MainWindows WindowList
MainWindows is the list of main windows (non-dialogs) that have been created.
func (*WindowList) Delete ¶
func (wl *WindowList) Delete(w *Window) bool
Delete removes a window from the list -- returns true if deleted.
func (*WindowList) FindData ¶ added in v0.9.10
func (wl *WindowList) FindData(data interface{}) (*Window, bool)
FindData finds window with given Data on list -- returns window and true if found, nil, false otherwise. data of type string works fine -- does equality comparison on string contents.
func (*WindowList) FindName ¶
func (wl *WindowList) FindName(name string) (*Window, bool)
FindName finds window with given name on list (case sensitive) -- returns window and true if found, nil, false otherwise.
func (*WindowList) FindOSWin ¶ added in v0.9.11
func (wl *WindowList) FindOSWin(osw oswin.Window) (*Window, bool)
FindOSWin finds window with given oswin.Window on list -- returns window and true if found, nil, false otherwise.
func (*WindowList) FocusNext ¶
func (wl *WindowList) FocusNext() (*Window, int)
FocusNext focuses on the next window in the list, after the current Focused() one skips minimized windows
func (*WindowList) Focused ¶
func (wl *WindowList) Focused() (*Window, int)
Focused returns the (first) window in this list that has the WinFlagGotFocus flag set and the index in the list (nil, -1 if not present)
func (*WindowList) Len ¶
func (wl *WindowList) Len() int
Len returns the length of the list, concurrent-safe
func (*WindowList) Win ¶
func (wl *WindowList) Win(idx int) *Window
Win gets window at given index, concurrent-safe
type WindowUpdates ¶ added in v1.3.0
type WindowUpdates struct { StartIdx int `desc:"starting index for this set of regions"` MaxIdx int `desc:"max index (exclusive) for this set of regions"` Order []int `desc:"order of updates to draw -- when an existing image is updated it goes to the top of the stack."` BeforeDir []int `desc:"updates that must be drawn before direct uploads because they fully occlude them"` Updates *ordmap.Map[image.Rectangle, *Viewport2D] `desc:"ordered map of updates -- order (indx) is the image"` }
WindowUpdates are a list of window update regions -- manages the index for a window bounding box region, which corresponds to the vdraw image index holding this image. Automatically handles range issues.
func (*WindowUpdates) Add ¶ added in v1.3.0
func (wu *WindowUpdates) Add(winBBox image.Rectangle, vp *Viewport2D) (int, bool)
Add adds a new update, returning index to store for given winBBox (could be existing), and bool = true if new index exceeds max range. If it is an exact match for an existing bbox, then that is returned.
func (*WindowUpdates) DrawImages ¶ added in v1.3.0
func (wu *WindowUpdates) DrawImages(drw *vdraw.Drawer, beforeDir bool)
DrawImages iterates over regions and calls Copy on given vdraw.Drawer for each region. beforeDir calls items on the BeforeDir list, else regular Order.
func (*WindowUpdates) Idx ¶ added in v1.3.0
func (wu *WindowUpdates) Idx(idx int) int
Idx returns the given 0-based index plus StartIdx
func (*WindowUpdates) Init ¶ added in v1.3.0
func (wu *WindowUpdates) Init()
Init checks if ordered map needs to be allocated
func (*WindowUpdates) MoveIdxToBeforeDir ¶ added in v1.3.0
func (wu *WindowUpdates) MoveIdxToBeforeDir(idx int)
MoveIdxToBeforeDir moves the given index to the BeforeDir list
func (*WindowUpdates) MoveIdxToTop ¶ added in v1.3.0
func (wu *WindowUpdates) MoveIdxToTop(idx int)
MoveIdxToTop moves the given index to top of the order
func (*WindowUpdates) Reset ¶ added in v1.3.0
func (wu *WindowUpdates) Reset()
Reset resets the ordered map
func (*WindowUpdates) SetIdxRange ¶ added in v1.3.0
func (wu *WindowUpdates) SetIdxRange(st, n int)
SetIdxRange sets the index range based on starting index and n
Source Files ¶
- action.go
- bars.go
- bitmap.go
- buttonbox.go
- buttonflags_string.go
- buttons.go
- buttonsignals_string.go
- buttonstates_string.go
- combobox.go
- complete.go
- completesignals_string.go
- css.go
- dialogs.go
- dialogstate_string.go
- dndstages_string.go
- doc.go
- eventpris_string.go
- events.go
- focuschanges_string.go
- frame.go
- geom2d.go
- geom3d.go
- gradient.go
- icon.go
- interfaces.go
- keyfun.go
- keyfuns_string.go
- label.go
- labelstates_string.go
- layout.go
- layout_impl.go
- layouts_string.go
- menus.go
- names.go
- node.go
- node2d.go
- nodeflags_string.go
- prefs.go
- rowcol_string.go
- sliders.go
- slidersignals_string.go
- sliderstates_string.go
- spell.go
- spellsignals_string.go
- spinbox.go
- splitview.go
- sprite.go
- stripes_string.go
- tabview.go
- tabviewsignals_string.go
- textfield.go
- textfieldsignals_string.go
- textfieldstates_string.go
- version.go
- viewport.go
- views.go
- vpflags_string.go
- widget.go
- widgetsignals_string.go
- window.go
- winflags_string.go
- wingeom.go
- winlists.go